ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.403 by ayin, Fri Feb 1 14:15:10 2008 UTC vs.
Revision 1.408 by ayin, Sat Feb 16 13:36:10 2008 UTC

279 } 279 }
280 280
281 iso14755buf = 0; 281 iso14755buf = 0;
282} 282}
283 283
284int 284static int
285rxvt_term::hex_keyval (XKeyEvent &ev) 285hex_keyval (XKeyEvent &ev)
286{ 286{
287 // check wether this event corresponds to a hex digit 287 // check wether this event corresponds to a hex digit
288 // if the modifiers had not been pressed. 288 // if the modifiers had not been pressed.
289 for (int index = 0; index < 8; index++) 289 for (int index = 0; index < 8; index++)
290 { 290 {
298 298
299 return -1; 299 return -1;
300} 300}
301#endif 301#endif
302 302
303static inline KeySym
304translate_keypad (KeySym keysym, bool kp)
305{
306#ifdef XK_KP_Home
307 static const KeySym keypadtrans[] = {
308 XK_KP_7, // XK_KP_Home
309 XK_KP_4, // XK_KP_Left
310 XK_KP_8, // XK_KP_Up
311 XK_KP_6, // XK_KP_Right
312 XK_KP_2, // XK_KP_Down
313# ifndef UNSHIFTED_SCROLLKEYS
314 XK_KP_9, // XK_KP_Prior
315 XK_KP_3, // XK_KP_Next
316# else
317 XK_Prior,
318 XK_Next,
319# endif
320 XK_KP_1, // XK_KP_End
321 XK_KP_5, // XK_KP_Begin
322 };
323
324 if (IN_RANGE_INC (keysym, XK_KP_Home, XK_KP_Begin))
325 {
326 unsigned int index = keysym - XK_KP_Home;
327 keysym = kp ? keypadtrans[index] : XK_Home + index;
328 }
329 else if (keysym == XK_KP_Insert)
330 keysym = kp ? XK_KP_0 : XK_Insert;
331# ifndef NO_DELETE_KEY
332 else if (keysym == XK_KP_Delete)
333 keysym = kp ? XK_KP_Decimal : XK_Delete;
334# endif
335#endif
336 return keysym;
337}
338
303void 339void
304rxvt_term::key_press (XKeyEvent &ev) 340rxvt_term::key_press (XKeyEvent &ev)
305{ 341{
306 int ctrl, meta, shft, len; 342 int ctrl, meta, shft, len;
307 unsigned int newlen;
308 KeySym keysym; 343 KeySym keysym;
309 int valid_keysym; 344 int valid_keysym;
310 char kbuf[KBUFSZ]; 345 char kbuf[KBUFSZ];
311 346
312#if ISO_14755 347#if ISO_14755
547 } 582 }
548#endif 583#endif
549 584
550 if (keysym >= 0xFF00 && keysym <= 0xFFFF) 585 if (keysym >= 0xFF00 && keysym <= 0xFFFF)
551 { 586 {
552 {
553 bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; 587 bool kp = priv_modes & PrivMode_aplKP ? !shft : shft;
554 newlen = 1; 588 unsigned int newlen = 1;
555#ifdef XK_KP_Home
556 static const KeySym keypadtrans[] = {
557 XK_KP_7, // XK_KP_Home
558 XK_KP_4, // XK_KP_Left
559 XK_KP_8, // XK_KP_Up
560 XK_KP_6, // XK_KP_Right
561 XK_KP_2, // XK_KP_Down
562#ifndef UNSHIFTED_SCROLLKEYS
563 XK_KP_9, // XK_KP_Prior
564 XK_KP_3, // XK_KP_Next
565#else
566 XK_Prior,
567 XK_Next,
568#endif
569 XK_KP_1, // XK_KP_End
570 XK_KP_5, // XK_KP_Begin
571 };
572 589
573 if (IN_RANGE_INC (keysym, XK_KP_Home, XK_KP_Begin)) 590 switch (translate_keypad (keysym, kp))
574 {
575 unsigned int index = keysym - XK_KP_Home;
576 keysym = kp ? keypadtrans[index] : XK_Home + index;
577 }
578 else if (keysym == XK_KP_Insert)
579 keysym = kp ? XK_KP_0 : XK_Insert;
580#ifndef NO_DELETE_KEY
581 else if (keysym == XK_KP_Delete)
582 keysym = kp ? XK_KP_Decimal : XK_Delete;
583#endif
584#endif
585 switch (keysym)
586 { 591 {
587#ifndef NO_BACKSPACE_KEY 592#ifndef NO_BACKSPACE_KEY
588 case XK_BackSpace: 593 case XK_BackSpace:
589 if (priv_modes & PrivMode_HaveBackSpace) 594 if (priv_modes & PrivMode_HaveBackSpace)
590 { 595 {
789 break; 794 break;
790 } 795 }
791 796
792 if (newlen) 797 if (newlen)
793 len = strlen (kbuf); 798 len = strlen (kbuf);
794 }
795 799
796 /* 800 /*
797 * Pass meta for all function keys, if 'meta' option set 801 * Pass meta for all function keys, if 'meta' option set
798 */ 802 */
799#ifdef META8_OPTION 803#ifdef META8_OPTION
1993 break; 1997 break;
1994 } 1998 }
1995 } 1999 }
1996 else 2000 else
1997#endif /* NO_SCROLLBAR_REPORT */ 2001#endif /* NO_SCROLLBAR_REPORT */
1998
1999 { 2002 {
2000 if (direction != NO_DIR) 2003 if (direction != NO_DIR)
2001 { 2004 {
2002#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 2005#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
2003 if (!cont_scroll_ev.is_active ()) 2006 if (!cont_scroll_ev.is_active ())

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines