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.486 by sf-exg, Fri Apr 29 13:29:45 2011 UTC vs.
Revision 1.499 by root, Wed Nov 16 20:15:45 2011 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines