|
|
56112c |
From 4db610f292aca3ae4ed0bb59ed1972202a1c6b27 Mon Sep 17 00:00:00 2001
|
|
|
56112c |
From: Vic Lee <llyzs@163.com>
|
|
|
56112c |
Date: Wed, 11 Apr 2012 12:37:47 +0800
|
|
|
56112c |
Subject: [PATCH 1/2] x11: release all pressed keys when window is unmapped.
|
|
|
56112c |
|
|
|
56112c |
https://github.com/FreeRDP/FreeRDP/pull/547
|
|
|
56112c |
|
|
|
56112c |
Backported by Ondrej Holy <oholy@redhat.com>.
|
|
|
56112c |
---
|
|
|
56112c |
client/X11/xf_event.c | 2 ++
|
|
|
56112c |
client/X11/xf_keyboard.c | 22 ++++++++++++++++++++++
|
|
|
56112c |
client/X11/xf_keyboard.h | 1 +
|
|
|
56112c |
3 files changed, 25 insertions(+)
|
|
|
56112c |
|
|
|
56112c |
diff --git a/client/X11/xf_event.c b/client/X11/xf_event.c
|
|
|
56112c |
index b5c381f..cbcfc65 100644
|
|
|
56112c |
--- a/client/X11/xf_event.c
|
|
|
56112c |
+++ b/client/X11/xf_event.c
|
|
|
56112c |
@@ -507,6 +507,8 @@ boolean xf_event_UnmapNotify(xfInfo* xfi, XEvent* event, boolean app)
|
|
|
56112c |
rdpWindow* window;
|
|
|
56112c |
rdpRail* rail = ((rdpContext*) xfi->context)->rail;
|
|
|
56112c |
|
|
|
56112c |
+ xf_kbd_release_all_keypress(xfi);
|
|
|
56112c |
+
|
|
|
56112c |
if (app != true)
|
|
|
56112c |
return true;
|
|
|
56112c |
|
|
|
56112c |
diff --git a/client/X11/xf_keyboard.c b/client/X11/xf_keyboard.c
|
|
|
56112c |
index cb82fa4..e94b362 100644
|
|
|
56112c |
--- a/client/X11/xf_keyboard.c
|
|
|
56112c |
+++ b/client/X11/xf_keyboard.c
|
|
|
56112c |
@@ -50,6 +50,28 @@ void xf_kbd_unset_keypress(xfInfo* xfi, uint8 keycode)
|
|
|
56112c |
return;
|
|
|
56112c |
}
|
|
|
56112c |
|
|
|
56112c |
+void xf_kbd_release_all_keypress(xfInfo* xfi)
|
|
|
56112c |
+{
|
|
|
56112c |
+ int keycode;
|
|
|
56112c |
+ uint16 flags;
|
|
|
56112c |
+ uint8 rdp_scancode;
|
|
|
56112c |
+ boolean extended;
|
|
|
56112c |
+
|
|
|
56112c |
+ for (keycode = 0; keycode < sizeof(xfi->pressed_keys) / sizeof(xfi->pressed_keys[0]); keycode++)
|
|
|
56112c |
+ {
|
|
|
56112c |
+ if (xfi->pressed_keys[keycode] != NoSymbol)
|
|
|
56112c |
+ {
|
|
|
56112c |
+ rdp_scancode = freerdp_kbd_get_scancode_by_keycode(keycode, &extended);
|
|
|
56112c |
+
|
|
|
56112c |
+ flags = KBD_FLAGS_RELEASE;
|
|
|
56112c |
+ flags |= (extended) ? KBD_FLAGS_EXTENDED : 0;
|
|
|
56112c |
+ xfi->instance->input->KeyboardEvent(xfi->instance->input, flags, rdp_scancode);
|
|
|
56112c |
+
|
|
|
56112c |
+ xfi->pressed_keys[keycode] = NoSymbol;
|
|
|
56112c |
+ }
|
|
|
56112c |
+ }
|
|
|
56112c |
+}
|
|
|
56112c |
+
|
|
|
56112c |
boolean xf_kbd_key_pressed(xfInfo* xfi, KeySym keysym)
|
|
|
56112c |
{
|
|
|
56112c |
KeyCode keycode = XKeysymToKeycode(xfi->display, keysym);
|
|
|
56112c |
diff --git a/client/X11/xf_keyboard.h b/client/X11/xf_keyboard.h
|
|
|
56112c |
index 92e08fc..e316f07 100644
|
|
|
56112c |
--- a/client/X11/xf_keyboard.h
|
|
|
56112c |
+++ b/client/X11/xf_keyboard.h
|
|
|
56112c |
@@ -28,6 +28,7 @@
|
|
|
56112c |
void xf_kbd_init(xfInfo* xfi);
|
|
|
56112c |
void xf_kbd_set_keypress(xfInfo* xfi, uint8 keycode, KeySym keysym);
|
|
|
56112c |
void xf_kbd_unset_keypress(xfInfo* xfi, uint8 keycode);
|
|
|
56112c |
+void xf_kbd_release_all_keypress(xfInfo* xfi);
|
|
|
56112c |
boolean xf_kbd_key_pressed(xfInfo* xfi, KeySym keysym);
|
|
|
56112c |
void xf_kbd_send_key(xfInfo* xfi, boolean down, uint8 keycode);
|
|
|
56112c |
int xf_kbd_read_keyboard_state(xfInfo* xfi);
|
|
|
56112c |
--
|
|
|
56112c |
2.9.3
|
|
|
56112c |
|