… | |
… | |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
6 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
7 | * - original version |
7 | * - original version |
8 | * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> |
8 | * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> |
9 | * - extensive modifications |
9 | * - extensive modifications |
10 | * Copyright (c) 1995 Garrett D'Amore <garrett@netcom.com> |
10 | * Copyright (c) 1995 Garrett D'Amore <garrett@netcom.com> |
11 | * - vt100 printing |
11 | * - vt100 printing |
12 | * Copyright (c) 1995 Steven Hirsch <hirsch@emba.uvm.edu> |
12 | * Copyright (c) 1995 Steven Hirsch <hirsch@emba.uvm.edu> |
13 | * - X11 mouse report mode and support for |
13 | * - X11 mouse report mode and support for |
14 | * DEC "private mode" save/restore functions. |
14 | * DEC "private mode" save/restore functions. |
… | |
… | |
20 | * Copyright (c) 1997 Raul Garcia Garcia <rgg@tid.es> |
20 | * Copyright (c) 1997 Raul Garcia Garcia <rgg@tid.es> |
21 | * - modification and cleanups for Solaris 2.x |
21 | * - modification and cleanups for Solaris 2.x |
22 | * and Linux 1.2.x |
22 | * and Linux 1.2.x |
23 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
23 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
24 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
24 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
25 | * - extensive modifications |
25 | * - extensive modifications |
26 | * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> |
26 | * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> |
27 | * Copyright (c) 2001 Marius Gedminas |
27 | * Copyright (c) 2001 Marius Gedminas |
28 | * - Ctrl/Mod4+Tab works like Meta+Tab (options) |
28 | * - Ctrl/Mod4+Tab works like Meta+Tab (options) |
29 | * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> |
29 | * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> |
30 | * Copyright (c) 2003-2011 Marc Lehmann <schmorp@schmorp.de> |
30 | * Copyright (c) 2003-2014 Marc Lehmann <schmorp@schmorp.de> |
31 | * Copyright (c) 2007 Emanuele Giaquinta <e.giaquinta@glauco.it> |
31 | * Copyright (c) 2007 Emanuele Giaquinta <e.giaquinta@glauco.it> |
32 | * |
32 | * |
33 | * This program is free software; you can redistribute it and/or modify |
33 | * This program is free software; you can redistribute it and/or modify |
34 | * it under the terms of the GNU General Public License as published by |
34 | * it under the terms of the GNU General Public License as published by |
35 | * the Free Software Foundation; either version 2 of the License, or |
35 | * the Free Software Foundation; either version 2 of the License, or |
… | |
… | |
400 | break; |
400 | break; |
401 | } |
401 | } |
402 | return param; |
402 | return param; |
403 | } |
403 | } |
404 | |
404 | |
|
|
405 | static inline wchar_t * |
|
|
406 | rxvt_wcsdup (const wchar_t *str, int len) |
|
|
407 | { |
|
|
408 | wchar_t *r = (wchar_t *)rxvt_malloc ((len + 1) * sizeof (wchar_t)); |
|
|
409 | memcpy (r, str, len * sizeof (wchar_t)); |
|
|
410 | r[len] = 0; |
|
|
411 | return r; |
|
|
412 | } |
|
|
413 | |
405 | void ecb_cold |
414 | void ecb_cold |
406 | rxvt_term::key_press (XKeyEvent &ev) |
415 | rxvt_term::key_press (XKeyEvent &ev) |
407 | { |
416 | { |
408 | int ctrl, meta, shft, len; |
417 | int ctrl, meta, shft, len; |
409 | KeySym keysym; |
418 | KeySym keysym; |
… | |
… | |
510 | #endif |
519 | #endif |
511 | max_it (lnsppg, 1); |
520 | max_it (lnsppg, 1); |
512 | |
521 | |
513 | if (keysym == XK_Prior) |
522 | if (keysym == XK_Prior) |
514 | { |
523 | { |
515 | scr_page (UP, lnsppg); |
524 | scr_page (lnsppg); |
516 | return; |
525 | return; |
517 | } |
526 | } |
518 | else if (keysym == XK_Next) |
527 | else if (keysym == XK_Next) |
519 | { |
528 | { |
520 | scr_page (DN, lnsppg); |
529 | scr_page (-lnsppg); |
521 | return; |
530 | return; |
522 | } |
531 | } |
523 | } |
532 | } |
524 | #ifdef SCROLL_ON_UPDOWN_KEYS |
533 | #ifdef SCROLL_ON_UPDOWN_KEYS |
525 | if (IS_SCROLL_MOD) |
534 | if (IS_SCROLL_MOD) |
526 | { |
535 | { |
527 | if (keysym == XK_Up) |
536 | if (keysym == XK_Up) |
528 | { |
537 | { |
529 | scr_page (UP, 1); |
538 | scr_page (1); |
530 | return; |
539 | return; |
531 | } |
540 | } |
532 | else if (keysym == XK_Down) |
541 | else if (keysym == XK_Down) |
533 | { |
542 | { |
534 | scr_page (DN, 1); |
543 | scr_page (-1); |
535 | return; |
544 | return; |
536 | } |
545 | } |
537 | } |
546 | } |
538 | #endif |
547 | #endif |
539 | #ifdef SCROLL_ON_HOMEEND_KEYS |
548 | #ifdef SCROLL_ON_HOMEEND_KEYS |
540 | if (IS_SCROLL_MOD) |
549 | if (IS_SCROLL_MOD) |
541 | { |
550 | { |
542 | if (keysym == XK_Home) |
551 | if (keysym == XK_Home) |
543 | { |
552 | { |
544 | scr_move_to (0, 1); |
553 | scr_changeview (top_row); |
545 | return; |
554 | return; |
546 | } |
555 | } |
547 | else if (keysym == XK_End) |
556 | else if (keysym == XK_End) |
548 | { |
557 | { |
549 | scr_move_to (1, 1); |
558 | scr_changeview (0); |
550 | return; |
559 | return; |
551 | } |
560 | } |
552 | } |
561 | } |
553 | #endif |
562 | #endif |
554 | } |
563 | } |
… | |
… | |
576 | case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */ |
585 | case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */ |
577 | return; |
586 | return; |
578 | #endif |
587 | #endif |
579 | } |
588 | } |
580 | } |
589 | } |
|
|
590 | } |
|
|
591 | |
|
|
592 | if (ctrl && meta && (keysym == XK_c || keysym == XK_v)) |
|
|
593 | { |
|
|
594 | if (keysym == XK_v) |
|
|
595 | selection_request (ev.time, Sel_Clipboard); |
|
|
596 | else if (selection.len > 0) |
|
|
597 | { |
|
|
598 | free (selection.clip_text); |
|
|
599 | selection.clip_text = rxvt_wcsdup (selection.text, selection.len); |
|
|
600 | selection.clip_len = selection.len; |
|
|
601 | selection_grab (CurrentTime, true); |
|
|
602 | } |
|
|
603 | |
|
|
604 | return; |
581 | } |
605 | } |
582 | |
606 | |
583 | #if ENABLE_FRILLS || ISO_14755 |
607 | #if ENABLE_FRILLS || ISO_14755 |
584 | // ISO 14755 support |
608 | // ISO 14755 support |
585 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_51)) |
609 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_51)) |
… | |
… | |
941 | void |
965 | void |
942 | rxvt_term::flush () |
966 | rxvt_term::flush () |
943 | { |
967 | { |
944 | flush_ev.stop (); |
968 | flush_ev.stop (); |
945 | |
969 | |
946 | #ifdef HAVE_BG_PIXMAP |
970 | #ifdef HAVE_IMG |
947 | if (bg_flags & BG_NEEDS_REFRESH) |
971 | if (bg_flags & BG_NEEDS_REFRESH) |
948 | { |
972 | { |
949 | bg_flags &= ~BG_NEEDS_REFRESH; |
973 | bg_flags &= ~BG_NEEDS_REFRESH; |
950 | scr_touch (false); |
974 | scr_touch (false); |
951 | } |
975 | } |
… | |
… | |
1077 | |
1101 | |
1078 | #ifdef SELECTION_SCROLLING |
1102 | #ifdef SELECTION_SCROLLING |
1079 | void |
1103 | void |
1080 | rxvt_term::sel_scroll_cb (ev::timer &w, int revents) |
1104 | rxvt_term::sel_scroll_cb (ev::timer &w, int revents) |
1081 | { |
1105 | { |
1082 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1106 | if (scr_page (scroll_selection_lines)) |
1083 | { |
1107 | { |
1084 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1108 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1085 | want_refresh = 1; |
1109 | want_refresh = 1; |
1086 | refresh_check (); |
1110 | refresh_check (); |
1087 | } |
1111 | } |
… | |
… | |
1092 | |
1116 | |
1093 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1117 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1094 | void |
1118 | void |
1095 | rxvt_term::slip_wheel_cb (ev::timer &w, int revents) |
1119 | rxvt_term::slip_wheel_cb (ev::timer &w, int revents) |
1096 | { |
1120 | { |
1097 | if (scr_changeview (view_start - mouse_slip_wheel_speed)) |
1121 | if (scr_page (mouse_slip_wheel_speed)) |
1098 | { |
1122 | { |
1099 | want_refresh = 1; |
1123 | want_refresh = 1; |
1100 | refresh_check (); |
1124 | refresh_check (); |
1101 | } |
1125 | } |
1102 | |
1126 | |
… | |
… | |
1467 | while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) |
1491 | while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) |
1468 | ; |
1492 | ; |
1469 | |
1493 | |
1470 | bool want_position_change = SHOULD_INVOKE (HOOK_POSITION_CHANGE); |
1494 | bool want_position_change = SHOULD_INVOKE (HOOK_POSITION_CHANGE); |
1471 | |
1495 | |
|
|
1496 | bool moved = false; |
1472 | #ifdef HAVE_BG_PIXMAP |
1497 | #ifdef HAVE_BG_PIXMAP |
1473 | if (bg_window_position_sensitive ()) |
1498 | if (bg_window_position_sensitive ()) |
|
|
1499 | { |
1474 | want_position_change = true; |
1500 | want_position_change = true; |
|
|
1501 | if (bg_img == 0) |
|
|
1502 | moved = true; |
|
|
1503 | } |
1475 | #endif |
1504 | #endif |
1476 | |
|
|
1477 | bool moved = false; |
|
|
1478 | |
1505 | |
1479 | if (want_position_change) |
1506 | if (want_position_change) |
1480 | { |
1507 | { |
1481 | int x, y; |
1508 | int x, y; |
1482 | |
1509 | |
… | |
… | |
1491 | if (x != parent_x || y != parent_y) |
1518 | if (x != parent_x || y != parent_y) |
1492 | { |
1519 | { |
1493 | parent_x = x; |
1520 | parent_x = x; |
1494 | parent_y = y; |
1521 | parent_y = y; |
1495 | HOOK_INVOKE ((this, HOOK_POSITION_CHANGE, DT_INT, x, DT_INT, y, DT_END)); |
1522 | HOOK_INVOKE ((this, HOOK_POSITION_CHANGE, DT_INT, x, DT_INT, y, DT_END)); |
|
|
1523 | moved = true; |
1496 | } |
1524 | } |
1497 | |
|
|
1498 | if (bg_set_position (x, y) |
|
|
1499 | || !(bg_flags & BG_IS_VALID)) |
|
|
1500 | moved = true; |
|
|
1501 | } |
1525 | } |
1502 | |
1526 | |
1503 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1527 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1504 | { |
1528 | { |
1505 | seen_resize = 1; |
1529 | seen_resize = 1; |
… | |
… | |
1529 | selection_send (ev.xselectionrequest); |
1553 | selection_send (ev.xselectionrequest); |
1530 | break; |
1554 | break; |
1531 | |
1555 | |
1532 | case MapNotify: |
1556 | case MapNotify: |
1533 | #ifdef HAVE_BG_PIXMAP |
1557 | #ifdef HAVE_BG_PIXMAP |
1534 | /* This is needed specifically to fix the case of no window manager or a |
1558 | // This is needed at startup for the case of no window manager |
1535 | * non-reparenting window manager. In those cases we never get first |
1559 | // or a non-reparenting window manager and also because we |
1536 | * ConfigureNotify. Also that speeds startup under normal WM, by taking |
1560 | // defer bg image updates if the window is not mapped. The |
1537 | * care of multiplicity of ConfigureNotify events arriving while WM does |
1561 | // short delay is to optimize for multiple ConfigureNotify |
1538 | * reparenting. |
1562 | // events at startup when the window manager reparents the |
1539 | * We should not render background immediately, as there could be several |
1563 | // window, so as to perform the computation after we have |
1540 | * ConfigureNotify's to follow. Lets take care of all of them in one scoop |
1564 | // received all of them. |
1541 | * by scheduling background redraw as soon as we can, but giving a short |
1565 | if (bg_img == 0) |
1542 | * bit of time for ConfigureNotifies to arrive. |
|
|
1543 | * We should render background PRIOR to drawing any text, but AFTER all |
|
|
1544 | * of ConfigureNotifys for the best results. |
|
|
1545 | */ |
|
|
1546 | if (!(bg_flags & BG_IS_VALID)) |
|
|
1547 | update_background_ev.start (0.025); |
1566 | update_background_ev.start (0.025); |
1548 | #endif |
1567 | #endif |
1549 | mapped = 1; |
1568 | mapped = 1; |
1550 | #ifdef TEXT_BLINK |
1569 | #ifdef TEXT_BLINK |
1551 | text_blink_ev.start (); |
1570 | text_blink_ev.start (); |
… | |
… | |
1643 | |
1662 | |
1644 | #ifdef SELECTION_SCROLLING |
1663 | #ifdef SELECTION_SCROLLING |
1645 | if (ev.xbutton.y < int_bwidth |
1664 | if (ev.xbutton.y < int_bwidth |
1646 | || Pixel2Row (ev.xbutton.y) > (nrow-1)) |
1665 | || Pixel2Row (ev.xbutton.y) > (nrow-1)) |
1647 | { |
1666 | { |
|
|
1667 | page_dirn scroll_selection_dir; |
1648 | int dist; |
1668 | int dist; |
1649 | |
1669 | |
1650 | /* don't clobber the current delay if we are |
1670 | /* don't clobber the current delay if we are |
1651 | * already in the middle of scrolling. |
1671 | * already in the middle of scrolling. |
1652 | */ |
1672 | */ |
… | |
… | |
1675 | scroll_selection_lines = Pixel2Height (dist) |
1695 | scroll_selection_lines = Pixel2Height (dist) |
1676 | / SELECTION_SCROLL_LINE_SPEEDUP |
1696 | / SELECTION_SCROLL_LINE_SPEEDUP |
1677 | + 1; |
1697 | + 1; |
1678 | min_it (scroll_selection_lines, |
1698 | min_it (scroll_selection_lines, |
1679 | SELECTION_SCROLL_MAX_LINES); |
1699 | SELECTION_SCROLL_MAX_LINES); |
|
|
1700 | scroll_selection_lines *= scroll_selection_dir; |
1680 | } |
1701 | } |
1681 | else |
1702 | else |
1682 | { |
1703 | { |
1683 | /* we are within the text window, so we |
1704 | /* we are within the text window, so we |
1684 | * shouldn't be scrolling |
1705 | * shouldn't be scrolling |
… | |
… | |
1838 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
1859 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
1839 | } |
1860 | } |
1840 | #endif |
1861 | #endif |
1841 | } |
1862 | } |
1842 | |
1863 | |
1843 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1864 | #if BG_IMAGE_FROM_ROOT || ENABLE_PERL |
1844 | void ecb_hot |
1865 | void ecb_hot |
1845 | rxvt_term::rootwin_cb (XEvent &ev) |
1866 | rxvt_term::rootwin_cb (XEvent &ev) |
1846 | { |
1867 | { |
1847 | make_current (); |
1868 | make_current (); |
1848 | |
1869 | |
… | |
… | |
1858 | * use the property to determine the pixmap. We use it later on. |
1879 | * use the property to determine the pixmap. We use it later on. |
1859 | */ |
1880 | */ |
1860 | if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] |
1881 | if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] |
1861 | || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) |
1882 | || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) |
1862 | { |
1883 | { |
1863 | # if ENABLE_TRANSPARENCY |
1884 | #if BG_IMAGE_FROM_ROOT |
1864 | bg_set_root_pixmap (); |
1885 | if (option (Opt_transparent)) |
|
|
1886 | { |
|
|
1887 | rxvt_img::new_from_root (this)->replace (root_img); |
1865 | update_background (); |
1888 | update_background (); |
|
|
1889 | } |
1866 | #endif |
1890 | #endif |
1867 | #if ENABLE_PERL |
|
|
1868 | HOOK_INVOKE ((this, HOOK_ROOTPMAP_CHANGE, DT_END)); |
1891 | HOOK_INVOKE ((this, HOOK_ROOTPMAP_CHANGE, DT_END)); |
1869 | #endif |
|
|
1870 | } |
1892 | } |
1871 | |
1893 | |
1872 | break; |
1894 | break; |
1873 | } |
1895 | } |
1874 | |
1896 | |
… | |
… | |
2199 | |
2221 | |
2200 | #ifdef MOUSE_WHEEL |
2222 | #ifdef MOUSE_WHEEL |
2201 | case Button4: |
2223 | case Button4: |
2202 | case Button5: |
2224 | case Button5: |
2203 | { |
2225 | { |
2204 | int i; |
2226 | int lines; |
2205 | page_dirn v; |
2227 | page_dirn dirn; |
2206 | |
2228 | |
2207 | v = ev.button == Button4 ? UP : DN; |
2229 | dirn = ev.button == Button4 ? UP : DN; |
2208 | |
2230 | |
2209 | if (ev.state & ShiftMask) |
2231 | if (ev.state & ShiftMask) |
2210 | i = 1; |
2232 | lines = 1; |
2211 | else if (option (Opt_mouseWheelScrollPage)) |
2233 | else if (option (Opt_mouseWheelScrollPage)) |
2212 | i = nrow - 1; |
2234 | lines = nrow - 1; |
2213 | else |
2235 | else |
2214 | i = 5; |
2236 | lines = 5; |
2215 | |
2237 | |
2216 | # ifdef MOUSE_SLIP_WHEELING |
2238 | # ifdef MOUSE_SLIP_WHEELING |
2217 | if (ev.state & ControlMask) |
2239 | if (ev.state & ControlMask) |
2218 | { |
2240 | { |
2219 | mouse_slip_wheel_speed += v ? -1 : 1; |
2241 | mouse_slip_wheel_speed += dirn; |
2220 | if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; |
2242 | clamp_it (mouse_slip_wheel_speed, -nrow, nrow); |
2221 | if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; |
|
|
2222 | |
2243 | |
2223 | if (!slip_wheel_ev.is_active ()) |
2244 | if (!slip_wheel_ev.is_active ()) |
2224 | slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
2245 | slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
2225 | } |
2246 | } |
2226 | else |
2247 | else |
2227 | # endif |
2248 | # endif |
2228 | { |
2249 | { |
2229 | scr_page (v, i); |
2250 | scr_page (dirn, lines); |
2230 | scrollBar.show (1); |
2251 | scrollBar.show (1); |
2231 | } |
2252 | } |
2232 | } |
2253 | } |
2233 | break; |
2254 | break; |
2234 | #endif |
2255 | #endif |
… | |
… | |
2387 | } |
2408 | } |
2388 | |
2409 | |
2389 | if (len == (size_t)-1) |
2410 | if (len == (size_t)-1) |
2390 | { |
2411 | { |
2391 | mbstate.reset (); // reset now undefined conversion state |
2412 | mbstate.reset (); // reset now undefined conversion state |
|
|
2413 | // a -1 might indicate that a previous incomplete char is invalid (previous return -2) |
|
|
2414 | // in which case we "erroneously" return the next byte which might be valid. |
2392 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2415 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2393 | } |
2416 | } |
2394 | |
2417 | |
2395 | // assume wchar == unicode |
2418 | // assume wchar == unicode |
2396 | cmdbuf_ptr += len; |
2419 | cmdbuf_ptr += len; |
… | |
… | |
2801 | }; |
2824 | }; |
2802 | |
2825 | |
2803 | void ecb_hot |
2826 | void ecb_hot |
2804 | rxvt_term::process_csi_seq () |
2827 | rxvt_term::process_csi_seq () |
2805 | { |
2828 | { |
2806 | unicode_t ch, priv, i; |
2829 | unicode_t ch, priv, prev_ch, i; |
2807 | unsigned int nargs, p; |
2830 | unsigned int nargs, p; |
2808 | int n, ndef; |
2831 | int n, ndef; |
2809 | int arg[ESC_ARGS] = { }; |
2832 | int arg[ESC_ARGS] = { }; |
2810 | |
2833 | |
2811 | nargs = 0; |
2834 | nargs = 0; |
… | |
… | |
2817 | /* '<' '=' '>' '?' '!' */ |
2840 | /* '<' '=' '>' '?' '!' */ |
2818 | priv = ch; |
2841 | priv = ch; |
2819 | ch = cmd_getc (); |
2842 | ch = cmd_getc (); |
2820 | } |
2843 | } |
2821 | |
2844 | |
|
|
2845 | prev_ch = 0; |
2822 | /* read any numerical arguments */ |
2846 | /* read any numerical arguments */ |
2823 | for (n = -1; ch < CSI_ICH; ) |
2847 | for (n = -1; ch < CSI_ICH; ) |
2824 | { |
2848 | { |
2825 | if (isdigit (ch)) |
2849 | if (isdigit (ch)) |
2826 | { |
2850 | { |
… | |
… | |
2836 | n = -1; |
2860 | n = -1; |
2837 | } |
2861 | } |
2838 | else if (IS_CONTROL (ch)) |
2862 | else if (IS_CONTROL (ch)) |
2839 | process_nonprinting (ch); |
2863 | process_nonprinting (ch); |
2840 | |
2864 | |
|
|
2865 | prev_ch = ch; |
2841 | ch = cmd_getc (); |
2866 | ch = cmd_getc (); |
2842 | } |
2867 | } |
2843 | |
2868 | |
2844 | if (ch > CSI_7F) |
2869 | if (ch > CSI_7F) |
2845 | return; |
2870 | return; |
… | |
… | |
3079 | scr_insert_mode (1); |
3104 | scr_insert_mode (1); |
3080 | else if (arg[0] == 20) |
3105 | else if (arg[0] == 20) |
3081 | priv_modes |= PrivMode_LFNL; |
3106 | priv_modes |= PrivMode_LFNL; |
3082 | break; |
3107 | break; |
3083 | |
3108 | |
|
|
3109 | case CSI_71: // DESCUSR: set cursor style |
|
|
3110 | if (prev_ch == ' ') |
|
|
3111 | set_cursor_style (arg[0]); |
|
|
3112 | break; |
|
|
3113 | |
3084 | /* |
3114 | /* |
3085 | * PRIVATE USE beyond this point. All CSI_7? sequences here |
3115 | * PRIVATE USE beyond this point. All CSI_7? sequences here |
3086 | */ |
3116 | */ |
3087 | case CSI_72: /* DECSTBM: set top and bottom margins */ |
3117 | case CSI_72: /* DECSTBM: set top and bottom margins */ |
3088 | if (nargs == 1) |
3118 | if (nargs == 1) |
… | |
… | |
3221 | rxvt_term::get_to_st (unicode_t &ends_how) |
3251 | rxvt_term::get_to_st (unicode_t &ends_how) |
3222 | { |
3252 | { |
3223 | unicode_t ch; |
3253 | unicode_t ch; |
3224 | bool seen_esc = false; |
3254 | bool seen_esc = false; |
3225 | unsigned int n = 0; |
3255 | unsigned int n = 0; |
3226 | wchar_t string[STRING_MAX]; |
3256 | wchar_t string[CBUFSIZ]; |
3227 | |
3257 | |
3228 | while ((ch = cmd_getc ()) != NOCHAR) |
3258 | while ((ch = cmd_getc ()) != NOCHAR) |
3229 | { |
3259 | { |
3230 | if (seen_esc) |
3260 | if (seen_esc) |
3231 | { |
3261 | { |
… | |
… | |
3246 | else if (ch < 0x20) |
3276 | else if (ch < 0x20) |
3247 | return NULL; /* other control character - exit */ |
3277 | return NULL; /* other control character - exit */ |
3248 | |
3278 | |
3249 | seen_esc = false; |
3279 | seen_esc = false; |
3250 | |
3280 | |
3251 | if (n >= STRING_MAX - 1) |
3281 | if (n >= sizeof (string) - 1) |
3252 | // stop at some sane length |
3282 | // stop at some sane length |
3253 | return NULL; |
3283 | return NULL; |
3254 | |
3284 | |
3255 | string[n++] = ch; |
3285 | string[n++] = ch; |
3256 | } |
3286 | } |
… | |
… | |
3373 | &nitems, &bytes_after, &value) == Success |
3403 | &nitems, &bytes_after, &value) == Success |
3374 | && actual_type != None |
3404 | && actual_type != None |
3375 | && actual_format == 8) |
3405 | && actual_format == 8) |
3376 | str = (const char *)(value); |
3406 | str = (const char *)(value); |
3377 | |
3407 | |
3378 | tt_printf ("\033]%d;%s%c", op, str, resp); |
3408 | tt_printf ("\033]%d;%s%c", op, option (Opt_insecure) ? str : "", resp); |
3379 | |
3409 | |
3380 | XFree (value); |
3410 | XFree (value); |
3381 | } |
3411 | } |
3382 | else |
3412 | else |
3383 | { |
3413 | { |
… | |
… | |
3451 | break; |
3481 | break; |
3452 | #endif |
3482 | #endif |
3453 | case URxvt_Color_border: |
3483 | case URxvt_Color_border: |
3454 | process_color_seq (op, Color_border, str, resp); |
3484 | process_color_seq (op, Color_border, str, resp); |
3455 | break; |
3485 | break; |
3456 | #if ENABLE_TRANSPARENCY |
3486 | |
|
|
3487 | #if BG_IMAGE_FROM_ROOT |
3457 | case URxvt_Color_tint: |
3488 | case URxvt_Color_tint: |
3458 | process_color_seq (op, Color_tint, str, resp); |
3489 | process_color_seq (op, Color_tint, str, resp); |
3459 | { |
3490 | { |
3460 | bool changed = false; |
3491 | bool changed = false; |
3461 | |
3492 | |
… | |
… | |
3488 | { |
3519 | { |
3489 | bool changed = false; |
3520 | bool changed = false; |
3490 | |
3521 | |
3491 | if (*str != ';') |
3522 | if (*str != ';') |
3492 | { |
3523 | { |
|
|
3524 | try |
|
|
3525 | { |
3493 | if (fimage.set_file_geometry (str)) |
3526 | fimage.set_file_geometry (this, str); |
3494 | changed = true; |
3527 | changed = true; |
|
|
3528 | } |
|
|
3529 | catch (const class rxvt_failure_exception &e) |
|
|
3530 | { |
|
|
3531 | } |
3495 | } |
3532 | } |
3496 | else |
3533 | else |
3497 | { |
3534 | { |
3498 | str++; |
3535 | str++; |
3499 | if (fimage.set_geometry (str, true)) |
3536 | if (fimage.set_geometry (str, true)) |
… | |
… | |
3504 | { |
3541 | { |
3505 | if (bg_window_position_sensitive ()) |
3542 | if (bg_window_position_sensitive ()) |
3506 | { |
3543 | { |
3507 | int x, y; |
3544 | int x, y; |
3508 | get_window_origin (x, y); |
3545 | get_window_origin (x, y); |
3509 | bg_set_position (x, y); |
3546 | parent_x = x; |
|
|
3547 | parent_y = y; |
3510 | } |
3548 | } |
3511 | update_background (); |
3549 | update_background (); |
3512 | } |
3550 | } |
3513 | } |
3551 | } |
3514 | break; |
3552 | break; |
… | |
… | |
3985 | break; |
4023 | break; |
3986 | #endif |
4024 | #endif |
3987 | } |
4025 | } |
3988 | } |
4026 | } |
3989 | } |
4027 | } |
|
|
4028 | |
|
|
4029 | void |
|
|
4030 | rxvt_term::set_cursor_style (int style) |
|
|
4031 | { |
|
|
4032 | if (!IN_RANGE_INC (style, 0, 4)) |
|
|
4033 | return; |
|
|
4034 | |
|
|
4035 | set_option (Opt_cursorUnderline, style >= 3); |
|
|
4036 | |
|
|
4037 | #ifdef CURSOR_BLINK |
|
|
4038 | set_option (Opt_cursorBlink, !style || (style & 1)); |
|
|
4039 | cursor_blink_reset (); |
|
|
4040 | #endif |
|
|
4041 | |
|
|
4042 | want_refresh = 1; |
|
|
4043 | } |
3990 | /*}}} */ |
4044 | /*}}} */ |
3991 | |
4045 | |
3992 | /* ------------------------------------------------------------------------- */ |
4046 | /* ------------------------------------------------------------------------- */ |
3993 | |
4047 | |
3994 | /* |
4048 | /* |