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.214 by root, Thu Dec 22 21:56:19 2005 UTC vs.
Revision 1.232 by root, Wed Jan 4 01:10:08 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#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
147 153
148 text_t t = l.t[x]; 154 text_t t = l.t[x];
149 155
150 if (t != NOCHAR || !x) 156 if (t != NOCHAR || !x)
151 { 157 {
152 iso14755_51 (l.t[x], l.r[x]); 158 iso14755_51 (l.t[x], l.r[x], x, y);
153 iso14755buf = ISO_14755_54; 159 iso14755buf = ISO_14755_54;
154 break; 160 break;
155 } 161 }
156 162
157 x--; 163 x--;
158 } 164 }
159} 165}
160#endif
161 166
162#if ENABLE_OVERLAY
163void 167void
164rxvt_term::iso14755_51 (unicode_t ch, rend_t r) 168rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y)
165{ 169{
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
171 fname = rxvt_utf8towcs (f->name); 175 fname = rxvt_utf8towcs (f->name);
172 176
173#if ENABLE_COMBINING 177# if ENABLE_COMBINING
174 if (IS_COMPOSE (ch)) 178 if (IS_COMPOSE (ch))
175 { 179 {
176 len = rxvt_composite.expand (ch, 0); 180 len = rxvt_composite.expand (ch, 0);
177 alloc = chr = new wchar_t[len]; 181 alloc = chr = new wchar_t[len];
178 rxvt_composite.expand (ch, chr); 182 rxvt_composite.expand (ch, chr);
179 } 183 }
180 else 184 else
181#endif 185# endif
182 { 186 {
183 ch2 = ch; 187 ch2 = ch;
184 188
185 alloc = 0; 189 alloc = 0;
186 chr = &ch2; 190 chr = &ch2;
187 len = 1; 191 len = 1;
188 } 192 }
189 193
194 char attr[80]; // plenty
195
196 sprintf (attr, "%08x = fg %d bg %d%s%s%s%s%s%s",
197 (int)r,
198 fgcolor_of (r), bgcolor_of (r),
199 r & RS_Bold ? " bold" : "",
200 r & RS_Italic ? " italic" : "",
201 r & RS_Blink ? " blink" : "",
202 r & RS_RVid ? " rvid" : "",
203 r & RS_Uline ? " uline" : "",
204 r & RS_Careful ? " careful" : "");
205
190 int width = wcswidth (fname, wcslen (fname)); 206 int width = wcswidth (fname, wcslen (fname));
191 207
192 scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1); 208 max_it (width, 8+5); // for char + hey
209 max_it (width, strlen (attr));
210
211 if (y >= 0)
212 {
213 y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1;
214 x = 0;
215 }
216
217 scr_overlay_new (x, y, width, len + 2);
193 218
194 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); 219 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r));
195 220
196 for (int y = 0; y < len; y++) 221 for (int y = 0; y < len; y++)
197 { 222 {
200 ch = *chr++; 225 ch = *chr++;
201 226
202 sprintf (buf, "%8x", ch); 227 sprintf (buf, "%8x", ch);
203 scr_overlay_set (0, y, buf); 228 scr_overlay_set (0, y, buf);
204 scr_overlay_set (9, y, '='); 229 scr_overlay_set (9, y, '=');
205#if !UNICODE3 230# if !UNICODE3
206 if (ch >= 0x10000) 231 if (ch >= 0x10000)
207 ch = 0xfffd; 232 ch = 0xfffd;
208#endif 233# endif
209 scr_overlay_set (11, y, ch, r); 234 scr_overlay_set (11, y, ch, r);
210 scr_overlay_set (12, y, NOCHAR, r); 235 scr_overlay_set (12, y, NOCHAR, r);
211 } 236 }
212 237
238 scr_overlay_set (0, len , attr);
213 scr_overlay_set (0, len, fname); 239 scr_overlay_set (0, len + 1, fname);
214 240
215 free (fname); 241 free (fname);
216 242
217#if ENABLE_COMBINING 243# if ENABLE_COMBINING
218 if (alloc) 244 if (alloc)
219 delete [] alloc; 245 delete [] alloc;
220#endif 246# endif
221} 247}
222#endif 248#endif
223 249
224void 250void
225rxvt_term::commit_iso14755 () 251rxvt_term::commit_iso14755 ()
844 } 870 }
845 871
846 if (len <= 0) 872 if (len <= 0)
847 return; /* not mapped */ 873 return; /* not mapped */
848 874
849 if (options & Opt_scrollTtyKeypress) 875 if (OPTION (Opt_scrollTtyKeypress))
850 if (view_start) 876 if (view_start)
851 { 877 {
852 view_start = 0; 878 view_start = 0;
853 want_refresh = 1; 879 want_refresh = 1;
854 } 880 }
960 SET_LOCALE (locale); 986 SET_LOCALE (locale);
961 987
962 display->flush (); 988 display->flush ();
963 989
964 if (want_refresh && !flush_ev.active) 990 if (want_refresh && !flush_ev.active)
965 flush_ev.start (NOW + 0.01); 991 flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally
966} 992}
967 993
968void 994void
969rxvt_term::flush_cb (time_watcher &w) 995rxvt_term::flush_cb (time_watcher &w)
970{ 996{
1045 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1071 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1046 } 1072 }
1047} 1073}
1048#endif 1074#endif
1049 1075
1076#if HAVE_SCHED_YIELD
1077static 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
1050bool 1094bool
1051rxvt_term::pty_fill () 1095rxvt_term::pty_fill ()
1052{ 1096{
1053 ssize_t n = cmdbuf_endp - cmdbuf_ptr; 1097 ssize_t n = cmdbuf_endp - cmdbuf_ptr;
1054 1098
1060 1104
1061 memmove (cmdbuf_base, cmdbuf_ptr, n); 1105 memmove (cmdbuf_base, cmdbuf_ptr, n);
1062 cmdbuf_ptr = cmdbuf_base; 1106 cmdbuf_ptr = cmdbuf_base;
1063 cmdbuf_endp = cmdbuf_ptr + n; 1107 cmdbuf_endp = cmdbuf_ptr + n;
1064 1108
1065 n = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); 1109 ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n);
1066 1110
1067 if (n > 0) 1111 if (r > 0)
1068 { 1112 {
1069 cmdbuf_endp += n; 1113 cmdbuf_endp += r;
1070 return true; 1114 return true;
1071 } 1115 }
1072 else if (n < 0 && errno != EAGAIN && errno != EINTR) 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
1124 {
1073 pty_ev.stop (); 1125 pty_ev.stop ();
1126
1127 if (!OPTION (Opt_hold))
1128 destroy ();
1129 }
1074 1130
1075 return false; 1131 return false;
1076} 1132}
1077 1133
1078void 1134void
1098 recolour_cursor (); 1154 recolour_cursor ();
1099 1155
1100#ifdef POINTER_BLANK 1156#ifdef POINTER_BLANK
1101 hidden_pointer = 0; 1157 hidden_pointer = 0;
1102 1158
1103 if (options & Opt_pointerBlank) 1159 if (OPTION (Opt_pointerBlank))
1104 pointer_ev.start (NOW + pointerBlankDelay); 1160 pointer_ev.start (NOW + pointerBlankDelay);
1105#endif 1161#endif
1106} 1162}
1107 1163
1108#ifdef POINTER_BLANK 1164#ifdef POINTER_BLANK
1109void 1165void
1110rxvt_term::pointer_blank () 1166rxvt_term::pointer_blank ()
1111{ 1167{
1112 if (! (options & Opt_pointerBlank)) 1168 if (! OPTION (Opt_pointerBlank))
1113 return; 1169 return;
1114 1170
1115 XDefineCursor (display->display, vt, display->blank_cursor); 1171 XDefineCursor (display->display, vt, display->blank_cursor);
1116 XFlush (display->display); 1172 XFlush (display->display);
1117 1173
1215 1271
1216 SET_R (this); 1272 SET_R (this);
1217 SET_LOCALE (locale); 1273 SET_LOCALE (locale);
1218 1274
1219#if defined(CURSOR_BLINK) 1275#if defined(CURSOR_BLINK)
1220 if ((options & Opt_cursorBlink) && ev.type == KeyPress) 1276 if (OPTION (Opt_cursorBlink) && ev.type == KeyPress)
1221 { 1277 {
1222 if (hidden_cursor) 1278 if (hidden_cursor)
1223 { 1279 {
1224 hidden_cursor = 0; 1280 hidden_cursor = 0;
1225 want_refresh = 1; 1281 want_refresh = 1;
1228 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1284 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1229 } 1285 }
1230#endif 1286#endif
1231 1287
1232#if defined(POINTER_BLANK) 1288#if defined(POINTER_BLANK)
1233 if ((options & Opt_pointerBlank) && pointerBlankDelay > 0) 1289 if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0)
1234 { 1290 {
1235 if (ev.type == MotionNotify 1291 if (ev.type == MotionNotify
1236 || ev.type == ButtonPress 1292 || ev.type == ButtonPress
1237 || ev.type == ButtonRelease) 1293 || ev.type == ButtonRelease)
1238 if (hidden_pointer) 1294 if (hidden_pointer)
1434 seen_resize = 1; 1490 seen_resize = 1;
1435 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1491 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1436 } 1492 }
1437 1493
1438#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ 1494#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */
1439 if (options & Opt_transparent) 1495 if (OPTION (Opt_transparent))
1440 check_our_parents (); 1496 check_our_parents ();
1441#endif 1497#endif
1442 } 1498 }
1443 break; 1499 break;
1444 1500
1645{ 1701{
1646 if (!focus) 1702 if (!focus)
1647 { 1703 {
1648 focus = 1; 1704 focus = 1;
1649 want_refresh = 1; 1705 want_refresh = 1;
1706
1707 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1708
1650#if USE_XIM 1709#if USE_XIM
1651 if (Input_Context != NULL) 1710 if (Input_Context != NULL)
1652 { 1711 {
1653 IMSetStatusPosition (); 1712 IMSetStatusPosition ();
1654 XSetICFocus (Input_Context); 1713 XSetICFocus (Input_Context);
1655 } 1714 }
1656#endif 1715#endif
1657#if CURSOR_BLINK 1716#if CURSOR_BLINK
1658 if (options & Opt_cursorBlink) 1717 if (OPTION (Opt_cursorBlink))
1659 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1718 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1660#endif 1719#endif
1661#if OFF_FOCUS_FADING 1720#if OFF_FOCUS_FADING
1662 if (rs[Rs_fade]) 1721 if (rs[Rs_fade])
1663 { 1722 {
1674 if (focus) 1733 if (focus)
1675 { 1734 {
1676 focus = 0; 1735 focus = 0;
1677 want_refresh = 1; 1736 want_refresh = 1;
1678 1737
1738 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1739
1679#if ENABLE_FRILLS || ISO_14755 1740#if ENABLE_FRILLS || ISO_14755
1741 if (iso14755buf)
1742 {
1680 iso14755buf = 0; 1743 iso14755buf = 0;
1681#endif
1682#if ENABLE_OVERLAY 1744# if ENABLE_OVERLAY
1683 scr_overlay_off (); 1745 scr_overlay_off ();
1746# endif
1747 }
1684#endif 1748#endif
1685#if USE_XIM 1749#if USE_XIM
1686 if (Input_Context != NULL) 1750 if (Input_Context != NULL)
1687 XUnsetICFocus (Input_Context); 1751 XUnsetICFocus (Input_Context);
1688#endif 1752#endif
1689#if CURSOR_BLINK 1753#if CURSOR_BLINK
1690 if (options & Opt_cursorBlink) 1754 if (OPTION (Opt_cursorBlink))
1691 cursor_blink_ev.stop (); 1755 cursor_blink_ev.stop ();
1692 hidden_cursor = 0; 1756 hidden_cursor = 0;
1693#endif 1757#endif
1694#if OFF_FOCUS_FADING 1758#if OFF_FOCUS_FADING
1695 if (rs[Rs_fade]) 1759 if (rs[Rs_fade])
1719 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) 1783 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID])
1720 return; 1784 return;
1721 1785
1722 /* FALLTHROUGH */ 1786 /* FALLTHROUGH */
1723 case ReparentNotify: 1787 case ReparentNotify:
1724 if ((options & Opt_transparent) && check_our_parents () && am_transparent) 1788 if (OPTION (Opt_transparent) && check_our_parents () && am_transparent)
1725 want_refresh = want_full_refresh = 1; 1789 want_refresh = want_full_refresh = 1;
1726 break; 1790 break;
1727 } 1791 }
1728} 1792}
1729#endif 1793#endif
1732rxvt_term::button_press (XButtonEvent &ev) 1796rxvt_term::button_press (XButtonEvent &ev)
1733{ 1797{
1734 int reportmode = 0, clickintime; 1798 int reportmode = 0, clickintime;
1735 1799
1736 bypass_keystate = ev.state & (ModMetaMask | ShiftMask); 1800 bypass_keystate = ev.state & (ModMetaMask | ShiftMask);
1801
1737 if (!bypass_keystate) 1802 if (!bypass_keystate)
1738 reportmode = !! (priv_modes & PrivMode_mouse_report); 1803 reportmode = !! (priv_modes & PrivMode_mouse_report);
1739 1804
1740 /* 1805 /*
1741 * VT window processing of button press 1806 * VT window processing of button press
1790 else 1855 else
1791 { 1856 {
1792 if (ev.button != MEvent.button) 1857 if (ev.button != MEvent.button)
1793 MEvent.clicks = 0; 1858 MEvent.clicks = 0;
1794 1859
1860 if (!PERL_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END)))
1795 switch (ev.button) 1861 switch (ev.button)
1796 { 1862 {
1797 case Button1: 1863 case Button1:
1798 /* allow meta + click to select rectangular areas */ 1864 /* allow meta + click to select rectangular areas */
1799 /* should be done in screen.C */ 1865 /* should be done in screen.C */
1800#if ENABLE_FRILLS 1866#if ENABLE_FRILLS
1801 selection.rect = !!(ev.state & ModMetaMask); 1867 selection.rect = !!(ev.state & ModMetaMask);
1802#else 1868#else
1803 selection.rect = false; 1869 selection.rect = false;
1804#endif 1870#endif
1805 1871
1806 /* allow shift+left click to extend selection */ 1872 /* allow shift+left click to extend selection */
1807 if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) 1873 if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report))
1808 { 1874 {
1809 if (MEvent.button == Button1 && clickintime) 1875 if (MEvent.button == Button1 && clickintime)
1810 selection_rotate (ev.x, ev.y); 1876 selection_rotate (ev.x, ev.y);
1811 else 1877 else
1812 selection_extend (ev.x, ev.y, 1); 1878 selection_extend (ev.x, ev.y, 1);
1813 } 1879 }
1814 else 1880 else
1815 { 1881 {
1816 if (MEvent.button == Button1 && clickintime) 1882 if (MEvent.button == Button1 && clickintime)
1817 MEvent.clicks++; 1883 MEvent.clicks++;
1818 else 1884 else
1819 MEvent.clicks = 1; 1885 MEvent.clicks = 1;
1820 1886
1821 selection_click (MEvent.clicks, ev.x, ev.y); 1887 selection_click (MEvent.clicks, ev.x, ev.y);
1822 } 1888 }
1823 1889
1824 MEvent.button = Button1; 1890 MEvent.button = Button1;
1825 break; 1891 break;
1826 1892
1827 case Button3: 1893 case Button3:
1828 if (MEvent.button == Button3 && clickintime) 1894 if (MEvent.button == Button3 && clickintime)
1829 selection_rotate (ev.x, ev.y); 1895 selection_rotate (ev.x, ev.y);
1830 else 1896 else
1831 selection_extend (ev.x, ev.y, 1); 1897 selection_extend (ev.x, ev.y, 1);
1832 1898
1833 MEvent.button = Button3; 1899 MEvent.button = Button3;
1834 break; 1900 break;
1835 } 1901 }
1836 } 1902 }
1837 1903
1838 MEvent.time = ev.time; 1904 MEvent.time = ev.time;
1839 return; 1905 return;
1840 } 1906 }
1841 1907
2071 2137
2072 v = ev.button == Button4 ? UP : DN; 2138 v = ev.button == Button4 ? UP : DN;
2073 2139
2074 if (ev.state & ShiftMask) 2140 if (ev.state & ShiftMask)
2075 i = 1; 2141 i = 1;
2076 else if (options & Opt_mouseWheelScrollPage) 2142 else if (OPTION (Opt_mouseWheelScrollPage))
2077 i = nrow - 1; 2143 i = nrow - 1;
2078 else 2144 else
2079 i = 5; 2145 i = 5;
2080 2146
2081# ifdef MOUSE_SLIP_WHEELING 2147# ifdef MOUSE_SLIP_WHEELING
2367 XWindowAttributes wattr, wrootattr; 2433 XWindowAttributes wattr, wrootattr;
2368 dDisp; 2434 dDisp;
2369 2435
2370 pchanged = 0; 2436 pchanged = 0;
2371 2437
2372 if (!(options & Opt_transparent)) 2438 if (!OPTION (Opt_transparent))
2373 return pchanged; /* Don't try any more */ 2439 return pchanged; /* Don't try any more */
2374 2440
2375 XGetWindowAttributes (disp, display->root, &wrootattr); 2441 XGetWindowAttributes (disp, display->root, &wrootattr);
2376 rootdepth = wrootattr.depth; 2442 rootdepth = wrootattr.depth;
2377 2443
2655 if (ch == C0_LF) 2721 if (ch == C0_LF)
2656 nlines++; 2722 nlines++;
2657 2723
2658 refresh_count++; 2724 refresh_count++;
2659 2725
2660 if (!(options & Opt_jumpScroll) 2726 if (!OPTION (Opt_jumpScroll)
2661 || (refresh_count >= refresh_limit * (nrow - 1))) 2727 || (refresh_count >= refresh_limit * (nrow - 1)))
2662 { 2728 {
2663 refreshnow = true; 2729 refreshnow = true;
2730 refresh_count = 0;
2664 ch = NOCHAR; 2731 ch = NOCHAR;
2665 break; 2732 break;
2666 } 2733 }
2667 2734
2668 // scr_add_lines only works for nlines <= nrow - 1. 2735 // scr_add_lines only works for nlines <= nrow - 1.
2699 * the number of pages between refreshes is refresh_limit, which 2766 * the number of pages between refreshes is refresh_limit, which
2700 * is incremented here because we must be doing flat-out scrolling. 2767 * is incremented here because we must be doing flat-out scrolling.
2701 */ 2768 */
2702 if (refreshnow) 2769 if (refreshnow)
2703 { 2770 {
2704 if ((options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) 2771 if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
2705 refresh_limit++; 2772 refresh_limit++;
2706 else 2773 else
2707 { 2774 {
2708 flag = true; 2775 flag = true;
2709 scr_refresh (refresh_type); 2776 scr_refresh (refresh_type);
2777 flush_ev.stop ();
2710 } 2778 }
2711 } 2779 }
2712 2780
2713 } 2781 }
2714 else 2782 else
3373 break; 3441 break;
3374 case 6: /* CPR requested */ 3442 case 6: /* CPR requested */
3375 scr_report_position (); 3443 scr_report_position ();
3376 break; 3444 break;
3377 case 7: /* unofficial extension */ 3445 case 7: /* unofficial extension */
3378 if (options & Opt_insecure) 3446 if (OPTION (Opt_insecure))
3379 tt_printf ("%-.250s\012", rs[Rs_display_name]); 3447 tt_printf ("%-.250s\012", rs[Rs_display_name]);
3380 break; 3448 break;
3381 case 8: /* unofficial extension */ 3449 case 8: /* unofficial extension */
3382 process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); 3450 process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST);
3383 break; 3451 break;
3547 break; 3615 break;
3548 case 20: /* report icon label */ 3616 case 20: /* report icon label */
3549 { 3617 {
3550 char *s; 3618 char *s;
3551 XGetIconName (disp, parent[0], &s); 3619 XGetIconName (disp, parent[0], &s);
3552 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 */
3553 XFree (s); 3621 XFree (s);
3554 } 3622 }
3555 break; 3623 break;
3556 case 21: /* report window title */ 3624 case 21: /* report window title */
3557 { 3625 {
3558 char *s; 3626 char *s;
3559 XFetchName (disp, parent[0], &s); 3627 XFetchName (disp, parent[0], &s);
3560 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 */
3561 XFree (s); 3629 XFree (s);
3562 } 3630 }
3563 break; 3631 break;
3564 } 3632 }
3565} 3633}
3841 // TODO, when secure mode? 3909 // TODO, when secure mode?
3842 break; 3910 break;
3843 3911
3844#ifdef MENUBAR 3912#ifdef MENUBAR
3845 case URxvt_Menu: 3913 case URxvt_Menu:
3846 if (options & Opt_insecure) 3914 if (OPTION (Opt_insecure))
3847 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked 3915 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked
3848 break; 3916 break;
3849#endif 3917#endif
3850#if 0 3918#if 0
3851 case XTerm_dumpscreen: /* no error notices */ 3919 case XTerm_dumpscreen: /* no error notices */
3867 case URxvt_italicFont: 3935 case URxvt_italicFont:
3868 case URxvt_boldItalicFont: 3936 case URxvt_boldItalicFont:
3869#endif 3937#endif
3870 if (query) 3938 if (query)
3871 tt_printf ("\33]%d;%-.250s%c", saveop, 3939 tt_printf ("\33]%d;%-.250s%c", saveop,
3872 (options & Opt_insecure) && fontset[op - URxvt_font]->fontdesc 3940 OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc
3873 ? fontset[op - URxvt_font]->fontdesc : "", 3941 ? fontset[op - URxvt_font]->fontdesc : "",
3874 resp); 3942 resp);
3875 else 3943 else
3876 { 3944 {
3877 const char *&res = rs[Rs_font + (op - URxvt_font)]; 3945 const char *&res = rs[Rs_font + (op - URxvt_font)];
3883 break; 3951 break;
3884 3952
3885#if ENABLE_FRILLS 3953#if ENABLE_FRILLS
3886 case URxvt_locale: 3954 case URxvt_locale:
3887 if (query) 3955 if (query)
3888 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);
3889 else 3957 else
3890 { 3958 {
3891 set_locale (str); 3959 set_locale (str);
3892 pty.set_utf8_mode (enc_utf8); 3960 pty.set_utf8_mode (enc_utf8);
3893 init_xlocale (); 3961 init_xlocale ();
3894 } 3962 }
3895 break; 3963 break;
3896 3964
3897 case URxvt_view_up: 3965 case URxvt_view_up:
3898 case URxvt_view_down: 3966 case URxvt_view_down:
3967 {
3899 int lines = atoi (str); 3968 int lines = atoi (str);
3900 3969
3901 if (lines) 3970 if (lines)
3902 scr_page (op == URxvt_view_up ? UP : DN, lines); 3971 scr_page (op == URxvt_view_up ? UP : DN, lines);
3903 else 3972 else
3904 {
3905 scr_erase_savelines (); 3973 scr_erase_savelines ();
3906 } 3974 }
3907 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
3908 break; 3983 break;
3909#endif 3984#endif
3910 } 3985 }
3911} 3986}
3912/*----------------------------------------------------------------------*/ 3987/*----------------------------------------------------------------------*/
4021 } 4096 }
4022 4097
4023 /* extra handling for values with state unkept */ 4098 /* extra handling for values with state unkept */
4024 switch (arg[i]) 4099 switch (arg[i])
4025 { 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
4026 case 1048: /* alternative cursor save */ 4111 case 1048: /* alternative cursor save */
4027 case 1049: 4112 case 1049:
4028 if (options & Opt_secondaryScreen) 4113 if (OPTION (Opt_secondaryScreen))
4029 if (mode == 0) 4114 if (mode == 0)
4030 scr_cursor (RESTORE); 4115 scr_cursor (RESTORE);
4031 else if (mode == 1) 4116 else if (mode == 1)
4032 scr_cursor (SAVE); 4117 scr_cursor (SAVE);
4033 break; 4118 break;
4048 case 3: /* 80/132 */ 4133 case 3: /* 80/132 */
4049 if (priv_modes & PrivMode_132OK) 4134 if (priv_modes & PrivMode_132OK)
4050 set_widthheight (((state ? 132 : 80) * fwidth), height); 4135 set_widthheight (((state ? 132 : 80) * fwidth), height);
4051 break; 4136 break;
4052 case 4: /* smooth scrolling */ 4137 case 4: /* smooth scrolling */
4053 if (state) 4138 if (!state)
4054 options &= ~Opt_jumpScroll; 4139 SET_OPTION (Opt_jumpScroll);
4055 else 4140 else
4056 options |= Opt_jumpScroll; 4141 CLR_OPTION (Opt_jumpScroll);
4057 break; 4142 break;
4058 case 5: /* reverse video */ 4143 case 5: /* reverse video */
4059 scr_rvideo_mode (state); 4144 scr_rvideo_mode (state);
4060 break; 4145 break;
4061 case 6: /* relative/absolute origins */ 4146 case 6: /* relative/absolute origins */
4102#if 0 4187#if 0
4103 case 1001: 4188 case 1001:
4104 break; /* X11 mouse highlighting */ 4189 break; /* X11 mouse highlighting */
4105#endif 4190#endif
4106 case 1010: /* scroll to bottom on TTY output inhibit */ 4191 case 1010: /* scroll to bottom on TTY output inhibit */
4107 if (state) 4192 if (!state)
4108 options &= ~Opt_scrollTtyOutput; 4193 SET_OPTION (Opt_scrollTtyOutput);
4109 else 4194 else
4110 options |= Opt_scrollTtyOutput; 4195 CLR_OPTION (Opt_scrollTtyOutput);
4111 break; 4196 break;
4112 case 1011: /* scroll to bottom on key press */ 4197 case 1011: /* scroll to bottom on key press */
4113 if (state) 4198 if (state)
4114 options |= Opt_scrollTtyKeypress; 4199 SET_OPTION (Opt_scrollTtyKeypress);
4115 else 4200 else
4116 options &= ~Opt_scrollTtyKeypress; 4201 CLR_OPTION (Opt_scrollTtyKeypress);
4117 break; 4202 break;
4118 case 1047: /* secondary screen w/ clearing last */ 4203 case 1047: /* secondary screen w/ clearing last */
4119 if (options & Opt_secondaryScreen) 4204 if (OPTION (Opt_secondaryScreen))
4120 if (current_screen != PRIMARY) 4205 if (current_screen != PRIMARY)
4121 scr_erase_screen (2); 4206 scr_erase_screen (2);
4122 scr_change_screen (state); 4207 scr_change_screen (state);
4123 break; 4208 break;
4124 case 1049: /* secondary screen w/ clearing first */ 4209 case 1049: /* secondary screen w/ clearing first */
4125 scr_change_screen (state); 4210 scr_change_screen (state);
4126 if (options & Opt_secondaryScreen) 4211 if (OPTION (Opt_secondaryScreen))
4127 if (current_screen != PRIMARY) 4212 if (current_screen != PRIMARY)
4128 scr_erase_screen (2); 4213 scr_erase_screen (2);
4129 break; 4214 break;
4130 default: 4215 default:
4131 break; 4216 break;
4281 case 106: 4366 case 106:
4282 case 107: 4367 case 107:
4283 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); 4368 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg);
4284 break; 4369 break;
4285#endif 4370#endif
4286
4287 } 4371 }
4288 } 4372 }
4289} 4373}
4290/*}}} */ 4374/*}}} */
4291 4375

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines