… | |
… | |
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. |
… | |
… | |
64 | |
64 | |
65 | /*----------------------------------------------------------------------*/ |
65 | /*----------------------------------------------------------------------*/ |
66 | |
66 | |
67 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
67 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
68 | |
68 | |
69 | // exception thrown when the command parser runs out of input data |
|
|
70 | class out_of_input { } out_of_input; |
|
|
71 | |
|
|
72 | #if ENABLE_FRILLS || ISO_14755 |
69 | #if ENABLE_FRILLS || ISO_14755 |
73 | |
70 | |
74 | #define ISO_14755_STARTED 0x80000000UL |
71 | #define ISO_14755_STARTED 0x80000000UL |
75 | #define ISO_14755_51 0x40000000UL // basic (section 5.1) |
72 | #define ISO_14755_51 0x40000000UL // basic (section 5.1) |
76 | #define ISO_14755_52 0x20000000UL // keycap (section 5.2) |
73 | #define ISO_14755_52 0x20000000UL // keycap (section 5.2) |
… | |
… | |
147 | || !IN_RANGE_EXC (y, 0, nrow)) |
144 | || !IN_RANGE_EXC (y, 0, nrow)) |
148 | return; |
145 | return; |
149 | |
146 | |
150 | for (;;) |
147 | for (;;) |
151 | { |
148 | { |
152 | const line_t &l = ROW(y - view_start); |
149 | const line_t &l = ROW(y + view_start); |
153 | |
150 | |
154 | text_t t = l.t[x]; |
151 | text_t t = l.t[x]; |
155 | |
152 | |
156 | if (t != NOCHAR || !x) |
153 | if (t != NOCHAR || !x) |
157 | { |
154 | { |
… | |
… | |
302 | rxvt_term::lookup_key (XKeyEvent &ev) |
299 | rxvt_term::lookup_key (XKeyEvent &ev) |
303 | { |
300 | { |
304 | int ctrl, meta, shft, len; |
301 | int ctrl, meta, shft, len; |
305 | unsigned int newlen; |
302 | unsigned int newlen; |
306 | KeySym keysym; |
303 | KeySym keysym; |
307 | #ifdef DEBUG_CMD |
|
|
308 | static int debug_key = 1; /* accessible by a debugger only */ |
|
|
309 | #endif |
|
|
310 | int valid_keysym; |
304 | int valid_keysym; |
311 | char kbuf[KBUFSZ]; |
305 | char kbuf[KBUFSZ]; |
312 | |
306 | |
313 | /* |
307 | /* |
314 | * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an |
308 | * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an |
… | |
… | |
443 | scr_move_to (0, 1); |
437 | scr_move_to (0, 1); |
444 | return; |
438 | return; |
445 | } |
439 | } |
446 | else if (keysym == XK_End) |
440 | else if (keysym == XK_End) |
447 | { |
441 | { |
448 | scr_move_to (1, 0); |
442 | scr_move_to (1, 1); |
449 | return; |
443 | return; |
450 | } |
444 | } |
451 | } |
445 | } |
452 | #endif |
446 | #endif |
453 | } |
447 | } |
… | |
… | |
464 | { |
458 | { |
465 | switch (keysym) |
459 | switch (keysym) |
466 | { |
460 | { |
467 | /* normal XTerm key bindings */ |
461 | /* normal XTerm key bindings */ |
468 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
462 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
469 | selection_request (ev.time, 0, 0); |
463 | selection_request (ev.time); |
470 | return; |
464 | return; |
471 | #if TODO |
465 | #if TODO |
472 | /* rxvt extras */ |
466 | /* rxvt extras */ |
473 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
467 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
474 | change_font (FONT_UP); |
468 | change_font (FONT_UP); |
… | |
… | |
867 | #endif |
861 | #endif |
868 | /* nil */ ; |
862 | /* nil */ ; |
869 | } |
863 | } |
870 | } |
864 | } |
871 | |
865 | |
|
|
866 | if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, DT_STR_LEN, kbuf, len, DT_END))) |
|
|
867 | return; |
|
|
868 | |
872 | if (len <= 0) |
869 | if (len <= 0) |
873 | return; /* not mapped */ |
870 | return; /* not mapped */ |
874 | |
871 | |
875 | if (OPTION (Opt_scrollTtyKeypress)) |
872 | if (OPTION (Opt_scrollTtyKeypress)) |
876 | if (view_start) |
873 | if (view_start) |
… | |
… | |
902 | { |
899 | { |
903 | const char ch = C0_ESC; |
900 | const char ch = C0_ESC; |
904 | tt_write (&ch, 1); |
901 | tt_write (&ch, 1); |
905 | } |
902 | } |
906 | |
903 | |
907 | #if defined(DEBUG_CMD) |
|
|
908 | /* Display keyboard buffer contents */ |
|
|
909 | unsigned char *p; |
|
|
910 | int i; |
|
|
911 | |
|
|
912 | fprintf (stderr, "key 0x%04X [%d]: `", (unsigned int)keysym, len); |
|
|
913 | for (i = 0, p = kbuf; i < len; i++, p++) |
|
|
914 | fprintf (stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); |
|
|
915 | fprintf (stderr, "'\n"); |
|
|
916 | #endif /* DEBUG_CMD */ |
|
|
917 | tt_write (kbuf, (unsigned int)len); |
904 | tt_write (kbuf, (unsigned int)len); |
918 | } |
905 | } |
919 | /*}}} */ |
906 | /*}}} */ |
920 | |
907 | |
921 | #if MENUBAR_MAX || defined (KEYSYM_RESOURCE) |
908 | #if defined (KEYSYM_RESOURCE) |
922 | /*{{{ rxvt_cmd_write (), rxvt_cmd_getc () */ |
|
|
923 | /* attempt to `write' count to the input buffer */ |
|
|
924 | unsigned int |
909 | unsigned int |
925 | rxvt_term::cmd_write (const char *str, unsigned int count) |
910 | rxvt_term::cmd_write (const char *str, unsigned int count) |
926 | { |
911 | { |
927 | unsigned int n, s; |
912 | unsigned int n, s; |
928 | |
913 | |
… | |
… | |
967 | } |
952 | } |
968 | #endif |
953 | #endif |
969 | |
954 | |
970 | if (want_refresh) |
955 | if (want_refresh) |
971 | { |
956 | { |
|
|
957 | if (SHOULD_INVOKE (HOOK_LINE_UPDATE)) |
|
|
958 | { |
|
|
959 | int row = view_start; |
|
|
960 | int end_row = row + nrow; |
|
|
961 | |
|
|
962 | while (row > top_row && ROW (row - 1).is_longer ()) |
|
|
963 | --row; |
|
|
964 | |
|
|
965 | do |
|
|
966 | { |
|
|
967 | int start_row = row; |
|
|
968 | line_t *l; |
|
|
969 | |
|
|
970 | do |
|
|
971 | { |
|
|
972 | l = &ROW (row++); |
|
|
973 | |
|
|
974 | if (!(l->f & LINE_FILTERED)) |
|
|
975 | { |
|
|
976 | // line not filtered, mark it as filtered |
|
|
977 | l->f |= LINE_FILTERED; |
|
|
978 | while (l->is_longer ()) |
|
|
979 | { |
|
|
980 | l = &ROW (row++); |
|
|
981 | l->f |= LINE_FILTERED; |
|
|
982 | } |
|
|
983 | |
|
|
984 | // and filter it |
|
|
985 | HOOK_INVOKE ((this, HOOK_LINE_UPDATE, DT_INT, start_row, DT_END)); |
|
|
986 | |
|
|
987 | break; |
|
|
988 | } |
|
|
989 | } |
|
|
990 | while (l->is_longer () && row < end_row); |
|
|
991 | } |
|
|
992 | while (row < end_row); |
|
|
993 | } |
|
|
994 | |
972 | scr_refresh (refresh_type); |
995 | scr_refresh (); |
973 | scrollbar_show (1); |
996 | scrollbar_show (1); |
974 | #ifdef USE_XIM |
997 | #ifdef USE_XIM |
975 | IMSendSpot (); |
998 | IMSendSpot (); |
976 | #endif |
999 | #endif |
977 | } |
1000 | } |
… | |
… | |
980 | } |
1003 | } |
981 | |
1004 | |
982 | void |
1005 | void |
983 | rxvt_term::check_cb (check_watcher &w) |
1006 | rxvt_term::check_cb (check_watcher &w) |
984 | { |
1007 | { |
985 | SET_R (this); |
1008 | make_current (); |
986 | SET_LOCALE (locale); |
|
|
987 | |
1009 | |
988 | display->flush (); |
1010 | display->flush (); |
989 | |
1011 | |
990 | if (want_refresh && !flush_ev.active) |
1012 | if (want_refresh && !flush_ev.active) |
991 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
1013 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
992 | } |
1014 | } |
993 | |
1015 | |
994 | void |
1016 | void |
995 | rxvt_term::flush_cb (time_watcher &w) |
1017 | rxvt_term::flush_cb (time_watcher &w) |
996 | { |
1018 | { |
997 | SET_R (this); |
1019 | make_current (); |
998 | SET_LOCALE (locale); |
|
|
999 | |
1020 | |
1000 | refresh_limit = 1; |
1021 | refresh_limit = 1; |
1001 | refresh_count = 0; |
1022 | refresh_count = 0; |
1002 | flush (); |
1023 | flush (); |
1003 | } |
1024 | } |
… | |
… | |
1007 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1028 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1008 | { |
1029 | { |
1009 | hidden_cursor = !hidden_cursor; |
1030 | hidden_cursor = !hidden_cursor; |
1010 | want_refresh = 1; |
1031 | want_refresh = 1; |
1011 | |
1032 | |
1012 | w.start (w.at + BLINK_INTERVAL); |
1033 | w.start (w.at + CURSOR_BLINK_INTERVAL); |
1013 | } |
1034 | } |
1014 | #endif |
1035 | #endif |
1015 | |
1036 | |
1016 | #ifdef TEXT_BLINK |
1037 | #ifdef TEXT_BLINK |
1017 | void |
1038 | void |
… | |
… | |
1031 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1052 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1032 | { |
1053 | { |
1033 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1054 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1034 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1055 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1035 | { |
1056 | { |
1036 | refresh_type |= SMOOTH_REFRESH; |
|
|
1037 | want_refresh = 1; |
1057 | want_refresh = 1; |
1038 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1058 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1039 | } |
1059 | } |
1040 | } |
1060 | } |
1041 | #endif |
1061 | #endif |
… | |
… | |
1045 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1065 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1046 | { |
1066 | { |
1047 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1067 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1048 | { |
1068 | { |
1049 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1069 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1050 | refresh_type |= SMOOTH_REFRESH; |
|
|
1051 | want_refresh = 1; |
1070 | want_refresh = 1; |
1052 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1071 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1053 | } |
1072 | } |
1054 | } |
1073 | } |
1055 | #endif |
1074 | #endif |
… | |
… | |
1060 | { |
1079 | { |
1061 | if (mouse_slip_wheel_speed == 0 |
1080 | if (mouse_slip_wheel_speed == 0 |
1062 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
1081 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
1063 | : scr_page (UP, mouse_slip_wheel_speed)) |
1082 | : scr_page (UP, mouse_slip_wheel_speed)) |
1064 | { |
1083 | { |
1065 | if (view_start == nsaved || |
1084 | if (view_start == top_row || view_start == 0) |
1066 | view_start == 0) |
|
|
1067 | mouse_slip_wheel_speed = 0; |
1085 | mouse_slip_wheel_speed = 0; |
1068 | |
1086 | |
1069 | refresh_type |= SMOOTH_REFRESH; |
|
|
1070 | want_refresh = 1; |
1087 | want_refresh = 1; |
1071 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1088 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1072 | } |
1089 | } |
1073 | } |
1090 | } |
1074 | #endif |
1091 | #endif |
… | |
… | |
1104 | |
1121 | |
1105 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1122 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1106 | cmdbuf_ptr = cmdbuf_base; |
1123 | cmdbuf_ptr = cmdbuf_base; |
1107 | cmdbuf_endp = cmdbuf_ptr + n; |
1124 | cmdbuf_endp = cmdbuf_ptr + n; |
1108 | |
1125 | |
1109 | ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); |
1126 | ssize_t r = read (pty->pty, cmdbuf_endp, CBUFSIZ - n); |
1110 | |
1127 | |
1111 | if (r > 0) |
1128 | if (r > 0) |
1112 | { |
1129 | { |
1113 | cmdbuf_endp += r; |
1130 | cmdbuf_endp += r; |
1114 | return true; |
1131 | return true; |
… | |
… | |
1132 | } |
1149 | } |
1133 | |
1150 | |
1134 | void |
1151 | void |
1135 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1152 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1136 | { |
1153 | { |
1137 | SET_R (this); |
1154 | make_current (); |
1138 | SET_LOCALE (locale); |
|
|
1139 | |
1155 | |
1140 | if (revents & EVENT_READ) |
1156 | if (revents & EVENT_READ) |
1141 | // loop, but don't allow a single term to monopolize us |
1157 | // loop, but don't allow a single term to monopolize us |
1142 | while (pty_fill ()) |
1158 | while (pty_fill ()) |
1143 | if (cmd_parse ()) |
1159 | if (cmd_parse ()) |
… | |
… | |
1163 | |
1179 | |
1164 | #ifdef POINTER_BLANK |
1180 | #ifdef POINTER_BLANK |
1165 | void |
1181 | void |
1166 | rxvt_term::pointer_blank () |
1182 | rxvt_term::pointer_blank () |
1167 | { |
1183 | { |
1168 | if (! OPTION (Opt_pointerBlank)) |
1184 | if (!OPTION (Opt_pointerBlank)) |
1169 | return; |
1185 | return; |
1170 | |
1186 | |
1171 | XDefineCursor (display->display, vt, display->blank_cursor); |
1187 | XDefineCursor (display->display, vt, display->blank_cursor); |
1172 | XFlush (display->display); |
1188 | XFlush (display->display); |
1173 | |
1189 | |
… | |
… | |
1175 | } |
1191 | } |
1176 | |
1192 | |
1177 | void |
1193 | void |
1178 | rxvt_term::pointer_cb (time_watcher &w) |
1194 | rxvt_term::pointer_cb (time_watcher &w) |
1179 | { |
1195 | { |
1180 | SET_R (this); |
1196 | make_current (); |
1181 | SET_LOCALE (locale); |
|
|
1182 | |
1197 | |
1183 | pointer_blank (); |
1198 | pointer_blank (); |
1184 | } |
1199 | } |
1185 | #endif |
1200 | #endif |
1186 | |
1201 | |
… | |
… | |
1251 | (32 + button_number + key_state), |
1266 | (32 + button_number + key_state), |
1252 | (32 + x + 1), |
1267 | (32 + x + 1), |
1253 | (32 + y + 1)); |
1268 | (32 + y + 1)); |
1254 | } |
1269 | } |
1255 | |
1270 | |
1256 | #ifdef USING_W11LIB |
|
|
1257 | void |
|
|
1258 | rxvt_W11_process_x_event (XEvent *ev) |
|
|
1259 | { |
|
|
1260 | rxvt_t *r = rxvt_get_r (); |
|
|
1261 | |
|
|
1262 | x_cb (*ev); |
|
|
1263 | } |
|
|
1264 | #endif |
|
|
1265 | |
|
|
1266 | /*{{{ process an X event */ |
1271 | /*{{{ process an X event */ |
1267 | void |
1272 | void |
1268 | rxvt_term::x_cb (XEvent &ev) |
1273 | rxvt_term::x_cb (XEvent &ev) |
1269 | { |
1274 | { |
|
|
1275 | make_current (); |
|
|
1276 | |
1270 | dDisp; |
1277 | dDisp; |
1271 | |
1278 | |
1272 | SET_R (this); |
1279 | if (ev.xany.window == vt |
1273 | SET_LOCALE (locale); |
1280 | && SHOULD_INVOKE (HOOK_X_EVENT) |
|
|
1281 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
|
|
1282 | return; |
1274 | |
1283 | |
1275 | #if defined(CURSOR_BLINK) |
1284 | // for XQueryPointer |
1276 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
|
|
1277 | { |
|
|
1278 | if (hidden_cursor) |
|
|
1279 | { |
|
|
1280 | hidden_cursor = 0; |
|
|
1281 | want_refresh = 1; |
|
|
1282 | } |
|
|
1283 | |
|
|
1284 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
|
|
1285 | } |
|
|
1286 | #endif |
|
|
1287 | |
|
|
1288 | #if defined(POINTER_BLANK) |
|
|
1289 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
|
|
1290 | { |
|
|
1291 | if (ev.type == MotionNotify |
|
|
1292 | || ev.type == ButtonPress |
|
|
1293 | || ev.type == ButtonRelease) |
|
|
1294 | if (hidden_pointer) |
|
|
1295 | pointer_unblank (); |
|
|
1296 | |
|
|
1297 | if (ev.type == KeyPress && hidden_pointer == 0) |
|
|
1298 | pointer_blank (); |
|
|
1299 | } |
|
|
1300 | #endif |
|
|
1301 | |
|
|
1302 | Window unused_root, unused_child; |
1285 | Window unused_root, unused_child; |
1303 | int unused_root_x, unused_root_y; |
1286 | int unused_root_x, unused_root_y; |
1304 | unsigned int unused_mask; |
1287 | unsigned int unused_mask; |
1305 | |
1288 | |
1306 | switch (ev.type) |
1289 | switch (ev.type) |
… | |
… | |
1313 | |
1296 | |
1314 | break; |
1297 | break; |
1315 | |
1298 | |
1316 | case KeyRelease: |
1299 | case KeyRelease: |
1317 | { |
1300 | { |
1318 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 |
1301 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 || ENABLE_PERL |
1319 | KeySym ks; |
1302 | KeySym keysym; |
1320 | |
1303 | |
1321 | ks = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
1304 | keysym = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
1322 | #endif |
1305 | #endif |
1323 | |
1306 | |
1324 | #if ENABLE_FRILLS || ISO_14755 |
1307 | #if ENABLE_FRILLS || ISO_14755 |
1325 | // ISO 14755 support |
1308 | // ISO 14755 support |
1326 | if (iso14755buf) |
1309 | if (iso14755buf) |
… | |
… | |
1331 | # endif |
1314 | # endif |
1332 | # if ISO_14755 |
1315 | # if ISO_14755 |
1333 | // iso14755 part 5.2 handling: release time |
1316 | // iso14755 part 5.2 handling: release time |
1334 | // first: controls |
1317 | // first: controls |
1335 | if ((ev.xkey.state & ControlMask) |
1318 | if ((ev.xkey.state & ControlMask) |
1336 | && ((ks >= 0x40 && ks <= 0x5f) |
1319 | && ((keysym >= 0x40 && keysym <= 0x5f) |
1337 | || (ks >= 0x61 && ks <= 0x7f))) |
1320 | || (keysym >= 0x61 && keysym <= 0x7f))) |
1338 | { |
1321 | { |
1339 | iso14755buf = ISO_14755_51 | 0x2400 | (ks & 0x1f); |
1322 | iso14755buf = ISO_14755_51 | 0x2400 | (keysym & 0x1f); |
1340 | commit_iso14755 (); |
1323 | commit_iso14755 (); |
1341 | return; // case-break; |
1324 | goto skip_switch; |
1342 | } |
1325 | } |
1343 | |
1326 | |
1344 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
1327 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
1345 | if (i[0] == ks) |
1328 | if (i[0] == keysym) |
1346 | { |
1329 | { |
1347 | iso14755buf = ISO_14755_51 | i[1]; |
1330 | iso14755buf = ISO_14755_51 | i[1]; |
1348 | commit_iso14755 (); |
1331 | commit_iso14755 (); |
1349 | return; // case-break; |
1332 | goto skip_switch; |
1350 | } |
1333 | } |
1351 | |
1334 | |
1352 | scr_bell (); |
1335 | scr_bell (); |
1353 | # endif |
1336 | # endif |
1354 | iso14755buf = 0; |
1337 | iso14755buf = 0; |
… | |
… | |
1373 | else |
1356 | else |
1374 | iso14755buf = 0; |
1357 | iso14755buf = 0; |
1375 | } |
1358 | } |
1376 | #endif |
1359 | #endif |
1377 | |
1360 | |
|
|
1361 | if (ev.xany.window == vt |
|
|
1362 | && HOOK_INVOKE ((this, HOOK_KEY_RELEASE, DT_XEVENT, &ev, DT_INT, keysym, DT_END))) |
|
|
1363 | break; |
|
|
1364 | |
1378 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1365 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1379 | if (!(ev.xkey.state & ControlMask)) |
1366 | if (!(ev.xkey.state & ControlMask)) |
1380 | slip_wheel_ev.stop (); |
1367 | slip_wheel_ev.stop (); |
1381 | else if (ks == XK_Control_L || ks == XK_Control_R) |
1368 | else if (keysym == XK_Control_L || keysym == XK_Control_R) |
1382 | mouse_slip_wheel_speed = 0; |
1369 | mouse_slip_wheel_speed = 0; |
1383 | #endif |
1370 | #endif |
1384 | break; |
1371 | break; |
1385 | } |
1372 | } |
1386 | |
1373 | |
… | |
… | |
1392 | button_release (ev.xbutton); |
1379 | button_release (ev.xbutton); |
1393 | break; |
1380 | break; |
1394 | |
1381 | |
1395 | case ClientMessage: |
1382 | case ClientMessage: |
1396 | if (ev.xclient.format == 32 |
1383 | if (ev.xclient.format == 32 |
1397 | && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
1384 | && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END))) |
1398 | { |
1385 | { |
|
|
1386 | if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
|
|
1387 | { |
|
|
1388 | if (!HOOK_INVOKE ((this, HOOK_WM_PROTOCOLS, DT_XEVENT, &ev, DT_END))) |
|
|
1389 | { |
1399 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
1390 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
|
|
1391 | { |
|
|
1392 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) |
1400 | destroy (); |
1393 | destroy (); |
|
|
1394 | } |
1401 | #if ENABLE_EWMH |
1395 | #if ENABLE_EWMH |
1402 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1396 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1403 | XSendEvent (disp, ev.xclient.window = display->root, |
1397 | XSendEvent (disp, ev.xclient.window = display->root, |
1404 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1398 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1405 | &ev); |
1399 | &ev); |
|
|
1400 | #endif |
|
|
1401 | } |
|
|
1402 | } |
|
|
1403 | #if ENABLE_XEMBED |
|
|
1404 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1405 | { |
|
|
1406 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1407 | focus_in (); |
|
|
1408 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1409 | focus_out (); |
|
|
1410 | } |
1406 | #endif |
1411 | #endif |
1407 | } |
1412 | } |
1408 | #if ENABLE_XEMBED |
|
|
1409 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1410 | { |
|
|
1411 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1412 | focus_in (); |
|
|
1413 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1414 | focus_out (); |
|
|
1415 | } |
|
|
1416 | #endif |
|
|
1417 | #ifdef OFFIX_DND |
|
|
1418 | /* OffiX Dnd (drag 'n' drop) protocol */ |
|
|
1419 | else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL] |
|
|
1420 | && (ev.xclient.data.l[0] == DndFile |
|
|
1421 | || ev.xclient.data.l[0] == DndDir |
|
|
1422 | || ev.xclient.data.l[0] == DndLink)) |
|
|
1423 | { |
|
|
1424 | /* Get Dnd data */ |
|
|
1425 | Atom ActualType; |
|
|
1426 | int ActualFormat; |
|
|
1427 | unsigned char *data; |
|
|
1428 | unsigned long Size, RemainingBytes; |
|
|
1429 | |
|
|
1430 | XGetWindowProperty (disp, display->root, |
|
|
1431 | xa[XA_DNDSELECTION], |
|
|
1432 | 0L, 1000000L, |
|
|
1433 | False, AnyPropertyType, |
|
|
1434 | &ActualType, &ActualFormat, |
|
|
1435 | &Size, &RemainingBytes, |
|
|
1436 | &data); |
|
|
1437 | set_string_property (XA_CUT_BUFFER0, data); |
|
|
1438 | XFree (data); |
|
|
1439 | selection_paste (display->root, XA_CUT_BUFFER0, true); |
|
|
1440 | XSetInputFocus (disp, display->root, RevertToNone, CurrentTime); |
|
|
1441 | } |
|
|
1442 | #endif /* OFFIX_DND */ |
|
|
1443 | break; |
1413 | break; |
1444 | |
1414 | |
1445 | case MappingNotify: |
1415 | case MappingNotify: |
1446 | XRefreshKeyboardMapping (&ev.xmapping); |
1416 | XRefreshKeyboardMapping (&ev.xmapping); |
1447 | break; |
1417 | break; |
… | |
… | |
1489 | { |
1459 | { |
1490 | seen_resize = 1; |
1460 | seen_resize = 1; |
1491 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1461 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1492 | } |
1462 | } |
1493 | |
1463 | |
|
|
1464 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
|
|
1465 | |
1494 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1466 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1495 | if (OPTION (Opt_transparent)) |
1467 | if (OPTION (Opt_transparent)) |
1496 | check_our_parents (); |
1468 | check_our_parents (); |
1497 | #endif |
1469 | #endif |
1498 | } |
1470 | } |
1499 | break; |
1471 | break; |
1500 | |
1472 | |
1501 | case PropertyNotify: |
1473 | case PropertyNotify: |
|
|
1474 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1502 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1475 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1503 | && ev.xproperty.state == PropertyNewValue) |
1476 | && ev.xproperty.state == PropertyNewValue) |
1504 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1477 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1505 | |
1478 | |
1506 | break; |
1479 | break; |
1507 | |
1480 | |
1508 | case SelectionClear: |
1481 | case SelectionClear: |
1509 | selection_clear (); |
1482 | selection_clear (); |
… | |
… | |
1514 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1487 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1515 | break; |
1488 | break; |
1516 | |
1489 | |
1517 | case SelectionRequest: |
1490 | case SelectionRequest: |
1518 | selection_send (ev.xselectionrequest); |
1491 | selection_send (ev.xselectionrequest); |
|
|
1492 | break; |
|
|
1493 | |
|
|
1494 | case MapNotify: |
|
|
1495 | mapped = 1; |
|
|
1496 | #ifdef TEXT_BLINK |
|
|
1497 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
|
|
1498 | #endif |
|
|
1499 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1519 | break; |
1500 | break; |
1520 | |
1501 | |
1521 | case UnmapNotify: |
1502 | case UnmapNotify: |
1522 | mapped = 0; |
1503 | mapped = 0; |
1523 | #ifdef TEXT_BLINK |
1504 | #ifdef TEXT_BLINK |
1524 | text_blink_ev.stop (); |
1505 | text_blink_ev.stop (); |
1525 | #endif |
1506 | #endif |
1526 | break; |
1507 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1527 | |
|
|
1528 | case MapNotify: |
|
|
1529 | mapped = 1; |
|
|
1530 | #ifdef TEXT_BLINK |
|
|
1531 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
|
|
1532 | #endif |
|
|
1533 | break; |
1508 | break; |
1534 | |
1509 | |
1535 | #ifdef TRANSPARENT |
1510 | #ifdef TRANSPARENT |
1536 | case ReparentNotify: |
1511 | case ReparentNotify: |
1537 | rootwin_cb (ev); |
1512 | rootwin_cb (ev); |
… | |
… | |
1551 | |
1526 | |
1552 | while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)) |
1527 | while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)) |
1553 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1528 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1554 | ev.xexpose.width, ev.xexpose.height, False); |
1529 | ev.xexpose.width, ev.xexpose.height, False); |
1555 | |
1530 | |
1556 | scr_refresh (refresh_type); |
1531 | want_refresh = 1; |
1557 | } |
1532 | } |
1558 | else |
1533 | else |
1559 | { |
1534 | { |
1560 | XEvent unused_event; |
1535 | XEvent unused_event; |
1561 | |
1536 | |
… | |
… | |
1567 | if (isScrollbarWindow (ev.xany.window)) |
1542 | if (isScrollbarWindow (ev.xany.window)) |
1568 | { |
1543 | { |
1569 | scrollBar.setIdle (); |
1544 | scrollBar.setIdle (); |
1570 | scrollbar_show (0); |
1545 | scrollbar_show (0); |
1571 | } |
1546 | } |
1572 | #ifdef MENUBAR |
|
|
1573 | if (menubar_visible () && isMenuBarWindow (ev.xany.window)) |
|
|
1574 | menubar_expose (); |
|
|
1575 | #endif |
|
|
1576 | |
1547 | |
1577 | #ifdef TRANSPARENT |
1548 | #ifdef TRANSPARENT |
1578 | if (am_transparent && ev.xany.window == parent[0]) |
1549 | if (am_transparent && ev.xany.window == parent[0]) |
1579 | XClearWindow (disp, ev.xany.window); |
1550 | XClearWindow (disp, ev.xany.window); |
1580 | #endif |
1551 | #endif |
… | |
… | |
1584 | case MotionNotify: |
1555 | case MotionNotify: |
1585 | #ifdef POINTER_BLANK |
1556 | #ifdef POINTER_BLANK |
1586 | if (hidden_pointer) |
1557 | if (hidden_pointer) |
1587 | pointer_unblank (); |
1558 | pointer_unblank (); |
1588 | #endif |
1559 | #endif |
1589 | #if MENUBAR |
|
|
1590 | if (isMenuBarWindow (ev.xany.window)) |
|
|
1591 | { |
|
|
1592 | menubar_control (ev.xbutton); |
|
|
1593 | break; |
|
|
1594 | } |
|
|
1595 | #endif |
|
|
1596 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1560 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1597 | break; |
1561 | break; |
1598 | |
1562 | |
1599 | if (ev.xany.window == vt) |
1563 | if (ev.xany.window == vt) |
1600 | { |
1564 | { |
|
|
1565 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
|
|
1566 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
|
|
1567 | ; // nop |
1601 | if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1568 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1602 | { |
1569 | { |
1603 | while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) |
1570 | while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) |
1604 | ; |
1571 | ; |
1605 | |
1572 | |
1606 | XQueryPointer (disp, vt, |
1573 | XQueryPointer (disp, vt, |
… | |
… | |
1686 | &unused_root_x, &unused_root_y, |
1653 | &unused_root_x, &unused_root_y, |
1687 | &ev.xbutton.x, &ev.xbutton.y, |
1654 | &ev.xbutton.x, &ev.xbutton.y, |
1688 | &unused_mask); |
1655 | &unused_mask); |
1689 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1656 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1690 | scrollbar_size ()); |
1657 | scrollbar_size ()); |
1691 | scr_refresh (refresh_type); |
1658 | want_refresh = 1; |
1692 | refresh_limit = 0; |
1659 | refresh_limit = 0; |
1693 | scrollbar_show (1); |
1660 | scrollbar_show (1); |
1694 | } |
1661 | } |
1695 | break; |
1662 | break; |
1696 | } |
1663 | } |
|
|
1664 | |
|
|
1665 | skip_switch: ; |
|
|
1666 | |
|
|
1667 | #if defined(CURSOR_BLINK) |
|
|
1668 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
|
|
1669 | { |
|
|
1670 | if (hidden_cursor) |
|
|
1671 | { |
|
|
1672 | hidden_cursor = 0; |
|
|
1673 | want_refresh = 1; |
|
|
1674 | } |
|
|
1675 | |
|
|
1676 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
|
|
1677 | } |
|
|
1678 | #endif |
|
|
1679 | |
|
|
1680 | #if defined(POINTER_BLANK) |
|
|
1681 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
|
|
1682 | { |
|
|
1683 | if (ev.type == MotionNotify |
|
|
1684 | || ev.type == ButtonPress |
|
|
1685 | || ev.type == ButtonRelease) |
|
|
1686 | if (hidden_pointer) |
|
|
1687 | pointer_unblank (); |
|
|
1688 | |
|
|
1689 | if (ev.type == KeyPress && hidden_pointer == 0) |
|
|
1690 | pointer_blank (); |
|
|
1691 | } |
|
|
1692 | #endif |
1697 | } |
1693 | } |
1698 | |
1694 | |
1699 | void |
1695 | void |
1700 | rxvt_term::focus_in () |
1696 | rxvt_term::focus_in () |
1701 | { |
1697 | { |
1702 | if (!focus) |
1698 | if (!focus) |
1703 | { |
1699 | { |
1704 | focus = 1; |
1700 | focus = 1; |
1705 | want_refresh = 1; |
1701 | want_refresh = 1; |
1706 | |
1702 | |
1707 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1703 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1708 | |
1704 | |
1709 | #if USE_XIM |
1705 | #if USE_XIM |
1710 | if (Input_Context != NULL) |
1706 | if (Input_Context != NULL) |
1711 | { |
1707 | { |
1712 | IMSetStatusPosition (); |
1708 | IMSetStatusPosition (); |
1713 | XSetICFocus (Input_Context); |
1709 | XSetICFocus (Input_Context); |
1714 | } |
1710 | } |
1715 | #endif |
1711 | #endif |
1716 | #if CURSOR_BLINK |
1712 | #if CURSOR_BLINK |
1717 | if (OPTION (Opt_cursorBlink)) |
1713 | if (OPTION (Opt_cursorBlink)) |
1718 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1714 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1719 | #endif |
1715 | #endif |
1720 | #if OFF_FOCUS_FADING |
1716 | #if OFF_FOCUS_FADING |
1721 | if (rs[Rs_fade]) |
1717 | if (rs[Rs_fade]) |
1722 | { |
1718 | { |
1723 | pix_colors = pix_colors_focused; |
1719 | pix_colors = pix_colors_focused; |
… | |
… | |
1733 | if (focus) |
1729 | if (focus) |
1734 | { |
1730 | { |
1735 | focus = 0; |
1731 | focus = 0; |
1736 | want_refresh = 1; |
1732 | want_refresh = 1; |
1737 | |
1733 | |
1738 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1734 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1739 | |
1735 | |
1740 | #if ENABLE_FRILLS || ISO_14755 |
1736 | #if ENABLE_FRILLS || ISO_14755 |
1741 | if (iso14755buf) |
1737 | if (iso14755buf) |
1742 | { |
1738 | { |
1743 | iso14755buf = 0; |
1739 | iso14755buf = 0; |
… | |
… | |
1767 | |
1763 | |
1768 | #if TRANSPARENT |
1764 | #if TRANSPARENT |
1769 | void |
1765 | void |
1770 | rxvt_term::rootwin_cb (XEvent &ev) |
1766 | rxvt_term::rootwin_cb (XEvent &ev) |
1771 | { |
1767 | { |
1772 | SET_R (this); |
1768 | make_current (); |
1773 | SET_LOCALE (locale); |
|
|
1774 | |
1769 | |
1775 | switch (ev.type) |
1770 | switch (ev.type) |
1776 | { |
1771 | { |
1777 | case PropertyNotify: |
1772 | case PropertyNotify: |
1778 | /* |
1773 | /* |
… | |
… | |
1805 | /* |
1800 | /* |
1806 | * VT window processing of button press |
1801 | * VT window processing of button press |
1807 | */ |
1802 | */ |
1808 | if (ev.window == vt) |
1803 | if (ev.window == vt) |
1809 | { |
1804 | { |
|
|
1805 | if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1806 | return; |
|
|
1807 | |
1810 | #if ISO_14755 |
1808 | #if ISO_14755 |
1811 | // 5.4 |
1809 | // 5.4 |
1812 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1810 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1813 | { |
1811 | { |
1814 | iso14755_54 (ev.x, ev.y); |
1812 | iso14755_54 (ev.x, ev.y); |
… | |
… | |
1826 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1824 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1827 | if (ev.button == MEvent.button && clickintime) |
1825 | if (ev.button == MEvent.button && clickintime) |
1828 | { |
1826 | { |
1829 | /* same button, within alloted time */ |
1827 | /* same button, within alloted time */ |
1830 | MEvent.clicks++; |
1828 | MEvent.clicks++; |
|
|
1829 | |
1831 | if (MEvent.clicks > 1) |
1830 | if (MEvent.clicks > 1) |
1832 | { |
1831 | { |
1833 | /* only report double clicks */ |
1832 | /* only report double clicks */ |
1834 | MEvent.clicks = 2; |
1833 | MEvent.clicks = 2; |
1835 | mouse_report (ev); |
1834 | mouse_report (ev); |
… | |
… | |
1855 | else |
1854 | else |
1856 | { |
1855 | { |
1857 | if (ev.button != MEvent.button) |
1856 | if (ev.button != MEvent.button) |
1858 | MEvent.clicks = 0; |
1857 | MEvent.clicks = 0; |
1859 | |
1858 | |
1860 | if (!PERL_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END))) |
|
|
1861 | switch (ev.button) |
1859 | switch (ev.button) |
1862 | { |
1860 | { |
1863 | case Button1: |
1861 | case Button1: |
1864 | /* allow meta + click to select rectangular areas */ |
1862 | /* allow meta + click to select rectangular areas */ |
1865 | /* should be done in screen.C */ |
1863 | /* should be done in screen.C */ |
1866 | #if ENABLE_FRILLS |
1864 | #if ENABLE_FRILLS |
1867 | selection.rect = !!(ev.state & ModMetaMask); |
1865 | selection.rect = !!(ev.state & ModMetaMask); |
1868 | #else |
1866 | #else |
1869 | selection.rect = false; |
1867 | selection.rect = false; |
1870 | #endif |
1868 | #endif |
1871 | |
1869 | |
1872 | /* allow shift+left click to extend selection */ |
1870 | /* allow shift+left click to extend selection */ |
1873 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1871 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1874 | { |
1872 | { |
1875 | if (MEvent.button == Button1 && clickintime) |
1873 | if (MEvent.button == Button1 && clickintime) |
1876 | selection_rotate (ev.x, ev.y); |
1874 | selection_rotate (ev.x, ev.y); |
1877 | else |
1875 | else |
1878 | selection_extend (ev.x, ev.y, 1); |
1876 | selection_extend (ev.x, ev.y, 1); |
1879 | } |
1877 | } |
1880 | else |
1878 | else |
1881 | { |
1879 | { |
1882 | if (MEvent.button == Button1 && clickintime) |
1880 | if (MEvent.button == Button1 && clickintime) |
1883 | MEvent.clicks++; |
1881 | MEvent.clicks++; |
1884 | else |
1882 | else |
1885 | MEvent.clicks = 1; |
1883 | MEvent.clicks = 1; |
1886 | |
1884 | |
1887 | selection_click (MEvent.clicks, ev.x, ev.y); |
1885 | selection_click (MEvent.clicks, ev.x, ev.y); |
1888 | } |
1886 | } |
1889 | |
1887 | |
1890 | MEvent.button = Button1; |
1888 | MEvent.button = Button1; |
1891 | break; |
1889 | break; |
1892 | |
1890 | |
1893 | case Button3: |
1891 | case Button3: |
1894 | if (MEvent.button == Button3 && clickintime) |
1892 | if (MEvent.button == Button3 && clickintime) |
1895 | selection_rotate (ev.x, ev.y); |
1893 | selection_rotate (ev.x, ev.y); |
1896 | else |
1894 | else |
1897 | selection_extend (ev.x, ev.y, 1); |
1895 | selection_extend (ev.x, ev.y, 1); |
1898 | |
1896 | |
1899 | MEvent.button = Button3; |
1897 | MEvent.button = Button3; |
1900 | break; |
1898 | break; |
1901 | } |
1899 | } |
1902 | } |
1900 | } |
1903 | |
1901 | |
1904 | MEvent.time = ev.time; |
1902 | MEvent.time = ev.time; |
1905 | return; |
1903 | return; |
1906 | } |
1904 | } |
1907 | |
1905 | |
… | |
… | |
2043 | } |
2041 | } |
2044 | |
2042 | |
2045 | break; |
2043 | break; |
2046 | } |
2044 | } |
2047 | } |
2045 | } |
|
|
2046 | |
2048 | return; |
2047 | return; |
2049 | } |
2048 | } |
2050 | #if MENUBAR |
|
|
2051 | /* |
|
|
2052 | * Menubar window processing of button press |
|
|
2053 | */ |
|
|
2054 | if (isMenuBarWindow (ev.window)) |
|
|
2055 | menubar_control (ev); |
|
|
2056 | #endif |
|
|
2057 | } |
2049 | } |
2058 | |
2050 | |
2059 | void |
2051 | void |
2060 | rxvt_term::button_release (XButtonEvent &ev) |
2052 | rxvt_term::button_release (XButtonEvent &ev) |
2061 | { |
2053 | { |
… | |
… | |
2067 | |
2059 | |
2068 | if (scrollbar_isUpDn ()) |
2060 | if (scrollbar_isUpDn ()) |
2069 | { |
2061 | { |
2070 | scrollBar.setIdle (); |
2062 | scrollBar.setIdle (); |
2071 | scrollbar_show (0); |
2063 | scrollbar_show (0); |
2072 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
2073 | refresh_type &= ~SMOOTH_REFRESH; |
|
|
2074 | #endif |
|
|
2075 | } |
2064 | } |
2076 | |
2065 | |
2077 | #ifdef SELECTION_SCROLLING |
2066 | #ifdef SELECTION_SCROLLING |
2078 | if (sel_scroll_ev.active) |
2067 | if (sel_scroll_ev.active) |
2079 | sel_scroll_ev.stop(); |
2068 | sel_scroll_ev.stop(); |
2080 | #endif |
2069 | #endif |
2081 | |
2070 | |
2082 | if (ev.window == vt) |
2071 | if (ev.window == vt) |
2083 | { |
2072 | { |
|
|
2073 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2074 | return; |
|
|
2075 | |
2084 | #if ISO_14755 |
2076 | #if ISO_14755 |
2085 | // 5.4 |
2077 | // 5.4 |
2086 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2078 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2087 | return; |
2079 | return; |
2088 | #endif |
2080 | #endif |
|
|
2081 | |
2089 | if (reportmode) |
2082 | if (reportmode) |
2090 | { |
2083 | { |
2091 | /* mouse report from vt window */ |
2084 | /* mouse report from vt window */ |
2092 | /* don't report release of wheel "buttons" */ |
2085 | /* don't report release of wheel "buttons" */ |
2093 | if (ev.button >= 4) |
2086 | if (ev.button >= 4) |
… | |
… | |
2123 | { |
2116 | { |
2124 | case Button1: |
2117 | case Button1: |
2125 | case Button3: |
2118 | case Button3: |
2126 | selection_make (ev.time); |
2119 | selection_make (ev.time); |
2127 | break; |
2120 | break; |
|
|
2121 | |
2128 | case Button2: |
2122 | case Button2: |
2129 | selection_request (ev.time, ev.x, ev.y); |
2123 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
|
|
2124 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary); |
2130 | break; |
2125 | break; |
|
|
2126 | |
2131 | #ifdef MOUSE_WHEEL |
2127 | #ifdef MOUSE_WHEEL |
2132 | case Button4: |
2128 | case Button4: |
2133 | case Button5: |
2129 | case Button5: |
2134 | { |
2130 | { |
2135 | int i; |
2131 | int i; |
… | |
… | |
2157 | slip_wheel_ev.start (); |
2153 | slip_wheel_ev.start (); |
2158 | } |
2154 | } |
2159 | else |
2155 | else |
2160 | { |
2156 | { |
2161 | # endif |
2157 | # endif |
2162 | # ifdef JUMP_MOUSE_WHEEL |
|
|
2163 | scr_page (v, i); |
2158 | scr_page (v, i); |
2164 | scr_refresh (SMOOTH_REFRESH); |
|
|
2165 | scrollbar_show (1); |
2159 | scrollbar_show (1); |
2166 | # else |
|
|
2167 | while (i--) |
|
|
2168 | { |
|
|
2169 | scr_page (v, 1); |
|
|
2170 | scr_refresh (SMOOTH_REFRESH); |
|
|
2171 | scrollbar_show (1); |
|
|
2172 | } |
|
|
2173 | # endif |
|
|
2174 | # ifdef MOUSE_SLIP_WHEELING |
2160 | # ifdef MOUSE_SLIP_WHEELING |
2175 | } |
2161 | } |
2176 | #endif |
2162 | # endif |
2177 | } |
2163 | } |
2178 | break; |
2164 | break; |
2179 | #endif |
2165 | #endif |
2180 | } |
2166 | } |
2181 | } |
2167 | } |
2182 | #ifdef MENUBAR |
|
|
2183 | else if (isMenuBarWindow (ev.window)) |
|
|
2184 | menubar_control (ev); |
|
|
2185 | #endif |
|
|
2186 | } |
2168 | } |
2187 | |
2169 | |
2188 | #ifdef TRANSPARENT |
2170 | #ifdef TRANSPARENT |
2189 | #if TINTING |
2171 | #if TINTING |
2190 | /* taken from aterm-0.4.2 */ |
2172 | /* taken from aterm-0.4.2 */ |
… | |
… | |
2627 | am_transparent = 0; |
2609 | am_transparent = 0; |
2628 | /* XXX: also turn off Opt_transparent? */ |
2610 | /* XXX: also turn off Opt_transparent? */ |
2629 | } |
2611 | } |
2630 | else |
2612 | else |
2631 | { |
2613 | { |
2632 | #if WAIT_FOR_WM |
|
|
2633 | /* wait (an arbitrary period) for the WM to do its thing |
|
|
2634 | * needed for fvwm2.2.2 (and before?) */ |
|
|
2635 | sleep (1); |
|
|
2636 | #endif |
|
|
2637 | for (n = 0; n < (unsigned int)i; n++) |
2614 | for (n = 0; n < (unsigned int)i; n++) |
2638 | { |
2615 | { |
2639 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2616 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2640 | XClearWindow (disp, parent[n]); |
2617 | XClearWindow (disp, parent[n]); |
2641 | } |
2618 | } |
… | |
… | |
2670 | |
2647 | |
2671 | bool |
2648 | bool |
2672 | rxvt_term::cmd_parse () |
2649 | rxvt_term::cmd_parse () |
2673 | { |
2650 | { |
2674 | bool flag = false; |
2651 | bool flag = false; |
2675 | unicode_t ch = NOCHAR; |
2652 | wchar_t ch = NOCHAR; |
2676 | char *seq_begin; // remember start of esc-sequence here |
2653 | char *seq_begin; // remember start of esc-sequence here |
2677 | |
2654 | |
2678 | for (;;) |
2655 | for (;;) |
2679 | { |
2656 | { |
2680 | if (ch == NOCHAR) |
2657 | if (ch == NOCHAR) |
2681 | { |
2658 | { |
2682 | seq_begin = cmdbuf_ptr; |
2659 | seq_begin = cmdbuf_ptr; |
2683 | ch = next_char (); |
2660 | ch = next_char (); |
2684 | } |
|
|
2685 | |
2661 | |
2686 | if (ch == NOCHAR) // TODO: improve |
2662 | if (ch == NOCHAR) |
2687 | break; |
2663 | break; |
|
|
2664 | } |
2688 | |
2665 | |
2689 | if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT) |
2666 | if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT) |
2690 | { |
2667 | { |
2691 | if (!seen_input) |
2668 | if (!seen_input) |
2692 | { |
2669 | { |
… | |
… | |
2701 | if (seen_resize && cmd_pid) |
2678 | if (seen_resize && cmd_pid) |
2702 | kill (-cmd_pid, SIGWINCH); |
2679 | kill (-cmd_pid, SIGWINCH); |
2703 | } |
2680 | } |
2704 | |
2681 | |
2705 | /* Read a text string from the input buffer */ |
2682 | /* Read a text string from the input buffer */ |
2706 | unicode_t buf[UBUFSIZ]; |
2683 | wchar_t buf[UBUFSIZ]; |
2707 | bool refreshnow = false; |
2684 | bool refreshnow = false; |
2708 | int nlines = 0; |
2685 | int nlines = 0; |
2709 | unicode_t *str = buf; |
2686 | wchar_t *str = buf; |
2710 | unicode_t *eol = str + min (ncol, UBUFSIZ); |
2687 | wchar_t *eol = str + min (ncol, UBUFSIZ); |
2711 | |
2688 | |
2712 | for (;;) |
2689 | for (;;) |
2713 | { |
2690 | { |
2714 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2691 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2715 | break; |
2692 | break; |
… | |
… | |
2733 | } |
2710 | } |
2734 | |
2711 | |
2735 | // scr_add_lines only works for nlines <= nrow - 1. |
2712 | // scr_add_lines only works for nlines <= nrow - 1. |
2736 | if (nlines >= nrow - 1) |
2713 | if (nlines >= nrow - 1) |
2737 | { |
2714 | { |
|
|
2715 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
|
|
2716 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2738 | scr_add_lines (buf, nlines, str - buf); |
2717 | scr_add_lines (buf, str - buf, nlines); |
|
|
2718 | |
2739 | nlines = 0; |
2719 | nlines = 0; |
2740 | str = buf; |
2720 | str = buf; |
2741 | eol = str + min (ncol, UBUFSIZ); |
2721 | eol = str + min (ncol, UBUFSIZ); |
2742 | } |
2722 | } |
2743 | |
2723 | |
… | |
… | |
2756 | |
2736 | |
2757 | seq_begin = cmdbuf_ptr; |
2737 | seq_begin = cmdbuf_ptr; |
2758 | ch = next_char (); |
2738 | ch = next_char (); |
2759 | } |
2739 | } |
2760 | |
2740 | |
|
|
2741 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
|
|
2742 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2761 | scr_add_lines (buf, nlines, str - buf); |
2743 | scr_add_lines (buf, str - buf, nlines); |
2762 | |
2744 | |
2763 | /* |
2745 | /* |
2764 | * If there have been a lot of new lines, then update the screen |
2746 | * If there have been a lot of new lines, then update the screen |
2765 | * What the heck I'll cheat and only refresh less than every page-full. |
2747 | * What the heck I'll cheat and only refresh less than every page-full. |
2766 | * the number of pages between refreshes is refresh_limit, which |
2748 | * the number of pages between refreshes is refresh_limit, which |
… | |
… | |
2771 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2753 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2772 | refresh_limit++; |
2754 | refresh_limit++; |
2773 | else |
2755 | else |
2774 | { |
2756 | { |
2775 | flag = true; |
2757 | flag = true; |
2776 | scr_refresh (refresh_type); |
2758 | scr_refresh (); |
2777 | flush_ev.stop (); |
2759 | want_refresh = 1; |
2778 | } |
2760 | } |
2779 | } |
2761 | } |
2780 | |
2762 | |
2781 | } |
2763 | } |
2782 | else |
2764 | else |
… | |
… | |
2797 | } |
2779 | } |
2798 | |
2780 | |
2799 | return flag; |
2781 | return flag; |
2800 | } |
2782 | } |
2801 | |
2783 | |
2802 | // read the next octet |
|
|
2803 | unicode_t |
|
|
2804 | rxvt_term::next_octet () |
|
|
2805 | { |
|
|
2806 | return cmdbuf_ptr < cmdbuf_endp |
|
|
2807 | ? *cmdbuf_ptr++ |
|
|
2808 | : NOCHAR; |
|
|
2809 | } |
|
|
2810 | |
|
|
2811 | // read the next character |
2784 | // read the next character |
2812 | unicode_t |
2785 | wchar_t |
2813 | rxvt_term::next_char () |
2786 | rxvt_term::next_char () NOTHROW |
2814 | { |
2787 | { |
2815 | while (cmdbuf_ptr < cmdbuf_endp) |
2788 | while (cmdbuf_ptr < cmdbuf_endp) |
2816 | { |
2789 | { |
2817 | // assume 7-bit to be ascii ALWAYS |
2790 | // assume 7-bit to be ascii ALWAYS |
2818 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2791 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
… | |
… | |
2827 | cmdbuf_ptr = cmdbuf_endp; |
2800 | cmdbuf_ptr = cmdbuf_endp; |
2828 | break; |
2801 | break; |
2829 | } |
2802 | } |
2830 | |
2803 | |
2831 | if (len == (size_t)-1) |
2804 | if (len == (size_t)-1) |
2832 | return *cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2805 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2833 | |
2806 | |
2834 | // assume wchar == unicode |
2807 | // assume wchar == unicode |
2835 | cmdbuf_ptr += len; |
2808 | cmdbuf_ptr += len; |
2836 | return wc & UNICODE_MASK; |
2809 | return wc & UNICODE_MASK; |
2837 | } |
2810 | } |
2838 | |
2811 | |
2839 | return NOCHAR; |
2812 | return NOCHAR; |
2840 | } |
2813 | } |
|
|
2814 | |
|
|
2815 | // read the next octet |
|
|
2816 | uint32_t |
|
|
2817 | rxvt_term::next_octet () NOTHROW |
|
|
2818 | { |
|
|
2819 | return cmdbuf_ptr < cmdbuf_endp |
|
|
2820 | ? (unsigned char)*cmdbuf_ptr++ |
|
|
2821 | : NOCHAR; |
|
|
2822 | } |
|
|
2823 | |
|
|
2824 | static class out_of_input out_of_input; |
2841 | |
2825 | |
2842 | /* rxvt_cmd_getc () - Return next input character */ |
2826 | /* rxvt_cmd_getc () - Return next input character */ |
2843 | /* |
2827 | /* |
2844 | * Return the next input character after first passing any keyboard input |
2828 | * Return the next input character after first passing any keyboard input |
2845 | * to the command. |
2829 | * to the command. |
2846 | */ |
2830 | */ |
2847 | unicode_t |
2831 | wchar_t |
2848 | rxvt_term::cmd_getc () |
2832 | rxvt_term::cmd_getc () THROW ((class out_of_input)) |
2849 | { |
2833 | { |
2850 | unicode_t c = next_char (); |
2834 | wchar_t c = next_char (); |
2851 | |
2835 | |
2852 | if (c == NOCHAR) |
2836 | if (c == NOCHAR) |
2853 | throw out_of_input; |
2837 | throw out_of_input; |
2854 | |
2838 | |
2855 | return c; |
2839 | return c; |
2856 | } |
2840 | } |
2857 | |
2841 | |
2858 | unicode_t |
2842 | uint32_t |
2859 | rxvt_term::cmd_get8 () |
2843 | rxvt_term::cmd_get8 () THROW ((class out_of_input)) |
2860 | { |
2844 | { |
2861 | unicode_t c = next_octet (); |
2845 | uint32_t c = next_octet (); |
2862 | |
2846 | |
2863 | if (c == NOCHAR) |
2847 | if (c == NOCHAR) |
2864 | throw out_of_input; |
2848 | throw out_of_input; |
2865 | |
2849 | |
2866 | return c; |
2850 | return c; |
… | |
… | |
3133 | break; |
3117 | break; |
3134 | |
3118 | |
3135 | /* 8.3.87: NEXT LINE */ |
3119 | /* 8.3.87: NEXT LINE */ |
3136 | case C1_NEL: /* ESC E */ |
3120 | case C1_NEL: /* ESC E */ |
3137 | { |
3121 | { |
3138 | unicode_t nlcr[] = { C0_LF, C0_CR }; |
3122 | wchar_t nlcr[] = { C0_LF, C0_CR }; |
3139 | scr_add_lines (nlcr, 1, 2); |
3123 | scr_add_lines (nlcr, sizeof (nlcr) / sizeof (nlcr [0]), 1); |
3140 | } |
3124 | } |
3141 | break; |
3125 | break; |
3142 | |
3126 | |
3143 | /* kidnapped escape sequence: Should be 8.3.48 */ |
3127 | /* kidnapped escape sequence: Should be 8.3.48 */ |
3144 | case C1_ESA: /* ESC G */ |
3128 | case C1_ESA: /* ESC G */ |
… | |
… | |
3285 | ndef = get_byte_array_bit (csi_defaults, i); |
3269 | ndef = get_byte_array_bit (csi_defaults, i); |
3286 | for (p = 0; p < nargs; p++) |
3270 | for (p = 0; p < nargs; p++) |
3287 | if (arg[p] == -1) |
3271 | if (arg[p] == -1) |
3288 | arg[p] = ndef; |
3272 | arg[p] = ndef; |
3289 | |
3273 | |
3290 | #ifdef DEBUG_CMD |
|
|
3291 | fprintf (stderr, "CSI "); |
|
|
3292 | for (p = 0; p < nargs; p++) |
|
|
3293 | fprintf (stderr, "%d%s", arg[p], p < nargs - 1 ? ";" : ""); |
|
|
3294 | fprintf (stderr, "%c\n", ch); |
|
|
3295 | #endif |
|
|
3296 | |
|
|
3297 | /* |
3274 | /* |
3298 | * private mode handling |
3275 | * private mode handling |
3299 | */ |
3276 | */ |
3300 | if (priv) |
3277 | if (priv) |
3301 | { |
3278 | { |
3302 | switch (priv) |
3279 | switch (priv) |
3303 | { |
3280 | { |
3304 | case '>': |
3281 | case '>': |
3305 | if (ch == CSI_DA) /* secondary device attributes */ |
3282 | if (ch == CSI_DA) /* secondary device attributes */ |
|
|
3283 | { |
|
|
3284 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
|
|
3285 | // 'U' for rxvt-unicode <= 7.2, and Mm85 (e.g. 7385 for 7.3) for later versions. |
|
|
3286 | // |
|
|
3287 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
|
|
3288 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
|
|
3289 | // that we do not support xterm mouse reporting (should be 95 when we do). |
|
|
3290 | // |
3306 | tt_printf ("\033[>%d;%c%c;0c", 'U', VERSION[0], VERSION[2]); |
3291 | tt_printf ("\033[>%c%c85;94;0c", VERSION[0], VERSION[1]); |
|
|
3292 | } |
3307 | break; |
3293 | break; |
3308 | case '?': |
3294 | case '?': |
3309 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3295 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3310 | process_terminal_mode (ch, priv, nargs, arg); |
3296 | process_terminal_mode (ch, priv, nargs, arg); |
3311 | break; |
3297 | break; |
… | |
… | |
3743 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3729 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3744 | */ |
3730 | */ |
3745 | void |
3731 | void |
3746 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3732 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3747 | { |
3733 | { |
3748 | int changed = 0; |
|
|
3749 | int color; |
3734 | int color; |
3750 | char *buf, *name; |
3735 | char *buf, *name; |
3751 | bool query = str[0] == '?' && !str[1]; |
3736 | bool query = str[0] == '?' && !str[1]; |
3752 | int saveop = op; |
3737 | int saveop = op; |
3753 | dDisp; |
3738 | dDisp; |
… | |
… | |
3808 | { |
3793 | { |
3809 | if ((name = strchr (buf, ';')) == NULL) |
3794 | if ((name = strchr (buf, ';')) == NULL) |
3810 | break; |
3795 | break; |
3811 | |
3796 | |
3812 | *name++ = '\0'; |
3797 | *name++ = '\0'; |
3813 | color = atoi (buf); |
3798 | color = atoi (buf) + minCOLOR; |
3814 | |
3799 | |
3815 | if (color < 0 || color >= TOTAL_COLORS) |
3800 | if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) |
3816 | break; |
3801 | break; |
3817 | |
3802 | |
3818 | if ((buf = strchr (name, ';')) != NULL) |
3803 | if ((buf = strchr (name, ';')) != NULL) |
3819 | *buf++ = '\0'; |
3804 | *buf++ = '\0'; |
3820 | |
3805 | |
3821 | if (name[0] == '?' && !name[1]) |
3806 | if (name[0] == '?' && !name[1]) |
3822 | { |
3807 | { |
3823 | unsigned short r, g, b; |
3808 | unsigned short r, g, b; |
3824 | pix_colors_focused[color + minCOLOR].get (display, r, g, b); |
3809 | pix_colors_focused[color].get (display, r, g, b); |
3825 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
3810 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
3826 | } |
3811 | } |
3827 | else |
3812 | else |
3828 | set_window_color (color + minCOLOR, name); |
3813 | set_window_color (color, name); |
3829 | } |
3814 | } |
3830 | break; |
3815 | break; |
3831 | case XTerm_Color00: |
3816 | case XTerm_Color00: |
3832 | process_color_seq (XTerm_Color00, Color_fg, str, resp); |
3817 | process_color_seq (XTerm_Color00, Color_fg, str, resp); |
3833 | break; |
3818 | break; |
3834 | case XTerm_Color01: |
3819 | case XTerm_Color01: |
3835 | process_color_seq (XTerm_Color00, Color_bg, str, resp); |
3820 | process_color_seq (XTerm_Color01, Color_bg, str, resp); |
3836 | break; |
3821 | break; |
3837 | #ifndef NO_CURSORCOLOR |
3822 | #ifndef NO_CURSORCOLOR |
3838 | case XTerm_Color_cursor: |
3823 | case XTerm_Color_cursor: |
3839 | process_color_seq (XTerm_Color_cursor, Color_cursor, str, resp); |
3824 | process_color_seq (XTerm_Color_cursor, Color_cursor, str, resp); |
3840 | break; |
3825 | break; |
… | |
… | |
3844 | break; |
3829 | break; |
3845 | case XTerm_Color_pointer_bg: |
3830 | case XTerm_Color_pointer_bg: |
3846 | process_color_seq (XTerm_Color_pointer_bg, Color_pointer_bg, str, resp); |
3831 | process_color_seq (XTerm_Color_pointer_bg, Color_pointer_bg, str, resp); |
3847 | break; |
3832 | break; |
3848 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3833 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3849 | case XTerm_Color_BD: |
|
|
3850 | process_color_seq (XTerm_Color_BD, Color_BD, str, resp); |
|
|
3851 | break; |
|
|
3852 | case XTerm_Color_UL: |
|
|
3853 | process_color_seq (XTerm_Color_UL, Color_UL, str, resp); |
|
|
3854 | break; |
|
|
3855 | case XTerm_Color_RV: |
3834 | case XTerm_Color_RV: |
3856 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
3835 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
|
|
3836 | break; |
|
|
3837 | case Rxvt_Color_BD: |
|
|
3838 | case URxvt_Color_BD: |
|
|
3839 | process_color_seq (op, Color_BD, str, resp); |
|
|
3840 | break; |
|
|
3841 | case Rxvt_Color_UL: |
|
|
3842 | case URxvt_Color_UL: |
|
|
3843 | process_color_seq (op, Color_UL, str, resp); |
3857 | break; |
3844 | break; |
3858 | case URxvt_Color_IT: |
3845 | case URxvt_Color_IT: |
3859 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
3846 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
3860 | break; |
3847 | break; |
3861 | #endif |
3848 | #endif |
… | |
… | |
3866 | if (am_transparent) |
3853 | if (am_transparent) |
3867 | want_full_refresh = want_refresh = 1; |
3854 | want_full_refresh = want_refresh = 1; |
3868 | break; |
3855 | break; |
3869 | #endif |
3856 | #endif |
3870 | |
3857 | |
3871 | case XTerm_Pixmap: |
3858 | case Rxvt_Pixmap: |
|
|
3859 | { |
3872 | if (*str != ';') |
3860 | if (*str != ';') |
3873 | { |
3861 | { |
3874 | #if XPM_BACKGROUND |
3862 | #if XPM_BACKGROUND |
3875 | scale_pixmap (""); /* reset to default scaling */ |
3863 | scale_pixmap (""); /* reset to default scaling */ |
3876 | set_bgPixmap (str); /* change pixmap */ |
3864 | set_bgPixmap (str); /* change pixmap */ |
3877 | #endif |
|
|
3878 | scr_touch (true); |
3865 | scr_touch (true); |
|
|
3866 | #endif |
3879 | } |
3867 | } |
|
|
3868 | |
|
|
3869 | int changed = 0; |
|
|
3870 | |
3880 | while ((str = strchr (str, ';')) != NULL) |
3871 | while ((str = strchr (str, ';')) != NULL) |
3881 | { |
3872 | { |
3882 | str++; |
3873 | str++; |
3883 | #if XPM_BACKGROUND |
3874 | #if XPM_BACKGROUND |
3884 | changed += scale_pixmap (str); |
3875 | changed += scale_pixmap (str); |
3885 | #endif |
3876 | #endif |
3886 | } |
3877 | } |
3887 | |
3878 | |
3888 | if (changed) |
3879 | if (changed) |
3889 | { |
3880 | { |
3890 | #ifdef XPM_BACKGROUND |
3881 | #ifdef XPM_BACKGROUND |
3891 | resize_pixmap (); |
3882 | resize_pixmap (); |
3892 | #endif |
|
|
3893 | scr_touch (true); |
3883 | scr_touch (true); |
|
|
3884 | #endif |
3894 | } |
3885 | } |
|
|
3886 | } |
3895 | break; |
3887 | break; |
3896 | |
3888 | |
3897 | case XTerm_restoreFG: |
3889 | case Rxvt_restoreFG: |
3898 | set_window_color (Color_fg, str); |
3890 | set_window_color (Color_fg, str); |
3899 | break; |
3891 | break; |
3900 | case XTerm_restoreBG: |
3892 | case Rxvt_restoreBG: |
3901 | set_window_color (Color_bg, str); |
3893 | set_window_color (Color_bg, str); |
3902 | break; |
3894 | break; |
3903 | |
3895 | |
3904 | case XTerm_logfile: |
3896 | case XTerm_logfile: |
3905 | // TODO, when secure mode? |
3897 | // TODO, when secure mode? |
3906 | break; |
3898 | break; |
3907 | |
3899 | |
3908 | #ifdef MENUBAR |
|
|
3909 | case URxvt_Menu: |
|
|
3910 | if (OPTION (Opt_insecure)) |
|
|
3911 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
|
|
3912 | break; |
|
|
3913 | #endif |
|
|
3914 | #if 0 |
3900 | #if 0 |
3915 | case XTerm_dumpscreen: /* no error notices */ |
3901 | case Rxvt_dumpscreen: /* no error notices */ |
3916 | { |
3902 | { |
3917 | int fd; |
3903 | int fd; |
3918 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3904 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3919 | { |
3905 | { |
3920 | scr_dump (fd); |
3906 | scr_dump (fd); |
… | |
… | |
3951 | if (query) |
3937 | if (query) |
3952 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); |
3938 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); |
3953 | else |
3939 | else |
3954 | { |
3940 | { |
3955 | set_locale (str); |
3941 | set_locale (str); |
3956 | pty.set_utf8_mode (enc_utf8); |
3942 | pty->set_utf8_mode (enc_utf8); |
3957 | init_xlocale (); |
3943 | init_xlocale (); |
3958 | } |
3944 | } |
3959 | break; |
3945 | break; |
3960 | |
3946 | |
3961 | case URxvt_view_up: |
3947 | case URxvt_view_up: |
… | |
… | |
3972 | break; |
3958 | break; |
3973 | #endif |
3959 | #endif |
3974 | |
3960 | |
3975 | #if ENABLE_PERL |
3961 | #if ENABLE_PERL |
3976 | case URxvt_perl: |
3962 | case URxvt_perl: |
3977 | if (PERL_INVOKE ((this, HOOK_OSC_SEQ, DT_STRING, str, DT_END))) |
3963 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_STR, str, DT_END))) |
3978 | ; // no responses yet |
3964 | ; // no responses yet |
3979 | break; |
3965 | break; |
3980 | #endif |
3966 | #endif |
3981 | } |
3967 | } |
3982 | } |
3968 | } |
… | |
… | |
4014 | return state; |
4000 | return state; |
4015 | } |
4001 | } |
4016 | |
4002 | |
4017 | /* we're not using priv _yet_ */ |
4003 | /* we're not using priv _yet_ */ |
4018 | void |
4004 | void |
4019 | rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) |
4005 | rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg) |
4020 | { |
4006 | { |
4021 | unsigned int i, j; |
4007 | unsigned int i, j; |
4022 | int state; |
4008 | int state; |
4023 | |
4009 | |
4024 | static const struct |
4010 | static const struct |
… | |
… | |
4035 | { 5, PrivMode_rVideo }, |
4021 | { 5, PrivMode_rVideo }, |
4036 | { 6, PrivMode_relOrigin }, |
4022 | { 6, PrivMode_relOrigin }, |
4037 | { 7, PrivMode_Autowrap }, |
4023 | { 7, PrivMode_Autowrap }, |
4038 | // 8, bi-directional support mode |
4024 | // 8, bi-directional support mode |
4039 | { 9, PrivMode_MouseX10 }, |
4025 | { 9, PrivMode_MouseX10 }, |
4040 | #ifdef menuBar_esc |
|
|
4041 | { menuBar_esc, PrivMode_menuBar }, |
|
|
4042 | #endif |
|
|
4043 | // 18, 19 printing-related |
4026 | // 18, 19 printing-related |
4044 | { 25, PrivMode_VisibleCursor }, |
4027 | { 25, PrivMode_VisibleCursor }, |
4045 | #ifdef scrollBar_esc |
4028 | #ifdef scrollBar_esc |
4046 | { scrollBar_esc, PrivMode_scrollBar }, |
4029 | { scrollBar_esc, PrivMode_scrollBar }, |
4047 | #endif |
4030 | #endif |
… | |
… | |
4094 | /* extra handling for values with state unkept */ |
4077 | /* extra handling for values with state unkept */ |
4095 | switch (arg[i]) |
4078 | switch (arg[i]) |
4096 | { |
4079 | { |
4097 | #if ENABLE_STYLES |
4080 | #if ENABLE_STYLES |
4098 | case 1021: |
4081 | case 1021: |
4099 | if (mode) |
4082 | set_option (Opt_intensityStyles, mode); |
4100 | SET_OPTION (Opt_intensityStyles); |
|
|
4101 | else |
|
|
4102 | CLR_OPTION (Opt_intensityStyles); |
|
|
4103 | |
4083 | |
4104 | scr_touch (true); |
4084 | scr_touch (true); |
4105 | break; |
4085 | break; |
4106 | #endif |
4086 | #endif |
4107 | case 1048: /* alternative cursor save */ |
4087 | case 1048: /* alternative cursor save */ |
… | |
… | |
4129 | case 3: /* 80/132 */ |
4109 | case 3: /* 80/132 */ |
4130 | if (priv_modes & PrivMode_132OK) |
4110 | if (priv_modes & PrivMode_132OK) |
4131 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4111 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4132 | break; |
4112 | break; |
4133 | case 4: /* smooth scrolling */ |
4113 | case 4: /* smooth scrolling */ |
4134 | if (!state) |
4114 | set_option (Opt_jumpScroll, !state); |
4135 | SET_OPTION (Opt_jumpScroll); |
|
|
4136 | else |
|
|
4137 | CLR_OPTION (Opt_jumpScroll); |
|
|
4138 | break; |
4115 | break; |
4139 | case 5: /* reverse video */ |
4116 | case 5: /* reverse video */ |
4140 | scr_rvideo_mode (state); |
4117 | scr_rvideo_mode (state); |
4141 | break; |
4118 | break; |
4142 | case 6: /* relative/absolute origins */ |
4119 | case 6: /* relative/absolute origins */ |
… | |
… | |
4148 | /* case 8: - auto repeat, can't do on a per window basis */ |
4125 | /* case 8: - auto repeat, can't do on a per window basis */ |
4149 | case 9: /* X10 mouse reporting */ |
4126 | case 9: /* X10 mouse reporting */ |
4150 | if (state) /* orthogonal */ |
4127 | if (state) /* orthogonal */ |
4151 | priv_modes &= ~PrivMode_MouseX11; |
4128 | priv_modes &= ~PrivMode_MouseX11; |
4152 | break; |
4129 | break; |
4153 | #ifdef menuBar_esc |
|
|
4154 | case menuBar_esc: |
|
|
4155 | #ifdef MENUBAR |
|
|
4156 | map_menuBar (state); |
|
|
4157 | #endif |
|
|
4158 | break; |
|
|
4159 | #endif |
|
|
4160 | #ifdef scrollBar_esc |
4130 | #ifdef scrollBar_esc |
4161 | case scrollBar_esc: |
4131 | case scrollBar_esc: |
4162 | if (scrollbar_mapping (state)) |
4132 | if (scrollbar_mapping (state)) |
4163 | { |
4133 | { |
4164 | resize_all_windows (0, 0, 0); |
4134 | resize_all_windows (0, 0, 0); |
… | |
… | |
4183 | #if 0 |
4153 | #if 0 |
4184 | case 1001: |
4154 | case 1001: |
4185 | break; /* X11 mouse highlighting */ |
4155 | break; /* X11 mouse highlighting */ |
4186 | #endif |
4156 | #endif |
4187 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4157 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4188 | if (!state) |
4158 | set_option (Opt_scrollTtyOutput, !state); |
4189 | SET_OPTION (Opt_scrollTtyOutput); |
|
|
4190 | else |
|
|
4191 | CLR_OPTION (Opt_scrollTtyOutput); |
|
|
4192 | break; |
4159 | break; |
4193 | case 1011: /* scroll to bottom on key press */ |
4160 | case 1011: /* scroll to bottom on key press */ |
4194 | if (state) |
4161 | set_option (Opt_scrollTtyKeypress, state); |
4195 | SET_OPTION (Opt_scrollTtyKeypress); |
|
|
4196 | else |
|
|
4197 | CLR_OPTION (Opt_scrollTtyKeypress); |
|
|
4198 | break; |
4162 | break; |
4199 | case 1047: /* secondary screen w/ clearing last */ |
4163 | case 1047: /* secondary screen w/ clearing last */ |
4200 | if (OPTION (Opt_secondaryScreen)) |
4164 | if (OPTION (Opt_secondaryScreen)) |
4201 | if (current_screen != PRIMARY) |
4165 | if (current_screen != PRIMARY) |
4202 | scr_erase_screen (2); |
4166 | scr_erase_screen (2); |
… | |
… | |
4340 | scr_color (Color_bg, Color_bg); |
4304 | scr_color (Color_bg, Color_bg); |
4341 | break; |
4305 | break; |
4342 | |
4306 | |
4343 | //case 50: // not variable spacing |
4307 | //case 50: // not variable spacing |
4344 | |
4308 | |
4345 | #ifndef NO_BRIGHTCOLOR |
4309 | #if ENABLE_FRILLS |
4346 | case 90: |
4310 | case 90: |
4347 | case 91: /* set bright fg color */ |
4311 | case 91: /* set bright fg color */ |
4348 | case 92: |
4312 | case 92: |
4349 | case 93: |
4313 | case 93: |
4350 | case 94: |
4314 | case 94: |
… | |
… | |
4412 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4376 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4413 | |
4377 | |
4414 | void |
4378 | void |
4415 | rxvt_term::tt_write (const char *data, unsigned int len) |
4379 | rxvt_term::tt_write (const char *data, unsigned int len) |
4416 | { |
4380 | { |
|
|
4381 | if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) |
|
|
4382 | return; |
|
|
4383 | |
|
|
4384 | if (pty->pty < 0) |
|
|
4385 | return; |
|
|
4386 | |
4417 | if (v_buflen == 0) |
4387 | if (v_buflen == 0) |
4418 | { |
4388 | { |
4419 | ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE)); |
4389 | ssize_t written = write (pty->pty, data, min (len, MAX_PTY_WRITE)); |
4420 | |
4390 | |
4421 | if ((unsigned int)written == len) |
4391 | if ((unsigned int)written == len) |
4422 | return; |
4392 | return; |
4423 | |
4393 | |
4424 | data += written; |
4394 | data += written; |
… | |
… | |
4433 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4403 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4434 | } |
4404 | } |
4435 | |
4405 | |
4436 | void rxvt_term::pty_write () |
4406 | void rxvt_term::pty_write () |
4437 | { |
4407 | { |
4438 | int written = write (pty.pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4408 | int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4439 | |
4409 | |
4440 | if (written > 0) |
4410 | if (written > 0) |
4441 | { |
4411 | { |
4442 | v_buflen -= written; |
4412 | v_buflen -= written; |
4443 | |
4413 | |