From ffb111b2a17cc9f4f3695001f2f4d8d35f1ba5be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C3=85strand?= Date: Fri, 7 Apr 2006 22:17:14 +0000 Subject: [PATCH] Only release Shift if non-physical shift plus Ctrl is pressed; not if CapsLock is active. This should solve bug 1228691. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1217 423420c4-83ab-492f-b58f-81f9feb106b5 --- xkeymap.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/xkeymap.c b/xkeymap.c index 997d03a..b2d8572 100644 --- a/xkeymap.c +++ b/xkeymap.c @@ -629,13 +629,18 @@ xkeymap_translate_key(uint32 keysym, unsigned int keycode, unsigned int state) } } - if ((tr.modifiers & MapLeftShiftMask) - && ((remote_modifier_state & MapLeftCtrlMask) - || (remote_modifier_state & MapRightCtrlMask)) - && get_key_state(state, XK_Caps_Lock)) + /* Windows interprets CapsLock+Ctrl+key + differently from Shift+Ctrl+key. Since we + are simulating CapsLock with Shifts, things + like Ctrl+f with CapsLock on breaks. To + solve this, we are releasing Shift if Ctrl + is on, but only if Shift isn't physically pressed. */ + if (MASK_HAS_BITS(tr.modifiers, MapShiftMask) + && MASK_HAS_BITS(remote_modifier_state, MapCtrlMask) + && !MASK_HAS_BITS(state, ShiftMask)) { - DEBUG_KBD(("CapsLock + Ctrl pressed, releasing LeftShift\n")); - tr.modifiers ^= MapLeftShiftMask; + DEBUG_KBD(("Non-physical Shift + Ctrl pressed, releasing Shift\n")); + MASK_REMOVE_BITS(tr.modifiers, MapShiftMask); } DEBUG_KBD(("Found scancode translation, scancode=0x%x, modifiers=0x%x\n",