[Spice-devel] [spice-gtk v1] widget: check if widget is realized before gdk_set_grab()

Victor Toso victortoso at redhat.com
Mon Mar 6 14:29:14 UTC 2017


From: Victor Toso <me at victortoso.com>

gdk_seat_grab() expects that the widget is visible otherwise it will
always fail with GDK_GRAB_NOT_VIEWABLE. This means that we can check if
display is realized before running gdk_seat_grab().

Fixes a critical & warning introduced by 3f4c5bcc88ca5db125e

 > Gdk-CRITICAL **: Window 0x17dcca0 has not been made visible in
 > GdkSeatGrabPrepareFunc
 > GSpice-WARNING **: keyboard grab failed 3

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 src/spice-widget.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/spice-widget.c b/src/spice-widget.c
index 9a7ea56..ff9c7d2 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -856,6 +856,8 @@ static void try_keyboard_grab(SpiceDisplay *display)
         return;
     if (d->keyboard_grab_released)
         return;
+    if (!gtk_widget_get_realized(GTK_WIDGET(display)))
+        return;
 
     g_return_if_fail(gtk_widget_is_focus(widget));
 
-- 
2.9.3



More information about the Spice-devel mailing list