/[rdesktop]/sourceforge.net/trunk/rdesktop/xkeymap.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/xkeymap.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 548 by astrand, Tue Nov 11 14:01:31 2003 UTC revision 552 by astrand, Mon Dec 8 12:01:25 2003 UTC
# Line 44  extern int keylayout; Line 44  extern int keylayout;
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];
# Line 186  xkeymap_read(char *mapname) Line 187  xkeymap_read(char *mapname)
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);
# Line 361  handle_special_keys(uint32 keysym, unsig Line 367  handle_special_keys(uint32 keysym, unsig
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;
# Line 507  ensure_remote_modifiers(uint32 ev_time, Line 519  ensure_remote_modifiers(uint32 ev_time,
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))
# Line 613  reset_modifier_keys() Line 652  reset_modifier_keys()
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    
# Line 652  update_modifier_state(uint8 scancode, BO Line 692  update_modifier_state(uint8 scancode, BO
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

Legend:
Removed from v.548  
changed lines
  Added in v.552

  ViewVC Help
Powered by ViewVC 1.1.26