1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: command.C |
2 | * File: command.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
6 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
… | |
… | |
25 | * - extensive modifications |
25 | * - extensive modifications |
26 | * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> |
26 | * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> |
27 | * Copyright (c) 2001 Marius Gedminas |
27 | * Copyright (c) 2001 Marius Gedminas |
28 | * - Ctrl/Mod4+Tab works like Meta+Tab (options) |
28 | * - Ctrl/Mod4+Tab works like Meta+Tab (options) |
29 | * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> |
29 | * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> |
30 | * Copyright (c) 2003-2005 Marc Lehmann <pcg@goof.com> |
30 | * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com> |
31 | * |
31 | * |
32 | * This program is free software; you can redistribute it and/or modify |
32 | * This program is free software; you can redistribute it and/or modify |
33 | * it under the terms of the GNU General Public License as published by |
33 | * it under the terms of the GNU General Public License as published by |
34 | * the Free Software Foundation; either version 2 of the License, or |
34 | * the Free Software Foundation; either version 2 of the License, or |
35 | * (at your option) any later version. |
35 | * (at your option) any later version. |
… | |
… | |
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" |
52 | |
53 | |
53 | #if HAVE_SCHED_YIELD |
|
|
54 | # include <sched.h> |
|
|
55 | #endif |
|
|
56 | |
|
|
57 | #ifdef KEYSYM_RESOURCE |
54 | #ifdef KEYSYM_RESOURCE |
58 | # include "keyboard.h" |
55 | # include "keyboard.h" |
59 | #endif |
56 | #endif |
60 | |
57 | |
61 | #include <csignal> |
58 | #include <csignal> |
62 | |
59 | |
|
|
60 | #if LINUX_YIELD_HACK |
|
|
61 | # include <ctime> |
|
|
62 | #endif |
|
|
63 | |
63 | /*----------------------------------------------------------------------*/ |
64 | /*----------------------------------------------------------------------*/ |
64 | |
65 | |
65 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
66 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
66 | |
|
|
67 | // exception thrown when the command parser runs out of input data |
|
|
68 | class out_of_input { } out_of_input; |
|
|
69 | |
67 | |
70 | #if ENABLE_FRILLS || ISO_14755 |
68 | #if ENABLE_FRILLS || ISO_14755 |
71 | |
69 | |
72 | #define ISO_14755_STARTED 0x80000000UL |
70 | #define ISO_14755_STARTED 0x80000000UL |
73 | #define ISO_14755_51 0x40000000UL // basic (section 5.1) |
71 | #define ISO_14755_51 0x40000000UL // basic (section 5.1) |
… | |
… | |
145 | || !IN_RANGE_EXC (y, 0, nrow)) |
143 | || !IN_RANGE_EXC (y, 0, nrow)) |
146 | return; |
144 | return; |
147 | |
145 | |
148 | for (;;) |
146 | for (;;) |
149 | { |
147 | { |
150 | const line_t &l = ROW(y - view_start); |
148 | const line_t &l = ROW(y + view_start); |
151 | |
149 | |
152 | text_t t = l.t[x]; |
150 | text_t t = l.t[x]; |
153 | |
151 | |
154 | if (t != NOCHAR || !x) |
152 | if (t != NOCHAR || !x) |
155 | { |
153 | { |
… | |
… | |
228 | # if !UNICODE3 |
226 | # if !UNICODE3 |
229 | if (ch >= 0x10000) |
227 | if (ch >= 0x10000) |
230 | ch = 0xfffd; |
228 | ch = 0xfffd; |
231 | # endif |
229 | # endif |
232 | scr_overlay_set (11, y, ch, r); |
230 | scr_overlay_set (11, y, ch, r); |
|
|
231 | |
|
|
232 | if (WCWIDTH (ch) >= 2) |
233 | scr_overlay_set (12, y, NOCHAR, r); |
233 | scr_overlay_set (12, y, NOCHAR, r); |
234 | } |
234 | } |
235 | |
235 | |
|
|
236 | // { |
|
|
237 | // char buf[4+4+3+1]; |
|
|
238 | // snprintf (buf, sizeof (buf), "(%.4d|%.4d)", x, y); |
|
|
239 | // scr_overlay_set (0, 0, buf); |
|
|
240 | // } |
236 | scr_overlay_set (0, len , attr); |
241 | scr_overlay_set (0, len , attr); |
237 | scr_overlay_set (0, len + 1, fname); |
242 | scr_overlay_set (0, len + 1, fname); |
238 | |
243 | |
239 | free (fname); |
244 | free (fname); |
240 | |
245 | |
… | |
… | |
266 | mb[0] = ch[0]; |
271 | mb[0] = ch[0]; |
267 | len = 1; |
272 | len = 1; |
268 | } |
273 | } |
269 | |
274 | |
270 | if (len > 0) |
275 | if (len > 0) |
271 | tt_write ((unsigned char *)mb, len); |
276 | tt_write (mb, len); |
272 | else |
277 | else |
273 | scr_bell (); |
278 | scr_bell (); |
274 | } |
279 | } |
275 | |
280 | |
276 | iso14755buf = 0; |
281 | iso14755buf = 0; |
… | |
… | |
293 | |
298 | |
294 | return -1; |
299 | return -1; |
295 | } |
300 | } |
296 | #endif |
301 | #endif |
297 | |
302 | |
298 | /*{{{ Convert the keypress event into a string */ |
|
|
299 | void |
303 | void |
300 | rxvt_term::lookup_key (XKeyEvent &ev) |
304 | rxvt_term::key_press (XKeyEvent &ev) |
301 | { |
305 | { |
302 | int ctrl, meta, shft, len; |
306 | int ctrl, meta, shft, len; |
303 | unsigned int newlen; |
307 | unsigned int newlen; |
304 | KeySym keysym; |
308 | KeySym keysym; |
305 | #ifdef DEBUG_CMD |
|
|
306 | static int debug_key = 1; /* accessible by a debugger only */ |
|
|
307 | #endif |
|
|
308 | int valid_keysym; |
309 | int valid_keysym; |
309 | unsigned char kbuf[KBUFSZ]; |
310 | char kbuf[KBUFSZ]; |
|
|
311 | |
|
|
312 | #if ISO_14755 |
|
|
313 | if (iso14755buf & ISO_14755_52) |
|
|
314 | return; |
|
|
315 | #endif |
310 | |
316 | |
311 | /* |
317 | /* |
312 | * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an |
318 | * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an |
313 | * escape sequence to toggle the Keypad. |
319 | * escape sequence to toggle the Keypad. |
314 | * |
320 | * |
… | |
… | |
332 | Status status_return; |
338 | Status status_return; |
333 | |
339 | |
334 | #if 0 |
340 | #if 0 |
335 | #ifdef X_HAVE_UTF8_STRING |
341 | #ifdef X_HAVE_UTF8_STRING |
336 | if (enc_utf8 && 0) // currently disabled, doesn't seem to work, nor is useful |
342 | if (enc_utf8 && 0) // currently disabled, doesn't seem to work, nor is useful |
337 | len = Xutf8LookupString (Input_Context, &ev, (char *)kbuf, |
343 | len = Xutf8LookupString (Input_Context, &ev, kbuf, |
338 | KBUFSZ, &keysym, &status_return); |
344 | KBUFSZ, &keysym, &status_return); |
339 | else |
345 | else |
340 | #endif |
346 | #endif |
341 | #endif |
347 | #endif |
342 | { |
348 | { |
… | |
… | |
379 | || status_return == XLookupBoth; |
385 | || status_return == XLookupBoth; |
380 | } |
386 | } |
381 | else |
387 | else |
382 | #endif |
388 | #endif |
383 | { |
389 | { |
384 | len = XLookupString (&ev, (char *)kbuf, KBUFSZ, &keysym, &compose); |
390 | len = XLookupString (&ev, kbuf, KBUFSZ, &keysym, &compose); |
385 | valid_keysym = keysym != NoSymbol; |
391 | valid_keysym = keysym != NoSymbol; |
386 | } |
392 | } |
387 | |
393 | |
388 | if (valid_keysym) |
394 | if (valid_keysym) |
389 | { |
395 | { |
… | |
… | |
441 | scr_move_to (0, 1); |
447 | scr_move_to (0, 1); |
442 | return; |
448 | return; |
443 | } |
449 | } |
444 | else if (keysym == XK_End) |
450 | else if (keysym == XK_End) |
445 | { |
451 | { |
446 | scr_move_to (1, 0); |
452 | scr_move_to (1, 1); |
447 | return; |
453 | return; |
448 | } |
454 | } |
449 | } |
455 | } |
450 | #endif |
456 | #endif |
451 | } |
457 | } |
… | |
… | |
462 | { |
468 | { |
463 | switch (keysym) |
469 | switch (keysym) |
464 | { |
470 | { |
465 | /* normal XTerm key bindings */ |
471 | /* normal XTerm key bindings */ |
466 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
472 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
467 | selection_request (ev.time, 0, 0); |
473 | selection_request (ev.time); |
468 | return; |
474 | return; |
469 | #if TODO |
475 | #if TODO |
470 | /* rxvt extras */ |
476 | /* rxvt extras */ |
471 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
477 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
472 | change_font (FONT_UP); |
478 | change_font (FONT_UP); |
… | |
… | |
491 | { |
497 | { |
492 | commit_iso14755 (); |
498 | commit_iso14755 (); |
493 | iso14755buf = ISO_14755_51; |
499 | iso14755buf = ISO_14755_51; |
494 | # if ISO_14755 |
500 | # if ISO_14755 |
495 | iso14755_51 (0); |
501 | iso14755_51 (0); |
|
|
502 | # endif |
|
|
503 | return; |
|
|
504 | } |
|
|
505 | else if (keysym == XK_BackSpace) |
|
|
506 | { |
|
|
507 | iso14755buf = ((iso14755buf & ISO_14755_MASK) >> 4) | ISO_14755_51; |
|
|
508 | # if ISO_14755 |
|
|
509 | iso14755_51 (iso14755buf & ISO_14755_MASK); |
496 | # endif |
510 | # endif |
497 | return; |
511 | return; |
498 | } |
512 | } |
499 | else if ((hv = hex_keyval (ev)) >= 0) |
513 | else if ((hv = hex_keyval (ev)) >= 0) |
500 | { |
514 | { |
… | |
… | |
853 | { |
867 | { |
854 | #ifdef META8_OPTION |
868 | #ifdef META8_OPTION |
855 | /* set 8-bit on */ |
869 | /* set 8-bit on */ |
856 | if (meta && (meta_char == 0x80)) |
870 | if (meta && (meta_char == 0x80)) |
857 | { |
871 | { |
858 | unsigned char *ch; |
872 | char *ch; |
859 | |
873 | |
860 | for (ch = kbuf; ch < kbuf + len; ch++) |
874 | for (ch = kbuf; ch < kbuf + len; ch++) |
861 | *ch |= 0x80; |
875 | *ch |= 0x80; |
862 | |
876 | |
863 | meta = 0; |
877 | meta = 0; |
… | |
… | |
865 | #endif |
879 | #endif |
866 | /* nil */ ; |
880 | /* nil */ ; |
867 | } |
881 | } |
868 | } |
882 | } |
869 | |
883 | |
|
|
884 | if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, DT_STR_LEN, kbuf, len, DT_END))) |
|
|
885 | return; |
|
|
886 | |
870 | if (len <= 0) |
887 | if (len <= 0) |
871 | return; /* not mapped */ |
888 | return; /* not mapped */ |
872 | |
889 | |
873 | if (OPTION (Opt_scrollTtyKeypress)) |
890 | if (option (Opt_scrollTtyKeypress)) |
874 | if (view_start) |
891 | if (view_start) |
875 | { |
892 | { |
876 | view_start = 0; |
893 | view_start = 0; |
877 | want_refresh = 1; |
894 | want_refresh = 1; |
878 | } |
895 | } |
… | |
… | |
896 | #ifdef META8_OPTION |
913 | #ifdef META8_OPTION |
897 | && meta_char == C0_ESC |
914 | && meta_char == C0_ESC |
898 | #endif |
915 | #endif |
899 | ) |
916 | ) |
900 | { |
917 | { |
901 | const unsigned char ch = C0_ESC; |
918 | const char ch = C0_ESC; |
902 | tt_write (&ch, 1); |
919 | tt_write (&ch, 1); |
903 | } |
920 | } |
904 | |
921 | |
905 | #if defined(DEBUG_CMD) |
|
|
906 | /* Display keyboard buffer contents */ |
|
|
907 | unsigned char *p; |
|
|
908 | int i; |
|
|
909 | |
|
|
910 | fprintf (stderr, "key 0x%04X [%d]: `", (unsigned int)keysym, len); |
|
|
911 | for (i = 0, p = kbuf; i < len; i++, p++) |
|
|
912 | fprintf (stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); |
|
|
913 | fprintf (stderr, "'\n"); |
|
|
914 | #endif /* DEBUG_CMD */ |
|
|
915 | tt_write (kbuf, (unsigned int)len); |
922 | tt_write (kbuf, (unsigned int)len); |
916 | } |
923 | } |
917 | /*}}} */ |
|
|
918 | |
924 | |
|
|
925 | void |
|
|
926 | rxvt_term::key_release (XKeyEvent &ev) |
|
|
927 | { |
|
|
928 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 || ENABLE_PERL |
|
|
929 | KeySym keysym; |
|
|
930 | |
|
|
931 | keysym = XLookupKeysym (&ev, ev.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
|
|
932 | #endif |
|
|
933 | |
|
|
934 | #if ENABLE_FRILLS || ISO_14755 |
|
|
935 | // ISO 14755 support |
|
|
936 | if (iso14755buf) |
|
|
937 | if (iso14755buf & ISO_14755_52) |
|
|
938 | { |
|
|
939 | # if ENABLE_OVERLAY |
|
|
940 | scr_overlay_off (); |
|
|
941 | # endif |
|
|
942 | # if ISO_14755 |
|
|
943 | // iso14755 part 5.2 handling: release time |
|
|
944 | // first: controls |
|
|
945 | if ((ev.state & ControlMask) |
|
|
946 | && ((keysym >= 0x40 && keysym <= 0x5f) |
|
|
947 | || (keysym >= 0x61 && keysym <= 0x7f))) |
|
|
948 | { |
|
|
949 | iso14755buf = ISO_14755_51 | 0x2400 | (keysym & 0x1f); |
|
|
950 | commit_iso14755 (); |
|
|
951 | |
|
|
952 | return; |
|
|
953 | } |
|
|
954 | |
|
|
955 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
|
|
956 | if (i[0] == keysym) |
|
|
957 | { |
|
|
958 | iso14755buf = ISO_14755_51 | i[1]; |
|
|
959 | commit_iso14755 (); |
|
|
960 | |
|
|
961 | return; |
|
|
962 | } |
|
|
963 | |
|
|
964 | scr_bell (); |
|
|
965 | # endif |
|
|
966 | iso14755buf = 0; |
|
|
967 | |
|
|
968 | return; |
|
|
969 | } |
|
|
970 | else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) |
|
|
971 | { |
|
|
972 | # if ENABLE_OVERLAY |
|
|
973 | scr_overlay_off (); |
|
|
974 | # endif |
|
|
975 | if (iso14755buf & ISO_14755_51) |
|
|
976 | commit_iso14755 (); |
|
|
977 | #if ISO_14755 |
|
|
978 | else if (option (Opt_iso14755_52) && iso14755buf & ISO_14755_STARTED) |
|
|
979 | { |
|
|
980 | iso14755buf = ISO_14755_52; // iso14755 part 5.2: remember empty begin/end pair |
|
|
981 | |
|
|
982 | scr_overlay_new (0, -1, sizeof ("KEYCAP PICTURE INSERT MODE") - 1, 1); |
|
|
983 | scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE"); |
|
|
984 | } |
|
|
985 | # endif |
|
|
986 | else |
|
|
987 | iso14755buf = 0; |
|
|
988 | } |
|
|
989 | #endif |
|
|
990 | |
|
|
991 | if (HOOK_INVOKE ((this, HOOK_KEY_RELEASE, DT_XEVENT, &ev, DT_INT, keysym, DT_END))) |
|
|
992 | return; |
|
|
993 | |
|
|
994 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
|
|
995 | if (!(ev.state & ControlMask)) |
|
|
996 | slip_wheel_ev.stop (); |
|
|
997 | else if (keysym == XK_Control_L || keysym == XK_Control_R) |
|
|
998 | mouse_slip_wheel_speed = 0; |
|
|
999 | #endif |
|
|
1000 | } |
|
|
1001 | |
919 | #if MENUBAR_MAX || defined (KEYSYM_RESOURCE) |
1002 | #if defined (KEYSYM_RESOURCE) |
920 | /*{{{ rxvt_cmd_write (), rxvt_cmd_getc () */ |
|
|
921 | /* attempt to `write' count to the input buffer */ |
|
|
922 | unsigned int |
1003 | unsigned int |
923 | rxvt_term::cmd_write (const unsigned char *str, unsigned int count) |
1004 | rxvt_term::cmd_write (const char *str, unsigned int count) |
924 | { |
1005 | { |
925 | unsigned int n, s; |
1006 | unsigned int n, s; |
926 | |
1007 | |
927 | n = cmdbuf_ptr - cmdbuf_base; |
1008 | n = cmdbuf_ptr - cmdbuf_base; |
928 | s = cmdbuf_base + CBUFSIZ - 1 - cmdbuf_endp; |
1009 | s = cmdbuf_base + CBUFSIZ - 1 - cmdbuf_endp; |
… | |
… | |
965 | } |
1046 | } |
966 | #endif |
1047 | #endif |
967 | |
1048 | |
968 | if (want_refresh) |
1049 | if (want_refresh) |
969 | { |
1050 | { |
|
|
1051 | if (SHOULD_INVOKE (HOOK_LINE_UPDATE)) |
|
|
1052 | { |
|
|
1053 | int row = view_start; |
|
|
1054 | int end_row = row + nrow; |
|
|
1055 | |
|
|
1056 | while (row > top_row && ROW (row - 1).is_longer ()) |
|
|
1057 | --row; |
|
|
1058 | |
|
|
1059 | do |
|
|
1060 | { |
|
|
1061 | int start_row = row; |
|
|
1062 | line_t *l; |
|
|
1063 | |
|
|
1064 | do |
|
|
1065 | { |
|
|
1066 | l = &ROW (row++); |
|
|
1067 | |
|
|
1068 | if (!(l->f & LINE_FILTERED)) |
|
|
1069 | { |
|
|
1070 | // line not filtered, mark it as filtered |
|
|
1071 | l->f |= LINE_FILTERED; |
|
|
1072 | while (l->is_longer ()) |
|
|
1073 | { |
|
|
1074 | l = &ROW (row++); |
|
|
1075 | l->f |= LINE_FILTERED; |
|
|
1076 | } |
|
|
1077 | |
|
|
1078 | // and filter it |
|
|
1079 | HOOK_INVOKE ((this, HOOK_LINE_UPDATE, DT_INT, start_row, DT_END)); |
|
|
1080 | |
|
|
1081 | break; |
|
|
1082 | } |
|
|
1083 | } |
|
|
1084 | while (l->is_longer () && row < end_row); |
|
|
1085 | } |
|
|
1086 | while (row < end_row); |
|
|
1087 | } |
|
|
1088 | |
970 | scr_refresh (refresh_type); |
1089 | scr_refresh (); |
971 | scrollbar_show (1); |
1090 | scrollbar_show (1); |
972 | #ifdef USE_XIM |
1091 | #ifdef USE_XIM |
973 | IMSendSpot (); |
1092 | IMSendSpot (); |
974 | #endif |
1093 | #endif |
975 | } |
1094 | } |
… | |
… | |
978 | } |
1097 | } |
979 | |
1098 | |
980 | void |
1099 | void |
981 | rxvt_term::check_cb (check_watcher &w) |
1100 | rxvt_term::check_cb (check_watcher &w) |
982 | { |
1101 | { |
983 | SET_R (this); |
1102 | make_current (); |
984 | SET_LOCALE (locale); |
|
|
985 | |
1103 | |
986 | display->flush (); |
1104 | display->flush (); |
987 | |
1105 | |
988 | if (want_refresh && !flush_ev.active) |
1106 | if (want_refresh && !flush_ev.active) |
989 | flush_ev.start (NOW + 0.01); |
1107 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
990 | } |
1108 | } |
991 | |
1109 | |
992 | void |
1110 | void |
993 | rxvt_term::flush_cb (time_watcher &w) |
1111 | rxvt_term::flush_cb (time_watcher &w) |
994 | { |
1112 | { |
995 | SET_R (this); |
1113 | make_current (); |
996 | SET_LOCALE (locale); |
|
|
997 | |
1114 | |
998 | refresh_limit = 1; |
1115 | refresh_limit = 1; |
999 | refresh_count = 0; |
1116 | refresh_count = 0; |
1000 | flush (); |
1117 | flush (); |
1001 | } |
1118 | } |
… | |
… | |
1005 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1122 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1006 | { |
1123 | { |
1007 | hidden_cursor = !hidden_cursor; |
1124 | hidden_cursor = !hidden_cursor; |
1008 | want_refresh = 1; |
1125 | want_refresh = 1; |
1009 | |
1126 | |
1010 | w.start (w.at + BLINK_INTERVAL); |
1127 | w.start (w.at + CURSOR_BLINK_INTERVAL); |
1011 | } |
1128 | } |
1012 | #endif |
1129 | #endif |
1013 | |
1130 | |
1014 | #ifdef TEXT_BLINK |
1131 | #ifdef TEXT_BLINK |
1015 | void |
1132 | void |
… | |
… | |
1029 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1146 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1030 | { |
1147 | { |
1031 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1148 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1032 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1149 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1033 | { |
1150 | { |
1034 | refresh_type |= SMOOTH_REFRESH; |
|
|
1035 | want_refresh = 1; |
1151 | want_refresh = 1; |
1036 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1152 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1037 | } |
1153 | } |
1038 | } |
1154 | } |
1039 | #endif |
1155 | #endif |
… | |
… | |
1043 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1159 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1044 | { |
1160 | { |
1045 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1161 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1046 | { |
1162 | { |
1047 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1163 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1048 | refresh_type |= SMOOTH_REFRESH; |
|
|
1049 | want_refresh = 1; |
1164 | want_refresh = 1; |
1050 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1165 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1051 | } |
1166 | } |
1052 | } |
1167 | } |
1053 | #endif |
1168 | #endif |
… | |
… | |
1058 | { |
1173 | { |
1059 | if (mouse_slip_wheel_speed == 0 |
1174 | if (mouse_slip_wheel_speed == 0 |
1060 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
1175 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
1061 | : scr_page (UP, mouse_slip_wheel_speed)) |
1176 | : scr_page (UP, mouse_slip_wheel_speed)) |
1062 | { |
1177 | { |
1063 | if (view_start == nsaved || |
1178 | if (view_start == top_row || view_start == 0) |
1064 | view_start == 0) |
|
|
1065 | mouse_slip_wheel_speed = 0; |
1179 | mouse_slip_wheel_speed = 0; |
1066 | |
1180 | |
1067 | refresh_type |= SMOOTH_REFRESH; |
|
|
1068 | want_refresh = 1; |
1181 | want_refresh = 1; |
1069 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1182 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1070 | } |
1183 | } |
1071 | } |
1184 | } |
1072 | #endif |
1185 | #endif |
1073 | |
1186 | |
|
|
1187 | #if LINUX_YIELD_HACK |
|
|
1188 | static struct event_handler |
|
|
1189 | { |
|
|
1190 | check_watcher yield_ev; |
|
|
1191 | |
|
|
1192 | void yield_cb (check_watcher &w) |
|
|
1193 | { |
|
|
1194 | // this should really be sched_yield(), but the linux guys thought |
|
|
1195 | // that giving a process calling sched_yield () less cpu time than |
|
|
1196 | // ones with high nice levels is a useful thing to do. It surely is is |
|
|
1197 | // allowed by the sus... as is returning ENOSYS. |
|
|
1198 | |
|
|
1199 | struct timespec ts = { 0, 0 }; |
|
|
1200 | nanosleep (&ts, 0); |
|
|
1201 | |
|
|
1202 | w.stop (); |
|
|
1203 | } |
|
|
1204 | |
|
|
1205 | event_handler () |
|
|
1206 | : yield_ev (this, &event_handler::yield_cb) |
|
|
1207 | { |
|
|
1208 | } |
|
|
1209 | } event_handler; |
|
|
1210 | #endif |
|
|
1211 | |
1074 | bool |
1212 | bool |
1075 | rxvt_term::pty_fill () |
1213 | rxvt_term::pty_fill () |
1076 | { |
1214 | { |
1077 | ssize_t n = cmdbuf_endp - cmdbuf_ptr; |
1215 | ssize_t n = cmdbuf_endp - cmdbuf_ptr; |
1078 | |
1216 | |
1079 | if (CBUFSIZ == n) |
1217 | if (CBUFSIZ == n) |
1080 | { |
1218 | { |
1081 | rxvt_warn ("pty_fill on full buffer, draining input, continuing.\n"); |
1219 | rxvt_warn ("PLEASE REPORT: pty_fill on full buffer, draining input, continuing.\n"); |
1082 | n = 0; |
1220 | n = 0; |
1083 | } |
1221 | } |
1084 | |
1222 | |
1085 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1223 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1086 | cmdbuf_ptr = cmdbuf_base; |
1224 | cmdbuf_ptr = cmdbuf_base; |
1087 | cmdbuf_endp = cmdbuf_ptr + n; |
1225 | cmdbuf_endp = cmdbuf_ptr + n; |
1088 | |
1226 | |
1089 | ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); |
1227 | ssize_t r = read (pty->pty, cmdbuf_endp, CBUFSIZ - n); |
1090 | |
1228 | |
1091 | if (r > 0) |
1229 | if (r > 0) |
1092 | { |
1230 | { |
1093 | cmdbuf_endp += r; |
1231 | cmdbuf_endp += r; |
1094 | return true; |
1232 | return true; |
1095 | } |
1233 | } |
1096 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
1234 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
1097 | { |
1235 | { |
1098 | #if HAVE_SCHED_YIELD |
1236 | #if LINUX_YIELD_HACK |
1099 | sched_yield (); |
1237 | if (display->is_local) |
|
|
1238 | event_handler.yield_ev.start (); |
1100 | #endif |
1239 | #endif |
1101 | } |
1240 | } |
1102 | else |
1241 | else |
1103 | { |
1242 | { |
1104 | pty_ev.stop (); |
1243 | pty_ev.stop (); |
1105 | |
1244 | |
1106 | if (!OPTION (Opt_hold)) |
1245 | if (!option (Opt_hold)) |
1107 | destroy (); |
1246 | destroy (); |
1108 | } |
1247 | } |
1109 | |
1248 | |
1110 | return false; |
1249 | return false; |
1111 | } |
1250 | } |
1112 | |
1251 | |
1113 | void |
1252 | void |
1114 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1253 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1115 | { |
1254 | { |
1116 | SET_R (this); |
1255 | make_current (); |
1117 | SET_LOCALE (locale); |
|
|
1118 | |
1256 | |
1119 | if (revents & EVENT_READ) |
1257 | if (revents & EVENT_READ) |
1120 | // loop, but don't allow a single term to monopolize us |
1258 | // loop, but don't allow a single term to monopolize us |
1121 | while (pty_fill ()) |
1259 | while (pty_fill ()) |
1122 | if (cmd_parse ()) |
1260 | if (cmd_parse ()) |
… | |
… | |
1127 | } |
1265 | } |
1128 | |
1266 | |
1129 | void |
1267 | void |
1130 | rxvt_term::pointer_unblank () |
1268 | rxvt_term::pointer_unblank () |
1131 | { |
1269 | { |
1132 | XDefineCursor (display->display, vt, TermWin_cursor); |
1270 | XDefineCursor (dpy, vt, TermWin_cursor); |
1133 | recolour_cursor (); |
1271 | recolour_cursor (); |
1134 | |
1272 | |
1135 | #ifdef POINTER_BLANK |
1273 | #ifdef POINTER_BLANK |
1136 | hidden_pointer = 0; |
1274 | hidden_pointer = 0; |
1137 | |
1275 | |
1138 | if (OPTION (Opt_pointerBlank)) |
1276 | if (option (Opt_pointerBlank)) |
1139 | pointer_ev.start (NOW + pointerBlankDelay); |
1277 | pointer_ev.start (NOW + pointerBlankDelay); |
1140 | #endif |
1278 | #endif |
1141 | } |
1279 | } |
1142 | |
1280 | |
1143 | #ifdef POINTER_BLANK |
1281 | #ifdef POINTER_BLANK |
1144 | void |
1282 | void |
1145 | rxvt_term::pointer_blank () |
1283 | rxvt_term::pointer_blank () |
1146 | { |
1284 | { |
1147 | if (! OPTION (Opt_pointerBlank)) |
1285 | if (!option (Opt_pointerBlank)) |
1148 | return; |
1286 | return; |
1149 | |
1287 | |
1150 | XDefineCursor (display->display, vt, display->blank_cursor); |
1288 | XDefineCursor (dpy, vt, display->blank_cursor); |
1151 | XFlush (display->display); |
1289 | XFlush (dpy); |
1152 | |
1290 | |
1153 | hidden_pointer = 1; |
1291 | hidden_pointer = 1; |
1154 | } |
1292 | } |
1155 | |
1293 | |
1156 | void |
1294 | void |
1157 | rxvt_term::pointer_cb (time_watcher &w) |
1295 | rxvt_term::pointer_cb (time_watcher &w) |
1158 | { |
1296 | { |
1159 | SET_R (this); |
1297 | make_current (); |
1160 | SET_LOCALE (locale); |
|
|
1161 | |
1298 | |
1162 | pointer_blank (); |
1299 | pointer_blank (); |
1163 | } |
1300 | } |
1164 | #endif |
1301 | #endif |
1165 | |
1302 | |
… | |
… | |
1230 | (32 + button_number + key_state), |
1367 | (32 + button_number + key_state), |
1231 | (32 + x + 1), |
1368 | (32 + x + 1), |
1232 | (32 + y + 1)); |
1369 | (32 + y + 1)); |
1233 | } |
1370 | } |
1234 | |
1371 | |
1235 | #ifdef USING_W11LIB |
|
|
1236 | void |
|
|
1237 | rxvt_W11_process_x_event (XEvent *ev) |
|
|
1238 | { |
|
|
1239 | rxvt_t *r = rxvt_get_r (); |
|
|
1240 | |
|
|
1241 | x_cb (*ev); |
|
|
1242 | } |
|
|
1243 | #endif |
|
|
1244 | |
|
|
1245 | /*{{{ process an X event */ |
1372 | /*{{{ process an X event */ |
1246 | void |
1373 | void |
1247 | rxvt_term::x_cb (XEvent &ev) |
1374 | rxvt_term::x_cb (XEvent &ev) |
1248 | { |
1375 | { |
1249 | dDisp; |
1376 | make_current (); |
1250 | |
1377 | |
1251 | SET_R (this); |
1378 | dLocal (Display *, dpy); |
1252 | SET_LOCALE (locale); |
|
|
1253 | |
1379 | |
1254 | #if defined(CURSOR_BLINK) |
1380 | if (ev.xany.window == vt |
1255 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
1381 | && SHOULD_INVOKE (HOOK_X_EVENT) |
1256 | { |
1382 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
1257 | if (hidden_cursor) |
1383 | return; |
1258 | { |
|
|
1259 | hidden_cursor = 0; |
|
|
1260 | want_refresh = 1; |
|
|
1261 | } |
|
|
1262 | |
1384 | |
1263 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1385 | // for XQueryPointer |
1264 | } |
|
|
1265 | #endif |
|
|
1266 | |
|
|
1267 | #if defined(POINTER_BLANK) |
|
|
1268 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
|
|
1269 | { |
|
|
1270 | if (ev.type == MotionNotify |
|
|
1271 | || ev.type == ButtonPress |
|
|
1272 | || ev.type == ButtonRelease) |
|
|
1273 | if (hidden_pointer) |
|
|
1274 | pointer_unblank (); |
|
|
1275 | |
|
|
1276 | if (ev.type == KeyPress && hidden_pointer == 0) |
|
|
1277 | pointer_blank (); |
|
|
1278 | } |
|
|
1279 | #endif |
|
|
1280 | |
|
|
1281 | Window unused_root, unused_child; |
1386 | Window unused_root, unused_child; |
1282 | int unused_root_x, unused_root_y; |
1387 | int unused_root_x, unused_root_y; |
1283 | unsigned int unused_mask; |
1388 | unsigned int unused_mask; |
1284 | |
1389 | |
1285 | switch (ev.type) |
1390 | switch (ev.type) |
1286 | { |
1391 | { |
1287 | case KeyPress: |
1392 | case KeyPress: |
1288 | #if ISO_14755 |
1393 | key_press (ev.xkey); |
1289 | if (!(iso14755buf & ISO_14755_52)) |
|
|
1290 | #endif |
|
|
1291 | lookup_key (ev.xkey); |
|
|
1292 | |
|
|
1293 | break; |
1394 | break; |
1294 | |
1395 | |
1295 | case KeyRelease: |
1396 | case KeyRelease: |
1296 | { |
1397 | key_release (ev.xkey); |
1297 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 |
|
|
1298 | KeySym ks; |
|
|
1299 | |
|
|
1300 | ks = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
|
|
1301 | #endif |
|
|
1302 | |
|
|
1303 | #if ENABLE_FRILLS || ISO_14755 |
|
|
1304 | // ISO 14755 support |
|
|
1305 | if (iso14755buf) |
|
|
1306 | if (iso14755buf & ISO_14755_52) |
|
|
1307 | { |
|
|
1308 | # if ENABLE_OVERLAY |
|
|
1309 | scr_overlay_off (); |
|
|
1310 | # endif |
|
|
1311 | # if ISO_14755 |
|
|
1312 | // iso14755 part 5.2 handling: release time |
|
|
1313 | // first: controls |
|
|
1314 | if ((ev.xkey.state & ControlMask) |
|
|
1315 | && ((ks >= 0x40 && ks <= 0x5f) |
|
|
1316 | || (ks >= 0x61 && ks <= 0x7f))) |
|
|
1317 | { |
|
|
1318 | iso14755buf = ISO_14755_51 | 0x2400 | (ks & 0x1f); |
|
|
1319 | commit_iso14755 (); |
|
|
1320 | return; // case-break; |
|
|
1321 | } |
|
|
1322 | |
|
|
1323 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
|
|
1324 | if (i[0] == ks) |
|
|
1325 | { |
|
|
1326 | iso14755buf = ISO_14755_51 | i[1]; |
|
|
1327 | commit_iso14755 (); |
|
|
1328 | return; // case-break; |
|
|
1329 | } |
|
|
1330 | |
|
|
1331 | scr_bell (); |
|
|
1332 | # endif |
|
|
1333 | iso14755buf = 0; |
|
|
1334 | break; |
|
|
1335 | } |
|
|
1336 | else if ((ev.xkey.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) |
|
|
1337 | { |
|
|
1338 | # if ENABLE_OVERLAY |
|
|
1339 | scr_overlay_off (); |
|
|
1340 | # endif |
|
|
1341 | if (iso14755buf & ISO_14755_51) |
|
|
1342 | commit_iso14755 (); |
|
|
1343 | #if ISO_14755 |
|
|
1344 | else if (iso14755buf & ISO_14755_STARTED) |
|
|
1345 | { |
|
|
1346 | iso14755buf = ISO_14755_52; // iso14755 part 5.2: remember empty begin/end pair |
|
|
1347 | |
|
|
1348 | scr_overlay_new (0, -1, sizeof ("KEYCAP PICTURE INSERT MODE") - 1, 1); |
|
|
1349 | scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE"); |
|
|
1350 | } |
|
|
1351 | # endif |
|
|
1352 | else |
|
|
1353 | iso14755buf = 0; |
|
|
1354 | } |
|
|
1355 | #endif |
|
|
1356 | |
|
|
1357 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
|
|
1358 | if (!(ev.xkey.state & ControlMask)) |
|
|
1359 | slip_wheel_ev.stop (); |
|
|
1360 | else if (ks == XK_Control_L || ks == XK_Control_R) |
|
|
1361 | mouse_slip_wheel_speed = 0; |
|
|
1362 | #endif |
|
|
1363 | break; |
1398 | break; |
1364 | } |
|
|
1365 | |
1399 | |
1366 | case ButtonPress: |
1400 | case ButtonPress: |
1367 | button_press (ev.xbutton); |
1401 | button_press (ev.xbutton); |
1368 | break; |
1402 | break; |
1369 | |
1403 | |
… | |
… | |
1371 | button_release (ev.xbutton); |
1405 | button_release (ev.xbutton); |
1372 | break; |
1406 | break; |
1373 | |
1407 | |
1374 | case ClientMessage: |
1408 | case ClientMessage: |
1375 | if (ev.xclient.format == 32 |
1409 | if (ev.xclient.format == 32 |
1376 | && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
1410 | && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END))) |
1377 | { |
1411 | { |
|
|
1412 | if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
|
|
1413 | { |
|
|
1414 | if (!HOOK_INVOKE ((this, HOOK_WM_PROTOCOLS, DT_XEVENT, &ev, DT_END))) |
|
|
1415 | { |
1378 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
1416 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
|
|
1417 | { |
|
|
1418 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) |
1379 | destroy (); |
1419 | destroy (); |
|
|
1420 | } |
1380 | #if ENABLE_EWMH |
1421 | #if ENABLE_EWMH |
1381 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1422 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1382 | XSendEvent (disp, ev.xclient.window = display->root, |
1423 | XSendEvent (dpy, ev.xclient.window = display->root, |
1383 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1424 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1384 | &ev); |
1425 | &ev); |
|
|
1426 | #endif |
|
|
1427 | } |
|
|
1428 | } |
|
|
1429 | #if ENABLE_XEMBED |
|
|
1430 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1431 | { |
|
|
1432 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1433 | focus_in (); |
|
|
1434 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1435 | focus_out (); |
|
|
1436 | } |
1385 | #endif |
1437 | #endif |
1386 | } |
1438 | } |
1387 | #if ENABLE_XEMBED |
|
|
1388 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1389 | { |
|
|
1390 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1391 | focus_in (); |
|
|
1392 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1393 | focus_out (); |
|
|
1394 | } |
|
|
1395 | #endif |
|
|
1396 | #ifdef OFFIX_DND |
|
|
1397 | /* OffiX Dnd (drag 'n' drop) protocol */ |
|
|
1398 | else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL] |
|
|
1399 | && (ev.xclient.data.l[0] == DndFile |
|
|
1400 | || ev.xclient.data.l[0] == DndDir |
|
|
1401 | || ev.xclient.data.l[0] == DndLink)) |
|
|
1402 | { |
|
|
1403 | /* Get Dnd data */ |
|
|
1404 | Atom ActualType; |
|
|
1405 | int ActualFormat; |
|
|
1406 | unsigned char *data; |
|
|
1407 | unsigned long Size, RemainingBytes; |
|
|
1408 | |
|
|
1409 | XGetWindowProperty (disp, display->root, |
|
|
1410 | xa[XA_DNDSELECTION], |
|
|
1411 | 0L, 1000000L, |
|
|
1412 | False, AnyPropertyType, |
|
|
1413 | &ActualType, &ActualFormat, |
|
|
1414 | &Size, &RemainingBytes, |
|
|
1415 | &data); |
|
|
1416 | set_string_property (XA_CUT_BUFFER0, data); |
|
|
1417 | XFree (data); |
|
|
1418 | selection_paste (display->root, XA_CUT_BUFFER0, true); |
|
|
1419 | XSetInputFocus (disp, display->root, RevertToNone, CurrentTime); |
|
|
1420 | } |
|
|
1421 | #endif /* OFFIX_DND */ |
|
|
1422 | break; |
1439 | break; |
1423 | |
1440 | |
1424 | case MappingNotify: |
1441 | case MappingNotify: |
1425 | XRefreshKeyboardMapping (&ev.xmapping); |
1442 | XRefreshKeyboardMapping (&ev.xmapping); |
1426 | break; |
1443 | break; |
… | |
… | |
1449 | break; |
1466 | break; |
1450 | } |
1467 | } |
1451 | break; |
1468 | break; |
1452 | |
1469 | |
1453 | case FocusIn: |
1470 | case FocusIn: |
|
|
1471 | if (ev.xfocus.detail != NotifyInferior |
|
|
1472 | && ev.xfocus.detail != NotifyPointer |
|
|
1473 | && ev.xfocus.mode != NotifyGrab) |
1454 | focus_in (); |
1474 | focus_in (); |
1455 | break; |
1475 | break; |
1456 | |
1476 | |
1457 | case FocusOut: |
1477 | case FocusOut: |
|
|
1478 | if (ev.xfocus.detail != NotifyInferior |
|
|
1479 | && ev.xfocus.detail != NotifyPointer |
|
|
1480 | && ev.xfocus.mode != NotifyGrab) |
1458 | focus_out (); |
1481 | focus_out (); |
1459 | break; |
1482 | break; |
1460 | |
1483 | |
1461 | case ConfigureNotify: |
1484 | case ConfigureNotify: |
1462 | if (ev.xconfigure.window == parent[0]) |
1485 | if (ev.xconfigure.window == parent[0]) |
1463 | { |
1486 | { |
1464 | while (XCheckTypedWindowEvent (disp, ev.xconfigure.window, ConfigureNotify, &ev)) |
1487 | while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) |
1465 | ; |
1488 | ; |
1466 | |
1489 | |
1467 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1490 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1468 | { |
1491 | { |
1469 | seen_resize = 1; |
1492 | seen_resize = 1; |
1470 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1493 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
|
|
1494 | #ifdef XPM_BACKGROUND |
|
|
1495 | if (!option(Opt_transparent) && bgPixmap.auto_resize) |
|
|
1496 | { |
|
|
1497 | resize_pixmap (); |
|
|
1498 | scr_touch (true); |
|
|
1499 | } |
|
|
1500 | #endif |
1471 | } |
1501 | } |
1472 | |
1502 | |
1473 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1503 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
|
|
1504 | |
|
|
1505 | #ifdef TRANSPARENT |
1474 | if (OPTION (Opt_transparent)) |
1506 | if (option (Opt_transparent)) |
1475 | check_our_parents (); |
1507 | check_our_parents (); |
1476 | #endif |
1508 | #endif |
1477 | } |
1509 | } |
1478 | break; |
1510 | break; |
1479 | |
1511 | |
1480 | case PropertyNotify: |
1512 | case PropertyNotify: |
|
|
1513 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1481 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1514 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1482 | && ev.xproperty.state == PropertyNewValue) |
1515 | && ev.xproperty.state == PropertyNewValue) |
1483 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1516 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1484 | |
1517 | |
1485 | break; |
1518 | break; |
1486 | |
1519 | |
1487 | case SelectionClear: |
1520 | case SelectionClear: |
1488 | selection_clear (); |
1521 | selection_clear (); |
… | |
… | |
1493 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1526 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1494 | break; |
1527 | break; |
1495 | |
1528 | |
1496 | case SelectionRequest: |
1529 | case SelectionRequest: |
1497 | selection_send (ev.xselectionrequest); |
1530 | selection_send (ev.xselectionrequest); |
|
|
1531 | break; |
|
|
1532 | |
|
|
1533 | case MapNotify: |
|
|
1534 | mapped = 1; |
|
|
1535 | #ifdef TEXT_BLINK |
|
|
1536 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
|
|
1537 | #endif |
|
|
1538 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1498 | break; |
1539 | break; |
1499 | |
1540 | |
1500 | case UnmapNotify: |
1541 | case UnmapNotify: |
1501 | mapped = 0; |
1542 | mapped = 0; |
1502 | #ifdef TEXT_BLINK |
1543 | #ifdef TEXT_BLINK |
1503 | text_blink_ev.stop (); |
1544 | text_blink_ev.stop (); |
1504 | #endif |
1545 | #endif |
1505 | break; |
1546 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1506 | |
|
|
1507 | case MapNotify: |
|
|
1508 | mapped = 1; |
|
|
1509 | #ifdef TEXT_BLINK |
|
|
1510 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
|
|
1511 | #endif |
|
|
1512 | break; |
1547 | break; |
1513 | |
1548 | |
1514 | #ifdef TRANSPARENT |
1549 | #ifdef TRANSPARENT |
1515 | case ReparentNotify: |
1550 | case ReparentNotify: |
1516 | rootwin_cb (ev); |
1551 | rootwin_cb (ev); |
… | |
… | |
1522 | if (ev.xany.window == vt) |
1557 | if (ev.xany.window == vt) |
1523 | { |
1558 | { |
1524 | do |
1559 | do |
1525 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1560 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1526 | ev.xexpose.width, ev.xexpose.height, False); |
1561 | ev.xexpose.width, ev.xexpose.height, False); |
1527 | while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)); |
1562 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); |
1528 | |
1563 | |
1529 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1564 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1530 | |
1565 | |
1531 | while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)) |
1566 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) |
1532 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1567 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1533 | ev.xexpose.width, ev.xexpose.height, False); |
1568 | ev.xexpose.width, ev.xexpose.height, False); |
1534 | |
1569 | |
1535 | scr_refresh (refresh_type); |
1570 | want_refresh = 1; |
1536 | } |
1571 | } |
1537 | else |
1572 | else |
1538 | { |
1573 | { |
1539 | XEvent unused_event; |
1574 | XEvent unused_event; |
1540 | |
1575 | |
1541 | while (XCheckTypedWindowEvent (disp, ev.xany.window, Expose, &unused_event)) |
1576 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event)) |
1542 | ; |
1577 | ; |
1543 | while (XCheckTypedWindowEvent (disp, ev.xany.window, GraphicsExpose, &unused_event)) |
1578 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) |
1544 | ; |
1579 | ; |
1545 | |
1580 | |
1546 | if (isScrollbarWindow (ev.xany.window)) |
1581 | if (isScrollbarWindow (ev.xany.window)) |
1547 | { |
1582 | { |
1548 | scrollBar.setIdle (); |
1583 | scrollBar.setIdle (); |
1549 | scrollbar_show (0); |
1584 | scrollbar_show (0); |
1550 | } |
1585 | } |
1551 | #ifdef MENUBAR |
|
|
1552 | if (menubar_visible () && isMenuBarWindow (ev.xany.window)) |
|
|
1553 | menubar_expose (); |
|
|
1554 | #endif |
|
|
1555 | |
1586 | |
1556 | #ifdef TRANSPARENT |
1587 | #ifdef TRANSPARENT |
1557 | if (am_transparent && ev.xany.window == parent[0]) |
1588 | if (am_transparent && ev.xany.window == parent[0]) |
1558 | XClearWindow (disp, ev.xany.window); |
1589 | XClearWindow (dpy, ev.xany.window); |
1559 | #endif |
1590 | #endif |
1560 | } |
1591 | } |
1561 | break; |
1592 | break; |
1562 | |
1593 | |
1563 | case MotionNotify: |
1594 | case MotionNotify: |
1564 | #ifdef POINTER_BLANK |
1595 | #ifdef POINTER_BLANK |
1565 | if (hidden_pointer) |
1596 | if (hidden_pointer) |
1566 | pointer_unblank (); |
1597 | pointer_unblank (); |
1567 | #endif |
1598 | #endif |
1568 | #if MENUBAR |
|
|
1569 | if (isMenuBarWindow (ev.xany.window)) |
|
|
1570 | { |
|
|
1571 | menubar_control (ev.xbutton); |
|
|
1572 | break; |
|
|
1573 | } |
|
|
1574 | #endif |
|
|
1575 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1599 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1576 | break; |
1600 | break; |
1577 | |
1601 | |
1578 | if (ev.xany.window == vt) |
1602 | if (ev.xany.window == vt) |
1579 | { |
1603 | { |
|
|
1604 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
|
|
1605 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
|
|
1606 | ; // nop |
1580 | if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1607 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1581 | { |
1608 | { |
1582 | while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) |
1609 | while (XCheckTypedWindowEvent (dpy, vt, MotionNotify, &ev)) |
1583 | ; |
1610 | ; |
1584 | |
1611 | |
1585 | XQueryPointer (disp, vt, |
1612 | XQueryPointer (dpy, vt, |
1586 | &unused_root, &unused_child, |
1613 | &unused_root, &unused_child, |
1587 | &unused_root_x, &unused_root_y, |
1614 | &unused_root_x, &unused_root_y, |
1588 | &ev.xbutton.x, &ev.xbutton.y, |
1615 | &ev.xbutton.x, &ev.xbutton.y, |
1589 | &ev.xbutton.state); |
1616 | &ev.xbutton.state); |
1590 | #ifdef MOUSE_THRESHOLD |
1617 | #ifdef MOUSE_THRESHOLD |
… | |
… | |
1654 | #endif |
1681 | #endif |
1655 | } |
1682 | } |
1656 | } |
1683 | } |
1657 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1684 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1658 | { |
1685 | { |
1659 | while (XCheckTypedWindowEvent (disp, scrollBar.win, |
1686 | while (XCheckTypedWindowEvent (dpy, scrollBar.win, |
1660 | MotionNotify, &ev)) |
1687 | MotionNotify, &ev)) |
1661 | ; |
1688 | ; |
1662 | |
1689 | |
1663 | XQueryPointer (disp, scrollBar.win, |
1690 | XQueryPointer (dpy, scrollBar.win, |
1664 | &unused_root, &unused_child, |
1691 | &unused_root, &unused_child, |
1665 | &unused_root_x, &unused_root_y, |
1692 | &unused_root_x, &unused_root_y, |
1666 | &ev.xbutton.x, &ev.xbutton.y, |
1693 | &ev.xbutton.x, &ev.xbutton.y, |
1667 | &unused_mask); |
1694 | &unused_mask); |
1668 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1695 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1669 | scrollbar_size ()); |
1696 | scrollbar_size ()); |
1670 | scr_refresh (refresh_type); |
1697 | want_refresh = 1; |
1671 | refresh_limit = 0; |
1698 | refresh_limit = 0; |
1672 | scrollbar_show (1); |
1699 | scrollbar_show (1); |
1673 | } |
1700 | } |
1674 | break; |
1701 | break; |
1675 | } |
1702 | } |
|
|
1703 | |
|
|
1704 | #if defined(CURSOR_BLINK) |
|
|
1705 | if (option (Opt_cursorBlink) && ev.type == KeyPress) |
|
|
1706 | { |
|
|
1707 | if (hidden_cursor) |
|
|
1708 | { |
|
|
1709 | hidden_cursor = 0; |
|
|
1710 | want_refresh = 1; |
|
|
1711 | } |
|
|
1712 | |
|
|
1713 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
|
|
1714 | } |
|
|
1715 | #endif |
|
|
1716 | |
|
|
1717 | #if defined(POINTER_BLANK) |
|
|
1718 | if (option (Opt_pointerBlank) && pointerBlankDelay > 0) |
|
|
1719 | { |
|
|
1720 | if (ev.type == MotionNotify |
|
|
1721 | || ev.type == ButtonPress |
|
|
1722 | || ev.type == ButtonRelease) |
|
|
1723 | if (hidden_pointer) |
|
|
1724 | pointer_unblank (); |
|
|
1725 | |
|
|
1726 | if (ev.type == KeyPress && hidden_pointer == 0) |
|
|
1727 | pointer_blank (); |
|
|
1728 | } |
|
|
1729 | #endif |
1676 | } |
1730 | } |
1677 | |
1731 | |
1678 | void |
1732 | void |
1679 | rxvt_term::focus_in () |
1733 | rxvt_term::focus_in () |
1680 | { |
1734 | { |
1681 | if (!focus) |
1735 | if (!focus) |
1682 | { |
1736 | { |
1683 | focus = 1; |
1737 | focus = 1; |
1684 | want_refresh = 1; |
1738 | want_refresh = 1; |
|
|
1739 | |
|
|
1740 | HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END)); |
|
|
1741 | |
1685 | #if USE_XIM |
1742 | #if USE_XIM |
1686 | if (Input_Context != NULL) |
1743 | if (Input_Context != NULL) |
1687 | { |
1744 | { |
1688 | IMSetStatusPosition (); |
1745 | IMSetPosition (); |
1689 | XSetICFocus (Input_Context); |
1746 | XSetICFocus (Input_Context); |
1690 | } |
1747 | } |
1691 | #endif |
1748 | #endif |
1692 | #if CURSOR_BLINK |
1749 | #if CURSOR_BLINK |
1693 | if (OPTION (Opt_cursorBlink)) |
1750 | if (option (Opt_cursorBlink)) |
1694 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1751 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1695 | #endif |
1752 | #endif |
1696 | #if OFF_FOCUS_FADING |
1753 | #if OFF_FOCUS_FADING |
1697 | if (rs[Rs_fade]) |
1754 | if (rs[Rs_fade]) |
1698 | { |
1755 | { |
1699 | pix_colors = pix_colors_focused; |
1756 | pix_colors = pix_colors_focused; |
1700 | scr_recolour (); |
1757 | scr_recolour (); |
1701 | } |
1758 | } |
1702 | #endif |
1759 | #endif |
|
|
1760 | #if ENABLE_FRILLS |
|
|
1761 | if (option (Opt_urgentOnBell)) |
|
|
1762 | { |
|
|
1763 | XWMHints *h; |
|
|
1764 | |
|
|
1765 | h = XGetWMHints(dpy, parent[0]); |
|
|
1766 | if (h != NULL) |
|
|
1767 | { |
|
|
1768 | h->flags &= ~XUrgencyHint; |
|
|
1769 | XSetWMHints(dpy, parent[0], h); |
|
|
1770 | } |
|
|
1771 | } |
|
|
1772 | #endif |
1703 | } |
1773 | } |
1704 | } |
1774 | } |
1705 | |
1775 | |
1706 | void |
1776 | void |
1707 | rxvt_term::focus_out () |
1777 | rxvt_term::focus_out () |
… | |
… | |
1709 | if (focus) |
1779 | if (focus) |
1710 | { |
1780 | { |
1711 | focus = 0; |
1781 | focus = 0; |
1712 | want_refresh = 1; |
1782 | want_refresh = 1; |
1713 | |
1783 | |
|
|
1784 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
|
|
1785 | |
1714 | #if ENABLE_FRILLS || ISO_14755 |
1786 | #if ENABLE_FRILLS || ISO_14755 |
|
|
1787 | if (iso14755buf) |
|
|
1788 | { |
1715 | iso14755buf = 0; |
1789 | iso14755buf = 0; |
1716 | #endif |
|
|
1717 | #if ENABLE_OVERLAY |
1790 | # if ENABLE_OVERLAY |
1718 | scr_overlay_off (); |
1791 | scr_overlay_off (); |
|
|
1792 | # endif |
|
|
1793 | } |
1719 | #endif |
1794 | #endif |
1720 | #if USE_XIM |
1795 | #if USE_XIM |
1721 | if (Input_Context != NULL) |
1796 | if (Input_Context != NULL) |
1722 | XUnsetICFocus (Input_Context); |
1797 | XUnsetICFocus (Input_Context); |
1723 | #endif |
1798 | #endif |
1724 | #if CURSOR_BLINK |
1799 | #if CURSOR_BLINK |
1725 | if (OPTION (Opt_cursorBlink)) |
1800 | if (option (Opt_cursorBlink)) |
1726 | cursor_blink_ev.stop (); |
1801 | cursor_blink_ev.stop (); |
1727 | hidden_cursor = 0; |
1802 | hidden_cursor = 0; |
1728 | #endif |
1803 | #endif |
1729 | #if OFF_FOCUS_FADING |
1804 | #if OFF_FOCUS_FADING |
1730 | if (rs[Rs_fade]) |
1805 | if (rs[Rs_fade]) |
… | |
… | |
1734 | } |
1809 | } |
1735 | #endif |
1810 | #endif |
1736 | } |
1811 | } |
1737 | } |
1812 | } |
1738 | |
1813 | |
1739 | #if TRANSPARENT |
1814 | void |
|
|
1815 | rxvt_term::update_fade_color (unsigned int idx) |
|
|
1816 | { |
|
|
1817 | #if OFF_FOCUS_FADING |
|
|
1818 | if (rs[Rs_fade]) |
|
|
1819 | { |
|
|
1820 | rgba c; |
|
|
1821 | pix_colors [Color_fade].get (c); |
|
|
1822 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
|
|
1823 | } |
|
|
1824 | #endif |
|
|
1825 | } |
|
|
1826 | |
|
|
1827 | #if TRANSPARENT || ENABLE_PERL |
1740 | void |
1828 | void |
1741 | rxvt_term::rootwin_cb (XEvent &ev) |
1829 | rxvt_term::rootwin_cb (XEvent &ev) |
1742 | { |
1830 | { |
1743 | SET_R (this); |
1831 | make_current (); |
1744 | SET_LOCALE (locale); |
|
|
1745 | |
1832 | |
|
|
1833 | if (SHOULD_INVOKE (HOOK_ROOT_EVENT) |
|
|
1834 | && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) |
|
|
1835 | return; |
|
|
1836 | |
|
|
1837 | # if TRANSPARENT |
1746 | switch (ev.type) |
1838 | switch (ev.type) |
1747 | { |
1839 | { |
1748 | case PropertyNotify: |
1840 | case PropertyNotify: |
1749 | /* |
1841 | /* |
1750 | * if user used some Esetroot compatible prog to set the root bg, |
1842 | * if user used some Esetroot compatible prog to set the root bg, |
… | |
… | |
1754 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1846 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1755 | return; |
1847 | return; |
1756 | |
1848 | |
1757 | /* FALLTHROUGH */ |
1849 | /* FALLTHROUGH */ |
1758 | case ReparentNotify: |
1850 | case ReparentNotify: |
1759 | if (OPTION (Opt_transparent) && check_our_parents () && am_transparent) |
1851 | if (option (Opt_transparent)) |
1760 | want_refresh = want_full_refresh = 1; |
1852 | check_our_parents (); |
1761 | break; |
1853 | break; |
1762 | } |
1854 | } |
|
|
1855 | # endif |
1763 | } |
1856 | } |
1764 | #endif |
1857 | #endif |
1765 | |
1858 | |
1766 | void |
1859 | void |
1767 | rxvt_term::button_press (XButtonEvent &ev) |
1860 | rxvt_term::button_press (XButtonEvent &ev) |
1768 | { |
1861 | { |
1769 | int reportmode = 0, clickintime; |
1862 | int reportmode = 0, clickintime; |
1770 | |
1863 | |
1771 | bypass_keystate = ev.state & (ModMetaMask | ShiftMask); |
1864 | bypass_keystate = ev.state & (ModMetaMask | ShiftMask); |
|
|
1865 | |
1772 | if (!bypass_keystate) |
1866 | if (!bypass_keystate) |
1773 | reportmode = !! (priv_modes & PrivMode_mouse_report); |
1867 | reportmode = !! (priv_modes & PrivMode_mouse_report); |
1774 | |
1868 | |
1775 | /* |
1869 | /* |
1776 | * VT window processing of button press |
1870 | * VT window processing of button press |
1777 | */ |
1871 | */ |
1778 | if (ev.window == vt) |
1872 | if (ev.window == vt) |
1779 | { |
1873 | { |
|
|
1874 | if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1875 | return; |
|
|
1876 | |
1780 | #if ISO_14755 |
1877 | #if ISO_14755 |
1781 | // 5.4 |
1878 | // 5.4 |
1782 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1879 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1783 | { |
1880 | { |
1784 | iso14755_54 (ev.x, ev.y); |
1881 | iso14755_54 (ev.x, ev.y); |
… | |
… | |
1796 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1893 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1797 | if (ev.button == MEvent.button && clickintime) |
1894 | if (ev.button == MEvent.button && clickintime) |
1798 | { |
1895 | { |
1799 | /* same button, within alloted time */ |
1896 | /* same button, within alloted time */ |
1800 | MEvent.clicks++; |
1897 | MEvent.clicks++; |
|
|
1898 | |
1801 | if (MEvent.clicks > 1) |
1899 | if (MEvent.clicks > 1) |
1802 | { |
1900 | { |
1803 | /* only report double clicks */ |
1901 | /* only report double clicks */ |
1804 | MEvent.clicks = 2; |
1902 | MEvent.clicks = 2; |
1805 | mouse_report (ev); |
1903 | mouse_report (ev); |
… | |
… | |
1837 | #else |
1935 | #else |
1838 | selection.rect = false; |
1936 | selection.rect = false; |
1839 | #endif |
1937 | #endif |
1840 | |
1938 | |
1841 | /* allow shift+left click to extend selection */ |
1939 | /* allow shift+left click to extend selection */ |
1842 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1940 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1843 | { |
1941 | { |
1844 | if (MEvent.button == Button1 && clickintime) |
1942 | if (MEvent.button == Button1 && clickintime) |
1845 | selection_rotate (ev.x, ev.y); |
1943 | selection_rotate (ev.x, ev.y); |
1846 | else |
1944 | else |
1847 | selection_extend (ev.x, ev.y, 1); |
1945 | selection_extend (ev.x, ev.y, 1); |
… | |
… | |
2012 | } |
2110 | } |
2013 | |
2111 | |
2014 | break; |
2112 | break; |
2015 | } |
2113 | } |
2016 | } |
2114 | } |
|
|
2115 | |
2017 | return; |
2116 | return; |
2018 | } |
2117 | } |
2019 | #if MENUBAR |
|
|
2020 | /* |
|
|
2021 | * Menubar window processing of button press |
|
|
2022 | */ |
|
|
2023 | if (isMenuBarWindow (ev.window)) |
|
|
2024 | menubar_control (ev); |
|
|
2025 | #endif |
|
|
2026 | } |
2118 | } |
2027 | |
2119 | |
2028 | void |
2120 | void |
2029 | rxvt_term::button_release (XButtonEvent &ev) |
2121 | rxvt_term::button_release (XButtonEvent &ev) |
2030 | { |
2122 | { |
… | |
… | |
2036 | |
2128 | |
2037 | if (scrollbar_isUpDn ()) |
2129 | if (scrollbar_isUpDn ()) |
2038 | { |
2130 | { |
2039 | scrollBar.setIdle (); |
2131 | scrollBar.setIdle (); |
2040 | scrollbar_show (0); |
2132 | scrollbar_show (0); |
2041 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
2042 | refresh_type &= ~SMOOTH_REFRESH; |
|
|
2043 | #endif |
|
|
2044 | } |
2133 | } |
2045 | |
2134 | |
2046 | #ifdef SELECTION_SCROLLING |
2135 | #ifdef SELECTION_SCROLLING |
2047 | if (sel_scroll_ev.active) |
2136 | if (sel_scroll_ev.active) |
2048 | sel_scroll_ev.stop(); |
2137 | sel_scroll_ev.stop(); |
2049 | #endif |
2138 | #endif |
2050 | |
2139 | |
2051 | if (ev.window == vt) |
2140 | if (ev.window == vt) |
2052 | { |
2141 | { |
|
|
2142 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2143 | return; |
|
|
2144 | |
2053 | #if ISO_14755 |
2145 | #if ISO_14755 |
2054 | // 5.4 |
2146 | // 5.4 |
2055 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2147 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2056 | return; |
2148 | return; |
2057 | #endif |
2149 | #endif |
|
|
2150 | |
2058 | if (reportmode) |
2151 | if (reportmode) |
2059 | { |
2152 | { |
2060 | /* mouse report from vt window */ |
2153 | /* mouse report from vt window */ |
2061 | /* don't report release of wheel "buttons" */ |
2154 | /* don't report release of wheel "buttons" */ |
2062 | if (ev.button >= 4) |
2155 | if (ev.button >= 4) |
… | |
… | |
2092 | { |
2185 | { |
2093 | case Button1: |
2186 | case Button1: |
2094 | case Button3: |
2187 | case Button3: |
2095 | selection_make (ev.time); |
2188 | selection_make (ev.time); |
2096 | break; |
2189 | break; |
|
|
2190 | |
2097 | case Button2: |
2191 | case Button2: |
2098 | selection_request (ev.time, ev.x, ev.y); |
2192 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
|
|
2193 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Clipboard : Sel_Primary); |
2099 | break; |
2194 | break; |
|
|
2195 | |
2100 | #ifdef MOUSE_WHEEL |
2196 | #ifdef MOUSE_WHEEL |
2101 | case Button4: |
2197 | case Button4: |
2102 | case Button5: |
2198 | case Button5: |
2103 | { |
2199 | { |
2104 | int i; |
2200 | int i; |
… | |
… | |
2106 | |
2202 | |
2107 | v = ev.button == Button4 ? UP : DN; |
2203 | v = ev.button == Button4 ? UP : DN; |
2108 | |
2204 | |
2109 | if (ev.state & ShiftMask) |
2205 | if (ev.state & ShiftMask) |
2110 | i = 1; |
2206 | i = 1; |
2111 | else if (OPTION (Opt_mouseWheelScrollPage)) |
2207 | else if (option (Opt_mouseWheelScrollPage)) |
2112 | i = nrow - 1; |
2208 | i = nrow - 1; |
2113 | else |
2209 | else |
2114 | i = 5; |
2210 | i = 5; |
2115 | |
2211 | |
2116 | # ifdef MOUSE_SLIP_WHEELING |
2212 | # ifdef MOUSE_SLIP_WHEELING |
… | |
… | |
2126 | slip_wheel_ev.start (); |
2222 | slip_wheel_ev.start (); |
2127 | } |
2223 | } |
2128 | else |
2224 | else |
2129 | { |
2225 | { |
2130 | # endif |
2226 | # endif |
2131 | # ifdef JUMP_MOUSE_WHEEL |
|
|
2132 | scr_page (v, i); |
2227 | scr_page (v, i); |
2133 | scr_refresh (SMOOTH_REFRESH); |
|
|
2134 | scrollbar_show (1); |
2228 | scrollbar_show (1); |
2135 | # else |
|
|
2136 | while (i--) |
|
|
2137 | { |
|
|
2138 | scr_page (v, 1); |
|
|
2139 | scr_refresh (SMOOTH_REFRESH); |
|
|
2140 | scrollbar_show (1); |
|
|
2141 | } |
|
|
2142 | # endif |
|
|
2143 | # ifdef MOUSE_SLIP_WHEELING |
2229 | # ifdef MOUSE_SLIP_WHEELING |
2144 | } |
2230 | } |
2145 | #endif |
2231 | # endif |
2146 | } |
2232 | } |
2147 | break; |
2233 | break; |
2148 | #endif |
2234 | #endif |
2149 | } |
2235 | } |
2150 | } |
2236 | } |
2151 | #ifdef MENUBAR |
|
|
2152 | else if (isMenuBarWindow (ev.window)) |
|
|
2153 | menubar_control (ev); |
|
|
2154 | #endif |
|
|
2155 | } |
2237 | } |
2156 | |
2238 | |
2157 | #ifdef TRANSPARENT |
2239 | #ifdef TRANSPARENT |
2158 | #if TINTING |
2240 | #if TINTING && !defined(HAVE_AFTERIMAGE) |
2159 | /* taken from aterm-0.4.2 */ |
2241 | /* taken from aterm-0.4.2 */ |
2160 | |
2242 | |
2161 | typedef uint32_t RUINT32T; |
2243 | typedef uint32_t RUINT32T; |
2162 | |
2244 | |
2163 | void ShadeXImage(rxvt_display *display, XImage* srcImage, int shade, int rm, int gm, int bm) |
2245 | void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm) |
2164 | { |
2246 | { |
2165 | int sh_r, sh_g, sh_b; |
2247 | int sh_r, sh_g, sh_b; |
2166 | RUINT32T mask_r, mask_g, mask_b; |
2248 | RUINT32T mask_r, mask_g, mask_b; |
2167 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
2249 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
2168 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
2250 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
2169 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
2251 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
2170 | int i; |
2252 | int i; |
2171 | |
2253 | |
2172 | Visual *visual = display->visual; |
2254 | Visual *visual = term->visual; |
2173 | |
2255 | |
2174 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
2256 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
2175 | |
2257 | |
2176 | /* for convenience */ |
2258 | /* for convenience */ |
2177 | mask_r = visual->red_mask; |
2259 | mask_r = visual->red_mask; |
… | |
… | |
2391 | * Do transparency updates if required |
2473 | * Do transparency updates if required |
2392 | */ |
2474 | */ |
2393 | int |
2475 | int |
2394 | rxvt_term::check_our_parents () |
2476 | rxvt_term::check_our_parents () |
2395 | { |
2477 | { |
|
|
2478 | check_our_parents_ev.stop (); |
|
|
2479 | check_our_parents_ev.start (NOW + .1); |
|
|
2480 | return 0; |
|
|
2481 | } |
|
|
2482 | |
|
|
2483 | void |
|
|
2484 | rxvt_term::check_our_parents_cb (time_watcher &w) |
|
|
2485 | { |
2396 | int i, pchanged, aformat, have_pixmap, rootdepth; |
2486 | int i, pchanged, aformat, have_pixmap, rootdepth; |
2397 | unsigned long nitems, bytes_after; |
2487 | unsigned long nitems, bytes_after; |
2398 | Atom atype; |
2488 | Atom atype; |
2399 | unsigned char *prop = NULL; |
2489 | unsigned char *prop = NULL; |
2400 | Window root, oldp, *list; |
2490 | Window root, oldp, *list; |
2401 | Pixmap rootpixmap = None; |
2491 | Pixmap rootpixmap = None; |
2402 | XWindowAttributes wattr, wrootattr; |
2492 | XWindowAttributes wattr, wrootattr; |
2403 | dDisp; |
2493 | int sx, sy; |
|
|
2494 | Window cr; |
2404 | |
2495 | |
2405 | pchanged = 0; |
2496 | pchanged = 0; |
2406 | |
2497 | |
2407 | if (!OPTION (Opt_transparent)) |
2498 | if (!option (Opt_transparent)) |
2408 | return pchanged; /* Don't try any more */ |
2499 | return /*pchanged*/; /* Don't try any more */ |
2409 | |
2500 | |
2410 | XGetWindowAttributes (disp, display->root, &wrootattr); |
2501 | XGetWindowAttributes (dpy, display->root, &wrootattr); |
2411 | rootdepth = wrootattr.depth; |
2502 | rootdepth = wrootattr.depth; |
2412 | |
2503 | |
2413 | XGetWindowAttributes (disp, parent[0], &wattr); |
2504 | XGetWindowAttributes (dpy, parent[0], &wattr); |
2414 | |
2505 | |
2415 | if (rootdepth != wattr.depth) |
2506 | if (rootdepth != wattr.depth) |
2416 | { |
2507 | { |
2417 | if (am_transparent) |
2508 | if (am_transparent) |
2418 | { |
2509 | { |
2419 | pchanged = 1; |
2510 | pchanged = 1; |
2420 | XSetWindowBackground (disp, vt, pix_colors_focused[Color_bg]); |
2511 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
2421 | am_transparent = am_pixmap_trans = 0; |
2512 | am_transparent = am_pixmap_trans = 0; |
2422 | } |
2513 | } |
2423 | |
2514 | |
2424 | return pchanged; /* Don't try any more */ |
2515 | return /*pchanged*/; /* Don't try any more */ |
2425 | } |
2516 | } |
2426 | |
2517 | |
2427 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
2518 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
2428 | XSync (disp, False); |
2519 | XSync (dpy, False); |
2429 | |
2520 | |
|
|
2521 | XTranslateCoordinates (dpy, parent[0], display->root, |
|
|
2522 | 0, 0, &sx, &sy, &cr); |
|
|
2523 | |
|
|
2524 | /* check if we are outside of the visible part of the virtual screen : */ |
|
|
2525 | if( sx + (int)szHint.width <= 0 || sy + (int)szHint.height <= 0 |
|
|
2526 | || sx >= wrootattr.width || sy >= wrootattr.height ) |
|
|
2527 | return /* 0 */ ; |
2430 | /* |
2528 | /* |
2431 | * Make the frame window set by the window manager have |
2529 | * Make the frame window set by the window manager have |
2432 | * the root background. Some window managers put multiple nested frame |
2530 | * the root background. Some window managers put multiple nested frame |
2433 | * windows for each client, so we have to take care about that. |
2531 | * windows for each client, so we have to take care about that. |
2434 | */ |
2532 | */ |
2435 | i = (xa[XA_XROOTPMAP_ID] |
2533 | i = (xa[XA_XROOTPMAP_ID] |
2436 | && XGetWindowProperty (disp, display->root, xa[XA_XROOTPMAP_ID], |
2534 | && XGetWindowProperty (dpy, display->root, xa[XA_XROOTPMAP_ID], |
2437 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2535 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2438 | &nitems, &bytes_after, &prop) == Success); |
2536 | &nitems, &bytes_after, &prop) == Success); |
2439 | |
2537 | |
2440 | if (!i || prop == NULL) |
2538 | if (!i || prop == NULL) |
2441 | i = (xa[XA_ESETROOT_PMAP_ID] |
2539 | i = (xa[XA_ESETROOT_PMAP_ID] |
2442 | && XGetWindowProperty (disp, display->root, xa[XA_ESETROOT_PMAP_ID], |
2540 | && XGetWindowProperty (dpy, display->root, xa[XA_ESETROOT_PMAP_ID], |
2443 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2541 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2444 | &nitems, &bytes_after, &prop) == Success); |
2542 | &nitems, &bytes_after, &prop) == Success); |
2445 | |
2543 | |
2446 | if (!i || prop == NULL |
2544 | if (!i || prop == NULL |
2447 | #if TINTING |
2545 | #if TINTING |
2448 | || !rs[Rs_color + Color_tint] |
2546 | || (!ISSET_PIXCOLOR (Color_tint) && rs[Rs_shade] == NULL |
|
|
2547 | #ifdef HAVE_AFTERIMAGE |
|
|
2548 | && original_asim == NULL && rs[Rs_blurradius] == NULL |
|
|
2549 | #endif |
|
|
2550 | ) |
2449 | #endif |
2551 | #endif |
2450 | ) |
2552 | ) |
2451 | have_pixmap = 0; |
2553 | have_pixmap = 0; |
2452 | else |
2554 | else |
2453 | { |
2555 | { |
… | |
… | |
2456 | XFree (prop); |
2558 | XFree (prop); |
2457 | } |
2559 | } |
2458 | |
2560 | |
2459 | if (have_pixmap) |
2561 | if (have_pixmap) |
2460 | { |
2562 | { |
|
|
2563 | Bool success = False ; |
|
|
2564 | GC gc; |
|
|
2565 | XGCValues gcvalue; |
|
|
2566 | #ifdef HAVE_AFTERIMAGE |
|
|
2567 | { |
|
|
2568 | Pixmap tmp_pmap = None ; |
|
|
2569 | ShadingInfo shade; |
|
|
2570 | ARGB32 tint ; |
|
|
2571 | unsigned int pmap_w = 0, pmap_h = 0; |
|
|
2572 | |
|
|
2573 | if (get_drawable_size( rootpixmap, &pmap_w, &pmap_h )) |
|
|
2574 | { |
|
|
2575 | int root_x = 0, root_y = 0; |
|
|
2576 | |
|
|
2577 | shade.shading = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
|
|
2578 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
2579 | { |
|
|
2580 | rgba c; |
|
|
2581 | pix_colors_focused [Color_tint].get (c); |
|
|
2582 | shade.tintColor.red = c.r; |
|
|
2583 | shade.tintColor.green = c.g; |
|
|
2584 | shade.tintColor.blue = c.b; |
|
|
2585 | } |
|
|
2586 | else |
|
|
2587 | shade.tintColor.red = shade.tintColor.green = shade.tintColor.blue = 0xFFFF; |
|
|
2588 | tint = shading2tint32( &shade ); |
|
|
2589 | gc = XCreateGC (dpy, vt, 0UL, &gcvalue); |
|
|
2590 | if (GetWinPosition (parent[0], &root_x, &root_y) ) |
|
|
2591 | { |
|
|
2592 | ASImageLayer *layers = create_image_layers( 2 ); |
|
|
2593 | ASImage *merged_im = NULL; |
|
|
2594 | int back_x, back_y, back_w, back_h; |
|
|
2595 | /* merge_layers does good job at tiling background appropriately, |
|
|
2596 | so all we need is to cut out smallest possible piece : */ |
|
|
2597 | #define MAKE_ROOTPMAP_GEOM(xy,wh,widthheight) \ |
|
|
2598 | do{ while( root_##xy < 0 ) root_##xy += (int)wrootattr.widthheight; \ |
|
|
2599 | back_##xy = root_##xy % pmap_##wh; /* that gives us left side of the closest tile : */ \ |
|
|
2600 | if( pmap_##wh >= back_##xy + szHint.widthheight ) \ |
|
|
2601 | back_##wh = szHint.widthheight;/* background is large - limit it by our size */ \ |
|
|
2602 | else \ |
|
|
2603 | { /* small background - need the whole of it for successfull tiling :*/ \ |
|
|
2604 | back_##xy = 0; \ |
|
|
2605 | back_##wh = pmap_##wh; \ |
|
|
2606 | }}while(0) |
|
|
2607 | |
|
|
2608 | MAKE_ROOTPMAP_GEOM(x,w,width); |
|
|
2609 | MAKE_ROOTPMAP_GEOM(y,h,height); |
|
|
2610 | |
|
|
2611 | layers[0].im = pixmap2asimage (display->asv, rootpixmap, back_x, back_y, back_w, back_h, AllPlanes, ASA_ASImage, 100); |
|
|
2612 | layers[0].clip_x = (back_w == pmap_w)?root_x:0; |
|
|
2613 | layers[0].clip_y = (back_h == pmap_h)?root_y:0; |
|
|
2614 | layers[0].clip_width = szHint.width; |
|
|
2615 | layers[0].clip_height = szHint.height; |
|
|
2616 | layers[0].tint = tint; |
|
|
2617 | if (rs[Rs_blurradius] && layers[0].im) |
|
|
2618 | { |
|
|
2619 | double r = atof(rs[Rs_blurradius]); |
|
|
2620 | ASImage* tmp = blur_asimage_gauss(display->asv, layers[0].im, r, r, 0xFFFFFFFF, ASA_ASImage, 100, ASIMAGE_QUALITY_DEFAULT ); |
|
|
2621 | if( tmp ) |
|
|
2622 | { |
|
|
2623 | destroy_asimage( &layers[0].im ); |
|
|
2624 | layers[0].im = tmp; |
|
|
2625 | } |
|
|
2626 | } |
|
|
2627 | if (original_asim != NULL) |
|
|
2628 | { |
|
|
2629 | int fore_w, fore_h; |
|
|
2630 | layers[1].im = original_asim; |
|
|
2631 | if( bgPixmap.auto_resize ) |
|
|
2632 | { |
|
|
2633 | fore_w = szHint.width; |
|
|
2634 | fore_h = szHint.height; |
|
|
2635 | } |
|
|
2636 | else |
|
|
2637 | { |
|
|
2638 | fore_w = bgPixmap.w; |
|
|
2639 | fore_h = bgPixmap.h; |
|
|
2640 | } |
|
|
2641 | if (fore_w != original_asim->width |
|
|
2642 | || fore_h != original_asim->height) |
|
|
2643 | { |
|
|
2644 | layers[1].im = scale_asimage( display->asv, |
|
|
2645 | original_asim, |
|
|
2646 | fore_w, fore_h, |
|
|
2647 | ASA_ASImage, 100, |
|
|
2648 | ASIMAGE_QUALITY_DEFAULT ); |
|
|
2649 | } |
|
|
2650 | |
|
|
2651 | layers[1].clip_width = szHint.width; |
|
|
2652 | layers[1].clip_height = szHint.height; |
|
|
2653 | |
|
|
2654 | if (rs[Rs_blendtype]) |
|
|
2655 | { |
|
|
2656 | layers[1].merge_scanlines = blend_scanlines_name2func(rs[Rs_blendtype]); |
|
|
2657 | if( layers[1].merge_scanlines == NULL ) |
|
|
2658 | layers[1].merge_scanlines = alphablend_scanlines; |
|
|
2659 | } |
|
|
2660 | } |
|
|
2661 | merged_im = merge_layers( display->asv, layers, layers[1].im?2:1, |
|
|
2662 | szHint.width, szHint.height, |
|
|
2663 | ASA_XImage, 0, ASIMAGE_QUALITY_DEFAULT ); |
|
|
2664 | if (layers[1].im != original_asim) |
|
|
2665 | destroy_asimage( &(layers[1].im) ); |
|
|
2666 | destroy_asimage( &(layers[0].im) ); |
|
|
2667 | if (merged_im != NULL) |
|
|
2668 | { |
|
|
2669 | tmp_pmap = asimage2pixmap( display->asv, DefaultRootWindow(dpy), merged_im, gc, True ); |
|
|
2670 | destroy_asimage( &merged_im ); |
|
|
2671 | } |
|
|
2672 | free( layers ); |
|
|
2673 | } |
|
|
2674 | } |
|
|
2675 | if (tmp_pmap != None) |
|
|
2676 | { |
|
|
2677 | success = True; |
|
|
2678 | if (pixmap != None) |
|
|
2679 | XFreePixmap (dpy, pixmap); |
|
|
2680 | pixmap = tmp_pmap; |
|
|
2681 | } |
|
|
2682 | } |
|
|
2683 | #else /* HAVE_AFTERIMAGE */ |
|
|
2684 | { |
2461 | /* |
2685 | /* |
2462 | * Copy display->root pixmap transparency |
2686 | * Copy display->root pixmap transparency |
2463 | */ |
2687 | */ |
2464 | int sx, sy, nx, ny; |
2688 | int nx, ny; |
2465 | unsigned int nw, nh; |
2689 | unsigned int nw, nh; |
2466 | Window cr; |
|
|
2467 | XImage *image; |
2690 | XImage *image; |
2468 | GC gc; |
|
|
2469 | XGCValues gcvalue; |
|
|
2470 | |
2691 | |
2471 | XTranslateCoordinates (disp, parent[0], display->root, |
|
|
2472 | 0, 0, &sx, &sy, &cr); |
|
|
2473 | nw = (unsigned int)szHint.width; |
2692 | nw = (unsigned int)szHint.width; |
2474 | nh = (unsigned int)szHint.height; |
2693 | nh = (unsigned int)szHint.height; |
2475 | nx = ny = 0; |
2694 | nx = ny = 0; |
2476 | |
2695 | |
2477 | if (sx < 0) |
2696 | if (sx < 0) |
2478 | { |
2697 | { |
2479 | nw += sx; |
2698 | nw += sx; |
2480 | nx = -sx; |
2699 | nx = -sx; |
2481 | sx = 0; |
2700 | sx = 0; |
2482 | } |
2701 | } |
2483 | |
2702 | |
2484 | if (sy < 0) |
2703 | if (sy < 0) |
2485 | { |
2704 | { |
2486 | nh += sy; |
2705 | nh += sy; |
2487 | ny = -sy; |
2706 | ny = -sy; |
2488 | sy = 0; |
2707 | sy = 0; |
2489 | } |
2708 | } |
2490 | |
2709 | |
2491 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
2710 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
2492 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
2711 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
2493 | |
2712 | |
2494 | XSync (disp, False); |
2713 | XSync (dpy, False); |
2495 | allowedxerror = -1; |
2714 | allowedxerror = -1; |
2496 | image = XGetImage (disp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
2715 | image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
2497 | |
2716 | |
2498 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
2717 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
2499 | /* XXX: may need a delay here? */ |
2718 | /* XXX: may need a delay here? */ |
2500 | allowedxerror = 0; |
2719 | allowedxerror = 0; |
2501 | |
|
|
2502 | if (image == NULL) |
2720 | if (image != NULL) |
|
|
2721 | { |
|
|
2722 | if (pixmap != None) |
|
|
2723 | XFreePixmap (dpy, pixmap); |
|
|
2724 | |
|
|
2725 | #if TINTING |
|
|
2726 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
2727 | { |
|
|
2728 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
|
|
2729 | |
|
|
2730 | rgba c; |
|
|
2731 | pix_colors_focused [Color_tint].get (c); |
|
|
2732 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
|
|
2733 | } |
|
|
2734 | #endif |
|
|
2735 | |
|
|
2736 | pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, image->depth); |
|
|
2737 | gc = XCreateGC (dpy, vt, 0UL, &gcvalue); |
|
|
2738 | XPutImage (dpy, pixmap, gc, image, 0, 0, |
|
|
2739 | nx, ny, image->width, image->height); |
|
|
2740 | XDestroyImage (image); |
|
|
2741 | success = True ; |
|
|
2742 | } |
|
|
2743 | } |
|
|
2744 | #endif /* HAVE_AFTERIMAGE */ |
|
|
2745 | if (gc != NULL) |
|
|
2746 | XFreeGC (dpy, gc); |
|
|
2747 | |
|
|
2748 | if (!success) |
2503 | { |
2749 | { |
2504 | if (am_transparent && am_pixmap_trans) |
2750 | if (am_transparent && am_pixmap_trans) |
2505 | { |
2751 | { |
2506 | pchanged = 1; |
2752 | pchanged = 1; |
2507 | if (pixmap != None) |
2753 | if (pixmap != None) |
2508 | { |
2754 | { |
2509 | XFreePixmap (disp, pixmap); |
2755 | XFreePixmap (dpy, pixmap); |
2510 | pixmap = None; |
2756 | pixmap = None; |
2511 | } |
2757 | } |
2512 | } |
2758 | } |
2513 | |
2759 | |
2514 | am_pixmap_trans = 0; |
2760 | am_pixmap_trans = 0; |
2515 | } |
2761 | } |
2516 | else |
2762 | else |
2517 | { |
2763 | { |
2518 | if (pixmap != None) |
|
|
2519 | XFreePixmap (disp, pixmap); |
|
|
2520 | |
|
|
2521 | #if TINTING |
|
|
2522 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
2523 | { |
|
|
2524 | unsigned short rm, gm, bm; |
|
|
2525 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
|
|
2526 | |
|
|
2527 | pix_colors_focused[Color_tint].get (display, rm, gm, bm); |
|
|
2528 | |
|
|
2529 | ShadeXImage (display, image, shade, rm, gm, bm); |
|
|
2530 | } |
|
|
2531 | #endif |
|
|
2532 | |
|
|
2533 | pixmap = XCreatePixmap (disp, vt, |
|
|
2534 | szHint.width, szHint.height, image->depth); |
|
|
2535 | gc = XCreateGC (disp, vt, 0UL, &gcvalue); |
|
|
2536 | XPutImage (disp, pixmap, gc, image, 0, 0, |
|
|
2537 | nx, ny, image->width, image->height); |
|
|
2538 | XFreeGC (disp, gc); |
|
|
2539 | XDestroyImage (image); |
|
|
2540 | XSetWindowBackgroundPixmap (disp, parent[0], pixmap); |
2764 | XSetWindowBackgroundPixmap (dpy, parent[0], pixmap); |
2541 | XClearWindow (disp, parent[0]); |
2765 | XClearWindow (dpy, parent[0]); |
2542 | |
2766 | |
2543 | if (!am_transparent || !am_pixmap_trans) |
2767 | if (!am_transparent || !am_pixmap_trans) |
2544 | pchanged = 1; |
2768 | pchanged = 1; |
2545 | |
2769 | |
2546 | am_transparent = am_pixmap_trans = 1; |
2770 | am_transparent = am_pixmap_trans = 1; |
2547 | } |
2771 | } |
2548 | } |
2772 | } |
2549 | |
2773 | |
2550 | if (am_pixmap_trans) |
2774 | if (am_pixmap_trans) |
2551 | XSetWindowBackgroundPixmap (disp, vt, ParentRelative); |
2775 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
2552 | else |
2776 | else |
2553 | { |
2777 | { |
2554 | unsigned int n; |
2778 | unsigned int n; |
2555 | /* |
2779 | /* |
2556 | * InheritPixmap transparency |
2780 | * InheritPixmap transparency |
2557 | */ |
2781 | */ |
2558 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2782 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2559 | { |
2783 | { |
2560 | oldp = parent[i]; |
2784 | oldp = parent[i]; |
2561 | XQueryTree (disp, parent[i - 1], &root, |
2785 | XQueryTree (dpy, parent[i - 1], &root, &parent[i], &list, &n); |
2562 | &parent[i], &list, &n); |
|
|
2563 | XFree (list); |
2786 | XFree (list); |
2564 | |
2787 | |
2565 | if (parent[i] == display->root) |
2788 | if (parent[i] == display->root) |
2566 | { |
2789 | { |
2567 | if (oldp != None) |
2790 | if (oldp != None) |
… | |
… | |
2575 | } |
2798 | } |
2576 | |
2799 | |
2577 | n = 0; |
2800 | n = 0; |
2578 | |
2801 | |
2579 | if (pchanged) |
2802 | if (pchanged) |
2580 | { |
|
|
2581 | for (; n < (unsigned int)i; n++) |
2803 | for (; n < (unsigned int)i; n++) |
2582 | { |
2804 | { |
2583 | XGetWindowAttributes (disp, parent[n], &wattr); |
2805 | XGetWindowAttributes (dpy, parent[n], &wattr); |
|
|
2806 | |
2584 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
2807 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
2585 | { |
2808 | { |
2586 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
2809 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
2587 | break; |
2810 | break; |
2588 | } |
2811 | } |
2589 | } |
2812 | } |
2590 | } |
|
|
2591 | |
2813 | |
2592 | if (n > (int) (sizeof (parent) / sizeof (parent[0]))) |
2814 | if (n > (sizeof (parent) / sizeof (parent[0]))) |
2593 | { |
2815 | { |
2594 | XSetWindowBackground (disp, parent[0], pix_colors_focused[Color_border]); |
2816 | XSetWindowBackground (dpy, parent[0], pix_colors_focused[Color_border]); |
2595 | XSetWindowBackground (disp, vt, pix_colors_focused[Color_bg]); |
2817 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
2596 | am_transparent = 0; |
2818 | am_transparent = 0; |
2597 | /* XXX: also turn off Opt_transparent? */ |
2819 | /* XXX: also turn off Opt_transparent? */ |
2598 | } |
2820 | } |
2599 | else |
2821 | else |
2600 | { |
2822 | { |
2601 | #if WAIT_FOR_WM |
|
|
2602 | /* wait (an arbitrary period) for the WM to do its thing |
|
|
2603 | * needed for fvwm2.2.2 (and before?) */ |
|
|
2604 | sleep (1); |
|
|
2605 | #endif |
|
|
2606 | for (n = 0; n < (unsigned int)i; n++) |
2823 | for (n = 0; n < (unsigned int)i; n++) |
2607 | { |
2824 | { |
2608 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2825 | XSetWindowBackgroundPixmap (dpy, parent[n], ParentRelative); |
2609 | XClearWindow (disp, parent[n]); |
2826 | XClearWindow (dpy, parent[n]); |
2610 | } |
2827 | } |
2611 | |
2828 | |
2612 | XSetWindowBackgroundPixmap (disp, vt, ParentRelative); |
2829 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
2613 | am_transparent = 1; |
2830 | am_transparent = 1; |
2614 | } |
2831 | } |
2615 | |
2832 | |
2616 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2833 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2617 | parent[i] = None; |
2834 | parent[i] = None; |
2618 | } |
2835 | } |
2619 | |
2836 | |
2620 | if (scrollBar.win) |
2837 | if (scrollBar.win) |
2621 | { |
2838 | { |
2622 | XSetWindowBackgroundPixmap (disp, scrollBar.win, ParentRelative); |
2839 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
2623 | scrollBar.setIdle (); |
2840 | scrollBar.setIdle (); |
2624 | scrollbar_show (0); |
2841 | scrollbar_show (0); |
2625 | } |
2842 | } |
2626 | |
2843 | |
2627 | if (am_transparent) |
2844 | if (am_transparent) |
… | |
… | |
2629 | want_refresh = want_full_refresh = 1; |
2846 | want_refresh = want_full_refresh = 1; |
2630 | if (am_pixmap_trans) |
2847 | if (am_pixmap_trans) |
2631 | flush (); |
2848 | flush (); |
2632 | } |
2849 | } |
2633 | |
2850 | |
2634 | return pchanged; |
2851 | // return pchanged; |
2635 | } |
2852 | } |
2636 | #endif |
2853 | #endif |
2637 | |
2854 | |
2638 | /*}}} */ |
2855 | /*}}} */ |
2639 | |
2856 | |
2640 | bool |
2857 | bool |
2641 | rxvt_term::cmd_parse () |
2858 | rxvt_term::cmd_parse () |
2642 | { |
2859 | { |
2643 | bool flag = false; |
2860 | bool flag = false; |
2644 | unicode_t ch = NOCHAR; |
2861 | wchar_t ch = NOCHAR; |
2645 | unsigned char *seq_begin; // remember start of esc-sequence here |
2862 | char *seq_begin; // remember start of esc-sequence here |
2646 | |
2863 | |
2647 | for (;;) |
2864 | for (;;) |
2648 | { |
2865 | { |
2649 | if (ch == NOCHAR) |
2866 | if (ch == NOCHAR) |
2650 | { |
2867 | { |
2651 | seq_begin = cmdbuf_ptr; |
2868 | seq_begin = cmdbuf_ptr; |
2652 | ch = next_char (); |
2869 | ch = next_char (); |
2653 | } |
|
|
2654 | |
2870 | |
2655 | if (ch == NOCHAR) // TODO: improve |
2871 | if (ch == NOCHAR) |
2656 | break; |
2872 | break; |
|
|
2873 | } |
2657 | |
2874 | |
2658 | if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT) |
2875 | if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT) |
2659 | { |
2876 | { |
2660 | if (!seen_input) |
2877 | if (!seen_input) |
2661 | { |
2878 | { |
… | |
… | |
2670 | if (seen_resize && cmd_pid) |
2887 | if (seen_resize && cmd_pid) |
2671 | kill (-cmd_pid, SIGWINCH); |
2888 | kill (-cmd_pid, SIGWINCH); |
2672 | } |
2889 | } |
2673 | |
2890 | |
2674 | /* Read a text string from the input buffer */ |
2891 | /* Read a text string from the input buffer */ |
2675 | unicode_t buf[UBUFSIZ]; |
2892 | wchar_t buf[UBUFSIZ]; |
2676 | bool refreshnow = false; |
2893 | bool refreshnow = false; |
2677 | int nlines = 0; |
2894 | int nlines = 0; |
2678 | unicode_t *str = buf; |
2895 | wchar_t *str = buf; |
2679 | unicode_t *eol = str + min (ncol, UBUFSIZ); |
2896 | wchar_t *eol = str + min (ncol, UBUFSIZ); |
2680 | |
2897 | |
2681 | for (;;) |
2898 | for (;;) |
2682 | { |
2899 | { |
2683 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2900 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2684 | break; |
2901 | break; |
… | |
… | |
2690 | if (ch == C0_LF) |
2907 | if (ch == C0_LF) |
2691 | nlines++; |
2908 | nlines++; |
2692 | |
2909 | |
2693 | refresh_count++; |
2910 | refresh_count++; |
2694 | |
2911 | |
2695 | if (!OPTION (Opt_jumpScroll) |
2912 | if (!option (Opt_jumpScroll) |
2696 | || (refresh_count >= refresh_limit * (nrow - 1))) |
2913 | || (refresh_count >= refresh_limit * (nrow - 1))) |
2697 | { |
2914 | { |
2698 | refreshnow = true; |
2915 | refreshnow = true; |
|
|
2916 | refresh_count = 0; |
2699 | ch = NOCHAR; |
2917 | ch = NOCHAR; |
2700 | break; |
2918 | break; |
2701 | } |
2919 | } |
2702 | |
2920 | |
2703 | // scr_add_lines only works for nlines <= nrow - 1. |
2921 | // scr_add_lines only works for nlines <= nrow - 1. |
2704 | if (nlines >= nrow - 1) |
2922 | if (nlines >= nrow - 1) |
2705 | { |
2923 | { |
|
|
2924 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
|
|
2925 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2706 | scr_add_lines (buf, nlines, str - buf); |
2926 | scr_add_lines (buf, str - buf, nlines); |
|
|
2927 | |
2707 | nlines = 0; |
2928 | nlines = 0; |
2708 | str = buf; |
2929 | str = buf; |
2709 | eol = str + min (ncol, UBUFSIZ); |
2930 | eol = str + min (ncol, UBUFSIZ); |
2710 | } |
2931 | } |
2711 | |
2932 | |
… | |
… | |
2724 | |
2945 | |
2725 | seq_begin = cmdbuf_ptr; |
2946 | seq_begin = cmdbuf_ptr; |
2726 | ch = next_char (); |
2947 | ch = next_char (); |
2727 | } |
2948 | } |
2728 | |
2949 | |
|
|
2950 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
|
|
2951 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2729 | scr_add_lines (buf, nlines, str - buf); |
2952 | scr_add_lines (buf, str - buf, nlines); |
2730 | |
2953 | |
2731 | /* |
2954 | /* |
2732 | * If there have been a lot of new lines, then update the screen |
2955 | * If there have been a lot of new lines, then update the screen |
2733 | * What the heck I'll cheat and only refresh less than every page-full. |
2956 | * What the heck I'll cheat and only refresh less than every page-full. |
2734 | * the number of pages between refreshes is refresh_limit, which |
2957 | * the number of pages between refreshes is refresh_limit, which |
2735 | * is incremented here because we must be doing flat-out scrolling. |
2958 | * is incremented here because we must be doing flat-out scrolling. |
2736 | */ |
2959 | */ |
2737 | if (refreshnow) |
2960 | if (refreshnow) |
2738 | { |
2961 | { |
2739 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2962 | if (option (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2740 | refresh_limit++; |
2963 | refresh_limit++; |
2741 | else |
2964 | else |
2742 | { |
2965 | { |
2743 | flag = true; |
2966 | flag = true; |
|
|
2967 | //TODO: due to popular request, implement "skipscroll" option here |
2744 | scr_refresh (refresh_type); |
2968 | scr_refresh (); |
|
|
2969 | want_refresh = 1; |
2745 | } |
2970 | } |
2746 | } |
2971 | } |
2747 | |
2972 | |
2748 | } |
2973 | } |
2749 | else |
2974 | else |
… | |
… | |
2764 | } |
2989 | } |
2765 | |
2990 | |
2766 | return flag; |
2991 | return flag; |
2767 | } |
2992 | } |
2768 | |
2993 | |
2769 | // read the next octet |
|
|
2770 | unicode_t |
|
|
2771 | rxvt_term::next_octet () |
|
|
2772 | { |
|
|
2773 | return cmdbuf_ptr < cmdbuf_endp |
|
|
2774 | ? *cmdbuf_ptr++ |
|
|
2775 | : NOCHAR; |
|
|
2776 | } |
|
|
2777 | |
|
|
2778 | // read the next character |
2994 | // read the next character |
2779 | unicode_t |
2995 | wchar_t |
2780 | rxvt_term::next_char () |
2996 | rxvt_term::next_char () NOTHROW |
2781 | { |
2997 | { |
2782 | while (cmdbuf_ptr < cmdbuf_endp) |
2998 | while (cmdbuf_ptr < cmdbuf_endp) |
2783 | { |
2999 | { |
2784 | // assume 7-bit to be ascii ALWAYS |
3000 | // assume 7-bit to be ascii ALWAYS |
2785 | if (*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
3001 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2786 | return *cmdbuf_ptr++; |
3002 | return *cmdbuf_ptr++; |
2787 | |
3003 | |
2788 | wchar_t wc; |
3004 | wchar_t wc; |
2789 | size_t len = mbrtowc (&wc, (char *)cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); |
3005 | size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); |
2790 | |
3006 | |
2791 | if (len == (size_t)-2) |
3007 | if (len == (size_t)-2) |
2792 | { |
3008 | { |
2793 | // the mbstate stores incomplete sequences. didn't know this :/ |
3009 | // the mbstate stores incomplete sequences. didn't know this :/ |
2794 | cmdbuf_ptr = cmdbuf_endp; |
3010 | cmdbuf_ptr = cmdbuf_endp; |
2795 | break; |
3011 | break; |
2796 | } |
3012 | } |
2797 | |
3013 | |
2798 | if (len == (size_t)-1) |
3014 | if (len == (size_t)-1) |
2799 | return *cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
3015 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2800 | |
3016 | |
2801 | // assume wchar == unicode |
3017 | // assume wchar == unicode |
2802 | cmdbuf_ptr += len; |
3018 | cmdbuf_ptr += len; |
2803 | return wc & UNICODE_MASK; |
3019 | return wc & UNICODE_MASK; |
2804 | } |
3020 | } |
2805 | |
3021 | |
2806 | return NOCHAR; |
3022 | return NOCHAR; |
2807 | } |
3023 | } |
|
|
3024 | |
|
|
3025 | // read the next octet |
|
|
3026 | uint32_t |
|
|
3027 | rxvt_term::next_octet () NOTHROW |
|
|
3028 | { |
|
|
3029 | return cmdbuf_ptr < cmdbuf_endp |
|
|
3030 | ? (unsigned char)*cmdbuf_ptr++ |
|
|
3031 | : NOCHAR; |
|
|
3032 | } |
|
|
3033 | |
|
|
3034 | static class out_of_input out_of_input; |
2808 | |
3035 | |
2809 | /* rxvt_cmd_getc () - Return next input character */ |
3036 | /* rxvt_cmd_getc () - Return next input character */ |
2810 | /* |
3037 | /* |
2811 | * Return the next input character after first passing any keyboard input |
3038 | * Return the next input character after first passing any keyboard input |
2812 | * to the command. |
3039 | * to the command. |
2813 | */ |
3040 | */ |
2814 | unicode_t |
3041 | wchar_t |
2815 | rxvt_term::cmd_getc () |
3042 | rxvt_term::cmd_getc () THROW ((class out_of_input)) |
2816 | { |
3043 | { |
2817 | unicode_t c = next_char (); |
3044 | wchar_t c = next_char (); |
2818 | |
3045 | |
2819 | if (c == NOCHAR) |
3046 | if (c == NOCHAR) |
2820 | throw out_of_input; |
3047 | throw out_of_input; |
2821 | |
3048 | |
2822 | return c; |
3049 | return c; |
2823 | } |
3050 | } |
2824 | |
3051 | |
2825 | unicode_t |
3052 | uint32_t |
2826 | rxvt_term::cmd_get8 () |
3053 | rxvt_term::cmd_get8 () THROW ((class out_of_input)) |
2827 | { |
3054 | { |
2828 | unicode_t c = next_octet (); |
3055 | uint32_t c = next_octet (); |
2829 | |
3056 | |
2830 | if (c == NOCHAR) |
3057 | if (c == NOCHAR) |
2831 | throw out_of_input; |
3058 | throw out_of_input; |
2832 | |
3059 | |
2833 | return c; |
3060 | return c; |
… | |
… | |
2933 | case C0_ESC: |
3160 | case C0_ESC: |
2934 | process_escape_seq (); |
3161 | process_escape_seq (); |
2935 | break; |
3162 | break; |
2936 | case C0_ENQ: /* terminal Status */ |
3163 | case C0_ENQ: /* terminal Status */ |
2937 | if (rs[Rs_answerbackstring]) |
3164 | if (rs[Rs_answerbackstring]) |
2938 | tt_write ((const unsigned char *)rs[Rs_answerbackstring], |
3165 | tt_write (rs [Rs_answerbackstring], strlen (rs [Rs_answerbackstring])); |
2939 | (unsigned int)strlen (rs[Rs_answerbackstring])); |
|
|
2940 | else |
3166 | else |
2941 | tt_write ((unsigned char *)VT100_ANS, |
3167 | tt_write (VT100_ANS, strlen (VT100_ANS)); |
2942 | (unsigned int)strlen (VT100_ANS)); |
|
|
2943 | break; |
3168 | break; |
2944 | case C0_BEL: /* bell */ |
3169 | case C0_BEL: /* bell */ |
2945 | scr_bell (); |
3170 | scr_bell (); |
2946 | break; |
3171 | break; |
2947 | case C0_BS: /* backspace */ |
3172 | case C0_BS: /* backspace */ |
… | |
… | |
3071 | scr_charset_set (2, (unsigned int)cmd_getc ()); |
3296 | scr_charset_set (2, (unsigned int)cmd_getc ()); |
3072 | break; |
3297 | break; |
3073 | case '+': |
3298 | case '+': |
3074 | scr_charset_set (3, (unsigned int)cmd_getc ()); |
3299 | scr_charset_set (3, (unsigned int)cmd_getc ()); |
3075 | break; |
3300 | break; |
3076 | #if ENABLE_FRILLS |
3301 | #if !ENABLE_MINIMAL |
3077 | case '6': |
3302 | case '6': |
3078 | scr_backindex (); |
3303 | scr_backindex (); |
3079 | break; |
3304 | break; |
3080 | #endif |
3305 | #endif |
3081 | case '7': |
3306 | case '7': |
3082 | scr_cursor (SAVE); |
3307 | scr_cursor (SAVE); |
3083 | break; |
3308 | break; |
3084 | case '8': |
3309 | case '8': |
3085 | scr_cursor (RESTORE); |
3310 | scr_cursor (RESTORE); |
3086 | break; |
3311 | break; |
3087 | #if ENABLE_FRILLS |
3312 | #if !ENABLE_MINIMAL |
3088 | case '9': |
3313 | case '9': |
3089 | scr_forwardindex (); |
3314 | scr_forwardindex (); |
3090 | break; |
3315 | break; |
3091 | #endif |
3316 | #endif |
3092 | case '=': |
3317 | case '=': |
… | |
… | |
3102 | break; |
3327 | break; |
3103 | |
3328 | |
3104 | /* 8.3.87: NEXT LINE */ |
3329 | /* 8.3.87: NEXT LINE */ |
3105 | case C1_NEL: /* ESC E */ |
3330 | case C1_NEL: /* ESC E */ |
3106 | { |
3331 | { |
3107 | unicode_t nlcr[] = { C0_LF, C0_CR }; |
3332 | wchar_t nlcr[] = { C0_LF, C0_CR }; |
3108 | scr_add_lines (nlcr, 1, 2); |
3333 | scr_add_lines (nlcr, sizeof (nlcr) / sizeof (nlcr [0]), 1); |
3109 | } |
3334 | } |
3110 | break; |
3335 | break; |
3111 | |
3336 | |
3112 | /* kidnapped escape sequence: Should be 8.3.48 */ |
3337 | /* kidnapped escape sequence: Should be 8.3.48 */ |
3113 | case C1_ESA: /* ESC G */ |
3338 | case C1_ESA: /* ESC G */ |
… | |
… | |
3135 | process_dcs_seq (); |
3360 | process_dcs_seq (); |
3136 | break; |
3361 | break; |
3137 | |
3362 | |
3138 | /* 8.3.110: SINGLE CHARACTER INTRODUCER */ |
3363 | /* 8.3.110: SINGLE CHARACTER INTRODUCER */ |
3139 | case C1_SCI: /* ESC Z */ |
3364 | case C1_SCI: /* ESC Z */ |
3140 | tt_write ((const unsigned char *)ESCZ_ANSWER, |
3365 | tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1); |
3141 | (unsigned int) (sizeof (ESCZ_ANSWER) - 1)); |
|
|
3142 | break; /* steal obsolete ESC [ c */ |
3366 | break; /* steal obsolete ESC [ c */ |
3143 | |
3367 | |
3144 | /* 8.3.16: CONTROL SEQUENCE INTRODUCER */ |
3368 | /* 8.3.16: CONTROL SEQUENCE INTRODUCER */ |
3145 | case C1_CSI: /* ESC [ */ |
3369 | case C1_CSI: /* ESC [ */ |
3146 | process_csi_seq (); |
3370 | process_csi_seq (); |
… | |
… | |
3255 | ndef = get_byte_array_bit (csi_defaults, i); |
3479 | ndef = get_byte_array_bit (csi_defaults, i); |
3256 | for (p = 0; p < nargs; p++) |
3480 | for (p = 0; p < nargs; p++) |
3257 | if (arg[p] == -1) |
3481 | if (arg[p] == -1) |
3258 | arg[p] = ndef; |
3482 | arg[p] = ndef; |
3259 | |
3483 | |
3260 | #ifdef DEBUG_CMD |
|
|
3261 | fprintf (stderr, "CSI "); |
|
|
3262 | for (p = 0; p < nargs; p++) |
|
|
3263 | fprintf (stderr, "%d%s", arg[p], p < nargs - 1 ? ";" : ""); |
|
|
3264 | fprintf (stderr, "%c\n", ch); |
|
|
3265 | #endif |
|
|
3266 | |
|
|
3267 | /* |
3484 | /* |
3268 | * private mode handling |
3485 | * private mode handling |
3269 | */ |
3486 | */ |
3270 | if (priv) |
3487 | if (priv) |
3271 | { |
3488 | { |
3272 | switch (priv) |
3489 | switch (priv) |
3273 | { |
3490 | { |
3274 | case '>': |
3491 | case '>': |
3275 | if (ch == CSI_DA) /* secondary device attributes */ |
3492 | if (ch == CSI_DA) /* secondary device attributes */ |
3276 | tt_printf ("\033[>%d;%c%c;0c", 'U', VERSION[0], VERSION[2]); |
3493 | { |
|
|
3494 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
|
|
3495 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
|
|
3496 | // |
|
|
3497 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
|
|
3498 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
|
|
3499 | // that we do not support xterm mouse reporting (should be 95 when we do). |
|
|
3500 | // |
|
|
3501 | tt_printf ("\033[>%d;94;0c", 'U'); |
|
|
3502 | } |
3277 | break; |
3503 | break; |
3278 | case '?': |
3504 | case '?': |
3279 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3505 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3280 | process_terminal_mode (ch, priv, nargs, arg); |
3506 | process_terminal_mode (ch, priv, nargs, arg); |
3281 | break; |
3507 | break; |
… | |
… | |
3390 | case CSI_SU: /* 8.3.148: (1) SCROLL UP */ |
3616 | case CSI_SU: /* 8.3.148: (1) SCROLL UP */ |
3391 | scr_scroll_text (screen.tscroll, screen.bscroll, arg[0]); |
3617 | scr_scroll_text (screen.tscroll, screen.bscroll, arg[0]); |
3392 | break; |
3618 | break; |
3393 | |
3619 | |
3394 | case CSI_DA: /* 8.3.24: (0) DEVICE ATTRIBUTES */ |
3620 | case CSI_DA: /* 8.3.24: (0) DEVICE ATTRIBUTES */ |
3395 | tt_write ((const unsigned char *)VT100_ANS, |
3621 | tt_write (VT100_ANS, sizeof (VT100_ANS) - 1); |
3396 | (unsigned int) (sizeof (VT100_ANS) - 1)); |
|
|
3397 | break; |
3622 | break; |
3398 | |
3623 | |
3399 | case CSI_SGR: /* 8.3.118: (0) SELECT GRAPHIC RENDITION */ |
3624 | case CSI_SGR: /* 8.3.118: (0) SELECT GRAPHIC RENDITION */ |
3400 | process_sgr_mode (nargs, arg); |
3625 | process_sgr_mode (nargs, arg); |
3401 | break; |
3626 | break; |
… | |
… | |
3408 | break; |
3633 | break; |
3409 | case 6: /* CPR requested */ |
3634 | case 6: /* CPR requested */ |
3410 | scr_report_position (); |
3635 | scr_report_position (); |
3411 | break; |
3636 | break; |
3412 | case 7: /* unofficial extension */ |
3637 | case 7: /* unofficial extension */ |
3413 | if (OPTION (Opt_insecure)) |
3638 | if (option (Opt_insecure)) |
3414 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
3639 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
3415 | break; |
3640 | break; |
3416 | case 8: /* unofficial extension */ |
3641 | case 8: /* unofficial extension */ |
3417 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
3642 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
3418 | break; |
3643 | break; |
… | |
… | |
3485 | break; |
3710 | break; |
3486 | case CSI_75: |
3711 | case CSI_75: |
3487 | scr_cursor (RESTORE); |
3712 | scr_cursor (RESTORE); |
3488 | break; |
3713 | break; |
3489 | |
3714 | |
3490 | #if ENABLE_FRILLS |
3715 | #if !ENABLE_MINIMAL |
3491 | case CSI_74: |
3716 | case CSI_74: |
3492 | process_window_ops (arg, nargs); |
3717 | process_window_ops (arg, nargs); |
3493 | break; |
3718 | break; |
3494 | #endif |
3719 | #endif |
3495 | |
3720 | |
… | |
… | |
3502 | break; |
3727 | break; |
3503 | } |
3728 | } |
3504 | } |
3729 | } |
3505 | /*}}} */ |
3730 | /*}}} */ |
3506 | |
3731 | |
3507 | #if ENABLE_FRILLS |
3732 | #if !ENABLE_MINIMAL |
3508 | /* ARGSUSED */ |
3733 | /* ARGSUSED */ |
3509 | void |
3734 | void |
3510 | rxvt_term::process_window_ops (const int *args, unsigned int nargs) |
3735 | rxvt_term::process_window_ops (const int *args, unsigned int nargs) |
3511 | { |
3736 | { |
3512 | int x, y; |
3737 | int x, y; |
3513 | XWindowAttributes wattr; |
3738 | XWindowAttributes wattr; |
3514 | Window wdummy; |
3739 | Window wdummy; |
3515 | dDisp; |
3740 | |
|
|
3741 | dLocal (Display *, dpy); |
3516 | |
3742 | |
3517 | if (nargs == 0) |
3743 | if (nargs == 0) |
3518 | return; |
3744 | return; |
3519 | |
3745 | |
3520 | switch (args[0]) |
3746 | switch (args[0]) |
3521 | { |
3747 | { |
3522 | /* |
3748 | /* |
3523 | * commands |
3749 | * commands |
3524 | */ |
3750 | */ |
3525 | case 1: /* deiconify window */ |
3751 | case 1: /* deiconify window */ |
3526 | XMapWindow (disp, parent[0]); |
3752 | XMapWindow (dpy, parent[0]); |
3527 | break; |
3753 | break; |
3528 | case 2: /* iconify window */ |
3754 | case 2: /* iconify window */ |
3529 | XIconifyWindow (disp, parent[0], display->screen); |
3755 | XIconifyWindow (dpy, parent[0], display->screen); |
3530 | break; |
3756 | break; |
3531 | case 3: /* set position (pixels) */ |
3757 | case 3: /* set position (pixels) */ |
3532 | XMoveWindow (disp, parent[0], args[1], args[2]); |
3758 | XMoveWindow (dpy, parent[0], args[1], args[2]); |
3533 | break; |
3759 | break; |
3534 | case 4: /* set size (pixels) */ |
3760 | case 4: /* set size (pixels) */ |
3535 | set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); |
3761 | set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); |
3536 | break; |
3762 | break; |
3537 | case 5: /* raise window */ |
3763 | case 5: /* raise window */ |
3538 | XRaiseWindow (disp, parent[0]); |
3764 | XRaiseWindow (dpy, parent[0]); |
3539 | break; |
3765 | break; |
3540 | case 6: /* lower window */ |
3766 | case 6: /* lower window */ |
3541 | XLowerWindow (disp, parent[0]); |
3767 | XLowerWindow (dpy, parent[0]); |
3542 | break; |
3768 | break; |
3543 | case 7: /* refresh window */ |
3769 | case 7: /* refresh window */ |
3544 | scr_touch (true); |
3770 | scr_touch (true); |
3545 | break; |
3771 | break; |
3546 | case 8: /* set size (chars) */ |
3772 | case 8: /* set size (chars) */ |
… | |
… | |
3553 | if (args[0] >= 24) /* set height (chars) */ |
3779 | if (args[0] >= 24) /* set height (chars) */ |
3554 | set_widthheight ((unsigned int)width, |
3780 | set_widthheight ((unsigned int)width, |
3555 | (unsigned int) (args[1] * fheight)); |
3781 | (unsigned int) (args[1] * fheight)); |
3556 | break; |
3782 | break; |
3557 | |
3783 | |
3558 | |
|
|
3559 | /* |
3784 | /* |
3560 | * reports - some output format copied from XTerm |
3785 | * reports - some output format copied from XTerm |
3561 | */ |
3786 | */ |
3562 | case 11: /* report window state */ |
3787 | case 11: /* report window state */ |
3563 | XGetWindowAttributes (disp, parent[0], &wattr); |
3788 | XGetWindowAttributes (dpy, parent[0], &wattr); |
3564 | tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); |
3789 | tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); |
3565 | break; |
3790 | break; |
3566 | case 13: /* report window position */ |
3791 | case 13: /* report window position */ |
3567 | XGetWindowAttributes (disp, parent[0], &wattr); |
3792 | XGetWindowAttributes (dpy, parent[0], &wattr); |
3568 | XTranslateCoordinates (disp, parent[0], wattr.root, |
3793 | XTranslateCoordinates (dpy, parent[0], wattr.root, |
3569 | -wattr.border_width, -wattr.border_width, |
3794 | -wattr.border_width, -wattr.border_width, |
3570 | &x, &y, &wdummy); |
3795 | &x, &y, &wdummy); |
3571 | tt_printf ("\033[3;%d;%dt", x, y); |
3796 | tt_printf ("\033[3;%d;%dt", x, y); |
3572 | break; |
3797 | break; |
3573 | case 14: /* report window size (pixels) */ |
3798 | case 14: /* report window size (pixels) */ |
3574 | XGetWindowAttributes (disp, parent[0], &wattr); |
3799 | XGetWindowAttributes (dpy, parent[0], &wattr); |
3575 | tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); |
3800 | tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); |
3576 | break; |
3801 | break; |
3577 | case 18: /* report text area size (chars) */ |
3802 | case 18: /* report text area size (chars) */ |
3578 | tt_printf ("\033[8;%d;%dt", nrow, ncol); |
3803 | tt_printf ("\033[8;%d;%dt", nrow, ncol); |
3579 | break; |
3804 | break; |
… | |
… | |
3581 | tt_printf ("\033[9;%d;%dt", nrow, ncol); |
3806 | tt_printf ("\033[9;%d;%dt", nrow, ncol); |
3582 | break; |
3807 | break; |
3583 | case 20: /* report icon label */ |
3808 | case 20: /* report icon label */ |
3584 | { |
3809 | { |
3585 | char *s; |
3810 | char *s; |
3586 | XGetIconName (disp, parent[0], &s); |
3811 | XGetIconName (dpy, parent[0], &s); |
3587 | tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3812 | tt_printf ("\033]L%-.250s\234", option (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3588 | XFree (s); |
3813 | XFree (s); |
3589 | } |
3814 | } |
3590 | break; |
3815 | break; |
3591 | case 21: /* report window title */ |
3816 | case 21: /* report window title */ |
3592 | { |
3817 | { |
3593 | char *s; |
3818 | char *s; |
3594 | XFetchName (disp, parent[0], &s); |
3819 | XFetchName (dpy, parent[0], &s); |
3595 | tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3820 | tt_printf ("\033]l%-.250s\234", option (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3596 | XFree (s); |
3821 | XFree (s); |
3597 | } |
3822 | } |
3598 | break; |
3823 | break; |
3599 | } |
3824 | } |
3600 | } |
3825 | } |
… | |
… | |
3603 | /*----------------------------------------------------------------------*/ |
3828 | /*----------------------------------------------------------------------*/ |
3604 | /* |
3829 | /* |
3605 | * get input up until STRING TERMINATOR (or BEL) |
3830 | * get input up until STRING TERMINATOR (or BEL) |
3606 | * ends_how is terminator used. returned input must be free()'d |
3831 | * ends_how is terminator used. returned input must be free()'d |
3607 | */ |
3832 | */ |
3608 | unsigned char * |
3833 | char * |
3609 | rxvt_term::get_to_st (unicode_t &ends_how) |
3834 | rxvt_term::get_to_st (unicode_t &ends_how) |
3610 | { |
3835 | { |
3611 | unicode_t ch; |
3836 | unicode_t ch; |
3612 | bool seen_esc = false; |
3837 | bool seen_esc = false; |
3613 | unsigned int n = 0; |
3838 | unsigned int n = 0; |
… | |
… | |
3627 | seen_esc = true; |
3852 | seen_esc = true; |
3628 | continue; |
3853 | continue; |
3629 | } |
3854 | } |
3630 | else if (ch == C0_BEL || ch == CHAR_ST) |
3855 | else if (ch == C0_BEL || ch == CHAR_ST) |
3631 | break; |
3856 | break; |
|
|
3857 | else if (ch == C0_SYN) |
|
|
3858 | ch = cmd_get8 (); |
3632 | else if (ch < 0x20) |
3859 | else if (ch < 0x20) |
3633 | return NULL; /* other control character - exit */ |
3860 | return NULL; /* other control character - exit */ |
3634 | |
3861 | |
3635 | seen_esc = false; |
3862 | seen_esc = false; |
3636 | |
3863 | |
3637 | if (n >= STRING_MAX - 1) |
3864 | if (n >= STRING_MAX - 1) |
3638 | // stop at some sane length |
3865 | // stop at some sane length |
3639 | return NULL; |
3866 | return NULL; |
3640 | |
3867 | |
3641 | if (ch == C0_SYN) |
|
|
3642 | string[n++] = cmd_get8 (); |
|
|
3643 | else |
|
|
3644 | string[n++] = ch; |
3868 | string[n++] = ch; |
3645 | } |
3869 | } |
3646 | |
3870 | |
3647 | string[n++] = '\0'; |
3871 | string[n++] = '\0'; |
3648 | |
3872 | |
3649 | ends_how = (ch == 0x5c ? C0_ESC : ch); |
3873 | ends_how = (ch == 0x5c ? C0_ESC : ch); |
3650 | |
3874 | |
3651 | return (unsigned char *)rxvt_wcstombs (string); |
3875 | return rxvt_wcstombs (string); |
3652 | } |
3876 | } |
3653 | |
3877 | |
3654 | /*----------------------------------------------------------------------*/ |
3878 | /*----------------------------------------------------------------------*/ |
3655 | /* |
3879 | /* |
3656 | * process DEVICE CONTROL STRING `ESC P ... (ST|BEL)' or `0x90 ... (ST|BEL)' |
3880 | * process DEVICE CONTROL STRING `ESC P ... (ST|BEL)' or `0x90 ... (ST|BEL)' |
3657 | */ |
3881 | */ |
3658 | void |
3882 | void |
3659 | rxvt_term::process_dcs_seq () |
3883 | rxvt_term::process_dcs_seq () |
3660 | { |
3884 | { |
3661 | unsigned char *s; |
3885 | char *s; |
3662 | unicode_t eh; |
3886 | unicode_t eh; |
3663 | |
3887 | |
3664 | /* |
3888 | /* |
3665 | * Not handled yet |
3889 | * Not handled yet |
3666 | */ |
3890 | */ |
… | |
… | |
3685 | for (arg = 0; isdigit (ch); ch = cmd_getc ()) |
3909 | for (arg = 0; isdigit (ch); ch = cmd_getc ()) |
3686 | arg = arg * 10 + (ch - '0'); |
3910 | arg = arg * 10 + (ch - '0'); |
3687 | |
3911 | |
3688 | if (ch == ';') |
3912 | if (ch == ';') |
3689 | { |
3913 | { |
3690 | unsigned char *s = get_to_st (eh); |
3914 | char *s = get_to_st (eh); |
3691 | |
3915 | |
3692 | if (s) |
3916 | if (s) |
3693 | { |
3917 | { |
3694 | process_xterm_seq (arg, (char *)s, eh); |
3918 | process_xterm_seq (arg, s, eh); |
3695 | free (s); |
3919 | free (s); |
3696 | } |
3920 | } |
3697 | } |
3921 | } |
3698 | } |
3922 | } |
3699 | |
3923 | |
3700 | void |
3924 | void |
3701 | rxvt_term::process_color_seq (int report, int color, const char *str, unsigned char resp) |
3925 | rxvt_term::process_color_seq (int report, int color, const char *str, char resp) |
3702 | { |
3926 | { |
3703 | if (str[0] == '?' && !str[1]) |
3927 | if (str[0] == '?' && !str[1]) |
3704 | { |
3928 | { |
3705 | unsigned short r, g, b; |
3929 | rgba c; |
3706 | pix_colors_focused[color].get (display, r, g, b); |
3930 | pix_colors_focused[color].get (c); |
|
|
3931 | |
|
|
3932 | #if XFT |
|
|
3933 | if (c.a != rgba::MAX_CC) |
|
|
3934 | tt_printf ("\033]%d;rgba:%04x/%04x/%04x/%04x%c", report, c.a, c.r, c.g, c.b, resp); |
|
|
3935 | else |
|
|
3936 | #endif |
3707 | tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, r, g, b, resp); |
3937 | tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, c.r, c.g, c.b, resp); |
3708 | } |
3938 | } |
3709 | else |
3939 | else |
3710 | set_window_color (color, str); |
3940 | set_window_color (color, str); |
3711 | } |
3941 | } |
3712 | |
3942 | |
3713 | /* |
3943 | /* |
3714 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3944 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3715 | */ |
3945 | */ |
3716 | void |
3946 | void |
3717 | rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp) |
3947 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3718 | { |
3948 | { |
3719 | int changed = 0; |
|
|
3720 | int color; |
3949 | int color; |
3721 | char *buf, *name; |
3950 | char *buf, *name; |
3722 | bool query = str[0] == '?' && !str[1]; |
3951 | bool query = str[0] == '?' && !str[1]; |
3723 | int saveop = op; |
3952 | int saveop = op; |
3724 | dDisp; |
3953 | |
|
|
3954 | dLocal (Display *, dpy); |
3725 | |
3955 | |
3726 | assert (str != NULL); |
3956 | assert (str != NULL); |
|
|
3957 | |
|
|
3958 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
|
|
3959 | return; |
|
|
3960 | |
3727 | switch (op) |
3961 | switch (op) |
3728 | { |
3962 | { |
3729 | case XTerm_name: |
3963 | case XTerm_name: |
3730 | set_title (str); |
3964 | set_title (str); |
3731 | /* FALLTHROUGH */ |
3965 | /* FALLTHROUGH */ |
… | |
… | |
3745 | unsigned long bytes_after; |
3979 | unsigned long bytes_after; |
3746 | unsigned char *value = 0; |
3980 | unsigned char *value = 0; |
3747 | const char *str = ""; |
3981 | const char *str = ""; |
3748 | |
3982 | |
3749 | if (prop |
3983 | if (prop |
3750 | && XGetWindowProperty (disp, parent[0], |
3984 | && XGetWindowProperty (dpy, parent[0], |
3751 | prop, 0, 1<<16, 0, AnyPropertyType, |
3985 | prop, 0, 1<<16, 0, AnyPropertyType, |
3752 | &actual_type, &actual_format, |
3986 | &actual_type, &actual_format, |
3753 | &nitems, &bytes_after, &value) == Success |
3987 | &nitems, &bytes_after, &value) == Success |
3754 | && actual_type != None |
3988 | && actual_type != None |
3755 | && actual_format == 8) |
3989 | && actual_format == 8) |
3756 | str = (const char *)(value); |
3990 | str = (const char *)(value); |
3757 | |
3991 | |
3758 | tt_printf ("\033]%d;%s%c", XTerm_property, str, resp); |
3992 | tt_printf ("\033]%d;%s%c", op, str, resp); |
3759 | |
3993 | |
3760 | XFree (value); |
3994 | XFree (value); |
3761 | } |
3995 | } |
3762 | else |
3996 | else |
3763 | { |
3997 | { |
… | |
… | |
3767 | { |
4001 | { |
3768 | *eq = 0; |
4002 | *eq = 0; |
3769 | set_utf8_property (display->atom (str), eq + 1); |
4003 | set_utf8_property (display->atom (str), eq + 1); |
3770 | } |
4004 | } |
3771 | else |
4005 | else |
3772 | XDeleteProperty (disp, parent[0], |
4006 | XDeleteProperty (dpy, parent[0], |
3773 | display->atom (str)); |
4007 | display->atom (str)); |
3774 | } |
4008 | } |
3775 | break; |
4009 | break; |
3776 | |
4010 | |
3777 | case XTerm_Color: |
4011 | case XTerm_Color: |
… | |
… | |
3779 | { |
4013 | { |
3780 | if ((name = strchr (buf, ';')) == NULL) |
4014 | if ((name = strchr (buf, ';')) == NULL) |
3781 | break; |
4015 | break; |
3782 | |
4016 | |
3783 | *name++ = '\0'; |
4017 | *name++ = '\0'; |
3784 | color = atoi (buf); |
4018 | color = atoi (buf) + minCOLOR; |
3785 | |
4019 | |
3786 | if (color < 0 || color >= TOTAL_COLORS) |
4020 | if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) |
3787 | break; |
4021 | break; |
3788 | |
4022 | |
3789 | if ((buf = strchr (name, ';')) != NULL) |
4023 | if ((buf = strchr (name, ';')) != NULL) |
3790 | *buf++ = '\0'; |
4024 | *buf++ = '\0'; |
3791 | |
4025 | |
3792 | if (name[0] == '?' && !name[1]) |
4026 | process_color_seq (op, color, name, resp); |
3793 | { |
|
|
3794 | unsigned short r, g, b; |
|
|
3795 | pix_colors_focused[color + minCOLOR].get (display, r, g, b); |
|
|
3796 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
|
|
3797 | } |
|
|
3798 | else |
|
|
3799 | set_window_color (color + minCOLOR, name); |
|
|
3800 | } |
4027 | } |
3801 | break; |
4028 | break; |
3802 | case XTerm_Color00: |
4029 | case XTerm_Color00: |
3803 | process_color_seq (XTerm_Color00, Color_fg, str, resp); |
4030 | process_color_seq (op, Color_fg, str, resp); |
3804 | break; |
4031 | break; |
3805 | case XTerm_Color01: |
4032 | case XTerm_Color01: |
3806 | process_color_seq (XTerm_Color00, Color_bg, str, resp); |
4033 | process_color_seq (op, Color_bg, str, resp); |
3807 | break; |
4034 | break; |
3808 | #ifndef NO_CURSORCOLOR |
4035 | #ifndef NO_CURSORCOLOR |
3809 | case XTerm_Color_cursor: |
4036 | case XTerm_Color_cursor: |
3810 | process_color_seq (XTerm_Color_cursor, Color_cursor, str, resp); |
4037 | process_color_seq (op, Color_cursor, str, resp); |
3811 | break; |
4038 | break; |
3812 | #endif |
4039 | #endif |
3813 | case XTerm_Color_pointer_fg: |
4040 | case XTerm_Color_pointer_fg: |
3814 | process_color_seq (XTerm_Color_pointer_fg, Color_pointer_fg, str, resp); |
4041 | process_color_seq (op, Color_pointer_fg, str, resp); |
3815 | break; |
4042 | break; |
3816 | case XTerm_Color_pointer_bg: |
4043 | case XTerm_Color_pointer_bg: |
3817 | process_color_seq (XTerm_Color_pointer_bg, Color_pointer_bg, str, resp); |
4044 | process_color_seq (op, Color_pointer_bg, str, resp); |
3818 | break; |
4045 | break; |
3819 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
4046 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3820 | case XTerm_Color_BD: |
|
|
3821 | process_color_seq (XTerm_Color_BD, Color_BD, str, resp); |
|
|
3822 | break; |
|
|
3823 | case XTerm_Color_UL: |
|
|
3824 | process_color_seq (XTerm_Color_UL, Color_UL, str, resp); |
|
|
3825 | break; |
|
|
3826 | case XTerm_Color_RV: |
4047 | case XTerm_Color_RV: |
3827 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
4048 | process_color_seq (op, Color_RV, str, resp); |
|
|
4049 | break; |
|
|
4050 | case Rxvt_Color_BD: |
|
|
4051 | case URxvt_Color_BD: |
|
|
4052 | process_color_seq (op, Color_BD, str, resp); |
|
|
4053 | break; |
|
|
4054 | case Rxvt_Color_UL: |
|
|
4055 | case URxvt_Color_UL: |
|
|
4056 | process_color_seq (op, Color_UL, str, resp); |
3828 | break; |
4057 | break; |
3829 | case URxvt_Color_IT: |
4058 | case URxvt_Color_IT: |
3830 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
4059 | process_color_seq (op, Color_IT, str, resp); |
3831 | break; |
4060 | break; |
3832 | #endif |
4061 | #endif |
3833 | #if TRANSPARENT && TINTING |
4062 | #if TRANSPARENT && TINTING |
3834 | case URxvt_Color_tint: |
4063 | case URxvt_Color_tint: |
3835 | process_color_seq (URxvt_Color_tint, Color_tint, str, resp); |
4064 | process_color_seq (op, Color_tint, str, resp); |
|
|
4065 | |
3836 | check_our_parents (); |
4066 | check_our_parents (); |
|
|
4067 | |
3837 | if (am_transparent) |
4068 | if (am_transparent) |
3838 | want_full_refresh = want_refresh = 1; |
4069 | want_full_refresh = want_refresh = 1; |
3839 | break; |
|
|
3840 | #endif |
|
|
3841 | |
4070 | |
|
|
4071 | break; |
|
|
4072 | #endif |
|
|
4073 | |
3842 | case XTerm_Pixmap: |
4074 | case Rxvt_Pixmap: |
|
|
4075 | { |
3843 | if (*str != ';') |
4076 | if (*str != ';') |
3844 | { |
4077 | { |
3845 | #if XPM_BACKGROUND |
4078 | #if XPM_BACKGROUND |
3846 | scale_pixmap (""); /* reset to default scaling */ |
4079 | scale_pixmap (""); /* reset to default scaling */ |
3847 | set_bgPixmap (str); /* change pixmap */ |
4080 | set_bgPixmap (str); /* change pixmap */ |
3848 | #endif |
|
|
3849 | scr_touch (true); |
4081 | scr_touch (true); |
|
|
4082 | #endif |
3850 | } |
4083 | } |
|
|
4084 | |
|
|
4085 | int changed = 0; |
|
|
4086 | |
3851 | while ((str = strchr (str, ';')) != NULL) |
4087 | while ((str = strchr (str, ';')) != NULL) |
3852 | { |
4088 | { |
3853 | str++; |
4089 | str++; |
3854 | #if XPM_BACKGROUND |
4090 | #if XPM_BACKGROUND |
3855 | changed += scale_pixmap (str); |
4091 | changed += scale_pixmap (str); |
3856 | #endif |
4092 | #endif |
3857 | } |
4093 | } |
3858 | |
4094 | |
3859 | if (changed) |
4095 | if (changed) |
3860 | { |
4096 | { |
3861 | #ifdef XPM_BACKGROUND |
4097 | #ifdef XPM_BACKGROUND |
3862 | resize_pixmap (); |
4098 | resize_pixmap (); |
3863 | #endif |
|
|
3864 | scr_touch (true); |
4099 | scr_touch (true); |
|
|
4100 | #endif |
3865 | } |
4101 | } |
|
|
4102 | #if TRANSPARENT && defined(HAVE_AFTERIMAGE) |
|
|
4103 | if (option(Opt_transparent)) |
|
|
4104 | check_our_parents (); |
|
|
4105 | #endif |
|
|
4106 | |
|
|
4107 | } |
3866 | break; |
4108 | break; |
3867 | |
4109 | |
3868 | case XTerm_restoreFG: |
4110 | case Rxvt_restoreFG: |
3869 | set_window_color (Color_fg, str); |
4111 | set_window_color (Color_fg, str); |
3870 | break; |
4112 | break; |
3871 | case XTerm_restoreBG: |
4113 | case Rxvt_restoreBG: |
3872 | set_window_color (Color_bg, str); |
4114 | set_window_color (Color_bg, str); |
3873 | break; |
4115 | break; |
3874 | |
4116 | |
3875 | case XTerm_logfile: |
4117 | case XTerm_logfile: |
3876 | // TODO, when secure mode? |
4118 | // TODO, when secure mode? |
3877 | break; |
4119 | break; |
3878 | |
4120 | |
3879 | #ifdef MENUBAR |
|
|
3880 | case URxvt_Menu: |
|
|
3881 | if (OPTION (Opt_insecure)) |
|
|
3882 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
|
|
3883 | break; |
|
|
3884 | #endif |
|
|
3885 | #if 0 |
4121 | #if 0 |
3886 | case XTerm_dumpscreen: /* no error notices */ |
4122 | case Rxvt_dumpscreen: /* no error notices */ |
3887 | { |
4123 | { |
3888 | int fd; |
4124 | int fd; |
3889 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
4125 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3890 | { |
4126 | { |
3891 | scr_dump (fd); |
4127 | scr_dump (fd); |
… | |
… | |
3902 | case URxvt_italicFont: |
4138 | case URxvt_italicFont: |
3903 | case URxvt_boldItalicFont: |
4139 | case URxvt_boldItalicFont: |
3904 | #endif |
4140 | #endif |
3905 | if (query) |
4141 | if (query) |
3906 | tt_printf ("\33]%d;%-.250s%c", saveop, |
4142 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3907 | OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
4143 | option (Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3908 | ? fontset[op - URxvt_font]->fontdesc : "", |
4144 | ? fontset[op - URxvt_font]->fontdesc : "", |
3909 | resp); |
4145 | resp); |
3910 | else |
4146 | else |
3911 | { |
4147 | { |
3912 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
4148 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
… | |
… | |
3915 | allocated.push_back ((void *)res); |
4151 | allocated.push_back ((void *)res); |
3916 | set_fonts (); |
4152 | set_fonts (); |
3917 | } |
4153 | } |
3918 | break; |
4154 | break; |
3919 | |
4155 | |
3920 | #if ENABLE_FRILLS |
4156 | case URxvt_version: |
|
|
4157 | if (query) |
|
|
4158 | tt_printf ("\33]%d;rxvt-unicode;%-.20s;%c;%c%c", |
|
|
4159 | op, |
|
|
4160 | rs[Rs_name], VERSION[0], VERSION[2], |
|
|
4161 | resp); |
|
|
4162 | break; |
|
|
4163 | |
|
|
4164 | #if !ENABLE_MINIMAL |
3921 | case URxvt_locale: |
4165 | case URxvt_locale: |
3922 | if (query) |
4166 | if (query) |
3923 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); |
4167 | tt_printf ("\33]%d;%-.250s%c", op, option (Opt_insecure) ? locale : "", resp); |
3924 | else |
4168 | else |
3925 | { |
4169 | { |
3926 | set_locale (str); |
4170 | set_locale (str); |
3927 | pty.set_utf8_mode (enc_utf8); |
4171 | pty->set_utf8_mode (enc_utf8); |
3928 | init_xlocale (); |
4172 | init_xlocale (); |
3929 | } |
4173 | } |
3930 | break; |
4174 | break; |
3931 | |
4175 | |
3932 | case URxvt_view_up: |
4176 | case URxvt_view_up: |
3933 | case URxvt_view_down: |
4177 | case URxvt_view_down: |
|
|
4178 | { |
3934 | int lines = atoi (str); |
4179 | int lines = atoi (str); |
3935 | |
4180 | |
3936 | if (lines) |
4181 | if (lines) |
3937 | scr_page (op == URxvt_view_up ? UP : DN, lines); |
4182 | scr_page (op == URxvt_view_up ? UP : DN, lines); |
3938 | else |
4183 | else |
3939 | { |
|
|
3940 | scr_erase_savelines (); |
4184 | scr_erase_savelines (); |
3941 | } |
4185 | } |
3942 | |
4186 | |
|
|
4187 | break; |
|
|
4188 | #endif |
|
|
4189 | |
|
|
4190 | #if ENABLE_PERL |
|
|
4191 | case URxvt_perl: |
|
|
4192 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ_PERL, DT_STR, str, DT_END))) |
|
|
4193 | ; // no responses yet |
3943 | break; |
4194 | break; |
3944 | #endif |
4195 | #endif |
3945 | } |
4196 | } |
3946 | } |
4197 | } |
3947 | /*----------------------------------------------------------------------*/ |
4198 | /*----------------------------------------------------------------------*/ |
… | |
… | |
3978 | return state; |
4229 | return state; |
3979 | } |
4230 | } |
3980 | |
4231 | |
3981 | /* we're not using priv _yet_ */ |
4232 | /* we're not using priv _yet_ */ |
3982 | void |
4233 | void |
3983 | rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) |
4234 | rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg) |
3984 | { |
4235 | { |
3985 | unsigned int i, j; |
4236 | unsigned int i, j; |
3986 | int state; |
4237 | int state; |
3987 | |
4238 | |
3988 | static const struct |
4239 | static const struct |
… | |
… | |
3999 | { 5, PrivMode_rVideo }, |
4250 | { 5, PrivMode_rVideo }, |
4000 | { 6, PrivMode_relOrigin }, |
4251 | { 6, PrivMode_relOrigin }, |
4001 | { 7, PrivMode_Autowrap }, |
4252 | { 7, PrivMode_Autowrap }, |
4002 | // 8, bi-directional support mode |
4253 | // 8, bi-directional support mode |
4003 | { 9, PrivMode_MouseX10 }, |
4254 | { 9, PrivMode_MouseX10 }, |
4004 | #ifdef menuBar_esc |
|
|
4005 | { menuBar_esc, PrivMode_menuBar }, |
|
|
4006 | #endif |
|
|
4007 | // 18, 19 printing-related |
4255 | // 18, 19 printing-related |
4008 | { 25, PrivMode_VisibleCursor }, |
4256 | { 25, PrivMode_VisibleCursor }, |
4009 | #ifdef scrollBar_esc |
4257 | #ifdef scrollBar_esc |
4010 | { scrollBar_esc, PrivMode_scrollBar }, |
4258 | { scrollBar_esc, PrivMode_scrollBar }, |
4011 | #endif |
4259 | #endif |
… | |
… | |
4058 | /* extra handling for values with state unkept */ |
4306 | /* extra handling for values with state unkept */ |
4059 | switch (arg[i]) |
4307 | switch (arg[i]) |
4060 | { |
4308 | { |
4061 | #if ENABLE_STYLES |
4309 | #if ENABLE_STYLES |
4062 | case 1021: |
4310 | case 1021: |
4063 | if (mode) |
4311 | set_option (Opt_intensityStyles, mode); |
4064 | SET_OPTION (Opt_intensityStyles); |
|
|
4065 | else |
|
|
4066 | CLR_OPTION (Opt_intensityStyles); |
|
|
4067 | |
4312 | |
4068 | scr_touch (true); |
4313 | scr_touch (true); |
4069 | break; |
4314 | break; |
4070 | #endif |
4315 | #endif |
4071 | case 1048: /* alternative cursor save */ |
4316 | case 1048: /* alternative cursor save */ |
4072 | case 1049: |
4317 | case 1049: |
4073 | if (OPTION (Opt_secondaryScreen)) |
4318 | if (option (Opt_secondaryScreen)) |
4074 | if (mode == 0) |
4319 | if (mode == 0) |
4075 | scr_cursor (RESTORE); |
4320 | scr_cursor (RESTORE); |
4076 | else if (mode == 1) |
4321 | else if (mode == 1) |
4077 | scr_cursor (SAVE); |
4322 | scr_cursor (SAVE); |
4078 | break; |
4323 | break; |
… | |
… | |
4093 | case 3: /* 80/132 */ |
4338 | case 3: /* 80/132 */ |
4094 | if (priv_modes & PrivMode_132OK) |
4339 | if (priv_modes & PrivMode_132OK) |
4095 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4340 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4096 | break; |
4341 | break; |
4097 | case 4: /* smooth scrolling */ |
4342 | case 4: /* smooth scrolling */ |
4098 | if (!state) |
4343 | set_option (Opt_jumpScroll, !state); |
4099 | SET_OPTION (Opt_jumpScroll); |
|
|
4100 | else |
|
|
4101 | CLR_OPTION (Opt_jumpScroll); |
|
|
4102 | break; |
4344 | break; |
4103 | case 5: /* reverse video */ |
4345 | case 5: /* reverse video */ |
4104 | scr_rvideo_mode (state); |
4346 | scr_rvideo_mode (state); |
4105 | break; |
4347 | break; |
4106 | case 6: /* relative/absolute origins */ |
4348 | case 6: /* relative/absolute origins */ |
… | |
… | |
4112 | /* case 8: - auto repeat, can't do on a per window basis */ |
4354 | /* case 8: - auto repeat, can't do on a per window basis */ |
4113 | case 9: /* X10 mouse reporting */ |
4355 | case 9: /* X10 mouse reporting */ |
4114 | if (state) /* orthogonal */ |
4356 | if (state) /* orthogonal */ |
4115 | priv_modes &= ~PrivMode_MouseX11; |
4357 | priv_modes &= ~PrivMode_MouseX11; |
4116 | break; |
4358 | break; |
4117 | #ifdef menuBar_esc |
|
|
4118 | case menuBar_esc: |
|
|
4119 | #ifdef MENUBAR |
|
|
4120 | map_menuBar (state); |
|
|
4121 | #endif |
|
|
4122 | break; |
|
|
4123 | #endif |
|
|
4124 | #ifdef scrollBar_esc |
4359 | #ifdef scrollBar_esc |
4125 | case scrollBar_esc: |
4360 | case scrollBar_esc: |
4126 | if (scrollbar_mapping (state)) |
4361 | if (scrollbar_mapping (state)) |
4127 | { |
4362 | { |
4128 | resize_all_windows (0, 0, 0); |
4363 | resize_all_windows (0, 0, 0); |
… | |
… | |
4147 | #if 0 |
4382 | #if 0 |
4148 | case 1001: |
4383 | case 1001: |
4149 | break; /* X11 mouse highlighting */ |
4384 | break; /* X11 mouse highlighting */ |
4150 | #endif |
4385 | #endif |
4151 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4386 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4152 | if (!state) |
4387 | set_option (Opt_scrollTtyOutput, !state); |
4153 | SET_OPTION (Opt_scrollTtyOutput); |
|
|
4154 | else |
|
|
4155 | CLR_OPTION (Opt_scrollTtyOutput); |
|
|
4156 | break; |
4388 | break; |
4157 | case 1011: /* scroll to bottom on key press */ |
4389 | case 1011: /* scroll to bottom on key press */ |
4158 | if (state) |
4390 | set_option (Opt_scrollTtyKeypress, state); |
4159 | SET_OPTION (Opt_scrollTtyKeypress); |
|
|
4160 | else |
|
|
4161 | CLR_OPTION (Opt_scrollTtyKeypress); |
|
|
4162 | break; |
4391 | break; |
4163 | case 1047: /* secondary screen w/ clearing last */ |
4392 | case 1047: /* secondary screen w/ clearing last */ |
4164 | if (OPTION (Opt_secondaryScreen)) |
4393 | if (option (Opt_secondaryScreen)) |
4165 | if (current_screen != PRIMARY) |
4394 | if (current_screen != PRIMARY) |
4166 | scr_erase_screen (2); |
4395 | scr_erase_screen (2); |
4167 | scr_change_screen (state); |
4396 | scr_change_screen (state); |
4168 | break; |
4397 | break; |
4169 | case 1049: /* secondary screen w/ clearing first */ |
4398 | case 1049: /* secondary screen w/ clearing first */ |
4170 | scr_change_screen (state); |
4399 | scr_change_screen (state); |
4171 | if (OPTION (Opt_secondaryScreen)) |
4400 | if (option (Opt_secondaryScreen)) |
4172 | if (current_screen != PRIMARY) |
4401 | if (current_screen != PRIMARY) |
4173 | scr_erase_screen (2); |
4402 | scr_erase_screen (2); |
4174 | break; |
4403 | break; |
4175 | default: |
4404 | default: |
4176 | break; |
4405 | break; |
… | |
… | |
4304 | scr_color (Color_bg, Color_bg); |
4533 | scr_color (Color_bg, Color_bg); |
4305 | break; |
4534 | break; |
4306 | |
4535 | |
4307 | //case 50: // not variable spacing |
4536 | //case 50: // not variable spacing |
4308 | |
4537 | |
4309 | #ifndef NO_BRIGHTCOLOR |
4538 | #if !ENABLE_MINIMAL |
4310 | case 90: |
4539 | case 90: |
4311 | case 91: /* set bright fg color */ |
4540 | case 91: /* set bright fg color */ |
4312 | case 92: |
4541 | case 92: |
4313 | case 93: |
4542 | case 93: |
4314 | case 94: |
4543 | case 94: |
… | |
… | |
4359 | */ |
4588 | */ |
4360 | void |
4589 | void |
4361 | rxvt_term::tt_printf (const char *fmt,...) |
4590 | rxvt_term::tt_printf (const char *fmt,...) |
4362 | { |
4591 | { |
4363 | va_list arg_ptr; |
4592 | va_list arg_ptr; |
4364 | unsigned char buf[256]; |
4593 | char buf[256]; |
4365 | |
4594 | |
4366 | va_start (arg_ptr, fmt); |
4595 | va_start (arg_ptr, fmt); |
4367 | vsnprintf ((char *)buf, 256, fmt, arg_ptr); |
4596 | vsnprintf ((char *)buf, 256, fmt, arg_ptr); |
4368 | va_end (arg_ptr); |
4597 | va_end (arg_ptr); |
4369 | tt_write (buf, strlen (buf)); |
4598 | tt_write (buf, strlen (buf)); |
… | |
… | |
4374 | * or generated by us in response to a query ESC sequence. |
4603 | * or generated by us in response to a query ESC sequence. |
4375 | */ |
4604 | */ |
4376 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4605 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4377 | |
4606 | |
4378 | void |
4607 | void |
4379 | rxvt_term::tt_write (const unsigned char *data, unsigned int len) |
4608 | rxvt_term::tt_write (const char *data, unsigned int len) |
4380 | { |
4609 | { |
|
|
4610 | if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) |
|
|
4611 | return; |
|
|
4612 | |
|
|
4613 | if (pty->pty < 0) |
|
|
4614 | return; |
|
|
4615 | |
4381 | if (v_buflen == 0) |
4616 | if (v_buflen == 0) |
4382 | { |
4617 | { |
4383 | ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE)); |
4618 | ssize_t written = write (pty->pty, data, min (len, MAX_PTY_WRITE)); |
4384 | |
4619 | |
4385 | if ((unsigned int)written == len) |
4620 | if ((unsigned int)written == len) |
4386 | return; |
4621 | return; |
4387 | |
4622 | |
4388 | data += written; |
4623 | data += written; |
4389 | len -= written; |
4624 | len -= written; |
4390 | } |
4625 | } |
4391 | |
4626 | |
4392 | v_buffer = (unsigned char *)realloc (v_buffer, v_buflen + len); |
4627 | v_buffer = (char *)realloc (v_buffer, v_buflen + len); |
4393 | |
4628 | |
4394 | memcpy (v_buffer + v_buflen, data, len); |
4629 | memcpy (v_buffer + v_buflen, data, len); |
4395 | v_buflen += len; |
4630 | v_buflen += len; |
4396 | |
4631 | |
4397 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4632 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4398 | } |
4633 | } |
4399 | |
4634 | |
4400 | void rxvt_term::pty_write () |
4635 | void rxvt_term::pty_write () |
4401 | { |
4636 | { |
4402 | int written = write (pty.pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4637 | int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4403 | |
4638 | |
4404 | if (written > 0) |
4639 | if (written > 0) |
4405 | { |
4640 | { |
4406 | v_buflen -= written; |
4641 | v_buflen -= written; |
4407 | |
4642 | |