GNOME Bugzilla – Bug 788367
Using GtkSocket and GtkPlug result in flickering while drawing
Last modified: 2018-05-02 19:10:21 UTC
Hi Gtk team, Steps to Reproduce: Create a GtkWindow with a GtkSocket child and a GtkPlug with a GtkDrawingArea attached and connected both. Continuously draw on the GtkDrawingArea by creating an idle callback. Actual results: The GtkWindow starts flickering constantly. Additional info: A demo app can be found here: https://github.com/rehans/GtkSocketPlugDemo While this demo works on Ubuntu 16.04 (tested on 3 PCs) with libgtk-3-0:amd64 3.18.9-1ubuntu3.3 amd64 GTK+ graphical user interface library it starts flickering constantly on Ubuntu 17.04 with libgtk-3-0:amd64 3.22.11-0ubuntu3 amd64 GTK+ graphical user interface library The Raspberry PI 3 with (Debian Stretch installed) shows the same behavior like Ubuntu 17.04 with libgtk-3-0:armhf 3.22.11-1+rpi3 armhf GTK+ graphical user interface library The issue is discussed in further detail on the mailing list: https://mail.gnome.org/archives/gtk-list/2017-September/msg00112.html René
Hi Rene, In gdkwindow.c there is a condition in two places(gdk_window_begin_draw_frame() and gdk_window_end_draw_frame()) if (gdk_window_has_native (window) && gdk_window_is_toplevel (window)) that the drawing area in the plug doesn't pass. The first condition can be made true by using gdk_window_ensure_native() either in the application code or it could be set in gtkwidget.c, gtk_widget_render(). Something like if (is_double_buffered) { GtkWidget *top = gtk_widget_get_ancestor (widget, GTK_TYPE_PLUG); if (top != NULL) gdk_window_ensure_native (window); for gdk_window_is_toplevel it seems a little more difficult to pass. If I use gdk_window_ensure_native() and ignore gdk_window_is_toplevel() the test code with the plug and drawing area draws without flicker. This is as far as I have got on this one. Have made some progress but have a ways to go before figuring it out. Eric
If the two lines in gdkwindow.c if (gdk_window_has_native (window) && gdk_window_is_toplevel (window)) get changed to if (gdk_window_has_native (window) && window->toplevel_window_type == -1) and the GdkWindow is set to native with gtk_widget_show_all(plug); GdkWindow *win=gtk_widget_get_window(drawing_area); gdk_window_ensure_native(win); in the application, then the double buffering works with the drawing area in the plug with minimal code changes. Is (window->toplevel_window_type == -1) a suitable replacement for (gdk_window_is_toplevel (window))? Eric
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/927.