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.415 by root, Sat Apr 26 03:37:18 2008 UTC vs.
Revision 1.435 by sf-exg, Wed Jan 6 12:10:44 2010 UTC

579 } 579 }
580 } 580 }
581 581
582#if ENABLE_FRILLS || ISO_14755 582#if ENABLE_FRILLS || ISO_14755
583 // ISO 14755 support 583 // ISO 14755 support
584 if (shft && ctrl) 584 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_51))
585 { 585 {
586 int hv; 586 int hv;
587 587
588 if (iso14755buf & ISO_14755_51 588 if (iso14755buf & ISO_14755_51
589 && (keysym == XK_space || keysym == XK_KP_Space 589 && (keysym == XK_space || keysym == XK_KP_Space
619 scr_overlay_off (); 619 scr_overlay_off ();
620# endif 620# endif
621 iso14755buf = 0; 621 iso14755buf = 0;
622 } 622 }
623 } 623 }
624 else if (option (Opt_iso14755) &&
624 else if ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R)) 625 ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R))
625 || (shft && (keysym == XK_Control_L || keysym == XK_Control_R))) 626 || (shft && (keysym == XK_Control_L || keysym == XK_Control_R))))
626 if (!(iso14755buf & ISO_14755_STARTED)) 627 if (!(iso14755buf & ISO_14755_STARTED))
627 { 628 {
628 iso14755buf |= ISO_14755_STARTED; 629 iso14755buf |= ISO_14755_STARTED;
629# if ISO_14755 630# if ISO_14755
630 scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); 631 scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1);
1127 { 1128 {
1128 // this should really be sched_yield(), but the linux guys thought 1129 // this should really be sched_yield(), but the linux guys thought
1129 // that giving a process calling sched_yield () less cpu time than 1130 // that giving a process calling sched_yield () less cpu time than
1130 // ones with high nice levels is a useful thing to do. It surely is is 1131 // ones with high nice levels is a useful thing to do. It surely is is
1131 // allowed by the sus... as is returning ENOSYS. 1132 // allowed by the sus... as is returning ENOSYS.
1133 // since the linux guys additionally thought that breaking the only
1134 // known workaroudn against their unusable sched_yield hack is cool,
1135 // we just nanosleep a bit and hope for the best.
1132 1136
1133 struct timespec ts = { 0, 0 }; 1137 struct timespec ts = { 0, 1000 };
1134 nanosleep (&ts, 0); 1138 nanosleep (&ts, 0);
1135 1139
1136 w.stop (); 1140 w.stop ();
1137 } 1141 }
1138 1142
1188{ 1192{
1189 make_current (); 1193 make_current ();
1190 1194
1191 if (revents & ev::READ) 1195 if (revents & ev::READ)
1192 // loop, but don't allow a single term to monopolize us 1196 // loop, but don't allow a single term to monopolize us
1193 while (pty_fill ()) 1197 for (int i = CBUFCNT; i-- && pty_fill (); )
1194 if (cmd_parse ()) 1198 cmd_parse ();
1195 break;
1196 1199
1197 if (revents & ev::WRITE) 1200 if (revents & ev::WRITE)
1198 pty_write (); 1201 pty_write ();
1199 1202
1200 refresh_check (); 1203 refresh_check ();
1682#endif 1685#endif
1683 1686
1684 refresh_check (); 1687 refresh_check ();
1685} 1688}
1686 1689
1690#if ENABLE_FRILLS
1691void
1692rxvt_term::set_urgency (bool enable)
1693{
1694 if (enable == urgency_hint)
1695 return;
1696
1697 if (XWMHints *h = XGetWMHints (dpy, parent[0]))
1698 {
1699 h->flags = h->flags & ~XUrgencyHint | (enable ? XUrgencyHint : 0);
1700 XSetWMHints (dpy, parent[0], h);
1701 urgency_hint = enable;
1702 }
1703}
1704#endif
1705
1687void 1706void
1688rxvt_term::focus_in () 1707rxvt_term::focus_in ()
1689{ 1708{
1690 if (!focus) 1709 if (!focus)
1691 { 1710 {
1692 focus = 1; 1711 focus = 1;
1693 want_refresh = 1; 1712 want_refresh = 1;
1694
1695 HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END));
1696 1713
1697#if USE_XIM 1714#if USE_XIM
1698 if (Input_Context != NULL) 1715 if (Input_Context != NULL)
1699 { 1716 {
1700 IMSetPosition (); 1717 IMSetPosition ();
1712 scr_recolour (); 1729 scr_recolour ();
1713 } 1730 }
1714#endif 1731#endif
1715#if ENABLE_FRILLS 1732#if ENABLE_FRILLS
1716 if (option (Opt_urgentOnBell)) 1733 if (option (Opt_urgentOnBell))
1717 { 1734 set_urgency (0);
1718 if (XWMHints *h = XGetWMHints(dpy, parent[0]))
1719 {
1720 h->flags &= ~XUrgencyHint;
1721 XSetWMHints (dpy, parent[0], h);
1722 }
1723 }
1724#endif 1735#endif
1736
1737 HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END));
1725 } 1738 }
1726} 1739}
1727 1740
1728void 1741void
1729rxvt_term::focus_out () 1742rxvt_term::focus_out ()
1731 if (focus) 1744 if (focus)
1732 { 1745 {
1733 focus = 0; 1746 focus = 0;
1734 want_refresh = 1; 1747 want_refresh = 1;
1735 1748
1736 HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); 1749#if ENABLE_FRILLS
1737 1750 if (option (Opt_urgentOnBell))
1751 set_urgency (0);
1752#endif
1738#if ENABLE_FRILLS || ISO_14755 1753#if ENABLE_FRILLS || ISO_14755
1739 if (iso14755buf) 1754 if (iso14755buf)
1740 { 1755 {
1741 iso14755buf = 0; 1756 iso14755buf = 0;
1742# if ISO_14755 1757# if ISO_14755
1759 { 1774 {
1760 pix_colors = pix_colors_unfocused; 1775 pix_colors = pix_colors_unfocused;
1761 scr_recolour (); 1776 scr_recolour ();
1762 } 1777 }
1763#endif 1778#endif
1779
1780 HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1764 } 1781 }
1765} 1782}
1766 1783
1767void 1784void
1768rxvt_term::update_fade_color (unsigned int idx) 1785rxvt_term::update_fade_color (unsigned int idx)
2170 } 2187 }
2171} 2188}
2172 2189
2173/*}}} */ 2190/*}}} */
2174 2191
2175bool 2192void
2176rxvt_term::cmd_parse () 2193rxvt_term::cmd_parse ()
2177{ 2194{
2178 bool flag = false;
2179 wchar_t ch = NOCHAR; 2195 wchar_t ch = NOCHAR;
2180 char *seq_begin; // remember start of esc-sequence here 2196 char *seq_begin; // remember start of esc-sequence here
2181 2197
2182 for (;;) 2198 for (;;)
2183 { 2199 {
2184 if (ch == NOCHAR) 2200 if (expect_false (ch == NOCHAR))
2185 { 2201 {
2186 seq_begin = cmdbuf_ptr; 2202 seq_begin = cmdbuf_ptr;
2187 ch = next_char (); 2203 ch = next_char ();
2188 2204
2189 if (ch == NOCHAR) 2205 if (ch == NOCHAR)
2190 break; 2206 break;
2191 } 2207 }
2192 2208
2193 if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT) 2209 if (expect_true (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT))
2194 { 2210 {
2195 if (!seen_input) 2211 if (expect_false (!seen_input))
2196 { 2212 {
2197 seen_input = 1; 2213 seen_input = 1;
2198 // many badly-written programs (e.g. jed) contain a race condition: 2214 // many badly-written programs (e.g. jed) contain a race condition:
2199 // they first read the screensize and then install a SIGWINCH handler. 2215 // they first read the screensize and then install a SIGWINCH handler.
2200 // some window managers resize the window early, and these programs 2216 // some window managers resize the window early, and these programs
2213 wchar_t *str = buf; 2229 wchar_t *str = buf;
2214 wchar_t *eol = str + min (ncol, UBUFSIZ); 2230 wchar_t *eol = str + min (ncol, UBUFSIZ);
2215 2231
2216 for (;;) 2232 for (;;)
2217 { 2233 {
2218 if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) 2234 if (expect_false (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)))
2219 break; 2235 break;
2220 2236
2221 *str++ = ch; 2237 *str++ = ch;
2222 2238
2223 if (ch == C0_LF || str >= eol) 2239 if (expect_false (ch == C0_LF || str >= eol))
2224 { 2240 {
2225 if (ch == C0_LF) 2241 if (ch == C0_LF)
2226 nlines++; 2242 nlines++;
2227 2243
2228 refresh_count++; 2244 refresh_count++;
2277 * What the heck we'll cheat and only refresh less than every page-full. 2293 * What the heck we'll cheat and only refresh less than every page-full.
2278 * if skipScroll is enabled. 2294 * if skipScroll is enabled.
2279 */ 2295 */
2280 if (refreshnow) 2296 if (refreshnow)
2281 { 2297 {
2282 flag = true;
2283 scr_refresh (); 2298 scr_refresh ();
2284 want_refresh = 1; 2299 want_refresh = 1;
2285 } 2300 }
2286
2287 } 2301 }
2288 else 2302 else
2289 { 2303 {
2290 try 2304 try
2291 { 2305 {
2299 } 2313 }
2300 2314
2301 ch = NOCHAR; 2315 ch = NOCHAR;
2302 } 2316 }
2303 } 2317 }
2304
2305 return flag;
2306} 2318}
2307 2319
2308// read the next character 2320// read the next character
2309wchar_t 2321wchar_t
2310rxvt_term::next_char () NOTHROW 2322rxvt_term::next_char () NOTHROW
2311{ 2323{
2312 while (cmdbuf_ptr < cmdbuf_endp) 2324 while (cmdbuf_ptr < cmdbuf_endp)
2313 { 2325 {
2314 // assume 7-bit to be ascii ALWAYS 2326 // assume 7-bit to be ascii ALWAYS
2315 if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) 2327 if (expect_true ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b))
2316 return *cmdbuf_ptr++; 2328 return *cmdbuf_ptr++;
2317 2329
2318 wchar_t wc; 2330 wchar_t wc;
2319 size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); 2331 size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate);
2320 2332
2325 break; 2337 break;
2326 } 2338 }
2327 2339
2328 if (len == (size_t)-1) 2340 if (len == (size_t)-1)
2329 { 2341 {
2330 mbrtowc (0, 0, 0, mbstate); // reset now undefined conversion state 2342 mbstate.reset (); // reset now undefined conversion state
2331 return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through 2343 return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through
2332 } 2344 }
2333 2345
2334 // assume wchar == unicode 2346 // assume wchar == unicode
2335 cmdbuf_ptr += len; 2347 cmdbuf_ptr += len;
2381/*----------------------------------------------------------------------*/ 2393/*----------------------------------------------------------------------*/
2382#ifdef PRINTPIPE 2394#ifdef PRINTPIPE
2383FILE * 2395FILE *
2384rxvt_term::popen_printer () 2396rxvt_term::popen_printer ()
2385{ 2397{
2386 FILE *stream = popen (rs[Rs_print_pipe], "w"); 2398 FILE *stream = popen (rs[Rs_print_pipe] ? rs[Rs_print_pipe] : PRINTPIPE, "w");
2387 2399
2388 if (stream == NULL) 2400 if (stream == NULL)
2389 rxvt_warn ("can't open printer pipe, not printing.\n"); 2401 rxvt_warn ("can't open printer pipe, not printing.\n");
2390 2402
2391 return stream; 2403 return stream;
2402 * simulate attached vt100 printer 2414 * simulate attached vt100 printer
2403 */ 2415 */
2404void 2416void
2405rxvt_term::process_print_pipe () 2417rxvt_term::process_print_pipe ()
2406{ 2418{
2407 int done; 2419 FILE *fd = popen_printer ();
2408 FILE *fd;
2409 2420
2410 if ((fd = popen_printer ()) == NULL) 2421 if (!fd)
2411 return; 2422 return;
2412 2423
2413 /* 2424 /*
2414 * Send all input to the printer until either ESC[4i or ESC[?4i 2425 * Send all input to the printer until either ESC[4i or ESC[?4i
2415 * is received. 2426 * is received.
2416 */ 2427 */
2417 for (done = 0; !done;) 2428 for (int done = 0; !done; )
2418 { 2429 {
2419 unsigned char buf[8]; 2430 unsigned char buf[8];
2420 unicode_t ch; 2431 unicode_t ch;
2421 unsigned int i, len; 2432 unsigned int i, len;
2422 2433
2680 /* 8.3.110: SINGLE CHARACTER INTRODUCER */ 2691 /* 8.3.110: SINGLE CHARACTER INTRODUCER */
2681 case C1_SCI: /* ESC Z */ 2692 case C1_SCI: /* ESC Z */
2682 tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1); 2693 tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1);
2683 break; /* steal obsolete ESC [ c */ 2694 break; /* steal obsolete ESC [ c */
2684 2695
2685 /* 8.3.16: CONTROL SEQUENCE INTRODUCER */ 2696 /* 8.3.16: CONTROL SEQUENCE INTRODUCER (CSI) */
2686 case C1_CSI: /* ESC [ */ 2697 case C1_CSI: /* ESC [ */
2687 process_csi_seq (); 2698 process_csi_seq ();
2688 break; 2699 break;
2689 2700
2690 /* 8.3.90: OPERATING SYSTEM COMMAND */ 2701 /* 8.3.90: OPERATING SYSTEM COMMAND (OSC) */
2691 case C1_OSC: /* ESC ] */ 2702 case C1_OSC: /* ESC ] */
2692 process_osc_seq (); 2703 process_osc_seq ();
2693 break; 2704 break;
2694 2705
2695 /* 8.3.106: RESET TO INITIAL STATE */ 2706 /* 8.3.106: RESET TO INITIAL STATE (RIS) */
2696 case 'c': 2707 case 'c':
2697 mbstate.reset (); 2708 mbstate.reset ();
2698 scr_poweron (); 2709 scr_poweron ();
2699 scrollBar.show (1); 2710 scrollBar.show (1);
2700 break; 2711 break;
2755 2766
2756 nargs = 0; 2767 nargs = 0;
2757 2768
2758 priv = 0; 2769 priv = 0;
2759 ch = cmd_getc (); 2770 ch = cmd_getc ();
2760 if (ch >= '<' && ch <= '?') 2771 if ((ch >= '<' && ch <= '?') || ch == '!')
2761 { 2772 {
2762 /* '<' '=' '>' '?' */ 2773 /* '<' '=' '>' '?' '!' */
2763 priv = ch; 2774 priv = ch;
2764 ch = cmd_getc (); 2775 ch = cmd_getc ();
2765 } 2776 }
2766 2777
2767 /* read any numerical arguments */ 2778 /* read any numerical arguments */
2821 2832
2822 case '?': 2833 case '?':
2823 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 2834 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
2824 process_terminal_mode (ch, priv, nargs, arg); 2835 process_terminal_mode (ch, priv, nargs, arg);
2825 break; 2836 break;
2837
2838 case '!':
2839 if (ch == CSI_70)
2840 {
2841 /* DECSTR: soft terminal reset, used by our terminfo since 9.06 */
2842 scr_soft_reset ();
2843
2844 static const int pm_h[] = { 7, 25 };
2845 static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1049 };
2846
2847 process_terminal_mode ('h', 0, sizeof (pm_h) / sizeof (pm_h[0]), pm_h);
2848 process_terminal_mode ('l', 0, sizeof (pm_l) / sizeof (pm_l[0]), pm_l);
2826 } 2849 }
2850 break;
2851 }
2852
2827 return; 2853 return;
2828 } 2854 }
2829 2855
2830 switch (ch) 2856 switch (ch)
2831 { 2857 {
3260 3286
3261/* 3287/*
3262 * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) 3288 * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL)
3263 */ 3289 */
3264void 3290void
3265rxvt_term::process_xterm_seq (int op, const char *str, char resp) 3291rxvt_term::process_xterm_seq (int op, char *str, char resp)
3266{ 3292{
3267 int color; 3293 int color;
3268 char *buf, *name; 3294 char *buf, *name;
3269 bool query = str[0] == '?' && !str[1]; 3295 bool query = str[0] == '?' && !str[1];
3270 int saveop = op; 3296 int saveop = op;
3311 3337
3312 XFree (value); 3338 XFree (value);
3313 } 3339 }
3314 else 3340 else
3315 { 3341 {
3316 char *eq = strchr (str, '='); // constness lost, but verified to be ok 3342 char *eq = strchr (str, '=');
3317 3343
3318 if (eq) 3344 if (eq)
3319 { 3345 {
3320 *eq = 0; 3346 *eq = 0;
3321 set_utf8_property (display->atom (str), eq + 1); 3347 set_utf8_property (display->atom (str), eq + 1);
3377 break; 3403 break;
3378 case URxvt_Color_IT: 3404 case URxvt_Color_IT:
3379 process_color_seq (op, Color_IT, str, resp); 3405 process_color_seq (op, Color_IT, str, resp);
3380 break; 3406 break;
3381#endif 3407#endif
3408 case URxvt_Color_border:
3409 process_color_seq (op, Color_border, str, resp);
3410 break;
3382#if ENABLE_TRANSPARENCY 3411#if ENABLE_TRANSPARENCY
3383 case URxvt_Color_tint: 3412 case URxvt_Color_tint:
3384 process_color_seq (op, Color_tint, str, resp); 3413 process_color_seq (op, Color_tint, str, resp);
3385 { 3414 {
3386 bool changed = false; 3415 bool changed = false;
3510 break; 3539 break;
3511#endif 3540#endif
3512 3541
3513#if ENABLE_PERL 3542#if ENABLE_PERL
3514 case URxvt_perl: 3543 case URxvt_perl:
3515 if (HOOK_INVOKE ((this, HOOK_OSC_SEQ_PERL, DT_STR, str, DT_END))) 3544 HOOK_INVOKE ((this, HOOK_OSC_SEQ_PERL, DT_STR, str, DT_STR_LEN, &resp, 1, DT_END));
3516 ; // no responses yet
3517 break; 3545 break;
3518#endif 3546#endif
3519 } 3547 }
3520} 3548}
3521/*----------------------------------------------------------------------*/ 3549/*----------------------------------------------------------------------*/
3562 static const struct 3590 static const struct
3563 { 3591 {
3564 const int argval; 3592 const int argval;
3565 const unsigned long bit; 3593 const unsigned long bit;
3566 } argtopriv[] = { 3594 } argtopriv[] = {
3567 { 1, PrivMode_aplCUR }, 3595 { 1, PrivMode_aplCUR }, // DECCKM
3568 { 2, PrivMode_vt52 }, 3596 { 2, PrivMode_vt52 },
3569 { 3, PrivMode_132 }, 3597 { 3, PrivMode_132 }, // DECCOLM
3570 { 4, PrivMode_smoothScroll }, 3598 { 4, PrivMode_smoothScroll }, // DECSCLM
3571 { 5, PrivMode_rVideo }, 3599 { 5, PrivMode_rVideo }, // DECSCNM
3572 { 6, PrivMode_relOrigin }, 3600 { 6, PrivMode_relOrigin }, // DECOM
3573 { 7, PrivMode_Autowrap }, 3601 { 7, PrivMode_Autowrap }, // DECAWM
3574 // 8, bi-directional support mode 3602 // 8, auto-repeat keys // DECARM
3575 { 9, PrivMode_MouseX10 }, 3603 { 9, PrivMode_MouseX10 },
3576 // 18, 19 printing-related 3604 // 18 end FF to printer after print screen
3605 // 19 Print screen prints full screen/scorll region
3577 { 25, PrivMode_VisibleCursor }, 3606 { 25, PrivMode_VisibleCursor }, // cnorm/cvvis/civis
3578#ifdef scrollBar_esc 3607#ifdef scrollBar_esc
3579 { scrollBar_esc, PrivMode_scrollBar }, 3608 { scrollBar_esc, PrivMode_scrollBar },
3580#endif 3609#endif
3581 { 35, PrivMode_ShiftKeys }, // rxvt extension 3610 { 35, PrivMode_ShiftKeys }, // rxvt extension
3611 // 38, tektronix mode // DECTEK
3582 { 40, PrivMode_132OK }, 3612 { 40, PrivMode_132OK },
3583 // 41 xterm more fixes NYI 3613 // 41 xterm more fixes NYI
3584 // 45 margin bell NYI 3614 // 45 margin bell NYI
3585 // 46 start logging 3615 // 46 start logging
3586 { 47, PrivMode_Screen }, 3616 { 47, PrivMode_Screen },
3587 { 66, PrivMode_aplKP }, 3617 { 66, PrivMode_aplKP }, // DECPAM/DECPNM
3588#ifndef NO_BACKSPACE_KEY 3618#ifndef NO_BACKSPACE_KEY
3589 { 67, PrivMode_BackSpace }, 3619 { 67, PrivMode_BackSpace }, // DECBKM
3590#endif 3620#endif
3591 { 1000, PrivMode_MouseX11 }, 3621 { 1000, PrivMode_MouseX11 },
3592 { 1002, PrivMode_MouseBtnEvent }, 3622 { 1002, PrivMode_MouseBtnEvent },
3593 { 1003, PrivMode_MouseAnyEvent }, 3623 { 1003, PrivMode_MouseAnyEvent },
3594 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3624 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3633 3663
3634 scr_touch (true); 3664 scr_touch (true);
3635 break; 3665 break;
3636#endif 3666#endif
3637 case 1048: /* alternative cursor save */ 3667 case 1048: /* alternative cursor save */
3638 case 1049:
3639 if (option (Opt_secondaryScreen)) 3668 if (option (Opt_secondaryScreen))
3640 if (mode == 0) 3669 if (mode == 0)
3641 scr_cursor (RESTORE); 3670 scr_cursor (RESTORE);
3642 else if (mode == 1) 3671 else if (mode == 1)
3643 scr_cursor (SAVE); 3672 scr_cursor (SAVE);
3656 */ 3685 */
3657 set_privmode (PrivMode_vt52, 1); 3686 set_privmode (PrivMode_vt52, 1);
3658 break; 3687 break;
3659 case 3: /* 80/132 */ 3688 case 3: /* 80/132 */
3660 if (priv_modes & PrivMode_132OK) 3689 if (priv_modes & PrivMode_132OK)
3661 {
3662 scr_poweron ();
3663 set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight); 3690 set_widthheight ((state ? 132 : 80) * fwidth, 24 * fheight);
3664 }
3665 break; 3691 break;
3666 case 4: /* smooth scrolling */ 3692 case 4: /* smooth scrolling */
3667 set_option (Opt_jumpScroll, !state); 3693 set_option (Opt_jumpScroll, !state);
3668 break; 3694 break;
3669 case 5: /* reverse video */ 3695 case 5: /* reverse video */
3711 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; 3737 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
3712 vt_emask_mouse = PointerMotionMask; 3738 vt_emask_mouse = PointerMotionMask;
3713 } 3739 }
3714 else 3740 else
3715 vt_emask_mouse = NoEventMask; 3741 vt_emask_mouse = NoEventMask;
3742
3716 vt_select_input (); 3743 vt_select_input ();
3717 break; 3744 break;
3718 case 1010: /* scroll to bottom on TTY output inhibit */ 3745 case 1010: /* scroll to bottom on TTY output inhibit */
3719 set_option (Opt_scrollTtyOutput, !state); 3746 set_option (Opt_scrollTtyOutput, !state);
3720 break; 3747 break;
3721 case 1011: /* scroll to bottom on key press */ 3748 case 1011: /* scroll to bottom on key press */
3722 set_option (Opt_scrollTtyKeypress, state); 3749 set_option (Opt_scrollTtyKeypress, state);
3723 break; 3750 break;
3724 case 1047: /* secondary screen w/ clearing last */ 3751 case 1047: /* secondary screen w/ clearing last */
3725 if (option (Opt_secondaryScreen)) 3752 if (option (Opt_secondaryScreen))
3726 if (current_screen != PRIMARY) 3753 if (!state)
3727 scr_erase_screen (2); 3754 scr_erase_screen (2);
3755
3728 scr_change_screen (state); 3756 scr_change_screen (state);
3729 break; 3757 break;
3730 case 1049: /* secondary screen w/ clearing first */ 3758 case 1049: /* secondary screen w/ clearing first */
3759 if (option (Opt_secondaryScreen))
3760 if (state)
3761 scr_cursor (SAVE);
3762
3731 scr_change_screen (state); 3763 scr_change_screen (state);
3764
3732 if (option (Opt_secondaryScreen)) 3765 if (option (Opt_secondaryScreen))
3733 if (current_screen != PRIMARY) 3766 if (state)
3734 scr_erase_screen (2); 3767 scr_erase_screen (2);
3768 else
3769 scr_cursor (RESTORE);
3735 break; 3770 break;
3736 default: 3771 default:
3737 break; 3772 break;
3738 } 3773 }
3739 } 3774 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines