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.494 by sf-exg, Mon Aug 22 17:23:56 2011 UTC vs.
Revision 1.503 by sf-exg, Mon Dec 5 13:36:56 2011 UTC

776 } 776 }
777 777
778 if (newlen) 778 if (newlen)
779 len = strlen (kbuf); 779 len = strlen (kbuf);
780 780
781 if (len > 0)
782 {
781 /* 783 /*
784 * pass Shift/Control indicators for function keys ending with `~'
785 *
786 * eg,
787 * Prior = "ESC[5~"
788 * Shift+Prior = "ESC[5$"
789 * Ctrl+Prior = "ESC[5^"
790 * Ctrl+Shift+Prior = "ESC[5@"
791 */
792 if (kbuf[0] == C0_ESC && kbuf[1] == '[' && kbuf[len - 1] == '~')
793 kbuf[len - 1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~'));
794
795 /*
782 * Pass meta for all function keys, if 'meta' option set 796 * Pass meta for all function keys, if 'meta' option set
783 */ 797 */
784#ifdef META8_OPTION 798#ifdef META8_OPTION
785 if (meta && (meta_char == 0x80) && len > 0) 799 if (meta && (meta_char == 0x80))
786 kbuf[len - 1] |= 0x80; 800 kbuf[len - 1] |= 0x80;
787#endif 801#endif
802 }
788 803
789 } 804 }
790 else if (ctrl && keysym == XK_minus) 805 else if (ctrl && keysym == XK_minus)
791 { 806 {
792 len = 1; 807 len = 1;
825 if (view_start) 840 if (view_start)
826 { 841 {
827 view_start = 0; 842 view_start = 0;
828 want_refresh = 1; 843 want_refresh = 1;
829 } 844 }
830
831 /*
832 * these modifications only affect the static keybuffer
833 * pass Shift/Control indicators for function keys ending with `~'
834 *
835 * eg,
836 * Prior = "ESC[5~"
837 * Shift+Prior = "ESC[5$"
838 * Ctrl+Prior = "ESC[5^"
839 * Ctrl+Shift+Prior = "ESC[5@"
840 * Meta adds an Escape prefix (with META8_OPTION, if meta == <escape>).
841 */
842 if (kbuf[0] == C0_ESC && kbuf[1] == '[' && kbuf[len - 1] == '~')
843 kbuf[len - 1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~'));
844 845
845 /* escape prefix */ 846 /* escape prefix */
846 if (meta 847 if (meta
847#ifdef META8_OPTION 848#ifdef META8_OPTION
848 && meta_char == C0_ESC 849 && meta_char == C0_ESC
1042 1043
1043#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1044#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1044void 1045void
1045rxvt_term::cont_scroll_cb (ev::timer &w, int revents) 1046rxvt_term::cont_scroll_cb (ev::timer &w, int revents)
1046{ 1047{
1047 if ((scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN) 1048 if ((scrollBar.state == SB_STATE_UP || scrollBar.state == SB_STATE_DOWN)
1048 && scr_page (scrollBar.state == STATE_UP ? UP : DN, 1)) 1049 && scr_page (scrollBar.state == SB_STATE_UP ? UP : DN, 1))
1049 { 1050 {
1050 want_refresh = 1; 1051 want_refresh = 1;
1051 refresh_check (); 1052 refresh_check ();
1052 } 1053 }
1053 else 1054 else
1557 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) 1558 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event))
1558 ; 1559 ;
1559 1560
1560 if (scrollBar.state && ev.xany.window == scrollBar.win) 1561 if (scrollBar.state && ev.xany.window == scrollBar.win)
1561 { 1562 {
1562 scrollBar.state = STATE_IDLE; 1563 scrollBar.state = SB_STATE_IDLE;
1563 scrollBar.show (0); 1564 scrollBar.show (0);
1564 } 1565 }
1565 } 1566 }
1566 break; 1567 break;
1567 1568
1655#ifdef MOUSE_THRESHOLD 1656#ifdef MOUSE_THRESHOLD
1656 } 1657 }
1657#endif 1658#endif
1658 } 1659 }
1659 } 1660 }
1660 else if (scrollBar.state == STATE_MOTION && ev.xany.window == scrollBar.win) 1661 else if (scrollBar.state == SB_STATE_MOTION && ev.xany.window == scrollBar.win)
1661 { 1662 {
1662 while (XCheckTypedWindowEvent (dpy, scrollBar.win, 1663 while (XCheckTypedWindowEvent (dpy, scrollBar.win,
1663 MotionNotify, &ev)) 1664 MotionNotify, &ev))
1664 ; 1665 ;
1665 1666
1716 if (XWMHints *h = XGetWMHints (dpy, parent)) 1717 if (XWMHints *h = XGetWMHints (dpy, parent))
1717 { 1718 {
1718 h->flags = h->flags & ~XUrgencyHint | (enable ? XUrgencyHint : 0); 1719 h->flags = h->flags & ~XUrgencyHint | (enable ? XUrgencyHint : 0);
1719 XSetWMHints (dpy, parent, h); 1720 XSetWMHints (dpy, parent, h);
1720 urgency_hint = enable; 1721 urgency_hint = enable;
1722 XFree (h);
1721 } 1723 }
1722} 1724}
1723#endif 1725#endif
1724 1726
1725void 1727void
1972 if (scrollBar.upButton (ev.y)) 1974 if (scrollBar.upButton (ev.y))
1973 direction = UP; /* up */ 1975 direction = UP; /* up */
1974 else if (scrollBar.dnButton (ev.y)) 1976 else if (scrollBar.dnButton (ev.y))
1975 direction = DN; /* down */ 1977 direction = DN; /* down */
1976 1978
1977 scrollBar.state = STATE_IDLE; 1979 scrollBar.state = SB_STATE_IDLE;
1978 /* 1980 /*
1979 * Rxvt-style scrollbar: 1981 * Rxvt-style scrollbar:
1980 * move up if mouse is above slider 1982 * move up if mouse is above slider
1981 * move dn if mouse is below slider 1983 * move dn if mouse is below slider
1982 * 1984 *
2021 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 2023 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2022#endif 2024#endif
2023 if (scr_page (direction, 1)) 2025 if (scr_page (direction, 1))
2024 { 2026 {
2025 if (direction == UP) 2027 if (direction == UP)
2026 scrollBar.state = STATE_UP; 2028 scrollBar.state = SB_STATE_UP;
2027 else 2029 else
2028 scrollBar.state = STATE_DOWN; 2030 scrollBar.state = SB_STATE_DOWN;
2029 } 2031 }
2030 } 2032 }
2031 else 2033 else
2032 switch (ev.button) 2034 switch (ev.button)
2033 { 2035 {
2034 case Button2: 2036 case Button2:
2035 switch (scrollBar.align) 2037 switch (scrollBar.align)
2036 { 2038 {
2037 case R_SB_ALIGN_TOP: 2039 case SB_ALIGN_TOP:
2038 csrO = 0; 2040 csrO = 0;
2039 break; 2041 break;
2040 case R_SB_ALIGN_CENTRE: 2042 case SB_ALIGN_CENTRE:
2041 csrO = (scrollBar.bot - scrollBar.top) / 2; 2043 csrO = (scrollBar.bot - scrollBar.top) / 2;
2042 break; 2044 break;
2043 case R_SB_ALIGN_BOTTOM: 2045 case SB_ALIGN_BOTTOM:
2044 csrO = scrollBar.bot - scrollBar.top; 2046 csrO = scrollBar.bot - scrollBar.top;
2045 break; 2047 break;
2046 } 2048 }
2047 2049
2048 if (scrollBar.style == R_SB_XTERM 2050 if (scrollBar.style == SB_STYLE_XTERM
2049 || scrollBar.above_slider (ev.y) 2051 || scrollBar.above_slider (ev.y)
2050 || scrollBar.below_slider (ev.y)) 2052 || scrollBar.below_slider (ev.y))
2051 scr_move_to (scrollBar.position (ev.y) - csrO, scrollBar.size ()); 2053 scr_move_to (scrollBar.position (ev.y) - csrO, scrollBar.size ());
2052 2054
2053 scrollBar.state = STATE_MOTION; 2055 scrollBar.state = SB_STATE_MOTION;
2054 break; 2056 break;
2055 2057
2056 case Button1: 2058 case Button1:
2057 if (scrollBar.align == R_SB_ALIGN_CENTRE) 2059 if (scrollBar.align == SB_ALIGN_CENTRE)
2058 csrO = ev.y - scrollBar.top; 2060 csrO = ev.y - scrollBar.top;
2059 /* FALLTHROUGH */ 2061 /* FALLTHROUGH */
2060 2062
2061 case Button3: 2063 case Button3:
2062 if (scrollBar.style != R_SB_XTERM) 2064 if (scrollBar.style != SB_STYLE_XTERM)
2063 { 2065 {
2064 if (scrollBar.above_slider (ev.y)) 2066 if (scrollBar.above_slider (ev.y))
2065# ifdef RXVT_SCROLL_FULL 2067# ifdef RXVT_SCROLL_FULL
2066 scr_page (UP, nrow - 1); 2068 scr_page (UP, nrow - 1);
2067# else 2069# else
2072 scr_page (DN, nrow - 1); 2074 scr_page (DN, nrow - 1);
2073# else 2075# else
2074 scr_page (DN, nrow / 4); 2076 scr_page (DN, nrow / 4);
2075# endif 2077# endif
2076 else 2078 else
2077 scrollBar.state = STATE_MOTION; 2079 scrollBar.state = SB_STATE_MOTION;
2078 } 2080 }
2079 else 2081 else
2080 { 2082 {
2081 scr_page ((ev.button == Button1 ? DN : UP), 2083 scr_page ((ev.button == Button1 ? DN : UP),
2082 (nrow 2084 (nrow
2099 2101
2100 csrO = 0; /* reset csr Offset */ 2102 csrO = 0; /* reset csr Offset */
2101 if (!bypass_keystate) 2103 if (!bypass_keystate)
2102 reportmode = !! (priv_modes & PrivMode_mouse_report); 2104 reportmode = !! (priv_modes & PrivMode_mouse_report);
2103 2105
2104 if (scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN) 2106 if (scrollBar.state == SB_STATE_UP || scrollBar.state == SB_STATE_DOWN)
2105 { 2107 {
2106 scrollBar.state = STATE_IDLE; 2108 scrollBar.state = SB_STATE_IDLE;
2107 scrollBar.show (0); 2109 scrollBar.show (0);
2108 } 2110 }
2109 2111
2110#ifdef SELECTION_SCROLLING 2112#ifdef SELECTION_SCROLLING
2111 sel_scroll_ev.stop(); 2113 sel_scroll_ev.stop();
2590 break; 2592 break;
2591 case 'Z': /* identify the terminal type */ 2593 case 'Z': /* identify the terminal type */
2592 tt_printf ("\033/Z"); /* I am a VT100 emulating a VT52 */ 2594 tt_printf ("\033/Z"); /* I am a VT100 emulating a VT52 */
2593 break; 2595 break;
2594 case '<': /* turn off VT52 mode */ 2596 case '<': /* turn off VT52 mode */
2595 set_privmode (PrivMode_vt52, 0); 2597 priv_modes &= ~PrivMode_vt52;
2596 break; 2598 break;
2597 case 'F': /* use special graphics character set */ 2599 case 'F': /* use special graphics character set */
2598 case 'G': /* use regular character set */ 2600 case 'G': /* use regular character set */
2599 /* unimplemented */ 2601 /* unimplemented */
2600 break; 2602 break;
2653 scr_forwardindex (); 2655 scr_forwardindex ();
2654 break; 2656 break;
2655#endif 2657#endif
2656 // DECPAM/DECPNM 2658 // DECPAM/DECPNM
2657 case '=': 2659 case '=':
2660 priv_modes |= PrivMode_aplKP;
2661 break;
2658 case '>': 2662 case '>':
2659 set_privmode (PrivMode_aplKP, ch == '='); 2663 priv_modes &= ~PrivMode_aplKP;
2660 break; 2664 break;
2661 2665
2662 case C1_40: 2666 case C1_40:
2663 cmd_getc (); 2667 cmd_getc ();
2664 break; 2668 break;
2883 } 2887 }
2884 break; 2888 break;
2885#endif 2889#endif
2886 2890
2887 case CSI_CUU: /* 8.3.22: (1) CURSOR UP */ 2891 case CSI_CUU: /* 8.3.22: (1) CURSOR UP */
2888 case CSI_VPR: /* 8.3.161: (1) LINE POSITION FORWARD */ 2892 case CSI_VPB: /* 8.3.160: (1) LINE POSITION BACKWARD */
2889 arg[0] = -arg[0]; 2893 arg[0] = -arg[0];
2890 /* FALLTHROUGH */ 2894 /* FALLTHROUGH */
2891 case CSI_CUD: /* 8.3.19: (1) CURSOR DOWN */ 2895 case CSI_CUD: /* 8.3.19: (1) CURSOR DOWN */
2892 case CSI_VPB: /* 8.3.160: (1) LINE POSITION BACKWARD */ 2896 case CSI_VPR: /* 8.3.161: (1) LINE POSITION FORWARD */
2893 scr_gotorc (arg[0], 0, RELATIVE); 2897 scr_gotorc (arg[0], 0, RELATIVE);
2894 break; 2898 break;
2895 2899
2896 case CSI_CUB: /* 8.3.18: (1) CURSOR LEFT */ 2900 case CSI_CUB: /* 8.3.18: (1) CURSOR LEFT */
2897 case CSI_HPB: /* 8.3.59: (1) CHARACTER POSITION BACKWARD */ 2901 case CSI_HPB: /* 8.3.59: (1) CHARACTER POSITION BACKWARD */
3585 if (mode == 'r') 3589 if (mode == 'r')
3586 state = (SavedModes & bit) ? 1 : 0; /* no overlapping */ 3590 state = (SavedModes & bit) ? 1 : 0; /* no overlapping */
3587 else 3591 else
3588 state = (mode == 't') ? ! (priv_modes & bit) : mode; 3592 state = (mode == 't') ? ! (priv_modes & bit) : mode;
3589 3593
3590 set_privmode (bit, state); 3594 if (state)
3595 priv_modes |= bit;
3596 else
3597 priv_modes &= ~bit;
3591 } 3598 }
3592 3599
3593 return state; 3600 return state;
3594} 3601}
3595 3602
3700 case 2: /* VT52 mode */ 3707 case 2: /* VT52 mode */
3701 /* oddball mode. should be set regardless of set/reset 3708 /* oddball mode. should be set regardless of set/reset
3702 * parameter. Return from VT52 mode with an ESC < from 3709 * parameter. Return from VT52 mode with an ESC < from
3703 * within VT52 mode 3710 * within VT52 mode
3704 */ 3711 */
3705 set_privmode (PrivMode_vt52, 1); 3712 priv_modes |= PrivMode_vt52;
3706 break; 3713 break;
3707 case 3: /* 80/132 */ 3714 case 3: /* 80/132 */
3708 if (priv_modes & PrivMode_132OK) 3715 if (priv_modes & PrivMode_132OK)
3709 set_widthheight ((state ? 132 : 80) * fwidth, 24 * fheight); 3716 set_widthheight ((state ? 132 : 80) * fwidth, 24 * fheight);
3710 break; 3717 break;
3725 if (state) /* orthogonal */ 3732 if (state) /* orthogonal */
3726 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); 3733 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3727 break; 3734 break;
3728#ifdef scrollBar_esc 3735#ifdef scrollBar_esc
3729 case scrollBar_esc: 3736 case scrollBar_esc:
3730 if (scrollBar.map (state)) 3737 scrollBar.map (state);
3731 {
3732 resize_all_windows (0, 0, 0); 3738 resize_all_windows (0, 0, 0);
3733 scr_touch (true); 3739 scr_touch (true);
3734 }
3735 break; 3740 break;
3736#endif 3741#endif
3737 case 25: /* visible/invisible cursor */ 3742 case 25: /* visible/invisible cursor */
3738 scr_cursor_visible (state); 3743 scr_cursor_visible (state);
3739 break; 3744 break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines