[Spice-devel] [PATCH spice-gtk 1/2] Do not send ungrab key sequence to the server

Marc-André Lureau marcandre.lureau at gmail.com
Fri Dec 9 08:03:19 PST 2011


---
 gtk/spice-widget.c |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 9e45979..3c2f6c0 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -876,6 +876,16 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key)
             __FUNCTION__, key->type == GDK_KEY_PRESS ? "press" : "release",
             key->hardware_keycode, key->state, key->group);
 
+    if (check_for_grab_key(display, key->type, key->keyval) &&
+        d->mouse_mode == SPICE_MOUSE_MODE_SERVER) {
+        g_signal_emit(widget, signals[SPICE_DISPLAY_GRAB_KEY_PRESSED], 0);
+        if (d->mouse_grab_active)
+            try_mouse_ungrab(display);
+        else
+            try_mouse_grab(display);
+        return true;
+    }
+
     if (!d->inputs)
         return true;
 
@@ -892,17 +902,6 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key)
         break;
     }
 
-    if (check_for_grab_key(display, key->type, key->keyval)) {
-        g_signal_emit(widget, signals[SPICE_DISPLAY_GRAB_KEY_PRESSED], 0);
-        if (d->mouse_grab_active)
-            try_mouse_ungrab(display);
-        else
-            /* TODO: gtk-vnc has a weird condition here
-               if (!d->grab_keyboard || !d->absolute) */
-            try_mouse_grab(display);
-    }
-
-
     return true;
 }
 
-- 
1.7.7.3



More information about the Spice-devel mailing list