[Spice-devel] [PATCH spice-gtk] RFC: win32: do not handle win keys when the keyboard is not grabbed

Marc-André Lureau marcandre.lureau at gmail.com
Tue Apr 2 09:15:25 PDT 2013


Special-case on win32, filter out the win keys when not having the
keyboard grab. This is to avoid the win keys to be received both by
the guest and the client, which can be undesirable in general.

https://bugzilla.redhat.com/show_bug.cgi?id=873341
---
 gtk/spice-widget.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 324f5ee..233b49f 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1278,6 +1278,14 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key)
     /* on windows, we ought to ignore the reserved key event? */
     if (key->hardware_keycode == 0xff)
         return false;
+
+    if (!d->keyboard_grab_active) {
+        if (key->hardware_keycode == VK_LWIN ||
+            key->hardware_keycode == VK_RWIN ||
+            key->hardware_keycode == VK_APPS)
+            return false;
+    }
+
 #endif
     SPICE_DEBUG("%s %s: keycode: %d  state: %d  group %d modifier %d",
             __FUNCTION__, key->type == GDK_KEY_PRESS ? "press" : "release",
-- 
1.8.1.1.439.g50a6b54



More information about the Spice-devel mailing list