… | |
… | |
64 | |
64 | |
65 | /*----------------------------------------------------------------------*/ |
65 | /*----------------------------------------------------------------------*/ |
66 | |
66 | |
67 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
67 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
68 | |
68 | |
69 | // exception thrown when the command parser runs out of input data |
|
|
70 | class out_of_input { } out_of_input; |
|
|
71 | |
|
|
72 | #if ENABLE_FRILLS || ISO_14755 |
69 | #if ENABLE_FRILLS || ISO_14755 |
73 | |
70 | |
74 | #define ISO_14755_STARTED 0x80000000UL |
71 | #define ISO_14755_STARTED 0x80000000UL |
75 | #define ISO_14755_51 0x40000000UL // basic (section 5.1) |
72 | #define ISO_14755_51 0x40000000UL // basic (section 5.1) |
76 | #define ISO_14755_52 0x20000000UL // keycap (section 5.2) |
73 | #define ISO_14755_52 0x20000000UL // keycap (section 5.2) |
… | |
… | |
464 | { |
461 | { |
465 | switch (keysym) |
462 | switch (keysym) |
466 | { |
463 | { |
467 | /* normal XTerm key bindings */ |
464 | /* normal XTerm key bindings */ |
468 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
465 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
469 | selection_request (ev.time, 0, 0); |
466 | selection_request (ev.time); |
470 | return; |
467 | return; |
471 | #if TODO |
468 | #if TODO |
472 | /* rxvt extras */ |
469 | /* rxvt extras */ |
473 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
470 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
474 | change_font (FONT_UP); |
471 | change_font (FONT_UP); |
… | |
… | |
1044 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1041 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1045 | { |
1042 | { |
1046 | hidden_cursor = !hidden_cursor; |
1043 | hidden_cursor = !hidden_cursor; |
1047 | want_refresh = 1; |
1044 | want_refresh = 1; |
1048 | |
1045 | |
1049 | w.start (w.at + BLINK_INTERVAL); |
1046 | w.start (w.at + CURSOR_BLINK_INTERVAL); |
1050 | } |
1047 | } |
1051 | #endif |
1048 | #endif |
1052 | |
1049 | |
1053 | #ifdef TEXT_BLINK |
1050 | #ifdef TEXT_BLINK |
1054 | void |
1051 | void |
… | |
… | |
1137 | |
1134 | |
1138 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1135 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1139 | cmdbuf_ptr = cmdbuf_base; |
1136 | cmdbuf_ptr = cmdbuf_base; |
1140 | cmdbuf_endp = cmdbuf_ptr + n; |
1137 | cmdbuf_endp = cmdbuf_ptr + n; |
1141 | |
1138 | |
1142 | ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); |
1139 | ssize_t r = read (pty->pty, cmdbuf_endp, CBUFSIZ - n); |
1143 | |
1140 | |
1144 | if (r > 0) |
1141 | if (r > 0) |
1145 | { |
1142 | { |
1146 | cmdbuf_endp += r; |
1143 | cmdbuf_endp += r; |
1147 | return true; |
1144 | return true; |
… | |
… | |
1405 | button_release (ev.xbutton); |
1402 | button_release (ev.xbutton); |
1406 | break; |
1403 | break; |
1407 | |
1404 | |
1408 | case ClientMessage: |
1405 | case ClientMessage: |
1409 | if (ev.xclient.format == 32 |
1406 | if (ev.xclient.format == 32 |
1410 | && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
1407 | && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END))) |
1411 | { |
1408 | { |
|
|
1409 | if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
|
|
1410 | { |
|
|
1411 | if (!HOOK_INVOKE ((this, HOOK_WM_PROTOCOLS, DT_XEVENT, &ev, DT_END))) |
|
|
1412 | { |
1412 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
1413 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
|
|
1414 | { |
|
|
1415 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) |
1413 | destroy (); |
1416 | destroy (); |
|
|
1417 | } |
1414 | #if ENABLE_EWMH |
1418 | #if ENABLE_EWMH |
1415 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1419 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1416 | XSendEvent (disp, ev.xclient.window = display->root, |
1420 | XSendEvent (disp, ev.xclient.window = display->root, |
1417 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1421 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1418 | &ev); |
1422 | &ev); |
|
|
1423 | #endif |
|
|
1424 | } |
|
|
1425 | } |
|
|
1426 | #if ENABLE_XEMBED |
|
|
1427 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1428 | { |
|
|
1429 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1430 | focus_in (); |
|
|
1431 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1432 | focus_out (); |
|
|
1433 | } |
1419 | #endif |
1434 | #endif |
1420 | } |
1435 | } |
1421 | #if ENABLE_XEMBED |
|
|
1422 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1423 | { |
|
|
1424 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1425 | focus_in (); |
|
|
1426 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1427 | focus_out (); |
|
|
1428 | } |
|
|
1429 | #endif |
|
|
1430 | #ifdef OFFIX_DND |
|
|
1431 | /* OffiX Dnd (drag 'n' drop) protocol */ |
|
|
1432 | else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL] |
|
|
1433 | && (ev.xclient.data.l[0] == DndFile |
|
|
1434 | || ev.xclient.data.l[0] == DndDir |
|
|
1435 | || ev.xclient.data.l[0] == DndLink)) |
|
|
1436 | { |
|
|
1437 | /* Get Dnd data */ |
|
|
1438 | Atom ActualType; |
|
|
1439 | int ActualFormat; |
|
|
1440 | unsigned char *data; |
|
|
1441 | unsigned long Size, RemainingBytes; |
|
|
1442 | |
|
|
1443 | XGetWindowProperty (disp, display->root, |
|
|
1444 | xa[XA_DNDSELECTION], |
|
|
1445 | 0L, 1000000L, |
|
|
1446 | False, AnyPropertyType, |
|
|
1447 | &ActualType, &ActualFormat, |
|
|
1448 | &Size, &RemainingBytes, |
|
|
1449 | &data); |
|
|
1450 | set_string_property (XA_CUT_BUFFER0, data); |
|
|
1451 | XFree (data); |
|
|
1452 | selection_paste (display->root, XA_CUT_BUFFER0, true); |
|
|
1453 | XSetInputFocus (disp, display->root, RevertToNone, CurrentTime); |
|
|
1454 | } |
|
|
1455 | #endif /* OFFIX_DND */ |
|
|
1456 | break; |
1436 | break; |
1457 | |
1437 | |
1458 | case MappingNotify: |
1438 | case MappingNotify: |
1459 | XRefreshKeyboardMapping (&ev.xmapping); |
1439 | XRefreshKeyboardMapping (&ev.xmapping); |
1460 | break; |
1440 | break; |
… | |
… | |
1502 | { |
1482 | { |
1503 | seen_resize = 1; |
1483 | seen_resize = 1; |
1504 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1484 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1505 | } |
1485 | } |
1506 | |
1486 | |
|
|
1487 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
|
|
1488 | |
1507 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1489 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1508 | if (OPTION (Opt_transparent)) |
1490 | if (OPTION (Opt_transparent)) |
1509 | check_our_parents (); |
1491 | check_our_parents (); |
1510 | #endif |
1492 | #endif |
1511 | } |
1493 | } |
1512 | break; |
1494 | break; |
1513 | |
1495 | |
1514 | case PropertyNotify: |
1496 | case PropertyNotify: |
|
|
1497 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1515 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1498 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1516 | && ev.xproperty.state == PropertyNewValue) |
1499 | && ev.xproperty.state == PropertyNewValue) |
1517 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1500 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1518 | |
1501 | |
1519 | break; |
1502 | break; |
1520 | |
1503 | |
1521 | case SelectionClear: |
1504 | case SelectionClear: |
1522 | selection_clear (); |
1505 | selection_clear (); |
… | |
… | |
1711 | { |
1694 | { |
1712 | hidden_cursor = 0; |
1695 | hidden_cursor = 0; |
1713 | want_refresh = 1; |
1696 | want_refresh = 1; |
1714 | } |
1697 | } |
1715 | |
1698 | |
1716 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1699 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1717 | } |
1700 | } |
1718 | #endif |
1701 | #endif |
1719 | |
1702 | |
1720 | #if defined(POINTER_BLANK) |
1703 | #if defined(POINTER_BLANK) |
1721 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
1704 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
… | |
… | |
1749 | XSetICFocus (Input_Context); |
1732 | XSetICFocus (Input_Context); |
1750 | } |
1733 | } |
1751 | #endif |
1734 | #endif |
1752 | #if CURSOR_BLINK |
1735 | #if CURSOR_BLINK |
1753 | if (OPTION (Opt_cursorBlink)) |
1736 | if (OPTION (Opt_cursorBlink)) |
1754 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1737 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1755 | #endif |
1738 | #endif |
1756 | #if OFF_FOCUS_FADING |
1739 | #if OFF_FOCUS_FADING |
1757 | if (rs[Rs_fade]) |
1740 | if (rs[Rs_fade]) |
1758 | { |
1741 | { |
1759 | pix_colors = pix_colors_focused; |
1742 | pix_colors = pix_colors_focused; |
… | |
… | |
1840 | /* |
1823 | /* |
1841 | * VT window processing of button press |
1824 | * VT window processing of button press |
1842 | */ |
1825 | */ |
1843 | if (ev.window == vt) |
1826 | if (ev.window == vt) |
1844 | { |
1827 | { |
|
|
1828 | if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1829 | return; |
|
|
1830 | |
1845 | #if ISO_14755 |
1831 | #if ISO_14755 |
1846 | // 5.4 |
1832 | // 5.4 |
1847 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1833 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1848 | { |
1834 | { |
1849 | iso14755_54 (ev.x, ev.y); |
1835 | iso14755_54 (ev.x, ev.y); |
… | |
… | |
1891 | else |
1877 | else |
1892 | { |
1878 | { |
1893 | if (ev.button != MEvent.button) |
1879 | if (ev.button != MEvent.button) |
1894 | MEvent.clicks = 0; |
1880 | MEvent.clicks = 0; |
1895 | |
1881 | |
1896 | if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1897 | switch (ev.button) |
1882 | switch (ev.button) |
1898 | { |
1883 | { |
1899 | case Button1: |
1884 | case Button1: |
1900 | /* allow meta + click to select rectangular areas */ |
1885 | /* allow meta + click to select rectangular areas */ |
1901 | /* should be done in screen.C */ |
1886 | /* should be done in screen.C */ |
1902 | #if ENABLE_FRILLS |
1887 | #if ENABLE_FRILLS |
1903 | selection.rect = !!(ev.state & ModMetaMask); |
1888 | selection.rect = !!(ev.state & ModMetaMask); |
1904 | #else |
1889 | #else |
1905 | selection.rect = false; |
1890 | selection.rect = false; |
1906 | #endif |
1891 | #endif |
1907 | |
1892 | |
1908 | /* allow shift+left click to extend selection */ |
1893 | /* allow shift+left click to extend selection */ |
1909 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1894 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1910 | { |
1895 | { |
1911 | if (MEvent.button == Button1 && clickintime) |
1896 | if (MEvent.button == Button1 && clickintime) |
1912 | selection_rotate (ev.x, ev.y); |
1897 | selection_rotate (ev.x, ev.y); |
1913 | else |
1898 | else |
1914 | selection_extend (ev.x, ev.y, 1); |
1899 | selection_extend (ev.x, ev.y, 1); |
1915 | } |
1900 | } |
1916 | else |
1901 | else |
1917 | { |
1902 | { |
1918 | if (MEvent.button == Button1 && clickintime) |
1903 | if (MEvent.button == Button1 && clickintime) |
1919 | MEvent.clicks++; |
1904 | MEvent.clicks++; |
1920 | else |
1905 | else |
1921 | MEvent.clicks = 1; |
1906 | MEvent.clicks = 1; |
1922 | |
1907 | |
1923 | selection_click (MEvent.clicks, ev.x, ev.y); |
1908 | selection_click (MEvent.clicks, ev.x, ev.y); |
1924 | } |
1909 | } |
1925 | |
1910 | |
1926 | MEvent.button = Button1; |
1911 | MEvent.button = Button1; |
1927 | break; |
1912 | break; |
1928 | |
1913 | |
1929 | case Button3: |
1914 | case Button3: |
1930 | if (MEvent.button == Button3 && clickintime) |
1915 | if (MEvent.button == Button3 && clickintime) |
1931 | selection_rotate (ev.x, ev.y); |
1916 | selection_rotate (ev.x, ev.y); |
1932 | else |
1917 | else |
1933 | selection_extend (ev.x, ev.y, 1); |
1918 | selection_extend (ev.x, ev.y, 1); |
1934 | |
1919 | |
1935 | MEvent.button = Button3; |
1920 | MEvent.button = Button3; |
1936 | break; |
1921 | break; |
1937 | } |
1922 | } |
1938 | } |
1923 | } |
1939 | |
1924 | |
1940 | MEvent.time = ev.time; |
1925 | MEvent.time = ev.time; |
1941 | return; |
1926 | return; |
1942 | } |
1927 | } |
1943 | |
1928 | |
… | |
… | |
2106 | sel_scroll_ev.stop(); |
2091 | sel_scroll_ev.stop(); |
2107 | #endif |
2092 | #endif |
2108 | |
2093 | |
2109 | if (ev.window == vt) |
2094 | if (ev.window == vt) |
2110 | { |
2095 | { |
|
|
2096 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2097 | return; |
|
|
2098 | |
2111 | #if ISO_14755 |
2099 | #if ISO_14755 |
2112 | // 5.4 |
2100 | // 5.4 |
2113 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2101 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2114 | return; |
2102 | return; |
2115 | #endif |
2103 | #endif |
|
|
2104 | |
2116 | if (reportmode) |
2105 | if (reportmode) |
2117 | { |
2106 | { |
2118 | /* mouse report from vt window */ |
2107 | /* mouse report from vt window */ |
2119 | /* don't report release of wheel "buttons" */ |
2108 | /* don't report release of wheel "buttons" */ |
2120 | if (ev.button >= 4) |
2109 | if (ev.button >= 4) |
… | |
… | |
2144 | if (priv_modes & PrivMode_mouse_report |
2133 | if (priv_modes & PrivMode_mouse_report |
2145 | && bypass_keystate |
2134 | && bypass_keystate |
2146 | && ev.button == Button1 && MEvent.clicks <= 1) |
2135 | && ev.button == Button1 && MEvent.clicks <= 1) |
2147 | selection_extend (ev.x, ev.y, 0); |
2136 | selection_extend (ev.x, ev.y, 0); |
2148 | |
2137 | |
2149 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2150 | return; |
|
|
2151 | |
|
|
2152 | switch (ev.button) |
2138 | switch (ev.button) |
2153 | { |
2139 | { |
2154 | case Button1: |
2140 | case Button1: |
2155 | case Button3: |
2141 | case Button3: |
2156 | selection_make (ev.time); |
2142 | selection_make (ev.time); |
2157 | break; |
2143 | break; |
|
|
2144 | |
2158 | case Button2: |
2145 | case Button2: |
2159 | selection_request (ev.time, ev.x, ev.y); |
2146 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
|
|
2147 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary); |
2160 | break; |
2148 | break; |
|
|
2149 | |
2161 | #ifdef MOUSE_WHEEL |
2150 | #ifdef MOUSE_WHEEL |
2162 | case Button4: |
2151 | case Button4: |
2163 | case Button5: |
2152 | case Button5: |
2164 | { |
2153 | { |
2165 | int i; |
2154 | int i; |
… | |
… | |
2643 | am_transparent = 0; |
2632 | am_transparent = 0; |
2644 | /* XXX: also turn off Opt_transparent? */ |
2633 | /* XXX: also turn off Opt_transparent? */ |
2645 | } |
2634 | } |
2646 | else |
2635 | else |
2647 | { |
2636 | { |
2648 | #if WAIT_FOR_WM |
|
|
2649 | /* wait (an arbitrary period) for the WM to do its thing |
|
|
2650 | * needed for fvwm2.2.2 (and before?) */ |
|
|
2651 | sleep (1); |
|
|
2652 | #endif |
|
|
2653 | for (n = 0; n < (unsigned int)i; n++) |
2637 | for (n = 0; n < (unsigned int)i; n++) |
2654 | { |
2638 | { |
2655 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2639 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2656 | XClearWindow (disp, parent[n]); |
2640 | XClearWindow (disp, parent[n]); |
2657 | } |
2641 | } |
… | |
… | |
2820 | return flag; |
2804 | return flag; |
2821 | } |
2805 | } |
2822 | |
2806 | |
2823 | // read the next character |
2807 | // read the next character |
2824 | wchar_t |
2808 | wchar_t |
2825 | rxvt_term::next_char () |
2809 | rxvt_term::next_char () NOTHROW |
2826 | { |
2810 | { |
2827 | while (cmdbuf_ptr < cmdbuf_endp) |
2811 | while (cmdbuf_ptr < cmdbuf_endp) |
2828 | { |
2812 | { |
2829 | // assume 7-bit to be ascii ALWAYS |
2813 | // assume 7-bit to be ascii ALWAYS |
2830 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2814 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
… | |
… | |
2851 | return NOCHAR; |
2835 | return NOCHAR; |
2852 | } |
2836 | } |
2853 | |
2837 | |
2854 | // read the next octet |
2838 | // read the next octet |
2855 | uint32_t |
2839 | uint32_t |
2856 | rxvt_term::next_octet () |
2840 | rxvt_term::next_octet () NOTHROW |
2857 | { |
2841 | { |
2858 | return cmdbuf_ptr < cmdbuf_endp |
2842 | return cmdbuf_ptr < cmdbuf_endp |
2859 | ? (unsigned char)*cmdbuf_ptr++ |
2843 | ? (unsigned char)*cmdbuf_ptr++ |
2860 | : NOCHAR; |
2844 | : NOCHAR; |
2861 | } |
2845 | } |
|
|
2846 | |
|
|
2847 | static class out_of_input out_of_input; |
2862 | |
2848 | |
2863 | /* rxvt_cmd_getc () - Return next input character */ |
2849 | /* rxvt_cmd_getc () - Return next input character */ |
2864 | /* |
2850 | /* |
2865 | * Return the next input character after first passing any keyboard input |
2851 | * Return the next input character after first passing any keyboard input |
2866 | * to the command. |
2852 | * to the command. |
2867 | */ |
2853 | */ |
2868 | wchar_t |
2854 | wchar_t |
2869 | rxvt_term::cmd_getc () |
2855 | rxvt_term::cmd_getc () THROW ((class out_of_input)) |
2870 | { |
2856 | { |
2871 | wchar_t c = next_char (); |
2857 | wchar_t c = next_char (); |
2872 | |
2858 | |
2873 | if (c == NOCHAR) |
2859 | if (c == NOCHAR) |
2874 | throw out_of_input; |
2860 | throw out_of_input; |
2875 | |
2861 | |
2876 | return c; |
2862 | return c; |
2877 | } |
2863 | } |
2878 | |
2864 | |
2879 | uint32_t |
2865 | uint32_t |
2880 | rxvt_term::cmd_get8 () |
2866 | rxvt_term::cmd_get8 () THROW ((class out_of_input)) |
2881 | { |
2867 | { |
2882 | uint32_t c = next_octet (); |
2868 | uint32_t c = next_octet (); |
2883 | |
2869 | |
2884 | if (c == NOCHAR) |
2870 | if (c == NOCHAR) |
2885 | throw out_of_input; |
2871 | throw out_of_input; |
… | |
… | |
3764 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3750 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3765 | */ |
3751 | */ |
3766 | void |
3752 | void |
3767 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3753 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3768 | { |
3754 | { |
3769 | int changed = 0; |
|
|
3770 | int color; |
3755 | int color; |
3771 | char *buf, *name; |
3756 | char *buf, *name; |
3772 | bool query = str[0] == '?' && !str[1]; |
3757 | bool query = str[0] == '?' && !str[1]; |
3773 | int saveop = op; |
3758 | int saveop = op; |
3774 | dDisp; |
3759 | dDisp; |
… | |
… | |
3890 | want_full_refresh = want_refresh = 1; |
3875 | want_full_refresh = want_refresh = 1; |
3891 | break; |
3876 | break; |
3892 | #endif |
3877 | #endif |
3893 | |
3878 | |
3894 | case Rxvt_Pixmap: |
3879 | case Rxvt_Pixmap: |
|
|
3880 | { |
3895 | if (*str != ';') |
3881 | if (*str != ';') |
3896 | { |
3882 | { |
3897 | #if XPM_BACKGROUND |
3883 | #if XPM_BACKGROUND |
3898 | scale_pixmap (""); /* reset to default scaling */ |
3884 | scale_pixmap (""); /* reset to default scaling */ |
3899 | set_bgPixmap (str); /* change pixmap */ |
3885 | set_bgPixmap (str); /* change pixmap */ |
3900 | scr_touch (true); |
3886 | scr_touch (true); |
3901 | #endif |
3887 | #endif |
3902 | } |
3888 | } |
3903 | |
3889 | |
|
|
3890 | int changed = 0; |
|
|
3891 | |
3904 | while ((str = strchr (str, ';')) != NULL) |
3892 | while ((str = strchr (str, ';')) != NULL) |
3905 | { |
3893 | { |
3906 | str++; |
3894 | str++; |
3907 | #if XPM_BACKGROUND |
3895 | #if XPM_BACKGROUND |
3908 | changed += scale_pixmap (str); |
3896 | changed += scale_pixmap (str); |
3909 | #endif |
3897 | #endif |
3910 | } |
3898 | } |
3911 | |
3899 | |
3912 | if (changed) |
3900 | if (changed) |
3913 | { |
3901 | { |
3914 | #ifdef XPM_BACKGROUND |
3902 | #ifdef XPM_BACKGROUND |
3915 | resize_pixmap (); |
3903 | resize_pixmap (); |
3916 | scr_touch (true); |
3904 | scr_touch (true); |
3917 | #endif |
3905 | #endif |
3918 | } |
3906 | } |
|
|
3907 | } |
3919 | break; |
3908 | break; |
3920 | |
3909 | |
3921 | case Rxvt_restoreFG: |
3910 | case Rxvt_restoreFG: |
3922 | set_window_color (Color_fg, str); |
3911 | set_window_color (Color_fg, str); |
3923 | break; |
3912 | break; |
… | |
… | |
3969 | if (query) |
3958 | if (query) |
3970 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); |
3959 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); |
3971 | else |
3960 | else |
3972 | { |
3961 | { |
3973 | set_locale (str); |
3962 | set_locale (str); |
3974 | pty.set_utf8_mode (enc_utf8); |
3963 | pty->set_utf8_mode (enc_utf8); |
3975 | init_xlocale (); |
3964 | init_xlocale (); |
3976 | } |
3965 | } |
3977 | break; |
3966 | break; |
3978 | |
3967 | |
3979 | case URxvt_view_up: |
3968 | case URxvt_view_up: |
… | |
… | |
4032 | return state; |
4021 | return state; |
4033 | } |
4022 | } |
4034 | |
4023 | |
4035 | /* we're not using priv _yet_ */ |
4024 | /* we're not using priv _yet_ */ |
4036 | void |
4025 | void |
4037 | rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) |
4026 | rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg) |
4038 | { |
4027 | { |
4039 | unsigned int i, j; |
4028 | unsigned int i, j; |
4040 | int state; |
4029 | int state; |
4041 | |
4030 | |
4042 | static const struct |
4031 | static const struct |
… | |
… | |
4411 | rxvt_term::tt_write (const char *data, unsigned int len) |
4400 | rxvt_term::tt_write (const char *data, unsigned int len) |
4412 | { |
4401 | { |
4413 | if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) |
4402 | if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) |
4414 | return; |
4403 | return; |
4415 | |
4404 | |
4416 | if (pty.pty < 0) |
4405 | if (pty->pty < 0) |
4417 | return; |
4406 | return; |
4418 | |
4407 | |
4419 | if (v_buflen == 0) |
4408 | if (v_buflen == 0) |
4420 | { |
4409 | { |
4421 | ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE)); |
4410 | ssize_t written = write (pty->pty, data, min (len, MAX_PTY_WRITE)); |
4422 | |
4411 | |
4423 | if ((unsigned int)written == len) |
4412 | if ((unsigned int)written == len) |
4424 | return; |
4413 | return; |
4425 | |
4414 | |
4426 | data += written; |
4415 | data += written; |
… | |
… | |
4435 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4424 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4436 | } |
4425 | } |
4437 | |
4426 | |
4438 | void rxvt_term::pty_write () |
4427 | void rxvt_term::pty_write () |
4439 | { |
4428 | { |
4440 | int written = write (pty.pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4429 | int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4441 | |
4430 | |
4442 | if (written > 0) |
4431 | if (written > 0) |
4443 | { |
4432 | { |
4444 | v_buflen -= written; |
4433 | v_buflen -= written; |
4445 | |
4434 | |