[Spice-commits] 2 commits - gtk/spice-widget.c

Marc-André Lureau elmarco at kemper.freedesktop.org
Fri Jun 14 08:01:02 PDT 2013


 gtk/spice-widget.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 5f67178c9602ed43f83f35a6d3097eb137244493
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Thu May 23 15:35:00 2013 +0200

    win32: don't block key up events
    
    The win32 ll keyboard hook avoid Windows and other application to
    receive global keyboard events. But some key combinations can't be
    filtered, such as Win+L. However, the windows lock screen doesn't catch
    that the Win key is released, when virt-viewer still holds the hook and
    filters it.
    
    So pressing Win+L quickly will lock the screen, but some key press in
    the password entry will still be handled as if the Win key was pressed,
    such as Win+P or Win+U and probably other, and prevents user from typing
    his password.
    
    The only working solution I could find is to just let go all the release
    key events in the hook. There doesn't seem any drawback with that.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=917986

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 1b5f8c3..d25edca 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -659,7 +659,7 @@ void spice_display_set_grab_keys(SpiceDisplay *display, SpiceGrabSequence *seq)
 #ifdef WIN32
 static LRESULT CALLBACK keyboard_hook_cb(int code, WPARAM wparam, LPARAM lparam)
 {
-    if  (win32_window && code == HC_ACTION) {
+    if  (win32_window && code == HC_ACTION && wparam == WM_KEYDOWN) {
         KBDLLHOOKSTRUCT *hooked = (KBDLLHOOKSTRUCT*)lparam;
         DWORD dwmsg = (hooked->flags << 24) | (hooked->scanCode << 16) | 1;
 
commit 0fb74ae1a7fd8ffbf0d353bb5e5c7c2aabd1ab27
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Thu May 23 01:47:01 2013 +0200

    widget: release keys on grab-broken
    
    This is similar to 8cbd5d745c221f788878c9c713f3b46a25828d3f and can be
    reproduced by pressing Win+l while the widget has the keyboard
    grab (pointer over the display).
    
    I have not reproduced implicit grab-broken event, I suppose they could
    happen if the grab is stolen from within the app. In any case, it's
    probably better to release the keys.
    
    This is related to:
    https://bugzilla.redhat.com/show_bug.cgi?id=917986

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 4c67e26..1b5f8c3 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -482,6 +482,7 @@ static gboolean grab_broken(SpiceDisplay *self, GdkEventGrabBroken *event,
 
     if (event->keyboard) {
         try_keyboard_ungrab(self);
+        release_keys(self);
     }
 
     /* always release mouse when grab broken, this could be more


More information about the Spice-commits mailing list