Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

x11: release all pressed keys when window is unmapped.

  • Loading branch information...
commit 400b58e9344e690d88180842e63e42699503503d 1 parent 092d16a
@llyzs authored
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++)

We have an ARRAY_SIZE macro that could make it slightly more DRY and less error prone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ {
+ 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);
Please sign in to comment.
Something went wrong with that request. Please try again.