/[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 1365 by jsorg71, Thu Jan 4 05:39:39 2007 UTC revision 1419 by astrand, Mon Oct 8 12:34:05 2007 UTC
# Line 3  Line 3 
3     User interface services - X keyboard mapping     User interface services - X keyboard mapping
4    
5     Copyright (C) Matthew Chapman 1999-2007     Copyright (C) Matthew Chapman 1999-2007
6     Copyright (C) Peter Astrand <peter@cendio.se> 2003-2007     Copyright (C) Peter Astrand <astrand@cendio.se> 2003-2007
7    
8     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
9     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
# Line 46  extern int g_keyboard_type; Line 46  extern int g_keyboard_type;
46  extern int g_keyboard_subtype;  extern int g_keyboard_subtype;
47  extern int g_keyboard_functionkeys;  extern int g_keyboard_functionkeys;
48  extern int g_win_button_size;  extern int g_win_button_size;
49  extern BOOL g_enable_compose;  extern RD_BOOL g_enable_compose;
50  extern BOOL g_use_rdp5;  extern RD_BOOL g_use_rdp5;
51  extern BOOL g_numlock_sync;  extern RD_BOOL g_numlock_sync;
52    
53  static BOOL keymap_loaded;  static RD_BOOL keymap_loaded;
54  static key_translation *keymap[KEYMAP_SIZE];  static key_translation *keymap[KEYMAP_SIZE];
55  static int min_keycode;  static int min_keycode;
56  static uint16 remote_modifier_state = 0;  static uint16 remote_modifier_state = 0;
57  static uint16 saved_remote_modifier_state = 0;  static uint16 saved_remote_modifier_state = 0;
58    
59  static void update_modifier_state(uint8 scancode, BOOL pressed);  static void update_modifier_state(uint8 scancode, RD_BOOL pressed);
60    
61  /* Free key_translation structure, including linked list */  /* Free key_translation structure, including linked list */
62  static void  static void
# Line 159  add_sequence(char *rest, char *mapname) Line 159  add_sequence(char *rest, char *mapname)
159          DEBUG_KBD(("\n"));          DEBUG_KBD(("\n"));
160  }  }
161    
162  BOOL  RD_BOOL
163  xkeymap_from_locale(const char *locale)  xkeymap_from_locale(const char *locale)
164  {  {
165          char *str, *ptr;          char *str, *ptr;
# Line 275  xkeymap_open(const char *filename) Line 275  xkeymap_open(const char *filename)
275          return NULL;          return NULL;
276  }  }
277    
278  static BOOL  static RD_BOOL
279  xkeymap_read(char *mapname)  xkeymap_read(char *mapname)
280  {  {
281          FILE *fp;          FILE *fp;
# Line 455  xkeymap_init(void) Line 455  xkeymap_init(void)
455  }  }
456    
457  static void  static void
458  send_winkey(uint32 ev_time, BOOL pressed, BOOL leftkey)  send_winkey(uint32 ev_time, RD_BOOL pressed, RD_BOOL leftkey)
459  {  {
460          uint8 winkey;          uint8 winkey;
461    
# Line 504  reset_winkey(uint32 ev_time) Line 504  reset_winkey(uint32 ev_time)
504  }  }
505    
506  /* Handle special key combinations */  /* Handle special key combinations */
507  BOOL  RD_BOOL
508  handle_special_keys(uint32 keysym, unsigned int state, uint32 ev_time, BOOL pressed)  handle_special_keys(uint32 keysym, unsigned int state, uint32 ev_time, RD_BOOL pressed)
509  {  {
510          switch (keysym)          switch (keysym)
511          {          {
# Line 679  xkeymap_translate_key(uint32 keysym, uns Line 679  xkeymap_translate_key(uint32 keysym, uns
679          return tr;          return tr;
680  }  }
681    
682    static RD_BOOL
683    is_modifier(uint8 scancode)
684    {
685            switch (scancode)
686            {
687                    case SCANCODE_CHAR_LSHIFT:
688                    case SCANCODE_CHAR_RSHIFT:
689                    case SCANCODE_CHAR_LCTRL:
690                    case SCANCODE_CHAR_RCTRL:
691                    case SCANCODE_CHAR_LALT:
692                    case SCANCODE_CHAR_RALT:
693                    case SCANCODE_CHAR_LWIN:
694                    case SCANCODE_CHAR_RWIN:
695                    case SCANCODE_CHAR_NUMLOCK:
696                            return True;
697                    default:
698                            break;
699            }
700            return False;
701    }
702    
703    
704  void  void
705  xkeymap_send_keys(uint32 keysym, unsigned int keycode, unsigned int state, uint32 ev_time,  xkeymap_send_keys(uint32 keysym, unsigned int keycode, unsigned int state, uint32 ev_time,
706                    BOOL pressed, uint8 nesting)                    RD_BOOL pressed, uint8 nesting)
707  {  {
708          key_translation tr, *ptr;          key_translation tr, *ptr;
709          tr = xkeymap_translate_key(keysym, keycode, state);          tr = xkeymap_translate_key(keysym, keycode, state);
# Line 692  xkeymap_send_keys(uint32 keysym, unsigne Line 714  xkeymap_send_keys(uint32 keysym, unsigne
714                  if (tr.scancode == 0)                  if (tr.scancode == 0)
715                          return;                          return;
716    
717                  if (pressed)                  save_remote_modifiers(tr.scancode);
718                  {                  ensure_remote_modifiers(ev_time, tr);
719                          save_remote_modifiers(tr.scancode);                  rdp_send_scancode(ev_time, pressed ? RDP_KEYPRESS : RDP_KEYRELEASE, tr.scancode);
720                          ensure_remote_modifiers(ev_time, tr);                  restore_remote_modifiers(ev_time, tr.scancode);
                         rdp_send_scancode(ev_time, RDP_KEYPRESS, tr.scancode);  
                         restore_remote_modifiers(ev_time, tr.scancode);  
                 }  
                 else  
                 {  
                         rdp_send_scancode(ev_time, RDP_KEYRELEASE, tr.scancode);  
                 }  
721                  return;                  return;
722          }          }
723    
# Line 762  get_ksname(uint32 keysym) Line 777  get_ksname(uint32 keysym)
777          return ksname;          return ksname;
778  }  }
779    
 static BOOL  
 is_modifier(uint8 scancode)  
 {  
         switch (scancode)  
         {  
                 case SCANCODE_CHAR_LSHIFT:  
                 case SCANCODE_CHAR_RSHIFT:  
                 case SCANCODE_CHAR_LCTRL:  
                 case SCANCODE_CHAR_RCTRL:  
                 case SCANCODE_CHAR_LALT:  
                 case SCANCODE_CHAR_RALT:  
                 case SCANCODE_CHAR_LWIN:  
                 case SCANCODE_CHAR_RWIN:  
                 case SCANCODE_CHAR_NUMLOCK:  
                         return True;  
                 default:  
                         break;  
         }  
         return False;  
 }  
   
780  void  void
781  save_remote_modifiers(uint8 scancode)  save_remote_modifiers(uint8 scancode)
782  {  {
# Line 956  reset_modifier_keys() Line 950  reset_modifier_keys()
950    
951    
952  static void  static void
953  update_modifier_state(uint8 scancode, BOOL pressed)  update_modifier_state(uint8 scancode, RD_BOOL pressed)
954  {  {
955  #ifdef WITH_DEBUG_KBD  #ifdef WITH_DEBUG_KBD
956          uint16 old_modifier_state;          uint16 old_modifier_state;
# Line 995  update_modifier_state(uint8 scancode, BO Line 989  update_modifier_state(uint8 scancode, BO
989                             modifier state only on Keypress */                             modifier state only on Keypress */
990                          if (pressed && !g_numlock_sync)                          if (pressed && !g_numlock_sync)
991                          {                          {
992                                  BOOL newNumLockState;                                  RD_BOOL newNumLockState;
993                                  newNumLockState =                                  newNumLockState =
994                                          (MASK_HAS_BITS                                          (MASK_HAS_BITS
995                                           (remote_modifier_state, MapNumLockMask) == False);                                           (remote_modifier_state, MapNumLockMask) == False);

Legend:
Removed from v.1365  
changed lines
  Added in v.1419

  ViewVC Help
Powered by ViewVC 1.1.26