[Spice-devel] [spice-gtk 3/4] gtk-deprecated: silence warn on gtk_widget_set_double_buffered()
Victor Toso
victortoso at redhat.com
Fri Jul 20 16:04:11 UTC 2018
From: Victor Toso <me at victortoso.com>
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 at redhat.com>
---
src/spice-widget.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 6ad0865..dc8ee40 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -640,7 +640,13 @@ 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);
+#ifdef GDK_WINDOWING_X11
+ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ gtk_widget_set_double_buffered(area, true);
+ G_GNUC_END_IGNORE_DEPRECATIONS
+ }
+#endif
gtk_stack_set_visible_child(d->stack, area);
#if HAVE_EGL
@@ -658,7 +664,13 @@ 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);
+#ifdef GDK_WINDOWING_X11
+ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ gtk_widget_set_double_buffered(area, true);
+ G_GNUC_END_IGNORE_DEPRECATIONS
+ }
+#endif
gtk_widget_show_all(widget);
@@ -1281,7 +1293,9 @@ 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");
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_widget_set_double_buffered(GTK_WIDGET(area), !enabled);
+ G_GNUC_END_IGNORE_DEPRECATIONS
} else
#endif
{
--
2.17.1
More information about the Spice-devel
mailing list