… | |
… | |
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 |
… | |
… | |
1281 | tt_printf ("\033[M%c%c%c", |
1265 | tt_printf ("\033[M%c%c%c", |
1282 | (32 + button_number + key_state), |
1266 | (32 + button_number + key_state), |
1283 | (32 + x + 1), |
1267 | (32 + x + 1), |
1284 | (32 + y + 1)); |
1268 | (32 + y + 1)); |
1285 | } |
1269 | } |
1286 | |
|
|
1287 | #ifdef USING_W11LIB |
|
|
1288 | void |
|
|
1289 | rxvt_W11_process_x_event (XEvent *ev) |
|
|
1290 | { |
|
|
1291 | rxvt_t *r = rxvt_get_r (); |
|
|
1292 | |
|
|
1293 | x_cb (*ev); |
|
|
1294 | } |
|
|
1295 | #endif |
|
|
1296 | |
1270 | |
1297 | /*{{{ process an X event */ |
1271 | /*{{{ process an X event */ |
1298 | void |
1272 | void |
1299 | rxvt_term::x_cb (XEvent &ev) |
1273 | rxvt_term::x_cb (XEvent &ev) |
1300 | { |
1274 | { |
… | |
… | |
1405 | button_release (ev.xbutton); |
1379 | button_release (ev.xbutton); |
1406 | break; |
1380 | break; |
1407 | |
1381 | |
1408 | case ClientMessage: |
1382 | case ClientMessage: |
1409 | if (ev.xclient.format == 32 |
1383 | if (ev.xclient.format == 32 |
1410 | && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
1384 | && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END))) |
1411 | { |
1385 | { |
|
|
1386 | if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
|
|
1387 | { |
|
|
1388 | if (!HOOK_INVOKE ((this, HOOK_WM_PROTOCOLS, DT_XEVENT, &ev, DT_END))) |
|
|
1389 | { |
1412 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
1390 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
|
|
1391 | { |
|
|
1392 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) |
1413 | destroy (); |
1393 | destroy (); |
|
|
1394 | } |
1414 | #if ENABLE_EWMH |
1395 | #if ENABLE_EWMH |
1415 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1396 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1416 | XSendEvent (disp, ev.xclient.window = display->root, |
1397 | XSendEvent (disp, ev.xclient.window = display->root, |
1417 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1398 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1418 | &ev); |
1399 | &ev); |
|
|
1400 | #endif |
|
|
1401 | } |
|
|
1402 | } |
|
|
1403 | #if ENABLE_XEMBED |
|
|
1404 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1405 | { |
|
|
1406 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1407 | focus_in (); |
|
|
1408 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1409 | focus_out (); |
|
|
1410 | } |
1419 | #endif |
1411 | #endif |
1420 | } |
1412 | } |
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; |
1413 | break; |
1457 | |
1414 | |
1458 | case MappingNotify: |
1415 | case MappingNotify: |
1459 | XRefreshKeyboardMapping (&ev.xmapping); |
1416 | XRefreshKeyboardMapping (&ev.xmapping); |
1460 | break; |
1417 | break; |
… | |
… | |
1512 | #endif |
1469 | #endif |
1513 | } |
1470 | } |
1514 | break; |
1471 | break; |
1515 | |
1472 | |
1516 | case PropertyNotify: |
1473 | case PropertyNotify: |
|
|
1474 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1517 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1475 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1518 | && ev.xproperty.state == PropertyNewValue) |
1476 | && ev.xproperty.state == PropertyNewValue) |
1519 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1477 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1520 | |
1478 | |
1521 | break; |
1479 | break; |
1522 | |
1480 | |
1523 | case SelectionClear: |
1481 | case SelectionClear: |
1524 | selection_clear (); |
1482 | selection_clear (); |
… | |
… | |
1713 | { |
1671 | { |
1714 | hidden_cursor = 0; |
1672 | hidden_cursor = 0; |
1715 | want_refresh = 1; |
1673 | want_refresh = 1; |
1716 | } |
1674 | } |
1717 | |
1675 | |
1718 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1676 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1719 | } |
1677 | } |
1720 | #endif |
1678 | #endif |
1721 | |
1679 | |
1722 | #if defined(POINTER_BLANK) |
1680 | #if defined(POINTER_BLANK) |
1723 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
1681 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
… | |
… | |
1751 | XSetICFocus (Input_Context); |
1709 | XSetICFocus (Input_Context); |
1752 | } |
1710 | } |
1753 | #endif |
1711 | #endif |
1754 | #if CURSOR_BLINK |
1712 | #if CURSOR_BLINK |
1755 | if (OPTION (Opt_cursorBlink)) |
1713 | if (OPTION (Opt_cursorBlink)) |
1756 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1714 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1757 | #endif |
1715 | #endif |
1758 | #if OFF_FOCUS_FADING |
1716 | #if OFF_FOCUS_FADING |
1759 | if (rs[Rs_fade]) |
1717 | if (rs[Rs_fade]) |
1760 | { |
1718 | { |
1761 | pix_colors = pix_colors_focused; |
1719 | pix_colors = pix_colors_focused; |
… | |
… | |
1842 | /* |
1800 | /* |
1843 | * VT window processing of button press |
1801 | * VT window processing of button press |
1844 | */ |
1802 | */ |
1845 | if (ev.window == vt) |
1803 | if (ev.window == vt) |
1846 | { |
1804 | { |
|
|
1805 | if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1806 | return; |
|
|
1807 | |
1847 | #if ISO_14755 |
1808 | #if ISO_14755 |
1848 | // 5.4 |
1809 | // 5.4 |
1849 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1810 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1850 | { |
1811 | { |
1851 | iso14755_54 (ev.x, ev.y); |
1812 | iso14755_54 (ev.x, ev.y); |
… | |
… | |
1893 | else |
1854 | else |
1894 | { |
1855 | { |
1895 | if (ev.button != MEvent.button) |
1856 | if (ev.button != MEvent.button) |
1896 | MEvent.clicks = 0; |
1857 | MEvent.clicks = 0; |
1897 | |
1858 | |
1898 | if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1899 | switch (ev.button) |
1859 | switch (ev.button) |
1900 | { |
1860 | { |
1901 | case Button1: |
1861 | case Button1: |
1902 | /* allow meta + click to select rectangular areas */ |
1862 | /* allow meta + click to select rectangular areas */ |
1903 | /* should be done in screen.C */ |
1863 | /* should be done in screen.C */ |
1904 | #if ENABLE_FRILLS |
1864 | #if ENABLE_FRILLS |
1905 | selection.rect = !!(ev.state & ModMetaMask); |
1865 | selection.rect = !!(ev.state & ModMetaMask); |
1906 | #else |
1866 | #else |
1907 | selection.rect = false; |
1867 | selection.rect = false; |
1908 | #endif |
1868 | #endif |
1909 | |
1869 | |
1910 | /* allow shift+left click to extend selection */ |
1870 | /* allow shift+left click to extend selection */ |
1911 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1871 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1912 | { |
1872 | { |
1913 | if (MEvent.button == Button1 && clickintime) |
1873 | if (MEvent.button == Button1 && clickintime) |
1914 | selection_rotate (ev.x, ev.y); |
1874 | selection_rotate (ev.x, ev.y); |
1915 | else |
1875 | else |
1916 | selection_extend (ev.x, ev.y, 1); |
1876 | selection_extend (ev.x, ev.y, 1); |
1917 | } |
1877 | } |
1918 | else |
1878 | else |
1919 | { |
1879 | { |
1920 | if (MEvent.button == Button1 && clickintime) |
1880 | if (MEvent.button == Button1 && clickintime) |
1921 | MEvent.clicks++; |
1881 | MEvent.clicks++; |
1922 | else |
1882 | else |
1923 | MEvent.clicks = 1; |
1883 | MEvent.clicks = 1; |
1924 | |
1884 | |
1925 | selection_click (MEvent.clicks, ev.x, ev.y); |
1885 | selection_click (MEvent.clicks, ev.x, ev.y); |
1926 | } |
1886 | } |
1927 | |
1887 | |
1928 | MEvent.button = Button1; |
1888 | MEvent.button = Button1; |
1929 | break; |
1889 | break; |
1930 | |
1890 | |
1931 | case Button3: |
1891 | case Button3: |
1932 | if (MEvent.button == Button3 && clickintime) |
1892 | if (MEvent.button == Button3 && clickintime) |
1933 | selection_rotate (ev.x, ev.y); |
1893 | selection_rotate (ev.x, ev.y); |
1934 | else |
1894 | else |
1935 | selection_extend (ev.x, ev.y, 1); |
1895 | selection_extend (ev.x, ev.y, 1); |
1936 | |
1896 | |
1937 | MEvent.button = Button3; |
1897 | MEvent.button = Button3; |
1938 | break; |
1898 | break; |
1939 | } |
1899 | } |
1940 | } |
1900 | } |
1941 | |
1901 | |
1942 | MEvent.time = ev.time; |
1902 | MEvent.time = ev.time; |
1943 | return; |
1903 | return; |
1944 | } |
1904 | } |
1945 | |
1905 | |
… | |
… | |
2108 | sel_scroll_ev.stop(); |
2068 | sel_scroll_ev.stop(); |
2109 | #endif |
2069 | #endif |
2110 | |
2070 | |
2111 | if (ev.window == vt) |
2071 | if (ev.window == vt) |
2112 | { |
2072 | { |
|
|
2073 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2074 | return; |
|
|
2075 | |
2113 | #if ISO_14755 |
2076 | #if ISO_14755 |
2114 | // 5.4 |
2077 | // 5.4 |
2115 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2078 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2116 | return; |
2079 | return; |
2117 | #endif |
2080 | #endif |
|
|
2081 | |
2118 | if (reportmode) |
2082 | if (reportmode) |
2119 | { |
2083 | { |
2120 | /* mouse report from vt window */ |
2084 | /* mouse report from vt window */ |
2121 | /* don't report release of wheel "buttons" */ |
2085 | /* don't report release of wheel "buttons" */ |
2122 | if (ev.button >= 4) |
2086 | if (ev.button >= 4) |
… | |
… | |
2146 | if (priv_modes & PrivMode_mouse_report |
2110 | if (priv_modes & PrivMode_mouse_report |
2147 | && bypass_keystate |
2111 | && bypass_keystate |
2148 | && ev.button == Button1 && MEvent.clicks <= 1) |
2112 | && ev.button == Button1 && MEvent.clicks <= 1) |
2149 | selection_extend (ev.x, ev.y, 0); |
2113 | selection_extend (ev.x, ev.y, 0); |
2150 | |
2114 | |
2151 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2152 | return; |
|
|
2153 | |
|
|
2154 | switch (ev.button) |
2115 | switch (ev.button) |
2155 | { |
2116 | { |
2156 | case Button1: |
2117 | case Button1: |
2157 | case Button3: |
2118 | case Button3: |
2158 | selection_make (ev.time); |
2119 | selection_make (ev.time); |
2159 | break; |
2120 | break; |
|
|
2121 | |
2160 | case Button2: |
2122 | case Button2: |
2161 | selection_request (ev.time, ev.x, ev.y); |
2123 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
|
|
2124 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary); |
2162 | break; |
2125 | break; |
|
|
2126 | |
2163 | #ifdef MOUSE_WHEEL |
2127 | #ifdef MOUSE_WHEEL |
2164 | case Button4: |
2128 | case Button4: |
2165 | case Button5: |
2129 | case Button5: |
2166 | { |
2130 | { |
2167 | int i; |
2131 | int i; |
… | |
… | |
2645 | am_transparent = 0; |
2609 | am_transparent = 0; |
2646 | /* XXX: also turn off Opt_transparent? */ |
2610 | /* XXX: also turn off Opt_transparent? */ |
2647 | } |
2611 | } |
2648 | else |
2612 | else |
2649 | { |
2613 | { |
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++) |
2614 | for (n = 0; n < (unsigned int)i; n++) |
2656 | { |
2615 | { |
2657 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2616 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2658 | XClearWindow (disp, parent[n]); |
2617 | XClearWindow (disp, parent[n]); |
2659 | } |
2618 | } |
… | |
… | |
2822 | return flag; |
2781 | return flag; |
2823 | } |
2782 | } |
2824 | |
2783 | |
2825 | // read the next character |
2784 | // read the next character |
2826 | wchar_t |
2785 | wchar_t |
2827 | rxvt_term::next_char () |
2786 | rxvt_term::next_char () NOTHROW |
2828 | { |
2787 | { |
2829 | while (cmdbuf_ptr < cmdbuf_endp) |
2788 | while (cmdbuf_ptr < cmdbuf_endp) |
2830 | { |
2789 | { |
2831 | // assume 7-bit to be ascii ALWAYS |
2790 | // assume 7-bit to be ascii ALWAYS |
2832 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2791 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
… | |
… | |
2853 | return NOCHAR; |
2812 | return NOCHAR; |
2854 | } |
2813 | } |
2855 | |
2814 | |
2856 | // read the next octet |
2815 | // read the next octet |
2857 | uint32_t |
2816 | uint32_t |
2858 | rxvt_term::next_octet () |
2817 | rxvt_term::next_octet () NOTHROW |
2859 | { |
2818 | { |
2860 | return cmdbuf_ptr < cmdbuf_endp |
2819 | return cmdbuf_ptr < cmdbuf_endp |
2861 | ? (unsigned char)*cmdbuf_ptr++ |
2820 | ? (unsigned char)*cmdbuf_ptr++ |
2862 | : NOCHAR; |
2821 | : NOCHAR; |
2863 | } |
2822 | } |
|
|
2823 | |
|
|
2824 | static class out_of_input out_of_input; |
2864 | |
2825 | |
2865 | /* rxvt_cmd_getc () - Return next input character */ |
2826 | /* rxvt_cmd_getc () - Return next input character */ |
2866 | /* |
2827 | /* |
2867 | * Return the next input character after first passing any keyboard input |
2828 | * Return the next input character after first passing any keyboard input |
2868 | * to the command. |
2829 | * to the command. |
2869 | */ |
2830 | */ |
2870 | wchar_t |
2831 | wchar_t |
2871 | rxvt_term::cmd_getc () |
2832 | rxvt_term::cmd_getc () THROW ((class out_of_input)) |
2872 | { |
2833 | { |
2873 | wchar_t c = next_char (); |
2834 | wchar_t c = next_char (); |
2874 | |
2835 | |
2875 | if (c == NOCHAR) |
2836 | if (c == NOCHAR) |
2876 | throw out_of_input; |
2837 | throw out_of_input; |
2877 | |
2838 | |
2878 | return c; |
2839 | return c; |
2879 | } |
2840 | } |
2880 | |
2841 | |
2881 | uint32_t |
2842 | uint32_t |
2882 | rxvt_term::cmd_get8 () |
2843 | rxvt_term::cmd_get8 () THROW ((class out_of_input)) |
2883 | { |
2844 | { |
2884 | uint32_t c = next_octet (); |
2845 | uint32_t c = next_octet (); |
2885 | |
2846 | |
2886 | if (c == NOCHAR) |
2847 | if (c == NOCHAR) |
2887 | throw out_of_input; |
2848 | throw out_of_input; |
… | |
… | |
3308 | ndef = get_byte_array_bit (csi_defaults, i); |
3269 | ndef = get_byte_array_bit (csi_defaults, i); |
3309 | for (p = 0; p < nargs; p++) |
3270 | for (p = 0; p < nargs; p++) |
3310 | if (arg[p] == -1) |
3271 | if (arg[p] == -1) |
3311 | arg[p] = ndef; |
3272 | arg[p] = ndef; |
3312 | |
3273 | |
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 | /* |
3274 | /* |
3321 | * private mode handling |
3275 | * private mode handling |
3322 | */ |
3276 | */ |
3323 | if (priv) |
3277 | if (priv) |
3324 | { |
3278 | { |
3325 | switch (priv) |
3279 | switch (priv) |
3326 | { |
3280 | { |
3327 | case '>': |
3281 | case '>': |
3328 | if (ch == CSI_DA) /* secondary device attributes */ |
3282 | if (ch == CSI_DA) /* secondary device attributes */ |
|
|
3283 | { |
|
|
3284 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
|
|
3285 | // 'U' for rxvt-unicode <= 7.2, and Mm85 (e.g. 7385 for 7.3) for later versions. |
|
|
3286 | // |
|
|
3287 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
|
|
3288 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
|
|
3289 | // that we do not support xterm mouse reporting (should be 95 when we do). |
|
|
3290 | // |
3329 | tt_printf ("\033[>%d;%c%c;0c", 'U', VERSION[0], VERSION[2]); |
3291 | tt_printf ("\033[>%c%c85;94;0c", VERSION[0], VERSION[1]); |
|
|
3292 | } |
3330 | break; |
3293 | break; |
3331 | case '?': |
3294 | case '?': |
3332 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3295 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3333 | process_terminal_mode (ch, priv, nargs, arg); |
3296 | process_terminal_mode (ch, priv, nargs, arg); |
3334 | break; |
3297 | break; |
… | |
… | |
4037 | return state; |
4000 | return state; |
4038 | } |
4001 | } |
4039 | |
4002 | |
4040 | /* we're not using priv _yet_ */ |
4003 | /* we're not using priv _yet_ */ |
4041 | void |
4004 | void |
4042 | rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) |
4005 | rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg) |
4043 | { |
4006 | { |
4044 | unsigned int i, j; |
4007 | unsigned int i, j; |
4045 | int state; |
4008 | int state; |
4046 | |
4009 | |
4047 | static const struct |
4010 | static const struct |