From 1d12ad20cbd07b0aeb49ac9544de451c9f43f04c Mon Sep 17 00:00:00 2001 From: Seray Rosh Date: Fri, 27 Feb 2015 16:02:40 +0100 Subject: [PATCH 2/2] release keys when xfreerdp is unfocused to prevent stuck keys https://github.com/FreeRDP/FreeRDP/issues/2104 https://github.com/FreeRDP/FreeRDP/pull/2430 Backported by Ondrej Holy . --- client/X11/xf_event.c | 2 ++ client/X11/xf_keyboard.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/client/X11/xf_event.c b/client/X11/xf_event.c index cbcfc65..1475214 100644 --- a/client/X11/xf_event.c +++ b/client/X11/xf_event.c @@ -356,6 +356,8 @@ boolean xf_event_FocusOut(xfInfo* xfi, XEvent* event, boolean app) if (event->xfocus.mode == NotifyWhileGrabbed) XUngrabKeyboard(xfi->display, CurrentTime); + xf_kbd_release_all_keypress(xfi); + if (app) xf_rail_send_activate(xfi, event->xany.window, false); diff --git a/client/X11/xf_keyboard.c b/client/X11/xf_keyboard.c index e94b362..fb14015 100644 --- a/client/X11/xf_keyboard.c +++ b/client/X11/xf_keyboard.c @@ -63,6 +63,11 @@ void xf_kbd_release_all_keypress(xfInfo* xfi) { rdp_scancode = freerdp_kbd_get_scancode_by_keycode(keycode, &extended); + // release tab before releasing the windows key. + // this stops the start menu from opening on unfocus event. + if (rdp_scancode == 0x5B && extended) /* Left Windows Key */ + xfi->instance->input->KeyboardEvent(xfi->instance->input, KBD_FLAGS_RELEASE, 0x0F); /* Tab up */ + flags = KBD_FLAGS_RELEASE; flags |= (extended) ? KBD_FLAGS_EXTENDED : 0; xfi->instance->input->KeyboardEvent(xfi->instance->input, flags, rdp_scancode); -- 2.9.3