… | |
… | |
43 | * along with this program; if not, write to the Free Software |
43 | * along with this program; if not, write to the Free Software |
44 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
44 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
45 | *----------------------------------------------------------------------*/ |
45 | *----------------------------------------------------------------------*/ |
46 | |
46 | |
47 | /*{{{ includes: */ |
47 | /*{{{ includes: */ |
48 | #include "../config.h" /* NECESSARY */ |
48 | #include "../config.h" |
49 | #include "rxvt.h" /* NECESSARY */ |
49 | #include "rxvt.h" |
|
|
50 | #include "rxvtperl.h" |
50 | #include "version.h" |
51 | #include "version.h" |
51 | #include "command.h" |
52 | #include "command.h" |
|
|
53 | |
|
|
54 | #if HAVE_SCHED_YIELD |
|
|
55 | #undef HAVE_SCHED_YIELD // disabled for the time being |
|
|
56 | //# include <sched.h> |
|
|
57 | #endif |
52 | |
58 | |
53 | #ifdef KEYSYM_RESOURCE |
59 | #ifdef KEYSYM_RESOURCE |
54 | # include "keyboard.h" |
60 | # include "keyboard.h" |
55 | #endif |
61 | #endif |
56 | |
62 | |
… | |
… | |
155 | } |
161 | } |
156 | |
162 | |
157 | x--; |
163 | x--; |
158 | } |
164 | } |
159 | } |
165 | } |
160 | #endif |
|
|
161 | |
166 | |
162 | void |
167 | void |
163 | rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y) |
168 | rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y) |
164 | { |
169 | { |
165 | #if ENABLE_OVERLAY |
|
|
166 | rxvt_fontset *fs = FONTSET (r); |
170 | rxvt_fontset *fs = FONTSET (r); |
167 | rxvt_font *f = (*fs)[fs->find_font (ch)]; |
171 | rxvt_font *f = (*fs)[fs->find_font (ch)]; |
168 | wchar_t *chr, *alloc, ch2, *fname; |
172 | wchar_t *chr, *alloc, ch2, *fname; |
169 | int len; |
173 | int len; |
170 | |
174 | |
… | |
… | |
189 | |
193 | |
190 | char attr[80]; // plenty |
194 | char attr[80]; // plenty |
191 | |
195 | |
192 | sprintf (attr, "%08x = fg %d bg %d%s%s%s%s%s%s", |
196 | sprintf (attr, "%08x = fg %d bg %d%s%s%s%s%s%s", |
193 | (int)r, |
197 | (int)r, |
194 | GET_FGCOLOR (r), GET_BGCOLOR (r), |
198 | fgcolor_of (r), bgcolor_of (r), |
195 | r & RS_Bold ? " bold" : "", |
199 | r & RS_Bold ? " bold" : "", |
196 | r & RS_Italic ? " italic" : "", |
200 | r & RS_Italic ? " italic" : "", |
197 | r & RS_Blink ? " blink" : "", |
201 | r & RS_Blink ? " blink" : "", |
198 | r & RS_RVid ? " rvid" : "", |
202 | r & RS_RVid ? " rvid" : "", |
199 | r & RS_Uline ? " uline" : "", |
203 | r & RS_Uline ? " uline" : "", |
… | |
… | |
238 | |
242 | |
239 | # if ENABLE_COMBINING |
243 | # if ENABLE_COMBINING |
240 | if (alloc) |
244 | if (alloc) |
241 | delete [] alloc; |
245 | delete [] alloc; |
242 | # endif |
246 | # endif |
243 | #endif |
|
|
244 | } |
247 | } |
|
|
248 | #endif |
245 | |
249 | |
246 | void |
250 | void |
247 | rxvt_term::commit_iso14755 () |
251 | rxvt_term::commit_iso14755 () |
248 | { |
252 | { |
249 | wchar_t ch[2]; |
253 | wchar_t ch[2]; |
… | |
… | |
866 | } |
870 | } |
867 | |
871 | |
868 | if (len <= 0) |
872 | if (len <= 0) |
869 | return; /* not mapped */ |
873 | return; /* not mapped */ |
870 | |
874 | |
871 | if (options & Opt_scrollTtyKeypress) |
875 | if (OPTION (Opt_scrollTtyKeypress)) |
872 | if (view_start) |
876 | if (view_start) |
873 | { |
877 | { |
874 | view_start = 0; |
878 | view_start = 0; |
875 | want_refresh = 1; |
879 | want_refresh = 1; |
876 | } |
880 | } |
… | |
… | |
982 | SET_LOCALE (locale); |
986 | SET_LOCALE (locale); |
983 | |
987 | |
984 | display->flush (); |
988 | display->flush (); |
985 | |
989 | |
986 | if (want_refresh && !flush_ev.active) |
990 | if (want_refresh && !flush_ev.active) |
987 | flush_ev.start (NOW + 0.01); |
991 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
988 | } |
992 | } |
989 | |
993 | |
990 | void |
994 | void |
991 | rxvt_term::flush_cb (time_watcher &w) |
995 | rxvt_term::flush_cb (time_watcher &w) |
992 | { |
996 | { |
… | |
… | |
1067 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1071 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1068 | } |
1072 | } |
1069 | } |
1073 | } |
1070 | #endif |
1074 | #endif |
1071 | |
1075 | |
|
|
1076 | #if HAVE_SCHED_YIELD |
|
|
1077 | static struct event_handler |
|
|
1078 | { |
|
|
1079 | check_watcher cw_yield; |
|
|
1080 | |
|
|
1081 | void yield (check_watcher &w) |
|
|
1082 | { |
|
|
1083 | sched_yield (); |
|
|
1084 | w.stop (); |
|
|
1085 | } |
|
|
1086 | |
|
|
1087 | event_handler () |
|
|
1088 | : cw_yield (this, &event_handler::yield) |
|
|
1089 | { |
|
|
1090 | } |
|
|
1091 | } event_handler; |
|
|
1092 | #endif |
|
|
1093 | |
1072 | bool |
1094 | bool |
1073 | rxvt_term::pty_fill () |
1095 | rxvt_term::pty_fill () |
1074 | { |
1096 | { |
1075 | ssize_t n = cmdbuf_endp - cmdbuf_ptr; |
1097 | ssize_t n = cmdbuf_endp - cmdbuf_ptr; |
1076 | |
1098 | |
1077 | if (CBUFSIZ == n) |
1099 | if (CBUFSIZ == n) |
1078 | { |
1100 | { |
1079 | rxvt_warn ("pty_fill on full buffer, draining input, continuing.\n"); |
1101 | rxvt_warn ("PLEASE REPORT: pty_fill on full buffer, draining input, continuing.\n"); |
1080 | n = 0; |
1102 | n = 0; |
1081 | } |
1103 | } |
1082 | |
1104 | |
1083 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1105 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1084 | cmdbuf_ptr = cmdbuf_base; |
1106 | cmdbuf_ptr = cmdbuf_base; |
1085 | cmdbuf_endp = cmdbuf_ptr + n; |
1107 | cmdbuf_endp = cmdbuf_ptr + n; |
1086 | |
1108 | |
1087 | n = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); |
1109 | ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); |
1088 | |
1110 | |
1089 | if (n > 0) |
1111 | if (r > 0) |
1090 | { |
1112 | { |
1091 | cmdbuf_endp += n; |
1113 | cmdbuf_endp += r; |
1092 | return true; |
1114 | return true; |
1093 | } |
1115 | } |
1094 | else if ((n < 0 && errno != EAGAIN && errno != EINTR) || n == 0) |
1116 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
|
|
1117 | { |
|
|
1118 | #if HAVE_SCHED_YIELD |
|
|
1119 | if (display->is_local) |
|
|
1120 | event_handler.cw_yield.start (); |
|
|
1121 | #endif |
|
|
1122 | } |
|
|
1123 | else |
1095 | { |
1124 | { |
1096 | pty_ev.stop (); |
1125 | pty_ev.stop (); |
1097 | |
1126 | |
1098 | if (!(options & Opt_hold)) |
1127 | if (!OPTION (Opt_hold)) |
1099 | destroy (); |
1128 | destroy (); |
1100 | } |
1129 | } |
1101 | |
1130 | |
1102 | return false; |
1131 | return false; |
1103 | } |
1132 | } |
… | |
… | |
1125 | recolour_cursor (); |
1154 | recolour_cursor (); |
1126 | |
1155 | |
1127 | #ifdef POINTER_BLANK |
1156 | #ifdef POINTER_BLANK |
1128 | hidden_pointer = 0; |
1157 | hidden_pointer = 0; |
1129 | |
1158 | |
1130 | if (options & Opt_pointerBlank) |
1159 | if (OPTION (Opt_pointerBlank)) |
1131 | pointer_ev.start (NOW + pointerBlankDelay); |
1160 | pointer_ev.start (NOW + pointerBlankDelay); |
1132 | #endif |
1161 | #endif |
1133 | } |
1162 | } |
1134 | |
1163 | |
1135 | #ifdef POINTER_BLANK |
1164 | #ifdef POINTER_BLANK |
1136 | void |
1165 | void |
1137 | rxvt_term::pointer_blank () |
1166 | rxvt_term::pointer_blank () |
1138 | { |
1167 | { |
1139 | if (! (options & Opt_pointerBlank)) |
1168 | if (! OPTION (Opt_pointerBlank)) |
1140 | return; |
1169 | return; |
1141 | |
1170 | |
1142 | XDefineCursor (display->display, vt, display->blank_cursor); |
1171 | XDefineCursor (display->display, vt, display->blank_cursor); |
1143 | XFlush (display->display); |
1172 | XFlush (display->display); |
1144 | |
1173 | |
… | |
… | |
1242 | |
1271 | |
1243 | SET_R (this); |
1272 | SET_R (this); |
1244 | SET_LOCALE (locale); |
1273 | SET_LOCALE (locale); |
1245 | |
1274 | |
1246 | #if defined(CURSOR_BLINK) |
1275 | #if defined(CURSOR_BLINK) |
1247 | if ((options & Opt_cursorBlink) && ev.type == KeyPress) |
1276 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
1248 | { |
1277 | { |
1249 | if (hidden_cursor) |
1278 | if (hidden_cursor) |
1250 | { |
1279 | { |
1251 | hidden_cursor = 0; |
1280 | hidden_cursor = 0; |
1252 | want_refresh = 1; |
1281 | want_refresh = 1; |
… | |
… | |
1255 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1284 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1256 | } |
1285 | } |
1257 | #endif |
1286 | #endif |
1258 | |
1287 | |
1259 | #if defined(POINTER_BLANK) |
1288 | #if defined(POINTER_BLANK) |
1260 | if ((options & Opt_pointerBlank) && pointerBlankDelay > 0) |
1289 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
1261 | { |
1290 | { |
1262 | if (ev.type == MotionNotify |
1291 | if (ev.type == MotionNotify |
1263 | || ev.type == ButtonPress |
1292 | || ev.type == ButtonPress |
1264 | || ev.type == ButtonRelease) |
1293 | || ev.type == ButtonRelease) |
1265 | if (hidden_pointer) |
1294 | if (hidden_pointer) |
… | |
… | |
1461 | seen_resize = 1; |
1490 | seen_resize = 1; |
1462 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1491 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1463 | } |
1492 | } |
1464 | |
1493 | |
1465 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1494 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1466 | if (options & Opt_transparent) |
1495 | if (OPTION (Opt_transparent)) |
1467 | check_our_parents (); |
1496 | check_our_parents (); |
1468 | #endif |
1497 | #endif |
1469 | } |
1498 | } |
1470 | break; |
1499 | break; |
1471 | |
1500 | |
… | |
… | |
1672 | { |
1701 | { |
1673 | if (!focus) |
1702 | if (!focus) |
1674 | { |
1703 | { |
1675 | focus = 1; |
1704 | focus = 1; |
1676 | want_refresh = 1; |
1705 | want_refresh = 1; |
|
|
1706 | |
|
|
1707 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
|
|
1708 | |
1677 | #if USE_XIM |
1709 | #if USE_XIM |
1678 | if (Input_Context != NULL) |
1710 | if (Input_Context != NULL) |
1679 | { |
1711 | { |
1680 | IMSetStatusPosition (); |
1712 | IMSetStatusPosition (); |
1681 | XSetICFocus (Input_Context); |
1713 | XSetICFocus (Input_Context); |
1682 | } |
1714 | } |
1683 | #endif |
1715 | #endif |
1684 | #if CURSOR_BLINK |
1716 | #if CURSOR_BLINK |
1685 | if (options & Opt_cursorBlink) |
1717 | if (OPTION (Opt_cursorBlink)) |
1686 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1718 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1687 | #endif |
1719 | #endif |
1688 | #if OFF_FOCUS_FADING |
1720 | #if OFF_FOCUS_FADING |
1689 | if (rs[Rs_fade]) |
1721 | if (rs[Rs_fade]) |
1690 | { |
1722 | { |
… | |
… | |
1701 | if (focus) |
1733 | if (focus) |
1702 | { |
1734 | { |
1703 | focus = 0; |
1735 | focus = 0; |
1704 | want_refresh = 1; |
1736 | want_refresh = 1; |
1705 | |
1737 | |
|
|
1738 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
|
|
1739 | |
1706 | #if ENABLE_FRILLS || ISO_14755 |
1740 | #if ENABLE_FRILLS || ISO_14755 |
|
|
1741 | if (iso14755buf) |
|
|
1742 | { |
1707 | iso14755buf = 0; |
1743 | iso14755buf = 0; |
1708 | #endif |
|
|
1709 | #if ENABLE_OVERLAY |
1744 | # if ENABLE_OVERLAY |
1710 | scr_overlay_off (); |
1745 | scr_overlay_off (); |
|
|
1746 | # endif |
|
|
1747 | } |
1711 | #endif |
1748 | #endif |
1712 | #if USE_XIM |
1749 | #if USE_XIM |
1713 | if (Input_Context != NULL) |
1750 | if (Input_Context != NULL) |
1714 | XUnsetICFocus (Input_Context); |
1751 | XUnsetICFocus (Input_Context); |
1715 | #endif |
1752 | #endif |
1716 | #if CURSOR_BLINK |
1753 | #if CURSOR_BLINK |
1717 | if (options & Opt_cursorBlink) |
1754 | if (OPTION (Opt_cursorBlink)) |
1718 | cursor_blink_ev.stop (); |
1755 | cursor_blink_ev.stop (); |
1719 | hidden_cursor = 0; |
1756 | hidden_cursor = 0; |
1720 | #endif |
1757 | #endif |
1721 | #if OFF_FOCUS_FADING |
1758 | #if OFF_FOCUS_FADING |
1722 | if (rs[Rs_fade]) |
1759 | if (rs[Rs_fade]) |
… | |
… | |
1746 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1783 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1747 | return; |
1784 | return; |
1748 | |
1785 | |
1749 | /* FALLTHROUGH */ |
1786 | /* FALLTHROUGH */ |
1750 | case ReparentNotify: |
1787 | case ReparentNotify: |
1751 | if ((options & Opt_transparent) && check_our_parents () && am_transparent) |
1788 | if (OPTION (Opt_transparent) && check_our_parents () && am_transparent) |
1752 | want_refresh = want_full_refresh = 1; |
1789 | want_refresh = want_full_refresh = 1; |
1753 | break; |
1790 | break; |
1754 | } |
1791 | } |
1755 | } |
1792 | } |
1756 | #endif |
1793 | #endif |
… | |
… | |
1759 | rxvt_term::button_press (XButtonEvent &ev) |
1796 | rxvt_term::button_press (XButtonEvent &ev) |
1760 | { |
1797 | { |
1761 | int reportmode = 0, clickintime; |
1798 | int reportmode = 0, clickintime; |
1762 | |
1799 | |
1763 | bypass_keystate = ev.state & (ModMetaMask | ShiftMask); |
1800 | bypass_keystate = ev.state & (ModMetaMask | ShiftMask); |
|
|
1801 | |
1764 | if (!bypass_keystate) |
1802 | if (!bypass_keystate) |
1765 | reportmode = !! (priv_modes & PrivMode_mouse_report); |
1803 | reportmode = !! (priv_modes & PrivMode_mouse_report); |
1766 | |
1804 | |
1767 | /* |
1805 | /* |
1768 | * VT window processing of button press |
1806 | * VT window processing of button press |
… | |
… | |
1817 | else |
1855 | else |
1818 | { |
1856 | { |
1819 | if (ev.button != MEvent.button) |
1857 | if (ev.button != MEvent.button) |
1820 | MEvent.clicks = 0; |
1858 | MEvent.clicks = 0; |
1821 | |
1859 | |
|
|
1860 | if (!PERL_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END))) |
1822 | switch (ev.button) |
1861 | switch (ev.button) |
1823 | { |
1862 | { |
1824 | case Button1: |
1863 | case Button1: |
1825 | /* allow meta + click to select rectangular areas */ |
1864 | /* allow meta + click to select rectangular areas */ |
1826 | /* should be done in screen.C */ |
1865 | /* should be done in screen.C */ |
1827 | #if ENABLE_FRILLS |
1866 | #if ENABLE_FRILLS |
1828 | selection.rect = !!(ev.state & ModMetaMask); |
1867 | selection.rect = !!(ev.state & ModMetaMask); |
1829 | #else |
1868 | #else |
1830 | selection.rect = false; |
1869 | selection.rect = false; |
1831 | #endif |
1870 | #endif |
1832 | |
1871 | |
1833 | /* allow shift+left click to extend selection */ |
1872 | /* allow shift+left click to extend selection */ |
1834 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1873 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1835 | { |
1874 | { |
1836 | if (MEvent.button == Button1 && clickintime) |
1875 | if (MEvent.button == Button1 && clickintime) |
1837 | selection_rotate (ev.x, ev.y); |
1876 | selection_rotate (ev.x, ev.y); |
1838 | else |
1877 | else |
1839 | selection_extend (ev.x, ev.y, 1); |
1878 | selection_extend (ev.x, ev.y, 1); |
1840 | } |
1879 | } |
1841 | else |
1880 | else |
1842 | { |
1881 | { |
1843 | if (MEvent.button == Button1 && clickintime) |
1882 | if (MEvent.button == Button1 && clickintime) |
1844 | MEvent.clicks++; |
1883 | MEvent.clicks++; |
1845 | else |
1884 | else |
1846 | MEvent.clicks = 1; |
1885 | MEvent.clicks = 1; |
1847 | |
1886 | |
1848 | selection_click (MEvent.clicks, ev.x, ev.y); |
1887 | selection_click (MEvent.clicks, ev.x, ev.y); |
1849 | } |
1888 | } |
1850 | |
1889 | |
1851 | MEvent.button = Button1; |
1890 | MEvent.button = Button1; |
1852 | break; |
1891 | break; |
1853 | |
1892 | |
1854 | case Button3: |
1893 | case Button3: |
1855 | if (MEvent.button == Button3 && clickintime) |
1894 | if (MEvent.button == Button3 && clickintime) |
1856 | selection_rotate (ev.x, ev.y); |
1895 | selection_rotate (ev.x, ev.y); |
1857 | else |
1896 | else |
1858 | selection_extend (ev.x, ev.y, 1); |
1897 | selection_extend (ev.x, ev.y, 1); |
1859 | |
1898 | |
1860 | MEvent.button = Button3; |
1899 | MEvent.button = Button3; |
1861 | break; |
1900 | break; |
1862 | } |
1901 | } |
1863 | } |
1902 | } |
1864 | |
1903 | |
1865 | MEvent.time = ev.time; |
1904 | MEvent.time = ev.time; |
1866 | return; |
1905 | return; |
1867 | } |
1906 | } |
1868 | |
1907 | |
… | |
… | |
2098 | |
2137 | |
2099 | v = ev.button == Button4 ? UP : DN; |
2138 | v = ev.button == Button4 ? UP : DN; |
2100 | |
2139 | |
2101 | if (ev.state & ShiftMask) |
2140 | if (ev.state & ShiftMask) |
2102 | i = 1; |
2141 | i = 1; |
2103 | else if (options & Opt_mouseWheelScrollPage) |
2142 | else if (OPTION (Opt_mouseWheelScrollPage)) |
2104 | i = nrow - 1; |
2143 | i = nrow - 1; |
2105 | else |
2144 | else |
2106 | i = 5; |
2145 | i = 5; |
2107 | |
2146 | |
2108 | # ifdef MOUSE_SLIP_WHEELING |
2147 | # ifdef MOUSE_SLIP_WHEELING |
… | |
… | |
2394 | XWindowAttributes wattr, wrootattr; |
2433 | XWindowAttributes wattr, wrootattr; |
2395 | dDisp; |
2434 | dDisp; |
2396 | |
2435 | |
2397 | pchanged = 0; |
2436 | pchanged = 0; |
2398 | |
2437 | |
2399 | if (!(options & Opt_transparent)) |
2438 | if (!OPTION (Opt_transparent)) |
2400 | return pchanged; /* Don't try any more */ |
2439 | return pchanged; /* Don't try any more */ |
2401 | |
2440 | |
2402 | XGetWindowAttributes (disp, display->root, &wrootattr); |
2441 | XGetWindowAttributes (disp, display->root, &wrootattr); |
2403 | rootdepth = wrootattr.depth; |
2442 | rootdepth = wrootattr.depth; |
2404 | |
2443 | |
… | |
… | |
2682 | if (ch == C0_LF) |
2721 | if (ch == C0_LF) |
2683 | nlines++; |
2722 | nlines++; |
2684 | |
2723 | |
2685 | refresh_count++; |
2724 | refresh_count++; |
2686 | |
2725 | |
2687 | if (!(options & Opt_jumpScroll) |
2726 | if (!OPTION (Opt_jumpScroll) |
2688 | || (refresh_count >= refresh_limit * (nrow - 1))) |
2727 | || (refresh_count >= refresh_limit * (nrow - 1))) |
2689 | { |
2728 | { |
2690 | refreshnow = true; |
2729 | refreshnow = true; |
|
|
2730 | refresh_count = 0; |
2691 | ch = NOCHAR; |
2731 | ch = NOCHAR; |
2692 | break; |
2732 | break; |
2693 | } |
2733 | } |
2694 | |
2734 | |
2695 | // scr_add_lines only works for nlines <= nrow - 1. |
2735 | // scr_add_lines only works for nlines <= nrow - 1. |
… | |
… | |
2726 | * the number of pages between refreshes is refresh_limit, which |
2766 | * the number of pages between refreshes is refresh_limit, which |
2727 | * is incremented here because we must be doing flat-out scrolling. |
2767 | * is incremented here because we must be doing flat-out scrolling. |
2728 | */ |
2768 | */ |
2729 | if (refreshnow) |
2769 | if (refreshnow) |
2730 | { |
2770 | { |
2731 | if ((options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2771 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2732 | refresh_limit++; |
2772 | refresh_limit++; |
2733 | else |
2773 | else |
2734 | { |
2774 | { |
2735 | flag = true; |
2775 | flag = true; |
2736 | scr_refresh (refresh_type); |
2776 | scr_refresh (refresh_type); |
|
|
2777 | flush_ev.stop (); |
2737 | } |
2778 | } |
2738 | } |
2779 | } |
2739 | |
2780 | |
2740 | } |
2781 | } |
2741 | else |
2782 | else |
… | |
… | |
3400 | break; |
3441 | break; |
3401 | case 6: /* CPR requested */ |
3442 | case 6: /* CPR requested */ |
3402 | scr_report_position (); |
3443 | scr_report_position (); |
3403 | break; |
3444 | break; |
3404 | case 7: /* unofficial extension */ |
3445 | case 7: /* unofficial extension */ |
3405 | if (options & Opt_insecure) |
3446 | if (OPTION (Opt_insecure)) |
3406 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
3447 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
3407 | break; |
3448 | break; |
3408 | case 8: /* unofficial extension */ |
3449 | case 8: /* unofficial extension */ |
3409 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
3450 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
3410 | break; |
3451 | break; |
… | |
… | |
3574 | break; |
3615 | break; |
3575 | case 20: /* report icon label */ |
3616 | case 20: /* report icon label */ |
3576 | { |
3617 | { |
3577 | char *s; |
3618 | char *s; |
3578 | XGetIconName (disp, parent[0], &s); |
3619 | XGetIconName (disp, parent[0], &s); |
3579 | tt_printf ("\033]L%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3620 | tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3580 | XFree (s); |
3621 | XFree (s); |
3581 | } |
3622 | } |
3582 | break; |
3623 | break; |
3583 | case 21: /* report window title */ |
3624 | case 21: /* report window title */ |
3584 | { |
3625 | { |
3585 | char *s; |
3626 | char *s; |
3586 | XFetchName (disp, parent[0], &s); |
3627 | XFetchName (disp, parent[0], &s); |
3587 | tt_printf ("\033]l%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3628 | tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3588 | XFree (s); |
3629 | XFree (s); |
3589 | } |
3630 | } |
3590 | break; |
3631 | break; |
3591 | } |
3632 | } |
3592 | } |
3633 | } |
… | |
… | |
3868 | // TODO, when secure mode? |
3909 | // TODO, when secure mode? |
3869 | break; |
3910 | break; |
3870 | |
3911 | |
3871 | #ifdef MENUBAR |
3912 | #ifdef MENUBAR |
3872 | case URxvt_Menu: |
3913 | case URxvt_Menu: |
3873 | if (options & Opt_insecure) |
3914 | if (OPTION (Opt_insecure)) |
3874 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
3915 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
3875 | break; |
3916 | break; |
3876 | #endif |
3917 | #endif |
3877 | #if 0 |
3918 | #if 0 |
3878 | case XTerm_dumpscreen: /* no error notices */ |
3919 | case XTerm_dumpscreen: /* no error notices */ |
… | |
… | |
3894 | case URxvt_italicFont: |
3935 | case URxvt_italicFont: |
3895 | case URxvt_boldItalicFont: |
3936 | case URxvt_boldItalicFont: |
3896 | #endif |
3937 | #endif |
3897 | if (query) |
3938 | if (query) |
3898 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3939 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3899 | (options & Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3940 | OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3900 | ? fontset[op - URxvt_font]->fontdesc : "", |
3941 | ? fontset[op - URxvt_font]->fontdesc : "", |
3901 | resp); |
3942 | resp); |
3902 | else |
3943 | else |
3903 | { |
3944 | { |
3904 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
3945 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
… | |
… | |
3910 | break; |
3951 | break; |
3911 | |
3952 | |
3912 | #if ENABLE_FRILLS |
3953 | #if ENABLE_FRILLS |
3913 | case URxvt_locale: |
3954 | case URxvt_locale: |
3914 | if (query) |
3955 | if (query) |
3915 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, (options & Opt_insecure) ? locale : "", resp); |
3956 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); |
3916 | else |
3957 | else |
3917 | { |
3958 | { |
3918 | set_locale (str); |
3959 | set_locale (str); |
3919 | pty.set_utf8_mode (enc_utf8); |
3960 | pty.set_utf8_mode (enc_utf8); |
3920 | init_xlocale (); |
3961 | init_xlocale (); |
3921 | } |
3962 | } |
3922 | break; |
3963 | break; |
3923 | |
3964 | |
3924 | case URxvt_view_up: |
3965 | case URxvt_view_up: |
3925 | case URxvt_view_down: |
3966 | case URxvt_view_down: |
|
|
3967 | { |
3926 | int lines = atoi (str); |
3968 | int lines = atoi (str); |
3927 | |
3969 | |
3928 | if (lines) |
3970 | if (lines) |
3929 | scr_page (op == URxvt_view_up ? UP : DN, lines); |
3971 | scr_page (op == URxvt_view_up ? UP : DN, lines); |
3930 | else |
3972 | else |
3931 | { |
|
|
3932 | scr_erase_savelines (); |
3973 | scr_erase_savelines (); |
3933 | } |
3974 | } |
3934 | |
3975 | |
|
|
3976 | break; |
|
|
3977 | #endif |
|
|
3978 | |
|
|
3979 | #if ENABLE_PERL |
|
|
3980 | case URxvt_perl: |
|
|
3981 | if (PERL_INVOKE ((this, HOOK_OSC_SEQ, DT_STRING, str, DT_END))) |
|
|
3982 | ; // no responses yet |
3935 | break; |
3983 | break; |
3936 | #endif |
3984 | #endif |
3937 | } |
3985 | } |
3938 | } |
3986 | } |
3939 | /*----------------------------------------------------------------------*/ |
3987 | /*----------------------------------------------------------------------*/ |
… | |
… | |
4048 | } |
4096 | } |
4049 | |
4097 | |
4050 | /* extra handling for values with state unkept */ |
4098 | /* extra handling for values with state unkept */ |
4051 | switch (arg[i]) |
4099 | switch (arg[i]) |
4052 | { |
4100 | { |
|
|
4101 | #if ENABLE_STYLES |
|
|
4102 | case 1021: |
|
|
4103 | if (mode) |
|
|
4104 | SET_OPTION (Opt_intensityStyles); |
|
|
4105 | else |
|
|
4106 | CLR_OPTION (Opt_intensityStyles); |
|
|
4107 | |
|
|
4108 | scr_touch (true); |
|
|
4109 | break; |
|
|
4110 | #endif |
4053 | case 1048: /* alternative cursor save */ |
4111 | case 1048: /* alternative cursor save */ |
4054 | case 1049: |
4112 | case 1049: |
4055 | if (options & Opt_secondaryScreen) |
4113 | if (OPTION (Opt_secondaryScreen)) |
4056 | if (mode == 0) |
4114 | if (mode == 0) |
4057 | scr_cursor (RESTORE); |
4115 | scr_cursor (RESTORE); |
4058 | else if (mode == 1) |
4116 | else if (mode == 1) |
4059 | scr_cursor (SAVE); |
4117 | scr_cursor (SAVE); |
4060 | break; |
4118 | break; |
… | |
… | |
4075 | case 3: /* 80/132 */ |
4133 | case 3: /* 80/132 */ |
4076 | if (priv_modes & PrivMode_132OK) |
4134 | if (priv_modes & PrivMode_132OK) |
4077 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4135 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4078 | break; |
4136 | break; |
4079 | case 4: /* smooth scrolling */ |
4137 | case 4: /* smooth scrolling */ |
4080 | if (state) |
4138 | if (!state) |
4081 | options &= ~Opt_jumpScroll; |
4139 | SET_OPTION (Opt_jumpScroll); |
4082 | else |
4140 | else |
4083 | options |= Opt_jumpScroll; |
4141 | CLR_OPTION (Opt_jumpScroll); |
4084 | break; |
4142 | break; |
4085 | case 5: /* reverse video */ |
4143 | case 5: /* reverse video */ |
4086 | scr_rvideo_mode (state); |
4144 | scr_rvideo_mode (state); |
4087 | break; |
4145 | break; |
4088 | case 6: /* relative/absolute origins */ |
4146 | case 6: /* relative/absolute origins */ |
… | |
… | |
4129 | #if 0 |
4187 | #if 0 |
4130 | case 1001: |
4188 | case 1001: |
4131 | break; /* X11 mouse highlighting */ |
4189 | break; /* X11 mouse highlighting */ |
4132 | #endif |
4190 | #endif |
4133 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4191 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4134 | if (state) |
4192 | if (!state) |
4135 | options &= ~Opt_scrollTtyOutput; |
4193 | SET_OPTION (Opt_scrollTtyOutput); |
4136 | else |
4194 | else |
4137 | options |= Opt_scrollTtyOutput; |
4195 | CLR_OPTION (Opt_scrollTtyOutput); |
4138 | break; |
4196 | break; |
4139 | case 1011: /* scroll to bottom on key press */ |
4197 | case 1011: /* scroll to bottom on key press */ |
4140 | if (state) |
4198 | if (state) |
4141 | options |= Opt_scrollTtyKeypress; |
4199 | SET_OPTION (Opt_scrollTtyKeypress); |
4142 | else |
4200 | else |
4143 | options &= ~Opt_scrollTtyKeypress; |
4201 | CLR_OPTION (Opt_scrollTtyKeypress); |
4144 | break; |
4202 | break; |
4145 | case 1047: /* secondary screen w/ clearing last */ |
4203 | case 1047: /* secondary screen w/ clearing last */ |
4146 | if (options & Opt_secondaryScreen) |
4204 | if (OPTION (Opt_secondaryScreen)) |
4147 | if (current_screen != PRIMARY) |
4205 | if (current_screen != PRIMARY) |
4148 | scr_erase_screen (2); |
4206 | scr_erase_screen (2); |
4149 | scr_change_screen (state); |
4207 | scr_change_screen (state); |
4150 | break; |
4208 | break; |
4151 | case 1049: /* secondary screen w/ clearing first */ |
4209 | case 1049: /* secondary screen w/ clearing first */ |
4152 | scr_change_screen (state); |
4210 | scr_change_screen (state); |
4153 | if (options & Opt_secondaryScreen) |
4211 | if (OPTION (Opt_secondaryScreen)) |
4154 | if (current_screen != PRIMARY) |
4212 | if (current_screen != PRIMARY) |
4155 | scr_erase_screen (2); |
4213 | scr_erase_screen (2); |
4156 | break; |
4214 | break; |
4157 | default: |
4215 | default: |
4158 | break; |
4216 | break; |
… | |
… | |
4308 | case 106: |
4366 | case 106: |
4309 | case 107: |
4367 | case 107: |
4310 | scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); |
4368 | scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); |
4311 | break; |
4369 | break; |
4312 | #endif |
4370 | #endif |
4313 | |
|
|
4314 | } |
4371 | } |
4315 | } |
4372 | } |
4316 | } |
4373 | } |
4317 | /*}}} */ |
4374 | /*}}} */ |
4318 | |
4375 | |