/[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 553 by astrand, Mon Dec 8 15:28:24 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 317  handle_special_keys(uint32 keysym, unsig Line 323  handle_special_keys(uint32 keysym, unsig
323                          }                          }
324                          /* No release sequence */                          /* No release sequence */
325                          return True;                          return True;
326                            break;
327    
328                  case XK_Pause:                  case XK_Pause:
329                          /* According to MS Keyboard Scan Code                          /* According to MS Keyboard Scan Code
# Line 343  handle_special_keys(uint32 keysym, unsig Line 350  handle_special_keys(uint32 keysym, unsig
350                                                 0x1d, 0);                                                 0x1d, 0);
351                          }                          }
352                          return True;                          return True;
353                            break;
354    
355                  case XK_Meta_L: /* Windows keys */                  case XK_Meta_L: /* Windows keys */
356                  case XK_Super_L:                  case XK_Super_L:
357                  case XK_Hyper_L:                  case XK_Hyper_L:
358                          send_winkey(ev_time, pressed, True);                          send_winkey(ev_time, pressed, True);
359                          return True;                          return True;
360                            break;
361    
362                  case XK_Meta_R:                  case XK_Meta_R:
363                  case XK_Super_R:                  case XK_Super_R:
364                  case XK_Hyper_R:                  case XK_Hyper_R:
365                          send_winkey(ev_time, pressed, False);                          send_winkey(ev_time, pressed, False);
366                          return True;                          return True;
367                            break;
368    
369                  case XK_space:                  case XK_space:
370                          /* Prevent access to the Windows system menu in single app mode */                          /* Prevent access to the Windows system menu in single app mode */
371                          if (g_win_button_size                          if (g_win_button_size
372                              && (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)))
373                                  return True;                                  return True;
374                            break;
375                    case XK_Num_Lock:
376                            /* FIXME: We might want to do RDP_INPUT_SYNCHRONIZE here, if g_numlock_sync */
377                            if (!g_numlock_sync)
378                                    /* Inhibit */
379                                    return True;
380                            break;
381    
382          }          }
383          return False;          return False;
# Line 507  ensure_remote_modifiers(uint32 ev_time, Line 524  ensure_remote_modifiers(uint32 ev_time,
524          if (is_modifier(tr.scancode))          if (is_modifier(tr.scancode))
525                  return;                  return;
526    
527            if (!g_numlock_sync)
528            {
529                    /* NumLock */
530                    if (MASK_HAS_BITS(tr.modifiers, MapNumLockMask)
531                        != MASK_HAS_BITS(remote_modifier_state, MapNumLockMask))
532                    {
533                            /* The remote modifier state is not correct */
534                            uint16 new_remote_state;
535    
536                            if (MASK_HAS_BITS(tr.modifiers, MapNumLockMask))
537                            {
538                                    DEBUG_KBD(("Remote NumLock state is incorrect, activating NumLock.\n"));
539                                    new_remote_state = KBD_FLAG_NUMLOCK;
540                                    remote_modifier_state = MapNumLockMask;
541                            }
542                            else
543                            {
544                                    DEBUG_KBD(("Remote NumLock state is incorrect, deactivating NumLock.\n"));
545                                    new_remote_state = 0;
546                                    remote_modifier_state = 0;
547                            }
548    
549                            rdp_send_input(0, RDP_INPUT_SYNCHRONIZE, 0, new_remote_state, 0);
550                    }
551            }
552    
553    
554          /* 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. */
555          if (MASK_HAS_BITS(tr.modifiers, MapShiftMask)          if (MASK_HAS_BITS(tr.modifiers, MapShiftMask)
556              != MASK_HAS_BITS(remote_modifier_state, MapShiftMask))              != MASK_HAS_BITS(remote_modifier_state, MapShiftMask))
# Line 613  reset_modifier_keys() Line 657  reset_modifier_keys()
657    
658          reset_winkey(ev_time);          reset_winkey(ev_time);
659    
660          rdp_send_input(ev_time, RDP_INPUT_SYNCHRONIZE, 0, ui_get_numlock_state(state), 0);          if (g_numlock_sync)
661                    rdp_send_input(ev_time, RDP_INPUT_SYNCHRONIZE, 0, ui_get_numlock_state(state), 0);
662  }  }
663    
664    
# Line 652  update_modifier_state(uint8 scancode, BO Line 697  update_modifier_state(uint8 scancode, BO
697                  case SCANCODE_CHAR_RWIN:                  case SCANCODE_CHAR_RWIN:
698                          MASK_CHANGE_BIT(remote_modifier_state, MapRightWinMask, pressed);                          MASK_CHANGE_BIT(remote_modifier_state, MapRightWinMask, pressed);
699                          break;                          break;
700                    case SCANCODE_CHAR_NUMLOCK:
701                            /* KeyReleases for NumLocks are sent immediately. Toggle the
702                               modifier state only on Keypress */
703                            if (pressed && !g_numlock_sync)
704                            {
705                                    BOOL newNumLockState;
706                                    newNumLockState =
707                                            (MASK_HAS_BITS
708                                             (remote_modifier_state, MapNumLockMask) == False);
709                                    MASK_CHANGE_BIT(remote_modifier_state,
710                                                    MapNumLockMask, newNumLockState);
711                            }
712          }          }
713    
714  #ifdef WITH_DEBUG_KBD  #ifdef WITH_DEBUG_KBD

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

  ViewVC Help
Powered by ViewVC 1.1.26