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.363 by root, Sun Nov 11 04:08:00 2007 UTC vs.
Revision 1.371 by ayin, Wed Dec 5 08:46:30 2007 UTC

549 if (keysym >= 0xFF00 && keysym <= 0xFFFF) 549 if (keysym >= 0xFF00 && keysym <= 0xFFFF)
550 { 550 {
551 { 551 {
552 bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; 552 bool kp = priv_modes & PrivMode_aplKP ? !shft : shft;
553 newlen = 1; 553 newlen = 1;
554#ifdef XK_KP_Home
555 static const KeySym keypadtrans[] = {
556 XK_KP_7, // XK_KP_Home
557 XK_KP_4, // XK_KP_Left
558 XK_KP_8, // XK_KP_Up
559 XK_KP_6, // XK_KP_Right
560 XK_KP_2, // XK_KP_Down
561#ifndef UNSHIFTED_SCROLLKEYS
562 XK_KP_9, // XK_KP_Prior
563 XK_KP_3, // XK_KP_Next
564#else
565 XK_Prior,
566 XK_Next,
567#endif
568 XK_KP_1, // XK_KP_End
569 XK_KP_5, // XK_KP_Begin
570 };
571
572 if (IN_RANGE_INC (keysym, XK_KP_Home, XK_KP_Begin))
573 {
574 unsigned int index = keysym - XK_KP_Home;
575 keysym = kp ? keypadtrans[index] : XK_Home + index;
576 }
577 else if (keysym == XK_KP_Insert)
578 keysym = kp ? XK_KP_0 : XK_Insert;
579#ifndef NO_DELETE_KEY
580 else if (keysym == XK_KP_Delete)
581 keysym = kp ? XK_KP_Decimal : XK_Delete;
582#endif
583#endif
554 switch (keysym) 584 switch (keysym)
555 { 585 {
556#ifndef NO_BACKSPACE_KEY 586#ifndef NO_BACKSPACE_KEY
557 case XK_BackSpace: 587 case XK_BackSpace:
558 if (priv_modes & PrivMode_HaveBackSpace) 588 if (priv_modes & PrivMode_HaveBackSpace)
564 else 594 else
565 strcpy (kbuf, rs[Rs_backspace_key]); 595 strcpy (kbuf, rs[Rs_backspace_key]);
566 break; 596 break;
567#endif 597#endif
568#ifndef NO_DELETE_KEY 598#ifndef NO_DELETE_KEY
569# ifdef XK_KP_Delete
570 case XK_KP_Delete:
571 /* allow shift to override */
572 if (kp)
573 {
574 strcpy (kbuf, "\033On");
575 break;
576 }
577 /* FALLTHROUGH */
578# endif
579 case XK_Delete: 599 case XK_Delete:
580 strcpy (kbuf, rs[Rs_delete_key]); 600 strcpy (kbuf, rs[Rs_delete_key]);
581 break; 601 break;
582#endif 602#endif
583 case XK_Tab: 603 case XK_Tab:
595#endif 615#endif
596 newlen = 0; 616 newlen = 0;
597 } 617 }
598 break; 618 break;
599 619
600#ifdef XK_KP_Left
601 case XK_KP_Left: /* \033Ot or standard */
602 case XK_KP_Up: /* \033Ox or standard */
603 case XK_KP_Right: /* \033Ov or standard */
604 case XK_KP_Down: /* \033Or or standard */
605 if (kp)
606 {
607 strcpy (kbuf, "\033OZ");
608 kbuf[2] = "txvr"[keysym - XK_KP_Left];
609 break;
610 }
611 else
612 /* translate to std. cursor key */
613 keysym = XK_Left + (keysym - XK_KP_Left);
614 /* FALLTHROUGH */
615#endif
616 case XK_Up: /* "\033[A" */ 620 case XK_Up: /* "\033[A" */
617 case XK_Down: /* "\033[B" */ 621 case XK_Down: /* "\033[B" */
618 case XK_Right: /* "\033[C" */ 622 case XK_Right: /* "\033[C" */
619 case XK_Left: /* "\033[D" */ 623 case XK_Left: /* "\033[D" */
620 strcpy (kbuf, "\033[Z"); 624 strcpy (kbuf, "\033[Z");
630 else if (priv_modes & PrivMode_aplCUR) 634 else if (priv_modes & PrivMode_aplCUR)
631 kbuf[1] = 'O'; 635 kbuf[1] = 'O';
632 break; 636 break;
633 637
634#ifndef UNSHIFTED_SCROLLKEYS 638#ifndef UNSHIFTED_SCROLLKEYS
635# ifdef XK_KP_Prior
636 case XK_KP_Prior:
637 /* allow shift to override */
638 if (kp)
639 {
640 strcpy (kbuf, "\033Oy");
641 break;
642 }
643 /* FALLTHROUGH */
644# endif
645 case XK_Prior: 639 case XK_Prior:
646 strcpy (kbuf, "\033[5~"); 640 strcpy (kbuf, "\033[5~");
647 break; 641 break;
648# ifdef XK_KP_Next
649 case XK_KP_Next:
650 /* allow shift to override */
651 if (kp)
652 {
653 strcpy (kbuf, "\033Os");
654 break;
655 }
656 /* FALLTHROUGH */
657# endif
658 case XK_Next: 642 case XK_Next:
659 strcpy (kbuf, "\033[6~"); 643 strcpy (kbuf, "\033[6~");
660 break; 644 break;
661#endif 645#endif
662 case XK_KP_Enter: 646 case XK_KP_Enter:
681 kbuf[0] = '\015'; 665 kbuf[0] = '\015';
682 kbuf[1] = '\0'; 666 kbuf[1] = '\0';
683 } 667 }
684 break; 668 break;
685 669
686#ifdef XK_KP_Begin
687 case XK_KP_Begin:
688 strcpy (kbuf, "\033Ou");
689 break;
690
691#endif
692 case XK_KP_F1: /* "\033OP" */ 670 case XK_KP_F1: /* "\033OP" */
693 case XK_KP_F2: /* "\033OQ" */ 671 case XK_KP_F2: /* "\033OQ" */
694 case XK_KP_F3: /* "\033OR" */ 672 case XK_KP_F3: /* "\033OR" */
695 case XK_KP_F4: /* "\033OS" */ 673 case XK_KP_F4: /* "\033OS" */
696 strcpy (kbuf, "\033OP"); 674 strcpy (kbuf, "\033OP");
728 706
729 case XK_Find: 707 case XK_Find:
730 strcpy (kbuf, "\033[1~"); 708 strcpy (kbuf, "\033[1~");
731 break; 709 break;
732 710
733#ifdef XK_KP_Insert
734 case XK_KP_Insert:
735 /* allow shift to override */
736 if (kp)
737 {
738 strcpy (kbuf, "\033Op");
739 break;
740 }
741 /* FALLTHROUGH */
742#endif
743 case XK_Insert: 711 case XK_Insert:
744 strcpy (kbuf, "\033[2~"); 712 strcpy (kbuf, "\033[2~");
745 break; 713 break;
746#ifdef DXK_Remove /* support for DEC remove like key */ 714#ifdef DXK_Remove /* support for DEC remove like key */
747 case DXK_Remove: 715 case DXK_Remove:
751 strcpy (kbuf, "\033[3~"); 719 strcpy (kbuf, "\033[3~");
752 break; 720 break;
753 case XK_Select: 721 case XK_Select:
754 strcpy (kbuf, "\033[4~"); 722 strcpy (kbuf, "\033[4~");
755 break; 723 break;
756#ifdef XK_KP_End
757 case XK_KP_End:
758 /* allow shift to override */
759 if (kp)
760 {
761 strcpy (kbuf, "\033Oq");
762 break;
763 }
764 /* FALLTHROUGH */
765#endif
766 case XK_End: 724 case XK_End:
767 strcpy (kbuf, KS_END); 725 strcpy (kbuf, KS_END);
768 break; 726 break;
769#ifdef XK_KP_Home
770 case XK_KP_Home:
771 /* allow shift to override */
772 if (kp)
773 {
774 strcpy (kbuf, "\033Ow");
775 break;
776 }
777 /* FALLTHROUGH */
778#endif
779 case XK_Home: 727 case XK_Home:
780 strcpy (kbuf, KS_HOME); 728 strcpy (kbuf, KS_HOME);
781 break; 729 break;
782 730
783#define FKEY(n, fkey) \ 731#define FKEY(n, fkey) \
1101 make_current (); 1049 make_current ();
1102 1050
1103 display->flush (); 1051 display->flush ();
1104 1052
1105 if (want_refresh && !flush_ev.active) 1053 if (want_refresh && !flush_ev.active)
1106 flush_ev.start (1. / 60.); // refresh at max. 60 hz normally 1054 flush_ev.start (1. / 60.); // refresh at max. 60 Hz normally
1107} 1055}
1108 1056
1109void 1057void
1110rxvt_term::flush_cb (ev::timer &w, int revents) 1058rxvt_term::flush_cb (ev::timer &w, int revents)
1111{ 1059{
1303 int x, y; 1251 int x, y;
1304 int code = 32; 1252 int code = 32;
1305 1253
1306 x = Pixel2Col (ev.x); 1254 x = Pixel2Col (ev.x);
1307 y = Pixel2Row (ev.y); 1255 y = Pixel2Row (ev.y);
1308 if (ev.type == MotionNotify) { 1256 if (ev.type == MotionNotify)
1257 {
1309 if (x == mouse_row && y == mouse_col) 1258 if (x == mouse_row && y == mouse_col)
1310 return; 1259 return;
1311 mouse_row = x; 1260 mouse_row = x;
1312 mouse_col = y; 1261 mouse_col = y;
1313 code += 32; 1262 code += 32;
1314 } 1263 }
1315 1264
1316 if (MEvent.button == AnyButton) 1265 if (MEvent.button == AnyButton)
1317 button_number = 3; 1266 button_number = 3;
1318 else 1267 else
1319 { 1268 {
1901 mouse_report (ev); 1850 mouse_report (ev);
1902 } 1851 }
1903#else 1852#else
1904 MEvent.button = ev.button; 1853 MEvent.button = ev.button;
1905 mouse_report (ev); 1854 mouse_report (ev);
1906#endif /* MOUSE_REPORT_DOUBLECLICK */ 1855#endif /* MOUSE_REPORT_DOUBLECLICK */
1907 1856
1908 } 1857 }
1909 else 1858 else
1910 { 1859 {
1911 if (ev.button != MEvent.button) 1860 if (ev.button != MEvent.button)
2005 tt_printf ("\033[5~"); 1954 tt_printf ("\033[5~");
2006 break; 1955 break;
2007 } 1956 }
2008 } 1957 }
2009 else 1958 else
2010#endif /* NO_SCROLLBAR_REPORT */ 1959#endif /* NO_SCROLLBAR_REPORT */
2011 1960
2012 { 1961 {
2013 char upordown = 0; 1962 char upordown = 0;
2014 1963
2015 if (scrollBar.style == R_SB_NEXT) 1964 if (scrollBar.style == R_SB_NEXT)
2016 { 1965 {
2017 if (scrollbarnext_upButton (ev.y)) 1966 if (scrollbarnext_upButton (ev.y))
2018 upordown = -1; /* up */ 1967 upordown = -1; /* up */
2152 mouse_report (ev); 2101 mouse_report (ev);
2153 } 2102 }
2154#else /* MOUSE_REPORT_DOUBLECLICK */ 2103#else /* MOUSE_REPORT_DOUBLECLICK */
2155 MEvent.button = AnyButton; 2104 MEvent.button = AnyButton;
2156 mouse_report (ev); 2105 mouse_report (ev);
2157#endif /* MOUSE_REPORT_DOUBLECLICK */ 2106#endif /* MOUSE_REPORT_DOUBLECLICK */
2158 return; 2107 return;
2159 } 2108 }
2160 2109
2161 /* 2110 /*
2162 * dumb hack to compensate for the failure of click-and-drag 2111 * dumb hack to compensate for the failure of click-and-drag
2278 2227
2279 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) 2228 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1)
2280 { 2229 {
2281 refresh_count = 0; 2230 refresh_count = 0;
2282 2231
2283 if (!option (Opt_skipScroll) || ev::ev_time () > ev::now () + 1. / 60.) 2232 if (!option (Opt_skipScroll) || ev_time () > ev::now () + 1. / 60.)
2284 { 2233 {
2285 refreshnow = true; 2234 refreshnow = true;
2286 ch = NOCHAR; 2235 ch = NOCHAR;
2287 break; 2236 break;
2288 } 2237 }
2499 } 2448 }
2500 } 2449 }
2501 2450
2502 pclose_printer (fd); 2451 pclose_printer (fd);
2503} 2452}
2504#endif /* PRINTPIPE */ 2453#endif /* PRINTPIPE */
2505/*}}} */ 2454/*}}} */
2506 2455
2507/* *INDENT-OFF* */ 2456/* *INDENT-OFF* */
2508enum { 2457enum {
2509 C1_40 = 0x40, 2458 C1_40 = 0x40,
2802 nargs = 0; 2751 nargs = 0;
2803 2752
2804 priv = 0; 2753 priv = 0;
2805 ch = cmd_getc (); 2754 ch = cmd_getc ();
2806 if (ch >= '<' && ch <= '?') 2755 if (ch >= '<' && ch <= '?')
2756 {
2807 { /* '<' '=' '>' '?' */ 2757 /* '<' '=' '>' '?' */
2808 priv = ch; 2758 priv = ch;
2809 ch = cmd_getc (); 2759 ch = cmd_getc ();
2810 } 2760 }
2811 2761
2812 /* read any numerical arguments */ 2762 /* read any numerical arguments */
3632 { 66, PrivMode_aplKP }, 3582 { 66, PrivMode_aplKP },
3633#ifndef NO_BACKSPACE_KEY 3583#ifndef NO_BACKSPACE_KEY
3634 { 67, PrivMode_BackSpace }, 3584 { 67, PrivMode_BackSpace },
3635#endif 3585#endif
3636 { 1000, PrivMode_MouseX11 }, 3586 { 1000, PrivMode_MouseX11 },
3637 // 1001 Use Hilite Mouse Tracking. NYI, TODO
3638 { 1002, PrivMode_MouseBtnEvent }, 3587 { 1002, PrivMode_MouseBtnEvent },
3639 { 1003, PrivMode_MouseAnyEvent }, 3588 { 1003, PrivMode_MouseAnyEvent },
3640 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3589 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3641 { 1011, PrivMode_Keypress }, // rxvt extension 3590 { 1011, PrivMode_Keypress }, // rxvt extension
3642 // 1035 enable modifiers for alt, numlock NYI 3591 // 1035 enable modifiers for alt, numlock NYI
3743 /* case 67: - backspace key */ 3692 /* case 67: - backspace key */
3744 case 1000: /* X11 mouse reporting */ 3693 case 1000: /* X11 mouse reporting */
3745 if (state) /* orthogonal */ 3694 if (state) /* orthogonal */
3746 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); 3695 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3747 break; 3696 break;
3748#if 0
3749 case 1001:
3750 break; /* X11 mouse highlighting */
3751#endif
3752 case 1002: 3697 case 1002:
3753 case 1003: 3698 case 1003:
3754 if (state) { 3699 if (state)
3700 {
3755 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11); 3701 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11);
3756 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; 3702 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
3757 vt_emask_mouse = PointerMotionMask; 3703 vt_emask_mouse = PointerMotionMask;
3704 }
3758 } else 3705 else
3759 vt_emask_mouse = NoEventMask; 3706 vt_emask_mouse = NoEventMask;
3760 vt_select_input (); 3707 vt_select_input ();
3761 break; 3708 break;
3762 case 1010: /* scroll to bottom on TTY output inhibit */ 3709 case 1010: /* scroll to bottom on TTY output inhibit */
3763 set_option (Opt_scrollTtyOutput, !state); 3710 set_option (Opt_scrollTtyOutput, !state);
3943rxvt_term::process_graphics () 3890rxvt_term::process_graphics ()
3944{ 3891{
3945 unicode_t ch, cmd = cmd_getc (); 3892 unicode_t ch, cmd = cmd_getc ();
3946 3893
3947 if (cmd == 'Q') 3894 if (cmd == 'Q')
3895 {
3948 { /* query graphics */ 3896 /* query graphics */
3949 tt_printf ("\033G0\012"); /* no graphics */ 3897 tt_printf ("\033G0\012"); /* no graphics */
3950 return; 3898 return;
3951 } 3899 }
3952 /* swallow other graphics sequences until terminating ':' */ 3900 /* swallow other graphics sequences until terminating ':' */
3953 do 3901 do

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines