… | |
… | |
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 | { |
… | |
… | |
443 | scr_move_to (0, 1); |
440 | scr_move_to (0, 1); |
444 | return; |
441 | return; |
445 | } |
442 | } |
446 | else if (keysym == XK_End) |
443 | else if (keysym == XK_End) |
447 | { |
444 | { |
448 | scr_move_to (1, 0); |
445 | scr_move_to (1, 1); |
449 | return; |
446 | return; |
450 | } |
447 | } |
451 | } |
448 | } |
452 | #endif |
449 | #endif |
453 | } |
450 | } |
… | |
… | |
464 | { |
461 | { |
465 | switch (keysym) |
462 | switch (keysym) |
466 | { |
463 | { |
467 | /* normal XTerm key bindings */ |
464 | /* normal XTerm key bindings */ |
468 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
465 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
469 | selection_request (ev.time, 0, 0); |
466 | selection_request (ev.time); |
470 | return; |
467 | return; |
471 | #if TODO |
468 | #if TODO |
472 | /* rxvt extras */ |
469 | /* rxvt extras */ |
473 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
470 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
474 | change_font (FONT_UP); |
471 | change_font (FONT_UP); |
… | |
… | |
867 | #endif |
864 | #endif |
868 | /* nil */ ; |
865 | /* nil */ ; |
869 | } |
866 | } |
870 | } |
867 | } |
871 | |
868 | |
|
|
869 | if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, DT_STR_LEN, kbuf, len, DT_END))) |
|
|
870 | return; |
|
|
871 | |
872 | if (len <= 0) |
872 | if (len <= 0) |
873 | return; /* not mapped */ |
873 | return; /* not mapped */ |
874 | |
874 | |
875 | if (OPTION (Opt_scrollTtyKeypress)) |
875 | if (OPTION (Opt_scrollTtyKeypress)) |
876 | if (view_start) |
876 | if (view_start) |
… | |
… | |
916 | #endif /* DEBUG_CMD */ |
916 | #endif /* DEBUG_CMD */ |
917 | tt_write (kbuf, (unsigned int)len); |
917 | tt_write (kbuf, (unsigned int)len); |
918 | } |
918 | } |
919 | /*}}} */ |
919 | /*}}} */ |
920 | |
920 | |
921 | #if MENUBAR_MAX || defined (KEYSYM_RESOURCE) |
921 | #if defined (KEYSYM_RESOURCE) |
922 | /*{{{ rxvt_cmd_write (), rxvt_cmd_getc () */ |
|
|
923 | /* attempt to `write' count to the input buffer */ |
|
|
924 | unsigned int |
922 | unsigned int |
925 | rxvt_term::cmd_write (const char *str, unsigned int count) |
923 | rxvt_term::cmd_write (const char *str, unsigned int count) |
926 | { |
924 | { |
927 | unsigned int n, s; |
925 | unsigned int n, s; |
928 | |
926 | |
… | |
… | |
969 | |
967 | |
970 | if (want_refresh) |
968 | if (want_refresh) |
971 | { |
969 | { |
972 | if (SHOULD_INVOKE (HOOK_LINE_UPDATE)) |
970 | if (SHOULD_INVOKE (HOOK_LINE_UPDATE)) |
973 | { |
971 | { |
974 | int row = -view_start; |
972 | int row = view_start; |
|
|
973 | int end_row = row + nrow; |
975 | |
974 | |
976 | while (row > -nsaved && ROW (row - 1).is_longer ()) |
975 | while (row > top_row && ROW (row - 1).is_longer ()) |
977 | --row; |
976 | --row; |
978 | |
977 | |
979 | while (row < -view_start + nrow) |
978 | do |
980 | { |
979 | { |
981 | int start_row = row; |
980 | int start_row = row; |
982 | line_t *l; |
981 | line_t *l; |
983 | |
982 | |
984 | do |
983 | do |
985 | { |
984 | { |
986 | l = &ROW (row); |
985 | l = &ROW (row++); |
987 | |
986 | |
988 | if (!(l->f & LINE_FILTERED)) |
987 | if (!(l->f & LINE_FILTERED)) |
989 | { |
988 | { |
990 | // line not filtered, mark it as filtered |
989 | // line not filtered, mark it as filtered |
991 | l->f |= LINE_FILTERED; |
990 | l->f |= LINE_FILTERED; |
992 | while (l->is_longer ()) |
991 | while (l->is_longer ()) |
993 | { |
992 | { |
994 | l = &ROW (++row); |
993 | l = &ROW (row++); |
995 | l->f |= LINE_FILTERED; |
994 | l->f |= LINE_FILTERED; |
996 | } |
995 | } |
997 | |
996 | |
998 | // and filter it |
997 | // and filter it |
999 | HOOK_INVOKE ((this, HOOK_LINE_UPDATE, DT_INT, start_row, DT_END)); |
998 | HOOK_INVOKE ((this, HOOK_LINE_UPDATE, DT_INT, start_row, DT_END)); |
1000 | |
999 | |
1001 | break; |
1000 | break; |
1002 | } |
1001 | } |
1003 | } |
1002 | } |
1004 | while (l->is_longer ()); |
1003 | while (l->is_longer () && row < end_row); |
1005 | |
|
|
1006 | row++; |
|
|
1007 | } |
1004 | } |
|
|
1005 | while (row < end_row); |
1008 | |
1006 | } |
1009 | } |
|
|
1010 | |
1007 | |
1011 | scr_refresh (refresh_type); |
1008 | scr_refresh (); |
1012 | scrollbar_show (1); |
1009 | scrollbar_show (1); |
1013 | #ifdef USE_XIM |
1010 | #ifdef USE_XIM |
1014 | IMSendSpot (); |
1011 | IMSendSpot (); |
1015 | #endif |
1012 | #endif |
1016 | } |
1013 | } |
… | |
… | |
1019 | } |
1016 | } |
1020 | |
1017 | |
1021 | void |
1018 | void |
1022 | rxvt_term::check_cb (check_watcher &w) |
1019 | rxvt_term::check_cb (check_watcher &w) |
1023 | { |
1020 | { |
1024 | SET_R (this); |
1021 | make_current (); |
1025 | SET_LOCALE (locale); |
|
|
1026 | |
1022 | |
1027 | display->flush (); |
1023 | display->flush (); |
1028 | |
1024 | |
1029 | if (want_refresh && !flush_ev.active) |
1025 | if (want_refresh && !flush_ev.active) |
1030 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
1026 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
1031 | } |
1027 | } |
1032 | |
1028 | |
1033 | void |
1029 | void |
1034 | rxvt_term::flush_cb (time_watcher &w) |
1030 | rxvt_term::flush_cb (time_watcher &w) |
1035 | { |
1031 | { |
1036 | SET_R (this); |
1032 | make_current (); |
1037 | SET_LOCALE (locale); |
|
|
1038 | |
1033 | |
1039 | refresh_limit = 1; |
1034 | refresh_limit = 1; |
1040 | refresh_count = 0; |
1035 | refresh_count = 0; |
1041 | flush (); |
1036 | flush (); |
1042 | } |
1037 | } |
… | |
… | |
1046 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1041 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1047 | { |
1042 | { |
1048 | hidden_cursor = !hidden_cursor; |
1043 | hidden_cursor = !hidden_cursor; |
1049 | want_refresh = 1; |
1044 | want_refresh = 1; |
1050 | |
1045 | |
1051 | w.start (w.at + BLINK_INTERVAL); |
1046 | w.start (w.at + CURSOR_BLINK_INTERVAL); |
1052 | } |
1047 | } |
1053 | #endif |
1048 | #endif |
1054 | |
1049 | |
1055 | #ifdef TEXT_BLINK |
1050 | #ifdef TEXT_BLINK |
1056 | void |
1051 | void |
… | |
… | |
1070 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1065 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1071 | { |
1066 | { |
1072 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1067 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1073 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1068 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1074 | { |
1069 | { |
1075 | refresh_type |= SMOOTH_REFRESH; |
|
|
1076 | want_refresh = 1; |
1070 | want_refresh = 1; |
1077 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1071 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1078 | } |
1072 | } |
1079 | } |
1073 | } |
1080 | #endif |
1074 | #endif |
… | |
… | |
1084 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1078 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1085 | { |
1079 | { |
1086 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1080 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1087 | { |
1081 | { |
1088 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1082 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1089 | refresh_type |= SMOOTH_REFRESH; |
|
|
1090 | want_refresh = 1; |
1083 | want_refresh = 1; |
1091 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1084 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1092 | } |
1085 | } |
1093 | } |
1086 | } |
1094 | #endif |
1087 | #endif |
… | |
… | |
1099 | { |
1092 | { |
1100 | if (mouse_slip_wheel_speed == 0 |
1093 | if (mouse_slip_wheel_speed == 0 |
1101 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
1094 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
1102 | : scr_page (UP, mouse_slip_wheel_speed)) |
1095 | : scr_page (UP, mouse_slip_wheel_speed)) |
1103 | { |
1096 | { |
1104 | if (view_start == nsaved || |
1097 | if (view_start == top_row || view_start == 0) |
1105 | view_start == 0) |
|
|
1106 | mouse_slip_wheel_speed = 0; |
1098 | mouse_slip_wheel_speed = 0; |
1107 | |
1099 | |
1108 | refresh_type |= SMOOTH_REFRESH; |
|
|
1109 | want_refresh = 1; |
1100 | want_refresh = 1; |
1110 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1101 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1111 | } |
1102 | } |
1112 | } |
1103 | } |
1113 | #endif |
1104 | #endif |
… | |
… | |
1143 | |
1134 | |
1144 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1135 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1145 | cmdbuf_ptr = cmdbuf_base; |
1136 | cmdbuf_ptr = cmdbuf_base; |
1146 | cmdbuf_endp = cmdbuf_ptr + n; |
1137 | cmdbuf_endp = cmdbuf_ptr + n; |
1147 | |
1138 | |
1148 | ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); |
1139 | ssize_t r = read (pty->pty, cmdbuf_endp, CBUFSIZ - n); |
1149 | |
1140 | |
1150 | if (r > 0) |
1141 | if (r > 0) |
1151 | { |
1142 | { |
1152 | cmdbuf_endp += r; |
1143 | cmdbuf_endp += r; |
1153 | return true; |
1144 | return true; |
… | |
… | |
1171 | } |
1162 | } |
1172 | |
1163 | |
1173 | void |
1164 | void |
1174 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1165 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1175 | { |
1166 | { |
1176 | SET_R (this); |
1167 | make_current (); |
1177 | SET_LOCALE (locale); |
|
|
1178 | |
1168 | |
1179 | if (revents & EVENT_READ) |
1169 | if (revents & EVENT_READ) |
1180 | // loop, but don't allow a single term to monopolize us |
1170 | // loop, but don't allow a single term to monopolize us |
1181 | while (pty_fill ()) |
1171 | while (pty_fill ()) |
1182 | if (cmd_parse ()) |
1172 | if (cmd_parse ()) |
… | |
… | |
1202 | |
1192 | |
1203 | #ifdef POINTER_BLANK |
1193 | #ifdef POINTER_BLANK |
1204 | void |
1194 | void |
1205 | rxvt_term::pointer_blank () |
1195 | rxvt_term::pointer_blank () |
1206 | { |
1196 | { |
1207 | if (! OPTION (Opt_pointerBlank)) |
1197 | if (!OPTION (Opt_pointerBlank)) |
1208 | return; |
1198 | return; |
1209 | |
1199 | |
1210 | XDefineCursor (display->display, vt, display->blank_cursor); |
1200 | XDefineCursor (display->display, vt, display->blank_cursor); |
1211 | XFlush (display->display); |
1201 | XFlush (display->display); |
1212 | |
1202 | |
… | |
… | |
1214 | } |
1204 | } |
1215 | |
1205 | |
1216 | void |
1206 | void |
1217 | rxvt_term::pointer_cb (time_watcher &w) |
1207 | rxvt_term::pointer_cb (time_watcher &w) |
1218 | { |
1208 | { |
1219 | SET_R (this); |
1209 | make_current (); |
1220 | SET_LOCALE (locale); |
|
|
1221 | |
1210 | |
1222 | pointer_blank (); |
1211 | pointer_blank (); |
1223 | } |
1212 | } |
1224 | #endif |
1213 | #endif |
1225 | |
1214 | |
… | |
… | |
1304 | |
1293 | |
1305 | /*{{{ process an X event */ |
1294 | /*{{{ process an X event */ |
1306 | void |
1295 | void |
1307 | rxvt_term::x_cb (XEvent &ev) |
1296 | rxvt_term::x_cb (XEvent &ev) |
1308 | { |
1297 | { |
|
|
1298 | make_current (); |
|
|
1299 | |
1309 | dDisp; |
1300 | dDisp; |
1310 | |
1301 | |
1311 | SET_R (this); |
1302 | if (ev.xany.window == vt |
1312 | SET_LOCALE (locale); |
1303 | && SHOULD_INVOKE (HOOK_X_EVENT) |
|
|
1304 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
|
|
1305 | return; |
1313 | |
1306 | |
1314 | #if defined(CURSOR_BLINK) |
1307 | // for XQueryPointer |
1315 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
|
|
1316 | { |
|
|
1317 | if (hidden_cursor) |
|
|
1318 | { |
|
|
1319 | hidden_cursor = 0; |
|
|
1320 | want_refresh = 1; |
|
|
1321 | } |
|
|
1322 | |
|
|
1323 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
|
|
1324 | } |
|
|
1325 | #endif |
|
|
1326 | |
|
|
1327 | #if defined(POINTER_BLANK) |
|
|
1328 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
|
|
1329 | { |
|
|
1330 | if (ev.type == MotionNotify |
|
|
1331 | || ev.type == ButtonPress |
|
|
1332 | || ev.type == ButtonRelease) |
|
|
1333 | if (hidden_pointer) |
|
|
1334 | pointer_unblank (); |
|
|
1335 | |
|
|
1336 | if (ev.type == KeyPress && hidden_pointer == 0) |
|
|
1337 | pointer_blank (); |
|
|
1338 | } |
|
|
1339 | #endif |
|
|
1340 | |
|
|
1341 | Window unused_root, unused_child; |
1308 | Window unused_root, unused_child; |
1342 | int unused_root_x, unused_root_y; |
1309 | int unused_root_x, unused_root_y; |
1343 | unsigned int unused_mask; |
1310 | unsigned int unused_mask; |
1344 | |
1311 | |
1345 | switch (ev.type) |
1312 | switch (ev.type) |
… | |
… | |
1352 | |
1319 | |
1353 | break; |
1320 | break; |
1354 | |
1321 | |
1355 | case KeyRelease: |
1322 | case KeyRelease: |
1356 | { |
1323 | { |
1357 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 |
1324 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 || ENABLE_PERL |
1358 | KeySym ks; |
1325 | KeySym keysym; |
1359 | |
1326 | |
1360 | ks = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
1327 | keysym = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
1361 | #endif |
1328 | #endif |
1362 | |
1329 | |
1363 | #if ENABLE_FRILLS || ISO_14755 |
1330 | #if ENABLE_FRILLS || ISO_14755 |
1364 | // ISO 14755 support |
1331 | // ISO 14755 support |
1365 | if (iso14755buf) |
1332 | if (iso14755buf) |
… | |
… | |
1370 | # endif |
1337 | # endif |
1371 | # if ISO_14755 |
1338 | # if ISO_14755 |
1372 | // iso14755 part 5.2 handling: release time |
1339 | // iso14755 part 5.2 handling: release time |
1373 | // first: controls |
1340 | // first: controls |
1374 | if ((ev.xkey.state & ControlMask) |
1341 | if ((ev.xkey.state & ControlMask) |
1375 | && ((ks >= 0x40 && ks <= 0x5f) |
1342 | && ((keysym >= 0x40 && keysym <= 0x5f) |
1376 | || (ks >= 0x61 && ks <= 0x7f))) |
1343 | || (keysym >= 0x61 && keysym <= 0x7f))) |
1377 | { |
1344 | { |
1378 | iso14755buf = ISO_14755_51 | 0x2400 | (ks & 0x1f); |
1345 | iso14755buf = ISO_14755_51 | 0x2400 | (keysym & 0x1f); |
1379 | commit_iso14755 (); |
1346 | commit_iso14755 (); |
1380 | return; // case-break; |
1347 | goto skip_switch; |
1381 | } |
1348 | } |
1382 | |
1349 | |
1383 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
1350 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
1384 | if (i[0] == ks) |
1351 | if (i[0] == keysym) |
1385 | { |
1352 | { |
1386 | iso14755buf = ISO_14755_51 | i[1]; |
1353 | iso14755buf = ISO_14755_51 | i[1]; |
1387 | commit_iso14755 (); |
1354 | commit_iso14755 (); |
1388 | return; // case-break; |
1355 | goto skip_switch; |
1389 | } |
1356 | } |
1390 | |
1357 | |
1391 | scr_bell (); |
1358 | scr_bell (); |
1392 | # endif |
1359 | # endif |
1393 | iso14755buf = 0; |
1360 | iso14755buf = 0; |
… | |
… | |
1412 | else |
1379 | else |
1413 | iso14755buf = 0; |
1380 | iso14755buf = 0; |
1414 | } |
1381 | } |
1415 | #endif |
1382 | #endif |
1416 | |
1383 | |
|
|
1384 | if (ev.xany.window == vt |
|
|
1385 | && HOOK_INVOKE ((this, HOOK_KEY_RELEASE, DT_XEVENT, &ev, DT_INT, keysym, DT_END))) |
|
|
1386 | break; |
|
|
1387 | |
1417 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1388 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1418 | if (!(ev.xkey.state & ControlMask)) |
1389 | if (!(ev.xkey.state & ControlMask)) |
1419 | slip_wheel_ev.stop (); |
1390 | slip_wheel_ev.stop (); |
1420 | else if (ks == XK_Control_L || ks == XK_Control_R) |
1391 | else if (keysym == XK_Control_L || keysym == XK_Control_R) |
1421 | mouse_slip_wheel_speed = 0; |
1392 | mouse_slip_wheel_speed = 0; |
1422 | #endif |
1393 | #endif |
1423 | break; |
1394 | break; |
1424 | } |
1395 | } |
1425 | |
1396 | |
… | |
… | |
1431 | button_release (ev.xbutton); |
1402 | button_release (ev.xbutton); |
1432 | break; |
1403 | break; |
1433 | |
1404 | |
1434 | case ClientMessage: |
1405 | case ClientMessage: |
1435 | if (ev.xclient.format == 32 |
1406 | if (ev.xclient.format == 32 |
1436 | && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
1407 | && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END))) |
1437 | { |
1408 | { |
|
|
1409 | if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
|
|
1410 | { |
|
|
1411 | if (!HOOK_INVOKE ((this, HOOK_WM_PROTOCOLS, DT_XEVENT, &ev, DT_END))) |
|
|
1412 | { |
1438 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
1413 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
|
|
1414 | { |
|
|
1415 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) |
1439 | destroy (); |
1416 | destroy (); |
|
|
1417 | } |
1440 | #if ENABLE_EWMH |
1418 | #if ENABLE_EWMH |
1441 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1419 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1442 | XSendEvent (disp, ev.xclient.window = display->root, |
1420 | XSendEvent (disp, ev.xclient.window = display->root, |
1443 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1421 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1444 | &ev); |
1422 | &ev); |
|
|
1423 | #endif |
|
|
1424 | } |
|
|
1425 | } |
|
|
1426 | #if ENABLE_XEMBED |
|
|
1427 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1428 | { |
|
|
1429 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1430 | focus_in (); |
|
|
1431 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1432 | focus_out (); |
|
|
1433 | } |
1445 | #endif |
1434 | #endif |
1446 | } |
1435 | } |
1447 | #if ENABLE_XEMBED |
|
|
1448 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1449 | { |
|
|
1450 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1451 | focus_in (); |
|
|
1452 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1453 | focus_out (); |
|
|
1454 | } |
|
|
1455 | #endif |
|
|
1456 | #ifdef OFFIX_DND |
|
|
1457 | /* OffiX Dnd (drag 'n' drop) protocol */ |
|
|
1458 | else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL] |
|
|
1459 | && (ev.xclient.data.l[0] == DndFile |
|
|
1460 | || ev.xclient.data.l[0] == DndDir |
|
|
1461 | || ev.xclient.data.l[0] == DndLink)) |
|
|
1462 | { |
|
|
1463 | /* Get Dnd data */ |
|
|
1464 | Atom ActualType; |
|
|
1465 | int ActualFormat; |
|
|
1466 | unsigned char *data; |
|
|
1467 | unsigned long Size, RemainingBytes; |
|
|
1468 | |
|
|
1469 | XGetWindowProperty (disp, display->root, |
|
|
1470 | xa[XA_DNDSELECTION], |
|
|
1471 | 0L, 1000000L, |
|
|
1472 | False, AnyPropertyType, |
|
|
1473 | &ActualType, &ActualFormat, |
|
|
1474 | &Size, &RemainingBytes, |
|
|
1475 | &data); |
|
|
1476 | set_string_property (XA_CUT_BUFFER0, data); |
|
|
1477 | XFree (data); |
|
|
1478 | selection_paste (display->root, XA_CUT_BUFFER0, true); |
|
|
1479 | XSetInputFocus (disp, display->root, RevertToNone, CurrentTime); |
|
|
1480 | } |
|
|
1481 | #endif /* OFFIX_DND */ |
|
|
1482 | break; |
1436 | break; |
1483 | |
1437 | |
1484 | case MappingNotify: |
1438 | case MappingNotify: |
1485 | XRefreshKeyboardMapping (&ev.xmapping); |
1439 | XRefreshKeyboardMapping (&ev.xmapping); |
1486 | break; |
1440 | break; |
… | |
… | |
1528 | { |
1482 | { |
1529 | seen_resize = 1; |
1483 | seen_resize = 1; |
1530 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1484 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1531 | } |
1485 | } |
1532 | |
1486 | |
|
|
1487 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
|
|
1488 | |
1533 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1489 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1534 | if (OPTION (Opt_transparent)) |
1490 | if (OPTION (Opt_transparent)) |
1535 | check_our_parents (); |
1491 | check_our_parents (); |
1536 | #endif |
1492 | #endif |
1537 | } |
1493 | } |
1538 | break; |
1494 | break; |
1539 | |
1495 | |
1540 | case PropertyNotify: |
1496 | case PropertyNotify: |
|
|
1497 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1541 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1498 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1542 | && ev.xproperty.state == PropertyNewValue) |
1499 | && ev.xproperty.state == PropertyNewValue) |
1543 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1500 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1544 | |
1501 | |
1545 | break; |
1502 | break; |
1546 | |
1503 | |
1547 | case SelectionClear: |
1504 | case SelectionClear: |
1548 | selection_clear (); |
1505 | selection_clear (); |
… | |
… | |
1553 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1510 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1554 | break; |
1511 | break; |
1555 | |
1512 | |
1556 | case SelectionRequest: |
1513 | case SelectionRequest: |
1557 | selection_send (ev.xselectionrequest); |
1514 | selection_send (ev.xselectionrequest); |
|
|
1515 | break; |
|
|
1516 | |
|
|
1517 | case MapNotify: |
|
|
1518 | mapped = 1; |
|
|
1519 | #ifdef TEXT_BLINK |
|
|
1520 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
|
|
1521 | #endif |
|
|
1522 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1558 | break; |
1523 | break; |
1559 | |
1524 | |
1560 | case UnmapNotify: |
1525 | case UnmapNotify: |
1561 | mapped = 0; |
1526 | mapped = 0; |
1562 | #ifdef TEXT_BLINK |
1527 | #ifdef TEXT_BLINK |
1563 | text_blink_ev.stop (); |
1528 | text_blink_ev.stop (); |
1564 | #endif |
1529 | #endif |
1565 | break; |
1530 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1566 | |
|
|
1567 | case MapNotify: |
|
|
1568 | mapped = 1; |
|
|
1569 | #ifdef TEXT_BLINK |
|
|
1570 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
|
|
1571 | #endif |
|
|
1572 | break; |
1531 | break; |
1573 | |
1532 | |
1574 | #ifdef TRANSPARENT |
1533 | #ifdef TRANSPARENT |
1575 | case ReparentNotify: |
1534 | case ReparentNotify: |
1576 | rootwin_cb (ev); |
1535 | rootwin_cb (ev); |
… | |
… | |
1590 | |
1549 | |
1591 | while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)) |
1550 | while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)) |
1592 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1551 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1593 | ev.xexpose.width, ev.xexpose.height, False); |
1552 | ev.xexpose.width, ev.xexpose.height, False); |
1594 | |
1553 | |
1595 | scr_refresh (refresh_type); |
1554 | want_refresh = 1; |
1596 | } |
1555 | } |
1597 | else |
1556 | else |
1598 | { |
1557 | { |
1599 | XEvent unused_event; |
1558 | XEvent unused_event; |
1600 | |
1559 | |
… | |
… | |
1606 | if (isScrollbarWindow (ev.xany.window)) |
1565 | if (isScrollbarWindow (ev.xany.window)) |
1607 | { |
1566 | { |
1608 | scrollBar.setIdle (); |
1567 | scrollBar.setIdle (); |
1609 | scrollbar_show (0); |
1568 | scrollbar_show (0); |
1610 | } |
1569 | } |
1611 | #ifdef MENUBAR |
|
|
1612 | if (menubar_visible () && isMenuBarWindow (ev.xany.window)) |
|
|
1613 | menubar_expose (); |
|
|
1614 | #endif |
|
|
1615 | |
1570 | |
1616 | #ifdef TRANSPARENT |
1571 | #ifdef TRANSPARENT |
1617 | if (am_transparent && ev.xany.window == parent[0]) |
1572 | if (am_transparent && ev.xany.window == parent[0]) |
1618 | XClearWindow (disp, ev.xany.window); |
1573 | XClearWindow (disp, ev.xany.window); |
1619 | #endif |
1574 | #endif |
… | |
… | |
1623 | case MotionNotify: |
1578 | case MotionNotify: |
1624 | #ifdef POINTER_BLANK |
1579 | #ifdef POINTER_BLANK |
1625 | if (hidden_pointer) |
1580 | if (hidden_pointer) |
1626 | pointer_unblank (); |
1581 | pointer_unblank (); |
1627 | #endif |
1582 | #endif |
1628 | #if MENUBAR |
|
|
1629 | if (isMenuBarWindow (ev.xany.window)) |
|
|
1630 | { |
|
|
1631 | menubar_control (ev.xbutton); |
|
|
1632 | break; |
|
|
1633 | } |
|
|
1634 | #endif |
|
|
1635 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1583 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1636 | break; |
1584 | break; |
1637 | |
1585 | |
1638 | if (ev.xany.window == vt) |
1586 | if (ev.xany.window == vt) |
1639 | { |
1587 | { |
|
|
1588 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
|
|
1589 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
|
|
1590 | ; // nop |
1640 | if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1591 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1641 | { |
1592 | { |
1642 | while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) |
1593 | while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) |
1643 | ; |
1594 | ; |
1644 | |
1595 | |
1645 | XQueryPointer (disp, vt, |
1596 | XQueryPointer (disp, vt, |
… | |
… | |
1725 | &unused_root_x, &unused_root_y, |
1676 | &unused_root_x, &unused_root_y, |
1726 | &ev.xbutton.x, &ev.xbutton.y, |
1677 | &ev.xbutton.x, &ev.xbutton.y, |
1727 | &unused_mask); |
1678 | &unused_mask); |
1728 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1679 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1729 | scrollbar_size ()); |
1680 | scrollbar_size ()); |
1730 | scr_refresh (refresh_type); |
1681 | want_refresh = 1; |
1731 | refresh_limit = 0; |
1682 | refresh_limit = 0; |
1732 | scrollbar_show (1); |
1683 | scrollbar_show (1); |
1733 | } |
1684 | } |
1734 | break; |
1685 | break; |
1735 | } |
1686 | } |
|
|
1687 | |
|
|
1688 | skip_switch: ; |
|
|
1689 | |
|
|
1690 | #if defined(CURSOR_BLINK) |
|
|
1691 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
|
|
1692 | { |
|
|
1693 | if (hidden_cursor) |
|
|
1694 | { |
|
|
1695 | hidden_cursor = 0; |
|
|
1696 | want_refresh = 1; |
|
|
1697 | } |
|
|
1698 | |
|
|
1699 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
|
|
1700 | } |
|
|
1701 | #endif |
|
|
1702 | |
|
|
1703 | #if defined(POINTER_BLANK) |
|
|
1704 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
|
|
1705 | { |
|
|
1706 | if (ev.type == MotionNotify |
|
|
1707 | || ev.type == ButtonPress |
|
|
1708 | || ev.type == ButtonRelease) |
|
|
1709 | if (hidden_pointer) |
|
|
1710 | pointer_unblank (); |
|
|
1711 | |
|
|
1712 | if (ev.type == KeyPress && hidden_pointer == 0) |
|
|
1713 | pointer_blank (); |
|
|
1714 | } |
|
|
1715 | #endif |
1736 | } |
1716 | } |
1737 | |
1717 | |
1738 | void |
1718 | void |
1739 | rxvt_term::focus_in () |
1719 | rxvt_term::focus_in () |
1740 | { |
1720 | { |
… | |
… | |
1752 | XSetICFocus (Input_Context); |
1732 | XSetICFocus (Input_Context); |
1753 | } |
1733 | } |
1754 | #endif |
1734 | #endif |
1755 | #if CURSOR_BLINK |
1735 | #if CURSOR_BLINK |
1756 | if (OPTION (Opt_cursorBlink)) |
1736 | if (OPTION (Opt_cursorBlink)) |
1757 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1737 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1758 | #endif |
1738 | #endif |
1759 | #if OFF_FOCUS_FADING |
1739 | #if OFF_FOCUS_FADING |
1760 | if (rs[Rs_fade]) |
1740 | if (rs[Rs_fade]) |
1761 | { |
1741 | { |
1762 | pix_colors = pix_colors_focused; |
1742 | pix_colors = pix_colors_focused; |
… | |
… | |
1806 | |
1786 | |
1807 | #if TRANSPARENT |
1787 | #if TRANSPARENT |
1808 | void |
1788 | void |
1809 | rxvt_term::rootwin_cb (XEvent &ev) |
1789 | rxvt_term::rootwin_cb (XEvent &ev) |
1810 | { |
1790 | { |
1811 | SET_R (this); |
1791 | make_current (); |
1812 | SET_LOCALE (locale); |
|
|
1813 | |
1792 | |
1814 | switch (ev.type) |
1793 | switch (ev.type) |
1815 | { |
1794 | { |
1816 | case PropertyNotify: |
1795 | case PropertyNotify: |
1817 | /* |
1796 | /* |
… | |
… | |
1844 | /* |
1823 | /* |
1845 | * VT window processing of button press |
1824 | * VT window processing of button press |
1846 | */ |
1825 | */ |
1847 | if (ev.window == vt) |
1826 | if (ev.window == vt) |
1848 | { |
1827 | { |
|
|
1828 | if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1829 | return; |
|
|
1830 | |
1849 | #if ISO_14755 |
1831 | #if ISO_14755 |
1850 | // 5.4 |
1832 | // 5.4 |
1851 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1833 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1852 | { |
1834 | { |
1853 | iso14755_54 (ev.x, ev.y); |
1835 | iso14755_54 (ev.x, ev.y); |
… | |
… | |
1865 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1847 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1866 | if (ev.button == MEvent.button && clickintime) |
1848 | if (ev.button == MEvent.button && clickintime) |
1867 | { |
1849 | { |
1868 | /* same button, within alloted time */ |
1850 | /* same button, within alloted time */ |
1869 | MEvent.clicks++; |
1851 | MEvent.clicks++; |
|
|
1852 | |
1870 | if (MEvent.clicks > 1) |
1853 | if (MEvent.clicks > 1) |
1871 | { |
1854 | { |
1872 | /* only report double clicks */ |
1855 | /* only report double clicks */ |
1873 | MEvent.clicks = 2; |
1856 | MEvent.clicks = 2; |
1874 | mouse_report (ev); |
1857 | mouse_report (ev); |
… | |
… | |
1894 | else |
1877 | else |
1895 | { |
1878 | { |
1896 | if (ev.button != MEvent.button) |
1879 | if (ev.button != MEvent.button) |
1897 | MEvent.clicks = 0; |
1880 | MEvent.clicks = 0; |
1898 | |
1881 | |
1899 | if (!HOOK_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END))) |
|
|
1900 | switch (ev.button) |
1882 | switch (ev.button) |
1901 | { |
1883 | { |
1902 | case Button1: |
1884 | case Button1: |
1903 | /* allow meta + click to select rectangular areas */ |
1885 | /* allow meta + click to select rectangular areas */ |
1904 | /* should be done in screen.C */ |
1886 | /* should be done in screen.C */ |
1905 | #if ENABLE_FRILLS |
1887 | #if ENABLE_FRILLS |
1906 | selection.rect = !!(ev.state & ModMetaMask); |
1888 | selection.rect = !!(ev.state & ModMetaMask); |
1907 | #else |
1889 | #else |
1908 | selection.rect = false; |
1890 | selection.rect = false; |
1909 | #endif |
1891 | #endif |
1910 | |
1892 | |
1911 | /* allow shift+left click to extend selection */ |
1893 | /* allow shift+left click to extend selection */ |
1912 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1894 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1913 | { |
1895 | { |
1914 | if (MEvent.button == Button1 && clickintime) |
1896 | if (MEvent.button == Button1 && clickintime) |
1915 | selection_rotate (ev.x, ev.y); |
1897 | selection_rotate (ev.x, ev.y); |
1916 | else |
1898 | else |
1917 | selection_extend (ev.x, ev.y, 1); |
1899 | selection_extend (ev.x, ev.y, 1); |
1918 | } |
1900 | } |
1919 | else |
1901 | else |
1920 | { |
1902 | { |
1921 | if (MEvent.button == Button1 && clickintime) |
1903 | if (MEvent.button == Button1 && clickintime) |
1922 | MEvent.clicks++; |
1904 | MEvent.clicks++; |
1923 | else |
1905 | else |
1924 | MEvent.clicks = 1; |
1906 | MEvent.clicks = 1; |
1925 | |
1907 | |
1926 | selection_click (MEvent.clicks, ev.x, ev.y); |
1908 | selection_click (MEvent.clicks, ev.x, ev.y); |
1927 | } |
1909 | } |
1928 | |
1910 | |
1929 | MEvent.button = Button1; |
1911 | MEvent.button = Button1; |
1930 | break; |
1912 | break; |
1931 | |
1913 | |
1932 | case Button3: |
1914 | case Button3: |
1933 | if (MEvent.button == Button3 && clickintime) |
1915 | if (MEvent.button == Button3 && clickintime) |
1934 | selection_rotate (ev.x, ev.y); |
1916 | selection_rotate (ev.x, ev.y); |
1935 | else |
1917 | else |
1936 | selection_extend (ev.x, ev.y, 1); |
1918 | selection_extend (ev.x, ev.y, 1); |
1937 | |
1919 | |
1938 | MEvent.button = Button3; |
1920 | MEvent.button = Button3; |
1939 | break; |
1921 | break; |
1940 | } |
1922 | } |
1941 | } |
1923 | } |
1942 | |
1924 | |
1943 | MEvent.time = ev.time; |
1925 | MEvent.time = ev.time; |
1944 | return; |
1926 | return; |
1945 | } |
1927 | } |
1946 | |
1928 | |
… | |
… | |
2082 | } |
2064 | } |
2083 | |
2065 | |
2084 | break; |
2066 | break; |
2085 | } |
2067 | } |
2086 | } |
2068 | } |
|
|
2069 | |
2087 | return; |
2070 | return; |
2088 | } |
2071 | } |
2089 | #if MENUBAR |
|
|
2090 | /* |
|
|
2091 | * Menubar window processing of button press |
|
|
2092 | */ |
|
|
2093 | if (isMenuBarWindow (ev.window)) |
|
|
2094 | menubar_control (ev); |
|
|
2095 | #endif |
|
|
2096 | } |
2072 | } |
2097 | |
2073 | |
2098 | void |
2074 | void |
2099 | rxvt_term::button_release (XButtonEvent &ev) |
2075 | rxvt_term::button_release (XButtonEvent &ev) |
2100 | { |
2076 | { |
… | |
… | |
2106 | |
2082 | |
2107 | if (scrollbar_isUpDn ()) |
2083 | if (scrollbar_isUpDn ()) |
2108 | { |
2084 | { |
2109 | scrollBar.setIdle (); |
2085 | scrollBar.setIdle (); |
2110 | scrollbar_show (0); |
2086 | scrollbar_show (0); |
2111 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
2112 | refresh_type &= ~SMOOTH_REFRESH; |
|
|
2113 | #endif |
|
|
2114 | } |
2087 | } |
2115 | |
2088 | |
2116 | #ifdef SELECTION_SCROLLING |
2089 | #ifdef SELECTION_SCROLLING |
2117 | if (sel_scroll_ev.active) |
2090 | if (sel_scroll_ev.active) |
2118 | sel_scroll_ev.stop(); |
2091 | sel_scroll_ev.stop(); |
2119 | #endif |
2092 | #endif |
2120 | |
2093 | |
2121 | if (ev.window == vt) |
2094 | if (ev.window == vt) |
2122 | { |
2095 | { |
|
|
2096 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2097 | return; |
|
|
2098 | |
2123 | #if ISO_14755 |
2099 | #if ISO_14755 |
2124 | // 5.4 |
2100 | // 5.4 |
2125 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2101 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2126 | return; |
2102 | return; |
2127 | #endif |
2103 | #endif |
|
|
2104 | |
2128 | if (reportmode) |
2105 | if (reportmode) |
2129 | { |
2106 | { |
2130 | /* mouse report from vt window */ |
2107 | /* mouse report from vt window */ |
2131 | /* don't report release of wheel "buttons" */ |
2108 | /* don't report release of wheel "buttons" */ |
2132 | if (ev.button >= 4) |
2109 | if (ev.button >= 4) |
… | |
… | |
2162 | { |
2139 | { |
2163 | case Button1: |
2140 | case Button1: |
2164 | case Button3: |
2141 | case Button3: |
2165 | selection_make (ev.time); |
2142 | selection_make (ev.time); |
2166 | break; |
2143 | break; |
|
|
2144 | |
2167 | case Button2: |
2145 | case Button2: |
2168 | selection_request (ev.time, ev.x, ev.y); |
2146 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
|
|
2147 | selection_request (ev.time, ev.state & ShiftMask ? Sel_Clipboard : Sel_Primary); |
2169 | break; |
2148 | break; |
|
|
2149 | |
2170 | #ifdef MOUSE_WHEEL |
2150 | #ifdef MOUSE_WHEEL |
2171 | case Button4: |
2151 | case Button4: |
2172 | case Button5: |
2152 | case Button5: |
2173 | { |
2153 | { |
2174 | int i; |
2154 | int i; |
… | |
… | |
2196 | slip_wheel_ev.start (); |
2176 | slip_wheel_ev.start (); |
2197 | } |
2177 | } |
2198 | else |
2178 | else |
2199 | { |
2179 | { |
2200 | # endif |
2180 | # endif |
2201 | # ifdef JUMP_MOUSE_WHEEL |
|
|
2202 | scr_page (v, i); |
2181 | scr_page (v, i); |
2203 | scr_refresh (SMOOTH_REFRESH); |
|
|
2204 | scrollbar_show (1); |
2182 | scrollbar_show (1); |
2205 | # else |
|
|
2206 | while (i--) |
|
|
2207 | { |
|
|
2208 | scr_page (v, 1); |
|
|
2209 | scr_refresh (SMOOTH_REFRESH); |
|
|
2210 | scrollbar_show (1); |
|
|
2211 | } |
|
|
2212 | # endif |
|
|
2213 | # ifdef MOUSE_SLIP_WHEELING |
2183 | # ifdef MOUSE_SLIP_WHEELING |
2214 | } |
2184 | } |
2215 | #endif |
2185 | # endif |
2216 | } |
2186 | } |
2217 | break; |
2187 | break; |
2218 | #endif |
2188 | #endif |
2219 | } |
2189 | } |
2220 | } |
2190 | } |
2221 | #ifdef MENUBAR |
|
|
2222 | else if (isMenuBarWindow (ev.window)) |
|
|
2223 | menubar_control (ev); |
|
|
2224 | #endif |
|
|
2225 | } |
2191 | } |
2226 | |
2192 | |
2227 | #ifdef TRANSPARENT |
2193 | #ifdef TRANSPARENT |
2228 | #if TINTING |
2194 | #if TINTING |
2229 | /* taken from aterm-0.4.2 */ |
2195 | /* taken from aterm-0.4.2 */ |
… | |
… | |
2666 | am_transparent = 0; |
2632 | am_transparent = 0; |
2667 | /* XXX: also turn off Opt_transparent? */ |
2633 | /* XXX: also turn off Opt_transparent? */ |
2668 | } |
2634 | } |
2669 | else |
2635 | else |
2670 | { |
2636 | { |
2671 | #if WAIT_FOR_WM |
|
|
2672 | /* wait (an arbitrary period) for the WM to do its thing |
|
|
2673 | * needed for fvwm2.2.2 (and before?) */ |
|
|
2674 | sleep (1); |
|
|
2675 | #endif |
|
|
2676 | for (n = 0; n < (unsigned int)i; n++) |
2637 | for (n = 0; n < (unsigned int)i; n++) |
2677 | { |
2638 | { |
2678 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2639 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2679 | XClearWindow (disp, parent[n]); |
2640 | XClearWindow (disp, parent[n]); |
2680 | } |
2641 | } |
… | |
… | |
2709 | |
2670 | |
2710 | bool |
2671 | bool |
2711 | rxvt_term::cmd_parse () |
2672 | rxvt_term::cmd_parse () |
2712 | { |
2673 | { |
2713 | bool flag = false; |
2674 | bool flag = false; |
2714 | unicode_t ch = NOCHAR; |
2675 | wchar_t ch = NOCHAR; |
2715 | char *seq_begin; // remember start of esc-sequence here |
2676 | char *seq_begin; // remember start of esc-sequence here |
2716 | |
2677 | |
2717 | for (;;) |
2678 | for (;;) |
2718 | { |
2679 | { |
2719 | if (ch == NOCHAR) |
2680 | if (ch == NOCHAR) |
… | |
… | |
2740 | if (seen_resize && cmd_pid) |
2701 | if (seen_resize && cmd_pid) |
2741 | kill (-cmd_pid, SIGWINCH); |
2702 | kill (-cmd_pid, SIGWINCH); |
2742 | } |
2703 | } |
2743 | |
2704 | |
2744 | /* Read a text string from the input buffer */ |
2705 | /* Read a text string from the input buffer */ |
2745 | unicode_t buf[UBUFSIZ]; |
2706 | wchar_t buf[UBUFSIZ]; |
2746 | bool refreshnow = false; |
2707 | bool refreshnow = false; |
2747 | int nlines = 0; |
2708 | int nlines = 0; |
2748 | unicode_t *str = buf; |
2709 | wchar_t *str = buf; |
2749 | unicode_t *eol = str + min (ncol, UBUFSIZ); |
2710 | wchar_t *eol = str + min (ncol, UBUFSIZ); |
2750 | |
2711 | |
2751 | for (;;) |
2712 | for (;;) |
2752 | { |
2713 | { |
2753 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2714 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2754 | break; |
2715 | break; |
… | |
… | |
2772 | } |
2733 | } |
2773 | |
2734 | |
2774 | // scr_add_lines only works for nlines <= nrow - 1. |
2735 | // scr_add_lines only works for nlines <= nrow - 1. |
2775 | if (nlines >= nrow - 1) |
2736 | if (nlines >= nrow - 1) |
2776 | { |
2737 | { |
|
|
2738 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
2777 | if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_USTRING_LEN, buf, str - buf, DT_END))) |
2739 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2778 | scr_add_lines (buf, nlines, str - buf); |
2740 | scr_add_lines (buf, str - buf, nlines); |
2779 | |
2741 | |
2780 | nlines = 0; |
2742 | nlines = 0; |
2781 | str = buf; |
2743 | str = buf; |
2782 | eol = str + min (ncol, UBUFSIZ); |
2744 | eol = str + min (ncol, UBUFSIZ); |
2783 | } |
2745 | } |
… | |
… | |
2797 | |
2759 | |
2798 | seq_begin = cmdbuf_ptr; |
2760 | seq_begin = cmdbuf_ptr; |
2799 | ch = next_char (); |
2761 | ch = next_char (); |
2800 | } |
2762 | } |
2801 | |
2763 | |
|
|
2764 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
2802 | if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_USTRING_LEN, buf, str - buf, DT_END))) |
2765 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2803 | scr_add_lines (buf, nlines, str - buf); |
2766 | scr_add_lines (buf, str - buf, nlines); |
2804 | |
2767 | |
2805 | /* |
2768 | /* |
2806 | * If there have been a lot of new lines, then update the screen |
2769 | * If there have been a lot of new lines, then update the screen |
2807 | * What the heck I'll cheat and only refresh less than every page-full. |
2770 | * What the heck I'll cheat and only refresh less than every page-full. |
2808 | * the number of pages between refreshes is refresh_limit, which |
2771 | * the number of pages between refreshes is refresh_limit, which |
… | |
… | |
2813 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2776 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2814 | refresh_limit++; |
2777 | refresh_limit++; |
2815 | else |
2778 | else |
2816 | { |
2779 | { |
2817 | flag = true; |
2780 | flag = true; |
2818 | scr_refresh (refresh_type); |
2781 | scr_refresh (); |
2819 | flush_ev.stop (); |
2782 | want_refresh = 1; |
2820 | } |
2783 | } |
2821 | } |
2784 | } |
2822 | |
2785 | |
2823 | } |
2786 | } |
2824 | else |
2787 | else |
… | |
… | |
2839 | } |
2802 | } |
2840 | |
2803 | |
2841 | return flag; |
2804 | return flag; |
2842 | } |
2805 | } |
2843 | |
2806 | |
2844 | // read the next octet |
|
|
2845 | unicode_t |
|
|
2846 | rxvt_term::next_octet () |
|
|
2847 | { |
|
|
2848 | return cmdbuf_ptr < cmdbuf_endp |
|
|
2849 | ? *cmdbuf_ptr++ |
|
|
2850 | : NOCHAR; |
|
|
2851 | } |
|
|
2852 | |
|
|
2853 | // read the next character |
2807 | // read the next character |
2854 | unicode_t |
2808 | wchar_t |
2855 | rxvt_term::next_char () |
2809 | rxvt_term::next_char () NOTHROW |
2856 | { |
2810 | { |
2857 | while (cmdbuf_ptr < cmdbuf_endp) |
2811 | while (cmdbuf_ptr < cmdbuf_endp) |
2858 | { |
2812 | { |
2859 | // assume 7-bit to be ascii ALWAYS |
2813 | // assume 7-bit to be ascii ALWAYS |
2860 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2814 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
… | |
… | |
2869 | cmdbuf_ptr = cmdbuf_endp; |
2823 | cmdbuf_ptr = cmdbuf_endp; |
2870 | break; |
2824 | break; |
2871 | } |
2825 | } |
2872 | |
2826 | |
2873 | if (len == (size_t)-1) |
2827 | if (len == (size_t)-1) |
2874 | return *cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2828 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2875 | |
2829 | |
2876 | // assume wchar == unicode |
2830 | // assume wchar == unicode |
2877 | cmdbuf_ptr += len; |
2831 | cmdbuf_ptr += len; |
2878 | return wc & UNICODE_MASK; |
2832 | return wc & UNICODE_MASK; |
2879 | } |
2833 | } |
2880 | |
2834 | |
2881 | return NOCHAR; |
2835 | return NOCHAR; |
2882 | } |
2836 | } |
|
|
2837 | |
|
|
2838 | // read the next octet |
|
|
2839 | uint32_t |
|
|
2840 | rxvt_term::next_octet () NOTHROW |
|
|
2841 | { |
|
|
2842 | return cmdbuf_ptr < cmdbuf_endp |
|
|
2843 | ? (unsigned char)*cmdbuf_ptr++ |
|
|
2844 | : NOCHAR; |
|
|
2845 | } |
|
|
2846 | |
|
|
2847 | static class out_of_input out_of_input; |
2883 | |
2848 | |
2884 | /* rxvt_cmd_getc () - Return next input character */ |
2849 | /* rxvt_cmd_getc () - Return next input character */ |
2885 | /* |
2850 | /* |
2886 | * Return the next input character after first passing any keyboard input |
2851 | * Return the next input character after first passing any keyboard input |
2887 | * to the command. |
2852 | * to the command. |
2888 | */ |
2853 | */ |
2889 | unicode_t |
2854 | wchar_t |
2890 | rxvt_term::cmd_getc () |
2855 | rxvt_term::cmd_getc () THROW ((class out_of_input)) |
2891 | { |
2856 | { |
2892 | unicode_t c = next_char (); |
2857 | wchar_t c = next_char (); |
2893 | |
2858 | |
2894 | if (c == NOCHAR) |
2859 | if (c == NOCHAR) |
2895 | throw out_of_input; |
2860 | throw out_of_input; |
2896 | |
2861 | |
2897 | return c; |
2862 | return c; |
2898 | } |
2863 | } |
2899 | |
2864 | |
2900 | unicode_t |
2865 | uint32_t |
2901 | rxvt_term::cmd_get8 () |
2866 | rxvt_term::cmd_get8 () THROW ((class out_of_input)) |
2902 | { |
2867 | { |
2903 | unicode_t c = next_octet (); |
2868 | uint32_t c = next_octet (); |
2904 | |
2869 | |
2905 | if (c == NOCHAR) |
2870 | if (c == NOCHAR) |
2906 | throw out_of_input; |
2871 | throw out_of_input; |
2907 | |
2872 | |
2908 | return c; |
2873 | return c; |
… | |
… | |
3175 | break; |
3140 | break; |
3176 | |
3141 | |
3177 | /* 8.3.87: NEXT LINE */ |
3142 | /* 8.3.87: NEXT LINE */ |
3178 | case C1_NEL: /* ESC E */ |
3143 | case C1_NEL: /* ESC E */ |
3179 | { |
3144 | { |
3180 | unicode_t nlcr[] = { C0_LF, C0_CR }; |
3145 | wchar_t nlcr[] = { C0_LF, C0_CR }; |
3181 | scr_add_lines (nlcr, 1, 2); |
3146 | scr_add_lines (nlcr, sizeof (nlcr) / sizeof (nlcr [0]), 1); |
3182 | } |
3147 | } |
3183 | break; |
3148 | break; |
3184 | |
3149 | |
3185 | /* kidnapped escape sequence: Should be 8.3.48 */ |
3150 | /* kidnapped escape sequence: Should be 8.3.48 */ |
3186 | case C1_ESA: /* ESC G */ |
3151 | case C1_ESA: /* ESC G */ |
… | |
… | |
3785 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3750 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3786 | */ |
3751 | */ |
3787 | void |
3752 | void |
3788 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3753 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3789 | { |
3754 | { |
3790 | int changed = 0; |
|
|
3791 | int color; |
3755 | int color; |
3792 | char *buf, *name; |
3756 | char *buf, *name; |
3793 | bool query = str[0] == '?' && !str[1]; |
3757 | bool query = str[0] == '?' && !str[1]; |
3794 | int saveop = op; |
3758 | int saveop = op; |
3795 | dDisp; |
3759 | dDisp; |
… | |
… | |
3850 | { |
3814 | { |
3851 | if ((name = strchr (buf, ';')) == NULL) |
3815 | if ((name = strchr (buf, ';')) == NULL) |
3852 | break; |
3816 | break; |
3853 | |
3817 | |
3854 | *name++ = '\0'; |
3818 | *name++ = '\0'; |
3855 | color = atoi (buf); |
3819 | color = atoi (buf) + minCOLOR; |
3856 | |
3820 | |
3857 | if (color < 0 || color >= TOTAL_COLORS) |
3821 | if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) |
3858 | break; |
3822 | break; |
3859 | |
3823 | |
3860 | if ((buf = strchr (name, ';')) != NULL) |
3824 | if ((buf = strchr (name, ';')) != NULL) |
3861 | *buf++ = '\0'; |
3825 | *buf++ = '\0'; |
3862 | |
3826 | |
3863 | if (name[0] == '?' && !name[1]) |
3827 | if (name[0] == '?' && !name[1]) |
3864 | { |
3828 | { |
3865 | unsigned short r, g, b; |
3829 | unsigned short r, g, b; |
3866 | pix_colors_focused[color + minCOLOR].get (display, r, g, b); |
3830 | pix_colors_focused[color].get (display, r, g, b); |
3867 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
3831 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
3868 | } |
3832 | } |
3869 | else |
3833 | else |
3870 | set_window_color (color + minCOLOR, name); |
3834 | set_window_color (color, name); |
3871 | } |
3835 | } |
3872 | break; |
3836 | break; |
3873 | case XTerm_Color00: |
3837 | case XTerm_Color00: |
3874 | process_color_seq (XTerm_Color00, Color_fg, str, resp); |
3838 | process_color_seq (XTerm_Color00, Color_fg, str, resp); |
3875 | break; |
3839 | break; |
3876 | case XTerm_Color01: |
3840 | case XTerm_Color01: |
3877 | process_color_seq (XTerm_Color00, Color_bg, str, resp); |
3841 | process_color_seq (XTerm_Color01, Color_bg, str, resp); |
3878 | break; |
3842 | break; |
3879 | #ifndef NO_CURSORCOLOR |
3843 | #ifndef NO_CURSORCOLOR |
3880 | case XTerm_Color_cursor: |
3844 | case XTerm_Color_cursor: |
3881 | process_color_seq (XTerm_Color_cursor, Color_cursor, str, resp); |
3845 | process_color_seq (XTerm_Color_cursor, Color_cursor, str, resp); |
3882 | break; |
3846 | break; |
… | |
… | |
3886 | break; |
3850 | break; |
3887 | case XTerm_Color_pointer_bg: |
3851 | case XTerm_Color_pointer_bg: |
3888 | process_color_seq (XTerm_Color_pointer_bg, Color_pointer_bg, str, resp); |
3852 | process_color_seq (XTerm_Color_pointer_bg, Color_pointer_bg, str, resp); |
3889 | break; |
3853 | break; |
3890 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3854 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3891 | case XTerm_Color_BD: |
|
|
3892 | process_color_seq (XTerm_Color_BD, Color_BD, str, resp); |
|
|
3893 | break; |
|
|
3894 | case XTerm_Color_UL: |
|
|
3895 | process_color_seq (XTerm_Color_UL, Color_UL, str, resp); |
|
|
3896 | break; |
|
|
3897 | case XTerm_Color_RV: |
3855 | case XTerm_Color_RV: |
3898 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
3856 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
|
|
3857 | break; |
|
|
3858 | case Rxvt_Color_BD: |
|
|
3859 | case URxvt_Color_BD: |
|
|
3860 | process_color_seq (op, Color_BD, str, resp); |
|
|
3861 | break; |
|
|
3862 | case Rxvt_Color_UL: |
|
|
3863 | case URxvt_Color_UL: |
|
|
3864 | process_color_seq (op, Color_UL, str, resp); |
3899 | break; |
3865 | break; |
3900 | case URxvt_Color_IT: |
3866 | case URxvt_Color_IT: |
3901 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
3867 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
3902 | break; |
3868 | break; |
3903 | #endif |
3869 | #endif |
… | |
… | |
3908 | if (am_transparent) |
3874 | if (am_transparent) |
3909 | want_full_refresh = want_refresh = 1; |
3875 | want_full_refresh = want_refresh = 1; |
3910 | break; |
3876 | break; |
3911 | #endif |
3877 | #endif |
3912 | |
3878 | |
3913 | case XTerm_Pixmap: |
3879 | case Rxvt_Pixmap: |
|
|
3880 | { |
3914 | if (*str != ';') |
3881 | if (*str != ';') |
3915 | { |
3882 | { |
3916 | #if XPM_BACKGROUND |
3883 | #if XPM_BACKGROUND |
3917 | scale_pixmap (""); /* reset to default scaling */ |
3884 | scale_pixmap (""); /* reset to default scaling */ |
3918 | set_bgPixmap (str); /* change pixmap */ |
3885 | set_bgPixmap (str); /* change pixmap */ |
3919 | #endif |
|
|
3920 | scr_touch (true); |
3886 | scr_touch (true); |
|
|
3887 | #endif |
3921 | } |
3888 | } |
|
|
3889 | |
|
|
3890 | int changed = 0; |
|
|
3891 | |
3922 | while ((str = strchr (str, ';')) != NULL) |
3892 | while ((str = strchr (str, ';')) != NULL) |
3923 | { |
3893 | { |
3924 | str++; |
3894 | str++; |
3925 | #if XPM_BACKGROUND |
3895 | #if XPM_BACKGROUND |
3926 | changed += scale_pixmap (str); |
3896 | changed += scale_pixmap (str); |
3927 | #endif |
3897 | #endif |
3928 | } |
3898 | } |
3929 | |
3899 | |
3930 | if (changed) |
3900 | if (changed) |
3931 | { |
3901 | { |
3932 | #ifdef XPM_BACKGROUND |
3902 | #ifdef XPM_BACKGROUND |
3933 | resize_pixmap (); |
3903 | resize_pixmap (); |
3934 | #endif |
|
|
3935 | scr_touch (true); |
3904 | scr_touch (true); |
|
|
3905 | #endif |
3936 | } |
3906 | } |
|
|
3907 | } |
3937 | break; |
3908 | break; |
3938 | |
3909 | |
3939 | case XTerm_restoreFG: |
3910 | case Rxvt_restoreFG: |
3940 | set_window_color (Color_fg, str); |
3911 | set_window_color (Color_fg, str); |
3941 | break; |
3912 | break; |
3942 | case XTerm_restoreBG: |
3913 | case Rxvt_restoreBG: |
3943 | set_window_color (Color_bg, str); |
3914 | set_window_color (Color_bg, str); |
3944 | break; |
3915 | break; |
3945 | |
3916 | |
3946 | case XTerm_logfile: |
3917 | case XTerm_logfile: |
3947 | // TODO, when secure mode? |
3918 | // TODO, when secure mode? |
3948 | break; |
3919 | break; |
3949 | |
3920 | |
3950 | #ifdef MENUBAR |
|
|
3951 | case URxvt_Menu: |
|
|
3952 | if (OPTION (Opt_insecure)) |
|
|
3953 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
|
|
3954 | break; |
|
|
3955 | #endif |
|
|
3956 | #if 0 |
3921 | #if 0 |
3957 | case XTerm_dumpscreen: /* no error notices */ |
3922 | case Rxvt_dumpscreen: /* no error notices */ |
3958 | { |
3923 | { |
3959 | int fd; |
3924 | int fd; |
3960 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3925 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3961 | { |
3926 | { |
3962 | scr_dump (fd); |
3927 | scr_dump (fd); |
… | |
… | |
3993 | if (query) |
3958 | if (query) |
3994 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); |
3959 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); |
3995 | else |
3960 | else |
3996 | { |
3961 | { |
3997 | set_locale (str); |
3962 | set_locale (str); |
3998 | pty.set_utf8_mode (enc_utf8); |
3963 | pty->set_utf8_mode (enc_utf8); |
3999 | init_xlocale (); |
3964 | init_xlocale (); |
4000 | } |
3965 | } |
4001 | break; |
3966 | break; |
4002 | |
3967 | |
4003 | case URxvt_view_up: |
3968 | case URxvt_view_up: |
… | |
… | |
4014 | break; |
3979 | break; |
4015 | #endif |
3980 | #endif |
4016 | |
3981 | |
4017 | #if ENABLE_PERL |
3982 | #if ENABLE_PERL |
4018 | case URxvt_perl: |
3983 | case URxvt_perl: |
4019 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_STRING, str, DT_END))) |
3984 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_STR, str, DT_END))) |
4020 | ; // no responses yet |
3985 | ; // no responses yet |
4021 | break; |
3986 | break; |
4022 | #endif |
3987 | #endif |
4023 | } |
3988 | } |
4024 | } |
3989 | } |
… | |
… | |
4056 | return state; |
4021 | return state; |
4057 | } |
4022 | } |
4058 | |
4023 | |
4059 | /* we're not using priv _yet_ */ |
4024 | /* we're not using priv _yet_ */ |
4060 | void |
4025 | void |
4061 | rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) |
4026 | rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg) |
4062 | { |
4027 | { |
4063 | unsigned int i, j; |
4028 | unsigned int i, j; |
4064 | int state; |
4029 | int state; |
4065 | |
4030 | |
4066 | static const struct |
4031 | static const struct |
… | |
… | |
4077 | { 5, PrivMode_rVideo }, |
4042 | { 5, PrivMode_rVideo }, |
4078 | { 6, PrivMode_relOrigin }, |
4043 | { 6, PrivMode_relOrigin }, |
4079 | { 7, PrivMode_Autowrap }, |
4044 | { 7, PrivMode_Autowrap }, |
4080 | // 8, bi-directional support mode |
4045 | // 8, bi-directional support mode |
4081 | { 9, PrivMode_MouseX10 }, |
4046 | { 9, PrivMode_MouseX10 }, |
4082 | #ifdef menuBar_esc |
|
|
4083 | { menuBar_esc, PrivMode_menuBar }, |
|
|
4084 | #endif |
|
|
4085 | // 18, 19 printing-related |
4047 | // 18, 19 printing-related |
4086 | { 25, PrivMode_VisibleCursor }, |
4048 | { 25, PrivMode_VisibleCursor }, |
4087 | #ifdef scrollBar_esc |
4049 | #ifdef scrollBar_esc |
4088 | { scrollBar_esc, PrivMode_scrollBar }, |
4050 | { scrollBar_esc, PrivMode_scrollBar }, |
4089 | #endif |
4051 | #endif |
… | |
… | |
4136 | /* extra handling for values with state unkept */ |
4098 | /* extra handling for values with state unkept */ |
4137 | switch (arg[i]) |
4099 | switch (arg[i]) |
4138 | { |
4100 | { |
4139 | #if ENABLE_STYLES |
4101 | #if ENABLE_STYLES |
4140 | case 1021: |
4102 | case 1021: |
4141 | if (mode) |
4103 | set_option (Opt_intensityStyles, mode); |
4142 | SET_OPTION (Opt_intensityStyles); |
|
|
4143 | else |
|
|
4144 | CLR_OPTION (Opt_intensityStyles); |
|
|
4145 | |
4104 | |
4146 | scr_touch (true); |
4105 | scr_touch (true); |
4147 | break; |
4106 | break; |
4148 | #endif |
4107 | #endif |
4149 | case 1048: /* alternative cursor save */ |
4108 | case 1048: /* alternative cursor save */ |
… | |
… | |
4171 | case 3: /* 80/132 */ |
4130 | case 3: /* 80/132 */ |
4172 | if (priv_modes & PrivMode_132OK) |
4131 | if (priv_modes & PrivMode_132OK) |
4173 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4132 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4174 | break; |
4133 | break; |
4175 | case 4: /* smooth scrolling */ |
4134 | case 4: /* smooth scrolling */ |
4176 | if (!state) |
4135 | set_option (Opt_jumpScroll, !state); |
4177 | SET_OPTION (Opt_jumpScroll); |
|
|
4178 | else |
|
|
4179 | CLR_OPTION (Opt_jumpScroll); |
|
|
4180 | break; |
4136 | break; |
4181 | case 5: /* reverse video */ |
4137 | case 5: /* reverse video */ |
4182 | scr_rvideo_mode (state); |
4138 | scr_rvideo_mode (state); |
4183 | break; |
4139 | break; |
4184 | case 6: /* relative/absolute origins */ |
4140 | case 6: /* relative/absolute origins */ |
… | |
… | |
4190 | /* case 8: - auto repeat, can't do on a per window basis */ |
4146 | /* case 8: - auto repeat, can't do on a per window basis */ |
4191 | case 9: /* X10 mouse reporting */ |
4147 | case 9: /* X10 mouse reporting */ |
4192 | if (state) /* orthogonal */ |
4148 | if (state) /* orthogonal */ |
4193 | priv_modes &= ~PrivMode_MouseX11; |
4149 | priv_modes &= ~PrivMode_MouseX11; |
4194 | break; |
4150 | break; |
4195 | #ifdef menuBar_esc |
|
|
4196 | case menuBar_esc: |
|
|
4197 | #ifdef MENUBAR |
|
|
4198 | map_menuBar (state); |
|
|
4199 | #endif |
|
|
4200 | break; |
|
|
4201 | #endif |
|
|
4202 | #ifdef scrollBar_esc |
4151 | #ifdef scrollBar_esc |
4203 | case scrollBar_esc: |
4152 | case scrollBar_esc: |
4204 | if (scrollbar_mapping (state)) |
4153 | if (scrollbar_mapping (state)) |
4205 | { |
4154 | { |
4206 | resize_all_windows (0, 0, 0); |
4155 | resize_all_windows (0, 0, 0); |
… | |
… | |
4225 | #if 0 |
4174 | #if 0 |
4226 | case 1001: |
4175 | case 1001: |
4227 | break; /* X11 mouse highlighting */ |
4176 | break; /* X11 mouse highlighting */ |
4228 | #endif |
4177 | #endif |
4229 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4178 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4230 | if (!state) |
4179 | set_option (Opt_scrollTtyOutput, !state); |
4231 | SET_OPTION (Opt_scrollTtyOutput); |
|
|
4232 | else |
|
|
4233 | CLR_OPTION (Opt_scrollTtyOutput); |
|
|
4234 | break; |
4180 | break; |
4235 | case 1011: /* scroll to bottom on key press */ |
4181 | case 1011: /* scroll to bottom on key press */ |
4236 | if (state) |
4182 | set_option (Opt_scrollTtyKeypress, state); |
4237 | SET_OPTION (Opt_scrollTtyKeypress); |
|
|
4238 | else |
|
|
4239 | CLR_OPTION (Opt_scrollTtyKeypress); |
|
|
4240 | break; |
4183 | break; |
4241 | case 1047: /* secondary screen w/ clearing last */ |
4184 | case 1047: /* secondary screen w/ clearing last */ |
4242 | if (OPTION (Opt_secondaryScreen)) |
4185 | if (OPTION (Opt_secondaryScreen)) |
4243 | if (current_screen != PRIMARY) |
4186 | if (current_screen != PRIMARY) |
4244 | scr_erase_screen (2); |
4187 | scr_erase_screen (2); |
… | |
… | |
4454 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4397 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4455 | |
4398 | |
4456 | void |
4399 | void |
4457 | rxvt_term::tt_write (const char *data, unsigned int len) |
4400 | rxvt_term::tt_write (const char *data, unsigned int len) |
4458 | { |
4401 | { |
4459 | if (pty.pty < 0) |
4402 | if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) |
4460 | return; |
4403 | return; |
4461 | |
4404 | |
|
|
4405 | if (pty->pty < 0) |
|
|
4406 | return; |
|
|
4407 | |
4462 | if (v_buflen == 0) |
4408 | if (v_buflen == 0) |
4463 | { |
4409 | { |
4464 | ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE)); |
4410 | ssize_t written = write (pty->pty, data, min (len, MAX_PTY_WRITE)); |
4465 | |
4411 | |
4466 | if ((unsigned int)written == len) |
4412 | if ((unsigned int)written == len) |
4467 | return; |
4413 | return; |
4468 | |
4414 | |
4469 | data += written; |
4415 | data += written; |
… | |
… | |
4478 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4424 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4479 | } |
4425 | } |
4480 | |
4426 | |
4481 | void rxvt_term::pty_write () |
4427 | void rxvt_term::pty_write () |
4482 | { |
4428 | { |
4483 | int written = write (pty.pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4429 | int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4484 | |
4430 | |
4485 | if (written > 0) |
4431 | if (written > 0) |
4486 | { |
4432 | { |
4487 | v_buflen -= written; |
4433 | v_buflen -= written; |
4488 | |
4434 | |