[Spice-devel] [PATCH spice-gtk] widget: Always call gtk_widget_show_all

Christophe Fergeau cfergeau at redhat.com
Mon Mar 27 12:43:34 UTC 2017


On Mon, Mar 27, 2017 at 01:36:57PM +0200, Pavel Grunt wrote:
> Since spice-gtk 0.32 SpiceDisplay widget internally has changed
> from the GtkDrawingArea to a GtkContainer.
> 
> Per gtk_widget_show documentation:
>  "Remember that you have to show the containers containing a widget,
>   in addition to the widget itself, before it will appear onscreen."
> 
> Let's always call gtk_widget_show_all, not just for Gtk >= 3.16

I'd mention in th e log that otherwise you get a blackscreen with spice-gtk
compiled against an old gtk+ version.

Christophe

> 
> Fixes:
> https://bugs.freedesktop.org/show_bug.cgi?id=100251
> ---
>  src/spice-widget.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index 5cc1553..5bbba8f 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -648,28 +648,28 @@ static void spice_display_init(SpiceDisplay *display)
>  #if GTK_CHECK_VERSION(3,16,0)
>  #ifndef G_OS_WIN32
>  /* Ignore GLib's too-new warnings */
>  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      area = gtk_gl_area_new();
>      gtk_gl_area_set_required_version(GTK_GL_AREA(area), 3, 2);
>      gtk_gl_area_set_auto_render(GTK_GL_AREA(area), false);
>      g_object_connect(area,
>                       "signal::render", gl_area_render, display,
>                       "signal::realize", gl_area_realize, display,
>                       NULL);
>      gtk_stack_add_named(d->stack, area, "gl-area");
> -    gtk_widget_show_all(widget);
>  G_GNUC_END_IGNORE_DEPRECATIONS
>  #endif
>  #endif
> +    gtk_widget_show_all(widget);
>  
>      g_signal_connect(display, "grab-broken-event", G_CALLBACK(grab_broken), NULL);
>      g_signal_connect(display, "grab-notify", G_CALLBACK(grab_notify), NULL);
>  
>      gtk_drag_dest_set(widget, GTK_DEST_DEFAULT_ALL, &targets, 1, GDK_ACTION_COPY);
>      g_signal_connect(display, "drag-data-received",
>                       G_CALLBACK(drag_data_received_callback), NULL);
>      g_signal_connect(display, "size-allocate", G_CALLBACK(size_allocate), NULL);
>  
>      gtk_widget_add_events(widget,
>                            GDK_POINTER_MOTION_MASK |
>                            GDK_BUTTON_PRESS_MASK |
> -- 
> 2.12.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170327/3ef06248/attachment.sig>


More information about the Spice-devel mailing list