… | |
… | |
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 | { |
… | |
… | |
230 | # if !UNICODE3 |
227 | # if !UNICODE3 |
231 | if (ch >= 0x10000) |
228 | if (ch >= 0x10000) |
232 | ch = 0xfffd; |
229 | ch = 0xfffd; |
233 | # endif |
230 | # endif |
234 | scr_overlay_set (11, y, ch, r); |
231 | scr_overlay_set (11, y, ch, r); |
|
|
232 | |
|
|
233 | if (WCWIDTH (ch) >= 2) |
235 | scr_overlay_set (12, y, NOCHAR, r); |
234 | scr_overlay_set (12, y, NOCHAR, r); |
236 | } |
235 | } |
237 | |
236 | |
|
|
237 | // { |
|
|
238 | // char buf[4+4+3+1]; |
|
|
239 | // snprintf (buf, sizeof (buf), "(%.4d|%.4d)", x, y); |
|
|
240 | // scr_overlay_set (0, 0, buf); |
|
|
241 | // } |
238 | scr_overlay_set (0, len , attr); |
242 | scr_overlay_set (0, len , attr); |
239 | scr_overlay_set (0, len + 1, fname); |
243 | scr_overlay_set (0, len + 1, fname); |
240 | |
244 | |
241 | free (fname); |
245 | free (fname); |
242 | |
246 | |
… | |
… | |
302 | rxvt_term::lookup_key (XKeyEvent &ev) |
306 | rxvt_term::lookup_key (XKeyEvent &ev) |
303 | { |
307 | { |
304 | int ctrl, meta, shft, len; |
308 | int ctrl, meta, shft, len; |
305 | unsigned int newlen; |
309 | unsigned int newlen; |
306 | KeySym keysym; |
310 | KeySym keysym; |
307 | #ifdef DEBUG_CMD |
|
|
308 | static int debug_key = 1; /* accessible by a debugger only */ |
|
|
309 | #endif |
|
|
310 | int valid_keysym; |
311 | int valid_keysym; |
311 | char kbuf[KBUFSZ]; |
312 | char kbuf[KBUFSZ]; |
312 | |
313 | |
313 | /* |
314 | /* |
314 | * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an |
315 | * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an |
… | |
… | |
443 | scr_move_to (0, 1); |
444 | scr_move_to (0, 1); |
444 | return; |
445 | return; |
445 | } |
446 | } |
446 | else if (keysym == XK_End) |
447 | else if (keysym == XK_End) |
447 | { |
448 | { |
448 | scr_move_to (1, 0); |
449 | scr_move_to (1, 1); |
449 | return; |
450 | return; |
450 | } |
451 | } |
451 | } |
452 | } |
452 | #endif |
453 | #endif |
453 | } |
454 | } |
… | |
… | |
464 | { |
465 | { |
465 | switch (keysym) |
466 | switch (keysym) |
466 | { |
467 | { |
467 | /* normal XTerm key bindings */ |
468 | /* normal XTerm key bindings */ |
468 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
469 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
469 | selection_request (ev.time, 0, 0); |
470 | selection_request (ev.time); |
470 | return; |
471 | return; |
471 | #if TODO |
472 | #if TODO |
472 | /* rxvt extras */ |
473 | /* rxvt extras */ |
473 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
474 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
474 | change_font (FONT_UP); |
475 | change_font (FONT_UP); |
… | |
… | |
867 | #endif |
868 | #endif |
868 | /* nil */ ; |
869 | /* nil */ ; |
869 | } |
870 | } |
870 | } |
871 | } |
871 | |
872 | |
|
|
873 | if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, DT_STR_LEN, kbuf, len, DT_END))) |
|
|
874 | return; |
|
|
875 | |
872 | if (len <= 0) |
876 | if (len <= 0) |
873 | return; /* not mapped */ |
877 | return; /* not mapped */ |
874 | |
878 | |
875 | if (OPTION (Opt_scrollTtyKeypress)) |
879 | if (OPTION (Opt_scrollTtyKeypress)) |
876 | if (view_start) |
880 | if (view_start) |
… | |
… | |
902 | { |
906 | { |
903 | const char ch = C0_ESC; |
907 | const char ch = C0_ESC; |
904 | tt_write (&ch, 1); |
908 | tt_write (&ch, 1); |
905 | } |
909 | } |
906 | |
910 | |
907 | #if defined(DEBUG_CMD) |
|
|
908 | /* Display keyboard buffer contents */ |
|
|
909 | unsigned char *p; |
|
|
910 | int i; |
|
|
911 | |
|
|
912 | fprintf (stderr, "key 0x%04X [%d]: `", (unsigned int)keysym, len); |
|
|
913 | for (i = 0, p = kbuf; i < len; i++, p++) |
|
|
914 | fprintf (stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); |
|
|
915 | fprintf (stderr, "'\n"); |
|
|
916 | #endif /* DEBUG_CMD */ |
|
|
917 | tt_write (kbuf, (unsigned int)len); |
911 | tt_write (kbuf, (unsigned int)len); |
918 | } |
912 | } |
919 | /*}}} */ |
913 | /*}}} */ |
920 | |
914 | |
921 | #if MENUBAR_MAX || defined (KEYSYM_RESOURCE) |
915 | #if defined (KEYSYM_RESOURCE) |
922 | /*{{{ rxvt_cmd_write (), rxvt_cmd_getc () */ |
|
|
923 | /* attempt to `write' count to the input buffer */ |
|
|
924 | unsigned int |
916 | unsigned int |
925 | rxvt_term::cmd_write (const char *str, unsigned int count) |
917 | rxvt_term::cmd_write (const char *str, unsigned int count) |
926 | { |
918 | { |
927 | unsigned int n, s; |
919 | unsigned int n, s; |
928 | |
920 | |
… | |
… | |
969 | |
961 | |
970 | if (want_refresh) |
962 | if (want_refresh) |
971 | { |
963 | { |
972 | if (SHOULD_INVOKE (HOOK_LINE_UPDATE)) |
964 | if (SHOULD_INVOKE (HOOK_LINE_UPDATE)) |
973 | { |
965 | { |
974 | int row = -view_start; |
966 | int row = view_start; |
|
|
967 | int end_row = row + nrow; |
975 | |
968 | |
976 | while (row > -nsaved && ROW (row - 1).is_longer ()) |
969 | while (row > top_row && ROW (row - 1).is_longer ()) |
977 | --row; |
970 | --row; |
978 | |
971 | |
979 | while (row < -view_start + nrow) |
972 | do |
980 | { |
973 | { |
981 | int start_row = row; |
974 | int start_row = row; |
982 | line_t *l; |
975 | line_t *l; |
983 | |
976 | |
984 | do |
977 | do |
985 | { |
978 | { |
986 | l = &ROW (row); |
979 | l = &ROW (row++); |
987 | |
980 | |
988 | if (!(l->f & LINE_FILTERED)) |
981 | if (!(l->f & LINE_FILTERED)) |
989 | { |
982 | { |
990 | // line not filtered, mark it as filtered |
983 | // line not filtered, mark it as filtered |
991 | l->f |= LINE_FILTERED; |
984 | l->f |= LINE_FILTERED; |
992 | while (l->is_longer ()) |
985 | while (l->is_longer ()) |
993 | { |
986 | { |
994 | l = &ROW (++row); |
987 | l = &ROW (row++); |
995 | l->f |= LINE_FILTERED; |
988 | l->f |= LINE_FILTERED; |
996 | } |
989 | } |
997 | |
990 | |
998 | // and filter it |
991 | // and filter it |
999 | HOOK_INVOKE ((this, HOOK_LINE_UPDATE, DT_INT, start_row, DT_END)); |
992 | HOOK_INVOKE ((this, HOOK_LINE_UPDATE, DT_INT, start_row, DT_END)); |
1000 | |
993 | |
1001 | break; |
994 | break; |
1002 | } |
995 | } |
1003 | } |
996 | } |
1004 | while (l->is_longer ()); |
997 | while (l->is_longer () && row < end_row); |
1005 | |
|
|
1006 | row++; |
|
|
1007 | } |
998 | } |
|
|
999 | while (row < end_row); |
1008 | |
1000 | } |
1009 | } |
|
|
1010 | |
1001 | |
1011 | scr_refresh (refresh_type); |
1002 | scr_refresh (); |
1012 | scrollbar_show (1); |
1003 | scrollbar_show (1); |
1013 | #ifdef USE_XIM |
1004 | #ifdef USE_XIM |
1014 | IMSendSpot (); |
1005 | IMSendSpot (); |
1015 | #endif |
1006 | #endif |
1016 | } |
1007 | } |
… | |
… | |
1019 | } |
1010 | } |
1020 | |
1011 | |
1021 | void |
1012 | void |
1022 | rxvt_term::check_cb (check_watcher &w) |
1013 | rxvt_term::check_cb (check_watcher &w) |
1023 | { |
1014 | { |
1024 | SET_R (this); |
1015 | make_current (); |
1025 | SET_LOCALE (locale); |
|
|
1026 | |
1016 | |
1027 | display->flush (); |
1017 | display->flush (); |
1028 | |
1018 | |
1029 | if (want_refresh && !flush_ev.active) |
1019 | if (want_refresh && !flush_ev.active) |
1030 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
1020 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
1031 | } |
1021 | } |
1032 | |
1022 | |
1033 | void |
1023 | void |
1034 | rxvt_term::flush_cb (time_watcher &w) |
1024 | rxvt_term::flush_cb (time_watcher &w) |
1035 | { |
1025 | { |
1036 | SET_R (this); |
1026 | make_current (); |
1037 | SET_LOCALE (locale); |
|
|
1038 | |
1027 | |
1039 | refresh_limit = 1; |
1028 | refresh_limit = 1; |
1040 | refresh_count = 0; |
1029 | refresh_count = 0; |
1041 | flush (); |
1030 | flush (); |
1042 | } |
1031 | } |
… | |
… | |
1046 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1035 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1047 | { |
1036 | { |
1048 | hidden_cursor = !hidden_cursor; |
1037 | hidden_cursor = !hidden_cursor; |
1049 | want_refresh = 1; |
1038 | want_refresh = 1; |
1050 | |
1039 | |
1051 | w.start (w.at + BLINK_INTERVAL); |
1040 | w.start (w.at + CURSOR_BLINK_INTERVAL); |
1052 | } |
1041 | } |
1053 | #endif |
1042 | #endif |
1054 | |
1043 | |
1055 | #ifdef TEXT_BLINK |
1044 | #ifdef TEXT_BLINK |
1056 | void |
1045 | void |
… | |
… | |
1070 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1059 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1071 | { |
1060 | { |
1072 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1061 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1073 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1062 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1074 | { |
1063 | { |
1075 | refresh_type |= SMOOTH_REFRESH; |
|
|
1076 | want_refresh = 1; |
1064 | want_refresh = 1; |
1077 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1065 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1078 | } |
1066 | } |
1079 | } |
1067 | } |
1080 | #endif |
1068 | #endif |
… | |
… | |
1084 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1072 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1085 | { |
1073 | { |
1086 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1074 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1087 | { |
1075 | { |
1088 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1076 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1089 | refresh_type |= SMOOTH_REFRESH; |
|
|
1090 | want_refresh = 1; |
1077 | want_refresh = 1; |
1091 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1078 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1092 | } |
1079 | } |
1093 | } |
1080 | } |
1094 | #endif |
1081 | #endif |
… | |
… | |
1099 | { |
1086 | { |
1100 | if (mouse_slip_wheel_speed == 0 |
1087 | if (mouse_slip_wheel_speed == 0 |
1101 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
1088 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
1102 | : scr_page (UP, mouse_slip_wheel_speed)) |
1089 | : scr_page (UP, mouse_slip_wheel_speed)) |
1103 | { |
1090 | { |
1104 | if (view_start == nsaved || |
1091 | if (view_start == top_row || view_start == 0) |
1105 | view_start == 0) |
|
|
1106 | mouse_slip_wheel_speed = 0; |
1092 | mouse_slip_wheel_speed = 0; |
1107 | |
1093 | |
1108 | refresh_type |= SMOOTH_REFRESH; |
|
|
1109 | want_refresh = 1; |
1094 | want_refresh = 1; |
1110 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1095 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1111 | } |
1096 | } |
1112 | } |
1097 | } |
1113 | #endif |
1098 | #endif |
… | |
… | |
1143 | |
1128 | |
1144 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1129 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1145 | cmdbuf_ptr = cmdbuf_base; |
1130 | cmdbuf_ptr = cmdbuf_base; |
1146 | cmdbuf_endp = cmdbuf_ptr + n; |
1131 | cmdbuf_endp = cmdbuf_ptr + n; |
1147 | |
1132 | |
1148 | ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); |
1133 | ssize_t r = read (pty->pty, cmdbuf_endp, CBUFSIZ - n); |
1149 | |
1134 | |
1150 | if (r > 0) |
1135 | if (r > 0) |
1151 | { |
1136 | { |
1152 | cmdbuf_endp += r; |
1137 | cmdbuf_endp += r; |
1153 | return true; |
1138 | return true; |
… | |
… | |
1171 | } |
1156 | } |
1172 | |
1157 | |
1173 | void |
1158 | void |
1174 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1159 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1175 | { |
1160 | { |
1176 | SET_R (this); |
1161 | make_current (); |
1177 | SET_LOCALE (locale); |
|
|
1178 | |
1162 | |
1179 | if (revents & EVENT_READ) |
1163 | if (revents & EVENT_READ) |
1180 | // loop, but don't allow a single term to monopolize us |
1164 | // loop, but don't allow a single term to monopolize us |
1181 | while (pty_fill ()) |
1165 | while (pty_fill ()) |
1182 | if (cmd_parse ()) |
1166 | if (cmd_parse ()) |
… | |
… | |
1187 | } |
1171 | } |
1188 | |
1172 | |
1189 | void |
1173 | void |
1190 | rxvt_term::pointer_unblank () |
1174 | rxvt_term::pointer_unblank () |
1191 | { |
1175 | { |
1192 | XDefineCursor (display->display, vt, TermWin_cursor); |
1176 | XDefineCursor (xdisp, vt, TermWin_cursor); |
1193 | recolour_cursor (); |
1177 | recolour_cursor (); |
1194 | |
1178 | |
1195 | #ifdef POINTER_BLANK |
1179 | #ifdef POINTER_BLANK |
1196 | hidden_pointer = 0; |
1180 | hidden_pointer = 0; |
1197 | |
1181 | |
… | |
… | |
1202 | |
1186 | |
1203 | #ifdef POINTER_BLANK |
1187 | #ifdef POINTER_BLANK |
1204 | void |
1188 | void |
1205 | rxvt_term::pointer_blank () |
1189 | rxvt_term::pointer_blank () |
1206 | { |
1190 | { |
1207 | if (! OPTION (Opt_pointerBlank)) |
1191 | if (!OPTION (Opt_pointerBlank)) |
1208 | return; |
1192 | return; |
1209 | |
1193 | |
1210 | XDefineCursor (display->display, vt, display->blank_cursor); |
1194 | XDefineCursor (xdisp, vt, display->blank_cursor); |
1211 | XFlush (display->display); |
1195 | XFlush (xdisp); |
1212 | |
1196 | |
1213 | hidden_pointer = 1; |
1197 | hidden_pointer = 1; |
1214 | } |
1198 | } |
1215 | |
1199 | |
1216 | void |
1200 | void |
1217 | rxvt_term::pointer_cb (time_watcher &w) |
1201 | rxvt_term::pointer_cb (time_watcher &w) |
1218 | { |
1202 | { |
1219 | SET_R (this); |
1203 | make_current (); |
1220 | SET_LOCALE (locale); |
|
|
1221 | |
1204 | |
1222 | pointer_blank (); |
1205 | pointer_blank (); |
1223 | } |
1206 | } |
1224 | #endif |
1207 | #endif |
1225 | |
1208 | |
… | |
… | |
1290 | (32 + button_number + key_state), |
1273 | (32 + button_number + key_state), |
1291 | (32 + x + 1), |
1274 | (32 + x + 1), |
1292 | (32 + y + 1)); |
1275 | (32 + y + 1)); |
1293 | } |
1276 | } |
1294 | |
1277 | |
1295 | #ifdef USING_W11LIB |
|
|
1296 | void |
|
|
1297 | rxvt_W11_process_x_event (XEvent *ev) |
|
|
1298 | { |
|
|
1299 | rxvt_t *r = rxvt_get_r (); |
|
|
1300 | |
|
|
1301 | x_cb (*ev); |
|
|
1302 | } |
|
|
1303 | #endif |
|
|
1304 | |
|
|
1305 | /*{{{ process an X event */ |
1278 | /*{{{ process an X event */ |
1306 | void |
1279 | void |
1307 | rxvt_term::x_cb (XEvent &ev) |
1280 | rxvt_term::x_cb (XEvent &ev) |
1308 | { |
1281 | { |
1309 | dDisp; |
1282 | make_current (); |
1310 | |
1283 | |
1311 | SET_R (this); |
1284 | dLocal (Display *, xdisp); |
1312 | SET_LOCALE (locale); |
|
|
1313 | |
1285 | |
1314 | #if defined(CURSOR_BLINK) |
1286 | if (ev.xany.window == vt |
1315 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
1287 | && SHOULD_INVOKE (HOOK_X_EVENT) |
1316 | { |
1288 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
1317 | if (hidden_cursor) |
1289 | return; |
1318 | { |
|
|
1319 | hidden_cursor = 0; |
|
|
1320 | want_refresh = 1; |
|
|
1321 | } |
|
|
1322 | |
1290 | |
1323 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1291 | // for XQueryPointer |
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; |
1292 | Window unused_root, unused_child; |
1342 | int unused_root_x, unused_root_y; |
1293 | int unused_root_x, unused_root_y; |
1343 | unsigned int unused_mask; |
1294 | unsigned int unused_mask; |
1344 | |
1295 | |
1345 | switch (ev.type) |
1296 | switch (ev.type) |
… | |
… | |
1352 | |
1303 | |
1353 | break; |
1304 | break; |
1354 | |
1305 | |
1355 | case KeyRelease: |
1306 | case KeyRelease: |
1356 | { |
1307 | { |
1357 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 |
1308 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 || ENABLE_PERL |
1358 | KeySym ks; |
1309 | KeySym keysym; |
1359 | |
1310 | |
1360 | ks = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
1311 | keysym = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
1361 | #endif |
1312 | #endif |
1362 | |
1313 | |
1363 | #if ENABLE_FRILLS || ISO_14755 |
1314 | #if ENABLE_FRILLS || ISO_14755 |
1364 | // ISO 14755 support |
1315 | // ISO 14755 support |
1365 | if (iso14755buf) |
1316 | if (iso14755buf) |
… | |
… | |
1370 | # endif |
1321 | # endif |
1371 | # if ISO_14755 |
1322 | # if ISO_14755 |
1372 | // iso14755 part 5.2 handling: release time |
1323 | // iso14755 part 5.2 handling: release time |
1373 | // first: controls |
1324 | // first: controls |
1374 | if ((ev.xkey.state & ControlMask) |
1325 | if ((ev.xkey.state & ControlMask) |
1375 | && ((ks >= 0x40 && ks <= 0x5f) |
1326 | && ((keysym >= 0x40 && keysym <= 0x5f) |
1376 | || (ks >= 0x61 && ks <= 0x7f))) |
1327 | || (keysym >= 0x61 && keysym <= 0x7f))) |
1377 | { |
1328 | { |
1378 | iso14755buf = ISO_14755_51 | 0x2400 | (ks & 0x1f); |
1329 | iso14755buf = ISO_14755_51 | 0x2400 | (keysym & 0x1f); |
1379 | commit_iso14755 (); |
1330 | commit_iso14755 (); |
1380 | return; // case-break; |
1331 | goto skip_switch; |
1381 | } |
1332 | } |
1382 | |
1333 | |
1383 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
1334 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
1384 | if (i[0] == ks) |
1335 | if (i[0] == keysym) |
1385 | { |
1336 | { |
1386 | iso14755buf = ISO_14755_51 | i[1]; |
1337 | iso14755buf = ISO_14755_51 | i[1]; |
1387 | commit_iso14755 (); |
1338 | commit_iso14755 (); |
1388 | return; // case-break; |
1339 | goto skip_switch; |
1389 | } |
1340 | } |
1390 | |
1341 | |
1391 | scr_bell (); |
1342 | scr_bell (); |
1392 | # endif |
1343 | # endif |
1393 | iso14755buf = 0; |
1344 | iso14755buf = 0; |
… | |
… | |
1412 | else |
1363 | else |
1413 | iso14755buf = 0; |
1364 | iso14755buf = 0; |
1414 | } |
1365 | } |
1415 | #endif |
1366 | #endif |
1416 | |
1367 | |
|
|
1368 | if (ev.xany.window == vt |
|
|
1369 | && HOOK_INVOKE ((this, HOOK_KEY_RELEASE, DT_XEVENT, &ev, DT_INT, keysym, DT_END))) |
|
|
1370 | break; |
|
|
1371 | |
1417 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1372 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1418 | if (!(ev.xkey.state & ControlMask)) |
1373 | if (!(ev.xkey.state & ControlMask)) |
1419 | slip_wheel_ev.stop (); |
1374 | slip_wheel_ev.stop (); |
1420 | else if (ks == XK_Control_L || ks == XK_Control_R) |
1375 | else if (keysym == XK_Control_L || keysym == XK_Control_R) |
1421 | mouse_slip_wheel_speed = 0; |
1376 | mouse_slip_wheel_speed = 0; |
1422 | #endif |
1377 | #endif |
1423 | break; |
1378 | break; |
1424 | } |
1379 | } |
1425 | |
1380 | |
… | |
… | |
1431 | button_release (ev.xbutton); |
1386 | button_release (ev.xbutton); |
1432 | break; |
1387 | break; |
1433 | |
1388 | |
1434 | case ClientMessage: |
1389 | case ClientMessage: |
1435 | if (ev.xclient.format == 32 |
1390 | if (ev.xclient.format == 32 |
1436 | && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
1391 | && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END))) |
1437 | { |
1392 | { |
|
|
1393 | if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
|
|
1394 | { |
|
|
1395 | if (!HOOK_INVOKE ((this, HOOK_WM_PROTOCOLS, DT_XEVENT, &ev, DT_END))) |
|
|
1396 | { |
1438 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
1397 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
|
|
1398 | { |
|
|
1399 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) |
1439 | destroy (); |
1400 | destroy (); |
|
|
1401 | } |
1440 | #if ENABLE_EWMH |
1402 | #if ENABLE_EWMH |
1441 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1403 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1442 | XSendEvent (disp, ev.xclient.window = display->root, |
1404 | XSendEvent (xdisp, ev.xclient.window = display->root, |
1443 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1405 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1444 | &ev); |
1406 | &ev); |
|
|
1407 | #endif |
|
|
1408 | } |
|
|
1409 | } |
|
|
1410 | #if ENABLE_XEMBED |
|
|
1411 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1412 | { |
|
|
1413 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1414 | focus_in (); |
|
|
1415 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1416 | focus_out (); |
|
|
1417 | } |
1445 | #endif |
1418 | #endif |
1446 | } |
1419 | } |
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; |
1420 | break; |
1483 | |
1421 | |
1484 | case MappingNotify: |
1422 | case MappingNotify: |
1485 | XRefreshKeyboardMapping (&ev.xmapping); |
1423 | XRefreshKeyboardMapping (&ev.xmapping); |
1486 | break; |
1424 | break; |
… | |
… | |
1519 | break; |
1457 | break; |
1520 | |
1458 | |
1521 | case ConfigureNotify: |
1459 | case ConfigureNotify: |
1522 | if (ev.xconfigure.window == parent[0]) |
1460 | if (ev.xconfigure.window == parent[0]) |
1523 | { |
1461 | { |
1524 | while (XCheckTypedWindowEvent (disp, ev.xconfigure.window, ConfigureNotify, &ev)) |
1462 | while (XCheckTypedWindowEvent (xdisp, ev.xconfigure.window, ConfigureNotify, &ev)) |
1525 | ; |
1463 | ; |
1526 | |
1464 | |
1527 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1465 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1528 | { |
1466 | { |
1529 | seen_resize = 1; |
1467 | seen_resize = 1; |
1530 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1468 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1531 | } |
1469 | } |
1532 | |
1470 | |
|
|
1471 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
|
|
1472 | |
1533 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1473 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1534 | if (OPTION (Opt_transparent)) |
1474 | if (OPTION (Opt_transparent)) |
1535 | check_our_parents (); |
1475 | check_our_parents (); |
1536 | #endif |
1476 | #endif |
1537 | } |
1477 | } |
1538 | break; |
1478 | break; |
1539 | |
1479 | |
1540 | case PropertyNotify: |
1480 | case PropertyNotify: |
|
|
1481 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1541 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1482 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1542 | && ev.xproperty.state == PropertyNewValue) |
1483 | && ev.xproperty.state == PropertyNewValue) |
1543 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1484 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1544 | |
1485 | |
1545 | break; |
1486 | break; |
1546 | |
1487 | |
1547 | case SelectionClear: |
1488 | case SelectionClear: |
1548 | selection_clear (); |
1489 | selection_clear (); |
… | |
… | |
1553 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1494 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1554 | break; |
1495 | break; |
1555 | |
1496 | |
1556 | case SelectionRequest: |
1497 | case SelectionRequest: |
1557 | selection_send (ev.xselectionrequest); |
1498 | selection_send (ev.xselectionrequest); |
|
|
1499 | break; |
|
|
1500 | |
|
|
1501 | case MapNotify: |
|
|
1502 | mapped = 1; |
|
|
1503 | #ifdef TEXT_BLINK |
|
|
1504 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
|
|
1505 | #endif |
|
|
1506 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1558 | break; |
1507 | break; |
1559 | |
1508 | |
1560 | case UnmapNotify: |
1509 | case UnmapNotify: |
1561 | mapped = 0; |
1510 | mapped = 0; |
1562 | #ifdef TEXT_BLINK |
1511 | #ifdef TEXT_BLINK |
1563 | text_blink_ev.stop (); |
1512 | text_blink_ev.stop (); |
1564 | #endif |
1513 | #endif |
1565 | break; |
1514 | 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; |
1515 | break; |
1573 | |
1516 | |
1574 | #ifdef TRANSPARENT |
1517 | #ifdef TRANSPARENT |
1575 | case ReparentNotify: |
1518 | case ReparentNotify: |
1576 | rootwin_cb (ev); |
1519 | rootwin_cb (ev); |
… | |
… | |
1582 | if (ev.xany.window == vt) |
1525 | if (ev.xany.window == vt) |
1583 | { |
1526 | { |
1584 | do |
1527 | do |
1585 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1528 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1586 | ev.xexpose.width, ev.xexpose.height, False); |
1529 | ev.xexpose.width, ev.xexpose.height, False); |
1587 | while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)); |
1530 | while (XCheckTypedWindowEvent (xdisp, vt, ev.xany.type, &ev)); |
1588 | |
1531 | |
1589 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1532 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1590 | |
1533 | |
1591 | while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)) |
1534 | while (XCheckTypedWindowEvent (xdisp, vt, ev.xany.type, &ev)) |
1592 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1535 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1593 | ev.xexpose.width, ev.xexpose.height, False); |
1536 | ev.xexpose.width, ev.xexpose.height, False); |
1594 | |
1537 | |
1595 | scr_refresh (refresh_type); |
1538 | want_refresh = 1; |
1596 | } |
1539 | } |
1597 | else |
1540 | else |
1598 | { |
1541 | { |
1599 | XEvent unused_event; |
1542 | XEvent unused_event; |
1600 | |
1543 | |
1601 | while (XCheckTypedWindowEvent (disp, ev.xany.window, Expose, &unused_event)) |
1544 | while (XCheckTypedWindowEvent (xdisp, ev.xany.window, Expose, &unused_event)) |
1602 | ; |
1545 | ; |
1603 | while (XCheckTypedWindowEvent (disp, ev.xany.window, GraphicsExpose, &unused_event)) |
1546 | while (XCheckTypedWindowEvent (xdisp, ev.xany.window, GraphicsExpose, &unused_event)) |
1604 | ; |
1547 | ; |
1605 | |
1548 | |
1606 | if (isScrollbarWindow (ev.xany.window)) |
1549 | if (isScrollbarWindow (ev.xany.window)) |
1607 | { |
1550 | { |
1608 | scrollBar.setIdle (); |
1551 | scrollBar.setIdle (); |
1609 | scrollbar_show (0); |
1552 | scrollbar_show (0); |
1610 | } |
1553 | } |
1611 | #ifdef MENUBAR |
|
|
1612 | if (menubar_visible () && isMenuBarWindow (ev.xany.window)) |
|
|
1613 | menubar_expose (); |
|
|
1614 | #endif |
|
|
1615 | |
1554 | |
1616 | #ifdef TRANSPARENT |
1555 | #ifdef TRANSPARENT |
1617 | if (am_transparent && ev.xany.window == parent[0]) |
1556 | if (am_transparent && ev.xany.window == parent[0]) |
1618 | XClearWindow (disp, ev.xany.window); |
1557 | XClearWindow (xdisp, ev.xany.window); |
1619 | #endif |
1558 | #endif |
1620 | } |
1559 | } |
1621 | break; |
1560 | break; |
1622 | |
1561 | |
1623 | case MotionNotify: |
1562 | case MotionNotify: |
1624 | #ifdef POINTER_BLANK |
1563 | #ifdef POINTER_BLANK |
1625 | if (hidden_pointer) |
1564 | if (hidden_pointer) |
1626 | pointer_unblank (); |
1565 | pointer_unblank (); |
1627 | #endif |
1566 | #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) |
1567 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1636 | break; |
1568 | break; |
1637 | |
1569 | |
1638 | if (ev.xany.window == vt) |
1570 | if (ev.xany.window == vt) |
1639 | { |
1571 | { |
|
|
1572 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
|
|
1573 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
|
|
1574 | ; // nop |
1640 | if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1575 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1641 | { |
1576 | { |
1642 | while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) |
1577 | while (XCheckTypedWindowEvent (xdisp, vt, MotionNotify, &ev)) |
1643 | ; |
1578 | ; |
1644 | |
1579 | |
1645 | XQueryPointer (disp, vt, |
1580 | XQueryPointer (xdisp, vt, |
1646 | &unused_root, &unused_child, |
1581 | &unused_root, &unused_child, |
1647 | &unused_root_x, &unused_root_y, |
1582 | &unused_root_x, &unused_root_y, |
1648 | &ev.xbutton.x, &ev.xbutton.y, |
1583 | &ev.xbutton.x, &ev.xbutton.y, |
1649 | &ev.xbutton.state); |
1584 | &ev.xbutton.state); |
1650 | #ifdef MOUSE_THRESHOLD |
1585 | #ifdef MOUSE_THRESHOLD |
… | |
… | |
1714 | #endif |
1649 | #endif |
1715 | } |
1650 | } |
1716 | } |
1651 | } |
1717 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1652 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1718 | { |
1653 | { |
1719 | while (XCheckTypedWindowEvent (disp, scrollBar.win, |
1654 | while (XCheckTypedWindowEvent (xdisp, scrollBar.win, |
1720 | MotionNotify, &ev)) |
1655 | MotionNotify, &ev)) |
1721 | ; |
1656 | ; |
1722 | |
1657 | |
1723 | XQueryPointer (disp, scrollBar.win, |
1658 | XQueryPointer (xdisp, scrollBar.win, |
1724 | &unused_root, &unused_child, |
1659 | &unused_root, &unused_child, |
1725 | &unused_root_x, &unused_root_y, |
1660 | &unused_root_x, &unused_root_y, |
1726 | &ev.xbutton.x, &ev.xbutton.y, |
1661 | &ev.xbutton.x, &ev.xbutton.y, |
1727 | &unused_mask); |
1662 | &unused_mask); |
1728 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1663 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1729 | scrollbar_size ()); |
1664 | scrollbar_size ()); |
1730 | scr_refresh (refresh_type); |
1665 | want_refresh = 1; |
1731 | refresh_limit = 0; |
1666 | refresh_limit = 0; |
1732 | scrollbar_show (1); |
1667 | scrollbar_show (1); |
1733 | } |
1668 | } |
1734 | break; |
1669 | break; |
1735 | } |
1670 | } |
|
|
1671 | |
|
|
1672 | skip_switch: ; |
|
|
1673 | |
|
|
1674 | #if defined(CURSOR_BLINK) |
|
|
1675 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
|
|
1676 | { |
|
|
1677 | if (hidden_cursor) |
|
|
1678 | { |
|
|
1679 | hidden_cursor = 0; |
|
|
1680 | want_refresh = 1; |
|
|
1681 | } |
|
|
1682 | |
|
|
1683 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
|
|
1684 | } |
|
|
1685 | #endif |
|
|
1686 | |
|
|
1687 | #if defined(POINTER_BLANK) |
|
|
1688 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
|
|
1689 | { |
|
|
1690 | if (ev.type == MotionNotify |
|
|
1691 | || ev.type == ButtonPress |
|
|
1692 | || ev.type == ButtonRelease) |
|
|
1693 | if (hidden_pointer) |
|
|
1694 | pointer_unblank (); |
|
|
1695 | |
|
|
1696 | if (ev.type == KeyPress && hidden_pointer == 0) |
|
|
1697 | pointer_blank (); |
|
|
1698 | } |
|
|
1699 | #endif |
1736 | } |
1700 | } |
1737 | |
1701 | |
1738 | void |
1702 | void |
1739 | rxvt_term::focus_in () |
1703 | rxvt_term::focus_in () |
1740 | { |
1704 | { |
1741 | if (!focus) |
1705 | if (!focus) |
1742 | { |
1706 | { |
1743 | focus = 1; |
1707 | focus = 1; |
1744 | want_refresh = 1; |
|
|
1745 | |
1708 | |
1746 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1709 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1747 | |
1710 | |
1748 | #if USE_XIM |
1711 | #if USE_XIM |
1749 | if (Input_Context != NULL) |
1712 | if (Input_Context != NULL) |
… | |
… | |
1752 | XSetICFocus (Input_Context); |
1715 | XSetICFocus (Input_Context); |
1753 | } |
1716 | } |
1754 | #endif |
1717 | #endif |
1755 | #if CURSOR_BLINK |
1718 | #if CURSOR_BLINK |
1756 | if (OPTION (Opt_cursorBlink)) |
1719 | if (OPTION (Opt_cursorBlink)) |
1757 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1720 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1758 | #endif |
1721 | #endif |
1759 | #if OFF_FOCUS_FADING |
1722 | #if OFF_FOCUS_FADING |
1760 | if (rs[Rs_fade]) |
1723 | if (rs[Rs_fade]) |
1761 | { |
1724 | { |
1762 | pix_colors = pix_colors_focused; |
1725 | pix_colors = pix_colors_focused; |
|
|
1726 | want_refresh = 1; |
1763 | scr_recolour (); |
1727 | scr_recolour (); |
1764 | } |
1728 | } |
1765 | #endif |
1729 | #endif |
1766 | } |
1730 | } |
1767 | } |
1731 | } |
… | |
… | |
1770 | rxvt_term::focus_out () |
1734 | rxvt_term::focus_out () |
1771 | { |
1735 | { |
1772 | if (focus) |
1736 | if (focus) |
1773 | { |
1737 | { |
1774 | focus = 0; |
1738 | focus = 0; |
1775 | want_refresh = 1; |
|
|
1776 | |
1739 | |
1777 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1740 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1778 | |
1741 | |
1779 | #if ENABLE_FRILLS || ISO_14755 |
1742 | #if ENABLE_FRILLS || ISO_14755 |
1780 | if (iso14755buf) |
1743 | if (iso14755buf) |
… | |
… | |
1796 | #endif |
1759 | #endif |
1797 | #if OFF_FOCUS_FADING |
1760 | #if OFF_FOCUS_FADING |
1798 | if (rs[Rs_fade]) |
1761 | if (rs[Rs_fade]) |
1799 | { |
1762 | { |
1800 | pix_colors = pix_colors_unfocused; |
1763 | pix_colors = pix_colors_unfocused; |
|
|
1764 | want_refresh = 1; |
1801 | scr_recolour (); |
1765 | scr_recolour (); |
1802 | } |
1766 | } |
1803 | #endif |
1767 | #endif |
1804 | } |
1768 | } |
1805 | } |
1769 | } |
1806 | |
1770 | |
1807 | #if TRANSPARENT |
1771 | #if TRANSPARENT |
1808 | void |
1772 | void |
1809 | rxvt_term::rootwin_cb (XEvent &ev) |
1773 | rxvt_term::rootwin_cb (XEvent &ev) |
1810 | { |
1774 | { |
1811 | SET_R (this); |
1775 | make_current (); |
1812 | SET_LOCALE (locale); |
|
|
1813 | |
1776 | |
1814 | switch (ev.type) |
1777 | switch (ev.type) |
1815 | { |
1778 | { |
1816 | case PropertyNotify: |
1779 | case PropertyNotify: |
1817 | /* |
1780 | /* |
… | |
… | |
1844 | /* |
1807 | /* |
1845 | * VT window processing of button press |
1808 | * VT window processing of button press |
1846 | */ |
1809 | */ |
1847 | if (ev.window == vt) |
1810 | if (ev.window == vt) |
1848 | { |
1811 | { |
|
|
1812 | if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1813 | return; |
|
|
1814 | |
1849 | #if ISO_14755 |
1815 | #if ISO_14755 |
1850 | // 5.4 |
1816 | // 5.4 |
1851 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1817 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1852 | { |
1818 | { |
1853 | iso14755_54 (ev.x, ev.y); |
1819 | iso14755_54 (ev.x, ev.y); |
… | |
… | |
1865 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1831 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1866 | if (ev.button == MEvent.button && clickintime) |
1832 | if (ev.button == MEvent.button && clickintime) |
1867 | { |
1833 | { |
1868 | /* same button, within alloted time */ |
1834 | /* same button, within alloted time */ |
1869 | MEvent.clicks++; |
1835 | MEvent.clicks++; |
|
|
1836 | |
1870 | if (MEvent.clicks > 1) |
1837 | if (MEvent.clicks > 1) |
1871 | { |
1838 | { |
1872 | /* only report double clicks */ |
1839 | /* only report double clicks */ |
1873 | MEvent.clicks = 2; |
1840 | MEvent.clicks = 2; |
1874 | mouse_report (ev); |
1841 | mouse_report (ev); |
… | |
… | |
1894 | else |
1861 | else |
1895 | { |
1862 | { |
1896 | if (ev.button != MEvent.button) |
1863 | if (ev.button != MEvent.button) |
1897 | MEvent.clicks = 0; |
1864 | MEvent.clicks = 0; |
1898 | |
1865 | |
1899 | if (!HOOK_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END))) |
|
|
1900 | switch (ev.button) |
1866 | switch (ev.button) |
1901 | { |
1867 | { |
1902 | case Button1: |
1868 | case Button1: |
1903 | /* allow meta + click to select rectangular areas */ |
1869 | /* allow meta + click to select rectangular areas */ |
1904 | /* should be done in screen.C */ |
1870 | /* should be done in screen.C */ |
1905 | #if ENABLE_FRILLS |
1871 | #if ENABLE_FRILLS |
1906 | selection.rect = !!(ev.state & ModMetaMask); |
1872 | selection.rect = !!(ev.state & ModMetaMask); |
1907 | #else |
1873 | #else |
1908 | selection.rect = false; |
1874 | selection.rect = false; |
1909 | #endif |
1875 | #endif |
1910 | |
1876 | |
1911 | /* allow shift+left click to extend selection */ |
1877 | /* allow shift+left click to extend selection */ |
1912 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1878 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1913 | { |
1879 | { |
1914 | if (MEvent.button == Button1 && clickintime) |
1880 | if (MEvent.button == Button1 && clickintime) |
1915 | selection_rotate (ev.x, ev.y); |
1881 | selection_rotate (ev.x, ev.y); |
1916 | else |
1882 | else |
1917 | selection_extend (ev.x, ev.y, 1); |
1883 | selection_extend (ev.x, ev.y, 1); |
1918 | } |
1884 | } |
1919 | else |
1885 | else |
1920 | { |
1886 | { |
1921 | if (MEvent.button == Button1 && clickintime) |
1887 | if (MEvent.button == Button1 && clickintime) |
1922 | MEvent.clicks++; |
1888 | MEvent.clicks++; |
1923 | else |
1889 | else |
1924 | MEvent.clicks = 1; |
1890 | MEvent.clicks = 1; |
1925 | |
1891 | |
1926 | selection_click (MEvent.clicks, ev.x, ev.y); |
1892 | selection_click (MEvent.clicks, ev.x, ev.y); |
1927 | } |
1893 | } |
1928 | |
1894 | |
1929 | MEvent.button = Button1; |
1895 | MEvent.button = Button1; |
1930 | break; |
1896 | break; |
1931 | |
1897 | |
1932 | case Button3: |
1898 | case Button3: |
1933 | if (MEvent.button == Button3 && clickintime) |
1899 | if (MEvent.button == Button3 && clickintime) |
1934 | selection_rotate (ev.x, ev.y); |
1900 | selection_rotate (ev.x, ev.y); |
1935 | else |
1901 | else |
1936 | selection_extend (ev.x, ev.y, 1); |
1902 | selection_extend (ev.x, ev.y, 1); |
1937 | |
1903 | |
1938 | MEvent.button = Button3; |
1904 | MEvent.button = Button3; |
1939 | break; |
1905 | break; |
1940 | } |
1906 | } |
1941 | } |
1907 | } |
1942 | |
1908 | |
1943 | MEvent.time = ev.time; |
1909 | MEvent.time = ev.time; |
1944 | return; |
1910 | return; |
1945 | } |
1911 | } |
1946 | |
1912 | |
… | |
… | |
2082 | } |
2048 | } |
2083 | |
2049 | |
2084 | break; |
2050 | break; |
2085 | } |
2051 | } |
2086 | } |
2052 | } |
|
|
2053 | |
2087 | return; |
2054 | return; |
2088 | } |
2055 | } |
2089 | #if MENUBAR |
|
|
2090 | /* |
|
|
2091 | * Menubar window processing of button press |
|
|
2092 | */ |
|
|
2093 | if (isMenuBarWindow (ev.window)) |
|
|
2094 | menubar_control (ev); |
|
|
2095 | #endif |
|
|
2096 | } |
2056 | } |
2097 | |
2057 | |
2098 | void |
2058 | void |
2099 | rxvt_term::button_release (XButtonEvent &ev) |
2059 | rxvt_term::button_release (XButtonEvent &ev) |
2100 | { |
2060 | { |
… | |
… | |
2106 | |
2066 | |
2107 | if (scrollbar_isUpDn ()) |
2067 | if (scrollbar_isUpDn ()) |
2108 | { |
2068 | { |
2109 | scrollBar.setIdle (); |
2069 | scrollBar.setIdle (); |
2110 | scrollbar_show (0); |
2070 | scrollbar_show (0); |
2111 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
2112 | refresh_type &= ~SMOOTH_REFRESH; |
|
|
2113 | #endif |
|
|
2114 | } |
2071 | } |
2115 | |
2072 | |
2116 | #ifdef SELECTION_SCROLLING |
2073 | #ifdef SELECTION_SCROLLING |
2117 | if (sel_scroll_ev.active) |
2074 | if (sel_scroll_ev.active) |
2118 | sel_scroll_ev.stop(); |
2075 | sel_scroll_ev.stop(); |
2119 | #endif |
2076 | #endif |
2120 | |
2077 | |
2121 | if (ev.window == vt) |
2078 | if (ev.window == vt) |
2122 | { |
2079 | { |
|
|
2080 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2081 | return; |
|
|
2082 | |
2123 | #if ISO_14755 |
2083 | #if ISO_14755 |
2124 | // 5.4 |
2084 | // 5.4 |
2125 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2085 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2126 | return; |
2086 | return; |
2127 | #endif |
2087 | #endif |
|
|
2088 | |
2128 | if (reportmode) |
2089 | if (reportmode) |
2129 | { |
2090 | { |
2130 | /* mouse report from vt window */ |
2091 | /* mouse report from vt window */ |
2131 | /* don't report release of wheel "buttons" */ |
2092 | /* don't report release of wheel "buttons" */ |
2132 | if (ev.button >= 4) |
2093 | if (ev.button >= 4) |
… | |
… | |
2162 | { |
2123 | { |
2163 | case Button1: |
2124 | case Button1: |
2164 | case Button3: |
2125 | case Button3: |
2165 | selection_make (ev.time); |
2126 | selection_make (ev.time); |
2166 | break; |
2127 | break; |
|
|
2128 | |
2167 | case Button2: |
2129 | case Button2: |
2168 | selection_request (ev.time, ev.x, ev.y); |
2130 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
|
|
2131 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary); |
2169 | break; |
2132 | break; |
|
|
2133 | |
2170 | #ifdef MOUSE_WHEEL |
2134 | #ifdef MOUSE_WHEEL |
2171 | case Button4: |
2135 | case Button4: |
2172 | case Button5: |
2136 | case Button5: |
2173 | { |
2137 | { |
2174 | int i; |
2138 | int i; |
… | |
… | |
2196 | slip_wheel_ev.start (); |
2160 | slip_wheel_ev.start (); |
2197 | } |
2161 | } |
2198 | else |
2162 | else |
2199 | { |
2163 | { |
2200 | # endif |
2164 | # endif |
2201 | # ifdef JUMP_MOUSE_WHEEL |
|
|
2202 | scr_page (v, i); |
2165 | scr_page (v, i); |
2203 | scr_refresh (SMOOTH_REFRESH); |
|
|
2204 | scrollbar_show (1); |
2166 | 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 |
2167 | # ifdef MOUSE_SLIP_WHEELING |
2214 | } |
2168 | } |
2215 | #endif |
2169 | # endif |
2216 | } |
2170 | } |
2217 | break; |
2171 | break; |
2218 | #endif |
2172 | #endif |
2219 | } |
2173 | } |
2220 | } |
2174 | } |
2221 | #ifdef MENUBAR |
|
|
2222 | else if (isMenuBarWindow (ev.window)) |
|
|
2223 | menubar_control (ev); |
|
|
2224 | #endif |
|
|
2225 | } |
2175 | } |
2226 | |
2176 | |
2227 | #ifdef TRANSPARENT |
2177 | #ifdef TRANSPARENT |
2228 | #if TINTING |
2178 | #if TINTING |
2229 | /* taken from aterm-0.4.2 */ |
2179 | /* taken from aterm-0.4.2 */ |
2230 | |
2180 | |
2231 | typedef uint32_t RUINT32T; |
2181 | typedef uint32_t RUINT32T; |
2232 | |
2182 | |
2233 | void ShadeXImage(rxvt_display *display, XImage* srcImage, int shade, int rm, int gm, int bm) |
2183 | void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm) |
2234 | { |
2184 | { |
2235 | int sh_r, sh_g, sh_b; |
2185 | int sh_r, sh_g, sh_b; |
2236 | RUINT32T mask_r, mask_g, mask_b; |
2186 | RUINT32T mask_r, mask_g, mask_b; |
2237 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
2187 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
2238 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
2188 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
2239 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
2189 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
2240 | int i; |
2190 | int i; |
2241 | |
2191 | |
2242 | Visual *visual = display->visual; |
2192 | Visual *visual = term->visual; |
2243 | |
2193 | |
2244 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
2194 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
2245 | |
2195 | |
2246 | /* for convenience */ |
2196 | /* for convenience */ |
2247 | mask_r = visual->red_mask; |
2197 | mask_r = visual->red_mask; |
… | |
… | |
2468 | Atom atype; |
2418 | Atom atype; |
2469 | unsigned char *prop = NULL; |
2419 | unsigned char *prop = NULL; |
2470 | Window root, oldp, *list; |
2420 | Window root, oldp, *list; |
2471 | Pixmap rootpixmap = None; |
2421 | Pixmap rootpixmap = None; |
2472 | XWindowAttributes wattr, wrootattr; |
2422 | XWindowAttributes wattr, wrootattr; |
2473 | dDisp; |
|
|
2474 | |
2423 | |
2475 | pchanged = 0; |
2424 | pchanged = 0; |
2476 | |
2425 | |
2477 | if (!OPTION (Opt_transparent)) |
2426 | if (!OPTION (Opt_transparent)) |
2478 | return pchanged; /* Don't try any more */ |
2427 | return pchanged; /* Don't try any more */ |
2479 | |
2428 | |
2480 | XGetWindowAttributes (disp, display->root, &wrootattr); |
2429 | XGetWindowAttributes (xdisp, display->root, &wrootattr); |
2481 | rootdepth = wrootattr.depth; |
2430 | rootdepth = wrootattr.depth; |
2482 | |
2431 | |
2483 | XGetWindowAttributes (disp, parent[0], &wattr); |
2432 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
2484 | |
2433 | |
2485 | if (rootdepth != wattr.depth) |
2434 | if (rootdepth != wattr.depth) |
2486 | { |
2435 | { |
2487 | if (am_transparent) |
2436 | if (am_transparent) |
2488 | { |
2437 | { |
2489 | pchanged = 1; |
2438 | pchanged = 1; |
2490 | XSetWindowBackground (disp, vt, pix_colors_focused[Color_bg]); |
2439 | XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]); |
2491 | am_transparent = am_pixmap_trans = 0; |
2440 | am_transparent = am_pixmap_trans = 0; |
2492 | } |
2441 | } |
2493 | |
2442 | |
2494 | return pchanged; /* Don't try any more */ |
2443 | return pchanged; /* Don't try any more */ |
2495 | } |
2444 | } |
2496 | |
2445 | |
2497 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
2446 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
2498 | XSync (disp, False); |
2447 | XSync (xdisp, False); |
2499 | |
2448 | |
2500 | /* |
2449 | /* |
2501 | * Make the frame window set by the window manager have |
2450 | * Make the frame window set by the window manager have |
2502 | * the root background. Some window managers put multiple nested frame |
2451 | * the root background. Some window managers put multiple nested frame |
2503 | * windows for each client, so we have to take care about that. |
2452 | * windows for each client, so we have to take care about that. |
2504 | */ |
2453 | */ |
2505 | i = (xa[XA_XROOTPMAP_ID] |
2454 | i = (xa[XA_XROOTPMAP_ID] |
2506 | && XGetWindowProperty (disp, display->root, xa[XA_XROOTPMAP_ID], |
2455 | && XGetWindowProperty (xdisp, display->root, xa[XA_XROOTPMAP_ID], |
2507 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2456 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2508 | &nitems, &bytes_after, &prop) == Success); |
2457 | &nitems, &bytes_after, &prop) == Success); |
2509 | |
2458 | |
2510 | if (!i || prop == NULL) |
2459 | if (!i || prop == NULL) |
2511 | i = (xa[XA_ESETROOT_PMAP_ID] |
2460 | i = (xa[XA_ESETROOT_PMAP_ID] |
2512 | && XGetWindowProperty (disp, display->root, xa[XA_ESETROOT_PMAP_ID], |
2461 | && XGetWindowProperty (xdisp, display->root, xa[XA_ESETROOT_PMAP_ID], |
2513 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2462 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2514 | &nitems, &bytes_after, &prop) == Success); |
2463 | &nitems, &bytes_after, &prop) == Success); |
2515 | |
2464 | |
2516 | if (!i || prop == NULL |
2465 | if (!i || prop == NULL |
2517 | #if TINTING |
2466 | #if TINTING |
… | |
… | |
2536 | Window cr; |
2485 | Window cr; |
2537 | XImage *image; |
2486 | XImage *image; |
2538 | GC gc; |
2487 | GC gc; |
2539 | XGCValues gcvalue; |
2488 | XGCValues gcvalue; |
2540 | |
2489 | |
2541 | XTranslateCoordinates (disp, parent[0], display->root, |
2490 | XTranslateCoordinates (xdisp, parent[0], display->root, |
2542 | 0, 0, &sx, &sy, &cr); |
2491 | 0, 0, &sx, &sy, &cr); |
2543 | nw = (unsigned int)szHint.width; |
2492 | nw = (unsigned int)szHint.width; |
2544 | nh = (unsigned int)szHint.height; |
2493 | nh = (unsigned int)szHint.height; |
2545 | nx = ny = 0; |
2494 | nx = ny = 0; |
2546 | |
2495 | |
… | |
… | |
2559 | } |
2508 | } |
2560 | |
2509 | |
2561 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
2510 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
2562 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
2511 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
2563 | |
2512 | |
2564 | XSync (disp, False); |
2513 | XSync (xdisp, False); |
2565 | allowedxerror = -1; |
2514 | allowedxerror = -1; |
2566 | image = XGetImage (disp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
2515 | image = XGetImage (xdisp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
2567 | |
2516 | |
2568 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
2517 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
2569 | /* XXX: may need a delay here? */ |
2518 | /* XXX: may need a delay here? */ |
2570 | allowedxerror = 0; |
2519 | allowedxerror = 0; |
2571 | |
2520 | |
… | |
… | |
2574 | if (am_transparent && am_pixmap_trans) |
2523 | if (am_transparent && am_pixmap_trans) |
2575 | { |
2524 | { |
2576 | pchanged = 1; |
2525 | pchanged = 1; |
2577 | if (pixmap != None) |
2526 | if (pixmap != None) |
2578 | { |
2527 | { |
2579 | XFreePixmap (disp, pixmap); |
2528 | XFreePixmap (xdisp, pixmap); |
2580 | pixmap = None; |
2529 | pixmap = None; |
2581 | } |
2530 | } |
2582 | } |
2531 | } |
2583 | |
2532 | |
2584 | am_pixmap_trans = 0; |
2533 | am_pixmap_trans = 0; |
2585 | } |
2534 | } |
2586 | else |
2535 | else |
2587 | { |
2536 | { |
2588 | if (pixmap != None) |
2537 | if (pixmap != None) |
2589 | XFreePixmap (disp, pixmap); |
2538 | XFreePixmap (xdisp, pixmap); |
2590 | |
2539 | |
2591 | #if TINTING |
2540 | #if TINTING |
2592 | if (ISSET_PIXCOLOR (Color_tint)) |
2541 | if (ISSET_PIXCOLOR (Color_tint)) |
2593 | { |
2542 | { |
2594 | unsigned short rm, gm, bm; |
|
|
2595 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
2543 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
2596 | |
2544 | |
|
|
2545 | rxvt_rgba c; |
2597 | pix_colors_focused[Color_tint].get (display, rm, gm, bm); |
2546 | pix_colors_focused [Color_tint].get (this, c); |
2598 | |
2547 | |
2599 | ShadeXImage (display, image, shade, rm, gm, bm); |
2548 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
2600 | } |
2549 | } |
2601 | #endif |
2550 | #endif |
2602 | |
2551 | |
2603 | pixmap = XCreatePixmap (disp, vt, |
2552 | pixmap = XCreatePixmap (xdisp, vt, szHint.width, szHint.height, image->depth); |
2604 | szHint.width, szHint.height, image->depth); |
|
|
2605 | gc = XCreateGC (disp, vt, 0UL, &gcvalue); |
2553 | gc = XCreateGC (xdisp, vt, 0UL, &gcvalue); |
2606 | XPutImage (disp, pixmap, gc, image, 0, 0, |
2554 | XPutImage (xdisp, pixmap, gc, image, 0, 0, |
2607 | nx, ny, image->width, image->height); |
2555 | nx, ny, image->width, image->height); |
2608 | XFreeGC (disp, gc); |
2556 | XFreeGC (xdisp, gc); |
2609 | XDestroyImage (image); |
2557 | XDestroyImage (image); |
2610 | XSetWindowBackgroundPixmap (disp, parent[0], pixmap); |
2558 | XSetWindowBackgroundPixmap (xdisp, parent[0], pixmap); |
2611 | XClearWindow (disp, parent[0]); |
2559 | XClearWindow (xdisp, parent[0]); |
2612 | |
2560 | |
2613 | if (!am_transparent || !am_pixmap_trans) |
2561 | if (!am_transparent || !am_pixmap_trans) |
2614 | pchanged = 1; |
2562 | pchanged = 1; |
2615 | |
2563 | |
2616 | am_transparent = am_pixmap_trans = 1; |
2564 | am_transparent = am_pixmap_trans = 1; |
2617 | } |
2565 | } |
2618 | } |
2566 | } |
2619 | |
2567 | |
2620 | if (am_pixmap_trans) |
2568 | if (am_pixmap_trans) |
2621 | XSetWindowBackgroundPixmap (disp, vt, ParentRelative); |
2569 | XSetWindowBackgroundPixmap (xdisp, vt, ParentRelative); |
2622 | else |
2570 | else |
2623 | { |
2571 | { |
2624 | unsigned int n; |
2572 | unsigned int n; |
2625 | /* |
2573 | /* |
2626 | * InheritPixmap transparency |
2574 | * InheritPixmap transparency |
2627 | */ |
2575 | */ |
2628 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2576 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2629 | { |
2577 | { |
2630 | oldp = parent[i]; |
2578 | oldp = parent[i]; |
2631 | XQueryTree (disp, parent[i - 1], &root, |
2579 | XQueryTree (xdisp, parent[i - 1], &root, |
2632 | &parent[i], &list, &n); |
2580 | &parent[i], &list, &n); |
2633 | XFree (list); |
2581 | XFree (list); |
2634 | |
2582 | |
2635 | if (parent[i] == display->root) |
2583 | if (parent[i] == display->root) |
2636 | { |
2584 | { |
… | |
… | |
2648 | |
2596 | |
2649 | if (pchanged) |
2597 | if (pchanged) |
2650 | { |
2598 | { |
2651 | for (; n < (unsigned int)i; n++) |
2599 | for (; n < (unsigned int)i; n++) |
2652 | { |
2600 | { |
2653 | XGetWindowAttributes (disp, parent[n], &wattr); |
2601 | XGetWindowAttributes (xdisp, parent[n], &wattr); |
2654 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
2602 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
2655 | { |
2603 | { |
2656 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
2604 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
2657 | break; |
2605 | break; |
2658 | } |
2606 | } |
2659 | } |
2607 | } |
2660 | } |
2608 | } |
2661 | |
2609 | |
2662 | if (n > (int) (sizeof (parent) / sizeof (parent[0]))) |
2610 | if (n > (int) (sizeof (parent) / sizeof (parent[0]))) |
2663 | { |
2611 | { |
2664 | XSetWindowBackground (disp, parent[0], pix_colors_focused[Color_border]); |
2612 | XSetWindowBackground (xdisp, parent[0], pix_colors_focused[Color_border]); |
2665 | XSetWindowBackground (disp, vt, pix_colors_focused[Color_bg]); |
2613 | XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]); |
2666 | am_transparent = 0; |
2614 | am_transparent = 0; |
2667 | /* XXX: also turn off Opt_transparent? */ |
2615 | /* XXX: also turn off Opt_transparent? */ |
2668 | } |
2616 | } |
2669 | else |
2617 | else |
2670 | { |
2618 | { |
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++) |
2619 | for (n = 0; n < (unsigned int)i; n++) |
2677 | { |
2620 | { |
2678 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2621 | XSetWindowBackgroundPixmap (xdisp, parent[n], ParentRelative); |
2679 | XClearWindow (disp, parent[n]); |
2622 | XClearWindow (xdisp, parent[n]); |
2680 | } |
2623 | } |
2681 | |
2624 | |
2682 | XSetWindowBackgroundPixmap (disp, vt, ParentRelative); |
2625 | XSetWindowBackgroundPixmap (xdisp, vt, ParentRelative); |
2683 | am_transparent = 1; |
2626 | am_transparent = 1; |
2684 | } |
2627 | } |
2685 | |
2628 | |
2686 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2629 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2687 | parent[i] = None; |
2630 | parent[i] = None; |
2688 | } |
2631 | } |
2689 | |
2632 | |
2690 | if (scrollBar.win) |
2633 | if (scrollBar.win) |
2691 | { |
2634 | { |
2692 | XSetWindowBackgroundPixmap (disp, scrollBar.win, ParentRelative); |
2635 | XSetWindowBackgroundPixmap (xdisp, scrollBar.win, ParentRelative); |
2693 | scrollBar.setIdle (); |
2636 | scrollBar.setIdle (); |
2694 | scrollbar_show (0); |
2637 | scrollbar_show (0); |
2695 | } |
2638 | } |
2696 | |
2639 | |
2697 | if (am_transparent) |
2640 | if (am_transparent) |
… | |
… | |
2709 | |
2652 | |
2710 | bool |
2653 | bool |
2711 | rxvt_term::cmd_parse () |
2654 | rxvt_term::cmd_parse () |
2712 | { |
2655 | { |
2713 | bool flag = false; |
2656 | bool flag = false; |
2714 | unicode_t ch = NOCHAR; |
2657 | wchar_t ch = NOCHAR; |
2715 | char *seq_begin; // remember start of esc-sequence here |
2658 | char *seq_begin; // remember start of esc-sequence here |
2716 | |
2659 | |
2717 | for (;;) |
2660 | for (;;) |
2718 | { |
2661 | { |
2719 | if (ch == NOCHAR) |
2662 | if (ch == NOCHAR) |
… | |
… | |
2740 | if (seen_resize && cmd_pid) |
2683 | if (seen_resize && cmd_pid) |
2741 | kill (-cmd_pid, SIGWINCH); |
2684 | kill (-cmd_pid, SIGWINCH); |
2742 | } |
2685 | } |
2743 | |
2686 | |
2744 | /* Read a text string from the input buffer */ |
2687 | /* Read a text string from the input buffer */ |
2745 | unicode_t buf[UBUFSIZ]; |
2688 | wchar_t buf[UBUFSIZ]; |
2746 | bool refreshnow = false; |
2689 | bool refreshnow = false; |
2747 | int nlines = 0; |
2690 | int nlines = 0; |
2748 | unicode_t *str = buf; |
2691 | wchar_t *str = buf; |
2749 | unicode_t *eol = str + min (ncol, UBUFSIZ); |
2692 | wchar_t *eol = str + min (ncol, UBUFSIZ); |
2750 | |
2693 | |
2751 | for (;;) |
2694 | for (;;) |
2752 | { |
2695 | { |
2753 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2696 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2754 | break; |
2697 | break; |
… | |
… | |
2772 | } |
2715 | } |
2773 | |
2716 | |
2774 | // scr_add_lines only works for nlines <= nrow - 1. |
2717 | // scr_add_lines only works for nlines <= nrow - 1. |
2775 | if (nlines >= nrow - 1) |
2718 | if (nlines >= nrow - 1) |
2776 | { |
2719 | { |
|
|
2720 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
2777 | if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_USTRING_LEN, buf, str - buf, DT_END))) |
2721 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2778 | scr_add_lines (buf, nlines, str - buf); |
2722 | scr_add_lines (buf, str - buf, nlines); |
2779 | |
2723 | |
2780 | nlines = 0; |
2724 | nlines = 0; |
2781 | str = buf; |
2725 | str = buf; |
2782 | eol = str + min (ncol, UBUFSIZ); |
2726 | eol = str + min (ncol, UBUFSIZ); |
2783 | } |
2727 | } |
… | |
… | |
2797 | |
2741 | |
2798 | seq_begin = cmdbuf_ptr; |
2742 | seq_begin = cmdbuf_ptr; |
2799 | ch = next_char (); |
2743 | ch = next_char (); |
2800 | } |
2744 | } |
2801 | |
2745 | |
|
|
2746 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
2802 | if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_USTRING_LEN, buf, str - buf, DT_END))) |
2747 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2803 | scr_add_lines (buf, nlines, str - buf); |
2748 | scr_add_lines (buf, str - buf, nlines); |
2804 | |
2749 | |
2805 | /* |
2750 | /* |
2806 | * If there have been a lot of new lines, then update the screen |
2751 | * 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. |
2752 | * 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 |
2753 | * the number of pages between refreshes is refresh_limit, which |
… | |
… | |
2813 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2758 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2814 | refresh_limit++; |
2759 | refresh_limit++; |
2815 | else |
2760 | else |
2816 | { |
2761 | { |
2817 | flag = true; |
2762 | flag = true; |
2818 | scr_refresh (refresh_type); |
2763 | scr_refresh (); |
2819 | flush_ev.stop (); |
2764 | want_refresh = 1; |
2820 | } |
2765 | } |
2821 | } |
2766 | } |
2822 | |
2767 | |
2823 | } |
2768 | } |
2824 | else |
2769 | else |
… | |
… | |
2839 | } |
2784 | } |
2840 | |
2785 | |
2841 | return flag; |
2786 | return flag; |
2842 | } |
2787 | } |
2843 | |
2788 | |
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 |
2789 | // read the next character |
2854 | unicode_t |
2790 | wchar_t |
2855 | rxvt_term::next_char () |
2791 | rxvt_term::next_char () NOTHROW |
2856 | { |
2792 | { |
2857 | while (cmdbuf_ptr < cmdbuf_endp) |
2793 | while (cmdbuf_ptr < cmdbuf_endp) |
2858 | { |
2794 | { |
2859 | // assume 7-bit to be ascii ALWAYS |
2795 | // assume 7-bit to be ascii ALWAYS |
2860 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2796 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
… | |
… | |
2869 | cmdbuf_ptr = cmdbuf_endp; |
2805 | cmdbuf_ptr = cmdbuf_endp; |
2870 | break; |
2806 | break; |
2871 | } |
2807 | } |
2872 | |
2808 | |
2873 | if (len == (size_t)-1) |
2809 | if (len == (size_t)-1) |
2874 | return *cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2810 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2875 | |
2811 | |
2876 | // assume wchar == unicode |
2812 | // assume wchar == unicode |
2877 | cmdbuf_ptr += len; |
2813 | cmdbuf_ptr += len; |
2878 | return wc & UNICODE_MASK; |
2814 | return wc & UNICODE_MASK; |
2879 | } |
2815 | } |
2880 | |
2816 | |
2881 | return NOCHAR; |
2817 | return NOCHAR; |
2882 | } |
2818 | } |
|
|
2819 | |
|
|
2820 | // read the next octet |
|
|
2821 | uint32_t |
|
|
2822 | rxvt_term::next_octet () NOTHROW |
|
|
2823 | { |
|
|
2824 | return cmdbuf_ptr < cmdbuf_endp |
|
|
2825 | ? (unsigned char)*cmdbuf_ptr++ |
|
|
2826 | : NOCHAR; |
|
|
2827 | } |
|
|
2828 | |
|
|
2829 | static class out_of_input out_of_input; |
2883 | |
2830 | |
2884 | /* rxvt_cmd_getc () - Return next input character */ |
2831 | /* rxvt_cmd_getc () - Return next input character */ |
2885 | /* |
2832 | /* |
2886 | * Return the next input character after first passing any keyboard input |
2833 | * Return the next input character after first passing any keyboard input |
2887 | * to the command. |
2834 | * to the command. |
2888 | */ |
2835 | */ |
2889 | unicode_t |
2836 | wchar_t |
2890 | rxvt_term::cmd_getc () |
2837 | rxvt_term::cmd_getc () THROW ((class out_of_input)) |
2891 | { |
2838 | { |
2892 | unicode_t c = next_char (); |
2839 | wchar_t c = next_char (); |
2893 | |
2840 | |
2894 | if (c == NOCHAR) |
2841 | if (c == NOCHAR) |
2895 | throw out_of_input; |
2842 | throw out_of_input; |
2896 | |
2843 | |
2897 | return c; |
2844 | return c; |
2898 | } |
2845 | } |
2899 | |
2846 | |
2900 | unicode_t |
2847 | uint32_t |
2901 | rxvt_term::cmd_get8 () |
2848 | rxvt_term::cmd_get8 () THROW ((class out_of_input)) |
2902 | { |
2849 | { |
2903 | unicode_t c = next_octet (); |
2850 | uint32_t c = next_octet (); |
2904 | |
2851 | |
2905 | if (c == NOCHAR) |
2852 | if (c == NOCHAR) |
2906 | throw out_of_input; |
2853 | throw out_of_input; |
2907 | |
2854 | |
2908 | return c; |
2855 | return c; |
… | |
… | |
3144 | scr_charset_set (2, (unsigned int)cmd_getc ()); |
3091 | scr_charset_set (2, (unsigned int)cmd_getc ()); |
3145 | break; |
3092 | break; |
3146 | case '+': |
3093 | case '+': |
3147 | scr_charset_set (3, (unsigned int)cmd_getc ()); |
3094 | scr_charset_set (3, (unsigned int)cmd_getc ()); |
3148 | break; |
3095 | break; |
3149 | #if ENABLE_FRILLS |
3096 | #if !ENABLE_MINIMAL |
3150 | case '6': |
3097 | case '6': |
3151 | scr_backindex (); |
3098 | scr_backindex (); |
3152 | break; |
3099 | break; |
3153 | #endif |
3100 | #endif |
3154 | case '7': |
3101 | case '7': |
3155 | scr_cursor (SAVE); |
3102 | scr_cursor (SAVE); |
3156 | break; |
3103 | break; |
3157 | case '8': |
3104 | case '8': |
3158 | scr_cursor (RESTORE); |
3105 | scr_cursor (RESTORE); |
3159 | break; |
3106 | break; |
3160 | #if ENABLE_FRILLS |
3107 | #if !ENABLE_MINIMAL |
3161 | case '9': |
3108 | case '9': |
3162 | scr_forwardindex (); |
3109 | scr_forwardindex (); |
3163 | break; |
3110 | break; |
3164 | #endif |
3111 | #endif |
3165 | case '=': |
3112 | case '=': |
… | |
… | |
3175 | break; |
3122 | break; |
3176 | |
3123 | |
3177 | /* 8.3.87: NEXT LINE */ |
3124 | /* 8.3.87: NEXT LINE */ |
3178 | case C1_NEL: /* ESC E */ |
3125 | case C1_NEL: /* ESC E */ |
3179 | { |
3126 | { |
3180 | unicode_t nlcr[] = { C0_LF, C0_CR }; |
3127 | wchar_t nlcr[] = { C0_LF, C0_CR }; |
3181 | scr_add_lines (nlcr, 1, 2); |
3128 | scr_add_lines (nlcr, sizeof (nlcr) / sizeof (nlcr [0]), 1); |
3182 | } |
3129 | } |
3183 | break; |
3130 | break; |
3184 | |
3131 | |
3185 | /* kidnapped escape sequence: Should be 8.3.48 */ |
3132 | /* kidnapped escape sequence: Should be 8.3.48 */ |
3186 | case C1_ESA: /* ESC G */ |
3133 | case C1_ESA: /* ESC G */ |
… | |
… | |
3327 | ndef = get_byte_array_bit (csi_defaults, i); |
3274 | ndef = get_byte_array_bit (csi_defaults, i); |
3328 | for (p = 0; p < nargs; p++) |
3275 | for (p = 0; p < nargs; p++) |
3329 | if (arg[p] == -1) |
3276 | if (arg[p] == -1) |
3330 | arg[p] = ndef; |
3277 | arg[p] = ndef; |
3331 | |
3278 | |
3332 | #ifdef DEBUG_CMD |
|
|
3333 | fprintf (stderr, "CSI "); |
|
|
3334 | for (p = 0; p < nargs; p++) |
|
|
3335 | fprintf (stderr, "%d%s", arg[p], p < nargs - 1 ? ";" : ""); |
|
|
3336 | fprintf (stderr, "%c\n", ch); |
|
|
3337 | #endif |
|
|
3338 | |
|
|
3339 | /* |
3279 | /* |
3340 | * private mode handling |
3280 | * private mode handling |
3341 | */ |
3281 | */ |
3342 | if (priv) |
3282 | if (priv) |
3343 | { |
3283 | { |
3344 | switch (priv) |
3284 | switch (priv) |
3345 | { |
3285 | { |
3346 | case '>': |
3286 | case '>': |
3347 | if (ch == CSI_DA) /* secondary device attributes */ |
3287 | if (ch == CSI_DA) /* secondary device attributes */ |
3348 | tt_printf ("\033[>%d;%c%c;0c", 'U', VERSION[0], VERSION[2]); |
3288 | { |
|
|
3289 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
|
|
3290 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
|
|
3291 | // |
|
|
3292 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
|
|
3293 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
|
|
3294 | // that we do not support xterm mouse reporting (should be 95 when we do). |
|
|
3295 | // |
|
|
3296 | tt_printf ("\033[>%d;94;0c", 'U'); |
|
|
3297 | } |
3349 | break; |
3298 | break; |
3350 | case '?': |
3299 | case '?': |
3351 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3300 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3352 | process_terminal_mode (ch, priv, nargs, arg); |
3301 | process_terminal_mode (ch, priv, nargs, arg); |
3353 | break; |
3302 | break; |
… | |
… | |
3556 | break; |
3505 | break; |
3557 | case CSI_75: |
3506 | case CSI_75: |
3558 | scr_cursor (RESTORE); |
3507 | scr_cursor (RESTORE); |
3559 | break; |
3508 | break; |
3560 | |
3509 | |
3561 | #if ENABLE_FRILLS |
3510 | #if !ENABLE_MINIMAL |
3562 | case CSI_74: |
3511 | case CSI_74: |
3563 | process_window_ops (arg, nargs); |
3512 | process_window_ops (arg, nargs); |
3564 | break; |
3513 | break; |
3565 | #endif |
3514 | #endif |
3566 | |
3515 | |
… | |
… | |
3573 | break; |
3522 | break; |
3574 | } |
3523 | } |
3575 | } |
3524 | } |
3576 | /*}}} */ |
3525 | /*}}} */ |
3577 | |
3526 | |
3578 | #if ENABLE_FRILLS |
3527 | #if !ENABLE_MINIMAL |
3579 | /* ARGSUSED */ |
3528 | /* ARGSUSED */ |
3580 | void |
3529 | void |
3581 | rxvt_term::process_window_ops (const int *args, unsigned int nargs) |
3530 | rxvt_term::process_window_ops (const int *args, unsigned int nargs) |
3582 | { |
3531 | { |
3583 | int x, y; |
3532 | int x, y; |
3584 | XWindowAttributes wattr; |
3533 | XWindowAttributes wattr; |
3585 | Window wdummy; |
3534 | Window wdummy; |
3586 | dDisp; |
3535 | |
|
|
3536 | dLocal (Display *, xdisp); |
3587 | |
3537 | |
3588 | if (nargs == 0) |
3538 | if (nargs == 0) |
3589 | return; |
3539 | return; |
3590 | |
3540 | |
3591 | switch (args[0]) |
3541 | switch (args[0]) |
3592 | { |
3542 | { |
3593 | /* |
3543 | /* |
3594 | * commands |
3544 | * commands |
3595 | */ |
3545 | */ |
3596 | case 1: /* deiconify window */ |
3546 | case 1: /* deiconify window */ |
3597 | XMapWindow (disp, parent[0]); |
3547 | XMapWindow (xdisp, parent[0]); |
3598 | break; |
3548 | break; |
3599 | case 2: /* iconify window */ |
3549 | case 2: /* iconify window */ |
3600 | XIconifyWindow (disp, parent[0], display->screen); |
3550 | XIconifyWindow (xdisp, parent[0], display->screen); |
3601 | break; |
3551 | break; |
3602 | case 3: /* set position (pixels) */ |
3552 | case 3: /* set position (pixels) */ |
3603 | XMoveWindow (disp, parent[0], args[1], args[2]); |
3553 | XMoveWindow (xdisp, parent[0], args[1], args[2]); |
3604 | break; |
3554 | break; |
3605 | case 4: /* set size (pixels) */ |
3555 | case 4: /* set size (pixels) */ |
3606 | set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); |
3556 | set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); |
3607 | break; |
3557 | break; |
3608 | case 5: /* raise window */ |
3558 | case 5: /* raise window */ |
3609 | XRaiseWindow (disp, parent[0]); |
3559 | XRaiseWindow (xdisp, parent[0]); |
3610 | break; |
3560 | break; |
3611 | case 6: /* lower window */ |
3561 | case 6: /* lower window */ |
3612 | XLowerWindow (disp, parent[0]); |
3562 | XLowerWindow (xdisp, parent[0]); |
3613 | break; |
3563 | break; |
3614 | case 7: /* refresh window */ |
3564 | case 7: /* refresh window */ |
3615 | scr_touch (true); |
3565 | scr_touch (true); |
3616 | break; |
3566 | break; |
3617 | case 8: /* set size (chars) */ |
3567 | case 8: /* set size (chars) */ |
… | |
… | |
3629 | |
3579 | |
3630 | /* |
3580 | /* |
3631 | * reports - some output format copied from XTerm |
3581 | * reports - some output format copied from XTerm |
3632 | */ |
3582 | */ |
3633 | case 11: /* report window state */ |
3583 | case 11: /* report window state */ |
3634 | XGetWindowAttributes (disp, parent[0], &wattr); |
3584 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3635 | tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); |
3585 | tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); |
3636 | break; |
3586 | break; |
3637 | case 13: /* report window position */ |
3587 | case 13: /* report window position */ |
3638 | XGetWindowAttributes (disp, parent[0], &wattr); |
3588 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3639 | XTranslateCoordinates (disp, parent[0], wattr.root, |
3589 | XTranslateCoordinates (xdisp, parent[0], wattr.root, |
3640 | -wattr.border_width, -wattr.border_width, |
3590 | -wattr.border_width, -wattr.border_width, |
3641 | &x, &y, &wdummy); |
3591 | &x, &y, &wdummy); |
3642 | tt_printf ("\033[3;%d;%dt", x, y); |
3592 | tt_printf ("\033[3;%d;%dt", x, y); |
3643 | break; |
3593 | break; |
3644 | case 14: /* report window size (pixels) */ |
3594 | case 14: /* report window size (pixels) */ |
3645 | XGetWindowAttributes (disp, parent[0], &wattr); |
3595 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3646 | tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); |
3596 | tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); |
3647 | break; |
3597 | break; |
3648 | case 18: /* report text area size (chars) */ |
3598 | case 18: /* report text area size (chars) */ |
3649 | tt_printf ("\033[8;%d;%dt", nrow, ncol); |
3599 | tt_printf ("\033[8;%d;%dt", nrow, ncol); |
3650 | break; |
3600 | break; |
… | |
… | |
3652 | tt_printf ("\033[9;%d;%dt", nrow, ncol); |
3602 | tt_printf ("\033[9;%d;%dt", nrow, ncol); |
3653 | break; |
3603 | break; |
3654 | case 20: /* report icon label */ |
3604 | case 20: /* report icon label */ |
3655 | { |
3605 | { |
3656 | char *s; |
3606 | char *s; |
3657 | XGetIconName (disp, parent[0], &s); |
3607 | XGetIconName (xdisp, parent[0], &s); |
3658 | tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3608 | tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3659 | XFree (s); |
3609 | XFree (s); |
3660 | } |
3610 | } |
3661 | break; |
3611 | break; |
3662 | case 21: /* report window title */ |
3612 | case 21: /* report window title */ |
3663 | { |
3613 | { |
3664 | char *s; |
3614 | char *s; |
3665 | XFetchName (disp, parent[0], &s); |
3615 | XFetchName (xdisp, parent[0], &s); |
3666 | tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3616 | tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3667 | XFree (s); |
3617 | XFree (s); |
3668 | } |
3618 | } |
3669 | break; |
3619 | break; |
3670 | } |
3620 | } |
… | |
… | |
3771 | void |
3721 | void |
3772 | rxvt_term::process_color_seq (int report, int color, const char *str, char resp) |
3722 | rxvt_term::process_color_seq (int report, int color, const char *str, char resp) |
3773 | { |
3723 | { |
3774 | if (str[0] == '?' && !str[1]) |
3724 | if (str[0] == '?' && !str[1]) |
3775 | { |
3725 | { |
3776 | unsigned short r, g, b; |
3726 | rxvt_rgba c; |
3777 | pix_colors_focused[color].get (display, r, g, b); |
3727 | pix_colors_focused[color].get (this, c); |
|
|
3728 | |
|
|
3729 | #if XFT |
|
|
3730 | if (c.a != rxvt_rgba::MAX_CC) |
|
|
3731 | tt_printf ("\033]%d;rgba:%04x/%04x/%04x/%04x%c", report, c.a, c.r, c.g, c.b, resp); |
|
|
3732 | else |
|
|
3733 | #endif |
3778 | tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, r, g, b, resp); |
3734 | tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, c.r, c.g, c.b, resp); |
3779 | } |
3735 | } |
3780 | else |
3736 | else |
3781 | set_window_color (color, str); |
3737 | set_window_color (color, str); |
3782 | } |
3738 | } |
3783 | |
3739 | |
… | |
… | |
3785 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3741 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3786 | */ |
3742 | */ |
3787 | void |
3743 | void |
3788 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3744 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3789 | { |
3745 | { |
3790 | int changed = 0; |
|
|
3791 | int color; |
3746 | int color; |
3792 | char *buf, *name; |
3747 | char *buf, *name; |
3793 | bool query = str[0] == '?' && !str[1]; |
3748 | bool query = str[0] == '?' && !str[1]; |
3794 | int saveop = op; |
3749 | int saveop = op; |
3795 | dDisp; |
3750 | |
|
|
3751 | dLocal (Display *, xdisp); |
3796 | |
3752 | |
3797 | assert (str != NULL); |
3753 | assert (str != NULL); |
3798 | switch (op) |
3754 | switch (op) |
3799 | { |
3755 | { |
3800 | case XTerm_name: |
3756 | case XTerm_name: |
… | |
… | |
3816 | unsigned long bytes_after; |
3772 | unsigned long bytes_after; |
3817 | unsigned char *value = 0; |
3773 | unsigned char *value = 0; |
3818 | const char *str = ""; |
3774 | const char *str = ""; |
3819 | |
3775 | |
3820 | if (prop |
3776 | if (prop |
3821 | && XGetWindowProperty (disp, parent[0], |
3777 | && XGetWindowProperty (xdisp, parent[0], |
3822 | prop, 0, 1<<16, 0, AnyPropertyType, |
3778 | prop, 0, 1<<16, 0, AnyPropertyType, |
3823 | &actual_type, &actual_format, |
3779 | &actual_type, &actual_format, |
3824 | &nitems, &bytes_after, &value) == Success |
3780 | &nitems, &bytes_after, &value) == Success |
3825 | && actual_type != None |
3781 | && actual_type != None |
3826 | && actual_format == 8) |
3782 | && actual_format == 8) |
3827 | str = (const char *)(value); |
3783 | str = (const char *)(value); |
3828 | |
3784 | |
3829 | tt_printf ("\033]%d;%s%c", XTerm_property, str, resp); |
3785 | tt_printf ("\033]%d;%s%c", op, str, resp); |
3830 | |
3786 | |
3831 | XFree (value); |
3787 | XFree (value); |
3832 | } |
3788 | } |
3833 | else |
3789 | else |
3834 | { |
3790 | { |
… | |
… | |
3838 | { |
3794 | { |
3839 | *eq = 0; |
3795 | *eq = 0; |
3840 | set_utf8_property (display->atom (str), eq + 1); |
3796 | set_utf8_property (display->atom (str), eq + 1); |
3841 | } |
3797 | } |
3842 | else |
3798 | else |
3843 | XDeleteProperty (disp, parent[0], |
3799 | XDeleteProperty (xdisp, parent[0], |
3844 | display->atom (str)); |
3800 | display->atom (str)); |
3845 | } |
3801 | } |
3846 | break; |
3802 | break; |
3847 | |
3803 | |
3848 | case XTerm_Color: |
3804 | case XTerm_Color: |
… | |
… | |
3850 | { |
3806 | { |
3851 | if ((name = strchr (buf, ';')) == NULL) |
3807 | if ((name = strchr (buf, ';')) == NULL) |
3852 | break; |
3808 | break; |
3853 | |
3809 | |
3854 | *name++ = '\0'; |
3810 | *name++ = '\0'; |
3855 | color = atoi (buf); |
3811 | color = atoi (buf) + minCOLOR; |
3856 | |
3812 | |
3857 | if (color < 0 || color >= TOTAL_COLORS) |
3813 | if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) |
3858 | break; |
3814 | break; |
3859 | |
3815 | |
3860 | if ((buf = strchr (name, ';')) != NULL) |
3816 | if ((buf = strchr (name, ';')) != NULL) |
3861 | *buf++ = '\0'; |
3817 | *buf++ = '\0'; |
3862 | |
3818 | |
3863 | if (name[0] == '?' && !name[1]) |
3819 | process_color_seq (op, color, name, resp); |
3864 | { |
|
|
3865 | unsigned short r, g, b; |
|
|
3866 | pix_colors_focused[color + minCOLOR].get (display, r, g, b); |
|
|
3867 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
|
|
3868 | } |
|
|
3869 | else |
|
|
3870 | set_window_color (color + minCOLOR, name); |
|
|
3871 | } |
3820 | } |
3872 | break; |
3821 | break; |
3873 | case XTerm_Color00: |
3822 | case XTerm_Color00: |
3874 | process_color_seq (XTerm_Color00, Color_fg, str, resp); |
3823 | process_color_seq (op, Color_fg, str, resp); |
3875 | break; |
3824 | break; |
3876 | case XTerm_Color01: |
3825 | case XTerm_Color01: |
3877 | process_color_seq (XTerm_Color00, Color_bg, str, resp); |
3826 | process_color_seq (op, Color_bg, str, resp); |
3878 | break; |
3827 | break; |
3879 | #ifndef NO_CURSORCOLOR |
3828 | #ifndef NO_CURSORCOLOR |
3880 | case XTerm_Color_cursor: |
3829 | case XTerm_Color_cursor: |
3881 | process_color_seq (XTerm_Color_cursor, Color_cursor, str, resp); |
3830 | process_color_seq (op, Color_cursor, str, resp); |
3882 | break; |
3831 | break; |
3883 | #endif |
3832 | #endif |
3884 | case XTerm_Color_pointer_fg: |
3833 | case XTerm_Color_pointer_fg: |
3885 | process_color_seq (XTerm_Color_pointer_fg, Color_pointer_fg, str, resp); |
3834 | process_color_seq (op, Color_pointer_fg, str, resp); |
3886 | break; |
3835 | break; |
3887 | case XTerm_Color_pointer_bg: |
3836 | case XTerm_Color_pointer_bg: |
3888 | process_color_seq (XTerm_Color_pointer_bg, Color_pointer_bg, str, resp); |
3837 | process_color_seq (op, Color_pointer_bg, str, resp); |
3889 | break; |
3838 | break; |
3890 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3839 | #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: |
3840 | case XTerm_Color_RV: |
3898 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
3841 | process_color_seq (op, Color_RV, str, resp); |
|
|
3842 | break; |
|
|
3843 | case Rxvt_Color_BD: |
|
|
3844 | case URxvt_Color_BD: |
|
|
3845 | process_color_seq (op, Color_BD, str, resp); |
|
|
3846 | break; |
|
|
3847 | case Rxvt_Color_UL: |
|
|
3848 | case URxvt_Color_UL: |
|
|
3849 | process_color_seq (op, Color_UL, str, resp); |
3899 | break; |
3850 | break; |
3900 | case URxvt_Color_IT: |
3851 | case URxvt_Color_IT: |
3901 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
3852 | process_color_seq (op, Color_IT, str, resp); |
3902 | break; |
3853 | break; |
3903 | #endif |
3854 | #endif |
3904 | #if TRANSPARENT && TINTING |
3855 | #if TRANSPARENT && TINTING |
3905 | case URxvt_Color_tint: |
3856 | case URxvt_Color_tint: |
3906 | process_color_seq (URxvt_Color_tint, Color_tint, str, resp); |
3857 | process_color_seq (op, Color_tint, str, resp); |
3907 | check_our_parents (); |
3858 | check_our_parents (); |
3908 | if (am_transparent) |
3859 | if (am_transparent) |
3909 | want_full_refresh = want_refresh = 1; |
3860 | want_full_refresh = want_refresh = 1; |
3910 | break; |
3861 | break; |
3911 | #endif |
3862 | #endif |
3912 | |
3863 | |
3913 | case XTerm_Pixmap: |
3864 | case Rxvt_Pixmap: |
|
|
3865 | { |
3914 | if (*str != ';') |
3866 | if (*str != ';') |
3915 | { |
3867 | { |
3916 | #if XPM_BACKGROUND |
3868 | #if XPM_BACKGROUND |
3917 | scale_pixmap (""); /* reset to default scaling */ |
3869 | scale_pixmap (""); /* reset to default scaling */ |
3918 | set_bgPixmap (str); /* change pixmap */ |
3870 | set_bgPixmap (str); /* change pixmap */ |
3919 | #endif |
|
|
3920 | scr_touch (true); |
3871 | scr_touch (true); |
|
|
3872 | #endif |
3921 | } |
3873 | } |
|
|
3874 | |
|
|
3875 | int changed = 0; |
|
|
3876 | |
3922 | while ((str = strchr (str, ';')) != NULL) |
3877 | while ((str = strchr (str, ';')) != NULL) |
3923 | { |
3878 | { |
3924 | str++; |
3879 | str++; |
3925 | #if XPM_BACKGROUND |
3880 | #if XPM_BACKGROUND |
3926 | changed += scale_pixmap (str); |
3881 | changed += scale_pixmap (str); |
3927 | #endif |
3882 | #endif |
3928 | } |
3883 | } |
3929 | |
3884 | |
3930 | if (changed) |
3885 | if (changed) |
3931 | { |
3886 | { |
3932 | #ifdef XPM_BACKGROUND |
3887 | #ifdef XPM_BACKGROUND |
3933 | resize_pixmap (); |
3888 | resize_pixmap (); |
3934 | #endif |
|
|
3935 | scr_touch (true); |
3889 | scr_touch (true); |
|
|
3890 | #endif |
3936 | } |
3891 | } |
|
|
3892 | } |
3937 | break; |
3893 | break; |
3938 | |
3894 | |
3939 | case XTerm_restoreFG: |
3895 | case Rxvt_restoreFG: |
3940 | set_window_color (Color_fg, str); |
3896 | set_window_color (Color_fg, str); |
3941 | break; |
3897 | break; |
3942 | case XTerm_restoreBG: |
3898 | case Rxvt_restoreBG: |
3943 | set_window_color (Color_bg, str); |
3899 | set_window_color (Color_bg, str); |
3944 | break; |
3900 | break; |
3945 | |
3901 | |
3946 | case XTerm_logfile: |
3902 | case XTerm_logfile: |
3947 | // TODO, when secure mode? |
3903 | // TODO, when secure mode? |
3948 | break; |
3904 | break; |
3949 | |
3905 | |
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 |
3906 | #if 0 |
3957 | case XTerm_dumpscreen: /* no error notices */ |
3907 | case Rxvt_dumpscreen: /* no error notices */ |
3958 | { |
3908 | { |
3959 | int fd; |
3909 | int fd; |
3960 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3910 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3961 | { |
3911 | { |
3962 | scr_dump (fd); |
3912 | scr_dump (fd); |
… | |
… | |
3986 | allocated.push_back ((void *)res); |
3936 | allocated.push_back ((void *)res); |
3987 | set_fonts (); |
3937 | set_fonts (); |
3988 | } |
3938 | } |
3989 | break; |
3939 | break; |
3990 | |
3940 | |
3991 | #if ENABLE_FRILLS |
3941 | case URxvt_version: |
|
|
3942 | if (query) |
|
|
3943 | tt_printf ("\33]%d;rxvt-unicode;%-.20s;%c;%c%c", |
|
|
3944 | op, |
|
|
3945 | rs[Rs_name], VERSION[0], VERSION[2], |
|
|
3946 | resp); |
|
|
3947 | break; |
|
|
3948 | |
|
|
3949 | #if !ENABLE_MINIMAL |
3992 | case URxvt_locale: |
3950 | case URxvt_locale: |
3993 | if (query) |
3951 | if (query) |
3994 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); |
3952 | tt_printf ("\33]%d;%-.250s%c", op, OPTION (Opt_insecure) ? locale : "", resp); |
3995 | else |
3953 | else |
3996 | { |
3954 | { |
3997 | set_locale (str); |
3955 | set_locale (str); |
3998 | pty.set_utf8_mode (enc_utf8); |
3956 | pty->set_utf8_mode (enc_utf8); |
3999 | init_xlocale (); |
3957 | init_xlocale (); |
4000 | } |
3958 | } |
4001 | break; |
3959 | break; |
4002 | |
3960 | |
4003 | case URxvt_view_up: |
3961 | case URxvt_view_up: |
… | |
… | |
4014 | break; |
3972 | break; |
4015 | #endif |
3973 | #endif |
4016 | |
3974 | |
4017 | #if ENABLE_PERL |
3975 | #if ENABLE_PERL |
4018 | case URxvt_perl: |
3976 | case URxvt_perl: |
4019 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_STRING, str, DT_END))) |
3977 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_STR, str, DT_END))) |
4020 | ; // no responses yet |
3978 | ; // no responses yet |
4021 | break; |
3979 | break; |
4022 | #endif |
3980 | #endif |
4023 | } |
3981 | } |
4024 | } |
3982 | } |
… | |
… | |
4056 | return state; |
4014 | return state; |
4057 | } |
4015 | } |
4058 | |
4016 | |
4059 | /* we're not using priv _yet_ */ |
4017 | /* we're not using priv _yet_ */ |
4060 | void |
4018 | void |
4061 | rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) |
4019 | rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg) |
4062 | { |
4020 | { |
4063 | unsigned int i, j; |
4021 | unsigned int i, j; |
4064 | int state; |
4022 | int state; |
4065 | |
4023 | |
4066 | static const struct |
4024 | static const struct |
… | |
… | |
4077 | { 5, PrivMode_rVideo }, |
4035 | { 5, PrivMode_rVideo }, |
4078 | { 6, PrivMode_relOrigin }, |
4036 | { 6, PrivMode_relOrigin }, |
4079 | { 7, PrivMode_Autowrap }, |
4037 | { 7, PrivMode_Autowrap }, |
4080 | // 8, bi-directional support mode |
4038 | // 8, bi-directional support mode |
4081 | { 9, PrivMode_MouseX10 }, |
4039 | { 9, PrivMode_MouseX10 }, |
4082 | #ifdef menuBar_esc |
|
|
4083 | { menuBar_esc, PrivMode_menuBar }, |
|
|
4084 | #endif |
|
|
4085 | // 18, 19 printing-related |
4040 | // 18, 19 printing-related |
4086 | { 25, PrivMode_VisibleCursor }, |
4041 | { 25, PrivMode_VisibleCursor }, |
4087 | #ifdef scrollBar_esc |
4042 | #ifdef scrollBar_esc |
4088 | { scrollBar_esc, PrivMode_scrollBar }, |
4043 | { scrollBar_esc, PrivMode_scrollBar }, |
4089 | #endif |
4044 | #endif |
… | |
… | |
4136 | /* extra handling for values with state unkept */ |
4091 | /* extra handling for values with state unkept */ |
4137 | switch (arg[i]) |
4092 | switch (arg[i]) |
4138 | { |
4093 | { |
4139 | #if ENABLE_STYLES |
4094 | #if ENABLE_STYLES |
4140 | case 1021: |
4095 | case 1021: |
4141 | if (mode) |
4096 | set_option (Opt_intensityStyles, mode); |
4142 | SET_OPTION (Opt_intensityStyles); |
|
|
4143 | else |
|
|
4144 | CLR_OPTION (Opt_intensityStyles); |
|
|
4145 | |
4097 | |
4146 | scr_touch (true); |
4098 | scr_touch (true); |
4147 | break; |
4099 | break; |
4148 | #endif |
4100 | #endif |
4149 | case 1048: /* alternative cursor save */ |
4101 | case 1048: /* alternative cursor save */ |
… | |
… | |
4171 | case 3: /* 80/132 */ |
4123 | case 3: /* 80/132 */ |
4172 | if (priv_modes & PrivMode_132OK) |
4124 | if (priv_modes & PrivMode_132OK) |
4173 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4125 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4174 | break; |
4126 | break; |
4175 | case 4: /* smooth scrolling */ |
4127 | case 4: /* smooth scrolling */ |
4176 | if (!state) |
4128 | set_option (Opt_jumpScroll, !state); |
4177 | SET_OPTION (Opt_jumpScroll); |
|
|
4178 | else |
|
|
4179 | CLR_OPTION (Opt_jumpScroll); |
|
|
4180 | break; |
4129 | break; |
4181 | case 5: /* reverse video */ |
4130 | case 5: /* reverse video */ |
4182 | scr_rvideo_mode (state); |
4131 | scr_rvideo_mode (state); |
4183 | break; |
4132 | break; |
4184 | case 6: /* relative/absolute origins */ |
4133 | case 6: /* relative/absolute origins */ |
… | |
… | |
4190 | /* case 8: - auto repeat, can't do on a per window basis */ |
4139 | /* case 8: - auto repeat, can't do on a per window basis */ |
4191 | case 9: /* X10 mouse reporting */ |
4140 | case 9: /* X10 mouse reporting */ |
4192 | if (state) /* orthogonal */ |
4141 | if (state) /* orthogonal */ |
4193 | priv_modes &= ~PrivMode_MouseX11; |
4142 | priv_modes &= ~PrivMode_MouseX11; |
4194 | break; |
4143 | 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 |
4144 | #ifdef scrollBar_esc |
4203 | case scrollBar_esc: |
4145 | case scrollBar_esc: |
4204 | if (scrollbar_mapping (state)) |
4146 | if (scrollbar_mapping (state)) |
4205 | { |
4147 | { |
4206 | resize_all_windows (0, 0, 0); |
4148 | resize_all_windows (0, 0, 0); |
… | |
… | |
4225 | #if 0 |
4167 | #if 0 |
4226 | case 1001: |
4168 | case 1001: |
4227 | break; /* X11 mouse highlighting */ |
4169 | break; /* X11 mouse highlighting */ |
4228 | #endif |
4170 | #endif |
4229 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4171 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4230 | if (!state) |
4172 | set_option (Opt_scrollTtyOutput, !state); |
4231 | SET_OPTION (Opt_scrollTtyOutput); |
|
|
4232 | else |
|
|
4233 | CLR_OPTION (Opt_scrollTtyOutput); |
|
|
4234 | break; |
4173 | break; |
4235 | case 1011: /* scroll to bottom on key press */ |
4174 | case 1011: /* scroll to bottom on key press */ |
4236 | if (state) |
4175 | set_option (Opt_scrollTtyKeypress, state); |
4237 | SET_OPTION (Opt_scrollTtyKeypress); |
|
|
4238 | else |
|
|
4239 | CLR_OPTION (Opt_scrollTtyKeypress); |
|
|
4240 | break; |
4176 | break; |
4241 | case 1047: /* secondary screen w/ clearing last */ |
4177 | case 1047: /* secondary screen w/ clearing last */ |
4242 | if (OPTION (Opt_secondaryScreen)) |
4178 | if (OPTION (Opt_secondaryScreen)) |
4243 | if (current_screen != PRIMARY) |
4179 | if (current_screen != PRIMARY) |
4244 | scr_erase_screen (2); |
4180 | scr_erase_screen (2); |
… | |
… | |
4382 | scr_color (Color_bg, Color_bg); |
4318 | scr_color (Color_bg, Color_bg); |
4383 | break; |
4319 | break; |
4384 | |
4320 | |
4385 | //case 50: // not variable spacing |
4321 | //case 50: // not variable spacing |
4386 | |
4322 | |
4387 | #if ENABLE_FRILLS |
4323 | #if !ENABLE_MINIMAL |
4388 | case 90: |
4324 | case 90: |
4389 | case 91: /* set bright fg color */ |
4325 | case 91: /* set bright fg color */ |
4390 | case 92: |
4326 | case 92: |
4391 | case 93: |
4327 | case 93: |
4392 | case 94: |
4328 | case 94: |
… | |
… | |
4454 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4390 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4455 | |
4391 | |
4456 | void |
4392 | void |
4457 | rxvt_term::tt_write (const char *data, unsigned int len) |
4393 | rxvt_term::tt_write (const char *data, unsigned int len) |
4458 | { |
4394 | { |
4459 | if (pty.pty < 0) |
4395 | if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) |
4460 | return; |
4396 | return; |
4461 | |
4397 | |
|
|
4398 | if (pty->pty < 0) |
|
|
4399 | return; |
|
|
4400 | |
4462 | if (v_buflen == 0) |
4401 | if (v_buflen == 0) |
4463 | { |
4402 | { |
4464 | ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE)); |
4403 | ssize_t written = write (pty->pty, data, min (len, MAX_PTY_WRITE)); |
4465 | |
4404 | |
4466 | if ((unsigned int)written == len) |
4405 | if ((unsigned int)written == len) |
4467 | return; |
4406 | return; |
4468 | |
4407 | |
4469 | data += written; |
4408 | data += written; |
… | |
… | |
4478 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4417 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4479 | } |
4418 | } |
4480 | |
4419 | |
4481 | void rxvt_term::pty_write () |
4420 | void rxvt_term::pty_write () |
4482 | { |
4421 | { |
4483 | int written = write (pty.pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4422 | int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4484 | |
4423 | |
4485 | if (written > 0) |
4424 | if (written > 0) |
4486 | { |
4425 | { |
4487 | v_buflen -= written; |
4426 | v_buflen -= written; |
4488 | |
4427 | |