[Spice-devel] [PATCH] spice-widget: Don't return early from focus_in_event when widget is not realized

Pavel Grunt pgrunt at redhat.com
Fri Jan 23 08:54:56 PST 2015


Otherwise SpiceDisplay might not get the keyboard grab.
It also silence GSpice-CRITICAL on focus out event:
GSpice-CRITICAL **: spice_gtk_session_request_auto_usbredir: assertion 's->auto_usbredir_reqs > 0' failed
---
 gtk/spice-widget.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 3a2be87..147271c 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1475,9 +1475,6 @@ static gboolean focus_in_event(GtkWidget *widget, GdkEventFocus *focus G_GNUC_UN
 
     SPICE_DEBUG("%s", __FUNCTION__);
 
-    if (!gtk_widget_get_realized(widget))
-        return true;
-
     /*
      * Ignore focus in when we already have the focus
      * (this happens when doing an ungrab from the leave_event callback).
@@ -1492,7 +1489,9 @@ static gboolean focus_in_event(GtkWidget *widget, GdkEventFocus *focus G_GNUC_UN
         memset(d->activeseq, 0, sizeof(gboolean) * d->grabseq->nkeysyms);
     update_keyboard_focus(display, true);
     try_keyboard_grab(display);
-    update_display(display);
+
+    if (gtk_widget_get_realized(widget))
+        update_display(display);
 
     return true;
 }
-- 
1.9.3



More information about the Spice-devel mailing list