Merge pull request #547 from llyzs/x11

x11: release all pressed keys when window is unmapped.
This commit is contained in:
Vic Lee 2012-04-12 23:33:56 -07:00
commit fcf07f780e
3 changed files with 19 additions and 0 deletions

View File

@ -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 File

@ -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 < ARRAY_SIZE(xfi->pressed_keys); 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 File

@ -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);