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.487 by sf-exg, Sat Apr 30 13:11:34 2011 UTC vs.
Revision 1.501 by sf-exg, Fri Nov 25 09:00:40 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
987 } 988 }
988 989
989 scr_refresh (); 990 scr_refresh ();
990 scrollBar.show (1); 991 scrollBar.show (1);
991#ifdef USE_XIM 992#ifdef USE_XIM
992 IMSendSpot (); 993 im_send_spot ();
993#endif 994#endif
994 } 995 }
995 996
996 display->flush (); 997 display->flush ();
997} 998}
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
1473 } 1474 }
1474 else 1475 else
1475 { 1476 {
1476#ifdef HAVE_BG_PIXMAP 1477#ifdef HAVE_BG_PIXMAP
1477 if (moved) 1478 if (moved)
1478 {
1479 if (mapped)
1480 update_background (); 1479 update_background ();
1481 else
1482 bg_invalidate ();
1483 }
1484#endif 1480#endif
1485 } 1481 }
1486 1482
1487 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1483 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1488 } 1484 }
1562 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) 1558 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event))
1563 ; 1559 ;
1564 1560
1565 if (scrollBar.state && ev.xany.window == scrollBar.win) 1561 if (scrollBar.state && ev.xany.window == scrollBar.win)
1566 { 1562 {
1567 scrollBar.state = STATE_IDLE; 1563 scrollBar.state = SB_STATE_IDLE;
1568 scrollBar.show (0); 1564 scrollBar.show (0);
1569 } 1565 }
1570 } 1566 }
1571 break; 1567 break;
1572 1568
1660#ifdef MOUSE_THRESHOLD 1656#ifdef MOUSE_THRESHOLD
1661 } 1657 }
1662#endif 1658#endif
1663 } 1659 }
1664 } 1660 }
1665 else if (scrollBar.state == STATE_MOTION && ev.xany.window == scrollBar.win) 1661 else if (scrollBar.state == SB_STATE_MOTION && ev.xany.window == scrollBar.win)
1666 { 1662 {
1667 while (XCheckTypedWindowEvent (dpy, scrollBar.win, 1663 while (XCheckTypedWindowEvent (dpy, scrollBar.win,
1668 MotionNotify, &ev)) 1664 MotionNotify, &ev))
1669 ; 1665 ;
1670 1666
1671 XQueryPointer (dpy, scrollBar.win, 1667 XQueryPointer (dpy, scrollBar.win,
1672 &unused_root, &unused_child, 1668 &unused_root, &unused_child,
1673 &unused_root_x, &unused_root_y, 1669 &unused_root_x, &unused_root_y,
1674 &ev.xbutton.x, &ev.xbutton.y, 1670 &ev.xbutton.x, &ev.xbutton.y,
1675 &unused_mask); 1671 &unused_mask);
1676 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, 1672 scr_move_to (scrollBar.position (ev.xbutton.y) - csrO,
1677 scrollBar.size ()); 1673 scrollBar.size ());
1678 want_refresh = 1; 1674 want_refresh = 1;
1679 scrollBar.show (1); 1675 scrollBar.show (1);
1680 } 1676 }
1681 break; 1677 break;
1721 if (XWMHints *h = XGetWMHints (dpy, parent)) 1717 if (XWMHints *h = XGetWMHints (dpy, parent))
1722 { 1718 {
1723 h->flags = h->flags & ~XUrgencyHint | (enable ? XUrgencyHint : 0); 1719 h->flags = h->flags & ~XUrgencyHint | (enable ? XUrgencyHint : 0);
1724 XSetWMHints (dpy, parent, h); 1720 XSetWMHints (dpy, parent, h);
1725 urgency_hint = enable; 1721 urgency_hint = enable;
1722 XFree (h);
1726 } 1723 }
1727} 1724}
1728#endif 1725#endif
1729 1726
1730void 1727void
1736 want_refresh = 1; 1733 want_refresh = 1;
1737 1734
1738#if USE_XIM 1735#if USE_XIM
1739 if (Input_Context != NULL) 1736 if (Input_Context != NULL)
1740 { 1737 {
1741 IMSetPosition (); 1738 im_set_position ();
1742 XSetICFocus (Input_Context); 1739 XSetICFocus (Input_Context);
1743 } 1740 }
1744#endif 1741#endif
1745#if CURSOR_BLINK 1742#if CURSOR_BLINK
1746 if (option (Opt_cursorBlink)) 1743 if (option (Opt_cursorBlink))
1977 if (scrollBar.upButton (ev.y)) 1974 if (scrollBar.upButton (ev.y))
1978 direction = UP; /* up */ 1975 direction = UP; /* up */
1979 else if (scrollBar.dnButton (ev.y)) 1976 else if (scrollBar.dnButton (ev.y))
1980 direction = DN; /* down */ 1977 direction = DN; /* down */
1981 1978
1982 scrollBar.state = STATE_IDLE; 1979 scrollBar.state = SB_STATE_IDLE;
1983 /* 1980 /*
1984 * Rxvt-style scrollbar: 1981 * Rxvt-style scrollbar:
1985 * move up if mouse is above slider 1982 * move up if mouse is above slider
1986 * move dn if mouse is below slider 1983 * move dn if mouse is below slider
1987 * 1984 *
2026 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 2023 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2027#endif 2024#endif
2028 if (scr_page (direction, 1)) 2025 if (scr_page (direction, 1))
2029 { 2026 {
2030 if (direction == UP) 2027 if (direction == UP)
2031 scrollBar.state = STATE_UP; 2028 scrollBar.state = SB_STATE_UP;
2032 else 2029 else
2033 scrollBar.state = STATE_DOWN; 2030 scrollBar.state = SB_STATE_DOWN;
2034 } 2031 }
2035 } 2032 }
2036 else 2033 else
2037 switch (ev.button) 2034 switch (ev.button)
2038 { 2035 {
2039 case Button2: 2036 case Button2:
2040 switch (scrollBar.align) 2037 switch (scrollBar.align)
2041 { 2038 {
2042 case R_SB_ALIGN_TOP: 2039 case SB_ALIGN_TOP:
2043 csrO = 0; 2040 csrO = 0;
2044 break; 2041 break;
2045 case R_SB_ALIGN_CENTRE: 2042 case SB_ALIGN_CENTRE:
2046 csrO = (scrollBar.bot - scrollBar.top) / 2; 2043 csrO = (scrollBar.bot - scrollBar.top) / 2;
2047 break; 2044 break;
2048 case R_SB_ALIGN_BOTTOM: 2045 case SB_ALIGN_BOTTOM:
2049 csrO = scrollBar.bot - scrollBar.top; 2046 csrO = scrollBar.bot - scrollBar.top;
2050 break; 2047 break;
2051 } 2048 }
2052 2049
2053 if (scrollBar.style == R_SB_XTERM 2050 if (scrollBar.style == SB_STYLE_XTERM
2054 || scrollbar_above_slider (ev.y) 2051 || scrollBar.above_slider (ev.y)
2055 || scrollbar_below_slider (ev.y)) 2052 || scrollBar.below_slider (ev.y))
2056 scr_move_to (scrollbar_position (ev.y) - csrO, scrollBar.size ()); 2053 scr_move_to (scrollBar.position (ev.y) - csrO, scrollBar.size ());
2057 2054
2058 scrollBar.state = STATE_MOTION; 2055 scrollBar.state = SB_STATE_MOTION;
2059 break; 2056 break;
2060 2057
2061 case Button1: 2058 case Button1:
2062 if (scrollBar.align == R_SB_ALIGN_CENTRE) 2059 if (scrollBar.align == SB_ALIGN_CENTRE)
2063 csrO = ev.y - scrollBar.top; 2060 csrO = ev.y - scrollBar.top;
2064 /* FALLTHROUGH */ 2061 /* FALLTHROUGH */
2065 2062
2066 case Button3: 2063 case Button3:
2067 if (scrollBar.style != R_SB_XTERM) 2064 if (scrollBar.style != SB_STYLE_XTERM)
2068 { 2065 {
2069 if (scrollbar_above_slider (ev.y)) 2066 if (scrollBar.above_slider (ev.y))
2070# ifdef RXVT_SCROLL_FULL 2067# ifdef RXVT_SCROLL_FULL
2071 scr_page (UP, nrow - 1); 2068 scr_page (UP, nrow - 1);
2072# else 2069# else
2073 scr_page (UP, nrow / 4); 2070 scr_page (UP, nrow / 4);
2074# endif 2071# endif
2075 else if (scrollbar_below_slider (ev.y)) 2072 else if (scrollBar.below_slider (ev.y))
2076# ifdef RXVT_SCROLL_FULL 2073# ifdef RXVT_SCROLL_FULL
2077 scr_page (DN, nrow - 1); 2074 scr_page (DN, nrow - 1);
2078# else 2075# else
2079 scr_page (DN, nrow / 4); 2076 scr_page (DN, nrow / 4);
2080# endif 2077# endif
2081 else 2078 else
2082 scrollBar.state = STATE_MOTION; 2079 scrollBar.state = SB_STATE_MOTION;
2083 } 2080 }
2084 else 2081 else
2085 { 2082 {
2086 scr_page ((ev.button == Button1 ? DN : UP), 2083 scr_page ((ev.button == Button1 ? DN : UP),
2087 (nrow 2084 (nrow
2088 * scrollbar_position (ev.y) 2085 * scrollBar.position (ev.y)
2089 / scrollBar.size ())); 2086 / scrollBar.size ()));
2090 } 2087 }
2091 2088
2092 break; 2089 break;
2093 } 2090 }
2104 2101
2105 csrO = 0; /* reset csr Offset */ 2102 csrO = 0; /* reset csr Offset */
2106 if (!bypass_keystate) 2103 if (!bypass_keystate)
2107 reportmode = !! (priv_modes & PrivMode_mouse_report); 2104 reportmode = !! (priv_modes & PrivMode_mouse_report);
2108 2105
2109 if (scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN) 2106 if (scrollBar.state == SB_STATE_UP || scrollBar.state == SB_STATE_DOWN)
2110 { 2107 {
2111 scrollBar.state = STATE_IDLE; 2108 scrollBar.state = SB_STATE_IDLE;
2112 scrollBar.show (0); 2109 scrollBar.show (0);
2113 } 2110 }
2114 2111
2115#ifdef SELECTION_SCROLLING 2112#ifdef SELECTION_SCROLLING
2116 sel_scroll_ev.stop(); 2113 sel_scroll_ev.stop();
2219 wchar_t ch = NOCHAR; 2216 wchar_t ch = NOCHAR;
2220 char *seq_begin; // remember start of esc-sequence here 2217 char *seq_begin; // remember start of esc-sequence here
2221 2218
2222 for (;;) 2219 for (;;)
2223 { 2220 {
2224 if (expect_false (ch == NOCHAR)) 2221 if (ecb_unlikely (ch == NOCHAR))
2225 { 2222 {
2226 seq_begin = cmdbuf_ptr; 2223 seq_begin = cmdbuf_ptr;
2227 ch = next_char (); 2224 ch = next_char ();
2228 2225
2229 if (ch == NOCHAR) 2226 if (ch == NOCHAR)
2230 break; 2227 break;
2231 } 2228 }
2232 2229
2233 if (expect_true (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT)) 2230 if (ecb_likely (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT))
2234 { 2231 {
2235 if (expect_false (!seen_input)) 2232 if (ecb_unlikely (!seen_input))
2236 { 2233 {
2237 seen_input = 1; 2234 seen_input = 1;
2238 // many badly-written programs (e.g. jed) contain a race condition: 2235 // many badly-written programs (e.g. jed) contain a race condition:
2239 // they first read the screensize and then install a SIGWINCH handler. 2236 // they first read the screensize and then install a SIGWINCH handler.
2240 // some window managers resize the window early, and these programs 2237 // some window managers resize the window early, and these programs
2253 wchar_t *str = buf; 2250 wchar_t *str = buf;
2254 wchar_t *eol = str + min (ncol, UBUFSIZ); 2251 wchar_t *eol = str + min (ncol, UBUFSIZ);
2255 2252
2256 for (;;) 2253 for (;;)
2257 { 2254 {
2258 if (expect_false (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT))) 2255 if (ecb_unlikely (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)))
2259 break; 2256 break;
2260 2257
2261 *str++ = ch; 2258 *str++ = ch;
2262 2259
2263 if (expect_false (ch == C0_LF || str >= eol)) 2260 if (ecb_unlikely (ch == C0_LF || str >= eol))
2264 { 2261 {
2265 if (ch == C0_LF) 2262 if (ch == C0_LF)
2266 nlines++; 2263 nlines++;
2267 2264
2268 refresh_count++; 2265 refresh_count++;
2346rxvt_term::next_char () NOTHROW 2343rxvt_term::next_char () NOTHROW
2347{ 2344{
2348 while (cmdbuf_ptr < cmdbuf_endp) 2345 while (cmdbuf_ptr < cmdbuf_endp)
2349 { 2346 {
2350 // assume 7-bit to be ascii ALWAYS 2347 // assume 7-bit to be ascii ALWAYS
2351 if (expect_true ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b)) 2348 if (ecb_likely ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b))
2352 return *cmdbuf_ptr++; 2349 return *cmdbuf_ptr++;
2353 2350
2354 wchar_t wc; 2351 wchar_t wc;
2355 size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); 2352 size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate);
2356 2353
2595 break; 2592 break;
2596 case 'Z': /* identify the terminal type */ 2593 case 'Z': /* identify the terminal type */
2597 tt_printf ("\033/Z"); /* I am a VT100 emulating a VT52 */ 2594 tt_printf ("\033/Z"); /* I am a VT100 emulating a VT52 */
2598 break; 2595 break;
2599 case '<': /* turn off VT52 mode */ 2596 case '<': /* turn off VT52 mode */
2600 set_privmode (PrivMode_vt52, 0); 2597 priv_modes &= ~PrivMode_vt52;
2601 break; 2598 break;
2602 case 'F': /* use special graphics character set */ 2599 case 'F': /* use special graphics character set */
2603 case 'G': /* use regular character set */ 2600 case 'G': /* use regular character set */
2604 /* unimplemented */ 2601 /* unimplemented */
2605 break; 2602 break;
2656#if !ENABLE_MINIMAL 2653#if !ENABLE_MINIMAL
2657 case '9': 2654 case '9':
2658 scr_forwardindex (); 2655 scr_forwardindex ();
2659 break; 2656 break;
2660#endif 2657#endif
2658 // DECPAM/DECPNM
2661 case '=': 2659 case '=':
2660 priv_modes |= PrivMode_aplKP;
2661 break;
2662 case '>': 2662 case '>':
2663 set_privmode (PrivMode_aplKP, ch == '='); 2663 priv_modes &= ~PrivMode_aplKP;
2664 break; 2664 break;
2665 2665
2666 case C1_40: 2666 case C1_40:
2667 cmd_getc (); 2667 cmd_getc ();
2668 break; 2668 break;
2672 2672
2673 /* 8.3.87: NEXT LINE */ 2673 /* 8.3.87: NEXT LINE */
2674 case C1_NEL: /* ESC E */ 2674 case C1_NEL: /* ESC E */
2675 { 2675 {
2676 wchar_t nlcr[] = { C0_LF, C0_CR }; 2676 wchar_t nlcr[] = { C0_LF, C0_CR };
2677 scr_add_lines (nlcr, ARRAY_LENGTH(nlcr), 1); 2677 scr_add_lines (nlcr, ecb_array_length (nlcr), 1);
2678 } 2678 }
2679 break; 2679 break;
2680 2680
2681 /* kidnapped escape sequence: Should be 8.3.48 */ 2681 /* kidnapped escape sequence: Should be 8.3.48 */
2682 case C1_ESA: /* ESC G */ 2682 case C1_ESA: /* ESC G */
2858 scr_soft_reset (); 2858 scr_soft_reset ();
2859 2859
2860 static const int pm_h[] = { 7, 25 }; 2860 static const int pm_h[] = { 7, 25 };
2861 static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1005, 1015, 1049 }; 2861 static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1005, 1015, 1049 };
2862 2862
2863 process_terminal_mode ('h', 0, ARRAY_LENGTH(pm_h), pm_h); 2863 process_terminal_mode ('h', 0, ecb_array_length (pm_h), pm_h);
2864 process_terminal_mode ('l', 0, ARRAY_LENGTH(pm_l), pm_l); 2864 process_terminal_mode ('l', 0, ecb_array_length (pm_l), pm_l);
2865 } 2865 }
2866 break; 2866 break;
2867 } 2867 }
2868 2868
2869 return; 2869 return;
2887 } 2887 }
2888 break; 2888 break;
2889#endif 2889#endif
2890 2890
2891 case CSI_CUU: /* 8.3.22: (1) CURSOR UP */ 2891 case CSI_CUU: /* 8.3.22: (1) CURSOR UP */
2892 case CSI_VPR: /* 8.3.161: (1) LINE POSITION FORWARD */ 2892 case CSI_VPB: /* 8.3.160: (1) LINE POSITION BACKWARD */
2893 arg[0] = -arg[0]; 2893 arg[0] = -arg[0];
2894 /* FALLTHROUGH */ 2894 /* FALLTHROUGH */
2895 case CSI_CUD: /* 8.3.19: (1) CURSOR DOWN */ 2895 case CSI_CUD: /* 8.3.19: (1) CURSOR DOWN */
2896 case CSI_VPB: /* 8.3.160: (1) LINE POSITION BACKWARD */ 2896 case CSI_VPR: /* 8.3.161: (1) LINE POSITION FORWARD */
2897 scr_gotorc (arg[0], 0, RELATIVE); 2897 scr_gotorc (arg[0], 0, RELATIVE);
2898 break; 2898 break;
2899 2899
2900 case CSI_CUB: /* 8.3.18: (1) CURSOR LEFT */ 2900 case CSI_CUB: /* 8.3.18: (1) CURSOR LEFT */
2901 case CSI_HPB: /* 8.3.59: (1) CHARACTER POSITION BACKWARD */ 2901 case CSI_HPB: /* 8.3.59: (1) CHARACTER POSITION BACKWARD */
3452 min (h_align, 32767), min (v_align, 32767)); 3452 min (h_align, 32767), min (v_align, 32767));
3453 process_xterm_seq (XTerm_title, str, CHAR_ST); 3453 process_xterm_seq (XTerm_title, str, CHAR_ST);
3454 } 3454 }
3455 else 3455 else
3456 { 3456 {
3457 int changed = 0; 3457 bool changed = false;
3458 3458
3459 if (*str != ';') 3459 if (*str != ';')
3460 { 3460 {
3461 if (bg_set_file (str)) /* change pixmap */ 3461 if (bg_set_file (str)) /* change pixmap */
3462 {
3463 changed++; 3462 changed = true;
3464 str = strchr (str, ';');
3465 if (str == NULL)
3466 bg_set_default_geometry ();
3467 else
3468 bg_set_geometry (str+1);
3469 }
3470 } 3463 }
3471 else 3464 else
3472 { 3465 {
3473 str++; 3466 str++;
3474 if (bg_set_geometry (str, true)) 3467 if (bg_set_geometry (str, true))
3475 changed++; 3468 changed = true;
3476 } 3469 }
3477 3470
3478 if (changed) 3471 if (changed)
3479 { 3472 {
3480 if (bg_window_position_sensitive ()) 3473 if (bg_window_position_sensitive ())
3596 if (mode == 'r') 3589 if (mode == 'r')
3597 state = (SavedModes & bit) ? 1 : 0; /* no overlapping */ 3590 state = (SavedModes & bit) ? 1 : 0; /* no overlapping */
3598 else 3591 else
3599 state = (mode == 't') ? ! (priv_modes & bit) : mode; 3592 state = (mode == 't') ? ! (priv_modes & bit) : mode;
3600 3593
3601 set_privmode (bit, state); 3594 if (state)
3595 priv_modes |= bit;
3596 else
3597 priv_modes &= ~bit;
3602 } 3598 }
3603 3599
3604 return state; 3600 return state;
3605} 3601}
3606 3602
3607/* we're not using priv _yet_ */ 3603/* we're not using priv _yet_ */
3608void 3604void
3609rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg) 3605rxvt_term::process_terminal_mode (int mode, int priv ecb_unused, unsigned int nargs, const int *arg)
3610{ 3606{
3611 unsigned int i, j; 3607 unsigned int i, j;
3612 int state; 3608 int state;
3613 3609
3614 static const struct 3610 static const struct
3615 { 3611 {
3616 const int argval; 3612 const int argval;
3617 const unsigned long bit; 3613 const unsigned long bit;
3618 } argtopriv[] = { 3614 } argtopriv[] = {
3619 { 1, PrivMode_aplCUR }, // DECCKM 3615 { 1, PrivMode_aplCUR }, // DECCKM
3620 { 2, PrivMode_vt52 }, 3616 { 2, PrivMode_vt52 }, // DECANM
3621 { 3, PrivMode_132 }, // DECCOLM 3617 { 3, PrivMode_132 }, // DECCOLM
3622 { 4, PrivMode_smoothScroll }, // DECSCLM 3618 { 4, PrivMode_smoothScroll }, // DECSCLM
3623 { 5, PrivMode_rVideo }, // DECSCNM 3619 { 5, PrivMode_rVideo }, // DECSCNM
3624 { 6, PrivMode_relOrigin }, // DECOM 3620 { 6, PrivMode_relOrigin }, // DECOM
3625 { 7, PrivMode_Autowrap }, // DECAWM 3621 { 7, PrivMode_Autowrap }, // DECAWM
3626 // 8, auto-repeat keys // DECARM 3622 // 8, auto-repeat keys // DECARM
3627 { 9, PrivMode_MouseX10 }, 3623 { 9, PrivMode_MouseX10 },
3628 // 18 end FF to printer after print screen 3624 // 18 end FF to printer after print screen
3629 // 19 Print screen prints full screen/scroll region 3625 // 19 Print screen prints full screen/scroll region
3630 { 25, PrivMode_VisibleCursor }, // cnorm/cvvis/civis 3626 { 25, PrivMode_VisibleCursor }, // DECTCEM cnorm/cvvis/civis
3631#ifdef scrollBar_esc 3627#ifdef scrollBar_esc
3632 { scrollBar_esc, PrivMode_scrollBar }, 3628 { scrollBar_esc, PrivMode_scrollBar },
3633#endif 3629#endif
3634 { 35, PrivMode_ShiftKeys }, // rxvt extension 3630 { 35, PrivMode_ShiftKeys }, // rxvt extension
3635 // 38, tektronix mode // DECTEK 3631 // 38, tektronix mode // DECTEK
3636 { 40, PrivMode_132OK }, 3632 { 40, PrivMode_132OK },
3637 // 41 xterm more fixes NYI 3633 // 41 xterm more fixes NYI
3638 // 45 margin bell NYI 3634 // 45 margin bell NYI
3639 // 46 start logging 3635 // 46 start logging
3640 { 47, PrivMode_Screen }, 3636 { 47, PrivMode_Screen },
3641 { 66, PrivMode_aplKP }, // DECPAM/DECPNM 3637 { 66, PrivMode_aplKP }, // DECNKM
3642#ifndef NO_BACKSPACE_KEY 3638#ifndef NO_BACKSPACE_KEY
3643 { 67, PrivMode_BackSpace }, // DECBKM 3639 { 67, PrivMode_BackSpace }, // DECBKM
3644#endif 3640#endif
3645 { 1000, PrivMode_MouseX11 }, 3641 { 1000, PrivMode_MouseX11 },
3646 { 1002, PrivMode_MouseBtnEvent }, 3642 { 1002, PrivMode_MouseBtnEvent },
3675 for (i = 0; i < nargs; i++) 3671 for (i = 0; i < nargs; i++)
3676 { 3672 {
3677 state = -1; 3673 state = -1;
3678 3674
3679 /* basic handling */ 3675 /* basic handling */
3680 for (j = 0; j < ARRAY_LENGTH(argtopriv); j++) 3676 for (j = 0; j < ecb_array_length (argtopriv); j++)
3681 if (argtopriv[j].argval == arg[i]) 3677 if (argtopriv[j].argval == arg[i])
3682 { 3678 {
3683 state = privcases (mode, argtopriv[j].bit); 3679 state = privcases (mode, argtopriv[j].bit);
3684 break; 3680 break;
3685 } 3681 }
3711 case 2: /* VT52 mode */ 3707 case 2: /* VT52 mode */
3712 /* oddball mode. should be set regardless of set/reset 3708 /* oddball mode. should be set regardless of set/reset
3713 * parameter. Return from VT52 mode with an ESC < from 3709 * parameter. Return from VT52 mode with an ESC < from
3714 * within VT52 mode 3710 * within VT52 mode
3715 */ 3711 */
3716 set_privmode (PrivMode_vt52, 1); 3712 priv_modes |= PrivMode_vt52;
3717 break; 3713 break;
3718 case 3: /* 80/132 */ 3714 case 3: /* 80/132 */
3719 if (priv_modes & PrivMode_132OK) 3715 if (priv_modes & PrivMode_132OK)
3720 set_widthheight ((state ? 132 : 80) * fwidth, 24 * fheight); 3716 set_widthheight ((state ? 132 : 80) * fwidth, 24 * fheight);
3721 break; 3717 break;
3736 if (state) /* orthogonal */ 3732 if (state) /* orthogonal */
3737 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); 3733 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3738 break; 3734 break;
3739#ifdef scrollBar_esc 3735#ifdef scrollBar_esc
3740 case scrollBar_esc: 3736 case scrollBar_esc:
3741 if (scrollBar.map (state)) 3737 scrollBar.map (state);
3742 {
3743 resize_all_windows (0, 0, 0); 3738 resize_all_windows (0, 0, 0);
3744 scr_touch (true); 3739 scr_touch (true);
3745 }
3746 break; 3740 break;
3747#endif 3741#endif
3748 case 25: /* visible/invisible cursor */ 3742 case 25: /* visible/invisible cursor */
3749 scr_cursor_visible (state); 3743 scr_cursor_visible (state);
3750 break; 3744 break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines