--- sourceforge.net/trunk/rdesktop/xkeymap.c 2002/09/17 08:18:41 170 +++ sourceforge.net/trunk/rdesktop/xkeymap.c 2002/09/17 16:57:07 183 @@ -25,6 +25,7 @@ #include #include #include +#include #include "rdesktop.h" #include "scancodes.h" @@ -362,21 +363,34 @@ break; } - /* Shift */ + /* Shift. Left shift and right shift are treated as equal; either is fine. */ if (MASK_HAS_BITS(tr.modifiers, MapShiftMask) != MASK_HAS_BITS(remote_modifier_state, MapShiftMask)) { /* The remote modifier state is not correct */ - if (MASK_HAS_BITS(tr.modifiers, MapShiftMask)) + if (MASK_HAS_BITS(tr.modifiers, MapLeftShiftMask)) { - /* Needs this modifier. Send down. */ + /* Needs left shift. Send down. */ rdp_send_scancode(ev_time, RDP_KEYPRESS, SCANCODE_CHAR_LSHIFT); } + else if (MASK_HAS_BITS(tr.modifiers, MapRightShiftMask)) + { + /* Needs right shift. Send down. */ + rdp_send_scancode(ev_time, RDP_KEYPRESS, SCANCODE_CHAR_RSHIFT); + } else { - /* Should not use this modifier. Send up. */ - rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_LSHIFT); - rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_RSHIFT); + /* Should not use this modifier. Send up for shift currently pressed. */ + if (MASK_HAS_BITS(remote_modifier_state, MapLeftShiftMask)) + /* Left shift is down */ + rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_LSHIFT); + else + { + assert(MASK_HAS_BITS(remote_modifier_state, MapRightShiftMask)); + /* Right shift is down */ + rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_RSHIFT); + } + } }