/[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 183 by astrand, Tue Sep 17 16:57:07 2002 UTC revision 190 by matthewc, Tue Sep 24 07:33:17 2002 UTC
# Line 19  Line 19 
19  */  */
20    
21  #include <X11/Xlib.h>  #include <X11/Xlib.h>
22  #include <X11/keysym.h>  #define XK_MISCELLANY
23  #include <stdio.h>  #include <X11/keysymdef.h>
 #include <stdlib.h>  
 #include <string.h>  
24  #include <ctype.h>  #include <ctype.h>
25  #include <limits.h>  #include <limits.h>
26  #include <assert.h>  #include <time.h>
27  #include "rdesktop.h"  #include "rdesktop.h"
28  #include "scancodes.h"  #include "scancodes.h"
29    
# Line 206  void Line 204  void
204  xkeymap_init(void)  xkeymap_init(void)
205  {  {
206          unsigned int max_keycode;          unsigned int max_keycode;
         int i;  
207    
208          if (strcmp(keymapname, "none"))          if (strcmp(keymapname, "none"))
209                  xkeymap_read(keymapname);                  xkeymap_read(keymapname);
# Line 217  xkeymap_init(void) Line 214  xkeymap_init(void)
214  /* Handles, for example, multi-scancode keypresses (which is not  /* Handles, for example, multi-scancode keypresses (which is not
215     possible via keymap-files) */     possible via keymap-files) */
216  BOOL  BOOL
217  handle_special_keys(KeySym keysym, uint32 ev_time, BOOL pressed)  handle_special_keys(uint32 keysym, uint32 ev_time, BOOL pressed)
218  {  {
219          switch (keysym)          switch (keysym)
220          {          {
# Line 253  handle_special_keys(KeySym keysym, uint3 Line 250  handle_special_keys(KeySym keysym, uint3
250    
251    
252  key_translation  key_translation
253  xkeymap_translate_key(KeySym keysym, unsigned int keycode, unsigned int state)  xkeymap_translate_key(uint32 keysym, unsigned int keycode, unsigned int state)
254  {  {
255          key_translation tr = { 0, 0 };          key_translation tr = { 0, 0 };
256    
# Line 278  xkeymap_translate_key(KeySym keysym, uns Line 275  xkeymap_translate_key(KeySym keysym, uns
275    
276          if (tr.scancode != 0)          if (tr.scancode != 0)
277          {          {
278                  DEBUG_KBD                  DEBUG_KBD(("Found key translation, scancode=0x%x, modifiers=0x%x\n",
                         (("Found key translation, scancode=0x%x, modifiers=0x%x\n",  
279                            tr.scancode, tr.modifiers));                            tr.scancode, tr.modifiers));
280                  return tr;                  return tr;
281          }          }
282    
283          fprintf(stderr, "No translation for (keysym 0x%lx, %s)\n", keysym, get_ksname(keysym));          DEBUG_KBD(("No translation for (keysym 0x%lx, %s)\n", keysym, get_ksname(keysym)));
284    
285          /* not in keymap, try to interpret the raw scancode */          /* not in keymap, try to interpret the raw scancode */
286          if ((keycode >= min_keycode) && (keycode <= 0x60))          if ((keycode >= min_keycode) && (keycode <= 0x60))
# Line 299  xkeymap_translate_key(KeySym keysym, uns Line 295  xkeymap_translate_key(KeySym keysym, uns
295                          tr.modifiers = MapLeftShiftMask;                          tr.modifiers = MapLeftShiftMask;
296                  }                  }
297    
298                  fprintf(stderr, "Sending guessed scancode 0x%x\n", tr.scancode);                  DEBUG_KBD(("Sending guessed scancode 0x%x\n", tr.scancode));
299          }          }
300          else          else
301          {          {
302                  fprintf(stderr, "No good guess for keycode 0x%x found\n", keycode);                  DEBUG_KBD(("No good guess for keycode 0x%x found\n", keycode));
303          }          }
304    
305          return tr;          return tr;
# Line 330  xkeymap_translate_button(unsigned int bu Line 326  xkeymap_translate_button(unsigned int bu
326  }  }
327    
328  char *  char *
329  get_ksname(KeySym keysym)  get_ksname(uint32 keysym)
330  {  {
331          char *ksname = NULL;          char *ksname = NULL;
332    
# Line 385  ensure_remote_modifiers(uint32 ev_time, Line 381  ensure_remote_modifiers(uint32 ev_time,
381                                  /* Left shift is down */                                  /* Left shift is down */
382                                  rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_LSHIFT);                                  rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_LSHIFT);
383                          else                          else
                         {  
                                 assert(MASK_HAS_BITS(remote_modifier_state, MapRightShiftMask));  
384                                  /* Right shift is down */                                  /* Right shift is down */
385                                  rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_RSHIFT);                                  rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_RSHIFT);
                         }  
   
386                  }                  }
387          }          }
388    

Legend:
Removed from v.183  
changed lines
  Added in v.190

  ViewVC Help
Powered by ViewVC 1.1.26