diff --git a/client/X11/xf_keyboard.c b/client/X11/xf_keyboard.c index 7e7c297af..da5d17f23 100644 --- a/client/X11/xf_keyboard.c +++ b/client/X11/xf_keyboard.c @@ -317,6 +317,26 @@ UINT32 xf_keyboard_get_toggle_keys_state(xfContext* xfc) return toggleKeysState; } +static void xk_keyboard_update_modifier_keys(xfContext* xfc) +{ + int state; + size_t i; + KeyCode keycode; + int keysyms[] = {XK_Shift_L, XK_Shift_R, XK_Alt_L, XK_Alt_R, + XK_Control_L, XK_Control_R, XK_Super_L, XK_Super_R + }; + state = xf_keyboard_read_keyboard_state(xfc); + + for (i = 0; i < ARRAYSIZE(keysyms); i++) + { + if (xf_keyboard_get_key_state(xfc, state, keysyms[i])) + { + keycode = XKeysymToKeycode(xfc->display, keysyms[i]); + xfc->KeyboardState[keycode] = TRUE; + } + } +} + void xf_keyboard_focus_in(xfContext* xfc) { rdpInput* input; @@ -330,6 +350,7 @@ void xf_keyboard_focus_in(xfContext* xfc) input = xfc->context.input; syncFlags = xf_keyboard_get_toggle_keys_state(xfc); input->FocusInEvent(input, syncFlags); + xk_keyboard_update_modifier_keys(xfc); /* finish with a mouse pointer position like mstsc.exe if required */ @@ -388,6 +409,9 @@ static int xf_keyboard_execute_action_script(xfContext* xfc, if (mod->Alt) strcat(combination, "Alt+"); + if (mod->Super) + strcat(combination, "Super+"); + strcat(combination, keyStr); count = ArrayList_Count(xfc->keyCombinations); @@ -596,6 +620,7 @@ void xf_keyboard_handle_special_keys_release(xfContext* xfc, KeySym keysym) { xf_toggle_control(xfc); } + xfc->mouse_active = FALSE; XUngrabKeyboard(xfc->display, CurrentTime); }