44 |
extern int g_win_button_size; |
extern int g_win_button_size; |
45 |
extern BOOL g_enable_compose; |
extern BOOL g_enable_compose; |
46 |
extern BOOL g_use_rdp5; |
extern BOOL g_use_rdp5; |
47 |
|
extern BOOL g_numlock_sync; |
48 |
|
|
49 |
static BOOL keymap_loaded; |
static BOOL keymap_loaded; |
50 |
static key_translation keymap[KEYMAP_SIZE]; |
static key_translation keymap[KEYMAP_SIZE]; |
187 |
MASK_ADD_BITS(modifiers, MapLeftShiftMask); |
MASK_ADD_BITS(modifiers, MapLeftShiftMask); |
188 |
} |
} |
189 |
|
|
190 |
|
if (strstr(line_rest, "numlock")) |
191 |
|
{ |
192 |
|
MASK_ADD_BITS(modifiers, MapNumLockMask); |
193 |
|
} |
194 |
|
|
195 |
if (strstr(line_rest, "localstate")) |
if (strstr(line_rest, "localstate")) |
196 |
{ |
{ |
197 |
MASK_ADD_BITS(modifiers, MapLocalStateMask); |
MASK_ADD_BITS(modifiers, MapLocalStateMask); |
367 |
if (g_win_button_size |
if (g_win_button_size |
368 |
&& (get_key_state(state, XK_Alt_L) || get_key_state(state, XK_Alt_R))) |
&& (get_key_state(state, XK_Alt_L) || get_key_state(state, XK_Alt_R))) |
369 |
return True; |
return True; |
370 |
|
case XK_Num_Lock: |
371 |
|
/* FIXME: We might want to do RDP_INPUT_SYNCHRONIZE here, if g_numlock_sync */ |
372 |
|
if (!g_numlock_sync) |
373 |
|
/* Inhibit */ |
374 |
|
return True; |
375 |
|
|
376 |
|
|
377 |
} |
} |
378 |
return False; |
return False; |
519 |
if (is_modifier(tr.scancode)) |
if (is_modifier(tr.scancode)) |
520 |
return; |
return; |
521 |
|
|
522 |
|
if (!g_numlock_sync) |
523 |
|
{ |
524 |
|
/* NumLock */ |
525 |
|
if (MASK_HAS_BITS(tr.modifiers, MapNumLockMask) |
526 |
|
!= MASK_HAS_BITS(remote_modifier_state, MapNumLockMask)) |
527 |
|
{ |
528 |
|
/* The remote modifier state is not correct */ |
529 |
|
uint16 new_remote_state; |
530 |
|
|
531 |
|
if (MASK_HAS_BITS(tr.modifiers, MapNumLockMask)) |
532 |
|
{ |
533 |
|
DEBUG_KBD(("Remote NumLock state is incorrect, activating NumLock.\n")); |
534 |
|
new_remote_state = KBD_FLAG_NUMLOCK; |
535 |
|
remote_modifier_state = MapNumLockMask; |
536 |
|
} |
537 |
|
else |
538 |
|
{ |
539 |
|
DEBUG_KBD(("Remote NumLock state is incorrect, deactivating NumLock.\n")); |
540 |
|
new_remote_state = 0; |
541 |
|
remote_modifier_state = 0; |
542 |
|
} |
543 |
|
|
544 |
|
rdp_send_input(0, RDP_INPUT_SYNCHRONIZE, 0, new_remote_state, 0); |
545 |
|
} |
546 |
|
} |
547 |
|
|
548 |
|
|
549 |
/* Shift. Left shift and right shift are treated as equal; either is fine. */ |
/* Shift. Left shift and right shift are treated as equal; either is fine. */ |
550 |
if (MASK_HAS_BITS(tr.modifiers, MapShiftMask) |
if (MASK_HAS_BITS(tr.modifiers, MapShiftMask) |
551 |
!= MASK_HAS_BITS(remote_modifier_state, MapShiftMask)) |
!= MASK_HAS_BITS(remote_modifier_state, MapShiftMask)) |
652 |
|
|
653 |
reset_winkey(ev_time); |
reset_winkey(ev_time); |
654 |
|
|
655 |
rdp_send_input(ev_time, RDP_INPUT_SYNCHRONIZE, 0, ui_get_numlock_state(state), 0); |
if (g_numlock_sync) |
656 |
|
rdp_send_input(ev_time, RDP_INPUT_SYNCHRONIZE, 0, ui_get_numlock_state(state), 0); |
657 |
} |
} |
658 |
|
|
659 |
|
|
692 |
case SCANCODE_CHAR_RWIN: |
case SCANCODE_CHAR_RWIN: |
693 |
MASK_CHANGE_BIT(remote_modifier_state, MapRightWinMask, pressed); |
MASK_CHANGE_BIT(remote_modifier_state, MapRightWinMask, pressed); |
694 |
break; |
break; |
695 |
|
case SCANCODE_CHAR_NUMLOCK: |
696 |
|
/* KeyReleases for NumLocks are sent immediately. Toggle the |
697 |
|
modifier state only on Keypress */ |
698 |
|
if (pressed && !g_numlock_sync) |
699 |
|
{ |
700 |
|
BOOL newNumLockState; |
701 |
|
newNumLockState = |
702 |
|
(MASK_HAS_BITS |
703 |
|
(remote_modifier_state, MapNumLockMask) == False); |
704 |
|
MASK_CHANGE_BIT(remote_modifier_state, |
705 |
|
MapNumLockMask, newNumLockState); |
706 |
|
} |
707 |
} |
} |
708 |
|
|
709 |
#ifdef WITH_DEBUG_KBD |
#ifdef WITH_DEBUG_KBD |