25 |
#include <string.h> |
#include <string.h> |
26 |
#include <ctype.h> |
#include <ctype.h> |
27 |
#include <limits.h> |
#include <limits.h> |
28 |
|
#include <assert.h> |
29 |
#include "rdesktop.h" |
#include "rdesktop.h" |
30 |
#include "scancodes.h" |
#include "scancodes.h" |
31 |
|
|
363 |
break; |
break; |
364 |
} |
} |
365 |
|
|
366 |
/* Shift */ |
/* Shift. Left shift and right shift are treated as equal; either is fine. */ |
367 |
if (MASK_HAS_BITS(tr.modifiers, MapShiftMask) |
if (MASK_HAS_BITS(tr.modifiers, MapShiftMask) |
368 |
!= MASK_HAS_BITS(remote_modifier_state, MapShiftMask)) |
!= MASK_HAS_BITS(remote_modifier_state, MapShiftMask)) |
369 |
{ |
{ |
370 |
/* The remote modifier state is not correct */ |
/* The remote modifier state is not correct */ |
371 |
if (MASK_HAS_BITS(tr.modifiers, MapShiftMask)) |
if (MASK_HAS_BITS(tr.modifiers, MapLeftShiftMask)) |
372 |
{ |
{ |
373 |
/* Needs this modifier. Send down. */ |
/* Needs left shift. Send down. */ |
374 |
rdp_send_scancode(ev_time, RDP_KEYPRESS, SCANCODE_CHAR_LSHIFT); |
rdp_send_scancode(ev_time, RDP_KEYPRESS, SCANCODE_CHAR_LSHIFT); |
375 |
} |
} |
376 |
|
else if (MASK_HAS_BITS(tr.modifiers, MapRightShiftMask)) |
377 |
|
{ |
378 |
|
/* Needs right shift. Send down. */ |
379 |
|
rdp_send_scancode(ev_time, RDP_KEYPRESS, SCANCODE_CHAR_RSHIFT); |
380 |
|
} |
381 |
else |
else |
382 |
{ |
{ |
383 |
/* Should not use this modifier. Send up. */ |
/* Should not use this modifier. Send up for shift currently pressed. */ |
384 |
rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_LSHIFT); |
if (MASK_HAS_BITS(remote_modifier_state, MapLeftShiftMask)) |
385 |
rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_RSHIFT); |
/* Left shift is down */ |
386 |
|
rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_LSHIFT); |
387 |
|
else |
388 |
|
{ |
389 |
|
assert(MASK_HAS_BITS(remote_modifier_state, MapRightShiftMask)); |
390 |
|
/* Right shift is down */ |
391 |
|
rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_RSHIFT); |
392 |
|
} |
393 |
|
|
394 |
} |
} |
395 |
} |
} |
396 |
|
|