From c87368310a01187b70380a5eafe01a07616366e3 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Mon, 11 Mar 2024 08:58:59 +0100 Subject: [PATCH] [client,x11] fix right control ungrab ungrab keybaord/mouse on first right control press. Fixes #9959 --- client/X11/xf_keyboard.c | 6 +++--- client/X11/xfreerdp.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/X11/xf_keyboard.c b/client/X11/xf_keyboard.c index 9b575c2eb..859b9d33c 100644 --- a/client/X11/xf_keyboard.c +++ b/client/X11/xf_keyboard.c @@ -555,11 +555,11 @@ BOOL xf_keyboard_handle_special_keys(xfContext* xfc, KeySym keysym) // do not return anything such that the key could be used by client if ungrab is not the goal if (keysym == XK_Control_R) { - if (mod.RightCtrl && xfc->firstPressRightCtrl) + if (mod.RightCtrl && !xfc->wasRightCtrlAlreadyPressed) { // Right Ctrl is pressed, getting ready to ungrab xfc->ungrabKeyboardWithRightCtrl = TRUE; - xfc->firstPressRightCtrl = FALSE; + xfc->wasRightCtrlAlreadyPressed = TRUE; } } else @@ -689,7 +689,7 @@ void xf_keyboard_handle_special_keys_release(xfContext* xfc, KeySym keysym) if (keysym != XK_Control_R) return; - xfc->firstPressRightCtrl = TRUE; + xfc->wasRightCtrlAlreadyPressed = FALSE; if (!xfc->ungrabKeyboardWithRightCtrl) return; diff --git a/client/X11/xfreerdp.h b/client/X11/xfreerdp.h index 314c63d9d..42a2224d5 100644 --- a/client/X11/xfreerdp.h +++ b/client/X11/xfreerdp.h @@ -277,7 +277,7 @@ struct xf_context button_map button_map[NUM_BUTTONS_MAPPED]; BYTE savedMaximizedState; UINT32 locked; - BOOL firstPressRightCtrl; + BOOL wasRightCtrlAlreadyPressed; BOOL ungrabKeyboardWithRightCtrl; #if defined(WITH_XI)