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.215 by root, Fri Dec 23 14:46:34 2005 UTC vs.
Revision 1.231 by root, Wed Jan 4 00:13:22 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
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} 164}
160#endif
161 165
162#if ENABLE_OVERLAY
163void 166void
164rxvt_term::iso14755_51 (unicode_t ch, rend_t r) 167rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y)
165{ 168{
166 rxvt_fontset *fs = FONTSET (r); 169 rxvt_fontset *fs = FONTSET (r);
167 rxvt_font *f = (*fs)[fs->find_font (ch)]; 170 rxvt_font *f = (*fs)[fs->find_font (ch)];
168 wchar_t *chr, *alloc, ch2, *fname; 171 wchar_t *chr, *alloc, ch2, *fname;
169 int len; 172 int len;
170 173
171 fname = rxvt_utf8towcs (f->name); 174 fname = rxvt_utf8towcs (f->name);
172 175
173#if ENABLE_COMBINING 176# if ENABLE_COMBINING
174 if (IS_COMPOSE (ch)) 177 if (IS_COMPOSE (ch))
175 { 178 {
176 len = rxvt_composite.expand (ch, 0); 179 len = rxvt_composite.expand (ch, 0);
177 alloc = chr = new wchar_t[len]; 180 alloc = chr = new wchar_t[len];
178 rxvt_composite.expand (ch, chr); 181 rxvt_composite.expand (ch, chr);
179 } 182 }
180 else 183 else
181#endif 184# endif
182 { 185 {
183 ch2 = ch; 186 ch2 = ch;
184 187
185 alloc = 0; 188 alloc = 0;
186 chr = &ch2; 189 chr = &ch2;
187 len = 1; 190 len = 1;
188 } 191 }
189 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
190 int width = wcswidth (fname, wcslen (fname)); 205 int width = wcswidth (fname, wcslen (fname));
191 206
192 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);
193 217
194 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); 218 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r));
195 219
196 for (int y = 0; y < len; y++) 220 for (int y = 0; y < len; y++)
197 { 221 {
200 ch = *chr++; 224 ch = *chr++;
201 225
202 sprintf (buf, "%8x", ch); 226 sprintf (buf, "%8x", ch);
203 scr_overlay_set (0, y, buf); 227 scr_overlay_set (0, y, buf);
204 scr_overlay_set (9, y, '='); 228 scr_overlay_set (9, y, '=');
205#if !UNICODE3 229# if !UNICODE3
206 if (ch >= 0x10000) 230 if (ch >= 0x10000)
207 ch = 0xfffd; 231 ch = 0xfffd;
208#endif 232# endif
209 scr_overlay_set (11, y, ch, r); 233 scr_overlay_set (11, y, ch, r);
210 scr_overlay_set (12, y, NOCHAR, r); 234 scr_overlay_set (12, y, NOCHAR, r);
211 } 235 }
212 236
237 scr_overlay_set (0, len , attr);
213 scr_overlay_set (0, len, fname); 238 scr_overlay_set (0, len + 1, fname);
214 239
215 free (fname); 240 free (fname);
216 241
217#if ENABLE_COMBINING 242# if ENABLE_COMBINING
218 if (alloc) 243 if (alloc)
219 delete [] alloc; 244 delete [] alloc;
220#endif 245# endif
221} 246}
222#endif 247#endif
223 248
224void 249void
225rxvt_term::commit_iso14755 () 250rxvt_term::commit_iso14755 ()
844 } 869 }
845 870
846 if (len <= 0) 871 if (len <= 0)
847 return; /* not mapped */ 872 return; /* not mapped */
848 873
849 if (options & Opt_scrollTtyKeypress) 874 if (OPTION (Opt_scrollTtyKeypress))
850 if (view_start) 875 if (view_start)
851 { 876 {
852 view_start = 0; 877 view_start = 0;
853 want_refresh = 1; 878 want_refresh = 1;
854 } 879 }
960 SET_LOCALE (locale); 985 SET_LOCALE (locale);
961 986
962 display->flush (); 987 display->flush ();
963 988
964 if (want_refresh && !flush_ev.active) 989 if (want_refresh && !flush_ev.active)
965 flush_ev.start (NOW + 0.01); 990 flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally
966} 991}
967 992
968void 993void
969rxvt_term::flush_cb (time_watcher &w) 994rxvt_term::flush_cb (time_watcher &w)
970{ 995{
1045 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1070 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1046 } 1071 }
1047} 1072}
1048#endif 1073#endif
1049 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
1050bool 1093bool
1051rxvt_term::pty_fill () 1094rxvt_term::pty_fill ()
1052{ 1095{
1053 ssize_t n = cmdbuf_endp - cmdbuf_ptr; 1096 ssize_t n = cmdbuf_endp - cmdbuf_ptr;
1054 1097
1060 1103
1061 memmove (cmdbuf_base, cmdbuf_ptr, n); 1104 memmove (cmdbuf_base, cmdbuf_ptr, n);
1062 cmdbuf_ptr = cmdbuf_base; 1105 cmdbuf_ptr = cmdbuf_base;
1063 cmdbuf_endp = cmdbuf_ptr + n; 1106 cmdbuf_endp = cmdbuf_ptr + n;
1064 1107
1065 n = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); 1108 ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n);
1066 1109
1067 if (n > 0) 1110 if (r > 0)
1068 { 1111 {
1069 cmdbuf_endp += n; 1112 cmdbuf_endp += r;
1070 return true; 1113 return true;
1071 } 1114 }
1072 else if ((n < 0 && errno != EAGAIN && errno != EINTR) || n == 0) 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
1073 { 1123 {
1074 pty_ev.stop (); 1124 pty_ev.stop ();
1075 1125
1076 if (!(options & Opt_hold)) 1126 if (!OPTION (Opt_hold))
1077 destroy (); 1127 destroy ();
1078 } 1128 }
1079 1129
1080 return false; 1130 return false;
1081} 1131}
1103 recolour_cursor (); 1153 recolour_cursor ();
1104 1154
1105#ifdef POINTER_BLANK 1155#ifdef POINTER_BLANK
1106 hidden_pointer = 0; 1156 hidden_pointer = 0;
1107 1157
1108 if (options & Opt_pointerBlank) 1158 if (OPTION (Opt_pointerBlank))
1109 pointer_ev.start (NOW + pointerBlankDelay); 1159 pointer_ev.start (NOW + pointerBlankDelay);
1110#endif 1160#endif
1111} 1161}
1112 1162
1113#ifdef POINTER_BLANK 1163#ifdef POINTER_BLANK
1114void 1164void
1115rxvt_term::pointer_blank () 1165rxvt_term::pointer_blank ()
1116{ 1166{
1117 if (! (options & Opt_pointerBlank)) 1167 if (! OPTION (Opt_pointerBlank))
1118 return; 1168 return;
1119 1169
1120 XDefineCursor (display->display, vt, display->blank_cursor); 1170 XDefineCursor (display->display, vt, display->blank_cursor);
1121 XFlush (display->display); 1171 XFlush (display->display);
1122 1172
1220 1270
1221 SET_R (this); 1271 SET_R (this);
1222 SET_LOCALE (locale); 1272 SET_LOCALE (locale);
1223 1273
1224#if defined(CURSOR_BLINK) 1274#if defined(CURSOR_BLINK)
1225 if ((options & Opt_cursorBlink) && ev.type == KeyPress) 1275 if (OPTION (Opt_cursorBlink) && ev.type == KeyPress)
1226 { 1276 {
1227 if (hidden_cursor) 1277 if (hidden_cursor)
1228 { 1278 {
1229 hidden_cursor = 0; 1279 hidden_cursor = 0;
1230 want_refresh = 1; 1280 want_refresh = 1;
1233 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1283 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1234 } 1284 }
1235#endif 1285#endif
1236 1286
1237#if defined(POINTER_BLANK) 1287#if defined(POINTER_BLANK)
1238 if ((options & Opt_pointerBlank) && pointerBlankDelay > 0) 1288 if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0)
1239 { 1289 {
1240 if (ev.type == MotionNotify 1290 if (ev.type == MotionNotify
1241 || ev.type == ButtonPress 1291 || ev.type == ButtonPress
1242 || ev.type == ButtonRelease) 1292 || ev.type == ButtonRelease)
1243 if (hidden_pointer) 1293 if (hidden_pointer)
1439 seen_resize = 1; 1489 seen_resize = 1;
1440 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1490 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1441 } 1491 }
1442 1492
1443#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ 1493#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */
1444 if (options & Opt_transparent) 1494 if (OPTION (Opt_transparent))
1445 check_our_parents (); 1495 check_our_parents ();
1446#endif 1496#endif
1447 } 1497 }
1448 break; 1498 break;
1449 1499
1650{ 1700{
1651 if (!focus) 1701 if (!focus)
1652 { 1702 {
1653 focus = 1; 1703 focus = 1;
1654 want_refresh = 1; 1704 want_refresh = 1;
1705
1706 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1707
1655#if USE_XIM 1708#if USE_XIM
1656 if (Input_Context != NULL) 1709 if (Input_Context != NULL)
1657 { 1710 {
1658 IMSetStatusPosition (); 1711 IMSetStatusPosition ();
1659 XSetICFocus (Input_Context); 1712 XSetICFocus (Input_Context);
1660 } 1713 }
1661#endif 1714#endif
1662#if CURSOR_BLINK 1715#if CURSOR_BLINK
1663 if (options & Opt_cursorBlink) 1716 if (OPTION (Opt_cursorBlink))
1664 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1717 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1665#endif 1718#endif
1666#if OFF_FOCUS_FADING 1719#if OFF_FOCUS_FADING
1667 if (rs[Rs_fade]) 1720 if (rs[Rs_fade])
1668 { 1721 {
1679 if (focus) 1732 if (focus)
1680 { 1733 {
1681 focus = 0; 1734 focus = 0;
1682 want_refresh = 1; 1735 want_refresh = 1;
1683 1736
1737 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1738
1684#if ENABLE_FRILLS || ISO_14755 1739#if ENABLE_FRILLS || ISO_14755
1740 if (iso14755buf)
1741 {
1685 iso14755buf = 0; 1742 iso14755buf = 0;
1686#endif
1687#if ENABLE_OVERLAY 1743# if ENABLE_OVERLAY
1688 scr_overlay_off (); 1744 scr_overlay_off ();
1745# endif
1746 }
1689#endif 1747#endif
1690#if USE_XIM 1748#if USE_XIM
1691 if (Input_Context != NULL) 1749 if (Input_Context != NULL)
1692 XUnsetICFocus (Input_Context); 1750 XUnsetICFocus (Input_Context);
1693#endif 1751#endif
1694#if CURSOR_BLINK 1752#if CURSOR_BLINK
1695 if (options & Opt_cursorBlink) 1753 if (OPTION (Opt_cursorBlink))
1696 cursor_blink_ev.stop (); 1754 cursor_blink_ev.stop ();
1697 hidden_cursor = 0; 1755 hidden_cursor = 0;
1698#endif 1756#endif
1699#if OFF_FOCUS_FADING 1757#if OFF_FOCUS_FADING
1700 if (rs[Rs_fade]) 1758 if (rs[Rs_fade])
1724 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) 1782 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID])
1725 return; 1783 return;
1726 1784
1727 /* FALLTHROUGH */ 1785 /* FALLTHROUGH */
1728 case ReparentNotify: 1786 case ReparentNotify:
1729 if ((options & Opt_transparent) && check_our_parents () && am_transparent) 1787 if (OPTION (Opt_transparent) && check_our_parents () && am_transparent)
1730 want_refresh = want_full_refresh = 1; 1788 want_refresh = want_full_refresh = 1;
1731 break; 1789 break;
1732 } 1790 }
1733} 1791}
1734#endif 1792#endif
1737rxvt_term::button_press (XButtonEvent &ev) 1795rxvt_term::button_press (XButtonEvent &ev)
1738{ 1796{
1739 int reportmode = 0, clickintime; 1797 int reportmode = 0, clickintime;
1740 1798
1741 bypass_keystate = ev.state & (ModMetaMask | ShiftMask); 1799 bypass_keystate = ev.state & (ModMetaMask | ShiftMask);
1800
1742 if (!bypass_keystate) 1801 if (!bypass_keystate)
1743 reportmode = !! (priv_modes & PrivMode_mouse_report); 1802 reportmode = !! (priv_modes & PrivMode_mouse_report);
1744 1803
1745 /* 1804 /*
1746 * VT window processing of button press 1805 * VT window processing of button press
1795 else 1854 else
1796 { 1855 {
1797 if (ev.button != MEvent.button) 1856 if (ev.button != MEvent.button)
1798 MEvent.clicks = 0; 1857 MEvent.clicks = 0;
1799 1858
1859 if (!PERL_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END)))
1800 switch (ev.button) 1860 switch (ev.button)
1801 { 1861 {
1802 case Button1: 1862 case Button1:
1803 /* allow meta + click to select rectangular areas */ 1863 /* allow meta + click to select rectangular areas */
1804 /* should be done in screen.C */ 1864 /* should be done in screen.C */
1805#if ENABLE_FRILLS 1865#if ENABLE_FRILLS
1806 selection.rect = !!(ev.state & ModMetaMask); 1866 selection.rect = !!(ev.state & ModMetaMask);
1807#else 1867#else
1808 selection.rect = false; 1868 selection.rect = false;
1809#endif 1869#endif
1810 1870
1811 /* allow shift+left click to extend selection */ 1871 /* allow shift+left click to extend selection */
1812 if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) 1872 if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report))
1813 { 1873 {
1814 if (MEvent.button == Button1 && clickintime) 1874 if (MEvent.button == Button1 && clickintime)
1815 selection_rotate (ev.x, ev.y); 1875 selection_rotate (ev.x, ev.y);
1816 else 1876 else
1817 selection_extend (ev.x, ev.y, 1); 1877 selection_extend (ev.x, ev.y, 1);
1818 } 1878 }
1819 else 1879 else
1820 { 1880 {
1821 if (MEvent.button == Button1 && clickintime) 1881 if (MEvent.button == Button1 && clickintime)
1822 MEvent.clicks++; 1882 MEvent.clicks++;
1823 else 1883 else
1824 MEvent.clicks = 1; 1884 MEvent.clicks = 1;
1825 1885
1826 selection_click (MEvent.clicks, ev.x, ev.y); 1886 selection_click (MEvent.clicks, ev.x, ev.y);
1827 } 1887 }
1828 1888
1829 MEvent.button = Button1; 1889 MEvent.button = Button1;
1830 break; 1890 break;
1831 1891
1832 case Button3: 1892 case Button3:
1833 if (MEvent.button == Button3 && clickintime) 1893 if (MEvent.button == Button3 && clickintime)
1834 selection_rotate (ev.x, ev.y); 1894 selection_rotate (ev.x, ev.y);
1835 else 1895 else
1836 selection_extend (ev.x, ev.y, 1); 1896 selection_extend (ev.x, ev.y, 1);
1837 1897
1838 MEvent.button = Button3; 1898 MEvent.button = Button3;
1839 break; 1899 break;
1840 } 1900 }
1841 } 1901 }
1842 1902
1843 MEvent.time = ev.time; 1903 MEvent.time = ev.time;
1844 return; 1904 return;
1845 } 1905 }
1846 1906
2076 2136
2077 v = ev.button == Button4 ? UP : DN; 2137 v = ev.button == Button4 ? UP : DN;
2078 2138
2079 if (ev.state & ShiftMask) 2139 if (ev.state & ShiftMask)
2080 i = 1; 2140 i = 1;
2081 else if (options & Opt_mouseWheelScrollPage) 2141 else if (OPTION (Opt_mouseWheelScrollPage))
2082 i = nrow - 1; 2142 i = nrow - 1;
2083 else 2143 else
2084 i = 5; 2144 i = 5;
2085 2145
2086# ifdef MOUSE_SLIP_WHEELING 2146# ifdef MOUSE_SLIP_WHEELING
2372 XWindowAttributes wattr, wrootattr; 2432 XWindowAttributes wattr, wrootattr;
2373 dDisp; 2433 dDisp;
2374 2434
2375 pchanged = 0; 2435 pchanged = 0;
2376 2436
2377 if (!(options & Opt_transparent)) 2437 if (!OPTION (Opt_transparent))
2378 return pchanged; /* Don't try any more */ 2438 return pchanged; /* Don't try any more */
2379 2439
2380 XGetWindowAttributes (disp, display->root, &wrootattr); 2440 XGetWindowAttributes (disp, display->root, &wrootattr);
2381 rootdepth = wrootattr.depth; 2441 rootdepth = wrootattr.depth;
2382 2442
2660 if (ch == C0_LF) 2720 if (ch == C0_LF)
2661 nlines++; 2721 nlines++;
2662 2722
2663 refresh_count++; 2723 refresh_count++;
2664 2724
2665 if (!(options & Opt_jumpScroll) 2725 if (!OPTION (Opt_jumpScroll)
2666 || (refresh_count >= refresh_limit * (nrow - 1))) 2726 || (refresh_count >= refresh_limit * (nrow - 1)))
2667 { 2727 {
2668 refreshnow = true; 2728 refreshnow = true;
2729 refresh_count = 0;
2669 ch = NOCHAR; 2730 ch = NOCHAR;
2670 break; 2731 break;
2671 } 2732 }
2672 2733
2673 // scr_add_lines only works for nlines <= nrow - 1. 2734 // scr_add_lines only works for nlines <= nrow - 1.
2704 * the number of pages between refreshes is refresh_limit, which 2765 * the number of pages between refreshes is refresh_limit, which
2705 * is incremented here because we must be doing flat-out scrolling. 2766 * is incremented here because we must be doing flat-out scrolling.
2706 */ 2767 */
2707 if (refreshnow) 2768 if (refreshnow)
2708 { 2769 {
2709 if ((options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) 2770 if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
2710 refresh_limit++; 2771 refresh_limit++;
2711 else 2772 else
2712 { 2773 {
2713 flag = true; 2774 flag = true;
2714 scr_refresh (refresh_type); 2775 scr_refresh (refresh_type);
2776 flush_ev.stop ();
2715 } 2777 }
2716 } 2778 }
2717 2779
2718 } 2780 }
2719 else 2781 else
3378 break; 3440 break;
3379 case 6: /* CPR requested */ 3441 case 6: /* CPR requested */
3380 scr_report_position (); 3442 scr_report_position ();
3381 break; 3443 break;
3382 case 7: /* unofficial extension */ 3444 case 7: /* unofficial extension */
3383 if (options & Opt_insecure) 3445 if (OPTION (Opt_insecure))
3384 tt_printf ("%-.250s\012", rs[Rs_display_name]); 3446 tt_printf ("%-.250s\012", rs[Rs_display_name]);
3385 break; 3447 break;
3386 case 8: /* unofficial extension */ 3448 case 8: /* unofficial extension */
3387 process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); 3449 process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST);
3388 break; 3450 break;
3552 break; 3614 break;
3553 case 20: /* report icon label */ 3615 case 20: /* report icon label */
3554 { 3616 {
3555 char *s; 3617 char *s;
3556 XGetIconName (disp, parent[0], &s); 3618 XGetIconName (disp, parent[0], &s);
3557 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 */
3558 XFree (s); 3620 XFree (s);
3559 } 3621 }
3560 break; 3622 break;
3561 case 21: /* report window title */ 3623 case 21: /* report window title */
3562 { 3624 {
3563 char *s; 3625 char *s;
3564 XFetchName (disp, parent[0], &s); 3626 XFetchName (disp, parent[0], &s);
3565 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 */
3566 XFree (s); 3628 XFree (s);
3567 } 3629 }
3568 break; 3630 break;
3569 } 3631 }
3570} 3632}
3846 // TODO, when secure mode? 3908 // TODO, when secure mode?
3847 break; 3909 break;
3848 3910
3849#ifdef MENUBAR 3911#ifdef MENUBAR
3850 case URxvt_Menu: 3912 case URxvt_Menu:
3851 if (options & Opt_insecure) 3913 if (OPTION (Opt_insecure))
3852 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked 3914 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked
3853 break; 3915 break;
3854#endif 3916#endif
3855#if 0 3917#if 0
3856 case XTerm_dumpscreen: /* no error notices */ 3918 case XTerm_dumpscreen: /* no error notices */
3872 case URxvt_italicFont: 3934 case URxvt_italicFont:
3873 case URxvt_boldItalicFont: 3935 case URxvt_boldItalicFont:
3874#endif 3936#endif
3875 if (query) 3937 if (query)
3876 tt_printf ("\33]%d;%-.250s%c", saveop, 3938 tt_printf ("\33]%d;%-.250s%c", saveop,
3877 (options & Opt_insecure) && fontset[op - URxvt_font]->fontdesc 3939 OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc
3878 ? fontset[op - URxvt_font]->fontdesc : "", 3940 ? fontset[op - URxvt_font]->fontdesc : "",
3879 resp); 3941 resp);
3880 else 3942 else
3881 { 3943 {
3882 const char *&res = rs[Rs_font + (op - URxvt_font)]; 3944 const char *&res = rs[Rs_font + (op - URxvt_font)];
3888 break; 3950 break;
3889 3951
3890#if ENABLE_FRILLS 3952#if ENABLE_FRILLS
3891 case URxvt_locale: 3953 case URxvt_locale:
3892 if (query) 3954 if (query)
3893 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);
3894 else 3956 else
3895 { 3957 {
3896 set_locale (str); 3958 set_locale (str);
3897 pty.set_utf8_mode (enc_utf8); 3959 pty.set_utf8_mode (enc_utf8);
3898 init_xlocale (); 3960 init_xlocale ();
3899 } 3961 }
3900 break; 3962 break;
3901 3963
3902 case URxvt_view_up: 3964 case URxvt_view_up:
3903 case URxvt_view_down: 3965 case URxvt_view_down:
3966 {
3904 int lines = atoi (str); 3967 int lines = atoi (str);
3905 3968
3906 if (lines) 3969 if (lines)
3907 scr_page (op == URxvt_view_up ? UP : DN, lines); 3970 scr_page (op == URxvt_view_up ? UP : DN, lines);
3908 else 3971 else
3909 {
3910 scr_erase_savelines (); 3972 scr_erase_savelines ();
3911 } 3973 }
3912 3974
3975 break;
3976#endif
3977
3978#if ENABLE_PERL
3979 case URxvt_perl:
3980 if (PERL_INVOKE ((this, HOOK_OSC_SEQ, DT_STRING, str, DT_END)))
3981 ; // no responses yet
3913 break; 3982 break;
3914#endif 3983#endif
3915 } 3984 }
3916} 3985}
3917/*----------------------------------------------------------------------*/ 3986/*----------------------------------------------------------------------*/
4026 } 4095 }
4027 4096
4028 /* extra handling for values with state unkept */ 4097 /* extra handling for values with state unkept */
4029 switch (arg[i]) 4098 switch (arg[i])
4030 { 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
4031 case 1048: /* alternative cursor save */ 4110 case 1048: /* alternative cursor save */
4032 case 1049: 4111 case 1049:
4033 if (options & Opt_secondaryScreen) 4112 if (OPTION (Opt_secondaryScreen))
4034 if (mode == 0) 4113 if (mode == 0)
4035 scr_cursor (RESTORE); 4114 scr_cursor (RESTORE);
4036 else if (mode == 1) 4115 else if (mode == 1)
4037 scr_cursor (SAVE); 4116 scr_cursor (SAVE);
4038 break; 4117 break;
4053 case 3: /* 80/132 */ 4132 case 3: /* 80/132 */
4054 if (priv_modes & PrivMode_132OK) 4133 if (priv_modes & PrivMode_132OK)
4055 set_widthheight (((state ? 132 : 80) * fwidth), height); 4134 set_widthheight (((state ? 132 : 80) * fwidth), height);
4056 break; 4135 break;
4057 case 4: /* smooth scrolling */ 4136 case 4: /* smooth scrolling */
4058 if (state) 4137 if (!state)
4059 options &= ~Opt_jumpScroll; 4138 SET_OPTION (Opt_jumpScroll);
4060 else 4139 else
4061 options |= Opt_jumpScroll; 4140 CLR_OPTION (Opt_jumpScroll);
4062 break; 4141 break;
4063 case 5: /* reverse video */ 4142 case 5: /* reverse video */
4064 scr_rvideo_mode (state); 4143 scr_rvideo_mode (state);
4065 break; 4144 break;
4066 case 6: /* relative/absolute origins */ 4145 case 6: /* relative/absolute origins */
4107#if 0 4186#if 0
4108 case 1001: 4187 case 1001:
4109 break; /* X11 mouse highlighting */ 4188 break; /* X11 mouse highlighting */
4110#endif 4189#endif
4111 case 1010: /* scroll to bottom on TTY output inhibit */ 4190 case 1010: /* scroll to bottom on TTY output inhibit */
4112 if (state) 4191 if (!state)
4113 options &= ~Opt_scrollTtyOutput; 4192 SET_OPTION (Opt_scrollTtyOutput);
4114 else 4193 else
4115 options |= Opt_scrollTtyOutput; 4194 CLR_OPTION (Opt_scrollTtyOutput);
4116 break; 4195 break;
4117 case 1011: /* scroll to bottom on key press */ 4196 case 1011: /* scroll to bottom on key press */
4118 if (state) 4197 if (state)
4119 options |= Opt_scrollTtyKeypress; 4198 SET_OPTION (Opt_scrollTtyKeypress);
4120 else 4199 else
4121 options &= ~Opt_scrollTtyKeypress; 4200 CLR_OPTION (Opt_scrollTtyKeypress);
4122 break; 4201 break;
4123 case 1047: /* secondary screen w/ clearing last */ 4202 case 1047: /* secondary screen w/ clearing last */
4124 if (options & Opt_secondaryScreen) 4203 if (OPTION (Opt_secondaryScreen))
4125 if (current_screen != PRIMARY) 4204 if (current_screen != PRIMARY)
4126 scr_erase_screen (2); 4205 scr_erase_screen (2);
4127 scr_change_screen (state); 4206 scr_change_screen (state);
4128 break; 4207 break;
4129 case 1049: /* secondary screen w/ clearing first */ 4208 case 1049: /* secondary screen w/ clearing first */
4130 scr_change_screen (state); 4209 scr_change_screen (state);
4131 if (options & Opt_secondaryScreen) 4210 if (OPTION (Opt_secondaryScreen))
4132 if (current_screen != PRIMARY) 4211 if (current_screen != PRIMARY)
4133 scr_erase_screen (2); 4212 scr_erase_screen (2);
4134 break; 4213 break;
4135 default: 4214 default:
4136 break; 4215 break;
4286 case 106: 4365 case 106:
4287 case 107: 4366 case 107:
4288 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); 4367 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg);
4289 break; 4368 break;
4290#endif 4369#endif
4291
4292 } 4370 }
4293 } 4371 }
4294} 4372}
4295/*}}} */ 4373/*}}} */
4296 4374

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines