/[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 85 by astrand, Wed Jul 31 06:49:34 2002 UTC revision 115 by astrand, Wed Sep 11 09:52:30 2002 UTC
# Line 41  static key_translation keymap[KEYMAP_SIZ Line 41  static key_translation keymap[KEYMAP_SIZ
41  static int min_keycode;  static int min_keycode;
42  static uint16 remote_modifier_state = 0;  static uint16 remote_modifier_state = 0;
43    
44    static void update_modifier_state(uint16 modifiers, BOOL pressed);
45    
46  static void  static void
47  add_to_keymap(char *keyname, uint8 scancode, uint16 modifiers, char *mapname)  add_to_keymap(char *keyname, uint8 scancode, uint16 modifiers, char *mapname)
48  {  {
# Line 247  xkeymap_translate_key(KeySym keysym, uns Line 249  xkeymap_translate_key(KeySym keysym, uns
249                  return tr;                  return tr;
250          }          }
251    
252          printf("No translation for (keysym 0x%lx, %s)\n", keysym, get_ksname(keysym));          fprintf(stderr, "No translation for (keysym 0x%lx, %s)\n", keysym, get_ksname(keysym));
253    
254          /* not in keymap, try to interpret the raw scancode */          /* not in keymap, try to interpret the raw scancode */
255          if ((keycode >= min_keycode) && (keycode <= 0x60))          if ((keycode >= min_keycode) && (keycode <= 0x60))
256          {          {
257                  tr.scancode = keycode - min_keycode;                  tr.scancode = keycode - min_keycode;
258                  printf("Sending guessed scancode 0x%x\n", tr.scancode);                  fprintf(stderr, "Sending guessed scancode 0x%x\n", tr.scancode);
259          }          }
260          else          else
261          {          {
262                  printf("No good guess for keycode 0x%x found\n", keycode);                  fprintf(stderr, "No good guess for keycode 0x%x found\n", keycode);
263          }          }
264    
265          return tr;          return tr;
# Line 307  inhibit_key(KeySym keysym) Line 309  inhibit_key(KeySym keysym)
309                  case XK_Multi_key:                  case XK_Multi_key:
310                          return True;                          return True;
311                          break;                          break;
312                    case XK_Num_Lock:
313                            return True;
314                            break;
315                  default:                  default:
316                          break;                          break;
317          }          }
# Line 372  ensure_remote_modifiers(uint32 ev_time, Line 377  ensure_remote_modifiers(uint32 ev_time,
377              != MASK_HAS_BITS(remote_modifier_state, MapNumLockMask))              != MASK_HAS_BITS(remote_modifier_state, MapNumLockMask))
378          {          {
379                  /* The remote modifier state is not correct */                  /* The remote modifier state is not correct */
380                  DEBUG_KBD(("Remote NumLock state is incorrect. Toggling\n"));                  uint16 new_remote_state = 0;
381    
382                  if (MASK_HAS_BITS(tr.modifiers, MapNumLockMask))                  if (MASK_HAS_BITS(tr.modifiers, MapNumLockMask))
383                  {                  {
384                          /* Needs this modifier. Toggle */                          DEBUG_KBD(("Remote NumLock state is incorrect, activating NumLock.\n"));
385                          rdp_send_scancode(ev_time, RDP_KEYPRESS, SCANCODE_CHAR_NUMLOCK);                          new_remote_state |= KBD_FLAG_NUMLOCK;
                         rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_NUMLOCK);  
386                  }                  }
387                  else                  else
388                  {                  {
389                          /* Should not use this modifier. Toggle */                          DEBUG_KBD(("Remote NumLock state is incorrect, deactivating NumLock.\n"));
                         rdp_send_scancode(ev_time, RDP_KEYPRESS, SCANCODE_CHAR_NUMLOCK);  
                         rdp_send_scancode(ev_time, RDP_KEYRELEASE, SCANCODE_CHAR_NUMLOCK);  
390                  }                  }
         }  
391    
392                    rdp_send_input(0, RDP_INPUT_SYNCHRONIZE, 0, new_remote_state, 0);
393                    update_modifier_state(SCANCODE_CHAR_NUMLOCK, True);
394            }
395  }  }
396    
397    
398  static void  static void
399  update_modifier_state(uint16 modifiers, BOOL pressed)  update_modifier_state(uint16 modifiers, BOOL pressed)
400  {  {
401    #ifdef WITH_DEBUG_KBD
402            uint16 old_modifier_state;
403    
404            old_modifier_state = remote_modifier_state;
405    #endif
406    
         DEBUG_KBD(("Before updating modifier_state:0x%x, pressed=0x%x\n",  
                    remote_modifier_state, pressed));  
407          switch (modifiers)          switch (modifiers)
408          {          {
409                  case SCANCODE_CHAR_LSHIFT:                  case SCANCODE_CHAR_LSHIFT:
# Line 436  update_modifier_state(uint16 modifiers, Line 444  update_modifier_state(uint16 modifiers,
444                          }                          }
445                          break;                          break;
446          }          }
447          DEBUG_KBD(("After updating modifier_state:0x%x\n", remote_modifier_state));  
448    #ifdef WITH_DEBUG_KBD
449            if (old_modifier_state != remote_modifier_state)
450            {
451                    DEBUG_KBD(("Before updating modifier_state:0x%x, pressed=0x%x\n",
452                               old_modifier_state, pressed));
453                    DEBUG_KBD(("After updating modifier_state:0x%x\n", remote_modifier_state));
454            }
455    #endif
456    
457  }  }
458    

Legend:
Removed from v.85  
changed lines
  Added in v.115

  ViewVC Help
Powered by ViewVC 1.1.26