ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.208 by root, Sun Dec 18 00:59:42 2005 UTC vs.
Revision 1.230 by root, Wed Jan 4 00:09:12 2006 UTC

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# include <sched.h>
56#endif
52 57
53#ifdef KEYSYM_RESOURCE 58#ifdef KEYSYM_RESOURCE
54# include "keyboard.h" 59# include "keyboard.h"
55#endif 60#endif
56 61
135rxvt_term::iso14755_54 (int x, int y) 140rxvt_term::iso14755_54 (int x, int y)
136{ 141{
137 x = Pixel2Col (x); 142 x = Pixel2Col (x);
138 y = Pixel2Row (y); 143 y = Pixel2Row (y);
139 144
140 if (x < 0 || x >= ncol 145 if (!IN_RANGE_EXC (x, 0, ncol)
141 || y < 0 || y >= nrow) 146 || !IN_RANGE_EXC (y, 0, nrow))
142 return; 147 return;
143 148
144 for (;;) 149 for (;;)
145 { 150 {
146 const line_t &l = save[y + saveLines - view_start]; 151 const line_t &l = ROW(y - view_start);
147 152
148 text_t t = l.t[x]; 153 text_t t = l.t[x];
149 154
150 if (t != NOCHAR || !x) 155 if (t != NOCHAR || !x)
151 { 156 {
152 iso14755_51 (l.t[x], l.r[x]); 157 iso14755_51 (l.t[x], l.r[x], x, y);
153 iso14755buf = ISO_14755_54; 158 iso14755buf = ISO_14755_54;
154 break; 159 break;
155 } 160 }
156 161
157 x--; 162 x--;
158 } 163 }
159
160} 164}
161#endif
162 165
163#if ENABLE_OVERLAY
164void 166void
165rxvt_term::iso14755_51 (unicode_t ch, rend_t r) 167rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y)
166{ 168{
167 rxvt_fontset *fs = FONTSET (r); 169 rxvt_fontset *fs = FONTSET (r);
168 rxvt_font *f = (*fs)[fs->find_font (ch)]; 170 rxvt_font *f = (*fs)[fs->find_font (ch)];
169 wchar_t *chr, *alloc, ch2, *fname; 171 wchar_t *chr, *alloc, ch2, *fname;
170 int len; 172 int len;
171 173
172 fname = rxvt_utf8towcs (f->name); 174 fname = rxvt_utf8towcs (f->name);
173 175
174#if ENABLE_COMBINING 176# if ENABLE_COMBINING
175 if (IS_COMPOSE (ch)) 177 if (IS_COMPOSE (ch))
176 { 178 {
177 len = rxvt_composite.expand (ch, 0); 179 len = rxvt_composite.expand (ch, 0);
178 alloc = chr = new wchar_t[len]; 180 alloc = chr = new wchar_t[len];
179 rxvt_composite.expand (ch, chr); 181 rxvt_composite.expand (ch, chr);
180 } 182 }
181 else 183 else
182#endif 184# endif
183 { 185 {
184 ch2 = ch; 186 ch2 = ch;
185 187
186 alloc = 0; 188 alloc = 0;
187 chr = &ch2; 189 chr = &ch2;
188 len = 1; 190 len = 1;
189 } 191 }
190 192
193 char attr[80]; // plenty
194
195 sprintf (attr, "%08x = fg %d bg %d%s%s%s%s%s%s",
196 (int)r,
197 fgcolor_of (r), bgcolor_of (r),
198 r & RS_Bold ? " bold" : "",
199 r & RS_Italic ? " italic" : "",
200 r & RS_Blink ? " blink" : "",
201 r & RS_RVid ? " rvid" : "",
202 r & RS_Uline ? " uline" : "",
203 r & RS_Careful ? " careful" : "");
204
191 int width = wcswidth (fname, wcslen (fname)); 205 int width = wcswidth (fname, wcslen (fname));
192 206
193 scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1); 207 max_it (width, 8+5); // for char + hey
208 max_it (width, strlen (attr));
209
210 if (y >= 0)
211 {
212 y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1;
213 x = 0;
214 }
215
216 scr_overlay_new (x, y, width, len + 2);
194 217
195 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); 218 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r));
196 219
197 for (int y = 0; y < len; y++) 220 for (int y = 0; y < len; y++)
198 { 221 {
201 ch = *chr++; 224 ch = *chr++;
202 225
203 sprintf (buf, "%8x", ch); 226 sprintf (buf, "%8x", ch);
204 scr_overlay_set (0, y, buf); 227 scr_overlay_set (0, y, buf);
205 scr_overlay_set (9, y, '='); 228 scr_overlay_set (9, y, '=');
206#if !UNICODE3 229# if !UNICODE3
207 if (ch >= 0x10000) 230 if (ch >= 0x10000)
208 ch = 0xfffd; 231 ch = 0xfffd;
209#endif 232# endif
210 scr_overlay_set (11, y, ch, r); 233 scr_overlay_set (11, y, ch, r);
211 scr_overlay_set (12, y, NOCHAR, r); 234 scr_overlay_set (12, y, NOCHAR, r);
212 } 235 }
213 236
237 scr_overlay_set (0, len , attr);
214 scr_overlay_set (0, len, fname); 238 scr_overlay_set (0, len + 1, fname);
215 239
216 free (fname); 240 free (fname);
217 241
218#if ENABLE_COMBINING 242# if ENABLE_COMBINING
219 if (alloc) 243 if (alloc)
220 delete [] alloc; 244 delete [] alloc;
221#endif 245# endif
222} 246}
223#endif 247#endif
224 248
225void 249void
226rxvt_term::commit_iso14755 () 250rxvt_term::commit_iso14755 ()
845 } 869 }
846 870
847 if (len <= 0) 871 if (len <= 0)
848 return; /* not mapped */ 872 return; /* not mapped */
849 873
850 if (options & Opt_scrollTtyKeypress) 874 if (OPTION (Opt_scrollTtyKeypress))
851 if (view_start) 875 if (view_start)
852 { 876 {
853 view_start = 0; 877 view_start = 0;
854 want_refresh = 1; 878 want_refresh = 1;
855 } 879 }
961 SET_LOCALE (locale); 985 SET_LOCALE (locale);
962 986
963 display->flush (); 987 display->flush ();
964 988
965 if (want_refresh && !flush_ev.active) 989 if (want_refresh && !flush_ev.active)
966 flush_ev.start (NOW + 0.01); 990 flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally
967} 991}
968 992
969void 993void
970rxvt_term::flush_cb (time_watcher &w) 994rxvt_term::flush_cb (time_watcher &w)
971{ 995{
1035{ 1059{
1036 if (mouse_slip_wheel_speed == 0 1060 if (mouse_slip_wheel_speed == 0
1037 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) 1061 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed)
1038 : scr_page (UP, mouse_slip_wheel_speed)) 1062 : scr_page (UP, mouse_slip_wheel_speed))
1039 { 1063 {
1040 if (view_start == nscrolled || 1064 if (view_start == nsaved ||
1041 view_start == 0) 1065 view_start == 0)
1042 mouse_slip_wheel_speed = 0; 1066 mouse_slip_wheel_speed = 0;
1043 1067
1044 refresh_type |= SMOOTH_REFRESH; 1068 refresh_type |= SMOOTH_REFRESH;
1045 want_refresh = 1; 1069 want_refresh = 1;
1046 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1070 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1047 } 1071 }
1048} 1072}
1049#endif 1073#endif
1050 1074
1075#if HAVE_SCHED_YIELD
1076static struct event_handler
1077{
1078 check_watcher cw_yield;
1079
1080 void yield (check_watcher &w)
1081 {
1082 sched_yield ();
1083 w.stop ();
1084 }
1085
1086 event_handler ()
1087 : cw_yield (this, &event_handler::yield)
1088 {
1089 }
1090} event_handler;
1091#endif
1092
1051bool 1093bool
1052rxvt_term::pty_fill () 1094rxvt_term::pty_fill ()
1053{ 1095{
1054 ssize_t n = cmdbuf_endp - cmdbuf_ptr; 1096 ssize_t n = cmdbuf_endp - cmdbuf_ptr;
1055 1097
1061 1103
1062 memmove (cmdbuf_base, cmdbuf_ptr, n); 1104 memmove (cmdbuf_base, cmdbuf_ptr, n);
1063 cmdbuf_ptr = cmdbuf_base; 1105 cmdbuf_ptr = cmdbuf_base;
1064 cmdbuf_endp = cmdbuf_ptr + n; 1106 cmdbuf_endp = cmdbuf_ptr + n;
1065 1107
1066 n = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); 1108 ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n);
1067 1109
1068 if (n > 0) 1110 if (r > 0)
1069 { 1111 {
1070 cmdbuf_endp += n; 1112 cmdbuf_endp += r;
1071 return true; 1113 return true;
1072 } 1114 }
1073 else if (n < 0 && errno != EAGAIN) 1115 else if (r < 0 && (errno == EAGAIN || errno == EINTR))
1116 {
1117#if HAVE_SCHED_YIELD
1118 if (display->is_local)
1119 event_handler.cw_yield.start ();
1120#endif
1121 }
1122 else
1123 {
1124 pty_ev.stop ();
1125
1126 if (!OPTION (Opt_hold))
1074 destroy (); 1127 destroy ();
1128 }
1075 1129
1076 return false; 1130 return false;
1077} 1131}
1078 1132
1079void 1133void
1099 recolour_cursor (); 1153 recolour_cursor ();
1100 1154
1101#ifdef POINTER_BLANK 1155#ifdef POINTER_BLANK
1102 hidden_pointer = 0; 1156 hidden_pointer = 0;
1103 1157
1104 if (options & Opt_pointerBlank) 1158 if (OPTION (Opt_pointerBlank))
1105 pointer_ev.start (NOW + pointerBlankDelay); 1159 pointer_ev.start (NOW + pointerBlankDelay);
1106#endif 1160#endif
1107} 1161}
1108 1162
1109#ifdef POINTER_BLANK 1163#ifdef POINTER_BLANK
1110void 1164void
1111rxvt_term::pointer_blank () 1165rxvt_term::pointer_blank ()
1112{ 1166{
1113 if (! (options & Opt_pointerBlank)) 1167 if (! OPTION (Opt_pointerBlank))
1114 return; 1168 return;
1115 1169
1116 XDefineCursor (display->display, vt, display->blank_cursor); 1170 XDefineCursor (display->display, vt, display->blank_cursor);
1117 XFlush (display->display); 1171 XFlush (display->display);
1118 1172
1216 1270
1217 SET_R (this); 1271 SET_R (this);
1218 SET_LOCALE (locale); 1272 SET_LOCALE (locale);
1219 1273
1220#if defined(CURSOR_BLINK) 1274#if defined(CURSOR_BLINK)
1221 if ((options & Opt_cursorBlink) && ev.type == KeyPress) 1275 if (OPTION (Opt_cursorBlink) && ev.type == KeyPress)
1222 { 1276 {
1223 if (hidden_cursor) 1277 if (hidden_cursor)
1224 { 1278 {
1225 hidden_cursor = 0; 1279 hidden_cursor = 0;
1226 want_refresh = 1; 1280 want_refresh = 1;
1229 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1283 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1230 } 1284 }
1231#endif 1285#endif
1232 1286
1233#if defined(POINTER_BLANK) 1287#if defined(POINTER_BLANK)
1234 if ((options & Opt_pointerBlank) && pointerBlankDelay > 0) 1288 if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0)
1235 { 1289 {
1236 if (ev.type == MotionNotify 1290 if (ev.type == MotionNotify
1237 || ev.type == ButtonPress 1291 || ev.type == ButtonPress
1238 || ev.type == ButtonRelease) 1292 || ev.type == ButtonRelease)
1239 if (hidden_pointer) 1293 if (hidden_pointer)
1435 seen_resize = 1; 1489 seen_resize = 1;
1436 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1490 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1437 } 1491 }
1438 1492
1439#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ 1493#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */
1440 if (options & Opt_transparent) 1494 if (OPTION (Opt_transparent))
1441 check_our_parents (); 1495 check_our_parents ();
1442#endif 1496#endif
1443 } 1497 }
1444 break; 1498 break;
1445 1499
1601 } 1655 }
1602 1656
1603 scroll_selection_lines = Pixel2Height (dist) 1657 scroll_selection_lines = Pixel2Height (dist)
1604 / SELECTION_SCROLL_LINE_SPEEDUP 1658 / SELECTION_SCROLL_LINE_SPEEDUP
1605 + 1; 1659 + 1;
1606 MIN_IT (scroll_selection_lines, 1660 min_it (scroll_selection_lines,
1607 SELECTION_SCROLL_MAX_LINES); 1661 SELECTION_SCROLL_MAX_LINES);
1608 } 1662 }
1609 else 1663 else
1610 { 1664 {
1611 /* we are within the text window, so we 1665 /* we are within the text window, so we
1646{ 1700{
1647 if (!focus) 1701 if (!focus)
1648 { 1702 {
1649 focus = 1; 1703 focus = 1;
1650 want_refresh = 1; 1704 want_refresh = 1;
1705
1706 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1707
1651#if USE_XIM 1708#if USE_XIM
1652 if (Input_Context != NULL) 1709 if (Input_Context != NULL)
1653 { 1710 {
1654 IMSetStatusPosition (); 1711 IMSetStatusPosition ();
1655 XSetICFocus (Input_Context); 1712 XSetICFocus (Input_Context);
1656 } 1713 }
1657#endif 1714#endif
1658#if CURSOR_BLINK 1715#if CURSOR_BLINK
1659 if (options & Opt_cursorBlink) 1716 if (OPTION (Opt_cursorBlink))
1660 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1717 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1661#endif 1718#endif
1662#if OFF_FOCUS_FADING 1719#if OFF_FOCUS_FADING
1663 if (rs[Rs_fade]) 1720 if (rs[Rs_fade])
1664 { 1721 {
1675 if (focus) 1732 if (focus)
1676 { 1733 {
1677 focus = 0; 1734 focus = 0;
1678 want_refresh = 1; 1735 want_refresh = 1;
1679 1736
1737 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1738
1680#if ENABLE_FRILLS || ISO_14755 1739#if ENABLE_FRILLS || ISO_14755
1740 if (iso14755buf)
1741 {
1681 iso14755buf = 0; 1742 iso14755buf = 0;
1682#endif
1683#if ENABLE_OVERLAY 1743# if ENABLE_OVERLAY
1684 scr_overlay_off (); 1744 scr_overlay_off ();
1745# endif
1746 }
1685#endif 1747#endif
1686#if USE_XIM 1748#if USE_XIM
1687 if (Input_Context != NULL) 1749 if (Input_Context != NULL)
1688 XUnsetICFocus (Input_Context); 1750 XUnsetICFocus (Input_Context);
1689#endif 1751#endif
1690#if CURSOR_BLINK 1752#if CURSOR_BLINK
1691 if (options & Opt_cursorBlink) 1753 if (OPTION (Opt_cursorBlink))
1692 cursor_blink_ev.stop (); 1754 cursor_blink_ev.stop ();
1693 hidden_cursor = 0; 1755 hidden_cursor = 0;
1694#endif 1756#endif
1695#if OFF_FOCUS_FADING 1757#if OFF_FOCUS_FADING
1696 if (rs[Rs_fade]) 1758 if (rs[Rs_fade])
1720 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) 1782 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID])
1721 return; 1783 return;
1722 1784
1723 /* FALLTHROUGH */ 1785 /* FALLTHROUGH */
1724 case ReparentNotify: 1786 case ReparentNotify:
1725 if ((options & Opt_transparent) && check_our_parents () && am_transparent) 1787 if (OPTION (Opt_transparent) && check_our_parents () && am_transparent)
1726 want_refresh = want_full_refresh = 1; 1788 want_refresh = want_full_refresh = 1;
1727 break; 1789 break;
1728 } 1790 }
1729} 1791}
1730#endif 1792#endif
1733rxvt_term::button_press (XButtonEvent &ev) 1795rxvt_term::button_press (XButtonEvent &ev)
1734{ 1796{
1735 int reportmode = 0, clickintime; 1797 int reportmode = 0, clickintime;
1736 1798
1737 bypass_keystate = ev.state & (ModMetaMask | ShiftMask); 1799 bypass_keystate = ev.state & (ModMetaMask | ShiftMask);
1800
1738 if (!bypass_keystate) 1801 if (!bypass_keystate)
1739 reportmode = !! (priv_modes & PrivMode_mouse_report); 1802 reportmode = !! (priv_modes & PrivMode_mouse_report);
1740 1803
1741 /* 1804 /*
1742 * VT window processing of button press 1805 * VT window processing of button press
1791 else 1854 else
1792 { 1855 {
1793 if (ev.button != MEvent.button) 1856 if (ev.button != MEvent.button)
1794 MEvent.clicks = 0; 1857 MEvent.clicks = 0;
1795 1858
1859 if (!PERL_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END)))
1796 switch (ev.button) 1860 switch (ev.button)
1797 { 1861 {
1798 case Button1: 1862 case Button1:
1799 /* allow meta + click to select rectangular areas */ 1863 /* allow meta + click to select rectangular areas */
1800 /* should be done in screen.C */ 1864 /* should be done in screen.C */
1801#if ENABLE_FRILLS 1865#if ENABLE_FRILLS
1802 selection.rect = !!(ev.state & ModMetaMask); 1866 selection.rect = !!(ev.state & ModMetaMask);
1803#else 1867#else
1804 selection.rect = false; 1868 selection.rect = false;
1805#endif 1869#endif
1806 1870
1807 /* allow shift+left click to extend selection */ 1871 /* allow shift+left click to extend selection */
1808 if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) 1872 if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report))
1809 { 1873 {
1810 if (MEvent.button == Button1 && clickintime) 1874 if (MEvent.button == Button1 && clickintime)
1811 selection_rotate (ev.x, ev.y); 1875 selection_rotate (ev.x, ev.y);
1812 else 1876 else
1813 selection_extend (ev.x, ev.y, 1); 1877 selection_extend (ev.x, ev.y, 1);
1814 } 1878 }
1815 else 1879 else
1816 { 1880 {
1817 if (MEvent.button == Button1 && clickintime) 1881 if (MEvent.button == Button1 && clickintime)
1818 MEvent.clicks++; 1882 MEvent.clicks++;
1819 else 1883 else
1820 MEvent.clicks = 1; 1884 MEvent.clicks = 1;
1821 1885
1822 selection_click (MEvent.clicks, ev.x, ev.y); 1886 selection_click (MEvent.clicks, ev.x, ev.y);
1823 } 1887 }
1824 1888
1825 MEvent.button = Button1; 1889 MEvent.button = Button1;
1826 break; 1890 break;
1827 1891
1828 case Button3: 1892 case Button3:
1829 if (MEvent.button == Button3 && clickintime) 1893 if (MEvent.button == Button3 && clickintime)
1830 selection_rotate (ev.x, ev.y); 1894 selection_rotate (ev.x, ev.y);
1831 else 1895 else
1832 selection_extend (ev.x, ev.y, 1); 1896 selection_extend (ev.x, ev.y, 1);
1833 1897
1834 MEvent.button = Button3; 1898 MEvent.button = Button3;
1835 break; 1899 break;
1836 } 1900 }
1837 } 1901 }
1838 1902
1839 MEvent.time = ev.time; 1903 MEvent.time = ev.time;
1840 return; 1904 return;
1841 } 1905 }
1842 1906
2072 2136
2073 v = ev.button == Button4 ? UP : DN; 2137 v = ev.button == Button4 ? UP : DN;
2074 2138
2075 if (ev.state & ShiftMask) 2139 if (ev.state & ShiftMask)
2076 i = 1; 2140 i = 1;
2077 else if (options & Opt_mouseWheelScrollPage) 2141 else if (OPTION (Opt_mouseWheelScrollPage))
2078 i = nrow - 1; 2142 i = nrow - 1;
2079 else 2143 else
2080 i = 5; 2144 i = 5;
2081 2145
2082# ifdef MOUSE_SLIP_WHEELING 2146# ifdef MOUSE_SLIP_WHEELING
2368 XWindowAttributes wattr, wrootattr; 2432 XWindowAttributes wattr, wrootattr;
2369 dDisp; 2433 dDisp;
2370 2434
2371 pchanged = 0; 2435 pchanged = 0;
2372 2436
2373 if (!(options & Opt_transparent)) 2437 if (!OPTION (Opt_transparent))
2374 return pchanged; /* Don't try any more */ 2438 return pchanged; /* Don't try any more */
2375 2439
2376 XGetWindowAttributes (disp, display->root, &wrootattr); 2440 XGetWindowAttributes (disp, display->root, &wrootattr);
2377 rootdepth = wrootattr.depth; 2441 rootdepth = wrootattr.depth;
2378 2442
2452 nh += sy; 2516 nh += sy;
2453 ny = -sy; 2517 ny = -sy;
2454 sy = 0; 2518 sy = 0;
2455 } 2519 }
2456 2520
2457 MIN_IT (nw, (unsigned int) (wrootattr.width - sx)); 2521 min_it (nw, (unsigned int) (wrootattr.width - sx));
2458 MIN_IT (nh, (unsigned int) (wrootattr.height - sy)); 2522 min_it (nh, (unsigned int) (wrootattr.height - sy));
2459 2523
2460 XSync (disp, False); 2524 XSync (disp, False);
2461 allowedxerror = -1; 2525 allowedxerror = -1;
2462 image = XGetImage (disp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); 2526 image = XGetImage (disp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap);
2463 2527
2656 if (ch == C0_LF) 2720 if (ch == C0_LF)
2657 nlines++; 2721 nlines++;
2658 2722
2659 refresh_count++; 2723 refresh_count++;
2660 2724
2661 if (!(options & Opt_jumpScroll) 2725 if (!OPTION (Opt_jumpScroll)
2662 || (refresh_count >= refresh_limit * (nrow - 1))) 2726 || (refresh_count >= refresh_limit * (nrow - 1)))
2663 { 2727 {
2664 refreshnow = true; 2728 refreshnow = true;
2729 refresh_count = 0;
2665 ch = NOCHAR; 2730 ch = NOCHAR;
2666 break; 2731 break;
2667 } 2732 }
2668 2733
2669 // scr_add_lines only works for nlines <= nrow - 1. 2734 // scr_add_lines only works for nlines <= nrow - 1.
2700 * the number of pages between refreshes is refresh_limit, which 2765 * the number of pages between refreshes is refresh_limit, which
2701 * is incremented here because we must be doing flat-out scrolling. 2766 * is incremented here because we must be doing flat-out scrolling.
2702 */ 2767 */
2703 if (refreshnow) 2768 if (refreshnow)
2704 { 2769 {
2705 if ((options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) 2770 if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
2706 refresh_limit++; 2771 refresh_limit++;
2707 else 2772 else
2708 { 2773 {
2709 flag = true; 2774 flag = true;
2710 scr_refresh (refresh_type); 2775 scr_refresh (refresh_type);
2776 flush_ev.stop ();
2711 } 2777 }
2712 } 2778 }
2713 2779
2714 } 2780 }
2715 else 2781 else
3352 3418
3353 case CSI_SD: /* 8.3.114: (1) SCROLL DOWN */ 3419 case CSI_SD: /* 8.3.114: (1) SCROLL DOWN */
3354 arg[0] = -arg[0]; 3420 arg[0] = -arg[0];
3355 /* FALLTHROUGH */ 3421 /* FALLTHROUGH */
3356 case CSI_SU: /* 8.3.148: (1) SCROLL UP */ 3422 case CSI_SU: /* 8.3.148: (1) SCROLL UP */
3357 scr_scroll_text (screen.tscroll, screen.bscroll, arg[0], 0); 3423 scr_scroll_text (screen.tscroll, screen.bscroll, arg[0]);
3358 break; 3424 break;
3359 3425
3360 case CSI_DA: /* 8.3.24: (0) DEVICE ATTRIBUTES */ 3426 case CSI_DA: /* 8.3.24: (0) DEVICE ATTRIBUTES */
3361 tt_write ((const unsigned char *)VT100_ANS, 3427 tt_write ((const unsigned char *)VT100_ANS,
3362 (unsigned int) (sizeof (VT100_ANS) - 1)); 3428 (unsigned int) (sizeof (VT100_ANS) - 1));
3374 break; 3440 break;
3375 case 6: /* CPR requested */ 3441 case 6: /* CPR requested */
3376 scr_report_position (); 3442 scr_report_position ();
3377 break; 3443 break;
3378 case 7: /* unofficial extension */ 3444 case 7: /* unofficial extension */
3379 if (options & Opt_insecure) 3445 if (OPTION (Opt_insecure))
3380 tt_printf ("%-.250s\012", rs[Rs_display_name]); 3446 tt_printf ("%-.250s\012", rs[Rs_display_name]);
3381 break; 3447 break;
3382 case 8: /* unofficial extension */ 3448 case 8: /* unofficial extension */
3383 process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); 3449 process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST);
3384 break; 3450 break;
3548 break; 3614 break;
3549 case 20: /* report icon label */ 3615 case 20: /* report icon label */
3550 { 3616 {
3551 char *s; 3617 char *s;
3552 XGetIconName (disp, parent[0], &s); 3618 XGetIconName (disp, parent[0], &s);
3553 tt_printf ("\033]L%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ 3619 tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */
3554 XFree (s); 3620 XFree (s);
3555 } 3621 }
3556 break; 3622 break;
3557 case 21: /* report window title */ 3623 case 21: /* report window title */
3558 { 3624 {
3559 char *s; 3625 char *s;
3560 XFetchName (disp, parent[0], &s); 3626 XFetchName (disp, parent[0], &s);
3561 tt_printf ("\033]l%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ 3627 tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */
3562 XFree (s); 3628 XFree (s);
3563 } 3629 }
3564 break; 3630 break;
3565 } 3631 }
3566} 3632}
3842 // TODO, when secure mode? 3908 // TODO, when secure mode?
3843 break; 3909 break;
3844 3910
3845#ifdef MENUBAR 3911#ifdef MENUBAR
3846 case URxvt_Menu: 3912 case URxvt_Menu:
3847 if (options & Opt_insecure) 3913 if (OPTION (Opt_insecure))
3848 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked 3914 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked
3849 break; 3915 break;
3850#endif 3916#endif
3851#if 0 3917#if 0
3852 case XTerm_dumpscreen: /* no error notices */ 3918 case XTerm_dumpscreen: /* no error notices */
3868 case URxvt_italicFont: 3934 case URxvt_italicFont:
3869 case URxvt_boldItalicFont: 3935 case URxvt_boldItalicFont:
3870#endif 3936#endif
3871 if (query) 3937 if (query)
3872 tt_printf ("\33]%d;%-.250s%c", saveop, 3938 tt_printf ("\33]%d;%-.250s%c", saveop,
3873 (options & Opt_insecure) && fontset[op - URxvt_font]->fontdesc 3939 OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc
3874 ? fontset[op - URxvt_font]->fontdesc : "", 3940 ? fontset[op - URxvt_font]->fontdesc : "",
3875 resp); 3941 resp);
3876 else 3942 else
3877 { 3943 {
3878 const char *&res = rs[Rs_font + (op - URxvt_font)]; 3944 const char *&res = rs[Rs_font + (op - URxvt_font)];
3884 break; 3950 break;
3885 3951
3886#if ENABLE_FRILLS 3952#if ENABLE_FRILLS
3887 case URxvt_locale: 3953 case URxvt_locale:
3888 if (query) 3954 if (query)
3889 tt_printf ("\33]%d;%-.250s%c", URxvt_locale, (options & Opt_insecure) ? locale : "", resp); 3955 tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp);
3890 else 3956 else
3891 { 3957 {
3892 set_locale (str); 3958 set_locale (str);
3893 pty.set_utf8_mode (enc_utf8); 3959 pty.set_utf8_mode (enc_utf8);
3894 init_xlocale (); 3960 init_xlocale ();
3900 int lines = atoi (str); 3966 int lines = atoi (str);
3901 3967
3902 if (lines) 3968 if (lines)
3903 scr_page (op == URxvt_view_up ? UP : DN, lines); 3969 scr_page (op == URxvt_view_up ? UP : DN, lines);
3904 else 3970 else
3905 {
3906 scr_erase_savelines (); 3971 scr_erase_savelines ();
3907 }
3908 3972
3909 break; 3973 break;
3910#endif 3974#endif
3975
3976#if ENABLE_PERL
3977 case URxvt_perl:
3978 if (PERL_INVOKE ((this, HOOK_OSC_SEQ, DT_STRING, str, DT_END)))
3979 ; // no responses yet
3980 break;
3981
3982#endif
3983
3911 } 3984 }
3912} 3985}
3913/*----------------------------------------------------------------------*/ 3986/*----------------------------------------------------------------------*/
3914 3987
3915/*{{{ process DEC private mode sequences `ESC [ ? Ps mode' */ 3988/*{{{ process DEC private mode sequences `ESC [ ? Ps mode' */
4022 } 4095 }
4023 4096
4024 /* extra handling for values with state unkept */ 4097 /* extra handling for values with state unkept */
4025 switch (arg[i]) 4098 switch (arg[i])
4026 { 4099 {
4100#if ENABLE_STYLES
4101 case 1021:
4102 if (mode)
4103 SET_OPTION (Opt_intensityStyles);
4104 else
4105 CLR_OPTION (Opt_intensityStyles);
4106
4107 scr_touch (true);
4108 break;
4109#endif
4027 case 1048: /* alternative cursor save */ 4110 case 1048: /* alternative cursor save */
4028 case 1049: 4111 case 1049:
4029 if (options & Opt_secondaryScreen) 4112 if (OPTION (Opt_secondaryScreen))
4030 if (mode == 0) 4113 if (mode == 0)
4031 scr_cursor (RESTORE); 4114 scr_cursor (RESTORE);
4032 else if (mode == 1) 4115 else if (mode == 1)
4033 scr_cursor (SAVE); 4116 scr_cursor (SAVE);
4034 break; 4117 break;
4049 case 3: /* 80/132 */ 4132 case 3: /* 80/132 */
4050 if (priv_modes & PrivMode_132OK) 4133 if (priv_modes & PrivMode_132OK)
4051 set_widthheight (((state ? 132 : 80) * fwidth), height); 4134 set_widthheight (((state ? 132 : 80) * fwidth), height);
4052 break; 4135 break;
4053 case 4: /* smooth scrolling */ 4136 case 4: /* smooth scrolling */
4054 if (state) 4137 if (!state)
4055 options &= ~Opt_jumpScroll; 4138 SET_OPTION (Opt_jumpScroll);
4056 else 4139 else
4057 options |= Opt_jumpScroll; 4140 CLR_OPTION (Opt_jumpScroll);
4058 break; 4141 break;
4059 case 5: /* reverse video */ 4142 case 5: /* reverse video */
4060 scr_rvideo_mode (state); 4143 scr_rvideo_mode (state);
4061 break; 4144 break;
4062 case 6: /* relative/absolute origins */ 4145 case 6: /* relative/absolute origins */
4103#if 0 4186#if 0
4104 case 1001: 4187 case 1001:
4105 break; /* X11 mouse highlighting */ 4188 break; /* X11 mouse highlighting */
4106#endif 4189#endif
4107 case 1010: /* scroll to bottom on TTY output inhibit */ 4190 case 1010: /* scroll to bottom on TTY output inhibit */
4108 if (state) 4191 if (!state)
4109 options &= ~Opt_scrollTtyOutput; 4192 SET_OPTION (Opt_scrollTtyOutput);
4110 else 4193 else
4111 options |= Opt_scrollTtyOutput; 4194 CLR_OPTION (Opt_scrollTtyOutput);
4112 break; 4195 break;
4113 case 1011: /* scroll to bottom on key press */ 4196 case 1011: /* scroll to bottom on key press */
4114 if (state) 4197 if (state)
4115 options |= Opt_scrollTtyKeypress; 4198 SET_OPTION (Opt_scrollTtyKeypress);
4116 else 4199 else
4117 options &= ~Opt_scrollTtyKeypress; 4200 CLR_OPTION (Opt_scrollTtyKeypress);
4118 break; 4201 break;
4119 case 1047: /* secondary screen w/ clearing last */ 4202 case 1047: /* secondary screen w/ clearing last */
4120 if (options & Opt_secondaryScreen) 4203 if (OPTION (Opt_secondaryScreen))
4121 if (current_screen != PRIMARY) 4204 if (current_screen != PRIMARY)
4122 scr_erase_screen (2); 4205 scr_erase_screen (2);
4123 scr_change_screen (state); 4206 scr_change_screen (state);
4124 break; 4207 break;
4125 case 1049: /* secondary screen w/ clearing first */ 4208 case 1049: /* secondary screen w/ clearing first */
4126 scr_change_screen (state); 4209 scr_change_screen (state);
4127 if (options & Opt_secondaryScreen) 4210 if (OPTION (Opt_secondaryScreen))
4128 if (current_screen != PRIMARY) 4211 if (current_screen != PRIMARY)
4129 scr_erase_screen (2); 4212 scr_erase_screen (2);
4130 break; 4213 break;
4131 default: 4214 default:
4132 break; 4215 break;
4282 case 106: 4365 case 106:
4283 case 107: 4366 case 107:
4284 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); 4367 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg);
4285 break; 4368 break;
4286#endif 4369#endif
4287
4288 } 4370 }
4289 } 4371 }
4290} 4372}
4291/*}}} */ 4373/*}}} */
4292 4374
4373 } 4455 }
4374 4456
4375 memmove (v_buffer, v_buffer + written, v_buflen); 4457 memmove (v_buffer, v_buffer + written, v_buflen);
4376 } 4458 }
4377 else if (written != -1 || (errno != EAGAIN && errno != EINTR)) 4459 else if (written != -1 || (errno != EAGAIN && errno != EINTR))
4378 // original code just ignores this... 4460 pty_ev.set (EVENT_READ);
4379 destroy ();
4380} 4461}
4381 4462
4382/*----------------------- end-of-file (C source) -----------------------*/ 4463/*----------------------- end-of-file (C source) -----------------------*/
4383 4464

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines