… | |
… | |
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 | |
… | |
… | |
967 | } |
965 | } |
968 | #endif |
966 | #endif |
969 | |
967 | |
970 | if (want_refresh) |
968 | if (want_refresh) |
971 | { |
969 | { |
|
|
970 | if (SHOULD_INVOKE (HOOK_LINE_UPDATE)) |
|
|
971 | { |
|
|
972 | int row = view_start; |
|
|
973 | int end_row = row + nrow; |
|
|
974 | |
|
|
975 | while (row > top_row && ROW (row - 1).is_longer ()) |
|
|
976 | --row; |
|
|
977 | |
|
|
978 | do |
|
|
979 | { |
|
|
980 | int start_row = row; |
|
|
981 | line_t *l; |
|
|
982 | |
|
|
983 | do |
|
|
984 | { |
|
|
985 | l = &ROW (row++); |
|
|
986 | |
|
|
987 | if (!(l->f & LINE_FILTERED)) |
|
|
988 | { |
|
|
989 | // line not filtered, mark it as filtered |
|
|
990 | l->f |= LINE_FILTERED; |
|
|
991 | while (l->is_longer ()) |
|
|
992 | { |
|
|
993 | l = &ROW (row++); |
|
|
994 | l->f |= LINE_FILTERED; |
|
|
995 | } |
|
|
996 | |
|
|
997 | // and filter it |
|
|
998 | HOOK_INVOKE ((this, HOOK_LINE_UPDATE, DT_INT, start_row, DT_END)); |
|
|
999 | |
|
|
1000 | break; |
|
|
1001 | } |
|
|
1002 | } |
|
|
1003 | while (l->is_longer () && row < end_row); |
|
|
1004 | } |
|
|
1005 | while (row < end_row); |
|
|
1006 | } |
|
|
1007 | |
972 | scr_refresh (refresh_type); |
1008 | scr_refresh (); |
973 | scrollbar_show (1); |
1009 | scrollbar_show (1); |
974 | #ifdef USE_XIM |
1010 | #ifdef USE_XIM |
975 | IMSendSpot (); |
1011 | IMSendSpot (); |
976 | #endif |
1012 | #endif |
977 | } |
1013 | } |
… | |
… | |
980 | } |
1016 | } |
981 | |
1017 | |
982 | void |
1018 | void |
983 | rxvt_term::check_cb (check_watcher &w) |
1019 | rxvt_term::check_cb (check_watcher &w) |
984 | { |
1020 | { |
985 | SET_R (this); |
1021 | make_current (); |
986 | SET_LOCALE (locale); |
|
|
987 | |
1022 | |
988 | display->flush (); |
1023 | display->flush (); |
989 | |
1024 | |
990 | if (want_refresh && !flush_ev.active) |
1025 | if (want_refresh && !flush_ev.active) |
991 | 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 |
992 | } |
1027 | } |
993 | |
1028 | |
994 | void |
1029 | void |
995 | rxvt_term::flush_cb (time_watcher &w) |
1030 | rxvt_term::flush_cb (time_watcher &w) |
996 | { |
1031 | { |
997 | SET_R (this); |
1032 | make_current (); |
998 | SET_LOCALE (locale); |
|
|
999 | |
1033 | |
1000 | refresh_limit = 1; |
1034 | refresh_limit = 1; |
1001 | refresh_count = 0; |
1035 | refresh_count = 0; |
1002 | flush (); |
1036 | flush (); |
1003 | } |
1037 | } |
… | |
… | |
1007 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1041 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1008 | { |
1042 | { |
1009 | hidden_cursor = !hidden_cursor; |
1043 | hidden_cursor = !hidden_cursor; |
1010 | want_refresh = 1; |
1044 | want_refresh = 1; |
1011 | |
1045 | |
1012 | w.start (w.at + BLINK_INTERVAL); |
1046 | w.start (w.at + CURSOR_BLINK_INTERVAL); |
1013 | } |
1047 | } |
1014 | #endif |
1048 | #endif |
1015 | |
1049 | |
1016 | #ifdef TEXT_BLINK |
1050 | #ifdef TEXT_BLINK |
1017 | void |
1051 | void |
… | |
… | |
1031 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1065 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1032 | { |
1066 | { |
1033 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1067 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1034 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1068 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1035 | { |
1069 | { |
1036 | refresh_type |= SMOOTH_REFRESH; |
|
|
1037 | want_refresh = 1; |
1070 | want_refresh = 1; |
1038 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1071 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1039 | } |
1072 | } |
1040 | } |
1073 | } |
1041 | #endif |
1074 | #endif |
… | |
… | |
1045 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1078 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1046 | { |
1079 | { |
1047 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1080 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1048 | { |
1081 | { |
1049 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1082 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1050 | refresh_type |= SMOOTH_REFRESH; |
|
|
1051 | want_refresh = 1; |
1083 | want_refresh = 1; |
1052 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1084 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1053 | } |
1085 | } |
1054 | } |
1086 | } |
1055 | #endif |
1087 | #endif |
… | |
… | |
1060 | { |
1092 | { |
1061 | if (mouse_slip_wheel_speed == 0 |
1093 | if (mouse_slip_wheel_speed == 0 |
1062 | || 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) |
1063 | : scr_page (UP, mouse_slip_wheel_speed)) |
1095 | : scr_page (UP, mouse_slip_wheel_speed)) |
1064 | { |
1096 | { |
1065 | if (view_start == nsaved || |
1097 | if (view_start == top_row || view_start == 0) |
1066 | view_start == 0) |
|
|
1067 | mouse_slip_wheel_speed = 0; |
1098 | mouse_slip_wheel_speed = 0; |
1068 | |
1099 | |
1069 | refresh_type |= SMOOTH_REFRESH; |
|
|
1070 | want_refresh = 1; |
1100 | want_refresh = 1; |
1071 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1101 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1072 | } |
1102 | } |
1073 | } |
1103 | } |
1074 | #endif |
1104 | #endif |
… | |
… | |
1104 | |
1134 | |
1105 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1135 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1106 | cmdbuf_ptr = cmdbuf_base; |
1136 | cmdbuf_ptr = cmdbuf_base; |
1107 | cmdbuf_endp = cmdbuf_ptr + n; |
1137 | cmdbuf_endp = cmdbuf_ptr + n; |
1108 | |
1138 | |
1109 | ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); |
1139 | ssize_t r = read (pty->pty, cmdbuf_endp, CBUFSIZ - n); |
1110 | |
1140 | |
1111 | if (r > 0) |
1141 | if (r > 0) |
1112 | { |
1142 | { |
1113 | cmdbuf_endp += r; |
1143 | cmdbuf_endp += r; |
1114 | return true; |
1144 | return true; |
… | |
… | |
1132 | } |
1162 | } |
1133 | |
1163 | |
1134 | void |
1164 | void |
1135 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1165 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1136 | { |
1166 | { |
1137 | SET_R (this); |
1167 | make_current (); |
1138 | SET_LOCALE (locale); |
|
|
1139 | |
1168 | |
1140 | if (revents & EVENT_READ) |
1169 | if (revents & EVENT_READ) |
1141 | // loop, but don't allow a single term to monopolize us |
1170 | // loop, but don't allow a single term to monopolize us |
1142 | while (pty_fill ()) |
1171 | while (pty_fill ()) |
1143 | if (cmd_parse ()) |
1172 | if (cmd_parse ()) |
… | |
… | |
1163 | |
1192 | |
1164 | #ifdef POINTER_BLANK |
1193 | #ifdef POINTER_BLANK |
1165 | void |
1194 | void |
1166 | rxvt_term::pointer_blank () |
1195 | rxvt_term::pointer_blank () |
1167 | { |
1196 | { |
1168 | if (! OPTION (Opt_pointerBlank)) |
1197 | if (!OPTION (Opt_pointerBlank)) |
1169 | return; |
1198 | return; |
1170 | |
1199 | |
1171 | XDefineCursor (display->display, vt, display->blank_cursor); |
1200 | XDefineCursor (display->display, vt, display->blank_cursor); |
1172 | XFlush (display->display); |
1201 | XFlush (display->display); |
1173 | |
1202 | |
… | |
… | |
1175 | } |
1204 | } |
1176 | |
1205 | |
1177 | void |
1206 | void |
1178 | rxvt_term::pointer_cb (time_watcher &w) |
1207 | rxvt_term::pointer_cb (time_watcher &w) |
1179 | { |
1208 | { |
1180 | SET_R (this); |
1209 | make_current (); |
1181 | SET_LOCALE (locale); |
|
|
1182 | |
1210 | |
1183 | pointer_blank (); |
1211 | pointer_blank (); |
1184 | } |
1212 | } |
1185 | #endif |
1213 | #endif |
1186 | |
1214 | |
… | |
… | |
1265 | |
1293 | |
1266 | /*{{{ process an X event */ |
1294 | /*{{{ process an X event */ |
1267 | void |
1295 | void |
1268 | rxvt_term::x_cb (XEvent &ev) |
1296 | rxvt_term::x_cb (XEvent &ev) |
1269 | { |
1297 | { |
|
|
1298 | make_current (); |
|
|
1299 | |
1270 | dDisp; |
1300 | dDisp; |
1271 | |
1301 | |
1272 | SET_R (this); |
1302 | if (ev.xany.window == vt |
1273 | SET_LOCALE (locale); |
1303 | && SHOULD_INVOKE (HOOK_X_EVENT) |
|
|
1304 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
|
|
1305 | return; |
1274 | |
1306 | |
1275 | #if defined(CURSOR_BLINK) |
1307 | // 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; |
1308 | Window unused_root, unused_child; |
1303 | int unused_root_x, unused_root_y; |
1309 | int unused_root_x, unused_root_y; |
1304 | unsigned int unused_mask; |
1310 | unsigned int unused_mask; |
1305 | |
1311 | |
1306 | switch (ev.type) |
1312 | switch (ev.type) |
… | |
… | |
1313 | |
1319 | |
1314 | break; |
1320 | break; |
1315 | |
1321 | |
1316 | case KeyRelease: |
1322 | case KeyRelease: |
1317 | { |
1323 | { |
1318 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 |
1324 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 || ENABLE_PERL |
1319 | KeySym ks; |
1325 | KeySym keysym; |
1320 | |
1326 | |
1321 | 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 :/ |
1322 | #endif |
1328 | #endif |
1323 | |
1329 | |
1324 | #if ENABLE_FRILLS || ISO_14755 |
1330 | #if ENABLE_FRILLS || ISO_14755 |
1325 | // ISO 14755 support |
1331 | // ISO 14755 support |
1326 | if (iso14755buf) |
1332 | if (iso14755buf) |
… | |
… | |
1331 | # endif |
1337 | # endif |
1332 | # if ISO_14755 |
1338 | # if ISO_14755 |
1333 | // iso14755 part 5.2 handling: release time |
1339 | // iso14755 part 5.2 handling: release time |
1334 | // first: controls |
1340 | // first: controls |
1335 | if ((ev.xkey.state & ControlMask) |
1341 | if ((ev.xkey.state & ControlMask) |
1336 | && ((ks >= 0x40 && ks <= 0x5f) |
1342 | && ((keysym >= 0x40 && keysym <= 0x5f) |
1337 | || (ks >= 0x61 && ks <= 0x7f))) |
1343 | || (keysym >= 0x61 && keysym <= 0x7f))) |
1338 | { |
1344 | { |
1339 | iso14755buf = ISO_14755_51 | 0x2400 | (ks & 0x1f); |
1345 | iso14755buf = ISO_14755_51 | 0x2400 | (keysym & 0x1f); |
1340 | commit_iso14755 (); |
1346 | commit_iso14755 (); |
1341 | return; // case-break; |
1347 | goto skip_switch; |
1342 | } |
1348 | } |
1343 | |
1349 | |
1344 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
1350 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
1345 | if (i[0] == ks) |
1351 | if (i[0] == keysym) |
1346 | { |
1352 | { |
1347 | iso14755buf = ISO_14755_51 | i[1]; |
1353 | iso14755buf = ISO_14755_51 | i[1]; |
1348 | commit_iso14755 (); |
1354 | commit_iso14755 (); |
1349 | return; // case-break; |
1355 | goto skip_switch; |
1350 | } |
1356 | } |
1351 | |
1357 | |
1352 | scr_bell (); |
1358 | scr_bell (); |
1353 | # endif |
1359 | # endif |
1354 | iso14755buf = 0; |
1360 | iso14755buf = 0; |
… | |
… | |
1373 | else |
1379 | else |
1374 | iso14755buf = 0; |
1380 | iso14755buf = 0; |
1375 | } |
1381 | } |
1376 | #endif |
1382 | #endif |
1377 | |
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 | |
1378 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1388 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1379 | if (!(ev.xkey.state & ControlMask)) |
1389 | if (!(ev.xkey.state & ControlMask)) |
1380 | slip_wheel_ev.stop (); |
1390 | slip_wheel_ev.stop (); |
1381 | else if (ks == XK_Control_L || ks == XK_Control_R) |
1391 | else if (keysym == XK_Control_L || keysym == XK_Control_R) |
1382 | mouse_slip_wheel_speed = 0; |
1392 | mouse_slip_wheel_speed = 0; |
1383 | #endif |
1393 | #endif |
1384 | break; |
1394 | break; |
1385 | } |
1395 | } |
1386 | |
1396 | |
… | |
… | |
1392 | button_release (ev.xbutton); |
1402 | button_release (ev.xbutton); |
1393 | break; |
1403 | break; |
1394 | |
1404 | |
1395 | case ClientMessage: |
1405 | case ClientMessage: |
1396 | if (ev.xclient.format == 32 |
1406 | if (ev.xclient.format == 32 |
1397 | && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
1407 | && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END))) |
1398 | { |
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 | { |
1399 | 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))) |
1400 | destroy (); |
1416 | destroy (); |
|
|
1417 | } |
1401 | #if ENABLE_EWMH |
1418 | #if ENABLE_EWMH |
1402 | 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]) |
1403 | XSendEvent (disp, ev.xclient.window = display->root, |
1420 | XSendEvent (disp, ev.xclient.window = display->root, |
1404 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1421 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1405 | &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 | } |
1406 | #endif |
1434 | #endif |
1407 | } |
1435 | } |
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; |
1436 | break; |
1444 | |
1437 | |
1445 | case MappingNotify: |
1438 | case MappingNotify: |
1446 | XRefreshKeyboardMapping (&ev.xmapping); |
1439 | XRefreshKeyboardMapping (&ev.xmapping); |
1447 | break; |
1440 | break; |
… | |
… | |
1489 | { |
1482 | { |
1490 | seen_resize = 1; |
1483 | seen_resize = 1; |
1491 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1484 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1492 | } |
1485 | } |
1493 | |
1486 | |
|
|
1487 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
|
|
1488 | |
1494 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1489 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1495 | if (OPTION (Opt_transparent)) |
1490 | if (OPTION (Opt_transparent)) |
1496 | check_our_parents (); |
1491 | check_our_parents (); |
1497 | #endif |
1492 | #endif |
1498 | } |
1493 | } |
1499 | break; |
1494 | break; |
1500 | |
1495 | |
1501 | case PropertyNotify: |
1496 | case PropertyNotify: |
|
|
1497 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1502 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1498 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1503 | && ev.xproperty.state == PropertyNewValue) |
1499 | && ev.xproperty.state == PropertyNewValue) |
1504 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1500 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1505 | |
1501 | |
1506 | break; |
1502 | break; |
1507 | |
1503 | |
1508 | case SelectionClear: |
1504 | case SelectionClear: |
1509 | selection_clear (); |
1505 | selection_clear (); |
… | |
… | |
1514 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1510 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1515 | break; |
1511 | break; |
1516 | |
1512 | |
1517 | case SelectionRequest: |
1513 | case SelectionRequest: |
1518 | 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)); |
1519 | break; |
1523 | break; |
1520 | |
1524 | |
1521 | case UnmapNotify: |
1525 | case UnmapNotify: |
1522 | mapped = 0; |
1526 | mapped = 0; |
1523 | #ifdef TEXT_BLINK |
1527 | #ifdef TEXT_BLINK |
1524 | text_blink_ev.stop (); |
1528 | text_blink_ev.stop (); |
1525 | #endif |
1529 | #endif |
1526 | break; |
1530 | 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; |
1531 | break; |
1534 | |
1532 | |
1535 | #ifdef TRANSPARENT |
1533 | #ifdef TRANSPARENT |
1536 | case ReparentNotify: |
1534 | case ReparentNotify: |
1537 | rootwin_cb (ev); |
1535 | rootwin_cb (ev); |
… | |
… | |
1551 | |
1549 | |
1552 | while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)) |
1550 | while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)) |
1553 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1551 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1554 | ev.xexpose.width, ev.xexpose.height, False); |
1552 | ev.xexpose.width, ev.xexpose.height, False); |
1555 | |
1553 | |
1556 | scr_refresh (refresh_type); |
1554 | want_refresh = 1; |
1557 | } |
1555 | } |
1558 | else |
1556 | else |
1559 | { |
1557 | { |
1560 | XEvent unused_event; |
1558 | XEvent unused_event; |
1561 | |
1559 | |
… | |
… | |
1567 | if (isScrollbarWindow (ev.xany.window)) |
1565 | if (isScrollbarWindow (ev.xany.window)) |
1568 | { |
1566 | { |
1569 | scrollBar.setIdle (); |
1567 | scrollBar.setIdle (); |
1570 | scrollbar_show (0); |
1568 | scrollbar_show (0); |
1571 | } |
1569 | } |
1572 | #ifdef MENUBAR |
|
|
1573 | if (menubar_visible () && isMenuBarWindow (ev.xany.window)) |
|
|
1574 | menubar_expose (); |
|
|
1575 | #endif |
|
|
1576 | |
1570 | |
1577 | #ifdef TRANSPARENT |
1571 | #ifdef TRANSPARENT |
1578 | if (am_transparent && ev.xany.window == parent[0]) |
1572 | if (am_transparent && ev.xany.window == parent[0]) |
1579 | XClearWindow (disp, ev.xany.window); |
1573 | XClearWindow (disp, ev.xany.window); |
1580 | #endif |
1574 | #endif |
… | |
… | |
1584 | case MotionNotify: |
1578 | case MotionNotify: |
1585 | #ifdef POINTER_BLANK |
1579 | #ifdef POINTER_BLANK |
1586 | if (hidden_pointer) |
1580 | if (hidden_pointer) |
1587 | pointer_unblank (); |
1581 | pointer_unblank (); |
1588 | #endif |
1582 | #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) |
1583 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1597 | break; |
1584 | break; |
1598 | |
1585 | |
1599 | if (ev.xany.window == vt) |
1586 | if (ev.xany.window == vt) |
1600 | { |
1587 | { |
|
|
1588 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
|
|
1589 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
|
|
1590 | ; // nop |
1601 | if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1591 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1602 | { |
1592 | { |
1603 | while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) |
1593 | while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) |
1604 | ; |
1594 | ; |
1605 | |
1595 | |
1606 | XQueryPointer (disp, vt, |
1596 | XQueryPointer (disp, vt, |
… | |
… | |
1686 | &unused_root_x, &unused_root_y, |
1676 | &unused_root_x, &unused_root_y, |
1687 | &ev.xbutton.x, &ev.xbutton.y, |
1677 | &ev.xbutton.x, &ev.xbutton.y, |
1688 | &unused_mask); |
1678 | &unused_mask); |
1689 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1679 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1690 | scrollbar_size ()); |
1680 | scrollbar_size ()); |
1691 | scr_refresh (refresh_type); |
1681 | want_refresh = 1; |
1692 | refresh_limit = 0; |
1682 | refresh_limit = 0; |
1693 | scrollbar_show (1); |
1683 | scrollbar_show (1); |
1694 | } |
1684 | } |
1695 | break; |
1685 | break; |
1696 | } |
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 |
1697 | } |
1716 | } |
1698 | |
1717 | |
1699 | void |
1718 | void |
1700 | rxvt_term::focus_in () |
1719 | rxvt_term::focus_in () |
1701 | { |
1720 | { |
1702 | if (!focus) |
1721 | if (!focus) |
1703 | { |
1722 | { |
1704 | focus = 1; |
1723 | focus = 1; |
1705 | want_refresh = 1; |
1724 | want_refresh = 1; |
1706 | |
1725 | |
1707 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1726 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1708 | |
1727 | |
1709 | #if USE_XIM |
1728 | #if USE_XIM |
1710 | if (Input_Context != NULL) |
1729 | if (Input_Context != NULL) |
1711 | { |
1730 | { |
1712 | IMSetStatusPosition (); |
1731 | IMSetStatusPosition (); |
1713 | XSetICFocus (Input_Context); |
1732 | XSetICFocus (Input_Context); |
1714 | } |
1733 | } |
1715 | #endif |
1734 | #endif |
1716 | #if CURSOR_BLINK |
1735 | #if CURSOR_BLINK |
1717 | if (OPTION (Opt_cursorBlink)) |
1736 | if (OPTION (Opt_cursorBlink)) |
1718 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1737 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1719 | #endif |
1738 | #endif |
1720 | #if OFF_FOCUS_FADING |
1739 | #if OFF_FOCUS_FADING |
1721 | if (rs[Rs_fade]) |
1740 | if (rs[Rs_fade]) |
1722 | { |
1741 | { |
1723 | pix_colors = pix_colors_focused; |
1742 | pix_colors = pix_colors_focused; |
… | |
… | |
1733 | if (focus) |
1752 | if (focus) |
1734 | { |
1753 | { |
1735 | focus = 0; |
1754 | focus = 0; |
1736 | want_refresh = 1; |
1755 | want_refresh = 1; |
1737 | |
1756 | |
1738 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1757 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1739 | |
1758 | |
1740 | #if ENABLE_FRILLS || ISO_14755 |
1759 | #if ENABLE_FRILLS || ISO_14755 |
1741 | if (iso14755buf) |
1760 | if (iso14755buf) |
1742 | { |
1761 | { |
1743 | iso14755buf = 0; |
1762 | iso14755buf = 0; |
… | |
… | |
1767 | |
1786 | |
1768 | #if TRANSPARENT |
1787 | #if TRANSPARENT |
1769 | void |
1788 | void |
1770 | rxvt_term::rootwin_cb (XEvent &ev) |
1789 | rxvt_term::rootwin_cb (XEvent &ev) |
1771 | { |
1790 | { |
1772 | SET_R (this); |
1791 | make_current (); |
1773 | SET_LOCALE (locale); |
|
|
1774 | |
1792 | |
1775 | switch (ev.type) |
1793 | switch (ev.type) |
1776 | { |
1794 | { |
1777 | case PropertyNotify: |
1795 | case PropertyNotify: |
1778 | /* |
1796 | /* |
… | |
… | |
1826 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1844 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1827 | if (ev.button == MEvent.button && clickintime) |
1845 | if (ev.button == MEvent.button && clickintime) |
1828 | { |
1846 | { |
1829 | /* same button, within alloted time */ |
1847 | /* same button, within alloted time */ |
1830 | MEvent.clicks++; |
1848 | MEvent.clicks++; |
|
|
1849 | |
1831 | if (MEvent.clicks > 1) |
1850 | if (MEvent.clicks > 1) |
1832 | { |
1851 | { |
1833 | /* only report double clicks */ |
1852 | /* only report double clicks */ |
1834 | MEvent.clicks = 2; |
1853 | MEvent.clicks = 2; |
1835 | mouse_report (ev); |
1854 | mouse_report (ev); |
… | |
… | |
1855 | else |
1874 | else |
1856 | { |
1875 | { |
1857 | if (ev.button != MEvent.button) |
1876 | if (ev.button != MEvent.button) |
1858 | MEvent.clicks = 0; |
1877 | MEvent.clicks = 0; |
1859 | |
1878 | |
1860 | if (!PERL_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END))) |
1879 | if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
1861 | switch (ev.button) |
1880 | switch (ev.button) |
1862 | { |
1881 | { |
1863 | case Button1: |
1882 | case Button1: |
1864 | /* allow meta + click to select rectangular areas */ |
1883 | /* allow meta + click to select rectangular areas */ |
1865 | /* should be done in screen.C */ |
1884 | /* should be done in screen.C */ |
… | |
… | |
1868 | #else |
1887 | #else |
1869 | selection.rect = false; |
1888 | selection.rect = false; |
1870 | #endif |
1889 | #endif |
1871 | |
1890 | |
1872 | /* allow shift+left click to extend selection */ |
1891 | /* allow shift+left click to extend selection */ |
1873 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1892 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1874 | { |
1893 | { |
1875 | if (MEvent.button == Button1 && clickintime) |
1894 | if (MEvent.button == Button1 && clickintime) |
1876 | selection_rotate (ev.x, ev.y); |
1895 | selection_rotate (ev.x, ev.y); |
1877 | else |
1896 | else |
1878 | selection_extend (ev.x, ev.y, 1); |
1897 | selection_extend (ev.x, ev.y, 1); |
… | |
… | |
2043 | } |
2062 | } |
2044 | |
2063 | |
2045 | break; |
2064 | break; |
2046 | } |
2065 | } |
2047 | } |
2066 | } |
|
|
2067 | |
2048 | return; |
2068 | return; |
2049 | } |
2069 | } |
2050 | #if MENUBAR |
|
|
2051 | /* |
|
|
2052 | * Menubar window processing of button press |
|
|
2053 | */ |
|
|
2054 | if (isMenuBarWindow (ev.window)) |
|
|
2055 | menubar_control (ev); |
|
|
2056 | #endif |
|
|
2057 | } |
2070 | } |
2058 | |
2071 | |
2059 | void |
2072 | void |
2060 | rxvt_term::button_release (XButtonEvent &ev) |
2073 | rxvt_term::button_release (XButtonEvent &ev) |
2061 | { |
2074 | { |
… | |
… | |
2067 | |
2080 | |
2068 | if (scrollbar_isUpDn ()) |
2081 | if (scrollbar_isUpDn ()) |
2069 | { |
2082 | { |
2070 | scrollBar.setIdle (); |
2083 | scrollBar.setIdle (); |
2071 | scrollbar_show (0); |
2084 | scrollbar_show (0); |
2072 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
2073 | refresh_type &= ~SMOOTH_REFRESH; |
|
|
2074 | #endif |
|
|
2075 | } |
2085 | } |
2076 | |
2086 | |
2077 | #ifdef SELECTION_SCROLLING |
2087 | #ifdef SELECTION_SCROLLING |
2078 | if (sel_scroll_ev.active) |
2088 | if (sel_scroll_ev.active) |
2079 | sel_scroll_ev.stop(); |
2089 | sel_scroll_ev.stop(); |
… | |
… | |
2117 | if (priv_modes & PrivMode_mouse_report |
2127 | if (priv_modes & PrivMode_mouse_report |
2118 | && bypass_keystate |
2128 | && bypass_keystate |
2119 | && ev.button == Button1 && MEvent.clicks <= 1) |
2129 | && ev.button == Button1 && MEvent.clicks <= 1) |
2120 | selection_extend (ev.x, ev.y, 0); |
2130 | selection_extend (ev.x, ev.y, 0); |
2121 | |
2131 | |
|
|
2132 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2133 | return; |
|
|
2134 | |
2122 | switch (ev.button) |
2135 | switch (ev.button) |
2123 | { |
2136 | { |
2124 | case Button1: |
2137 | case Button1: |
2125 | case Button3: |
2138 | case Button3: |
2126 | selection_make (ev.time); |
2139 | selection_make (ev.time); |
2127 | break; |
2140 | break; |
|
|
2141 | |
2128 | case Button2: |
2142 | case Button2: |
2129 | selection_request (ev.time, ev.x, ev.y); |
2143 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
|
|
2144 | selection_request (ev.time, ev.state & ShiftMask ? Sel_Clipboard : Sel_Primary); |
2130 | break; |
2145 | break; |
|
|
2146 | |
2131 | #ifdef MOUSE_WHEEL |
2147 | #ifdef MOUSE_WHEEL |
2132 | case Button4: |
2148 | case Button4: |
2133 | case Button5: |
2149 | case Button5: |
2134 | { |
2150 | { |
2135 | int i; |
2151 | int i; |
… | |
… | |
2157 | slip_wheel_ev.start (); |
2173 | slip_wheel_ev.start (); |
2158 | } |
2174 | } |
2159 | else |
2175 | else |
2160 | { |
2176 | { |
2161 | # endif |
2177 | # endif |
2162 | # ifdef JUMP_MOUSE_WHEEL |
|
|
2163 | scr_page (v, i); |
2178 | scr_page (v, i); |
2164 | scr_refresh (SMOOTH_REFRESH); |
|
|
2165 | scrollbar_show (1); |
2179 | 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 |
2180 | # ifdef MOUSE_SLIP_WHEELING |
2175 | } |
2181 | } |
2176 | #endif |
2182 | # endif |
2177 | } |
2183 | } |
2178 | break; |
2184 | break; |
2179 | #endif |
2185 | #endif |
2180 | } |
2186 | } |
2181 | } |
2187 | } |
2182 | #ifdef MENUBAR |
|
|
2183 | else if (isMenuBarWindow (ev.window)) |
|
|
2184 | menubar_control (ev); |
|
|
2185 | #endif |
|
|
2186 | } |
2188 | } |
2187 | |
2189 | |
2188 | #ifdef TRANSPARENT |
2190 | #ifdef TRANSPARENT |
2189 | #if TINTING |
2191 | #if TINTING |
2190 | /* taken from aterm-0.4.2 */ |
2192 | /* taken from aterm-0.4.2 */ |
… | |
… | |
2670 | |
2672 | |
2671 | bool |
2673 | bool |
2672 | rxvt_term::cmd_parse () |
2674 | rxvt_term::cmd_parse () |
2673 | { |
2675 | { |
2674 | bool flag = false; |
2676 | bool flag = false; |
2675 | unicode_t ch = NOCHAR; |
2677 | wchar_t ch = NOCHAR; |
2676 | char *seq_begin; // remember start of esc-sequence here |
2678 | char *seq_begin; // remember start of esc-sequence here |
2677 | |
2679 | |
2678 | for (;;) |
2680 | for (;;) |
2679 | { |
2681 | { |
2680 | if (ch == NOCHAR) |
2682 | if (ch == NOCHAR) |
2681 | { |
2683 | { |
2682 | seq_begin = cmdbuf_ptr; |
2684 | seq_begin = cmdbuf_ptr; |
2683 | ch = next_char (); |
2685 | ch = next_char (); |
2684 | } |
|
|
2685 | |
2686 | |
2686 | if (ch == NOCHAR) // TODO: improve |
2687 | if (ch == NOCHAR) |
2687 | break; |
2688 | break; |
|
|
2689 | } |
2688 | |
2690 | |
2689 | if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT) |
2691 | if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT) |
2690 | { |
2692 | { |
2691 | if (!seen_input) |
2693 | if (!seen_input) |
2692 | { |
2694 | { |
… | |
… | |
2701 | if (seen_resize && cmd_pid) |
2703 | if (seen_resize && cmd_pid) |
2702 | kill (-cmd_pid, SIGWINCH); |
2704 | kill (-cmd_pid, SIGWINCH); |
2703 | } |
2705 | } |
2704 | |
2706 | |
2705 | /* Read a text string from the input buffer */ |
2707 | /* Read a text string from the input buffer */ |
2706 | unicode_t buf[UBUFSIZ]; |
2708 | wchar_t buf[UBUFSIZ]; |
2707 | bool refreshnow = false; |
2709 | bool refreshnow = false; |
2708 | int nlines = 0; |
2710 | int nlines = 0; |
2709 | unicode_t *str = buf; |
2711 | wchar_t *str = buf; |
2710 | unicode_t *eol = str + min (ncol, UBUFSIZ); |
2712 | wchar_t *eol = str + min (ncol, UBUFSIZ); |
2711 | |
2713 | |
2712 | for (;;) |
2714 | for (;;) |
2713 | { |
2715 | { |
2714 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2716 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2715 | break; |
2717 | break; |
… | |
… | |
2733 | } |
2735 | } |
2734 | |
2736 | |
2735 | // scr_add_lines only works for nlines <= nrow - 1. |
2737 | // scr_add_lines only works for nlines <= nrow - 1. |
2736 | if (nlines >= nrow - 1) |
2738 | if (nlines >= nrow - 1) |
2737 | { |
2739 | { |
|
|
2740 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
|
|
2741 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2738 | scr_add_lines (buf, nlines, str - buf); |
2742 | scr_add_lines (buf, str - buf, nlines); |
|
|
2743 | |
2739 | nlines = 0; |
2744 | nlines = 0; |
2740 | str = buf; |
2745 | str = buf; |
2741 | eol = str + min (ncol, UBUFSIZ); |
2746 | eol = str + min (ncol, UBUFSIZ); |
2742 | } |
2747 | } |
2743 | |
2748 | |
… | |
… | |
2756 | |
2761 | |
2757 | seq_begin = cmdbuf_ptr; |
2762 | seq_begin = cmdbuf_ptr; |
2758 | ch = next_char (); |
2763 | ch = next_char (); |
2759 | } |
2764 | } |
2760 | |
2765 | |
|
|
2766 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
|
|
2767 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2761 | scr_add_lines (buf, nlines, str - buf); |
2768 | scr_add_lines (buf, str - buf, nlines); |
2762 | |
2769 | |
2763 | /* |
2770 | /* |
2764 | * If there have been a lot of new lines, then update the screen |
2771 | * 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. |
2772 | * 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 |
2773 | * the number of pages between refreshes is refresh_limit, which |
… | |
… | |
2771 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2778 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2772 | refresh_limit++; |
2779 | refresh_limit++; |
2773 | else |
2780 | else |
2774 | { |
2781 | { |
2775 | flag = true; |
2782 | flag = true; |
2776 | scr_refresh (refresh_type); |
2783 | scr_refresh (); |
2777 | flush_ev.stop (); |
2784 | want_refresh = 1; |
2778 | } |
2785 | } |
2779 | } |
2786 | } |
2780 | |
2787 | |
2781 | } |
2788 | } |
2782 | else |
2789 | else |
… | |
… | |
2797 | } |
2804 | } |
2798 | |
2805 | |
2799 | return flag; |
2806 | return flag; |
2800 | } |
2807 | } |
2801 | |
2808 | |
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 |
2809 | // read the next character |
2812 | unicode_t |
2810 | wchar_t |
2813 | rxvt_term::next_char () |
2811 | rxvt_term::next_char () NOTHROW |
2814 | { |
2812 | { |
2815 | while (cmdbuf_ptr < cmdbuf_endp) |
2813 | while (cmdbuf_ptr < cmdbuf_endp) |
2816 | { |
2814 | { |
2817 | // assume 7-bit to be ascii ALWAYS |
2815 | // assume 7-bit to be ascii ALWAYS |
2818 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2816 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
… | |
… | |
2827 | cmdbuf_ptr = cmdbuf_endp; |
2825 | cmdbuf_ptr = cmdbuf_endp; |
2828 | break; |
2826 | break; |
2829 | } |
2827 | } |
2830 | |
2828 | |
2831 | if (len == (size_t)-1) |
2829 | if (len == (size_t)-1) |
2832 | return *cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2830 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2833 | |
2831 | |
2834 | // assume wchar == unicode |
2832 | // assume wchar == unicode |
2835 | cmdbuf_ptr += len; |
2833 | cmdbuf_ptr += len; |
2836 | return wc & UNICODE_MASK; |
2834 | return wc & UNICODE_MASK; |
2837 | } |
2835 | } |
2838 | |
2836 | |
2839 | return NOCHAR; |
2837 | return NOCHAR; |
2840 | } |
2838 | } |
|
|
2839 | |
|
|
2840 | // read the next octet |
|
|
2841 | uint32_t |
|
|
2842 | rxvt_term::next_octet () NOTHROW |
|
|
2843 | { |
|
|
2844 | return cmdbuf_ptr < cmdbuf_endp |
|
|
2845 | ? (unsigned char)*cmdbuf_ptr++ |
|
|
2846 | : NOCHAR; |
|
|
2847 | } |
|
|
2848 | |
|
|
2849 | static class out_of_input out_of_input; |
2841 | |
2850 | |
2842 | /* rxvt_cmd_getc () - Return next input character */ |
2851 | /* rxvt_cmd_getc () - Return next input character */ |
2843 | /* |
2852 | /* |
2844 | * Return the next input character after first passing any keyboard input |
2853 | * Return the next input character after first passing any keyboard input |
2845 | * to the command. |
2854 | * to the command. |
2846 | */ |
2855 | */ |
2847 | unicode_t |
2856 | wchar_t |
2848 | rxvt_term::cmd_getc () |
2857 | rxvt_term::cmd_getc () THROW ((class out_of_input)) |
2849 | { |
2858 | { |
2850 | unicode_t c = next_char (); |
2859 | wchar_t c = next_char (); |
2851 | |
2860 | |
2852 | if (c == NOCHAR) |
2861 | if (c == NOCHAR) |
2853 | throw out_of_input; |
2862 | throw out_of_input; |
2854 | |
2863 | |
2855 | return c; |
2864 | return c; |
2856 | } |
2865 | } |
2857 | |
2866 | |
2858 | unicode_t |
2867 | uint32_t |
2859 | rxvt_term::cmd_get8 () |
2868 | rxvt_term::cmd_get8 () THROW ((class out_of_input)) |
2860 | { |
2869 | { |
2861 | unicode_t c = next_octet (); |
2870 | uint32_t c = next_octet (); |
2862 | |
2871 | |
2863 | if (c == NOCHAR) |
2872 | if (c == NOCHAR) |
2864 | throw out_of_input; |
2873 | throw out_of_input; |
2865 | |
2874 | |
2866 | return c; |
2875 | return c; |
… | |
… | |
3133 | break; |
3142 | break; |
3134 | |
3143 | |
3135 | /* 8.3.87: NEXT LINE */ |
3144 | /* 8.3.87: NEXT LINE */ |
3136 | case C1_NEL: /* ESC E */ |
3145 | case C1_NEL: /* ESC E */ |
3137 | { |
3146 | { |
3138 | unicode_t nlcr[] = { C0_LF, C0_CR }; |
3147 | wchar_t nlcr[] = { C0_LF, C0_CR }; |
3139 | scr_add_lines (nlcr, 1, 2); |
3148 | scr_add_lines (nlcr, sizeof (nlcr) / sizeof (nlcr [0]), 1); |
3140 | } |
3149 | } |
3141 | break; |
3150 | break; |
3142 | |
3151 | |
3143 | /* kidnapped escape sequence: Should be 8.3.48 */ |
3152 | /* kidnapped escape sequence: Should be 8.3.48 */ |
3144 | case C1_ESA: /* ESC G */ |
3153 | case C1_ESA: /* ESC G */ |
… | |
… | |
3743 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3752 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3744 | */ |
3753 | */ |
3745 | void |
3754 | void |
3746 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3755 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3747 | { |
3756 | { |
3748 | int changed = 0; |
|
|
3749 | int color; |
3757 | int color; |
3750 | char *buf, *name; |
3758 | char *buf, *name; |
3751 | bool query = str[0] == '?' && !str[1]; |
3759 | bool query = str[0] == '?' && !str[1]; |
3752 | int saveop = op; |
3760 | int saveop = op; |
3753 | dDisp; |
3761 | dDisp; |
… | |
… | |
3808 | { |
3816 | { |
3809 | if ((name = strchr (buf, ';')) == NULL) |
3817 | if ((name = strchr (buf, ';')) == NULL) |
3810 | break; |
3818 | break; |
3811 | |
3819 | |
3812 | *name++ = '\0'; |
3820 | *name++ = '\0'; |
3813 | color = atoi (buf); |
3821 | color = atoi (buf) + minCOLOR; |
3814 | |
3822 | |
3815 | if (color < 0 || color >= TOTAL_COLORS) |
3823 | if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) |
3816 | break; |
3824 | break; |
3817 | |
3825 | |
3818 | if ((buf = strchr (name, ';')) != NULL) |
3826 | if ((buf = strchr (name, ';')) != NULL) |
3819 | *buf++ = '\0'; |
3827 | *buf++ = '\0'; |
3820 | |
3828 | |
3821 | if (name[0] == '?' && !name[1]) |
3829 | if (name[0] == '?' && !name[1]) |
3822 | { |
3830 | { |
3823 | unsigned short r, g, b; |
3831 | unsigned short r, g, b; |
3824 | pix_colors_focused[color + minCOLOR].get (display, r, g, b); |
3832 | 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); |
3833 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
3826 | } |
3834 | } |
3827 | else |
3835 | else |
3828 | set_window_color (color + minCOLOR, name); |
3836 | set_window_color (color, name); |
3829 | } |
3837 | } |
3830 | break; |
3838 | break; |
3831 | case XTerm_Color00: |
3839 | case XTerm_Color00: |
3832 | process_color_seq (XTerm_Color00, Color_fg, str, resp); |
3840 | process_color_seq (XTerm_Color00, Color_fg, str, resp); |
3833 | break; |
3841 | break; |
3834 | case XTerm_Color01: |
3842 | case XTerm_Color01: |
3835 | process_color_seq (XTerm_Color00, Color_bg, str, resp); |
3843 | process_color_seq (XTerm_Color01, Color_bg, str, resp); |
3836 | break; |
3844 | break; |
3837 | #ifndef NO_CURSORCOLOR |
3845 | #ifndef NO_CURSORCOLOR |
3838 | case XTerm_Color_cursor: |
3846 | case XTerm_Color_cursor: |
3839 | process_color_seq (XTerm_Color_cursor, Color_cursor, str, resp); |
3847 | process_color_seq (XTerm_Color_cursor, Color_cursor, str, resp); |
3840 | break; |
3848 | break; |
… | |
… | |
3844 | break; |
3852 | break; |
3845 | case XTerm_Color_pointer_bg: |
3853 | case XTerm_Color_pointer_bg: |
3846 | process_color_seq (XTerm_Color_pointer_bg, Color_pointer_bg, str, resp); |
3854 | process_color_seq (XTerm_Color_pointer_bg, Color_pointer_bg, str, resp); |
3847 | break; |
3855 | break; |
3848 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3856 | #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: |
3857 | case XTerm_Color_RV: |
3856 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
3858 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
|
|
3859 | break; |
|
|
3860 | case Rxvt_Color_BD: |
|
|
3861 | case URxvt_Color_BD: |
|
|
3862 | process_color_seq (op, Color_BD, str, resp); |
|
|
3863 | break; |
|
|
3864 | case Rxvt_Color_UL: |
|
|
3865 | case URxvt_Color_UL: |
|
|
3866 | process_color_seq (op, Color_UL, str, resp); |
3857 | break; |
3867 | break; |
3858 | case URxvt_Color_IT: |
3868 | case URxvt_Color_IT: |
3859 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
3869 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
3860 | break; |
3870 | break; |
3861 | #endif |
3871 | #endif |
… | |
… | |
3866 | if (am_transparent) |
3876 | if (am_transparent) |
3867 | want_full_refresh = want_refresh = 1; |
3877 | want_full_refresh = want_refresh = 1; |
3868 | break; |
3878 | break; |
3869 | #endif |
3879 | #endif |
3870 | |
3880 | |
3871 | case XTerm_Pixmap: |
3881 | case Rxvt_Pixmap: |
|
|
3882 | { |
3872 | if (*str != ';') |
3883 | if (*str != ';') |
3873 | { |
3884 | { |
3874 | #if XPM_BACKGROUND |
3885 | #if XPM_BACKGROUND |
3875 | scale_pixmap (""); /* reset to default scaling */ |
3886 | scale_pixmap (""); /* reset to default scaling */ |
3876 | set_bgPixmap (str); /* change pixmap */ |
3887 | set_bgPixmap (str); /* change pixmap */ |
3877 | #endif |
|
|
3878 | scr_touch (true); |
3888 | scr_touch (true); |
|
|
3889 | #endif |
3879 | } |
3890 | } |
|
|
3891 | |
|
|
3892 | int changed = 0; |
|
|
3893 | |
3880 | while ((str = strchr (str, ';')) != NULL) |
3894 | while ((str = strchr (str, ';')) != NULL) |
3881 | { |
3895 | { |
3882 | str++; |
3896 | str++; |
3883 | #if XPM_BACKGROUND |
3897 | #if XPM_BACKGROUND |
3884 | changed += scale_pixmap (str); |
3898 | changed += scale_pixmap (str); |
3885 | #endif |
3899 | #endif |
3886 | } |
3900 | } |
3887 | |
3901 | |
3888 | if (changed) |
3902 | if (changed) |
3889 | { |
3903 | { |
3890 | #ifdef XPM_BACKGROUND |
3904 | #ifdef XPM_BACKGROUND |
3891 | resize_pixmap (); |
3905 | resize_pixmap (); |
3892 | #endif |
|
|
3893 | scr_touch (true); |
3906 | scr_touch (true); |
|
|
3907 | #endif |
3894 | } |
3908 | } |
|
|
3909 | } |
3895 | break; |
3910 | break; |
3896 | |
3911 | |
3897 | case XTerm_restoreFG: |
3912 | case Rxvt_restoreFG: |
3898 | set_window_color (Color_fg, str); |
3913 | set_window_color (Color_fg, str); |
3899 | break; |
3914 | break; |
3900 | case XTerm_restoreBG: |
3915 | case Rxvt_restoreBG: |
3901 | set_window_color (Color_bg, str); |
3916 | set_window_color (Color_bg, str); |
3902 | break; |
3917 | break; |
3903 | |
3918 | |
3904 | case XTerm_logfile: |
3919 | case XTerm_logfile: |
3905 | // TODO, when secure mode? |
3920 | // TODO, when secure mode? |
3906 | break; |
3921 | break; |
3907 | |
3922 | |
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 |
3923 | #if 0 |
3915 | case XTerm_dumpscreen: /* no error notices */ |
3924 | case Rxvt_dumpscreen: /* no error notices */ |
3916 | { |
3925 | { |
3917 | int fd; |
3926 | int fd; |
3918 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3927 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3919 | { |
3928 | { |
3920 | scr_dump (fd); |
3929 | scr_dump (fd); |
… | |
… | |
3951 | if (query) |
3960 | if (query) |
3952 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); |
3961 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); |
3953 | else |
3962 | else |
3954 | { |
3963 | { |
3955 | set_locale (str); |
3964 | set_locale (str); |
3956 | pty.set_utf8_mode (enc_utf8); |
3965 | pty->set_utf8_mode (enc_utf8); |
3957 | init_xlocale (); |
3966 | init_xlocale (); |
3958 | } |
3967 | } |
3959 | break; |
3968 | break; |
3960 | |
3969 | |
3961 | case URxvt_view_up: |
3970 | case URxvt_view_up: |
… | |
… | |
3972 | break; |
3981 | break; |
3973 | #endif |
3982 | #endif |
3974 | |
3983 | |
3975 | #if ENABLE_PERL |
3984 | #if ENABLE_PERL |
3976 | case URxvt_perl: |
3985 | case URxvt_perl: |
3977 | if (PERL_INVOKE ((this, HOOK_OSC_SEQ, DT_STRING, str, DT_END))) |
3986 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_STR, str, DT_END))) |
3978 | ; // no responses yet |
3987 | ; // no responses yet |
3979 | break; |
3988 | break; |
3980 | #endif |
3989 | #endif |
3981 | } |
3990 | } |
3982 | } |
3991 | } |
… | |
… | |
4014 | return state; |
4023 | return state; |
4015 | } |
4024 | } |
4016 | |
4025 | |
4017 | /* we're not using priv _yet_ */ |
4026 | /* we're not using priv _yet_ */ |
4018 | void |
4027 | void |
4019 | rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) |
4028 | rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg) |
4020 | { |
4029 | { |
4021 | unsigned int i, j; |
4030 | unsigned int i, j; |
4022 | int state; |
4031 | int state; |
4023 | |
4032 | |
4024 | static const struct |
4033 | static const struct |
… | |
… | |
4035 | { 5, PrivMode_rVideo }, |
4044 | { 5, PrivMode_rVideo }, |
4036 | { 6, PrivMode_relOrigin }, |
4045 | { 6, PrivMode_relOrigin }, |
4037 | { 7, PrivMode_Autowrap }, |
4046 | { 7, PrivMode_Autowrap }, |
4038 | // 8, bi-directional support mode |
4047 | // 8, bi-directional support mode |
4039 | { 9, PrivMode_MouseX10 }, |
4048 | { 9, PrivMode_MouseX10 }, |
4040 | #ifdef menuBar_esc |
|
|
4041 | { menuBar_esc, PrivMode_menuBar }, |
|
|
4042 | #endif |
|
|
4043 | // 18, 19 printing-related |
4049 | // 18, 19 printing-related |
4044 | { 25, PrivMode_VisibleCursor }, |
4050 | { 25, PrivMode_VisibleCursor }, |
4045 | #ifdef scrollBar_esc |
4051 | #ifdef scrollBar_esc |
4046 | { scrollBar_esc, PrivMode_scrollBar }, |
4052 | { scrollBar_esc, PrivMode_scrollBar }, |
4047 | #endif |
4053 | #endif |
… | |
… | |
4094 | /* extra handling for values with state unkept */ |
4100 | /* extra handling for values with state unkept */ |
4095 | switch (arg[i]) |
4101 | switch (arg[i]) |
4096 | { |
4102 | { |
4097 | #if ENABLE_STYLES |
4103 | #if ENABLE_STYLES |
4098 | case 1021: |
4104 | case 1021: |
4099 | if (mode) |
4105 | set_option (Opt_intensityStyles, mode); |
4100 | SET_OPTION (Opt_intensityStyles); |
|
|
4101 | else |
|
|
4102 | CLR_OPTION (Opt_intensityStyles); |
|
|
4103 | |
4106 | |
4104 | scr_touch (true); |
4107 | scr_touch (true); |
4105 | break; |
4108 | break; |
4106 | #endif |
4109 | #endif |
4107 | case 1048: /* alternative cursor save */ |
4110 | case 1048: /* alternative cursor save */ |
… | |
… | |
4129 | case 3: /* 80/132 */ |
4132 | case 3: /* 80/132 */ |
4130 | if (priv_modes & PrivMode_132OK) |
4133 | if (priv_modes & PrivMode_132OK) |
4131 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4134 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4132 | break; |
4135 | break; |
4133 | case 4: /* smooth scrolling */ |
4136 | case 4: /* smooth scrolling */ |
4134 | if (!state) |
4137 | set_option (Opt_jumpScroll, !state); |
4135 | SET_OPTION (Opt_jumpScroll); |
|
|
4136 | else |
|
|
4137 | CLR_OPTION (Opt_jumpScroll); |
|
|
4138 | break; |
4138 | break; |
4139 | case 5: /* reverse video */ |
4139 | case 5: /* reverse video */ |
4140 | scr_rvideo_mode (state); |
4140 | scr_rvideo_mode (state); |
4141 | break; |
4141 | break; |
4142 | case 6: /* relative/absolute origins */ |
4142 | case 6: /* relative/absolute origins */ |
… | |
… | |
4148 | /* case 8: - auto repeat, can't do on a per window basis */ |
4148 | /* case 8: - auto repeat, can't do on a per window basis */ |
4149 | case 9: /* X10 mouse reporting */ |
4149 | case 9: /* X10 mouse reporting */ |
4150 | if (state) /* orthogonal */ |
4150 | if (state) /* orthogonal */ |
4151 | priv_modes &= ~PrivMode_MouseX11; |
4151 | priv_modes &= ~PrivMode_MouseX11; |
4152 | break; |
4152 | 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 |
4153 | #ifdef scrollBar_esc |
4161 | case scrollBar_esc: |
4154 | case scrollBar_esc: |
4162 | if (scrollbar_mapping (state)) |
4155 | if (scrollbar_mapping (state)) |
4163 | { |
4156 | { |
4164 | resize_all_windows (0, 0, 0); |
4157 | resize_all_windows (0, 0, 0); |
… | |
… | |
4183 | #if 0 |
4176 | #if 0 |
4184 | case 1001: |
4177 | case 1001: |
4185 | break; /* X11 mouse highlighting */ |
4178 | break; /* X11 mouse highlighting */ |
4186 | #endif |
4179 | #endif |
4187 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4180 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4188 | if (!state) |
4181 | set_option (Opt_scrollTtyOutput, !state); |
4189 | SET_OPTION (Opt_scrollTtyOutput); |
|
|
4190 | else |
|
|
4191 | CLR_OPTION (Opt_scrollTtyOutput); |
|
|
4192 | break; |
4182 | break; |
4193 | case 1011: /* scroll to bottom on key press */ |
4183 | case 1011: /* scroll to bottom on key press */ |
4194 | if (state) |
4184 | set_option (Opt_scrollTtyKeypress, state); |
4195 | SET_OPTION (Opt_scrollTtyKeypress); |
|
|
4196 | else |
|
|
4197 | CLR_OPTION (Opt_scrollTtyKeypress); |
|
|
4198 | break; |
4185 | break; |
4199 | case 1047: /* secondary screen w/ clearing last */ |
4186 | case 1047: /* secondary screen w/ clearing last */ |
4200 | if (OPTION (Opt_secondaryScreen)) |
4187 | if (OPTION (Opt_secondaryScreen)) |
4201 | if (current_screen != PRIMARY) |
4188 | if (current_screen != PRIMARY) |
4202 | scr_erase_screen (2); |
4189 | scr_erase_screen (2); |
… | |
… | |
4340 | scr_color (Color_bg, Color_bg); |
4327 | scr_color (Color_bg, Color_bg); |
4341 | break; |
4328 | break; |
4342 | |
4329 | |
4343 | //case 50: // not variable spacing |
4330 | //case 50: // not variable spacing |
4344 | |
4331 | |
4345 | #ifndef NO_BRIGHTCOLOR |
4332 | #if ENABLE_FRILLS |
4346 | case 90: |
4333 | case 90: |
4347 | case 91: /* set bright fg color */ |
4334 | case 91: /* set bright fg color */ |
4348 | case 92: |
4335 | case 92: |
4349 | case 93: |
4336 | case 93: |
4350 | case 94: |
4337 | case 94: |
… | |
… | |
4412 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4399 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4413 | |
4400 | |
4414 | void |
4401 | void |
4415 | rxvt_term::tt_write (const char *data, unsigned int len) |
4402 | rxvt_term::tt_write (const char *data, unsigned int len) |
4416 | { |
4403 | { |
|
|
4404 | if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) |
|
|
4405 | return; |
|
|
4406 | |
|
|
4407 | if (pty->pty < 0) |
|
|
4408 | return; |
|
|
4409 | |
4417 | if (v_buflen == 0) |
4410 | if (v_buflen == 0) |
4418 | { |
4411 | { |
4419 | ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE)); |
4412 | ssize_t written = write (pty->pty, data, min (len, MAX_PTY_WRITE)); |
4420 | |
4413 | |
4421 | if ((unsigned int)written == len) |
4414 | if ((unsigned int)written == len) |
4422 | return; |
4415 | return; |
4423 | |
4416 | |
4424 | data += written; |
4417 | data += written; |
… | |
… | |
4433 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4426 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4434 | } |
4427 | } |
4435 | |
4428 | |
4436 | void rxvt_term::pty_write () |
4429 | void rxvt_term::pty_write () |
4437 | { |
4430 | { |
4438 | int written = write (pty.pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4431 | int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4439 | |
4432 | |
4440 | if (written > 0) |
4433 | if (written > 0) |
4441 | { |
4434 | { |
4442 | v_buflen -= written; |
4435 | v_buflen -= written; |
4443 | |
4436 | |