cog icon indicating copy to clipboard operation
cog copied to clipboard

gtk4: implement custom Widget for WebView rendering

Open philn opened this issue 4 years ago • 3 comments

As a future improvement idea, I suppose that instead of using GtkGLArea maybe it could be possible to implement a GtkWidget which would use gtk_snapshot_append_texture() to directly pass the GL texture, and let GTK do the compositing—we would not need to provide shaders to scan out the texture when painting a quad using GL calls, and if I understand correctly it should be faster because GtkGLArea paints to a FBO backed by a texture, and then that texture is snapshotted by the `GtkGLArea widget implementation.

Originally posted by @aperezdc in https://github.com/Igalia/cog/pull/262#discussion_r589310427

philn avatar Mar 08 '21 12:03 philn

With the current approach we can't select text. I think we should consider this new approach sooner than later :)

philn avatar Apr 19 '21 11:04 philn

With the current approach we can't select text. I think we should consider this new approach sooner than later :)

Ah well, maybe a different rendering approach wouldn't help much with this specific issue.

philn avatar Apr 19 '21 11:04 philn

This comment in the GTK GitLab shows how to import a DMA-BUF as a texture that then can be passed to GTK as an snapshot. It should work both for Wayland and X11 after this change in GTK to prefer EGL.

(Of course it should be possible to use EGLImage, there is no need to go all-in and use DMA-BUF to implement a widget, but it seemed interesting to share.)

aperezdc avatar May 11 '21 20:05 aperezdc