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