From: Victor Toso <me@xxxxxxxxxxxxxx> To quote documentation: | gtk_widget_set_double_buffered has been deprecated since version | 3.14 and should not be used in newly-written code. | This function does not work under non-X11 backends or with | non-native windows. It should not be used in newly written code. So be sure to only call this function on X11 backend and silence warnings with G_GNUC_BEGIN/END_IGNORE_DEPRECATIONS Warnings fixed: | spice-widget.c: In function ‘spice_display_init’: | spice-widget.c:643:5: warning: ‘gtk_widget_set_double_buffered’ is | deprecated | | gtk_widget_set_double_buffered(area, true); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | spice-widget.c:661:5: warning: ‘gtk_widget_set_double_buffered’ is | deprecated | | gtk_widget_set_double_buffered(area, true); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | spice-widget.c: In function ‘set_egl_enabled’: | spice-widget.c:1290:9: warning: ‘gtk_widget_set_double_buffered’ is | deprecated | gtk_widget_set_double_buffered(GTK_WIDGET(area), !enabled); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx> --- src/spice-widget.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/spice-widget.c b/src/spice-widget.c index ce123bd..bf10a0b 100644 --- a/src/spice-widget.c +++ b/src/spice-widget.c @@ -104,6 +104,18 @@ static guint signals[SPICE_DISPLAY_LAST_SIGNAL]; static HWND win32_window = NULL; #endif +#ifdef GDK_WINDOWING_X11 +#define SET_DOUBLE_BUFFERED_ON_X11(widget, enabled) G_STMT_START { \ + if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) { \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + gtk_widget_set_double_buffered(widget, enabled); \ + G_GNUC_END_IGNORE_DEPRECATIONS \ + } \ +} G_STMT_END +#else +#define SET_DOUBLE_BUFFERED_ON_X11(widget, enabled) G_STMT_START { } G_STMT_END +#endif + static void update_keyboard_grab(SpiceDisplay *display); static void try_keyboard_grab(SpiceDisplay *display); static void try_keyboard_ungrab(SpiceDisplay *display); @@ -640,7 +652,7 @@ static void spice_display_init(SpiceDisplay *display) "signal::realize", drawing_area_realize, display, NULL); gtk_stack_add_named(d->stack, area, "draw-area"); - gtk_widget_set_double_buffered(area, true); + SET_DOUBLE_BUFFERED_ON_X11(area, true); gtk_stack_set_visible_child(d->stack, area); #if HAVE_EGL @@ -658,7 +670,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS #endif area = gtk_drawing_area_new(); gtk_stack_add_named(d->stack, area, "gst-area"); - gtk_widget_set_double_buffered(area, true); + SET_DOUBLE_BUFFERED_ON_X11(area, true); gtk_widget_show_all(widget); @@ -1281,7 +1293,7 @@ static void set_egl_enabled(SpiceDisplay *display, bool enabled) * only way I found to prevent glitches when the window is * resized. */ GtkWidget *area = gtk_stack_get_child_by_name(d->stack, "draw-area"); - gtk_widget_set_double_buffered(GTK_WIDGET(area), !enabled); + SET_DOUBLE_BUFFERED_ON_X11(GTK_WIDGET(area), !enabled); } else #endif { -- 2.17.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel