Files
webview_cef/linux/webview_cef_texture.h
SinyimZhi 6f6ed6db81 Linux Support! (#88)
* init platform linux

* +linux

* fix cmake link problem

* run cef window on linux (#66)

Co-authored-by: zhixinyan <zhixinyan@baidu.com>

* linux auto download prebuilt files

* off-screen rendering,methodchannel... (#69)

* run cef window on linux

* linux auto download prebuilt files

* off-screen rendering,methodchannel

---------

Co-authored-by: zhixinyan <zhixinyan@baidu.com>

* fix warnings & compile err

* process keyevent for linux

* Merge main to linux (#73)

* Added cookie visitor to manage cookies

* Added cookie visitor to manage cookies

* Macos support cookie visitor

---------

Co-authored-by: zhixinyan <zhixinyan@baidu.com>

* fix opengl support, add support file

* bump ver to 0.0.9

* let CEF detect how to load a specific url

Current example implementation blocked local file loading.

* Jsbridge (#2)

support jsbridge/jschannel

* check bins files are newest version or not

* bump ver to 0.1.0

* bump ver to 0.1.0

* [mac] fix x86 mac frame blink

* Update Instructions of macOS

on macOS, manual work has to be done for placing CEF lib inside the repo. So we can not use the plugin directly as of now.

---------

Co-authored-by: zhixinyan <zhixinyan@baidu.com>
Co-authored-by: Prome <levi.hao96@gmail.com>
Co-authored-by: BullsEye <18664297+BullsEye34@users.noreply.github.com>

* unified windows and linux interface

* fixed some methodchannel bugs

* solve channel run in muti-thread casue some crash

* try to solve cef grab gtk main loop cause crash

* provide arm64 prebuilt package

* fix character type convert errors

* rebuild the data struct of unified interface

* fix build errors on linux

* fix build errors on linux

* unified interface for all three platforms!

* fix build error

---------

Co-authored-by: Prome <levi.hao96@gmail.com>
Co-authored-by: zhixinyan <zhixinyan@baidu.com>
Co-authored-by: BullsEye <18664297+BullsEye34@users.noreply.github.com>
2023-11-17 16:57:30 +08:00

59 lines
1.9 KiB
C

#ifndef WEBVIEW_CEF_TEXTURE_H_
#define WEBVIEW_CEF_TEXTURE_H_
#include <flutter_linux/flutter_linux.h>
#include <gtk/gtk.h>
struct WebviewCefTexture{
FlPixelBufferTexture parent_instance;
uint8_t *buffer = nullptr; // your pixel buffer.
uint32_t width = 0;
uint32_t height = 0;
};
struct WebviewCefTextureClass{
FlPixelBufferTextureClass parent_class;
};
G_DEFINE_TYPE(WebviewCefTexture,
webview_cef_texture,
fl_pixel_buffer_texture_get_type())
#define WEBVIEW_CEF_TEXTURE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), webview_cef_texture_get_type(), WebviewCefTexture))
static gboolean webview_cef_texture_copy_pixels(FlPixelBufferTexture *texture,
const uint8_t **out_buffer,
uint32_t *width,
uint32_t *height,
GError **error) {
// This method is called on Render Thread. Be careful with your
// cross-thread operation.
// @width and @height are initially stored the canvas size in Flutter.
// You must prepare your pixel buffer in RGBA format.
// So you may do some format conversion first if your original pixel
// buffer is not in RGBA format.
WebviewCefTexture *_texture = WEBVIEW_CEF_TEXTURE(texture);
if(_texture == nullptr){
return TRUE;
}
*out_buffer = _texture->buffer;
*width = _texture->width;
*height = _texture->height;
return TRUE;
}
static WebviewCefTexture* webview_cef_texture_new(){
return WEBVIEW_CEF_TEXTURE(g_object_new(webview_cef_texture_get_type(), nullptr));
}
static void webview_cef_texture_class_init(WebviewCefTextureClass *klass)
{
FL_PIXEL_BUFFER_TEXTURE_CLASS(klass)->copy_pixels = webview_cef_texture_copy_pixels;
}
static void webview_cef_texture_init(WebviewCefTexture *self) {}
#endif // WEBVIEW_CEF_TEXTURE_H_