[Spice-devel] [PATCH spice-gtk] win32: don't block key up events

Marc-André Lureau marcandre.lureau at gmail.com
Thu May 23 06:42:57 PDT 2013


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
---
 gtk/spice-widget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index c05b600..04a90e6 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;
 
-- 
1.8.3.rc1.49.g8d97506



More information about the Spice-devel mailing list