[Spice-devel] [spice-gtk v3] gtk-deprecated: silence warn on gtk_widget_set_double_buffered()

Frediano Ziglio fziglio at redhat.com
Wed Jul 25 11:17:15 UTC 2018


> 
> From: Victor Toso <me at victortoso.com>
> 
> By default, all widgets are double buffered so this patch removes two
> calls to gtk_widget_set_double_buffered() that are only enabling it.
> 
> The only special case is under egl (virgl) at set_egl_enabled() as
> disabling the double buffered seems to prevent glitches. The call to
> gtk_widget_set_double_buffered() was kept but wrapped under
> G_GNUC_BEGIN/END_IGNORE_DEPRECATIONS to avoid warnings.
> 
> Note however that this is only expected to work under X11.
> 
> 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>

Acked-by: Frediano Ziglio <fziglio at redhat.com>

Frediano

> ---
>  src/spice-widget.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index 24c42a8..853c9df 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -637,7 +637,6 @@ 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);
>      gtk_stack_set_visible_child(d->stack, area);
>  
>  #if HAVE_EGL
> @@ -652,7 +651,6 @@ static void spice_display_init(SpiceDisplay *display)
>  #endif
>      area = gtk_drawing_area_new();
>      gtk_stack_add_named(d->stack, area, "gst-area");
> -    gtk_widget_set_double_buffered(area, true);
>  
>      gtk_widget_show_all(widget);
>  
> @@ -1277,7 +1275,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
>      {


More information about the Spice-devel mailing list