… | |
… | |
43 | * along with this program; if not, write to the Free Software |
43 | * along with this program; if not, write to the Free Software |
44 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
44 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
45 | *----------------------------------------------------------------------*/ |
45 | *----------------------------------------------------------------------*/ |
46 | |
46 | |
47 | /*{{{ includes: */ |
47 | /*{{{ includes: */ |
48 | #include "../config.h" /* NECESSARY */ |
48 | #include "../config.h" |
49 | #include "rxvt.h" /* NECESSARY */ |
49 | #include "rxvt.h" |
|
|
50 | #include "rxvtperl.h" |
50 | #include "version.h" |
51 | #include "version.h" |
51 | #include "command.h" |
52 | #include "command.h" |
|
|
53 | |
|
|
54 | #if HAVE_SCHED_YIELD |
|
|
55 | #undef HAVE_SCHED_YIELD // disabled for the time being |
|
|
56 | //# include <sched.h> |
|
|
57 | #endif |
52 | |
58 | |
53 | #ifdef KEYSYM_RESOURCE |
59 | #ifdef KEYSYM_RESOURCE |
54 | # include "keyboard.h" |
60 | # include "keyboard.h" |
55 | #endif |
61 | #endif |
56 | |
62 | |
… | |
… | |
155 | } |
161 | } |
156 | |
162 | |
157 | x--; |
163 | x--; |
158 | } |
164 | } |
159 | } |
165 | } |
160 | #endif |
|
|
161 | |
166 | |
162 | void |
167 | void |
163 | rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y) |
168 | rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y) |
164 | { |
169 | { |
165 | #if ENABLE_OVERLAY |
|
|
166 | rxvt_fontset *fs = FONTSET (r); |
170 | rxvt_fontset *fs = FONTSET (r); |
167 | rxvt_font *f = (*fs)[fs->find_font (ch)]; |
171 | rxvt_font *f = (*fs)[fs->find_font (ch)]; |
168 | wchar_t *chr, *alloc, ch2, *fname; |
172 | wchar_t *chr, *alloc, ch2, *fname; |
169 | int len; |
173 | int len; |
170 | |
174 | |
… | |
… | |
189 | |
193 | |
190 | char attr[80]; // plenty |
194 | char attr[80]; // plenty |
191 | |
195 | |
192 | sprintf (attr, "%08x = fg %d bg %d%s%s%s%s%s%s", |
196 | sprintf (attr, "%08x = fg %d bg %d%s%s%s%s%s%s", |
193 | (int)r, |
197 | (int)r, |
194 | GET_FGCOLOR (r), GET_BGCOLOR (r), |
198 | fgcolor_of (r), bgcolor_of (r), |
195 | r & RS_Bold ? " bold" : "", |
199 | r & RS_Bold ? " bold" : "", |
196 | r & RS_Italic ? " italic" : "", |
200 | r & RS_Italic ? " italic" : "", |
197 | r & RS_Blink ? " blink" : "", |
201 | r & RS_Blink ? " blink" : "", |
198 | r & RS_RVid ? " rvid" : "", |
202 | r & RS_RVid ? " rvid" : "", |
199 | r & RS_Uline ? " uline" : "", |
203 | r & RS_Uline ? " uline" : "", |
… | |
… | |
238 | |
242 | |
239 | # if ENABLE_COMBINING |
243 | # if ENABLE_COMBINING |
240 | if (alloc) |
244 | if (alloc) |
241 | delete [] alloc; |
245 | delete [] alloc; |
242 | # endif |
246 | # endif |
243 | #endif |
|
|
244 | } |
247 | } |
|
|
248 | #endif |
245 | |
249 | |
246 | void |
250 | void |
247 | rxvt_term::commit_iso14755 () |
251 | rxvt_term::commit_iso14755 () |
248 | { |
252 | { |
249 | wchar_t ch[2]; |
253 | wchar_t ch[2]; |
… | |
… | |
264 | mb[0] = ch[0]; |
268 | mb[0] = ch[0]; |
265 | len = 1; |
269 | len = 1; |
266 | } |
270 | } |
267 | |
271 | |
268 | if (len > 0) |
272 | if (len > 0) |
269 | tt_write ((unsigned char *)mb, len); |
273 | tt_write (mb, len); |
270 | else |
274 | else |
271 | scr_bell (); |
275 | scr_bell (); |
272 | } |
276 | } |
273 | |
277 | |
274 | iso14755buf = 0; |
278 | iso14755buf = 0; |
… | |
… | |
302 | KeySym keysym; |
306 | KeySym keysym; |
303 | #ifdef DEBUG_CMD |
307 | #ifdef DEBUG_CMD |
304 | static int debug_key = 1; /* accessible by a debugger only */ |
308 | static int debug_key = 1; /* accessible by a debugger only */ |
305 | #endif |
309 | #endif |
306 | int valid_keysym; |
310 | int valid_keysym; |
307 | unsigned char kbuf[KBUFSZ]; |
311 | char kbuf[KBUFSZ]; |
308 | |
312 | |
309 | /* |
313 | /* |
310 | * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an |
314 | * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an |
311 | * escape sequence to toggle the Keypad. |
315 | * escape sequence to toggle the Keypad. |
312 | * |
316 | * |
… | |
… | |
330 | Status status_return; |
334 | Status status_return; |
331 | |
335 | |
332 | #if 0 |
336 | #if 0 |
333 | #ifdef X_HAVE_UTF8_STRING |
337 | #ifdef X_HAVE_UTF8_STRING |
334 | if (enc_utf8 && 0) // currently disabled, doesn't seem to work, nor is useful |
338 | if (enc_utf8 && 0) // currently disabled, doesn't seem to work, nor is useful |
335 | len = Xutf8LookupString (Input_Context, &ev, (char *)kbuf, |
339 | len = Xutf8LookupString (Input_Context, &ev, kbuf, |
336 | KBUFSZ, &keysym, &status_return); |
340 | KBUFSZ, &keysym, &status_return); |
337 | else |
341 | else |
338 | #endif |
342 | #endif |
339 | #endif |
343 | #endif |
340 | { |
344 | { |
… | |
… | |
377 | || status_return == XLookupBoth; |
381 | || status_return == XLookupBoth; |
378 | } |
382 | } |
379 | else |
383 | else |
380 | #endif |
384 | #endif |
381 | { |
385 | { |
382 | len = XLookupString (&ev, (char *)kbuf, KBUFSZ, &keysym, &compose); |
386 | len = XLookupString (&ev, kbuf, KBUFSZ, &keysym, &compose); |
383 | valid_keysym = keysym != NoSymbol; |
387 | valid_keysym = keysym != NoSymbol; |
384 | } |
388 | } |
385 | |
389 | |
386 | if (valid_keysym) |
390 | if (valid_keysym) |
387 | { |
391 | { |
… | |
… | |
851 | { |
855 | { |
852 | #ifdef META8_OPTION |
856 | #ifdef META8_OPTION |
853 | /* set 8-bit on */ |
857 | /* set 8-bit on */ |
854 | if (meta && (meta_char == 0x80)) |
858 | if (meta && (meta_char == 0x80)) |
855 | { |
859 | { |
856 | unsigned char *ch; |
860 | char *ch; |
857 | |
861 | |
858 | for (ch = kbuf; ch < kbuf + len; ch++) |
862 | for (ch = kbuf; ch < kbuf + len; ch++) |
859 | *ch |= 0x80; |
863 | *ch |= 0x80; |
860 | |
864 | |
861 | meta = 0; |
865 | meta = 0; |
… | |
… | |
866 | } |
870 | } |
867 | |
871 | |
868 | if (len <= 0) |
872 | if (len <= 0) |
869 | return; /* not mapped */ |
873 | return; /* not mapped */ |
870 | |
874 | |
871 | if (options & Opt_scrollTtyKeypress) |
875 | if (OPTION (Opt_scrollTtyKeypress)) |
872 | if (view_start) |
876 | if (view_start) |
873 | { |
877 | { |
874 | view_start = 0; |
878 | view_start = 0; |
875 | want_refresh = 1; |
879 | want_refresh = 1; |
876 | } |
880 | } |
… | |
… | |
894 | #ifdef META8_OPTION |
898 | #ifdef META8_OPTION |
895 | && meta_char == C0_ESC |
899 | && meta_char == C0_ESC |
896 | #endif |
900 | #endif |
897 | ) |
901 | ) |
898 | { |
902 | { |
899 | const unsigned char ch = C0_ESC; |
903 | const char ch = C0_ESC; |
900 | tt_write (&ch, 1); |
904 | tt_write (&ch, 1); |
901 | } |
905 | } |
902 | |
906 | |
903 | #if defined(DEBUG_CMD) |
907 | #if defined(DEBUG_CMD) |
904 | /* Display keyboard buffer contents */ |
908 | /* Display keyboard buffer contents */ |
… | |
… | |
916 | |
920 | |
917 | #if MENUBAR_MAX || defined (KEYSYM_RESOURCE) |
921 | #if MENUBAR_MAX || defined (KEYSYM_RESOURCE) |
918 | /*{{{ rxvt_cmd_write (), rxvt_cmd_getc () */ |
922 | /*{{{ rxvt_cmd_write (), rxvt_cmd_getc () */ |
919 | /* attempt to `write' count to the input buffer */ |
923 | /* attempt to `write' count to the input buffer */ |
920 | unsigned int |
924 | unsigned int |
921 | rxvt_term::cmd_write (const unsigned char *str, unsigned int count) |
925 | rxvt_term::cmd_write (const char *str, unsigned int count) |
922 | { |
926 | { |
923 | unsigned int n, s; |
927 | unsigned int n, s; |
924 | |
928 | |
925 | n = cmdbuf_ptr - cmdbuf_base; |
929 | n = cmdbuf_ptr - cmdbuf_base; |
926 | s = cmdbuf_base + CBUFSIZ - 1 - cmdbuf_endp; |
930 | s = cmdbuf_base + CBUFSIZ - 1 - cmdbuf_endp; |
… | |
… | |
982 | SET_LOCALE (locale); |
986 | SET_LOCALE (locale); |
983 | |
987 | |
984 | display->flush (); |
988 | display->flush (); |
985 | |
989 | |
986 | if (want_refresh && !flush_ev.active) |
990 | if (want_refresh && !flush_ev.active) |
987 | flush_ev.start (NOW + 0.01); |
991 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
988 | } |
992 | } |
989 | |
993 | |
990 | void |
994 | void |
991 | rxvt_term::flush_cb (time_watcher &w) |
995 | rxvt_term::flush_cb (time_watcher &w) |
992 | { |
996 | { |
… | |
… | |
1067 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1071 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1068 | } |
1072 | } |
1069 | } |
1073 | } |
1070 | #endif |
1074 | #endif |
1071 | |
1075 | |
|
|
1076 | #if HAVE_SCHED_YIELD |
|
|
1077 | static struct event_handler |
|
|
1078 | { |
|
|
1079 | check_watcher cw_yield; |
|
|
1080 | |
|
|
1081 | void yield (check_watcher &w) |
|
|
1082 | { |
|
|
1083 | sched_yield (); |
|
|
1084 | w.stop (); |
|
|
1085 | } |
|
|
1086 | |
|
|
1087 | event_handler () |
|
|
1088 | : cw_yield (this, &event_handler::yield) |
|
|
1089 | { |
|
|
1090 | } |
|
|
1091 | } event_handler; |
|
|
1092 | #endif |
|
|
1093 | |
1072 | bool |
1094 | bool |
1073 | rxvt_term::pty_fill () |
1095 | rxvt_term::pty_fill () |
1074 | { |
1096 | { |
1075 | ssize_t n = cmdbuf_endp - cmdbuf_ptr; |
1097 | ssize_t n = cmdbuf_endp - cmdbuf_ptr; |
1076 | |
1098 | |
1077 | if (CBUFSIZ == n) |
1099 | if (CBUFSIZ == n) |
1078 | { |
1100 | { |
1079 | rxvt_warn ("pty_fill on full buffer, draining input, continuing.\n"); |
1101 | rxvt_warn ("PLEASE REPORT: pty_fill on full buffer, draining input, continuing.\n"); |
1080 | n = 0; |
1102 | n = 0; |
1081 | } |
1103 | } |
1082 | |
1104 | |
1083 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1105 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1084 | cmdbuf_ptr = cmdbuf_base; |
1106 | cmdbuf_ptr = cmdbuf_base; |
1085 | cmdbuf_endp = cmdbuf_ptr + n; |
1107 | cmdbuf_endp = cmdbuf_ptr + n; |
1086 | |
1108 | |
1087 | n = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); |
1109 | ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); |
1088 | |
1110 | |
1089 | if (n > 0) |
1111 | if (r > 0) |
1090 | { |
1112 | { |
1091 | cmdbuf_endp += n; |
1113 | cmdbuf_endp += r; |
1092 | return true; |
1114 | return true; |
1093 | } |
1115 | } |
1094 | else if ((n < 0 && errno != EAGAIN && errno != EINTR) || n == 0) |
1116 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
|
|
1117 | { |
|
|
1118 | #if HAVE_SCHED_YIELD |
|
|
1119 | if (display->is_local) |
|
|
1120 | event_handler.cw_yield.start (); |
|
|
1121 | #endif |
|
|
1122 | } |
|
|
1123 | else |
1095 | { |
1124 | { |
1096 | pty_ev.stop (); |
1125 | pty_ev.stop (); |
1097 | |
1126 | |
1098 | if (!(options & Opt_hold)) |
1127 | if (!OPTION (Opt_hold)) |
1099 | destroy (); |
1128 | destroy (); |
1100 | } |
1129 | } |
1101 | |
1130 | |
1102 | return false; |
1131 | return false; |
1103 | } |
1132 | } |
… | |
… | |
1125 | recolour_cursor (); |
1154 | recolour_cursor (); |
1126 | |
1155 | |
1127 | #ifdef POINTER_BLANK |
1156 | #ifdef POINTER_BLANK |
1128 | hidden_pointer = 0; |
1157 | hidden_pointer = 0; |
1129 | |
1158 | |
1130 | if (options & Opt_pointerBlank) |
1159 | if (OPTION (Opt_pointerBlank)) |
1131 | pointer_ev.start (NOW + pointerBlankDelay); |
1160 | pointer_ev.start (NOW + pointerBlankDelay); |
1132 | #endif |
1161 | #endif |
1133 | } |
1162 | } |
1134 | |
1163 | |
1135 | #ifdef POINTER_BLANK |
1164 | #ifdef POINTER_BLANK |
1136 | void |
1165 | void |
1137 | rxvt_term::pointer_blank () |
1166 | rxvt_term::pointer_blank () |
1138 | { |
1167 | { |
1139 | if (! (options & Opt_pointerBlank)) |
1168 | if (! OPTION (Opt_pointerBlank)) |
1140 | return; |
1169 | return; |
1141 | |
1170 | |
1142 | XDefineCursor (display->display, vt, display->blank_cursor); |
1171 | XDefineCursor (display->display, vt, display->blank_cursor); |
1143 | XFlush (display->display); |
1172 | XFlush (display->display); |
1144 | |
1173 | |
… | |
… | |
1242 | |
1271 | |
1243 | SET_R (this); |
1272 | SET_R (this); |
1244 | SET_LOCALE (locale); |
1273 | SET_LOCALE (locale); |
1245 | |
1274 | |
1246 | #if defined(CURSOR_BLINK) |
1275 | #if defined(CURSOR_BLINK) |
1247 | if ((options & Opt_cursorBlink) && ev.type == KeyPress) |
1276 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
1248 | { |
1277 | { |
1249 | if (hidden_cursor) |
1278 | if (hidden_cursor) |
1250 | { |
1279 | { |
1251 | hidden_cursor = 0; |
1280 | hidden_cursor = 0; |
1252 | want_refresh = 1; |
1281 | want_refresh = 1; |
… | |
… | |
1255 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1284 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1256 | } |
1285 | } |
1257 | #endif |
1286 | #endif |
1258 | |
1287 | |
1259 | #if defined(POINTER_BLANK) |
1288 | #if defined(POINTER_BLANK) |
1260 | if ((options & Opt_pointerBlank) && pointerBlankDelay > 0) |
1289 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
1261 | { |
1290 | { |
1262 | if (ev.type == MotionNotify |
1291 | if (ev.type == MotionNotify |
1263 | || ev.type == ButtonPress |
1292 | || ev.type == ButtonPress |
1264 | || ev.type == ButtonRelease) |
1293 | || ev.type == ButtonRelease) |
1265 | if (hidden_pointer) |
1294 | if (hidden_pointer) |
… | |
… | |
1461 | seen_resize = 1; |
1490 | seen_resize = 1; |
1462 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1491 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1463 | } |
1492 | } |
1464 | |
1493 | |
1465 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1494 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1466 | if (options & Opt_transparent) |
1495 | if (OPTION (Opt_transparent)) |
1467 | check_our_parents (); |
1496 | check_our_parents (); |
1468 | #endif |
1497 | #endif |
1469 | } |
1498 | } |
1470 | break; |
1499 | break; |
1471 | |
1500 | |
… | |
… | |
1672 | { |
1701 | { |
1673 | if (!focus) |
1702 | if (!focus) |
1674 | { |
1703 | { |
1675 | focus = 1; |
1704 | focus = 1; |
1676 | want_refresh = 1; |
1705 | want_refresh = 1; |
|
|
1706 | |
|
|
1707 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
|
|
1708 | |
1677 | #if USE_XIM |
1709 | #if USE_XIM |
1678 | if (Input_Context != NULL) |
1710 | if (Input_Context != NULL) |
1679 | { |
1711 | { |
1680 | IMSetStatusPosition (); |
1712 | IMSetStatusPosition (); |
1681 | XSetICFocus (Input_Context); |
1713 | XSetICFocus (Input_Context); |
1682 | } |
1714 | } |
1683 | #endif |
1715 | #endif |
1684 | #if CURSOR_BLINK |
1716 | #if CURSOR_BLINK |
1685 | if (options & Opt_cursorBlink) |
1717 | if (OPTION (Opt_cursorBlink)) |
1686 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1718 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1687 | #endif |
1719 | #endif |
1688 | #if OFF_FOCUS_FADING |
1720 | #if OFF_FOCUS_FADING |
1689 | if (rs[Rs_fade]) |
1721 | if (rs[Rs_fade]) |
1690 | { |
1722 | { |
… | |
… | |
1701 | if (focus) |
1733 | if (focus) |
1702 | { |
1734 | { |
1703 | focus = 0; |
1735 | focus = 0; |
1704 | want_refresh = 1; |
1736 | want_refresh = 1; |
1705 | |
1737 | |
|
|
1738 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
|
|
1739 | |
1706 | #if ENABLE_FRILLS || ISO_14755 |
1740 | #if ENABLE_FRILLS || ISO_14755 |
|
|
1741 | if (iso14755buf) |
|
|
1742 | { |
1707 | iso14755buf = 0; |
1743 | iso14755buf = 0; |
1708 | #endif |
|
|
1709 | #if ENABLE_OVERLAY |
1744 | # if ENABLE_OVERLAY |
1710 | scr_overlay_off (); |
1745 | scr_overlay_off (); |
|
|
1746 | # endif |
|
|
1747 | } |
1711 | #endif |
1748 | #endif |
1712 | #if USE_XIM |
1749 | #if USE_XIM |
1713 | if (Input_Context != NULL) |
1750 | if (Input_Context != NULL) |
1714 | XUnsetICFocus (Input_Context); |
1751 | XUnsetICFocus (Input_Context); |
1715 | #endif |
1752 | #endif |
1716 | #if CURSOR_BLINK |
1753 | #if CURSOR_BLINK |
1717 | if (options & Opt_cursorBlink) |
1754 | if (OPTION (Opt_cursorBlink)) |
1718 | cursor_blink_ev.stop (); |
1755 | cursor_blink_ev.stop (); |
1719 | hidden_cursor = 0; |
1756 | hidden_cursor = 0; |
1720 | #endif |
1757 | #endif |
1721 | #if OFF_FOCUS_FADING |
1758 | #if OFF_FOCUS_FADING |
1722 | if (rs[Rs_fade]) |
1759 | if (rs[Rs_fade]) |
… | |
… | |
1746 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1783 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1747 | return; |
1784 | return; |
1748 | |
1785 | |
1749 | /* FALLTHROUGH */ |
1786 | /* FALLTHROUGH */ |
1750 | case ReparentNotify: |
1787 | case ReparentNotify: |
1751 | if ((options & Opt_transparent) && check_our_parents () && am_transparent) |
1788 | if (OPTION (Opt_transparent) && check_our_parents () && am_transparent) |
1752 | want_refresh = want_full_refresh = 1; |
1789 | want_refresh = want_full_refresh = 1; |
1753 | break; |
1790 | break; |
1754 | } |
1791 | } |
1755 | } |
1792 | } |
1756 | #endif |
1793 | #endif |
… | |
… | |
1759 | rxvt_term::button_press (XButtonEvent &ev) |
1796 | rxvt_term::button_press (XButtonEvent &ev) |
1760 | { |
1797 | { |
1761 | int reportmode = 0, clickintime; |
1798 | int reportmode = 0, clickintime; |
1762 | |
1799 | |
1763 | bypass_keystate = ev.state & (ModMetaMask | ShiftMask); |
1800 | bypass_keystate = ev.state & (ModMetaMask | ShiftMask); |
|
|
1801 | |
1764 | if (!bypass_keystate) |
1802 | if (!bypass_keystate) |
1765 | reportmode = !! (priv_modes & PrivMode_mouse_report); |
1803 | reportmode = !! (priv_modes & PrivMode_mouse_report); |
1766 | |
1804 | |
1767 | /* |
1805 | /* |
1768 | * VT window processing of button press |
1806 | * VT window processing of button press |
… | |
… | |
1817 | else |
1855 | else |
1818 | { |
1856 | { |
1819 | if (ev.button != MEvent.button) |
1857 | if (ev.button != MEvent.button) |
1820 | MEvent.clicks = 0; |
1858 | MEvent.clicks = 0; |
1821 | |
1859 | |
|
|
1860 | if (!PERL_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END))) |
1822 | switch (ev.button) |
1861 | switch (ev.button) |
1823 | { |
1862 | { |
1824 | case Button1: |
1863 | case Button1: |
1825 | /* allow meta + click to select rectangular areas */ |
1864 | /* allow meta + click to select rectangular areas */ |
1826 | /* should be done in screen.C */ |
1865 | /* should be done in screen.C */ |
1827 | #if ENABLE_FRILLS |
1866 | #if ENABLE_FRILLS |
1828 | selection.rect = !!(ev.state & ModMetaMask); |
1867 | selection.rect = !!(ev.state & ModMetaMask); |
1829 | #else |
1868 | #else |
1830 | selection.rect = false; |
1869 | selection.rect = false; |
1831 | #endif |
1870 | #endif |
1832 | |
1871 | |
1833 | /* allow shift+left click to extend selection */ |
1872 | /* allow shift+left click to extend selection */ |
1834 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1873 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1835 | { |
1874 | { |
1836 | if (MEvent.button == Button1 && clickintime) |
1875 | if (MEvent.button == Button1 && clickintime) |
1837 | selection_rotate (ev.x, ev.y); |
1876 | selection_rotate (ev.x, ev.y); |
1838 | else |
1877 | else |
1839 | selection_extend (ev.x, ev.y, 1); |
1878 | selection_extend (ev.x, ev.y, 1); |
1840 | } |
1879 | } |
1841 | else |
1880 | else |
1842 | { |
1881 | { |
1843 | if (MEvent.button == Button1 && clickintime) |
1882 | if (MEvent.button == Button1 && clickintime) |
1844 | MEvent.clicks++; |
1883 | MEvent.clicks++; |
1845 | else |
1884 | else |
1846 | MEvent.clicks = 1; |
1885 | MEvent.clicks = 1; |
1847 | |
1886 | |
1848 | selection_click (MEvent.clicks, ev.x, ev.y); |
1887 | selection_click (MEvent.clicks, ev.x, ev.y); |
1849 | } |
1888 | } |
1850 | |
1889 | |
1851 | MEvent.button = Button1; |
1890 | MEvent.button = Button1; |
1852 | break; |
1891 | break; |
1853 | |
1892 | |
1854 | case Button3: |
1893 | case Button3: |
1855 | if (MEvent.button == Button3 && clickintime) |
1894 | if (MEvent.button == Button3 && clickintime) |
1856 | selection_rotate (ev.x, ev.y); |
1895 | selection_rotate (ev.x, ev.y); |
1857 | else |
1896 | else |
1858 | selection_extend (ev.x, ev.y, 1); |
1897 | selection_extend (ev.x, ev.y, 1); |
1859 | |
1898 | |
1860 | MEvent.button = Button3; |
1899 | MEvent.button = Button3; |
1861 | break; |
1900 | break; |
1862 | } |
1901 | } |
1863 | } |
1902 | } |
1864 | |
1903 | |
1865 | MEvent.time = ev.time; |
1904 | MEvent.time = ev.time; |
1866 | return; |
1905 | return; |
1867 | } |
1906 | } |
1868 | |
1907 | |
… | |
… | |
2098 | |
2137 | |
2099 | v = ev.button == Button4 ? UP : DN; |
2138 | v = ev.button == Button4 ? UP : DN; |
2100 | |
2139 | |
2101 | if (ev.state & ShiftMask) |
2140 | if (ev.state & ShiftMask) |
2102 | i = 1; |
2141 | i = 1; |
2103 | else if (options & Opt_mouseWheelScrollPage) |
2142 | else if (OPTION (Opt_mouseWheelScrollPage)) |
2104 | i = nrow - 1; |
2143 | i = nrow - 1; |
2105 | else |
2144 | else |
2106 | i = 5; |
2145 | i = 5; |
2107 | |
2146 | |
2108 | # ifdef MOUSE_SLIP_WHEELING |
2147 | # ifdef MOUSE_SLIP_WHEELING |
… | |
… | |
2394 | XWindowAttributes wattr, wrootattr; |
2433 | XWindowAttributes wattr, wrootattr; |
2395 | dDisp; |
2434 | dDisp; |
2396 | |
2435 | |
2397 | pchanged = 0; |
2436 | pchanged = 0; |
2398 | |
2437 | |
2399 | if (!(options & Opt_transparent)) |
2438 | if (!OPTION (Opt_transparent)) |
2400 | return pchanged; /* Don't try any more */ |
2439 | return pchanged; /* Don't try any more */ |
2401 | |
2440 | |
2402 | XGetWindowAttributes (disp, display->root, &wrootattr); |
2441 | XGetWindowAttributes (disp, display->root, &wrootattr); |
2403 | rootdepth = wrootattr.depth; |
2442 | rootdepth = wrootattr.depth; |
2404 | |
2443 | |
… | |
… | |
2632 | bool |
2671 | bool |
2633 | rxvt_term::cmd_parse () |
2672 | rxvt_term::cmd_parse () |
2634 | { |
2673 | { |
2635 | bool flag = false; |
2674 | bool flag = false; |
2636 | unicode_t ch = NOCHAR; |
2675 | unicode_t ch = NOCHAR; |
2637 | unsigned char *seq_begin; // remember start of esc-sequence here |
2676 | char *seq_begin; // remember start of esc-sequence here |
2638 | |
2677 | |
2639 | for (;;) |
2678 | for (;;) |
2640 | { |
2679 | { |
2641 | if (ch == NOCHAR) |
2680 | if (ch == NOCHAR) |
2642 | { |
2681 | { |
… | |
… | |
2682 | if (ch == C0_LF) |
2721 | if (ch == C0_LF) |
2683 | nlines++; |
2722 | nlines++; |
2684 | |
2723 | |
2685 | refresh_count++; |
2724 | refresh_count++; |
2686 | |
2725 | |
2687 | if (!(options & Opt_jumpScroll) |
2726 | if (!OPTION (Opt_jumpScroll) |
2688 | || (refresh_count >= refresh_limit * (nrow - 1))) |
2727 | || (refresh_count >= refresh_limit * (nrow - 1))) |
2689 | { |
2728 | { |
2690 | refreshnow = true; |
2729 | refreshnow = true; |
|
|
2730 | refresh_count = 0; |
2691 | ch = NOCHAR; |
2731 | ch = NOCHAR; |
2692 | break; |
2732 | break; |
2693 | } |
2733 | } |
2694 | |
2734 | |
2695 | // scr_add_lines only works for nlines <= nrow - 1. |
2735 | // scr_add_lines only works for nlines <= nrow - 1. |
2696 | if (nlines >= nrow - 1) |
2736 | if (nlines >= nrow - 1) |
2697 | { |
2737 | { |
|
|
2738 | if (!PERL_INVOKE ((this, HOOK_ADD_LINES, DT_USTRING_LEN, buf, str - buf, DT_END))) |
2698 | scr_add_lines (buf, nlines, str - buf); |
2739 | scr_add_lines (buf, nlines, str - buf); |
|
|
2740 | |
2699 | nlines = 0; |
2741 | nlines = 0; |
2700 | str = buf; |
2742 | str = buf; |
2701 | eol = str + min (ncol, UBUFSIZ); |
2743 | eol = str + min (ncol, UBUFSIZ); |
2702 | } |
2744 | } |
2703 | |
2745 | |
… | |
… | |
2716 | |
2758 | |
2717 | seq_begin = cmdbuf_ptr; |
2759 | seq_begin = cmdbuf_ptr; |
2718 | ch = next_char (); |
2760 | ch = next_char (); |
2719 | } |
2761 | } |
2720 | |
2762 | |
|
|
2763 | if (!PERL_INVOKE ((this, HOOK_ADD_LINES, DT_USTRING_LEN, buf, str - buf, DT_END))) |
2721 | scr_add_lines (buf, nlines, str - buf); |
2764 | scr_add_lines (buf, nlines, str - buf); |
2722 | |
2765 | |
2723 | /* |
2766 | /* |
2724 | * If there have been a lot of new lines, then update the screen |
2767 | * If there have been a lot of new lines, then update the screen |
2725 | * What the heck I'll cheat and only refresh less than every page-full. |
2768 | * What the heck I'll cheat and only refresh less than every page-full. |
2726 | * the number of pages between refreshes is refresh_limit, which |
2769 | * the number of pages between refreshes is refresh_limit, which |
2727 | * is incremented here because we must be doing flat-out scrolling. |
2770 | * is incremented here because we must be doing flat-out scrolling. |
2728 | */ |
2771 | */ |
2729 | if (refreshnow) |
2772 | if (refreshnow) |
2730 | { |
2773 | { |
2731 | if ((options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2774 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2732 | refresh_limit++; |
2775 | refresh_limit++; |
2733 | else |
2776 | else |
2734 | { |
2777 | { |
2735 | flag = true; |
2778 | flag = true; |
2736 | scr_refresh (refresh_type); |
2779 | scr_refresh (refresh_type); |
|
|
2780 | flush_ev.stop (); |
2737 | } |
2781 | } |
2738 | } |
2782 | } |
2739 | |
2783 | |
2740 | } |
2784 | } |
2741 | else |
2785 | else |
… | |
… | |
2772 | rxvt_term::next_char () |
2816 | rxvt_term::next_char () |
2773 | { |
2817 | { |
2774 | while (cmdbuf_ptr < cmdbuf_endp) |
2818 | while (cmdbuf_ptr < cmdbuf_endp) |
2775 | { |
2819 | { |
2776 | // assume 7-bit to be ascii ALWAYS |
2820 | // assume 7-bit to be ascii ALWAYS |
2777 | if (*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2821 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2778 | return *cmdbuf_ptr++; |
2822 | return *cmdbuf_ptr++; |
2779 | |
2823 | |
2780 | wchar_t wc; |
2824 | wchar_t wc; |
2781 | size_t len = mbrtowc (&wc, (char *)cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); |
2825 | size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); |
2782 | |
2826 | |
2783 | if (len == (size_t)-2) |
2827 | if (len == (size_t)-2) |
2784 | { |
2828 | { |
2785 | // the mbstate stores incomplete sequences. didn't know this :/ |
2829 | // the mbstate stores incomplete sequences. didn't know this :/ |
2786 | cmdbuf_ptr = cmdbuf_endp; |
2830 | cmdbuf_ptr = cmdbuf_endp; |
… | |
… | |
2925 | case C0_ESC: |
2969 | case C0_ESC: |
2926 | process_escape_seq (); |
2970 | process_escape_seq (); |
2927 | break; |
2971 | break; |
2928 | case C0_ENQ: /* terminal Status */ |
2972 | case C0_ENQ: /* terminal Status */ |
2929 | if (rs[Rs_answerbackstring]) |
2973 | if (rs[Rs_answerbackstring]) |
2930 | tt_write ((const unsigned char *)rs[Rs_answerbackstring], |
2974 | tt_write (rs [Rs_answerbackstring], strlen (rs [Rs_answerbackstring])); |
2931 | (unsigned int)strlen (rs[Rs_answerbackstring])); |
|
|
2932 | else |
2975 | else |
2933 | tt_write ((unsigned char *)VT100_ANS, |
2976 | tt_write (VT100_ANS, strlen (VT100_ANS)); |
2934 | (unsigned int)strlen (VT100_ANS)); |
|
|
2935 | break; |
2977 | break; |
2936 | case C0_BEL: /* bell */ |
2978 | case C0_BEL: /* bell */ |
2937 | scr_bell (); |
2979 | scr_bell (); |
2938 | break; |
2980 | break; |
2939 | case C0_BS: /* backspace */ |
2981 | case C0_BS: /* backspace */ |
… | |
… | |
3127 | process_dcs_seq (); |
3169 | process_dcs_seq (); |
3128 | break; |
3170 | break; |
3129 | |
3171 | |
3130 | /* 8.3.110: SINGLE CHARACTER INTRODUCER */ |
3172 | /* 8.3.110: SINGLE CHARACTER INTRODUCER */ |
3131 | case C1_SCI: /* ESC Z */ |
3173 | case C1_SCI: /* ESC Z */ |
3132 | tt_write ((const unsigned char *)ESCZ_ANSWER, |
3174 | tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1); |
3133 | (unsigned int) (sizeof (ESCZ_ANSWER) - 1)); |
|
|
3134 | break; /* steal obsolete ESC [ c */ |
3175 | break; /* steal obsolete ESC [ c */ |
3135 | |
3176 | |
3136 | /* 8.3.16: CONTROL SEQUENCE INTRODUCER */ |
3177 | /* 8.3.16: CONTROL SEQUENCE INTRODUCER */ |
3137 | case C1_CSI: /* ESC [ */ |
3178 | case C1_CSI: /* ESC [ */ |
3138 | process_csi_seq (); |
3179 | process_csi_seq (); |
… | |
… | |
3382 | case CSI_SU: /* 8.3.148: (1) SCROLL UP */ |
3423 | case CSI_SU: /* 8.3.148: (1) SCROLL UP */ |
3383 | scr_scroll_text (screen.tscroll, screen.bscroll, arg[0]); |
3424 | scr_scroll_text (screen.tscroll, screen.bscroll, arg[0]); |
3384 | break; |
3425 | break; |
3385 | |
3426 | |
3386 | case CSI_DA: /* 8.3.24: (0) DEVICE ATTRIBUTES */ |
3427 | case CSI_DA: /* 8.3.24: (0) DEVICE ATTRIBUTES */ |
3387 | tt_write ((const unsigned char *)VT100_ANS, |
3428 | tt_write (VT100_ANS, sizeof (VT100_ANS) - 1); |
3388 | (unsigned int) (sizeof (VT100_ANS) - 1)); |
|
|
3389 | break; |
3429 | break; |
3390 | |
3430 | |
3391 | case CSI_SGR: /* 8.3.118: (0) SELECT GRAPHIC RENDITION */ |
3431 | case CSI_SGR: /* 8.3.118: (0) SELECT GRAPHIC RENDITION */ |
3392 | process_sgr_mode (nargs, arg); |
3432 | process_sgr_mode (nargs, arg); |
3393 | break; |
3433 | break; |
… | |
… | |
3400 | break; |
3440 | break; |
3401 | case 6: /* CPR requested */ |
3441 | case 6: /* CPR requested */ |
3402 | scr_report_position (); |
3442 | scr_report_position (); |
3403 | break; |
3443 | break; |
3404 | case 7: /* unofficial extension */ |
3444 | case 7: /* unofficial extension */ |
3405 | if (options & Opt_insecure) |
3445 | if (OPTION (Opt_insecure)) |
3406 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
3446 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
3407 | break; |
3447 | break; |
3408 | case 8: /* unofficial extension */ |
3448 | case 8: /* unofficial extension */ |
3409 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
3449 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
3410 | break; |
3450 | break; |
… | |
… | |
3574 | break; |
3614 | break; |
3575 | case 20: /* report icon label */ |
3615 | case 20: /* report icon label */ |
3576 | { |
3616 | { |
3577 | char *s; |
3617 | char *s; |
3578 | XGetIconName (disp, parent[0], &s); |
3618 | XGetIconName (disp, parent[0], &s); |
3579 | 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 */ |
3580 | XFree (s); |
3620 | XFree (s); |
3581 | } |
3621 | } |
3582 | break; |
3622 | break; |
3583 | case 21: /* report window title */ |
3623 | case 21: /* report window title */ |
3584 | { |
3624 | { |
3585 | char *s; |
3625 | char *s; |
3586 | XFetchName (disp, parent[0], &s); |
3626 | XFetchName (disp, parent[0], &s); |
3587 | 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 */ |
3588 | XFree (s); |
3628 | XFree (s); |
3589 | } |
3629 | } |
3590 | break; |
3630 | break; |
3591 | } |
3631 | } |
3592 | } |
3632 | } |
… | |
… | |
3595 | /*----------------------------------------------------------------------*/ |
3635 | /*----------------------------------------------------------------------*/ |
3596 | /* |
3636 | /* |
3597 | * get input up until STRING TERMINATOR (or BEL) |
3637 | * get input up until STRING TERMINATOR (or BEL) |
3598 | * ends_how is terminator used. returned input must be free()'d |
3638 | * ends_how is terminator used. returned input must be free()'d |
3599 | */ |
3639 | */ |
3600 | unsigned char * |
3640 | char * |
3601 | rxvt_term::get_to_st (unicode_t &ends_how) |
3641 | rxvt_term::get_to_st (unicode_t &ends_how) |
3602 | { |
3642 | { |
3603 | unicode_t ch; |
3643 | unicode_t ch; |
3604 | bool seen_esc = false; |
3644 | bool seen_esc = false; |
3605 | unsigned int n = 0; |
3645 | unsigned int n = 0; |
… | |
… | |
3638 | |
3678 | |
3639 | string[n++] = '\0'; |
3679 | string[n++] = '\0'; |
3640 | |
3680 | |
3641 | ends_how = (ch == 0x5c ? C0_ESC : ch); |
3681 | ends_how = (ch == 0x5c ? C0_ESC : ch); |
3642 | |
3682 | |
3643 | return (unsigned char *)rxvt_wcstombs (string); |
3683 | return rxvt_wcstombs (string); |
3644 | } |
3684 | } |
3645 | |
3685 | |
3646 | /*----------------------------------------------------------------------*/ |
3686 | /*----------------------------------------------------------------------*/ |
3647 | /* |
3687 | /* |
3648 | * process DEVICE CONTROL STRING `ESC P ... (ST|BEL)' or `0x90 ... (ST|BEL)' |
3688 | * process DEVICE CONTROL STRING `ESC P ... (ST|BEL)' or `0x90 ... (ST|BEL)' |
3649 | */ |
3689 | */ |
3650 | void |
3690 | void |
3651 | rxvt_term::process_dcs_seq () |
3691 | rxvt_term::process_dcs_seq () |
3652 | { |
3692 | { |
3653 | unsigned char *s; |
3693 | char *s; |
3654 | unicode_t eh; |
3694 | unicode_t eh; |
3655 | |
3695 | |
3656 | /* |
3696 | /* |
3657 | * Not handled yet |
3697 | * Not handled yet |
3658 | */ |
3698 | */ |
… | |
… | |
3677 | for (arg = 0; isdigit (ch); ch = cmd_getc ()) |
3717 | for (arg = 0; isdigit (ch); ch = cmd_getc ()) |
3678 | arg = arg * 10 + (ch - '0'); |
3718 | arg = arg * 10 + (ch - '0'); |
3679 | |
3719 | |
3680 | if (ch == ';') |
3720 | if (ch == ';') |
3681 | { |
3721 | { |
3682 | unsigned char *s = get_to_st (eh); |
3722 | char *s = get_to_st (eh); |
3683 | |
3723 | |
3684 | if (s) |
3724 | if (s) |
3685 | { |
3725 | { |
3686 | process_xterm_seq (arg, (char *)s, eh); |
3726 | process_xterm_seq (arg, s, eh); |
3687 | free (s); |
3727 | free (s); |
3688 | } |
3728 | } |
3689 | } |
3729 | } |
3690 | } |
3730 | } |
3691 | |
3731 | |
3692 | void |
3732 | void |
3693 | rxvt_term::process_color_seq (int report, int color, const char *str, unsigned char resp) |
3733 | rxvt_term::process_color_seq (int report, int color, const char *str, char resp) |
3694 | { |
3734 | { |
3695 | if (str[0] == '?' && !str[1]) |
3735 | if (str[0] == '?' && !str[1]) |
3696 | { |
3736 | { |
3697 | unsigned short r, g, b; |
3737 | unsigned short r, g, b; |
3698 | pix_colors_focused[color].get (display, r, g, b); |
3738 | pix_colors_focused[color].get (display, r, g, b); |
… | |
… | |
3704 | |
3744 | |
3705 | /* |
3745 | /* |
3706 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3746 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3707 | */ |
3747 | */ |
3708 | void |
3748 | void |
3709 | rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp) |
3749 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3710 | { |
3750 | { |
3711 | int changed = 0; |
3751 | int changed = 0; |
3712 | int color; |
3752 | int color; |
3713 | char *buf, *name; |
3753 | char *buf, *name; |
3714 | bool query = str[0] == '?' && !str[1]; |
3754 | bool query = str[0] == '?' && !str[1]; |
… | |
… | |
3868 | // TODO, when secure mode? |
3908 | // TODO, when secure mode? |
3869 | break; |
3909 | break; |
3870 | |
3910 | |
3871 | #ifdef MENUBAR |
3911 | #ifdef MENUBAR |
3872 | case URxvt_Menu: |
3912 | case URxvt_Menu: |
3873 | if (options & Opt_insecure) |
3913 | if (OPTION (Opt_insecure)) |
3874 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
3914 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
3875 | break; |
3915 | break; |
3876 | #endif |
3916 | #endif |
3877 | #if 0 |
3917 | #if 0 |
3878 | case XTerm_dumpscreen: /* no error notices */ |
3918 | case XTerm_dumpscreen: /* no error notices */ |
… | |
… | |
3894 | case URxvt_italicFont: |
3934 | case URxvt_italicFont: |
3895 | case URxvt_boldItalicFont: |
3935 | case URxvt_boldItalicFont: |
3896 | #endif |
3936 | #endif |
3897 | if (query) |
3937 | if (query) |
3898 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3938 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3899 | (options & Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3939 | OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3900 | ? fontset[op - URxvt_font]->fontdesc : "", |
3940 | ? fontset[op - URxvt_font]->fontdesc : "", |
3901 | resp); |
3941 | resp); |
3902 | else |
3942 | else |
3903 | { |
3943 | { |
3904 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
3944 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
… | |
… | |
3910 | break; |
3950 | break; |
3911 | |
3951 | |
3912 | #if ENABLE_FRILLS |
3952 | #if ENABLE_FRILLS |
3913 | case URxvt_locale: |
3953 | case URxvt_locale: |
3914 | if (query) |
3954 | if (query) |
3915 | 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); |
3916 | else |
3956 | else |
3917 | { |
3957 | { |
3918 | set_locale (str); |
3958 | set_locale (str); |
3919 | pty.set_utf8_mode (enc_utf8); |
3959 | pty.set_utf8_mode (enc_utf8); |
3920 | init_xlocale (); |
3960 | init_xlocale (); |
3921 | } |
3961 | } |
3922 | break; |
3962 | break; |
3923 | |
3963 | |
3924 | case URxvt_view_up: |
3964 | case URxvt_view_up: |
3925 | case URxvt_view_down: |
3965 | case URxvt_view_down: |
|
|
3966 | { |
3926 | int lines = atoi (str); |
3967 | int lines = atoi (str); |
3927 | |
3968 | |
3928 | if (lines) |
3969 | if (lines) |
3929 | scr_page (op == URxvt_view_up ? UP : DN, lines); |
3970 | scr_page (op == URxvt_view_up ? UP : DN, lines); |
3930 | else |
3971 | else |
3931 | { |
|
|
3932 | scr_erase_savelines (); |
3972 | scr_erase_savelines (); |
3933 | } |
3973 | } |
3934 | |
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 |
3935 | break; |
3982 | break; |
3936 | #endif |
3983 | #endif |
3937 | } |
3984 | } |
3938 | } |
3985 | } |
3939 | /*----------------------------------------------------------------------*/ |
3986 | /*----------------------------------------------------------------------*/ |
… | |
… | |
4048 | } |
4095 | } |
4049 | |
4096 | |
4050 | /* extra handling for values with state unkept */ |
4097 | /* extra handling for values with state unkept */ |
4051 | switch (arg[i]) |
4098 | switch (arg[i]) |
4052 | { |
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 |
4053 | case 1048: /* alternative cursor save */ |
4110 | case 1048: /* alternative cursor save */ |
4054 | case 1049: |
4111 | case 1049: |
4055 | if (options & Opt_secondaryScreen) |
4112 | if (OPTION (Opt_secondaryScreen)) |
4056 | if (mode == 0) |
4113 | if (mode == 0) |
4057 | scr_cursor (RESTORE); |
4114 | scr_cursor (RESTORE); |
4058 | else if (mode == 1) |
4115 | else if (mode == 1) |
4059 | scr_cursor (SAVE); |
4116 | scr_cursor (SAVE); |
4060 | break; |
4117 | break; |
… | |
… | |
4075 | case 3: /* 80/132 */ |
4132 | case 3: /* 80/132 */ |
4076 | if (priv_modes & PrivMode_132OK) |
4133 | if (priv_modes & PrivMode_132OK) |
4077 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4134 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4078 | break; |
4135 | break; |
4079 | case 4: /* smooth scrolling */ |
4136 | case 4: /* smooth scrolling */ |
4080 | if (state) |
4137 | if (!state) |
4081 | options &= ~Opt_jumpScroll; |
4138 | SET_OPTION (Opt_jumpScroll); |
4082 | else |
4139 | else |
4083 | options |= Opt_jumpScroll; |
4140 | CLR_OPTION (Opt_jumpScroll); |
4084 | break; |
4141 | break; |
4085 | case 5: /* reverse video */ |
4142 | case 5: /* reverse video */ |
4086 | scr_rvideo_mode (state); |
4143 | scr_rvideo_mode (state); |
4087 | break; |
4144 | break; |
4088 | case 6: /* relative/absolute origins */ |
4145 | case 6: /* relative/absolute origins */ |
… | |
… | |
4129 | #if 0 |
4186 | #if 0 |
4130 | case 1001: |
4187 | case 1001: |
4131 | break; /* X11 mouse highlighting */ |
4188 | break; /* X11 mouse highlighting */ |
4132 | #endif |
4189 | #endif |
4133 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4190 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4134 | if (state) |
4191 | if (!state) |
4135 | options &= ~Opt_scrollTtyOutput; |
4192 | SET_OPTION (Opt_scrollTtyOutput); |
4136 | else |
4193 | else |
4137 | options |= Opt_scrollTtyOutput; |
4194 | CLR_OPTION (Opt_scrollTtyOutput); |
4138 | break; |
4195 | break; |
4139 | case 1011: /* scroll to bottom on key press */ |
4196 | case 1011: /* scroll to bottom on key press */ |
4140 | if (state) |
4197 | if (state) |
4141 | options |= Opt_scrollTtyKeypress; |
4198 | SET_OPTION (Opt_scrollTtyKeypress); |
4142 | else |
4199 | else |
4143 | options &= ~Opt_scrollTtyKeypress; |
4200 | CLR_OPTION (Opt_scrollTtyKeypress); |
4144 | break; |
4201 | break; |
4145 | case 1047: /* secondary screen w/ clearing last */ |
4202 | case 1047: /* secondary screen w/ clearing last */ |
4146 | if (options & Opt_secondaryScreen) |
4203 | if (OPTION (Opt_secondaryScreen)) |
4147 | if (current_screen != PRIMARY) |
4204 | if (current_screen != PRIMARY) |
4148 | scr_erase_screen (2); |
4205 | scr_erase_screen (2); |
4149 | scr_change_screen (state); |
4206 | scr_change_screen (state); |
4150 | break; |
4207 | break; |
4151 | case 1049: /* secondary screen w/ clearing first */ |
4208 | case 1049: /* secondary screen w/ clearing first */ |
4152 | scr_change_screen (state); |
4209 | scr_change_screen (state); |
4153 | if (options & Opt_secondaryScreen) |
4210 | if (OPTION (Opt_secondaryScreen)) |
4154 | if (current_screen != PRIMARY) |
4211 | if (current_screen != PRIMARY) |
4155 | scr_erase_screen (2); |
4212 | scr_erase_screen (2); |
4156 | break; |
4213 | break; |
4157 | default: |
4214 | default: |
4158 | break; |
4215 | break; |
… | |
… | |
4286 | scr_color (Color_bg, Color_bg); |
4343 | scr_color (Color_bg, Color_bg); |
4287 | break; |
4344 | break; |
4288 | |
4345 | |
4289 | //case 50: // not variable spacing |
4346 | //case 50: // not variable spacing |
4290 | |
4347 | |
4291 | #ifndef NO_BRIGHTCOLOR |
4348 | #if ENABLE_FRILLS |
4292 | case 90: |
4349 | case 90: |
4293 | case 91: /* set bright fg color */ |
4350 | case 91: /* set bright fg color */ |
4294 | case 92: |
4351 | case 92: |
4295 | case 93: |
4352 | case 93: |
4296 | case 94: |
4353 | case 94: |
… | |
… | |
4308 | case 106: |
4365 | case 106: |
4309 | case 107: |
4366 | case 107: |
4310 | scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); |
4367 | scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); |
4311 | break; |
4368 | break; |
4312 | #endif |
4369 | #endif |
4313 | |
|
|
4314 | } |
4370 | } |
4315 | } |
4371 | } |
4316 | } |
4372 | } |
4317 | /*}}} */ |
4373 | /*}}} */ |
4318 | |
4374 | |
… | |
… | |
4342 | */ |
4398 | */ |
4343 | void |
4399 | void |
4344 | rxvt_term::tt_printf (const char *fmt,...) |
4400 | rxvt_term::tt_printf (const char *fmt,...) |
4345 | { |
4401 | { |
4346 | va_list arg_ptr; |
4402 | va_list arg_ptr; |
4347 | unsigned char buf[256]; |
4403 | char buf[256]; |
4348 | |
4404 | |
4349 | va_start (arg_ptr, fmt); |
4405 | va_start (arg_ptr, fmt); |
4350 | vsnprintf ((char *)buf, 256, fmt, arg_ptr); |
4406 | vsnprintf ((char *)buf, 256, fmt, arg_ptr); |
4351 | va_end (arg_ptr); |
4407 | va_end (arg_ptr); |
4352 | tt_write (buf, strlen (buf)); |
4408 | tt_write (buf, strlen (buf)); |
… | |
… | |
4357 | * or generated by us in response to a query ESC sequence. |
4413 | * or generated by us in response to a query ESC sequence. |
4358 | */ |
4414 | */ |
4359 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4415 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4360 | |
4416 | |
4361 | void |
4417 | void |
4362 | rxvt_term::tt_write (const unsigned char *data, unsigned int len) |
4418 | rxvt_term::tt_write (const char *data, unsigned int len) |
4363 | { |
4419 | { |
4364 | if (v_buflen == 0) |
4420 | if (v_buflen == 0) |
4365 | { |
4421 | { |
4366 | ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE)); |
4422 | ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE)); |
4367 | |
4423 | |
… | |
… | |
4370 | |
4426 | |
4371 | data += written; |
4427 | data += written; |
4372 | len -= written; |
4428 | len -= written; |
4373 | } |
4429 | } |
4374 | |
4430 | |
4375 | v_buffer = (unsigned char *)realloc (v_buffer, v_buflen + len); |
4431 | v_buffer = (char *)realloc (v_buffer, v_buflen + len); |
4376 | |
4432 | |
4377 | memcpy (v_buffer + v_buflen, data, len); |
4433 | memcpy (v_buffer + v_buflen, data, len); |
4378 | v_buflen += len; |
4434 | v_buflen += len; |
4379 | |
4435 | |
4380 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4436 | pty_ev.set (EVENT_READ | EVENT_WRITE); |