/[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 56 by jsorg71, Fri Jul 12 22:40:32 2002 UTC revision 64 by astrand, Thu Jul 18 16:38:31 2002 UTC
# Line 36  extern int keylayout; Line 36  extern int keylayout;
36  static uint8 keymap[KEYMAP_SIZE];  static uint8 keymap[KEYMAP_SIZE];
37  static unsigned int min_keycode;  static unsigned int min_keycode;
38    
39  static BOOL xkeymap_read(char *mapname)  static BOOL
40    xkeymap_read(char *mapname)
41  {  {
42          FILE *fp;          FILE *fp;
43          char line[PATH_MAX], path[PATH_MAX];          char line[PATH_MAX], path[PATH_MAX];
# Line 72  static BOOL xkeymap_read(char *mapname) Line 73  static BOOL xkeymap_read(char *mapname)
73    
74                                  keysym = XStringToKeysym(keyname);                                  keysym = XStringToKeysym(keyname);
75                                  if (keysym == NoSymbol)                                  if (keysym == NoSymbol)
76                                          error("Bad keysym %s in keymap %s\n", keyname, mapname);                                          error("Bad keysym %s in keymap %s\n",
77                                                  keyname, mapname);
78    
79                                  keymap[keysym & KEYMAP_MASK] = keycode;                                  keymap[keysym & KEYMAP_MASK] = keycode;
80                                  keyname = p;                                  keyname = p;
81    
82                          } while (keyname != NULL);                          }
83                            while (keyname != NULL);
84                  }                  }
85                  else if (strncmp(line, "include ", 8) == 0)                  else if (strncmp(line, "include ", 8) == 0)
86                  {                  {
87                          if (!xkeymap_read(line+8))                          if (!xkeymap_read(line + 8))
88                                  return False;                                  return False;
89                  }                  }
90                  else if (strncmp(line, "map ", 4) == 0)                  else if (strncmp(line, "map ", 4) == 0)
91                  {                  {
92                          keylayout = strtol(line+4, NULL, 16);                          keylayout = strtol(line + 4, NULL, 16);
93                  }                  }
94                  else if (line[0] != '#')                  else if (line[0] != '#')
95                  {                  {
# Line 98  static BOOL xkeymap_read(char *mapname) Line 101  static BOOL xkeymap_read(char *mapname)
101          return True;          return True;
102  }  }
103    
104  void xkeymap_init(void)  void
105    xkeymap_init(void)
106  {  {
107          unsigned int max_keycode;          unsigned int max_keycode;
108    
# Line 108  void xkeymap_init(void) Line 112  void xkeymap_init(void)
112                  xkeymap_read(keymapname);                  xkeymap_read(keymapname);
113  }  }
114    
115  uint8 xkeymap_translate_key(unsigned int keysym, unsigned int keycode, uint16 *flags)  uint8
116    xkeymap_translate_key(unsigned int keysym, unsigned int keycode,
117                          uint16 * flags)
118  {  {
119          uint8 scancode;          uint8 scancode;
120    
# Line 124  uint8 xkeymap_translate_key(unsigned int Line 130  uint8 xkeymap_translate_key(unsigned int
130          /* not in keymap, try to interpret the raw scancode */          /* not in keymap, try to interpret the raw scancode */
131    
132          if ((keycode >= min_keycode) && (keycode <= 0x60))          if ((keycode >= min_keycode) && (keycode <= 0x60))
133                  return (uint8)(keycode - min_keycode);                  return (uint8) (keycode - min_keycode);
134    
135          *flags |= KBD_FLAG_EXT;          *flags |= KBD_FLAG_EXT;
136    
# Line 173  uint8 xkeymap_translate_key(unsigned int Line 179  uint8 xkeymap_translate_key(unsigned int
179          return 0;          return 0;
180  }  }
181    
182  uint16 xkeymap_translate_button(unsigned int button)  uint16
183    xkeymap_translate_button(unsigned int button)
184  {  {
185          switch (button)          switch (button)
186          {          {
187                  case Button1:   /* left */                  case Button1:   /* left */
188                          return MOUSE_FLAG_BUTTON1;                          return MOUSE_FLAG_BUTTON1;
189                  case Button2:   /* middle */                  case Button2:   /* middle */
190                          return MOUSE_FLAG_BUTTON3;                          return MOUSE_FLAG_BUTTON3;
191                  case Button3:   /* right */                  case Button3:   /* right */
192                          return MOUSE_FLAG_BUTTON2;                          return MOUSE_FLAG_BUTTON2;
193                  case Button4:   /* wheel up */                  case Button4:   /* wheel up */
194                          return MOUSE_FLAG_BUTTON4;                          return MOUSE_FLAG_BUTTON4;
195                  case Button5:   /* wheel down */                  case Button5:   /* wheel down */
196                          return MOUSE_FLAG_BUTTON5;                          return MOUSE_FLAG_BUTTON5;
197          }          }
198    

Legend:
Removed from v.56  
changed lines
  Added in v.64

  ViewVC Help
Powered by ViewVC 1.1.26