… | |
… | |
57 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
57 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
58 | |
58 | |
59 | // exception thrown when the command parser runs out of input data |
59 | // exception thrown when the command parser runs out of input data |
60 | class out_of_input { } out_of_input; |
60 | class out_of_input { } out_of_input; |
61 | |
61 | |
|
|
62 | #ifndef NO_FRILLS |
|
|
63 | |
|
|
64 | #define ISO_14755_KEYCODE_VALID 0x80000000UL |
|
|
65 | #define ISO_14755_ACTIVE 0x40000000UL |
|
|
66 | #define ISO_14755_ESCAPE_NEXT 0x20000000UL |
|
|
67 | |
|
|
68 | static unsigned short iso14755_symtab[] = { |
|
|
69 | // keysym, unicode |
|
|
70 | XK_Left, 0x2190, |
|
|
71 | XK_KP_Left, 0x2190, |
|
|
72 | XK_Up, 0x2191, |
|
|
73 | XK_KP_Up, 0x2191, |
|
|
74 | XK_Right, 0x2192, |
|
|
75 | XK_KP_Right, 0x2192, |
|
|
76 | XK_Down, 0x2193, |
|
|
77 | XK_KP_Down, 0x2193, |
|
|
78 | XK_Linefeed, 0x21b4, |
|
|
79 | XK_Return, 0x21b5, |
|
|
80 | XK_KP_Enter, 0x21b5, |
|
|
81 | |
|
|
82 | XK_Prior, 0x21de, |
|
|
83 | XK_Next, 0x21df, |
|
|
84 | XK_Tab, 0x21e5, |
|
|
85 | XK_ISO_Left_Tab, 0x21e6, |
|
|
86 | XK_Shift_L, 0x21e7, |
|
|
87 | XK_Shift_R, 0x21e7, |
|
|
88 | |
|
|
89 | XK_Shift_Lock, 0x21eb, |
|
|
90 | XK_ISO_Lock, 0x21eb, |
|
|
91 | XK_ISO_Lock, 0x21eb, |
|
|
92 | XK_Caps_Lock, 0x21ec, |
|
|
93 | XK_Num_Lock, 0x21ed, |
|
|
94 | XK_ISO_Level3_Shift, 0x21ee, |
|
|
95 | XK_ISO_Level3_Lock, 0x21ef, |
|
|
96 | XK_ISO_Group_Lock, 0x21f0, |
|
|
97 | XK_Home, 0x21f1, |
|
|
98 | XK_End, 0x21f2, |
|
|
99 | |
|
|
100 | XK_Execute, 0x2318, |
|
|
101 | XK_Begin, 0x2320, |
|
|
102 | XK_Delete, 0x2326, |
|
|
103 | XK_Clear, 0x2327, |
|
|
104 | XK_BackSpace, 0x232b, |
|
|
105 | XK_Insert, 0x2380, |
|
|
106 | XK_Control_L, 0x2388, |
|
|
107 | XK_Control_R, 0x2388, |
|
|
108 | XK_Pause, 0x2389, |
|
|
109 | XK_Break, 0x238a, |
|
|
110 | XK_Escape, 0x238b, |
|
|
111 | XK_Undo, 0x238c, |
|
|
112 | XK_Print, 0x2399, |
|
|
113 | |
|
|
114 | XK_space, 0x2423, |
|
|
115 | XK_KP_Space, 0x2422, |
|
|
116 | 0, |
|
|
117 | }; |
|
|
118 | |
|
|
119 | void |
|
|
120 | rxvt_term::commit_iso14755 () |
|
|
121 | { |
|
|
122 | wchar_t ch[2]; |
|
|
123 | |
|
|
124 | ch[0] = iso14755buf & 0x1fffffffUL; // actually, unicode needs a 0x1fffff mask |
|
|
125 | ch[1] = 0; |
|
|
126 | |
|
|
127 | if (iso14755buf & ISO_14755_KEYCODE_VALID) |
|
|
128 | { |
|
|
129 | char mb[16]; |
|
|
130 | int len; |
|
|
131 | |
|
|
132 | // allow verbatim 0-bytes and control-bytes to be entered |
|
|
133 | if (ch[0] >= 0x20) |
|
|
134 | len = wcstombs (mb, ch, 16); |
|
|
135 | else |
|
|
136 | { |
|
|
137 | mb[0] = ch[0]; |
|
|
138 | len = 1; |
|
|
139 | } |
|
|
140 | |
|
|
141 | if (len > 0) |
|
|
142 | tt_write ((unsigned char *)mb, len); |
|
|
143 | else |
|
|
144 | scr_bell (); |
|
|
145 | } |
|
|
146 | |
|
|
147 | iso14755buf = 0; |
|
|
148 | } |
|
|
149 | |
|
|
150 | int |
|
|
151 | rxvt_term::hex_keyval (XKeyEvent &ev) |
|
|
152 | { |
|
|
153 | // check wether this event corresponds to a hex digit |
|
|
154 | // if the modifiers had not been pressed. |
|
|
155 | for (int index = 0; index < 8; index++) |
|
|
156 | { |
|
|
157 | KeySym k = XLookupKeysym (&ev, index); |
|
|
158 | |
|
|
159 | if (k >= XK_KP_0 && k <= XK_KP_9) return k - XK_KP_0; |
|
|
160 | else if (k >= XK_0 && k <= XK_9) return k - XK_0; |
|
|
161 | else if (k >= XK_a && k <= XK_f) return k - XK_a + 10; |
|
|
162 | else if (k >= XK_A && k <= XK_F) return k - XK_A + 10; |
|
|
163 | } |
|
|
164 | |
|
|
165 | return -1; |
|
|
166 | } |
|
|
167 | #endif |
|
|
168 | |
62 | /*{{{ Convert the keypress event into a string */ |
169 | /*{{{ Convert the keypress event into a string */ |
63 | void |
170 | void |
64 | rxvt_term::lookup_key (XKeyEvent &ev) |
171 | rxvt_term::lookup_key (XKeyEvent &ev) |
65 | { |
172 | { |
66 | int ctrl, meta, shft, len; |
173 | int ctrl, meta, shft, len; |
… | |
… | |
151 | { |
258 | { |
152 | if (TermWin.saveLines) |
259 | if (TermWin.saveLines) |
153 | { |
260 | { |
154 | #ifdef UNSHIFTED_SCROLLKEYS |
261 | #ifdef UNSHIFTED_SCROLLKEYS |
155 | if (!ctrl && !meta) |
262 | if (!ctrl && !meta) |
156 | { |
|
|
157 | #else |
263 | #else |
158 | if (IS_SCROLL_MOD) |
264 | if (IS_SCROLL_MOD) |
|
|
265 | #endif |
159 | { |
266 | { |
160 | #endif |
|
|
161 | int lnsppg; |
267 | int lnsppg; |
162 | |
268 | |
163 | #ifdef PAGING_CONTEXT_LINES |
269 | #ifdef PAGING_CONTEXT_LINES |
164 | lnsppg = TermWin.nrow - PAGING_CONTEXT_LINES; |
270 | lnsppg = TermWin.nrow - PAGING_CONTEXT_LINES; |
165 | #else |
271 | #else |
… | |
… | |
222 | { |
328 | { |
223 | /* normal XTerm key bindings */ |
329 | /* normal XTerm key bindings */ |
224 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
330 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
225 | selection_request (ev.time, 0, 0); |
331 | selection_request (ev.time, 0, 0); |
226 | return; |
332 | return; |
|
|
333 | #if TODO // TODO |
227 | /* rxvt extras */ |
334 | /* rxvt extras */ |
228 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
335 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
229 | change_font (FONT_UP); |
336 | change_font (FONT_UP); |
230 | return; |
337 | return; |
231 | case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */ |
338 | case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */ |
232 | change_font (FONT_DN); |
339 | change_font (FONT_DN); |
233 | return; |
340 | return; |
|
|
341 | #endif |
234 | } |
342 | } |
235 | } |
343 | } |
236 | } |
344 | } |
|
|
345 | |
|
|
346 | #ifndef NO_FRILLS |
|
|
347 | // ISO 14755 support |
|
|
348 | if (shft && ctrl) |
|
|
349 | { |
|
|
350 | int hv; |
|
|
351 | |
|
|
352 | if (keysym == XK_space || keysym == XK_KP_Space |
|
|
353 | || keysym == XK_Return || keysym == XK_KP_Enter) |
|
|
354 | { |
|
|
355 | commit_iso14755 (); |
|
|
356 | return; |
|
|
357 | } |
|
|
358 | else if ((hv = hex_keyval (ev)) >= 0) |
|
|
359 | { |
|
|
360 | iso14755buf = (iso14755buf << 4) | hv | ISO_14755_KEYCODE_VALID; |
|
|
361 | return; |
|
|
362 | } |
|
|
363 | else |
|
|
364 | iso14755buf = 0; |
|
|
365 | } |
|
|
366 | else if ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R)) |
|
|
367 | || (shft && (keysym == XK_Control_L || keysym == XK_Control_R))) |
|
|
368 | iso14755buf |= ISO_14755_ACTIVE; |
|
|
369 | #endif |
|
|
370 | |
237 | #ifdef PRINTPIPE |
371 | #ifdef PRINTPIPE |
238 | if (keysym == XK_Print) |
372 | if (keysym == XK_Print) |
239 | { |
373 | { |
240 | scr_printscreen (ctrl | shft); |
374 | scr_printscreen (ctrl | shft); |
241 | return; |
375 | return; |
… | |
… | |
306 | newlen = 0; |
440 | newlen = 0; |
307 | } |
441 | } |
308 | break; |
442 | break; |
309 | |
443 | |
310 | #ifdef XK_KP_Left |
444 | #ifdef XK_KP_Left |
311 | case XK_KP_Up: /* \033Ox or standard */ |
445 | case XK_KP_Up: /* \033Ox or standard */ |
312 | case XK_KP_Down: /* \033Or or standard */ |
446 | case XK_KP_Down: /* \033Or or standard */ |
313 | case XK_KP_Right: /* \033Ov or standard */ |
447 | case XK_KP_Right: /* \033Ov or standard */ |
314 | case XK_KP_Left: /* \033Ot or standard */ |
448 | case XK_KP_Left: /* \033Ot or standard */ |
315 | if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) |
449 | if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) |
316 | { |
450 | { |
… | |
… | |
661 | if (want_full_refresh) |
795 | if (want_full_refresh) |
662 | { |
796 | { |
663 | want_full_refresh = 0; |
797 | want_full_refresh = 0; |
664 | scr_clear (); |
798 | scr_clear (); |
665 | scr_touch (false); |
799 | scr_touch (false); |
666 | want_refresh = 1; |
|
|
667 | } |
800 | } |
668 | #endif |
801 | #endif |
669 | |
802 | |
670 | if (want_refresh) |
803 | if (want_refresh) |
671 | { |
804 | { |
… | |
… | |
687 | SET_R (this); |
820 | SET_R (this); |
688 | SET_LOCALE (locale); |
821 | SET_LOCALE (locale); |
689 | |
822 | |
690 | display->flush (); |
823 | display->flush (); |
691 | |
824 | |
692 | if (!flush_ev.active) |
825 | if (want_refresh && !flush_ev.active) |
693 | flush_ev.start (NOW + 0.01); |
826 | flush_ev.start (NOW + 0.01); |
694 | } |
827 | } |
695 | |
828 | |
696 | void |
829 | void |
697 | rxvt_term::flush_cb (time_watcher &w) |
830 | rxvt_term::flush_cb (time_watcher &w) |
… | |
… | |
1026 | #endif |
1159 | #endif |
1027 | |
1160 | |
1028 | switch (ev.type) |
1161 | switch (ev.type) |
1029 | { |
1162 | { |
1030 | case KeyPress: |
1163 | case KeyPress: |
|
|
1164 | if (!(iso14755buf & ISO_14755_ESCAPE_NEXT)) |
1031 | lookup_key (ev.xkey); |
1165 | lookup_key (ev.xkey); |
|
|
1166 | |
|
|
1167 | break; |
|
|
1168 | |
|
|
1169 | case KeyRelease: |
|
|
1170 | { |
|
|
1171 | #if (defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)) || !defined (NO_FRILLS) |
|
|
1172 | KeySym ks; |
|
|
1173 | |
|
|
1174 | ks = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
|
|
1175 | #endif |
|
|
1176 | |
|
|
1177 | #ifndef NO_FRILLS |
|
|
1178 | // ISO 14755 support |
|
|
1179 | if (iso14755buf) |
|
|
1180 | if (iso14755buf & ISO_14755_ESCAPE_NEXT) |
|
|
1181 | { |
|
|
1182 | // iso14755 part 5.2 handling: release time |
|
|
1183 | // first: controls |
|
|
1184 | if ((ev.xkey.state & ControlMask) |
|
|
1185 | && ((ks >= 0x40 && ks <= 0x5f) |
|
|
1186 | || (ks >= 0x61 && ks <= 0x7f))) |
|
|
1187 | { |
|
|
1188 | iso14755buf = ISO_14755_KEYCODE_VALID | 0x2400 | (ks & 0x1f); |
|
|
1189 | commit_iso14755 (); |
|
|
1190 | return; // case-break; |
|
|
1191 | } |
|
|
1192 | |
|
|
1193 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
|
|
1194 | if (i[0] == ks) |
|
|
1195 | { |
|
|
1196 | iso14755buf = ISO_14755_KEYCODE_VALID | i[1]; |
|
|
1197 | commit_iso14755 (); |
|
|
1198 | return; // case-break; |
|
|
1199 | } |
|
|
1200 | |
|
|
1201 | iso14755buf = 0; |
|
|
1202 | scr_bell (); |
1032 | break; |
1203 | break; |
|
|
1204 | } |
|
|
1205 | else if ((ev.xkey.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) |
|
|
1206 | { |
|
|
1207 | if (iso14755buf & ISO_14755_KEYCODE_VALID) |
|
|
1208 | commit_iso14755 (); |
|
|
1209 | else if (iso14755buf & ISO_14755_ACTIVE) |
|
|
1210 | iso14755buf = ISO_14755_ESCAPE_NEXT; // iso14755 part 5.2: remember empty begin/end pair |
|
|
1211 | } |
|
|
1212 | #endif |
1033 | |
1213 | |
1034 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1214 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1035 | case KeyRelease: |
|
|
1036 | { |
|
|
1037 | if (!(ev.xkey.state & ControlMask)) |
1215 | if (!(ev.xkey.state & ControlMask)) |
1038 | slip_wheel_ev.stop (); |
1216 | slip_wheel_ev.stop (); |
1039 | else |
|
|
1040 | { |
|
|
1041 | KeySym ks; |
|
|
1042 | |
|
|
1043 | ks = XKeycodeToKeysym (display->display, ev.xkey.keycode, 0); |
|
|
1044 | if (ks == XK_Control_L || ks == XK_Control_R) |
1217 | else if (ks == XK_Control_L || ks == XK_Control_R) |
1045 | mouse_slip_wheel_speed = 0; |
1218 | mouse_slip_wheel_speed = 0; |
1046 | } |
1219 | #endif |
1047 | break; |
1220 | break; |
1048 | } |
1221 | } |
1049 | #endif |
|
|
1050 | |
1222 | |
1051 | case ButtonPress: |
1223 | case ButtonPress: |
1052 | button_press (ev.xbutton); |
1224 | button_press (ev.xbutton); |
1053 | break; |
1225 | break; |
1054 | |
1226 | |
… | |
… | |
1192 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1364 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1193 | if (Options & Opt_transparent) |
1365 | if (Options & Opt_transparent) |
1194 | { |
1366 | { |
1195 | check_our_parents (); |
1367 | check_our_parents (); |
1196 | if (am_transparent) |
1368 | if (am_transparent) |
1197 | want_full_refresh = 1; |
1369 | want_refresh = want_full_refresh = 1; |
1198 | } |
1370 | } |
1199 | #endif |
1371 | #endif |
1200 | } |
1372 | } |
|
|
1373 | break; |
|
|
1374 | |
|
|
1375 | case PropertyNotify: |
|
|
1376 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
|
|
1377 | && ev.xproperty.state == PropertyNewValue) |
|
|
1378 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
|
|
1379 | |
1201 | break; |
1380 | break; |
1202 | |
1381 | |
1203 | case SelectionClear: |
1382 | case SelectionClear: |
1204 | selection_clear (); |
1383 | selection_clear (); |
1205 | break; |
1384 | break; |
… | |
… | |
1381 | } |
1560 | } |
1382 | break; |
1561 | break; |
1383 | } |
1562 | } |
1384 | } |
1563 | } |
1385 | |
1564 | |
|
|
1565 | #if TRANSPARENT |
1386 | void |
1566 | void |
1387 | rxvt_term::rootwin_cb (XEvent &ev) |
1567 | rxvt_term::rootwin_cb (XEvent &ev) |
1388 | { |
1568 | { |
1389 | SET_R (this); |
1569 | SET_R (this); |
1390 | SET_LOCALE (locale); |
1570 | SET_LOCALE (locale); |
1391 | |
1571 | |
1392 | switch (ev.type) |
1572 | switch (ev.type) |
1393 | { |
1573 | { |
1394 | case PropertyNotify: |
1574 | case PropertyNotify: |
1395 | if (ev.xproperty.atom == xa[XA_VT_SELECTION]) |
|
|
1396 | { |
|
|
1397 | if (ev.xproperty.state == PropertyNewValue) |
|
|
1398 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
|
|
1399 | break; |
|
|
1400 | } |
|
|
1401 | #ifdef TRANSPARENT |
|
|
1402 | else |
|
|
1403 | { |
|
|
1404 | /* |
1575 | /* |
1405 | * if user used some Esetroot compatible prog to set the root bg, |
1576 | * if user used some Esetroot compatible prog to set the root bg, |
1406 | * use the property to determine the pixmap. We use it later on. |
1577 | * use the property to determine the pixmap. We use it later on. |
1407 | */ |
1578 | */ |
1408 | if (xa[XA_XROOTPMAPID] == 0) |
1579 | if (xa[XA_XROOTPMAPID] == 0) |
1409 | xa[XA_XROOTPMAPID] = XInternAtom (display->display, "_XROOTPMAP_ID", False); |
1580 | xa[XA_XROOTPMAPID] = XInternAtom (display->display, "_XROOTPMAP_ID", False); |
1410 | |
1581 | |
1411 | if (ev.xproperty.atom != xa[XA_XROOTPMAPID]) |
1582 | if (ev.xproperty.atom != xa[XA_XROOTPMAPID]) |
1412 | return; |
1583 | return; |
1413 | } |
|
|
1414 | |
1584 | |
1415 | /* FALLTHROUGH */ |
1585 | /* FALLTHROUGH */ |
1416 | case ReparentNotify: |
1586 | case ReparentNotify: |
1417 | if ((Options & Opt_transparent) && check_our_parents () && am_transparent) |
1587 | if ((Options & Opt_transparent) && check_our_parents () && am_transparent) |
1418 | want_full_refresh = 1; |
1588 | want_refresh = want_full_refresh = 1; |
1419 | break; |
1589 | break; |
1420 | #endif |
|
|
1421 | } |
1590 | } |
1422 | } |
1591 | } |
|
|
1592 | #endif |
1423 | |
1593 | |
1424 | void |
1594 | void |
1425 | rxvt_term::button_press (XButtonEvent &ev) |
1595 | rxvt_term::button_press (XButtonEvent &ev) |
1426 | { |
1596 | { |
1427 | int reportmode = 0, clickintime; |
1597 | int reportmode = 0, clickintime; |
… | |
… | |
1605 | break; |
1775 | break; |
1606 | case R_SB_ALIGN_BOTTOM: |
1776 | case R_SB_ALIGN_BOTTOM: |
1607 | csrO = scrollBar.bot - scrollBar.top; |
1777 | csrO = scrollBar.bot - scrollBar.top; |
1608 | break; |
1778 | break; |
1609 | } |
1779 | } |
|
|
1780 | |
1610 | if (scrollBar.style == R_SB_XTERM |
1781 | if (scrollBar.style == R_SB_XTERM |
1611 | || scrollbar_above_slider (ev.y) |
1782 | || scrollbar_above_slider (ev.y) |
1612 | || scrollbar_below_slider (ev.y)) |
1783 | || scrollbar_below_slider (ev.y)) |
1613 | scr_move_to ( scrollbar_position (ev.y) - csrO, |
1784 | scr_move_to (scrollbar_position (ev.y) - csrO, scrollbar_size ()); |
1614 | scrollbar_size ()); |
1785 | |
1615 | scrollBar.setMotion (); |
1786 | scrollBar.setMotion (); |
1616 | break; |
1787 | break; |
1617 | |
1788 | |
1618 | case Button1: |
1789 | case Button1: |
1619 | if (scrollbar_align == R_SB_ALIGN_CENTRE) |
1790 | if (scrollbar_align == R_SB_ALIGN_CENTRE) |
… | |
… | |
1643 | scr_page ((ev.button == Button1 ? DN : UP), |
1814 | scr_page ((ev.button == Button1 ? DN : UP), |
1644 | (TermWin.nrow |
1815 | (TermWin.nrow |
1645 | * scrollbar_position (ev.y) |
1816 | * scrollbar_position (ev.y) |
1646 | / scrollbar_size ())); |
1817 | / scrollbar_size ())); |
1647 | } |
1818 | } |
|
|
1819 | |
1648 | break; |
1820 | break; |
1649 | } |
1821 | } |
1650 | } |
1822 | } |
1651 | return; |
1823 | return; |
1652 | } |
1824 | } |
… | |
… | |
2283 | unicode_t buf[UBUFSIZ]; |
2455 | unicode_t buf[UBUFSIZ]; |
2284 | bool refreshnow = false; |
2456 | bool refreshnow = false; |
2285 | int nlines = 0; |
2457 | int nlines = 0; |
2286 | unicode_t *str = buf; |
2458 | unicode_t *str = buf; |
2287 | |
2459 | |
2288 | *str++ = ch; |
|
|
2289 | |
|
|
2290 | for (;;) |
2460 | for (;;) |
2291 | { |
2461 | { |
2292 | seq_begin = cmdbuf_ptr; |
|
|
2293 | ch = next_char (); |
|
|
2294 | |
|
|
2295 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2462 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2296 | break; |
2463 | break; |
2297 | |
2464 | |
2298 | *str++ = ch; |
2465 | *str++ = ch; |
2299 | |
2466 | |
2300 | if (ch == C0_LF) |
2467 | if (ch == C0_LF) |
2301 | { |
2468 | { |
2302 | nlines++; |
2469 | nlines++; |
2303 | refresh_count++; |
2470 | refresh_count++; |
2304 | |
2471 | |
2305 | if (! (Options & Opt_jumpScroll) |
2472 | if (!(Options & Opt_jumpScroll) |
2306 | || (refresh_count >= refresh_limit * (TermWin.nrow - 1))) |
2473 | || (refresh_count >= refresh_limit * (TermWin.nrow - 1))) |
2307 | { |
2474 | { |
2308 | refreshnow = true; |
2475 | refreshnow = true; |
2309 | ch = NOCHAR; |
2476 | ch = NOCHAR; |
2310 | break; |
2477 | break; |
2311 | } |
2478 | } |
2312 | |
2479 | |
2313 | // scr_add_lines only works for nlines < TermWin.nrow - 1. |
2480 | // scr_add_lines only works for nlines <= TermWin.nrow - 1. |
2314 | if (nlines >= TermWin.nrow - 1) |
2481 | if (nlines >= TermWin.nrow - 1) |
2315 | { |
2482 | { |
2316 | scr_add_lines (buf, nlines, str - buf); |
2483 | scr_add_lines (buf, nlines, str - buf); |
2317 | nlines = 0; |
2484 | nlines = 0; |
2318 | str = buf; |
2485 | str = buf; |
… | |
… | |
2322 | if (str >= buf + UBUFSIZ) |
2489 | if (str >= buf + UBUFSIZ) |
2323 | { |
2490 | { |
2324 | ch = NOCHAR; |
2491 | ch = NOCHAR; |
2325 | break; |
2492 | break; |
2326 | } |
2493 | } |
|
|
2494 | |
|
|
2495 | seq_begin = cmdbuf_ptr; |
|
|
2496 | ch = next_char (); |
2327 | } |
2497 | } |
2328 | |
2498 | |
2329 | scr_add_lines (buf, nlines, str - buf); |
2499 | scr_add_lines (buf, nlines, str - buf); |
2330 | |
2500 | |
2331 | /* |
2501 | /* |
… | |
… | |
3175 | break; |
3345 | break; |
3176 | case 19: /* report window size (chars) */ |
3346 | case 19: /* report window size (chars) */ |
3177 | tt_printf ("\033[9;%d;%dt", TermWin.nrow, TermWin.ncol); |
3347 | tt_printf ("\033[9;%d;%dt", TermWin.nrow, TermWin.ncol); |
3178 | break; |
3348 | break; |
3179 | case 20: /* report icon label */ |
3349 | case 20: /* report icon label */ |
3180 | if (Options & Opt_insecure) |
|
|
3181 | { |
3350 | { |
3182 | char *s; |
3351 | char *s; |
3183 | XGetIconName (display->display, TermWin.parent[0], &s); |
3352 | XGetIconName (display->display, TermWin.parent[0], &s); |
3184 | tt_printf ("\033]L%-.200s\234", s ? s : ""); /* 8bit ST */ |
3353 | tt_printf ("\033]L%-.250s\234", (Options & Opt_insecure) && s ? s : ""); /* 8bit ST */ |
|
|
3354 | XFree (s); |
3185 | } |
3355 | } |
3186 | break; |
3356 | break; |
3187 | case 21: /* report window title */ |
3357 | case 21: /* report window title */ |
3188 | if (Options & Opt_insecure) |
|
|
3189 | { |
3358 | { |
3190 | char *s; |
3359 | char *s; |
3191 | XFetchName (display->display, TermWin.parent[0], &s); |
3360 | XFetchName (display->display, TermWin.parent[0], &s); |
3192 | tt_printf ("\033]l%-.200s\234", s ? s : ""); /* 8bit ST */ |
3361 | tt_printf ("\033]l%-.250s\234", (Options & Opt_insecure) && s ? s : ""); /* 8bit ST */ |
|
|
3362 | XFree (s); |
3193 | } |
3363 | } |
3194 | break; |
3364 | break; |
3195 | } |
3365 | } |
3196 | } |
3366 | } |
3197 | #endif |
3367 | #endif |
3198 | |
3368 | |
… | |
… | |
3295 | void |
3465 | void |
3296 | rxvt_term::process_color_seq (int report, int color, const char *str, unsigned char resp) |
3466 | rxvt_term::process_color_seq (int report, int color, const char *str, unsigned char resp) |
3297 | { |
3467 | { |
3298 | if (str[0] == '?' && !str[1]) |
3468 | if (str[0] == '?' && !str[1]) |
3299 | { |
3469 | { |
3300 | if (Options & Opt_insecure) |
|
|
3301 | { |
|
|
3302 | unsigned short r, g, b; |
3470 | unsigned short r, g, b; |
3303 | PixColorsFocused[color].get (display, r, g, b); |
3471 | PixColorsFocused[color].get (display, r, g, b); |
3304 | tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, r, g, b, resp); |
3472 | tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, r, g, b, resp); |
3305 | } |
|
|
3306 | } |
3473 | } |
3307 | else |
3474 | else |
3308 | set_window_color (color, str); |
3475 | set_window_color (color, str); |
3309 | } |
3476 | } |
3310 | |
3477 | |
… | |
… | |
3410 | if ((buf = STRCHR (name, ';')) != NULL) |
3577 | if ((buf = STRCHR (name, ';')) != NULL) |
3411 | *buf++ = '\0'; |
3578 | *buf++ = '\0'; |
3412 | |
3579 | |
3413 | if (name[0] == '?' && !name[1]) |
3580 | if (name[0] == '?' && !name[1]) |
3414 | { |
3581 | { |
3415 | if (Options & Opt_insecure) |
|
|
3416 | { |
|
|
3417 | unsigned short r, g, b; |
3582 | unsigned short r, g, b; |
3418 | PixColorsFocused[color + minCOLOR].get (display, r, g, b); |
3583 | PixColorsFocused[color + minCOLOR].get (display, r, g, b); |
3419 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
3584 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
3420 | } |
|
|
3421 | } |
3585 | } |
3422 | else |
3586 | else |
3423 | set_window_color (color + minCOLOR, name); |
3587 | set_window_color (color + minCOLOR, name); |
3424 | } |
3588 | } |
3425 | break; |
3589 | break; |
… | |
… | |
3489 | // TODO, when secure mode? |
3653 | // TODO, when secure mode? |
3490 | break; |
3654 | break; |
3491 | |
3655 | |
3492 | case XTerm_font: |
3656 | case XTerm_font: |
3493 | if (query) |
3657 | if (query) |
3494 | { |
|
|
3495 | if (Options & Opt_insecure) |
|
|
3496 | tt_printf ("\33]%d;%-.250s%c", XTerm_font, |
3658 | tt_printf ("\33]%d;%-.250s%c", XTerm_font, |
|
|
3659 | (Options & Opt_insecure) && TermWin.fontset->fontdesc |
3497 | TermWin.fontset->fontdesc |
3660 | ? TermWin.fontset->fontdesc : "", |
3498 | ? TermWin.fontset->fontdesc |
|
|
3499 | : "", |
|
|
3500 | resp); |
3661 | resp); |
3501 | } |
|
|
3502 | else |
3662 | else |
3503 | change_font (str); |
3663 | change_font (str); |
3504 | break; |
3664 | break; |
3505 | |
3665 | |
3506 | #ifndef NO_FRILLS |
3666 | #ifndef NO_FRILLS |
3507 | case XTerm_locale: |
3667 | case XTerm_locale: |
3508 | if (query) |
3668 | if (query) |
3509 | { |
|
|
3510 | if (Options & Opt_insecure) |
|
|
3511 | tt_printf ("\33]%d;%-.250s%c", XTerm_locale, locale, resp); |
3669 | tt_printf ("\33]%d;%-.250s%c", XTerm_locale, (Options & Opt_insecure) ? locale : "", resp); |
3512 | } |
|
|
3513 | else |
3670 | else |
3514 | { |
3671 | { |
3515 | set_locale (str); |
3672 | set_locale (str); |
3516 | # ifdef USE_XIM |
3673 | # ifdef USE_XIM |
3517 | im_cb (); |
3674 | im_cb (); |
3518 | # endif |
3675 | # endif |
3519 | } |
3676 | } |
3520 | break; |
3677 | break; |
3521 | |
3678 | |
3522 | case XTerm_findfont: |
3679 | case XTerm_findfont: |
3523 | if (Options & Opt_insecure) |
|
|
3524 | { |
3680 | { |
3525 | int fid = TermWin.fontset->find_font (atoi (str)); |
3681 | int fid = TermWin.fontset->find_font (atoi (str)); |
3526 | tt_printf ("\33]%d;%d;%-.250s%c", XTerm_findfont, |
3682 | tt_printf ("\33]%d;%d;%-.250s%c", XTerm_findfont, |
3527 | fid, (*TermWin.fontset)[fid]->name, resp); |
3683 | fid, |
|
|
3684 | (Options & Opt_insecure) ? (*TermWin.fontset)[fid]->name : "", |
|
|
3685 | resp); |
3528 | } |
3686 | } |
3529 | break; |
3687 | break; |
3530 | #endif |
3688 | #endif |
3531 | |
3689 | |
3532 | #ifdef MENUBAR |
3690 | #ifdef MENUBAR |
3533 | case XTerm_Menu: |
3691 | case XTerm_Menu: |