Skip to content
Browse files

x11: release all pressed keys when window is unmapped.

  • Loading branch information...
1 parent 092d16a commit 400b58e9344e690d88180842e63e42699503503d @llyzs committed
Showing with 19 additions and 0 deletions.
  1. +2 −0 client/X11/xf_event.c
  2. +16 −0 client/X11/xf_keyboard.c
  3. +1 −0 client/X11/xf_keyboard.h
View
2 client/X11/xf_event.c
@@ -559,6 +559,8 @@ boolean xf_event_UnmapNotify(xfInfo* xfi, XEvent* event, boolean app)
rdpWindow* window;
rdpRail* rail = ((rdpContext*) xfi->context)->rail;
+ xf_kbd_release_all_keypress(xfi);
+
if (app != true)
return true;
View
16 client/X11/xf_keyboard.c
@@ -50,6 +50,22 @@ void xf_kbd_unset_keypress(xfInfo* xfi, uint8 keycode)
return;
}
+void xf_kbd_release_all_keypress(xfInfo* xfi)
+{
+ int keycode;
+ RDP_SCANCODE rdp_scancode;
+
+ for (keycode = 0; keycode < sizeof(xfi->pressed_keys) / sizeof(xfi->pressed_keys[0]); keycode++)
+ {
+ if (xfi->pressed_keys[keycode] != NoSymbol)
+ {
+ rdp_scancode = freerdp_keyboard_get_rdp_scancode_from_x11_keycode(keycode);
+ freerdp_input_send_keyboard_event_2(xfi->instance->input, false, rdp_scancode);
+ xfi->pressed_keys[keycode] = NoSymbol;
+ }
+ }
+}
+
boolean xf_kbd_key_pressed(xfInfo* xfi, KeySym keysym)
{
KeyCode keycode = XKeysymToKeycode(xfi->display, keysym);
View
1 client/X11/xf_keyboard.h
@@ -27,6 +27,7 @@
void xf_kbd_init(xfInfo* xfi);
void xf_kbd_set_keypress(xfInfo* xfi, uint8 keycode, KeySym keysym);
void xf_kbd_unset_keypress(xfInfo* xfi, uint8 keycode);
+void xf_kbd_release_all_keypress(xfInfo* xfi);
boolean xf_kbd_key_pressed(xfInfo* xfi, KeySym keysym);
void xf_kbd_send_key(xfInfo* xfi, boolean down, uint8 keycode);
int xf_kbd_read_keyboard_state(xfInfo* xfi);

0 comments on commit 400b58e

Please sign in to comment.
Something went wrong with that request. Please try again.