… | |
… | |
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) |
… | |
… | |
302 | rxvt_term::lookup_key (XKeyEvent &ev) |
299 | rxvt_term::lookup_key (XKeyEvent &ev) |
303 | { |
300 | { |
304 | int ctrl, meta, shft, len; |
301 | int ctrl, meta, shft, len; |
305 | unsigned int newlen; |
302 | unsigned int newlen; |
306 | KeySym keysym; |
303 | KeySym keysym; |
307 | #ifdef DEBUG_CMD |
|
|
308 | static int debug_key = 1; /* accessible by a debugger only */ |
|
|
309 | #endif |
|
|
310 | int valid_keysym; |
304 | int valid_keysym; |
311 | char kbuf[KBUFSZ]; |
305 | char kbuf[KBUFSZ]; |
312 | |
306 | |
313 | /* |
307 | /* |
314 | * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an |
308 | * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an |
… | |
… | |
464 | { |
458 | { |
465 | switch (keysym) |
459 | switch (keysym) |
466 | { |
460 | { |
467 | /* normal XTerm key bindings */ |
461 | /* normal XTerm key bindings */ |
468 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
462 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
469 | selection_request (ev.time, 0, 0); |
463 | selection_request (ev.time); |
470 | return; |
464 | return; |
471 | #if TODO |
465 | #if TODO |
472 | /* rxvt extras */ |
466 | /* rxvt extras */ |
473 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
467 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
474 | change_font (FONT_UP); |
468 | change_font (FONT_UP); |
… | |
… | |
905 | { |
899 | { |
906 | const char ch = C0_ESC; |
900 | const char ch = C0_ESC; |
907 | tt_write (&ch, 1); |
901 | tt_write (&ch, 1); |
908 | } |
902 | } |
909 | |
903 | |
910 | #if defined(DEBUG_CMD) |
|
|
911 | /* Display keyboard buffer contents */ |
|
|
912 | unsigned char *p; |
|
|
913 | int i; |
|
|
914 | |
|
|
915 | fprintf (stderr, "key 0x%04X [%d]: `", (unsigned int)keysym, len); |
|
|
916 | for (i = 0, p = kbuf; i < len; i++, p++) |
|
|
917 | fprintf (stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); |
|
|
918 | fprintf (stderr, "'\n"); |
|
|
919 | #endif /* DEBUG_CMD */ |
|
|
920 | tt_write (kbuf, (unsigned int)len); |
904 | tt_write (kbuf, (unsigned int)len); |
921 | } |
905 | } |
922 | /*}}} */ |
906 | /*}}} */ |
923 | |
907 | |
924 | #if defined (KEYSYM_RESOURCE) |
908 | #if defined (KEYSYM_RESOURCE) |
… | |
… | |
1044 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1028 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1045 | { |
1029 | { |
1046 | hidden_cursor = !hidden_cursor; |
1030 | hidden_cursor = !hidden_cursor; |
1047 | want_refresh = 1; |
1031 | want_refresh = 1; |
1048 | |
1032 | |
1049 | w.start (w.at + BLINK_INTERVAL); |
1033 | w.start (w.at + CURSOR_BLINK_INTERVAL); |
1050 | } |
1034 | } |
1051 | #endif |
1035 | #endif |
1052 | |
1036 | |
1053 | #ifdef TEXT_BLINK |
1037 | #ifdef TEXT_BLINK |
1054 | void |
1038 | void |
… | |
… | |
1405 | button_release (ev.xbutton); |
1389 | button_release (ev.xbutton); |
1406 | break; |
1390 | break; |
1407 | |
1391 | |
1408 | case ClientMessage: |
1392 | case ClientMessage: |
1409 | if (ev.xclient.format == 32 |
1393 | if (ev.xclient.format == 32 |
1410 | && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
1394 | && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END))) |
1411 | { |
1395 | { |
|
|
1396 | if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
|
|
1397 | { |
|
|
1398 | if (!HOOK_INVOKE ((this, HOOK_WM_PROTOCOLS, DT_XEVENT, &ev, DT_END))) |
|
|
1399 | { |
1412 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
1400 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
|
|
1401 | { |
|
|
1402 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) |
1413 | destroy (); |
1403 | destroy (); |
|
|
1404 | } |
1414 | #if ENABLE_EWMH |
1405 | #if ENABLE_EWMH |
1415 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1406 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1416 | XSendEvent (disp, ev.xclient.window = display->root, |
1407 | XSendEvent (disp, ev.xclient.window = display->root, |
1417 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1408 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1418 | &ev); |
1409 | &ev); |
|
|
1410 | #endif |
|
|
1411 | } |
|
|
1412 | } |
|
|
1413 | #if ENABLE_XEMBED |
|
|
1414 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1415 | { |
|
|
1416 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1417 | focus_in (); |
|
|
1418 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1419 | focus_out (); |
|
|
1420 | } |
1419 | #endif |
1421 | #endif |
1420 | } |
1422 | } |
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; |
1423 | break; |
1457 | |
1424 | |
1458 | case MappingNotify: |
1425 | case MappingNotify: |
1459 | XRefreshKeyboardMapping (&ev.xmapping); |
1426 | XRefreshKeyboardMapping (&ev.xmapping); |
1460 | break; |
1427 | break; |
… | |
… | |
1512 | #endif |
1479 | #endif |
1513 | } |
1480 | } |
1514 | break; |
1481 | break; |
1515 | |
1482 | |
1516 | case PropertyNotify: |
1483 | case PropertyNotify: |
|
|
1484 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1517 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1485 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1518 | && ev.xproperty.state == PropertyNewValue) |
1486 | && ev.xproperty.state == PropertyNewValue) |
1519 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1487 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1520 | |
1488 | |
1521 | break; |
1489 | break; |
1522 | |
1490 | |
1523 | case SelectionClear: |
1491 | case SelectionClear: |
1524 | selection_clear (); |
1492 | selection_clear (); |
… | |
… | |
1713 | { |
1681 | { |
1714 | hidden_cursor = 0; |
1682 | hidden_cursor = 0; |
1715 | want_refresh = 1; |
1683 | want_refresh = 1; |
1716 | } |
1684 | } |
1717 | |
1685 | |
1718 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1686 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1719 | } |
1687 | } |
1720 | #endif |
1688 | #endif |
1721 | |
1689 | |
1722 | #if defined(POINTER_BLANK) |
1690 | #if defined(POINTER_BLANK) |
1723 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
1691 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
… | |
… | |
1751 | XSetICFocus (Input_Context); |
1719 | XSetICFocus (Input_Context); |
1752 | } |
1720 | } |
1753 | #endif |
1721 | #endif |
1754 | #if CURSOR_BLINK |
1722 | #if CURSOR_BLINK |
1755 | if (OPTION (Opt_cursorBlink)) |
1723 | if (OPTION (Opt_cursorBlink)) |
1756 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1724 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1757 | #endif |
1725 | #endif |
1758 | #if OFF_FOCUS_FADING |
1726 | #if OFF_FOCUS_FADING |
1759 | if (rs[Rs_fade]) |
1727 | if (rs[Rs_fade]) |
1760 | { |
1728 | { |
1761 | pix_colors = pix_colors_focused; |
1729 | pix_colors = pix_colors_focused; |
… | |
… | |
1842 | /* |
1810 | /* |
1843 | * VT window processing of button press |
1811 | * VT window processing of button press |
1844 | */ |
1812 | */ |
1845 | if (ev.window == vt) |
1813 | if (ev.window == vt) |
1846 | { |
1814 | { |
|
|
1815 | if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1816 | return; |
|
|
1817 | |
1847 | #if ISO_14755 |
1818 | #if ISO_14755 |
1848 | // 5.4 |
1819 | // 5.4 |
1849 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1820 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1850 | { |
1821 | { |
1851 | iso14755_54 (ev.x, ev.y); |
1822 | iso14755_54 (ev.x, ev.y); |
… | |
… | |
1893 | else |
1864 | else |
1894 | { |
1865 | { |
1895 | if (ev.button != MEvent.button) |
1866 | if (ev.button != MEvent.button) |
1896 | MEvent.clicks = 0; |
1867 | MEvent.clicks = 0; |
1897 | |
1868 | |
1898 | if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1899 | switch (ev.button) |
1869 | switch (ev.button) |
1900 | { |
1870 | { |
1901 | case Button1: |
1871 | case Button1: |
1902 | /* allow meta + click to select rectangular areas */ |
1872 | /* allow meta + click to select rectangular areas */ |
1903 | /* should be done in screen.C */ |
1873 | /* should be done in screen.C */ |
1904 | #if ENABLE_FRILLS |
1874 | #if ENABLE_FRILLS |
1905 | selection.rect = !!(ev.state & ModMetaMask); |
1875 | selection.rect = !!(ev.state & ModMetaMask); |
1906 | #else |
1876 | #else |
1907 | selection.rect = false; |
1877 | selection.rect = false; |
1908 | #endif |
1878 | #endif |
1909 | |
1879 | |
1910 | /* allow shift+left click to extend selection */ |
1880 | /* allow shift+left click to extend selection */ |
1911 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1881 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1912 | { |
1882 | { |
1913 | if (MEvent.button == Button1 && clickintime) |
1883 | if (MEvent.button == Button1 && clickintime) |
1914 | selection_rotate (ev.x, ev.y); |
1884 | selection_rotate (ev.x, ev.y); |
1915 | else |
1885 | else |
1916 | selection_extend (ev.x, ev.y, 1); |
1886 | selection_extend (ev.x, ev.y, 1); |
1917 | } |
1887 | } |
1918 | else |
1888 | else |
1919 | { |
1889 | { |
1920 | if (MEvent.button == Button1 && clickintime) |
1890 | if (MEvent.button == Button1 && clickintime) |
1921 | MEvent.clicks++; |
1891 | MEvent.clicks++; |
1922 | else |
1892 | else |
1923 | MEvent.clicks = 1; |
1893 | MEvent.clicks = 1; |
1924 | |
1894 | |
1925 | selection_click (MEvent.clicks, ev.x, ev.y); |
1895 | selection_click (MEvent.clicks, ev.x, ev.y); |
1926 | } |
1896 | } |
1927 | |
1897 | |
1928 | MEvent.button = Button1; |
1898 | MEvent.button = Button1; |
1929 | break; |
1899 | break; |
1930 | |
1900 | |
1931 | case Button3: |
1901 | case Button3: |
1932 | if (MEvent.button == Button3 && clickintime) |
1902 | if (MEvent.button == Button3 && clickintime) |
1933 | selection_rotate (ev.x, ev.y); |
1903 | selection_rotate (ev.x, ev.y); |
1934 | else |
1904 | else |
1935 | selection_extend (ev.x, ev.y, 1); |
1905 | selection_extend (ev.x, ev.y, 1); |
1936 | |
1906 | |
1937 | MEvent.button = Button3; |
1907 | MEvent.button = Button3; |
1938 | break; |
1908 | break; |
1939 | } |
1909 | } |
1940 | } |
1910 | } |
1941 | |
1911 | |
1942 | MEvent.time = ev.time; |
1912 | MEvent.time = ev.time; |
1943 | return; |
1913 | return; |
1944 | } |
1914 | } |
1945 | |
1915 | |
… | |
… | |
2108 | sel_scroll_ev.stop(); |
2078 | sel_scroll_ev.stop(); |
2109 | #endif |
2079 | #endif |
2110 | |
2080 | |
2111 | if (ev.window == vt) |
2081 | if (ev.window == vt) |
2112 | { |
2082 | { |
|
|
2083 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2084 | return; |
|
|
2085 | |
2113 | #if ISO_14755 |
2086 | #if ISO_14755 |
2114 | // 5.4 |
2087 | // 5.4 |
2115 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2088 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2116 | return; |
2089 | return; |
2117 | #endif |
2090 | #endif |
|
|
2091 | |
2118 | if (reportmode) |
2092 | if (reportmode) |
2119 | { |
2093 | { |
2120 | /* mouse report from vt window */ |
2094 | /* mouse report from vt window */ |
2121 | /* don't report release of wheel "buttons" */ |
2095 | /* don't report release of wheel "buttons" */ |
2122 | if (ev.button >= 4) |
2096 | if (ev.button >= 4) |
… | |
… | |
2146 | if (priv_modes & PrivMode_mouse_report |
2120 | if (priv_modes & PrivMode_mouse_report |
2147 | && bypass_keystate |
2121 | && bypass_keystate |
2148 | && ev.button == Button1 && MEvent.clicks <= 1) |
2122 | && ev.button == Button1 && MEvent.clicks <= 1) |
2149 | selection_extend (ev.x, ev.y, 0); |
2123 | selection_extend (ev.x, ev.y, 0); |
2150 | |
2124 | |
2151 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2152 | return; |
|
|
2153 | |
|
|
2154 | switch (ev.button) |
2125 | switch (ev.button) |
2155 | { |
2126 | { |
2156 | case Button1: |
2127 | case Button1: |
2157 | case Button3: |
2128 | case Button3: |
2158 | selection_make (ev.time); |
2129 | selection_make (ev.time); |
2159 | break; |
2130 | break; |
|
|
2131 | |
2160 | case Button2: |
2132 | case Button2: |
2161 | selection_request (ev.time, ev.x, ev.y); |
2133 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
|
|
2134 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary); |
2162 | break; |
2135 | break; |
|
|
2136 | |
2163 | #ifdef MOUSE_WHEEL |
2137 | #ifdef MOUSE_WHEEL |
2164 | case Button4: |
2138 | case Button4: |
2165 | case Button5: |
2139 | case Button5: |
2166 | { |
2140 | { |
2167 | int i; |
2141 | int i; |
… | |
… | |
2645 | am_transparent = 0; |
2619 | am_transparent = 0; |
2646 | /* XXX: also turn off Opt_transparent? */ |
2620 | /* XXX: also turn off Opt_transparent? */ |
2647 | } |
2621 | } |
2648 | else |
2622 | else |
2649 | { |
2623 | { |
2650 | #if WAIT_FOR_WM |
|
|
2651 | /* wait (an arbitrary period) for the WM to do its thing |
|
|
2652 | * needed for fvwm2.2.2 (and before?) */ |
|
|
2653 | sleep (1); |
|
|
2654 | #endif |
|
|
2655 | for (n = 0; n < (unsigned int)i; n++) |
2624 | for (n = 0; n < (unsigned int)i; n++) |
2656 | { |
2625 | { |
2657 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2626 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2658 | XClearWindow (disp, parent[n]); |
2627 | XClearWindow (disp, parent[n]); |
2659 | } |
2628 | } |
… | |
… | |
2822 | return flag; |
2791 | return flag; |
2823 | } |
2792 | } |
2824 | |
2793 | |
2825 | // read the next character |
2794 | // read the next character |
2826 | wchar_t |
2795 | wchar_t |
2827 | rxvt_term::next_char () |
2796 | rxvt_term::next_char () NOTHROW |
2828 | { |
2797 | { |
2829 | while (cmdbuf_ptr < cmdbuf_endp) |
2798 | while (cmdbuf_ptr < cmdbuf_endp) |
2830 | { |
2799 | { |
2831 | // assume 7-bit to be ascii ALWAYS |
2800 | // assume 7-bit to be ascii ALWAYS |
2832 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2801 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
… | |
… | |
2853 | return NOCHAR; |
2822 | return NOCHAR; |
2854 | } |
2823 | } |
2855 | |
2824 | |
2856 | // read the next octet |
2825 | // read the next octet |
2857 | uint32_t |
2826 | uint32_t |
2858 | rxvt_term::next_octet () |
2827 | rxvt_term::next_octet () NOTHROW |
2859 | { |
2828 | { |
2860 | return cmdbuf_ptr < cmdbuf_endp |
2829 | return cmdbuf_ptr < cmdbuf_endp |
2861 | ? (unsigned char)*cmdbuf_ptr++ |
2830 | ? (unsigned char)*cmdbuf_ptr++ |
2862 | : NOCHAR; |
2831 | : NOCHAR; |
2863 | } |
2832 | } |
|
|
2833 | |
|
|
2834 | static class out_of_input out_of_input; |
2864 | |
2835 | |
2865 | /* rxvt_cmd_getc () - Return next input character */ |
2836 | /* rxvt_cmd_getc () - Return next input character */ |
2866 | /* |
2837 | /* |
2867 | * Return the next input character after first passing any keyboard input |
2838 | * Return the next input character after first passing any keyboard input |
2868 | * to the command. |
2839 | * to the command. |
2869 | */ |
2840 | */ |
2870 | wchar_t |
2841 | wchar_t |
2871 | rxvt_term::cmd_getc () |
2842 | rxvt_term::cmd_getc () THROW ((class out_of_input)) |
2872 | { |
2843 | { |
2873 | wchar_t c = next_char (); |
2844 | wchar_t c = next_char (); |
2874 | |
2845 | |
2875 | if (c == NOCHAR) |
2846 | if (c == NOCHAR) |
2876 | throw out_of_input; |
2847 | throw out_of_input; |
2877 | |
2848 | |
2878 | return c; |
2849 | return c; |
2879 | } |
2850 | } |
2880 | |
2851 | |
2881 | uint32_t |
2852 | uint32_t |
2882 | rxvt_term::cmd_get8 () |
2853 | rxvt_term::cmd_get8 () THROW ((class out_of_input)) |
2883 | { |
2854 | { |
2884 | uint32_t c = next_octet (); |
2855 | uint32_t c = next_octet (); |
2885 | |
2856 | |
2886 | if (c == NOCHAR) |
2857 | if (c == NOCHAR) |
2887 | throw out_of_input; |
2858 | throw out_of_input; |
… | |
… | |
3308 | ndef = get_byte_array_bit (csi_defaults, i); |
3279 | ndef = get_byte_array_bit (csi_defaults, i); |
3309 | for (p = 0; p < nargs; p++) |
3280 | for (p = 0; p < nargs; p++) |
3310 | if (arg[p] == -1) |
3281 | if (arg[p] == -1) |
3311 | arg[p] = ndef; |
3282 | arg[p] = ndef; |
3312 | |
3283 | |
3313 | #ifdef DEBUG_CMD |
|
|
3314 | fprintf (stderr, "CSI "); |
|
|
3315 | for (p = 0; p < nargs; p++) |
|
|
3316 | fprintf (stderr, "%d%s", arg[p], p < nargs - 1 ? ";" : ""); |
|
|
3317 | fprintf (stderr, "%c\n", ch); |
|
|
3318 | #endif |
|
|
3319 | |
|
|
3320 | /* |
3284 | /* |
3321 | * private mode handling |
3285 | * private mode handling |
3322 | */ |
3286 | */ |
3323 | if (priv) |
3287 | if (priv) |
3324 | { |
3288 | { |
3325 | switch (priv) |
3289 | switch (priv) |
3326 | { |
3290 | { |
3327 | case '>': |
3291 | case '>': |
3328 | if (ch == CSI_DA) /* secondary device attributes */ |
3292 | if (ch == CSI_DA) /* secondary device attributes */ |
|
|
3293 | { |
|
|
3294 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
|
|
3295 | // 'U' for rxvt-unicode <= 7.2, and Mm85 (e.g. 7385 for 7.3) for later versions. |
|
|
3296 | // |
|
|
3297 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
|
|
3298 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
|
|
3299 | // that we do not support xterm mouse reporting (should be 95 when we do). |
|
|
3300 | // |
3329 | tt_printf ("\033[>%d;%c%c;0c", 'U', VERSION[0], VERSION[2]); |
3301 | tt_printf ("\033[>%c%c85;94;0c", VERSION[0], VERSION[1]); |
|
|
3302 | } |
3330 | break; |
3303 | break; |
3331 | case '?': |
3304 | case '?': |
3332 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3305 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3333 | process_terminal_mode (ch, priv, nargs, arg); |
3306 | process_terminal_mode (ch, priv, nargs, arg); |
3334 | break; |
3307 | break; |
… | |
… | |
4037 | return state; |
4010 | return state; |
4038 | } |
4011 | } |
4039 | |
4012 | |
4040 | /* we're not using priv _yet_ */ |
4013 | /* we're not using priv _yet_ */ |
4041 | void |
4014 | void |
4042 | rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) |
4015 | rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg) |
4043 | { |
4016 | { |
4044 | unsigned int i, j; |
4017 | unsigned int i, j; |
4045 | int state; |
4018 | int state; |
4046 | |
4019 | |
4047 | static const struct |
4020 | static const struct |