… | |
… | |
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 | |
872 | if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_STRING_LEN, kbuf, len, DT_END))) |
873 | if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, DT_STR_LEN, kbuf, len, DT_END))) |
873 | return; |
874 | return; |
874 | |
875 | |
875 | if (len <= 0) |
876 | if (len <= 0) |
876 | return; /* not mapped */ |
877 | return; /* not mapped */ |
877 | |
878 | |
… | |
… | |
905 | { |
906 | { |
906 | const char ch = C0_ESC; |
907 | const char ch = C0_ESC; |
907 | tt_write (&ch, 1); |
908 | tt_write (&ch, 1); |
908 | } |
909 | } |
909 | |
910 | |
910 | #if defined(DEBUG_CMD) |
|
|
911 | /* Display keyboard buffer contents */ |
|
|
912 | unsigned char *p; |
|
|
913 | int i; |
|
|
914 | |
|
|
915 | fprintf (stderr, "key 0x%04X [%d]: `", (unsigned int)keysym, len); |
|
|
916 | for (i = 0, p = kbuf; i < len; i++, p++) |
|
|
917 | fprintf (stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); |
|
|
918 | fprintf (stderr, "'\n"); |
|
|
919 | #endif /* DEBUG_CMD */ |
|
|
920 | tt_write (kbuf, (unsigned int)len); |
911 | tt_write (kbuf, (unsigned int)len); |
921 | } |
912 | } |
922 | /*}}} */ |
913 | /*}}} */ |
923 | |
914 | |
924 | #if MENUBAR_MAX || defined (KEYSYM_RESOURCE) |
915 | #if defined (KEYSYM_RESOURCE) |
925 | /*{{{ rxvt_cmd_write (), rxvt_cmd_getc () */ |
|
|
926 | /* attempt to `write' count to the input buffer */ |
|
|
927 | unsigned int |
916 | unsigned int |
928 | rxvt_term::cmd_write (const char *str, unsigned int count) |
917 | rxvt_term::cmd_write (const char *str, unsigned int count) |
929 | { |
918 | { |
930 | unsigned int n, s; |
919 | unsigned int n, s; |
931 | |
920 | |
… | |
… | |
972 | |
961 | |
973 | if (want_refresh) |
962 | if (want_refresh) |
974 | { |
963 | { |
975 | if (SHOULD_INVOKE (HOOK_LINE_UPDATE)) |
964 | if (SHOULD_INVOKE (HOOK_LINE_UPDATE)) |
976 | { |
965 | { |
977 | int row = -view_start; |
966 | int row = view_start; |
|
|
967 | int end_row = row + nrow; |
978 | |
968 | |
979 | while (row > -nsaved && ROW (row - 1).is_longer ()) |
969 | while (row > top_row && ROW (row - 1).is_longer ()) |
980 | --row; |
970 | --row; |
981 | |
971 | |
982 | while (row < -view_start + nrow) |
972 | do |
983 | { |
973 | { |
984 | int start_row = row; |
974 | int start_row = row; |
985 | line_t *l; |
975 | line_t *l; |
986 | |
976 | |
987 | do |
977 | do |
988 | { |
978 | { |
989 | l = &ROW (row); |
979 | l = &ROW (row++); |
990 | |
980 | |
991 | if (!(l->f & LINE_FILTERED)) |
981 | if (!(l->f & LINE_FILTERED)) |
992 | { |
982 | { |
993 | // line not filtered, mark it as filtered |
983 | // line not filtered, mark it as filtered |
994 | l->f |= LINE_FILTERED; |
984 | l->f |= LINE_FILTERED; |
995 | while (l->is_longer ()) |
985 | while (l->is_longer ()) |
996 | { |
986 | { |
997 | l = &ROW (++row); |
987 | l = &ROW (row++); |
998 | l->f |= LINE_FILTERED; |
988 | l->f |= LINE_FILTERED; |
999 | } |
989 | } |
1000 | |
990 | |
1001 | // and filter it |
991 | // and filter it |
1002 | 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)); |
1003 | |
993 | |
1004 | break; |
994 | break; |
1005 | } |
995 | } |
1006 | } |
996 | } |
1007 | while (l->is_longer ()); |
997 | while (l->is_longer () && row < end_row); |
1008 | |
|
|
1009 | row++; |
|
|
1010 | } |
998 | } |
|
|
999 | while (row < end_row); |
1011 | |
1000 | } |
1012 | } |
|
|
1013 | |
1001 | |
1014 | scr_refresh (refresh_type); |
1002 | scr_refresh (); |
1015 | scrollbar_show (1); |
1003 | scrollbar_show (1); |
1016 | #ifdef USE_XIM |
1004 | #ifdef USE_XIM |
1017 | IMSendSpot (); |
1005 | IMSendSpot (); |
1018 | #endif |
1006 | #endif |
1019 | } |
1007 | } |
… | |
… | |
1022 | } |
1010 | } |
1023 | |
1011 | |
1024 | void |
1012 | void |
1025 | rxvt_term::check_cb (check_watcher &w) |
1013 | rxvt_term::check_cb (check_watcher &w) |
1026 | { |
1014 | { |
1027 | SET_R (this); |
1015 | make_current (); |
1028 | SET_LOCALE (locale); |
|
|
1029 | |
1016 | |
1030 | display->flush (); |
1017 | display->flush (); |
1031 | |
1018 | |
1032 | if (want_refresh && !flush_ev.active) |
1019 | if (want_refresh && !flush_ev.active) |
1033 | 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 |
1034 | } |
1021 | } |
1035 | |
1022 | |
1036 | void |
1023 | void |
1037 | rxvt_term::flush_cb (time_watcher &w) |
1024 | rxvt_term::flush_cb (time_watcher &w) |
1038 | { |
1025 | { |
1039 | SET_R (this); |
1026 | make_current (); |
1040 | SET_LOCALE (locale); |
|
|
1041 | |
1027 | |
1042 | refresh_limit = 1; |
1028 | refresh_limit = 1; |
1043 | refresh_count = 0; |
1029 | refresh_count = 0; |
1044 | flush (); |
1030 | flush (); |
1045 | } |
1031 | } |
… | |
… | |
1049 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1035 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1050 | { |
1036 | { |
1051 | hidden_cursor = !hidden_cursor; |
1037 | hidden_cursor = !hidden_cursor; |
1052 | want_refresh = 1; |
1038 | want_refresh = 1; |
1053 | |
1039 | |
1054 | w.start (w.at + BLINK_INTERVAL); |
1040 | w.start (w.at + CURSOR_BLINK_INTERVAL); |
1055 | } |
1041 | } |
1056 | #endif |
1042 | #endif |
1057 | |
1043 | |
1058 | #ifdef TEXT_BLINK |
1044 | #ifdef TEXT_BLINK |
1059 | void |
1045 | void |
… | |
… | |
1073 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1059 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1074 | { |
1060 | { |
1075 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1061 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1076 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1062 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1077 | { |
1063 | { |
1078 | refresh_type |= SMOOTH_REFRESH; |
|
|
1079 | want_refresh = 1; |
1064 | want_refresh = 1; |
1080 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1065 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1081 | } |
1066 | } |
1082 | } |
1067 | } |
1083 | #endif |
1068 | #endif |
… | |
… | |
1087 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1072 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1088 | { |
1073 | { |
1089 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1074 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1090 | { |
1075 | { |
1091 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1076 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1092 | refresh_type |= SMOOTH_REFRESH; |
|
|
1093 | want_refresh = 1; |
1077 | want_refresh = 1; |
1094 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1078 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1095 | } |
1079 | } |
1096 | } |
1080 | } |
1097 | #endif |
1081 | #endif |
… | |
… | |
1102 | { |
1086 | { |
1103 | if (mouse_slip_wheel_speed == 0 |
1087 | if (mouse_slip_wheel_speed == 0 |
1104 | || 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) |
1105 | : scr_page (UP, mouse_slip_wheel_speed)) |
1089 | : scr_page (UP, mouse_slip_wheel_speed)) |
1106 | { |
1090 | { |
1107 | if (view_start == nsaved || |
1091 | if (view_start == top_row || view_start == 0) |
1108 | view_start == 0) |
|
|
1109 | mouse_slip_wheel_speed = 0; |
1092 | mouse_slip_wheel_speed = 0; |
1110 | |
1093 | |
1111 | refresh_type |= SMOOTH_REFRESH; |
|
|
1112 | want_refresh = 1; |
1094 | want_refresh = 1; |
1113 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1095 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1114 | } |
1096 | } |
1115 | } |
1097 | } |
1116 | #endif |
1098 | #endif |
… | |
… | |
1146 | |
1128 | |
1147 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1129 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1148 | cmdbuf_ptr = cmdbuf_base; |
1130 | cmdbuf_ptr = cmdbuf_base; |
1149 | cmdbuf_endp = cmdbuf_ptr + n; |
1131 | cmdbuf_endp = cmdbuf_ptr + n; |
1150 | |
1132 | |
1151 | ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); |
1133 | ssize_t r = read (pty->pty, cmdbuf_endp, CBUFSIZ - n); |
1152 | |
1134 | |
1153 | if (r > 0) |
1135 | if (r > 0) |
1154 | { |
1136 | { |
1155 | cmdbuf_endp += r; |
1137 | cmdbuf_endp += r; |
1156 | return true; |
1138 | return true; |
… | |
… | |
1174 | } |
1156 | } |
1175 | |
1157 | |
1176 | void |
1158 | void |
1177 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1159 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1178 | { |
1160 | { |
1179 | SET_R (this); |
1161 | make_current (); |
1180 | SET_LOCALE (locale); |
|
|
1181 | |
1162 | |
1182 | if (revents & EVENT_READ) |
1163 | if (revents & EVENT_READ) |
1183 | // loop, but don't allow a single term to monopolize us |
1164 | // loop, but don't allow a single term to monopolize us |
1184 | while (pty_fill ()) |
1165 | while (pty_fill ()) |
1185 | if (cmd_parse ()) |
1166 | if (cmd_parse ()) |
… | |
… | |
1190 | } |
1171 | } |
1191 | |
1172 | |
1192 | void |
1173 | void |
1193 | rxvt_term::pointer_unblank () |
1174 | rxvt_term::pointer_unblank () |
1194 | { |
1175 | { |
1195 | XDefineCursor (display->display, vt, TermWin_cursor); |
1176 | XDefineCursor (xdisp, vt, TermWin_cursor); |
1196 | recolour_cursor (); |
1177 | recolour_cursor (); |
1197 | |
1178 | |
1198 | #ifdef POINTER_BLANK |
1179 | #ifdef POINTER_BLANK |
1199 | hidden_pointer = 0; |
1180 | hidden_pointer = 0; |
1200 | |
1181 | |
… | |
… | |
1208 | rxvt_term::pointer_blank () |
1189 | rxvt_term::pointer_blank () |
1209 | { |
1190 | { |
1210 | if (!OPTION (Opt_pointerBlank)) |
1191 | if (!OPTION (Opt_pointerBlank)) |
1211 | return; |
1192 | return; |
1212 | |
1193 | |
1213 | XDefineCursor (display->display, vt, display->blank_cursor); |
1194 | XDefineCursor (xdisp, vt, display->blank_cursor); |
1214 | XFlush (display->display); |
1195 | XFlush (xdisp); |
1215 | |
1196 | |
1216 | hidden_pointer = 1; |
1197 | hidden_pointer = 1; |
1217 | } |
1198 | } |
1218 | |
1199 | |
1219 | void |
1200 | void |
1220 | rxvt_term::pointer_cb (time_watcher &w) |
1201 | rxvt_term::pointer_cb (time_watcher &w) |
1221 | { |
1202 | { |
1222 | SET_R (this); |
1203 | make_current (); |
1223 | SET_LOCALE (locale); |
|
|
1224 | |
1204 | |
1225 | pointer_blank (); |
1205 | pointer_blank (); |
1226 | } |
1206 | } |
1227 | #endif |
1207 | #endif |
1228 | |
1208 | |
… | |
… | |
1293 | (32 + button_number + key_state), |
1273 | (32 + button_number + key_state), |
1294 | (32 + x + 1), |
1274 | (32 + x + 1), |
1295 | (32 + y + 1)); |
1275 | (32 + y + 1)); |
1296 | } |
1276 | } |
1297 | |
1277 | |
1298 | #ifdef USING_W11LIB |
|
|
1299 | void |
|
|
1300 | rxvt_W11_process_x_event (XEvent *ev) |
|
|
1301 | { |
|
|
1302 | rxvt_t *r = rxvt_get_r (); |
|
|
1303 | |
|
|
1304 | x_cb (*ev); |
|
|
1305 | } |
|
|
1306 | #endif |
|
|
1307 | |
|
|
1308 | /*{{{ process an X event */ |
1278 | /*{{{ process an X event */ |
1309 | void |
1279 | void |
1310 | rxvt_term::x_cb (XEvent &ev) |
1280 | rxvt_term::x_cb (XEvent &ev) |
1311 | { |
1281 | { |
1312 | dDisp; |
1282 | make_current (); |
1313 | |
1283 | |
1314 | SET_R (this); |
1284 | dLocal (Display *, xdisp); |
1315 | SET_LOCALE (locale); |
|
|
1316 | |
1285 | |
1317 | #if defined(CURSOR_BLINK) |
1286 | if (ev.xany.window == vt |
1318 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
1287 | && SHOULD_INVOKE (HOOK_X_EVENT) |
1319 | { |
1288 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
1320 | if (hidden_cursor) |
1289 | return; |
1321 | { |
|
|
1322 | hidden_cursor = 0; |
|
|
1323 | want_refresh = 1; |
|
|
1324 | } |
|
|
1325 | |
1290 | |
1326 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1291 | // for XQueryPointer |
1327 | } |
|
|
1328 | #endif |
|
|
1329 | |
|
|
1330 | #if defined(POINTER_BLANK) |
|
|
1331 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
|
|
1332 | { |
|
|
1333 | if (ev.type == MotionNotify |
|
|
1334 | || ev.type == ButtonPress |
|
|
1335 | || ev.type == ButtonRelease) |
|
|
1336 | if (hidden_pointer) |
|
|
1337 | pointer_unblank (); |
|
|
1338 | |
|
|
1339 | if (ev.type == KeyPress && hidden_pointer == 0) |
|
|
1340 | pointer_blank (); |
|
|
1341 | } |
|
|
1342 | #endif |
|
|
1343 | |
|
|
1344 | Window unused_root, unused_child; |
1292 | Window unused_root, unused_child; |
1345 | int unused_root_x, unused_root_y; |
1293 | int unused_root_x, unused_root_y; |
1346 | unsigned int unused_mask; |
1294 | unsigned int unused_mask; |
1347 | |
1295 | |
1348 | switch (ev.type) |
1296 | switch (ev.type) |
… | |
… | |
1355 | |
1303 | |
1356 | break; |
1304 | break; |
1357 | |
1305 | |
1358 | case KeyRelease: |
1306 | case KeyRelease: |
1359 | { |
1307 | { |
1360 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 |
1308 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 || ENABLE_PERL |
1361 | KeySym ks; |
1309 | KeySym keysym; |
1362 | |
1310 | |
1363 | 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 :/ |
1364 | #endif |
1312 | #endif |
1365 | |
1313 | |
1366 | #if ENABLE_FRILLS || ISO_14755 |
1314 | #if ENABLE_FRILLS || ISO_14755 |
1367 | // ISO 14755 support |
1315 | // ISO 14755 support |
1368 | if (iso14755buf) |
1316 | if (iso14755buf) |
… | |
… | |
1373 | # endif |
1321 | # endif |
1374 | # if ISO_14755 |
1322 | # if ISO_14755 |
1375 | // iso14755 part 5.2 handling: release time |
1323 | // iso14755 part 5.2 handling: release time |
1376 | // first: controls |
1324 | // first: controls |
1377 | if ((ev.xkey.state & ControlMask) |
1325 | if ((ev.xkey.state & ControlMask) |
1378 | && ((ks >= 0x40 && ks <= 0x5f) |
1326 | && ((keysym >= 0x40 && keysym <= 0x5f) |
1379 | || (ks >= 0x61 && ks <= 0x7f))) |
1327 | || (keysym >= 0x61 && keysym <= 0x7f))) |
1380 | { |
1328 | { |
1381 | iso14755buf = ISO_14755_51 | 0x2400 | (ks & 0x1f); |
1329 | iso14755buf = ISO_14755_51 | 0x2400 | (keysym & 0x1f); |
1382 | commit_iso14755 (); |
1330 | commit_iso14755 (); |
1383 | return; // case-break; |
1331 | goto skip_switch; |
1384 | } |
1332 | } |
1385 | |
1333 | |
1386 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
1334 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
1387 | if (i[0] == ks) |
1335 | if (i[0] == keysym) |
1388 | { |
1336 | { |
1389 | iso14755buf = ISO_14755_51 | i[1]; |
1337 | iso14755buf = ISO_14755_51 | i[1]; |
1390 | commit_iso14755 (); |
1338 | commit_iso14755 (); |
1391 | return; // case-break; |
1339 | goto skip_switch; |
1392 | } |
1340 | } |
1393 | |
1341 | |
1394 | scr_bell (); |
1342 | scr_bell (); |
1395 | # endif |
1343 | # endif |
1396 | iso14755buf = 0; |
1344 | iso14755buf = 0; |
… | |
… | |
1415 | else |
1363 | else |
1416 | iso14755buf = 0; |
1364 | iso14755buf = 0; |
1417 | } |
1365 | } |
1418 | #endif |
1366 | #endif |
1419 | |
1367 | |
|
|
1368 | if (ev.xany.window == vt |
1420 | if (ev.xany.window == vt && HOOK_INVOKE ((this, HOOK_KEY_RELEASE, DT_XEVENT, &ev, DT_END))) |
1369 | && HOOK_INVOKE ((this, HOOK_KEY_RELEASE, DT_XEVENT, &ev, DT_INT, keysym, DT_END))) |
1421 | break; |
1370 | break; |
1422 | |
1371 | |
1423 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1372 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1424 | if (!(ev.xkey.state & ControlMask)) |
1373 | if (!(ev.xkey.state & ControlMask)) |
1425 | slip_wheel_ev.stop (); |
1374 | slip_wheel_ev.stop (); |
1426 | else if (ks == XK_Control_L || ks == XK_Control_R) |
1375 | else if (keysym == XK_Control_L || keysym == XK_Control_R) |
1427 | mouse_slip_wheel_speed = 0; |
1376 | mouse_slip_wheel_speed = 0; |
1428 | #endif |
1377 | #endif |
1429 | break; |
1378 | break; |
1430 | } |
1379 | } |
1431 | |
1380 | |
… | |
… | |
1437 | button_release (ev.xbutton); |
1386 | button_release (ev.xbutton); |
1438 | break; |
1387 | break; |
1439 | |
1388 | |
1440 | case ClientMessage: |
1389 | case ClientMessage: |
1441 | if (ev.xclient.format == 32 |
1390 | if (ev.xclient.format == 32 |
1442 | && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
1391 | && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END))) |
1443 | { |
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 | { |
1444 | 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))) |
1445 | destroy (); |
1400 | destroy (); |
|
|
1401 | } |
1446 | #if ENABLE_EWMH |
1402 | #if ENABLE_EWMH |
1447 | 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]) |
1448 | XSendEvent (disp, ev.xclient.window = display->root, |
1404 | XSendEvent (xdisp, ev.xclient.window = display->root, |
1449 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1405 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1450 | &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 | } |
1451 | #endif |
1418 | #endif |
1452 | } |
1419 | } |
1453 | #if ENABLE_XEMBED |
|
|
1454 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1455 | { |
|
|
1456 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1457 | focus_in (); |
|
|
1458 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1459 | focus_out (); |
|
|
1460 | } |
|
|
1461 | #endif |
|
|
1462 | #ifdef OFFIX_DND |
|
|
1463 | /* OffiX Dnd (drag 'n' drop) protocol */ |
|
|
1464 | else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL] |
|
|
1465 | && (ev.xclient.data.l[0] == DndFile |
|
|
1466 | || ev.xclient.data.l[0] == DndDir |
|
|
1467 | || ev.xclient.data.l[0] == DndLink)) |
|
|
1468 | { |
|
|
1469 | /* Get Dnd data */ |
|
|
1470 | Atom ActualType; |
|
|
1471 | int ActualFormat; |
|
|
1472 | unsigned char *data; |
|
|
1473 | unsigned long Size, RemainingBytes; |
|
|
1474 | |
|
|
1475 | XGetWindowProperty (disp, display->root, |
|
|
1476 | xa[XA_DNDSELECTION], |
|
|
1477 | 0L, 1000000L, |
|
|
1478 | False, AnyPropertyType, |
|
|
1479 | &ActualType, &ActualFormat, |
|
|
1480 | &Size, &RemainingBytes, |
|
|
1481 | &data); |
|
|
1482 | set_string_property (XA_CUT_BUFFER0, data); |
|
|
1483 | XFree (data); |
|
|
1484 | selection_paste (display->root, XA_CUT_BUFFER0, true); |
|
|
1485 | XSetInputFocus (disp, display->root, RevertToNone, CurrentTime); |
|
|
1486 | } |
|
|
1487 | #endif /* OFFIX_DND */ |
|
|
1488 | break; |
1420 | break; |
1489 | |
1421 | |
1490 | case MappingNotify: |
1422 | case MappingNotify: |
1491 | XRefreshKeyboardMapping (&ev.xmapping); |
1423 | XRefreshKeyboardMapping (&ev.xmapping); |
1492 | break; |
1424 | break; |
… | |
… | |
1525 | break; |
1457 | break; |
1526 | |
1458 | |
1527 | case ConfigureNotify: |
1459 | case ConfigureNotify: |
1528 | if (ev.xconfigure.window == parent[0]) |
1460 | if (ev.xconfigure.window == parent[0]) |
1529 | { |
1461 | { |
1530 | while (XCheckTypedWindowEvent (disp, ev.xconfigure.window, ConfigureNotify, &ev)) |
1462 | while (XCheckTypedWindowEvent (xdisp, ev.xconfigure.window, ConfigureNotify, &ev)) |
1531 | ; |
1463 | ; |
1532 | |
1464 | |
1533 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1465 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1534 | { |
1466 | { |
1535 | seen_resize = 1; |
1467 | seen_resize = 1; |
1536 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1468 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1537 | } |
1469 | } |
1538 | |
1470 | |
|
|
1471 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
|
|
1472 | |
1539 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1473 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1540 | if (OPTION (Opt_transparent)) |
1474 | if (OPTION (Opt_transparent)) |
1541 | check_our_parents (); |
1475 | check_our_parents (); |
1542 | #endif |
1476 | #endif |
1543 | } |
1477 | } |
1544 | break; |
1478 | break; |
1545 | |
1479 | |
1546 | case PropertyNotify: |
1480 | case PropertyNotify: |
|
|
1481 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1547 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1482 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1548 | && ev.xproperty.state == PropertyNewValue) |
1483 | && ev.xproperty.state == PropertyNewValue) |
1549 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1484 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1550 | |
1485 | |
1551 | break; |
1486 | break; |
1552 | |
1487 | |
1553 | case SelectionClear: |
1488 | case SelectionClear: |
1554 | selection_clear (); |
1489 | selection_clear (); |
… | |
… | |
1559 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1494 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1560 | break; |
1495 | break; |
1561 | |
1496 | |
1562 | case SelectionRequest: |
1497 | case SelectionRequest: |
1563 | 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)); |
1564 | break; |
1507 | break; |
1565 | |
1508 | |
1566 | case UnmapNotify: |
1509 | case UnmapNotify: |
1567 | mapped = 0; |
1510 | mapped = 0; |
1568 | #ifdef TEXT_BLINK |
1511 | #ifdef TEXT_BLINK |
1569 | text_blink_ev.stop (); |
1512 | text_blink_ev.stop (); |
1570 | #endif |
1513 | #endif |
1571 | break; |
1514 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1572 | |
|
|
1573 | case MapNotify: |
|
|
1574 | mapped = 1; |
|
|
1575 | #ifdef TEXT_BLINK |
|
|
1576 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
|
|
1577 | #endif |
|
|
1578 | break; |
1515 | break; |
1579 | |
1516 | |
1580 | #ifdef TRANSPARENT |
1517 | #ifdef TRANSPARENT |
1581 | case ReparentNotify: |
1518 | case ReparentNotify: |
1582 | rootwin_cb (ev); |
1519 | rootwin_cb (ev); |
… | |
… | |
1588 | if (ev.xany.window == vt) |
1525 | if (ev.xany.window == vt) |
1589 | { |
1526 | { |
1590 | do |
1527 | do |
1591 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1528 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1592 | ev.xexpose.width, ev.xexpose.height, False); |
1529 | ev.xexpose.width, ev.xexpose.height, False); |
1593 | while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)); |
1530 | while (XCheckTypedWindowEvent (xdisp, vt, ev.xany.type, &ev)); |
1594 | |
1531 | |
1595 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1532 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1596 | |
1533 | |
1597 | while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)) |
1534 | while (XCheckTypedWindowEvent (xdisp, vt, ev.xany.type, &ev)) |
1598 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1535 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1599 | ev.xexpose.width, ev.xexpose.height, False); |
1536 | ev.xexpose.width, ev.xexpose.height, False); |
1600 | |
1537 | |
1601 | scr_refresh (refresh_type); |
1538 | want_refresh = 1; |
1602 | } |
1539 | } |
1603 | else |
1540 | else |
1604 | { |
1541 | { |
1605 | XEvent unused_event; |
1542 | XEvent unused_event; |
1606 | |
1543 | |
1607 | while (XCheckTypedWindowEvent (disp, ev.xany.window, Expose, &unused_event)) |
1544 | while (XCheckTypedWindowEvent (xdisp, ev.xany.window, Expose, &unused_event)) |
1608 | ; |
1545 | ; |
1609 | while (XCheckTypedWindowEvent (disp, ev.xany.window, GraphicsExpose, &unused_event)) |
1546 | while (XCheckTypedWindowEvent (xdisp, ev.xany.window, GraphicsExpose, &unused_event)) |
1610 | ; |
1547 | ; |
1611 | |
1548 | |
1612 | if (isScrollbarWindow (ev.xany.window)) |
1549 | if (isScrollbarWindow (ev.xany.window)) |
1613 | { |
1550 | { |
1614 | scrollBar.setIdle (); |
1551 | scrollBar.setIdle (); |
1615 | scrollbar_show (0); |
1552 | scrollbar_show (0); |
1616 | } |
1553 | } |
1617 | #ifdef MENUBAR |
|
|
1618 | if (menubar_visible () && isMenuBarWindow (ev.xany.window)) |
|
|
1619 | menubar_expose (); |
|
|
1620 | #endif |
|
|
1621 | |
1554 | |
1622 | #ifdef TRANSPARENT |
1555 | #ifdef TRANSPARENT |
1623 | if (am_transparent && ev.xany.window == parent[0]) |
1556 | if (am_transparent && ev.xany.window == parent[0]) |
1624 | XClearWindow (disp, ev.xany.window); |
1557 | XClearWindow (xdisp, ev.xany.window); |
1625 | #endif |
1558 | #endif |
1626 | } |
1559 | } |
1627 | break; |
1560 | break; |
1628 | |
1561 | |
1629 | case MotionNotify: |
1562 | case MotionNotify: |
1630 | #ifdef POINTER_BLANK |
1563 | #ifdef POINTER_BLANK |
1631 | if (hidden_pointer) |
1564 | if (hidden_pointer) |
1632 | pointer_unblank (); |
1565 | pointer_unblank (); |
1633 | #endif |
1566 | #endif |
1634 | #if MENUBAR |
|
|
1635 | if (isMenuBarWindow (ev.xany.window)) |
|
|
1636 | { |
|
|
1637 | menubar_control (ev.xbutton); |
|
|
1638 | break; |
|
|
1639 | } |
|
|
1640 | #endif |
|
|
1641 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1567 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1642 | break; |
1568 | break; |
1643 | |
1569 | |
1644 | if (ev.xany.window == vt) |
1570 | if (ev.xany.window == vt) |
1645 | { |
1571 | { |
|
|
1572 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
1646 | if (HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1573 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1647 | ; // nop |
1574 | ; // nop |
1648 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1575 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1649 | { |
1576 | { |
1650 | while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) |
1577 | while (XCheckTypedWindowEvent (xdisp, vt, MotionNotify, &ev)) |
1651 | ; |
1578 | ; |
1652 | |
1579 | |
1653 | XQueryPointer (disp, vt, |
1580 | XQueryPointer (xdisp, vt, |
1654 | &unused_root, &unused_child, |
1581 | &unused_root, &unused_child, |
1655 | &unused_root_x, &unused_root_y, |
1582 | &unused_root_x, &unused_root_y, |
1656 | &ev.xbutton.x, &ev.xbutton.y, |
1583 | &ev.xbutton.x, &ev.xbutton.y, |
1657 | &ev.xbutton.state); |
1584 | &ev.xbutton.state); |
1658 | #ifdef MOUSE_THRESHOLD |
1585 | #ifdef MOUSE_THRESHOLD |
… | |
… | |
1722 | #endif |
1649 | #endif |
1723 | } |
1650 | } |
1724 | } |
1651 | } |
1725 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1652 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1726 | { |
1653 | { |
1727 | while (XCheckTypedWindowEvent (disp, scrollBar.win, |
1654 | while (XCheckTypedWindowEvent (xdisp, scrollBar.win, |
1728 | MotionNotify, &ev)) |
1655 | MotionNotify, &ev)) |
1729 | ; |
1656 | ; |
1730 | |
1657 | |
1731 | XQueryPointer (disp, scrollBar.win, |
1658 | XQueryPointer (xdisp, scrollBar.win, |
1732 | &unused_root, &unused_child, |
1659 | &unused_root, &unused_child, |
1733 | &unused_root_x, &unused_root_y, |
1660 | &unused_root_x, &unused_root_y, |
1734 | &ev.xbutton.x, &ev.xbutton.y, |
1661 | &ev.xbutton.x, &ev.xbutton.y, |
1735 | &unused_mask); |
1662 | &unused_mask); |
1736 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1663 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1737 | scrollbar_size ()); |
1664 | scrollbar_size ()); |
1738 | scr_refresh (refresh_type); |
1665 | want_refresh = 1; |
1739 | refresh_limit = 0; |
1666 | refresh_limit = 0; |
1740 | scrollbar_show (1); |
1667 | scrollbar_show (1); |
1741 | } |
1668 | } |
1742 | break; |
1669 | break; |
1743 | } |
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 |
1744 | } |
1700 | } |
1745 | |
1701 | |
1746 | void |
1702 | void |
1747 | rxvt_term::focus_in () |
1703 | rxvt_term::focus_in () |
1748 | { |
1704 | { |
… | |
… | |
1760 | XSetICFocus (Input_Context); |
1716 | XSetICFocus (Input_Context); |
1761 | } |
1717 | } |
1762 | #endif |
1718 | #endif |
1763 | #if CURSOR_BLINK |
1719 | #if CURSOR_BLINK |
1764 | if (OPTION (Opt_cursorBlink)) |
1720 | if (OPTION (Opt_cursorBlink)) |
1765 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1721 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1766 | #endif |
1722 | #endif |
1767 | #if OFF_FOCUS_FADING |
1723 | #if OFF_FOCUS_FADING |
1768 | if (rs[Rs_fade]) |
1724 | if (rs[Rs_fade]) |
1769 | { |
1725 | { |
1770 | pix_colors = pix_colors_focused; |
1726 | pix_colors = pix_colors_focused; |
… | |
… | |
1814 | |
1770 | |
1815 | #if TRANSPARENT |
1771 | #if TRANSPARENT |
1816 | void |
1772 | void |
1817 | rxvt_term::rootwin_cb (XEvent &ev) |
1773 | rxvt_term::rootwin_cb (XEvent &ev) |
1818 | { |
1774 | { |
1819 | SET_R (this); |
1775 | make_current (); |
1820 | SET_LOCALE (locale); |
|
|
1821 | |
1776 | |
1822 | switch (ev.type) |
1777 | switch (ev.type) |
1823 | { |
1778 | { |
1824 | case PropertyNotify: |
1779 | case PropertyNotify: |
1825 | /* |
1780 | /* |
… | |
… | |
1852 | /* |
1807 | /* |
1853 | * VT window processing of button press |
1808 | * VT window processing of button press |
1854 | */ |
1809 | */ |
1855 | if (ev.window == vt) |
1810 | if (ev.window == vt) |
1856 | { |
1811 | { |
|
|
1812 | if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1813 | return; |
|
|
1814 | |
1857 | #if ISO_14755 |
1815 | #if ISO_14755 |
1858 | // 5.4 |
1816 | // 5.4 |
1859 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1817 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1860 | { |
1818 | { |
1861 | iso14755_54 (ev.x, ev.y); |
1819 | iso14755_54 (ev.x, ev.y); |
… | |
… | |
1873 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1831 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1874 | if (ev.button == MEvent.button && clickintime) |
1832 | if (ev.button == MEvent.button && clickintime) |
1875 | { |
1833 | { |
1876 | /* same button, within alloted time */ |
1834 | /* same button, within alloted time */ |
1877 | MEvent.clicks++; |
1835 | MEvent.clicks++; |
|
|
1836 | |
1878 | if (MEvent.clicks > 1) |
1837 | if (MEvent.clicks > 1) |
1879 | { |
1838 | { |
1880 | /* only report double clicks */ |
1839 | /* only report double clicks */ |
1881 | MEvent.clicks = 2; |
1840 | MEvent.clicks = 2; |
1882 | mouse_report (ev); |
1841 | mouse_report (ev); |
… | |
… | |
1902 | else |
1861 | else |
1903 | { |
1862 | { |
1904 | if (ev.button != MEvent.button) |
1863 | if (ev.button != MEvent.button) |
1905 | MEvent.clicks = 0; |
1864 | MEvent.clicks = 0; |
1906 | |
1865 | |
1907 | if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1908 | switch (ev.button) |
1866 | switch (ev.button) |
1909 | { |
1867 | { |
1910 | case Button1: |
1868 | case Button1: |
1911 | /* allow meta + click to select rectangular areas */ |
1869 | /* allow meta + click to select rectangular areas */ |
1912 | /* should be done in screen.C */ |
1870 | /* should be done in screen.C */ |
1913 | #if ENABLE_FRILLS |
1871 | #if ENABLE_FRILLS |
1914 | selection.rect = !!(ev.state & ModMetaMask); |
1872 | selection.rect = !!(ev.state & ModMetaMask); |
1915 | #else |
1873 | #else |
1916 | selection.rect = false; |
1874 | selection.rect = false; |
1917 | #endif |
1875 | #endif |
1918 | |
1876 | |
1919 | /* allow shift+left click to extend selection */ |
1877 | /* allow shift+left click to extend selection */ |
1920 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1878 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1921 | { |
1879 | { |
1922 | if (MEvent.button == Button1 && clickintime) |
1880 | if (MEvent.button == Button1 && clickintime) |
1923 | selection_rotate (ev.x, ev.y); |
1881 | selection_rotate (ev.x, ev.y); |
1924 | else |
1882 | else |
1925 | selection_extend (ev.x, ev.y, 1); |
1883 | selection_extend (ev.x, ev.y, 1); |
1926 | } |
1884 | } |
1927 | else |
1885 | else |
1928 | { |
1886 | { |
1929 | if (MEvent.button == Button1 && clickintime) |
1887 | if (MEvent.button == Button1 && clickintime) |
1930 | MEvent.clicks++; |
1888 | MEvent.clicks++; |
1931 | else |
1889 | else |
1932 | MEvent.clicks = 1; |
1890 | MEvent.clicks = 1; |
1933 | |
1891 | |
1934 | selection_click (MEvent.clicks, ev.x, ev.y); |
1892 | selection_click (MEvent.clicks, ev.x, ev.y); |
1935 | } |
1893 | } |
1936 | |
1894 | |
1937 | MEvent.button = Button1; |
1895 | MEvent.button = Button1; |
1938 | break; |
1896 | break; |
1939 | |
1897 | |
1940 | case Button3: |
1898 | case Button3: |
1941 | if (MEvent.button == Button3 && clickintime) |
1899 | if (MEvent.button == Button3 && clickintime) |
1942 | selection_rotate (ev.x, ev.y); |
1900 | selection_rotate (ev.x, ev.y); |
1943 | else |
1901 | else |
1944 | selection_extend (ev.x, ev.y, 1); |
1902 | selection_extend (ev.x, ev.y, 1); |
1945 | |
1903 | |
1946 | MEvent.button = Button3; |
1904 | MEvent.button = Button3; |
1947 | break; |
1905 | break; |
1948 | } |
1906 | } |
1949 | } |
1907 | } |
1950 | |
1908 | |
1951 | MEvent.time = ev.time; |
1909 | MEvent.time = ev.time; |
1952 | return; |
1910 | return; |
1953 | } |
1911 | } |
1954 | |
1912 | |
… | |
… | |
2090 | } |
2048 | } |
2091 | |
2049 | |
2092 | break; |
2050 | break; |
2093 | } |
2051 | } |
2094 | } |
2052 | } |
|
|
2053 | |
2095 | return; |
2054 | return; |
2096 | } |
2055 | } |
2097 | #if MENUBAR |
|
|
2098 | /* |
|
|
2099 | * Menubar window processing of button press |
|
|
2100 | */ |
|
|
2101 | if (isMenuBarWindow (ev.window)) |
|
|
2102 | menubar_control (ev); |
|
|
2103 | #endif |
|
|
2104 | } |
2056 | } |
2105 | |
2057 | |
2106 | void |
2058 | void |
2107 | rxvt_term::button_release (XButtonEvent &ev) |
2059 | rxvt_term::button_release (XButtonEvent &ev) |
2108 | { |
2060 | { |
… | |
… | |
2114 | |
2066 | |
2115 | if (scrollbar_isUpDn ()) |
2067 | if (scrollbar_isUpDn ()) |
2116 | { |
2068 | { |
2117 | scrollBar.setIdle (); |
2069 | scrollBar.setIdle (); |
2118 | scrollbar_show (0); |
2070 | scrollbar_show (0); |
2119 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
2120 | refresh_type &= ~SMOOTH_REFRESH; |
|
|
2121 | #endif |
|
|
2122 | } |
2071 | } |
2123 | |
2072 | |
2124 | #ifdef SELECTION_SCROLLING |
2073 | #ifdef SELECTION_SCROLLING |
2125 | if (sel_scroll_ev.active) |
2074 | if (sel_scroll_ev.active) |
2126 | sel_scroll_ev.stop(); |
2075 | sel_scroll_ev.stop(); |
2127 | #endif |
2076 | #endif |
2128 | |
2077 | |
2129 | if (ev.window == vt) |
2078 | if (ev.window == vt) |
2130 | { |
2079 | { |
|
|
2080 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2081 | return; |
|
|
2082 | |
2131 | #if ISO_14755 |
2083 | #if ISO_14755 |
2132 | // 5.4 |
2084 | // 5.4 |
2133 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2085 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2134 | return; |
2086 | return; |
2135 | #endif |
2087 | #endif |
|
|
2088 | |
2136 | if (reportmode) |
2089 | if (reportmode) |
2137 | { |
2090 | { |
2138 | /* mouse report from vt window */ |
2091 | /* mouse report from vt window */ |
2139 | /* don't report release of wheel "buttons" */ |
2092 | /* don't report release of wheel "buttons" */ |
2140 | if (ev.button >= 4) |
2093 | if (ev.button >= 4) |
… | |
… | |
2164 | if (priv_modes & PrivMode_mouse_report |
2117 | if (priv_modes & PrivMode_mouse_report |
2165 | && bypass_keystate |
2118 | && bypass_keystate |
2166 | && ev.button == Button1 && MEvent.clicks <= 1) |
2119 | && ev.button == Button1 && MEvent.clicks <= 1) |
2167 | selection_extend (ev.x, ev.y, 0); |
2120 | selection_extend (ev.x, ev.y, 0); |
2168 | |
2121 | |
2169 | if (!HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2170 | return; |
|
|
2171 | |
|
|
2172 | switch (ev.button) |
2122 | switch (ev.button) |
2173 | { |
2123 | { |
2174 | case Button1: |
2124 | case Button1: |
2175 | case Button3: |
2125 | case Button3: |
2176 | selection_make (ev.time); |
2126 | selection_make (ev.time); |
2177 | break; |
2127 | break; |
|
|
2128 | |
2178 | case Button2: |
2129 | case Button2: |
2179 | 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); |
2180 | break; |
2132 | break; |
|
|
2133 | |
2181 | #ifdef MOUSE_WHEEL |
2134 | #ifdef MOUSE_WHEEL |
2182 | case Button4: |
2135 | case Button4: |
2183 | case Button5: |
2136 | case Button5: |
2184 | { |
2137 | { |
2185 | int i; |
2138 | int i; |
… | |
… | |
2207 | slip_wheel_ev.start (); |
2160 | slip_wheel_ev.start (); |
2208 | } |
2161 | } |
2209 | else |
2162 | else |
2210 | { |
2163 | { |
2211 | # endif |
2164 | # endif |
2212 | # ifdef JUMP_MOUSE_WHEEL |
|
|
2213 | scr_page (v, i); |
2165 | scr_page (v, i); |
2214 | scr_refresh (SMOOTH_REFRESH); |
|
|
2215 | scrollbar_show (1); |
2166 | scrollbar_show (1); |
2216 | # else |
|
|
2217 | while (i--) |
|
|
2218 | { |
|
|
2219 | scr_page (v, 1); |
|
|
2220 | scr_refresh (SMOOTH_REFRESH); |
|
|
2221 | scrollbar_show (1); |
|
|
2222 | } |
|
|
2223 | # endif |
|
|
2224 | # ifdef MOUSE_SLIP_WHEELING |
2167 | # ifdef MOUSE_SLIP_WHEELING |
2225 | } |
2168 | } |
2226 | #endif |
2169 | # endif |
2227 | } |
2170 | } |
2228 | break; |
2171 | break; |
2229 | #endif |
2172 | #endif |
2230 | } |
2173 | } |
2231 | } |
2174 | } |
2232 | #ifdef MENUBAR |
|
|
2233 | else if (isMenuBarWindow (ev.window)) |
|
|
2234 | menubar_control (ev); |
|
|
2235 | #endif |
|
|
2236 | } |
2175 | } |
2237 | |
2176 | |
2238 | #ifdef TRANSPARENT |
2177 | #ifdef TRANSPARENT |
2239 | #if TINTING |
2178 | #if TINTING |
2240 | /* taken from aterm-0.4.2 */ |
2179 | /* taken from aterm-0.4.2 */ |
2241 | |
2180 | |
2242 | typedef uint32_t RUINT32T; |
2181 | typedef uint32_t RUINT32T; |
2243 | |
2182 | |
2244 | 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) |
2245 | { |
2184 | { |
2246 | int sh_r, sh_g, sh_b; |
2185 | int sh_r, sh_g, sh_b; |
2247 | RUINT32T mask_r, mask_g, mask_b; |
2186 | RUINT32T mask_r, mask_g, mask_b; |
2248 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
2187 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
2249 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
2188 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
2250 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
2189 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
2251 | int i; |
2190 | int i; |
2252 | |
2191 | |
2253 | Visual *visual = display->visual; |
2192 | Visual *visual = term->visual; |
2254 | |
2193 | |
2255 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
2194 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
2256 | |
2195 | |
2257 | /* for convenience */ |
2196 | /* for convenience */ |
2258 | mask_r = visual->red_mask; |
2197 | mask_r = visual->red_mask; |
… | |
… | |
2479 | Atom atype; |
2418 | Atom atype; |
2480 | unsigned char *prop = NULL; |
2419 | unsigned char *prop = NULL; |
2481 | Window root, oldp, *list; |
2420 | Window root, oldp, *list; |
2482 | Pixmap rootpixmap = None; |
2421 | Pixmap rootpixmap = None; |
2483 | XWindowAttributes wattr, wrootattr; |
2422 | XWindowAttributes wattr, wrootattr; |
2484 | dDisp; |
|
|
2485 | |
2423 | |
2486 | pchanged = 0; |
2424 | pchanged = 0; |
2487 | |
2425 | |
2488 | if (!OPTION (Opt_transparent)) |
2426 | if (!OPTION (Opt_transparent)) |
2489 | return pchanged; /* Don't try any more */ |
2427 | return pchanged; /* Don't try any more */ |
2490 | |
2428 | |
2491 | XGetWindowAttributes (disp, display->root, &wrootattr); |
2429 | XGetWindowAttributes (xdisp, display->root, &wrootattr); |
2492 | rootdepth = wrootattr.depth; |
2430 | rootdepth = wrootattr.depth; |
2493 | |
2431 | |
2494 | XGetWindowAttributes (disp, parent[0], &wattr); |
2432 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
2495 | |
2433 | |
2496 | if (rootdepth != wattr.depth) |
2434 | if (rootdepth != wattr.depth) |
2497 | { |
2435 | { |
2498 | if (am_transparent) |
2436 | if (am_transparent) |
2499 | { |
2437 | { |
2500 | pchanged = 1; |
2438 | pchanged = 1; |
2501 | XSetWindowBackground (disp, vt, pix_colors_focused[Color_bg]); |
2439 | XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]); |
2502 | am_transparent = am_pixmap_trans = 0; |
2440 | am_transparent = am_pixmap_trans = 0; |
2503 | } |
2441 | } |
2504 | |
2442 | |
2505 | return pchanged; /* Don't try any more */ |
2443 | return pchanged; /* Don't try any more */ |
2506 | } |
2444 | } |
2507 | |
2445 | |
2508 | /* 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. */ |
2509 | XSync (disp, False); |
2447 | XSync (xdisp, False); |
2510 | |
2448 | |
2511 | /* |
2449 | /* |
2512 | * Make the frame window set by the window manager have |
2450 | * Make the frame window set by the window manager have |
2513 | * the root background. Some window managers put multiple nested frame |
2451 | * the root background. Some window managers put multiple nested frame |
2514 | * 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. |
2515 | */ |
2453 | */ |
2516 | i = (xa[XA_XROOTPMAP_ID] |
2454 | i = (xa[XA_XROOTPMAP_ID] |
2517 | && XGetWindowProperty (disp, display->root, xa[XA_XROOTPMAP_ID], |
2455 | && XGetWindowProperty (xdisp, display->root, xa[XA_XROOTPMAP_ID], |
2518 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2456 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2519 | &nitems, &bytes_after, &prop) == Success); |
2457 | &nitems, &bytes_after, &prop) == Success); |
2520 | |
2458 | |
2521 | if (!i || prop == NULL) |
2459 | if (!i || prop == NULL) |
2522 | i = (xa[XA_ESETROOT_PMAP_ID] |
2460 | i = (xa[XA_ESETROOT_PMAP_ID] |
2523 | && XGetWindowProperty (disp, display->root, xa[XA_ESETROOT_PMAP_ID], |
2461 | && XGetWindowProperty (xdisp, display->root, xa[XA_ESETROOT_PMAP_ID], |
2524 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2462 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2525 | &nitems, &bytes_after, &prop) == Success); |
2463 | &nitems, &bytes_after, &prop) == Success); |
2526 | |
2464 | |
2527 | if (!i || prop == NULL |
2465 | if (!i || prop == NULL |
2528 | #if TINTING |
2466 | #if TINTING |
2529 | || !rs[Rs_color + Color_tint] |
2467 | || !ISSET_PIXCOLOR (Color_tint) |
2530 | #endif |
2468 | #endif |
2531 | ) |
2469 | ) |
2532 | have_pixmap = 0; |
2470 | have_pixmap = 0; |
2533 | else |
2471 | else |
2534 | { |
2472 | { |
… | |
… | |
2547 | Window cr; |
2485 | Window cr; |
2548 | XImage *image; |
2486 | XImage *image; |
2549 | GC gc; |
2487 | GC gc; |
2550 | XGCValues gcvalue; |
2488 | XGCValues gcvalue; |
2551 | |
2489 | |
2552 | XTranslateCoordinates (disp, parent[0], display->root, |
2490 | XTranslateCoordinates (xdisp, parent[0], display->root, |
2553 | 0, 0, &sx, &sy, &cr); |
2491 | 0, 0, &sx, &sy, &cr); |
2554 | nw = (unsigned int)szHint.width; |
2492 | nw = (unsigned int)szHint.width; |
2555 | nh = (unsigned int)szHint.height; |
2493 | nh = (unsigned int)szHint.height; |
2556 | nx = ny = 0; |
2494 | nx = ny = 0; |
2557 | |
2495 | |
… | |
… | |
2570 | } |
2508 | } |
2571 | |
2509 | |
2572 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
2510 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
2573 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
2511 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
2574 | |
2512 | |
2575 | XSync (disp, False); |
2513 | XSync (xdisp, False); |
2576 | allowedxerror = -1; |
2514 | allowedxerror = -1; |
2577 | image = XGetImage (disp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
2515 | image = XGetImage (xdisp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
2578 | |
2516 | |
2579 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
2517 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
2580 | /* XXX: may need a delay here? */ |
2518 | /* XXX: may need a delay here? */ |
2581 | allowedxerror = 0; |
2519 | allowedxerror = 0; |
2582 | |
2520 | |
… | |
… | |
2585 | if (am_transparent && am_pixmap_trans) |
2523 | if (am_transparent && am_pixmap_trans) |
2586 | { |
2524 | { |
2587 | pchanged = 1; |
2525 | pchanged = 1; |
2588 | if (pixmap != None) |
2526 | if (pixmap != None) |
2589 | { |
2527 | { |
2590 | XFreePixmap (disp, pixmap); |
2528 | XFreePixmap (xdisp, pixmap); |
2591 | pixmap = None; |
2529 | pixmap = None; |
2592 | } |
2530 | } |
2593 | } |
2531 | } |
2594 | |
2532 | |
2595 | am_pixmap_trans = 0; |
2533 | am_pixmap_trans = 0; |
2596 | } |
2534 | } |
2597 | else |
2535 | else |
2598 | { |
2536 | { |
2599 | if (pixmap != None) |
2537 | if (pixmap != None) |
2600 | XFreePixmap (disp, pixmap); |
2538 | XFreePixmap (xdisp, pixmap); |
2601 | |
2539 | |
2602 | #if TINTING |
2540 | #if TINTING |
2603 | if (ISSET_PIXCOLOR (Color_tint)) |
2541 | if (ISSET_PIXCOLOR (Color_tint)) |
2604 | { |
2542 | { |
2605 | unsigned short rm, gm, bm; |
|
|
2606 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
2543 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
2607 | |
2544 | |
|
|
2545 | rgba c; |
2608 | pix_colors_focused[Color_tint].get (display, rm, gm, bm); |
2546 | pix_colors_focused [Color_tint].get (this, c); |
2609 | |
2547 | |
2610 | ShadeXImage (display, image, shade, rm, gm, bm); |
2548 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
2611 | } |
2549 | } |
2612 | #endif |
2550 | #endif |
2613 | |
2551 | |
2614 | pixmap = XCreatePixmap (disp, vt, |
2552 | pixmap = XCreatePixmap (xdisp, vt, szHint.width, szHint.height, image->depth); |
2615 | szHint.width, szHint.height, image->depth); |
|
|
2616 | gc = XCreateGC (disp, vt, 0UL, &gcvalue); |
2553 | gc = XCreateGC (xdisp, vt, 0UL, &gcvalue); |
2617 | XPutImage (disp, pixmap, gc, image, 0, 0, |
2554 | XPutImage (xdisp, pixmap, gc, image, 0, 0, |
2618 | nx, ny, image->width, image->height); |
2555 | nx, ny, image->width, image->height); |
2619 | XFreeGC (disp, gc); |
2556 | XFreeGC (xdisp, gc); |
2620 | XDestroyImage (image); |
2557 | XDestroyImage (image); |
2621 | XSetWindowBackgroundPixmap (disp, parent[0], pixmap); |
2558 | XSetWindowBackgroundPixmap (xdisp, parent[0], pixmap); |
2622 | XClearWindow (disp, parent[0]); |
2559 | XClearWindow (xdisp, parent[0]); |
2623 | |
2560 | |
2624 | if (!am_transparent || !am_pixmap_trans) |
2561 | if (!am_transparent || !am_pixmap_trans) |
2625 | pchanged = 1; |
2562 | pchanged = 1; |
2626 | |
2563 | |
2627 | am_transparent = am_pixmap_trans = 1; |
2564 | am_transparent = am_pixmap_trans = 1; |
2628 | } |
2565 | } |
2629 | } |
2566 | } |
2630 | |
2567 | |
2631 | if (am_pixmap_trans) |
2568 | if (am_pixmap_trans) |
2632 | XSetWindowBackgroundPixmap (disp, vt, ParentRelative); |
2569 | XSetWindowBackgroundPixmap (xdisp, vt, ParentRelative); |
2633 | else |
2570 | else |
2634 | { |
2571 | { |
2635 | unsigned int n; |
2572 | unsigned int n; |
2636 | /* |
2573 | /* |
2637 | * InheritPixmap transparency |
2574 | * InheritPixmap transparency |
2638 | */ |
2575 | */ |
2639 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2576 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2640 | { |
2577 | { |
2641 | oldp = parent[i]; |
2578 | oldp = parent[i]; |
2642 | XQueryTree (disp, parent[i - 1], &root, |
2579 | XQueryTree (xdisp, parent[i - 1], &root, &parent[i], &list, &n); |
2643 | &parent[i], &list, &n); |
|
|
2644 | XFree (list); |
2580 | XFree (list); |
2645 | |
2581 | |
2646 | if (parent[i] == display->root) |
2582 | if (parent[i] == display->root) |
2647 | { |
2583 | { |
2648 | if (oldp != None) |
2584 | if (oldp != None) |
… | |
… | |
2656 | } |
2592 | } |
2657 | |
2593 | |
2658 | n = 0; |
2594 | n = 0; |
2659 | |
2595 | |
2660 | if (pchanged) |
2596 | if (pchanged) |
2661 | { |
|
|
2662 | for (; n < (unsigned int)i; n++) |
2597 | for (; n < (unsigned int)i; n++) |
2663 | { |
2598 | { |
2664 | XGetWindowAttributes (disp, parent[n], &wattr); |
2599 | XGetWindowAttributes (xdisp, parent[n], &wattr); |
|
|
2600 | |
2665 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
2601 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
2666 | { |
2602 | { |
2667 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
2603 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
2668 | break; |
2604 | break; |
2669 | } |
2605 | } |
2670 | } |
2606 | } |
2671 | } |
|
|
2672 | |
2607 | |
2673 | if (n > (int) (sizeof (parent) / sizeof (parent[0]))) |
2608 | if (n > (sizeof (parent) / sizeof (parent[0]))) |
2674 | { |
2609 | { |
2675 | XSetWindowBackground (disp, parent[0], pix_colors_focused[Color_border]); |
2610 | XSetWindowBackground (xdisp, parent[0], pix_colors_focused[Color_border]); |
2676 | XSetWindowBackground (disp, vt, pix_colors_focused[Color_bg]); |
2611 | XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]); |
2677 | am_transparent = 0; |
2612 | am_transparent = 0; |
2678 | /* XXX: also turn off Opt_transparent? */ |
2613 | /* XXX: also turn off Opt_transparent? */ |
2679 | } |
2614 | } |
2680 | else |
2615 | else |
2681 | { |
2616 | { |
2682 | #if WAIT_FOR_WM |
|
|
2683 | /* wait (an arbitrary period) for the WM to do its thing |
|
|
2684 | * needed for fvwm2.2.2 (and before?) */ |
|
|
2685 | sleep (1); |
|
|
2686 | #endif |
|
|
2687 | for (n = 0; n < (unsigned int)i; n++) |
2617 | for (n = 0; n < (unsigned int)i; n++) |
2688 | { |
2618 | { |
2689 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2619 | XSetWindowBackgroundPixmap (xdisp, parent[n], ParentRelative); |
2690 | XClearWindow (disp, parent[n]); |
2620 | XClearWindow (xdisp, parent[n]); |
2691 | } |
2621 | } |
2692 | |
2622 | |
2693 | XSetWindowBackgroundPixmap (disp, vt, ParentRelative); |
2623 | XSetWindowBackgroundPixmap (xdisp, vt, ParentRelative); |
2694 | am_transparent = 1; |
2624 | am_transparent = 1; |
2695 | } |
2625 | } |
2696 | |
2626 | |
2697 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2627 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2698 | parent[i] = None; |
2628 | parent[i] = None; |
2699 | } |
2629 | } |
2700 | |
2630 | |
2701 | if (scrollBar.win) |
2631 | if (scrollBar.win) |
2702 | { |
2632 | { |
2703 | XSetWindowBackgroundPixmap (disp, scrollBar.win, ParentRelative); |
2633 | XSetWindowBackgroundPixmap (xdisp, scrollBar.win, ParentRelative); |
2704 | scrollBar.setIdle (); |
2634 | scrollBar.setIdle (); |
2705 | scrollbar_show (0); |
2635 | scrollbar_show (0); |
2706 | } |
2636 | } |
2707 | |
2637 | |
2708 | if (am_transparent) |
2638 | if (am_transparent) |
… | |
… | |
2720 | |
2650 | |
2721 | bool |
2651 | bool |
2722 | rxvt_term::cmd_parse () |
2652 | rxvt_term::cmd_parse () |
2723 | { |
2653 | { |
2724 | bool flag = false; |
2654 | bool flag = false; |
2725 | unicode_t ch = NOCHAR; |
2655 | wchar_t ch = NOCHAR; |
2726 | char *seq_begin; // remember start of esc-sequence here |
2656 | char *seq_begin; // remember start of esc-sequence here |
2727 | |
2657 | |
2728 | for (;;) |
2658 | for (;;) |
2729 | { |
2659 | { |
2730 | if (ch == NOCHAR) |
2660 | if (ch == NOCHAR) |
… | |
… | |
2751 | if (seen_resize && cmd_pid) |
2681 | if (seen_resize && cmd_pid) |
2752 | kill (-cmd_pid, SIGWINCH); |
2682 | kill (-cmd_pid, SIGWINCH); |
2753 | } |
2683 | } |
2754 | |
2684 | |
2755 | /* Read a text string from the input buffer */ |
2685 | /* Read a text string from the input buffer */ |
2756 | unicode_t buf[UBUFSIZ]; |
2686 | wchar_t buf[UBUFSIZ]; |
2757 | bool refreshnow = false; |
2687 | bool refreshnow = false; |
2758 | int nlines = 0; |
2688 | int nlines = 0; |
2759 | unicode_t *str = buf; |
2689 | wchar_t *str = buf; |
2760 | unicode_t *eol = str + min (ncol, UBUFSIZ); |
2690 | wchar_t *eol = str + min (ncol, UBUFSIZ); |
2761 | |
2691 | |
2762 | for (;;) |
2692 | for (;;) |
2763 | { |
2693 | { |
2764 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2694 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2765 | break; |
2695 | break; |
… | |
… | |
2783 | } |
2713 | } |
2784 | |
2714 | |
2785 | // scr_add_lines only works for nlines <= nrow - 1. |
2715 | // scr_add_lines only works for nlines <= nrow - 1. |
2786 | if (nlines >= nrow - 1) |
2716 | if (nlines >= nrow - 1) |
2787 | { |
2717 | { |
|
|
2718 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
2788 | if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_USTRING_LEN, buf, str - buf, DT_END))) |
2719 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2789 | scr_add_lines (buf, nlines, str - buf); |
2720 | scr_add_lines (buf, str - buf, nlines); |
2790 | |
2721 | |
2791 | nlines = 0; |
2722 | nlines = 0; |
2792 | str = buf; |
2723 | str = buf; |
2793 | eol = str + min (ncol, UBUFSIZ); |
2724 | eol = str + min (ncol, UBUFSIZ); |
2794 | } |
2725 | } |
… | |
… | |
2808 | |
2739 | |
2809 | seq_begin = cmdbuf_ptr; |
2740 | seq_begin = cmdbuf_ptr; |
2810 | ch = next_char (); |
2741 | ch = next_char (); |
2811 | } |
2742 | } |
2812 | |
2743 | |
|
|
2744 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
2813 | if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_USTRING_LEN, buf, str - buf, DT_END))) |
2745 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2814 | scr_add_lines (buf, nlines, str - buf); |
2746 | scr_add_lines (buf, str - buf, nlines); |
2815 | |
2747 | |
2816 | /* |
2748 | /* |
2817 | * If there have been a lot of new lines, then update the screen |
2749 | * If there have been a lot of new lines, then update the screen |
2818 | * What the heck I'll cheat and only refresh less than every page-full. |
2750 | * What the heck I'll cheat and only refresh less than every page-full. |
2819 | * the number of pages between refreshes is refresh_limit, which |
2751 | * the number of pages between refreshes is refresh_limit, which |
… | |
… | |
2824 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2756 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2825 | refresh_limit++; |
2757 | refresh_limit++; |
2826 | else |
2758 | else |
2827 | { |
2759 | { |
2828 | flag = true; |
2760 | flag = true; |
2829 | scr_refresh (refresh_type); |
2761 | scr_refresh (); |
2830 | flush_ev.stop (); |
2762 | want_refresh = 1; |
2831 | } |
2763 | } |
2832 | } |
2764 | } |
2833 | |
2765 | |
2834 | } |
2766 | } |
2835 | else |
2767 | else |
… | |
… | |
2850 | } |
2782 | } |
2851 | |
2783 | |
2852 | return flag; |
2784 | return flag; |
2853 | } |
2785 | } |
2854 | |
2786 | |
2855 | // read the next octet |
|
|
2856 | unicode_t |
|
|
2857 | rxvt_term::next_octet () |
|
|
2858 | { |
|
|
2859 | return cmdbuf_ptr < cmdbuf_endp |
|
|
2860 | ? *cmdbuf_ptr++ |
|
|
2861 | : NOCHAR; |
|
|
2862 | } |
|
|
2863 | |
|
|
2864 | // read the next character |
2787 | // read the next character |
2865 | unicode_t |
2788 | wchar_t |
2866 | rxvt_term::next_char () |
2789 | rxvt_term::next_char () NOTHROW |
2867 | { |
2790 | { |
2868 | while (cmdbuf_ptr < cmdbuf_endp) |
2791 | while (cmdbuf_ptr < cmdbuf_endp) |
2869 | { |
2792 | { |
2870 | // assume 7-bit to be ascii ALWAYS |
2793 | // assume 7-bit to be ascii ALWAYS |
2871 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2794 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
… | |
… | |
2880 | cmdbuf_ptr = cmdbuf_endp; |
2803 | cmdbuf_ptr = cmdbuf_endp; |
2881 | break; |
2804 | break; |
2882 | } |
2805 | } |
2883 | |
2806 | |
2884 | if (len == (size_t)-1) |
2807 | if (len == (size_t)-1) |
2885 | return *cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2808 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2886 | |
2809 | |
2887 | // assume wchar == unicode |
2810 | // assume wchar == unicode |
2888 | cmdbuf_ptr += len; |
2811 | cmdbuf_ptr += len; |
2889 | return wc & UNICODE_MASK; |
2812 | return wc & UNICODE_MASK; |
2890 | } |
2813 | } |
2891 | |
2814 | |
2892 | return NOCHAR; |
2815 | return NOCHAR; |
2893 | } |
2816 | } |
|
|
2817 | |
|
|
2818 | // read the next octet |
|
|
2819 | uint32_t |
|
|
2820 | rxvt_term::next_octet () NOTHROW |
|
|
2821 | { |
|
|
2822 | return cmdbuf_ptr < cmdbuf_endp |
|
|
2823 | ? (unsigned char)*cmdbuf_ptr++ |
|
|
2824 | : NOCHAR; |
|
|
2825 | } |
|
|
2826 | |
|
|
2827 | static class out_of_input out_of_input; |
2894 | |
2828 | |
2895 | /* rxvt_cmd_getc () - Return next input character */ |
2829 | /* rxvt_cmd_getc () - Return next input character */ |
2896 | /* |
2830 | /* |
2897 | * Return the next input character after first passing any keyboard input |
2831 | * Return the next input character after first passing any keyboard input |
2898 | * to the command. |
2832 | * to the command. |
2899 | */ |
2833 | */ |
2900 | unicode_t |
2834 | wchar_t |
2901 | rxvt_term::cmd_getc () |
2835 | rxvt_term::cmd_getc () THROW ((class out_of_input)) |
2902 | { |
2836 | { |
2903 | unicode_t c = next_char (); |
2837 | wchar_t c = next_char (); |
2904 | |
2838 | |
2905 | if (c == NOCHAR) |
2839 | if (c == NOCHAR) |
2906 | throw out_of_input; |
2840 | throw out_of_input; |
2907 | |
2841 | |
2908 | return c; |
2842 | return c; |
2909 | } |
2843 | } |
2910 | |
2844 | |
2911 | unicode_t |
2845 | uint32_t |
2912 | rxvt_term::cmd_get8 () |
2846 | rxvt_term::cmd_get8 () THROW ((class out_of_input)) |
2913 | { |
2847 | { |
2914 | unicode_t c = next_octet (); |
2848 | uint32_t c = next_octet (); |
2915 | |
2849 | |
2916 | if (c == NOCHAR) |
2850 | if (c == NOCHAR) |
2917 | throw out_of_input; |
2851 | throw out_of_input; |
2918 | |
2852 | |
2919 | return c; |
2853 | return c; |
… | |
… | |
3155 | scr_charset_set (2, (unsigned int)cmd_getc ()); |
3089 | scr_charset_set (2, (unsigned int)cmd_getc ()); |
3156 | break; |
3090 | break; |
3157 | case '+': |
3091 | case '+': |
3158 | scr_charset_set (3, (unsigned int)cmd_getc ()); |
3092 | scr_charset_set (3, (unsigned int)cmd_getc ()); |
3159 | break; |
3093 | break; |
3160 | #if ENABLE_FRILLS |
3094 | #if !ENABLE_MINIMAL |
3161 | case '6': |
3095 | case '6': |
3162 | scr_backindex (); |
3096 | scr_backindex (); |
3163 | break; |
3097 | break; |
3164 | #endif |
3098 | #endif |
3165 | case '7': |
3099 | case '7': |
3166 | scr_cursor (SAVE); |
3100 | scr_cursor (SAVE); |
3167 | break; |
3101 | break; |
3168 | case '8': |
3102 | case '8': |
3169 | scr_cursor (RESTORE); |
3103 | scr_cursor (RESTORE); |
3170 | break; |
3104 | break; |
3171 | #if ENABLE_FRILLS |
3105 | #if !ENABLE_MINIMAL |
3172 | case '9': |
3106 | case '9': |
3173 | scr_forwardindex (); |
3107 | scr_forwardindex (); |
3174 | break; |
3108 | break; |
3175 | #endif |
3109 | #endif |
3176 | case '=': |
3110 | case '=': |
… | |
… | |
3186 | break; |
3120 | break; |
3187 | |
3121 | |
3188 | /* 8.3.87: NEXT LINE */ |
3122 | /* 8.3.87: NEXT LINE */ |
3189 | case C1_NEL: /* ESC E */ |
3123 | case C1_NEL: /* ESC E */ |
3190 | { |
3124 | { |
3191 | unicode_t nlcr[] = { C0_LF, C0_CR }; |
3125 | wchar_t nlcr[] = { C0_LF, C0_CR }; |
3192 | scr_add_lines (nlcr, 1, 2); |
3126 | scr_add_lines (nlcr, sizeof (nlcr) / sizeof (nlcr [0]), 1); |
3193 | } |
3127 | } |
3194 | break; |
3128 | break; |
3195 | |
3129 | |
3196 | /* kidnapped escape sequence: Should be 8.3.48 */ |
3130 | /* kidnapped escape sequence: Should be 8.3.48 */ |
3197 | case C1_ESA: /* ESC G */ |
3131 | case C1_ESA: /* ESC G */ |
… | |
… | |
3338 | ndef = get_byte_array_bit (csi_defaults, i); |
3272 | ndef = get_byte_array_bit (csi_defaults, i); |
3339 | for (p = 0; p < nargs; p++) |
3273 | for (p = 0; p < nargs; p++) |
3340 | if (arg[p] == -1) |
3274 | if (arg[p] == -1) |
3341 | arg[p] = ndef; |
3275 | arg[p] = ndef; |
3342 | |
3276 | |
3343 | #ifdef DEBUG_CMD |
|
|
3344 | fprintf (stderr, "CSI "); |
|
|
3345 | for (p = 0; p < nargs; p++) |
|
|
3346 | fprintf (stderr, "%d%s", arg[p], p < nargs - 1 ? ";" : ""); |
|
|
3347 | fprintf (stderr, "%c\n", ch); |
|
|
3348 | #endif |
|
|
3349 | |
|
|
3350 | /* |
3277 | /* |
3351 | * private mode handling |
3278 | * private mode handling |
3352 | */ |
3279 | */ |
3353 | if (priv) |
3280 | if (priv) |
3354 | { |
3281 | { |
3355 | switch (priv) |
3282 | switch (priv) |
3356 | { |
3283 | { |
3357 | case '>': |
3284 | case '>': |
3358 | if (ch == CSI_DA) /* secondary device attributes */ |
3285 | if (ch == CSI_DA) /* secondary device attributes */ |
3359 | tt_printf ("\033[>%d;%c%c;0c", 'U', VERSION[0], VERSION[2]); |
3286 | { |
|
|
3287 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
|
|
3288 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
|
|
3289 | // |
|
|
3290 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
|
|
3291 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
|
|
3292 | // that we do not support xterm mouse reporting (should be 95 when we do). |
|
|
3293 | // |
|
|
3294 | tt_printf ("\033[>%d;94;0c", 'U'); |
|
|
3295 | } |
3360 | break; |
3296 | break; |
3361 | case '?': |
3297 | case '?': |
3362 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3298 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3363 | process_terminal_mode (ch, priv, nargs, arg); |
3299 | process_terminal_mode (ch, priv, nargs, arg); |
3364 | break; |
3300 | break; |
… | |
… | |
3567 | break; |
3503 | break; |
3568 | case CSI_75: |
3504 | case CSI_75: |
3569 | scr_cursor (RESTORE); |
3505 | scr_cursor (RESTORE); |
3570 | break; |
3506 | break; |
3571 | |
3507 | |
3572 | #if ENABLE_FRILLS |
3508 | #if !ENABLE_MINIMAL |
3573 | case CSI_74: |
3509 | case CSI_74: |
3574 | process_window_ops (arg, nargs); |
3510 | process_window_ops (arg, nargs); |
3575 | break; |
3511 | break; |
3576 | #endif |
3512 | #endif |
3577 | |
3513 | |
… | |
… | |
3584 | break; |
3520 | break; |
3585 | } |
3521 | } |
3586 | } |
3522 | } |
3587 | /*}}} */ |
3523 | /*}}} */ |
3588 | |
3524 | |
3589 | #if ENABLE_FRILLS |
3525 | #if !ENABLE_MINIMAL |
3590 | /* ARGSUSED */ |
3526 | /* ARGSUSED */ |
3591 | void |
3527 | void |
3592 | rxvt_term::process_window_ops (const int *args, unsigned int nargs) |
3528 | rxvt_term::process_window_ops (const int *args, unsigned int nargs) |
3593 | { |
3529 | { |
3594 | int x, y; |
3530 | int x, y; |
3595 | XWindowAttributes wattr; |
3531 | XWindowAttributes wattr; |
3596 | Window wdummy; |
3532 | Window wdummy; |
3597 | dDisp; |
3533 | |
|
|
3534 | dLocal (Display *, xdisp); |
3598 | |
3535 | |
3599 | if (nargs == 0) |
3536 | if (nargs == 0) |
3600 | return; |
3537 | return; |
3601 | |
3538 | |
3602 | switch (args[0]) |
3539 | switch (args[0]) |
3603 | { |
3540 | { |
3604 | /* |
3541 | /* |
3605 | * commands |
3542 | * commands |
3606 | */ |
3543 | */ |
3607 | case 1: /* deiconify window */ |
3544 | case 1: /* deiconify window */ |
3608 | XMapWindow (disp, parent[0]); |
3545 | XMapWindow (xdisp, parent[0]); |
3609 | break; |
3546 | break; |
3610 | case 2: /* iconify window */ |
3547 | case 2: /* iconify window */ |
3611 | XIconifyWindow (disp, parent[0], display->screen); |
3548 | XIconifyWindow (xdisp, parent[0], display->screen); |
3612 | break; |
3549 | break; |
3613 | case 3: /* set position (pixels) */ |
3550 | case 3: /* set position (pixels) */ |
3614 | XMoveWindow (disp, parent[0], args[1], args[2]); |
3551 | XMoveWindow (xdisp, parent[0], args[1], args[2]); |
3615 | break; |
3552 | break; |
3616 | case 4: /* set size (pixels) */ |
3553 | case 4: /* set size (pixels) */ |
3617 | set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); |
3554 | set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); |
3618 | break; |
3555 | break; |
3619 | case 5: /* raise window */ |
3556 | case 5: /* raise window */ |
3620 | XRaiseWindow (disp, parent[0]); |
3557 | XRaiseWindow (xdisp, parent[0]); |
3621 | break; |
3558 | break; |
3622 | case 6: /* lower window */ |
3559 | case 6: /* lower window */ |
3623 | XLowerWindow (disp, parent[0]); |
3560 | XLowerWindow (xdisp, parent[0]); |
3624 | break; |
3561 | break; |
3625 | case 7: /* refresh window */ |
3562 | case 7: /* refresh window */ |
3626 | scr_touch (true); |
3563 | scr_touch (true); |
3627 | break; |
3564 | break; |
3628 | case 8: /* set size (chars) */ |
3565 | case 8: /* set size (chars) */ |
… | |
… | |
3635 | if (args[0] >= 24) /* set height (chars) */ |
3572 | if (args[0] >= 24) /* set height (chars) */ |
3636 | set_widthheight ((unsigned int)width, |
3573 | set_widthheight ((unsigned int)width, |
3637 | (unsigned int) (args[1] * fheight)); |
3574 | (unsigned int) (args[1] * fheight)); |
3638 | break; |
3575 | break; |
3639 | |
3576 | |
3640 | |
|
|
3641 | /* |
3577 | /* |
3642 | * reports - some output format copied from XTerm |
3578 | * reports - some output format copied from XTerm |
3643 | */ |
3579 | */ |
3644 | case 11: /* report window state */ |
3580 | case 11: /* report window state */ |
3645 | XGetWindowAttributes (disp, parent[0], &wattr); |
3581 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3646 | tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); |
3582 | tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); |
3647 | break; |
3583 | break; |
3648 | case 13: /* report window position */ |
3584 | case 13: /* report window position */ |
3649 | XGetWindowAttributes (disp, parent[0], &wattr); |
3585 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3650 | XTranslateCoordinates (disp, parent[0], wattr.root, |
3586 | XTranslateCoordinates (xdisp, parent[0], wattr.root, |
3651 | -wattr.border_width, -wattr.border_width, |
3587 | -wattr.border_width, -wattr.border_width, |
3652 | &x, &y, &wdummy); |
3588 | &x, &y, &wdummy); |
3653 | tt_printf ("\033[3;%d;%dt", x, y); |
3589 | tt_printf ("\033[3;%d;%dt", x, y); |
3654 | break; |
3590 | break; |
3655 | case 14: /* report window size (pixels) */ |
3591 | case 14: /* report window size (pixels) */ |
3656 | XGetWindowAttributes (disp, parent[0], &wattr); |
3592 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3657 | tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); |
3593 | tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); |
3658 | break; |
3594 | break; |
3659 | case 18: /* report text area size (chars) */ |
3595 | case 18: /* report text area size (chars) */ |
3660 | tt_printf ("\033[8;%d;%dt", nrow, ncol); |
3596 | tt_printf ("\033[8;%d;%dt", nrow, ncol); |
3661 | break; |
3597 | break; |
… | |
… | |
3663 | tt_printf ("\033[9;%d;%dt", nrow, ncol); |
3599 | tt_printf ("\033[9;%d;%dt", nrow, ncol); |
3664 | break; |
3600 | break; |
3665 | case 20: /* report icon label */ |
3601 | case 20: /* report icon label */ |
3666 | { |
3602 | { |
3667 | char *s; |
3603 | char *s; |
3668 | XGetIconName (disp, parent[0], &s); |
3604 | XGetIconName (xdisp, parent[0], &s); |
3669 | tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3605 | tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3670 | XFree (s); |
3606 | XFree (s); |
3671 | } |
3607 | } |
3672 | break; |
3608 | break; |
3673 | case 21: /* report window title */ |
3609 | case 21: /* report window title */ |
3674 | { |
3610 | { |
3675 | char *s; |
3611 | char *s; |
3676 | XFetchName (disp, parent[0], &s); |
3612 | XFetchName (xdisp, parent[0], &s); |
3677 | tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3613 | tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3678 | XFree (s); |
3614 | XFree (s); |
3679 | } |
3615 | } |
3680 | break; |
3616 | break; |
3681 | } |
3617 | } |
… | |
… | |
3782 | void |
3718 | void |
3783 | rxvt_term::process_color_seq (int report, int color, const char *str, char resp) |
3719 | rxvt_term::process_color_seq (int report, int color, const char *str, char resp) |
3784 | { |
3720 | { |
3785 | if (str[0] == '?' && !str[1]) |
3721 | if (str[0] == '?' && !str[1]) |
3786 | { |
3722 | { |
3787 | unsigned short r, g, b; |
3723 | rgba c; |
3788 | pix_colors_focused[color].get (display, r, g, b); |
3724 | pix_colors_focused[color].get (this, c); |
|
|
3725 | |
|
|
3726 | #if XFT |
|
|
3727 | if (c.a != rgba::MAX_CC) |
|
|
3728 | tt_printf ("\033]%d;rgba:%04x/%04x/%04x/%04x%c", report, c.a, c.r, c.g, c.b, resp); |
|
|
3729 | else |
|
|
3730 | #endif |
3789 | tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, r, g, b, resp); |
3731 | tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, c.r, c.g, c.b, resp); |
3790 | } |
3732 | } |
3791 | else |
3733 | else |
3792 | set_window_color (color, str); |
3734 | set_window_color (color, str); |
3793 | } |
3735 | } |
3794 | |
3736 | |
… | |
… | |
3796 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3738 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3797 | */ |
3739 | */ |
3798 | void |
3740 | void |
3799 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3741 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3800 | { |
3742 | { |
3801 | int changed = 0; |
|
|
3802 | int color; |
3743 | int color; |
3803 | char *buf, *name; |
3744 | char *buf, *name; |
3804 | bool query = str[0] == '?' && !str[1]; |
3745 | bool query = str[0] == '?' && !str[1]; |
3805 | int saveop = op; |
3746 | int saveop = op; |
3806 | dDisp; |
3747 | |
|
|
3748 | dLocal (Display *, xdisp); |
3807 | |
3749 | |
3808 | assert (str != NULL); |
3750 | assert (str != NULL); |
3809 | switch (op) |
3751 | switch (op) |
3810 | { |
3752 | { |
3811 | case XTerm_name: |
3753 | case XTerm_name: |
… | |
… | |
3827 | unsigned long bytes_after; |
3769 | unsigned long bytes_after; |
3828 | unsigned char *value = 0; |
3770 | unsigned char *value = 0; |
3829 | const char *str = ""; |
3771 | const char *str = ""; |
3830 | |
3772 | |
3831 | if (prop |
3773 | if (prop |
3832 | && XGetWindowProperty (disp, parent[0], |
3774 | && XGetWindowProperty (xdisp, parent[0], |
3833 | prop, 0, 1<<16, 0, AnyPropertyType, |
3775 | prop, 0, 1<<16, 0, AnyPropertyType, |
3834 | &actual_type, &actual_format, |
3776 | &actual_type, &actual_format, |
3835 | &nitems, &bytes_after, &value) == Success |
3777 | &nitems, &bytes_after, &value) == Success |
3836 | && actual_type != None |
3778 | && actual_type != None |
3837 | && actual_format == 8) |
3779 | && actual_format == 8) |
3838 | str = (const char *)(value); |
3780 | str = (const char *)(value); |
3839 | |
3781 | |
3840 | tt_printf ("\033]%d;%s%c", XTerm_property, str, resp); |
3782 | tt_printf ("\033]%d;%s%c", op, str, resp); |
3841 | |
3783 | |
3842 | XFree (value); |
3784 | XFree (value); |
3843 | } |
3785 | } |
3844 | else |
3786 | else |
3845 | { |
3787 | { |
… | |
… | |
3849 | { |
3791 | { |
3850 | *eq = 0; |
3792 | *eq = 0; |
3851 | set_utf8_property (display->atom (str), eq + 1); |
3793 | set_utf8_property (display->atom (str), eq + 1); |
3852 | } |
3794 | } |
3853 | else |
3795 | else |
3854 | XDeleteProperty (disp, parent[0], |
3796 | XDeleteProperty (xdisp, parent[0], |
3855 | display->atom (str)); |
3797 | display->atom (str)); |
3856 | } |
3798 | } |
3857 | break; |
3799 | break; |
3858 | |
3800 | |
3859 | case XTerm_Color: |
3801 | case XTerm_Color: |
… | |
… | |
3861 | { |
3803 | { |
3862 | if ((name = strchr (buf, ';')) == NULL) |
3804 | if ((name = strchr (buf, ';')) == NULL) |
3863 | break; |
3805 | break; |
3864 | |
3806 | |
3865 | *name++ = '\0'; |
3807 | *name++ = '\0'; |
3866 | color = atoi (buf); |
3808 | color = atoi (buf) + minCOLOR; |
3867 | |
3809 | |
3868 | if (color < 0 || color >= TOTAL_COLORS) |
3810 | if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) |
3869 | break; |
3811 | break; |
3870 | |
3812 | |
3871 | if ((buf = strchr (name, ';')) != NULL) |
3813 | if ((buf = strchr (name, ';')) != NULL) |
3872 | *buf++ = '\0'; |
3814 | *buf++ = '\0'; |
3873 | |
3815 | |
3874 | if (name[0] == '?' && !name[1]) |
3816 | process_color_seq (op, color, name, resp); |
3875 | { |
|
|
3876 | unsigned short r, g, b; |
|
|
3877 | pix_colors_focused[color + minCOLOR].get (display, r, g, b); |
|
|
3878 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
|
|
3879 | } |
|
|
3880 | else |
|
|
3881 | set_window_color (color + minCOLOR, name); |
|
|
3882 | } |
3817 | } |
3883 | break; |
3818 | break; |
3884 | case XTerm_Color00: |
3819 | case XTerm_Color00: |
3885 | process_color_seq (XTerm_Color00, Color_fg, str, resp); |
3820 | process_color_seq (op, Color_fg, str, resp); |
3886 | break; |
3821 | break; |
3887 | case XTerm_Color01: |
3822 | case XTerm_Color01: |
3888 | process_color_seq (XTerm_Color00, Color_bg, str, resp); |
3823 | process_color_seq (op, Color_bg, str, resp); |
3889 | break; |
3824 | break; |
3890 | #ifndef NO_CURSORCOLOR |
3825 | #ifndef NO_CURSORCOLOR |
3891 | case XTerm_Color_cursor: |
3826 | case XTerm_Color_cursor: |
3892 | process_color_seq (XTerm_Color_cursor, Color_cursor, str, resp); |
3827 | process_color_seq (op, Color_cursor, str, resp); |
3893 | break; |
3828 | break; |
3894 | #endif |
3829 | #endif |
3895 | case XTerm_Color_pointer_fg: |
3830 | case XTerm_Color_pointer_fg: |
3896 | process_color_seq (XTerm_Color_pointer_fg, Color_pointer_fg, str, resp); |
3831 | process_color_seq (op, Color_pointer_fg, str, resp); |
3897 | break; |
3832 | break; |
3898 | case XTerm_Color_pointer_bg: |
3833 | case XTerm_Color_pointer_bg: |
3899 | process_color_seq (XTerm_Color_pointer_bg, Color_pointer_bg, str, resp); |
3834 | process_color_seq (op, Color_pointer_bg, str, resp); |
3900 | break; |
3835 | break; |
3901 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3836 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3902 | case XTerm_Color_BD: |
|
|
3903 | process_color_seq (XTerm_Color_BD, Color_BD, str, resp); |
|
|
3904 | break; |
|
|
3905 | case XTerm_Color_UL: |
|
|
3906 | process_color_seq (XTerm_Color_UL, Color_UL, str, resp); |
|
|
3907 | break; |
|
|
3908 | case XTerm_Color_RV: |
3837 | case XTerm_Color_RV: |
3909 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
3838 | process_color_seq (op, Color_RV, str, resp); |
|
|
3839 | break; |
|
|
3840 | case Rxvt_Color_BD: |
|
|
3841 | case URxvt_Color_BD: |
|
|
3842 | process_color_seq (op, Color_BD, str, resp); |
|
|
3843 | break; |
|
|
3844 | case Rxvt_Color_UL: |
|
|
3845 | case URxvt_Color_UL: |
|
|
3846 | process_color_seq (op, Color_UL, str, resp); |
3910 | break; |
3847 | break; |
3911 | case URxvt_Color_IT: |
3848 | case URxvt_Color_IT: |
3912 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
3849 | process_color_seq (op, Color_IT, str, resp); |
3913 | break; |
3850 | break; |
3914 | #endif |
3851 | #endif |
3915 | #if TRANSPARENT && TINTING |
3852 | #if TRANSPARENT && TINTING |
3916 | case URxvt_Color_tint: |
3853 | case URxvt_Color_tint: |
3917 | process_color_seq (URxvt_Color_tint, Color_tint, str, resp); |
3854 | process_color_seq (op, Color_tint, str, resp); |
|
|
3855 | |
3918 | check_our_parents (); |
3856 | check_our_parents (); |
|
|
3857 | |
3919 | if (am_transparent) |
3858 | if (am_transparent) |
3920 | want_full_refresh = want_refresh = 1; |
3859 | want_full_refresh = want_refresh = 1; |
3921 | break; |
|
|
3922 | #endif |
|
|
3923 | |
3860 | |
|
|
3861 | break; |
|
|
3862 | #endif |
|
|
3863 | |
3924 | case XTerm_Pixmap: |
3864 | case Rxvt_Pixmap: |
|
|
3865 | { |
3925 | if (*str != ';') |
3866 | if (*str != ';') |
3926 | { |
3867 | { |
3927 | #if XPM_BACKGROUND |
3868 | #if XPM_BACKGROUND |
3928 | scale_pixmap (""); /* reset to default scaling */ |
3869 | scale_pixmap (""); /* reset to default scaling */ |
3929 | set_bgPixmap (str); /* change pixmap */ |
3870 | set_bgPixmap (str); /* change pixmap */ |
3930 | #endif |
|
|
3931 | scr_touch (true); |
3871 | scr_touch (true); |
|
|
3872 | #endif |
3932 | } |
3873 | } |
|
|
3874 | |
|
|
3875 | int changed = 0; |
|
|
3876 | |
3933 | while ((str = strchr (str, ';')) != NULL) |
3877 | while ((str = strchr (str, ';')) != NULL) |
3934 | { |
3878 | { |
3935 | str++; |
3879 | str++; |
3936 | #if XPM_BACKGROUND |
3880 | #if XPM_BACKGROUND |
3937 | changed += scale_pixmap (str); |
3881 | changed += scale_pixmap (str); |
3938 | #endif |
3882 | #endif |
3939 | } |
3883 | } |
3940 | |
3884 | |
3941 | if (changed) |
3885 | if (changed) |
3942 | { |
3886 | { |
3943 | #ifdef XPM_BACKGROUND |
3887 | #ifdef XPM_BACKGROUND |
3944 | resize_pixmap (); |
3888 | resize_pixmap (); |
3945 | #endif |
|
|
3946 | scr_touch (true); |
3889 | scr_touch (true); |
|
|
3890 | #endif |
3947 | } |
3891 | } |
|
|
3892 | } |
3948 | break; |
3893 | break; |
3949 | |
3894 | |
3950 | case XTerm_restoreFG: |
3895 | case Rxvt_restoreFG: |
3951 | set_window_color (Color_fg, str); |
3896 | set_window_color (Color_fg, str); |
3952 | break; |
3897 | break; |
3953 | case XTerm_restoreBG: |
3898 | case Rxvt_restoreBG: |
3954 | set_window_color (Color_bg, str); |
3899 | set_window_color (Color_bg, str); |
3955 | break; |
3900 | break; |
3956 | |
3901 | |
3957 | case XTerm_logfile: |
3902 | case XTerm_logfile: |
3958 | // TODO, when secure mode? |
3903 | // TODO, when secure mode? |
3959 | break; |
3904 | break; |
3960 | |
3905 | |
3961 | #ifdef MENUBAR |
|
|
3962 | case URxvt_Menu: |
|
|
3963 | if (OPTION (Opt_insecure)) |
|
|
3964 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
|
|
3965 | break; |
|
|
3966 | #endif |
|
|
3967 | #if 0 |
3906 | #if 0 |
3968 | case XTerm_dumpscreen: /* no error notices */ |
3907 | case Rxvt_dumpscreen: /* no error notices */ |
3969 | { |
3908 | { |
3970 | int fd; |
3909 | int fd; |
3971 | 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) |
3972 | { |
3911 | { |
3973 | scr_dump (fd); |
3912 | scr_dump (fd); |
… | |
… | |
3997 | allocated.push_back ((void *)res); |
3936 | allocated.push_back ((void *)res); |
3998 | set_fonts (); |
3937 | set_fonts (); |
3999 | } |
3938 | } |
4000 | break; |
3939 | break; |
4001 | |
3940 | |
4002 | #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 |
4003 | case URxvt_locale: |
3950 | case URxvt_locale: |
4004 | if (query) |
3951 | if (query) |
4005 | 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); |
4006 | else |
3953 | else |
4007 | { |
3954 | { |
4008 | set_locale (str); |
3955 | set_locale (str); |
4009 | pty.set_utf8_mode (enc_utf8); |
3956 | pty->set_utf8_mode (enc_utf8); |
4010 | init_xlocale (); |
3957 | init_xlocale (); |
4011 | } |
3958 | } |
4012 | break; |
3959 | break; |
4013 | |
3960 | |
4014 | case URxvt_view_up: |
3961 | case URxvt_view_up: |
… | |
… | |
4025 | break; |
3972 | break; |
4026 | #endif |
3973 | #endif |
4027 | |
3974 | |
4028 | #if ENABLE_PERL |
3975 | #if ENABLE_PERL |
4029 | case URxvt_perl: |
3976 | case URxvt_perl: |
4030 | 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))) |
4031 | ; // no responses yet |
3978 | ; // no responses yet |
4032 | break; |
3979 | break; |
4033 | #endif |
3980 | #endif |
4034 | } |
3981 | } |
4035 | } |
3982 | } |
… | |
… | |
4067 | return state; |
4014 | return state; |
4068 | } |
4015 | } |
4069 | |
4016 | |
4070 | /* we're not using priv _yet_ */ |
4017 | /* we're not using priv _yet_ */ |
4071 | void |
4018 | void |
4072 | 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) |
4073 | { |
4020 | { |
4074 | unsigned int i, j; |
4021 | unsigned int i, j; |
4075 | int state; |
4022 | int state; |
4076 | |
4023 | |
4077 | static const struct |
4024 | static const struct |
… | |
… | |
4088 | { 5, PrivMode_rVideo }, |
4035 | { 5, PrivMode_rVideo }, |
4089 | { 6, PrivMode_relOrigin }, |
4036 | { 6, PrivMode_relOrigin }, |
4090 | { 7, PrivMode_Autowrap }, |
4037 | { 7, PrivMode_Autowrap }, |
4091 | // 8, bi-directional support mode |
4038 | // 8, bi-directional support mode |
4092 | { 9, PrivMode_MouseX10 }, |
4039 | { 9, PrivMode_MouseX10 }, |
4093 | #ifdef menuBar_esc |
|
|
4094 | { menuBar_esc, PrivMode_menuBar }, |
|
|
4095 | #endif |
|
|
4096 | // 18, 19 printing-related |
4040 | // 18, 19 printing-related |
4097 | { 25, PrivMode_VisibleCursor }, |
4041 | { 25, PrivMode_VisibleCursor }, |
4098 | #ifdef scrollBar_esc |
4042 | #ifdef scrollBar_esc |
4099 | { scrollBar_esc, PrivMode_scrollBar }, |
4043 | { scrollBar_esc, PrivMode_scrollBar }, |
4100 | #endif |
4044 | #endif |
… | |
… | |
4147 | /* extra handling for values with state unkept */ |
4091 | /* extra handling for values with state unkept */ |
4148 | switch (arg[i]) |
4092 | switch (arg[i]) |
4149 | { |
4093 | { |
4150 | #if ENABLE_STYLES |
4094 | #if ENABLE_STYLES |
4151 | case 1021: |
4095 | case 1021: |
4152 | if (mode) |
4096 | set_option (Opt_intensityStyles, mode); |
4153 | SET_OPTION (Opt_intensityStyles); |
|
|
4154 | else |
|
|
4155 | CLR_OPTION (Opt_intensityStyles); |
|
|
4156 | |
4097 | |
4157 | scr_touch (true); |
4098 | scr_touch (true); |
4158 | break; |
4099 | break; |
4159 | #endif |
4100 | #endif |
4160 | case 1048: /* alternative cursor save */ |
4101 | case 1048: /* alternative cursor save */ |
… | |
… | |
4182 | case 3: /* 80/132 */ |
4123 | case 3: /* 80/132 */ |
4183 | if (priv_modes & PrivMode_132OK) |
4124 | if (priv_modes & PrivMode_132OK) |
4184 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4125 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4185 | break; |
4126 | break; |
4186 | case 4: /* smooth scrolling */ |
4127 | case 4: /* smooth scrolling */ |
4187 | if (!state) |
4128 | set_option (Opt_jumpScroll, !state); |
4188 | SET_OPTION (Opt_jumpScroll); |
|
|
4189 | else |
|
|
4190 | CLR_OPTION (Opt_jumpScroll); |
|
|
4191 | break; |
4129 | break; |
4192 | case 5: /* reverse video */ |
4130 | case 5: /* reverse video */ |
4193 | scr_rvideo_mode (state); |
4131 | scr_rvideo_mode (state); |
4194 | break; |
4132 | break; |
4195 | case 6: /* relative/absolute origins */ |
4133 | case 6: /* relative/absolute origins */ |
… | |
… | |
4201 | /* 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 */ |
4202 | case 9: /* X10 mouse reporting */ |
4140 | case 9: /* X10 mouse reporting */ |
4203 | if (state) /* orthogonal */ |
4141 | if (state) /* orthogonal */ |
4204 | priv_modes &= ~PrivMode_MouseX11; |
4142 | priv_modes &= ~PrivMode_MouseX11; |
4205 | break; |
4143 | break; |
4206 | #ifdef menuBar_esc |
|
|
4207 | case menuBar_esc: |
|
|
4208 | #ifdef MENUBAR |
|
|
4209 | map_menuBar (state); |
|
|
4210 | #endif |
|
|
4211 | break; |
|
|
4212 | #endif |
|
|
4213 | #ifdef scrollBar_esc |
4144 | #ifdef scrollBar_esc |
4214 | case scrollBar_esc: |
4145 | case scrollBar_esc: |
4215 | if (scrollbar_mapping (state)) |
4146 | if (scrollbar_mapping (state)) |
4216 | { |
4147 | { |
4217 | resize_all_windows (0, 0, 0); |
4148 | resize_all_windows (0, 0, 0); |
… | |
… | |
4236 | #if 0 |
4167 | #if 0 |
4237 | case 1001: |
4168 | case 1001: |
4238 | break; /* X11 mouse highlighting */ |
4169 | break; /* X11 mouse highlighting */ |
4239 | #endif |
4170 | #endif |
4240 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4171 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4241 | if (!state) |
4172 | set_option (Opt_scrollTtyOutput, !state); |
4242 | SET_OPTION (Opt_scrollTtyOutput); |
|
|
4243 | else |
|
|
4244 | CLR_OPTION (Opt_scrollTtyOutput); |
|
|
4245 | break; |
4173 | break; |
4246 | case 1011: /* scroll to bottom on key press */ |
4174 | case 1011: /* scroll to bottom on key press */ |
4247 | if (state) |
4175 | set_option (Opt_scrollTtyKeypress, state); |
4248 | SET_OPTION (Opt_scrollTtyKeypress); |
|
|
4249 | else |
|
|
4250 | CLR_OPTION (Opt_scrollTtyKeypress); |
|
|
4251 | break; |
4176 | break; |
4252 | case 1047: /* secondary screen w/ clearing last */ |
4177 | case 1047: /* secondary screen w/ clearing last */ |
4253 | if (OPTION (Opt_secondaryScreen)) |
4178 | if (OPTION (Opt_secondaryScreen)) |
4254 | if (current_screen != PRIMARY) |
4179 | if (current_screen != PRIMARY) |
4255 | scr_erase_screen (2); |
4180 | scr_erase_screen (2); |
… | |
… | |
4393 | scr_color (Color_bg, Color_bg); |
4318 | scr_color (Color_bg, Color_bg); |
4394 | break; |
4319 | break; |
4395 | |
4320 | |
4396 | //case 50: // not variable spacing |
4321 | //case 50: // not variable spacing |
4397 | |
4322 | |
4398 | #if ENABLE_FRILLS |
4323 | #if !ENABLE_MINIMAL |
4399 | case 90: |
4324 | case 90: |
4400 | case 91: /* set bright fg color */ |
4325 | case 91: /* set bright fg color */ |
4401 | case 92: |
4326 | case 92: |
4402 | case 93: |
4327 | case 93: |
4403 | case 94: |
4328 | case 94: |
… | |
… | |
4465 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4390 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4466 | |
4391 | |
4467 | void |
4392 | void |
4468 | rxvt_term::tt_write (const char *data, unsigned int len) |
4393 | rxvt_term::tt_write (const char *data, unsigned int len) |
4469 | { |
4394 | { |
4470 | if (pty.pty < 0) |
4395 | if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) |
4471 | return; |
4396 | return; |
4472 | |
4397 | |
|
|
4398 | if (pty->pty < 0) |
|
|
4399 | return; |
|
|
4400 | |
4473 | if (v_buflen == 0) |
4401 | if (v_buflen == 0) |
4474 | { |
4402 | { |
4475 | 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)); |
4476 | |
4404 | |
4477 | if ((unsigned int)written == len) |
4405 | if ((unsigned int)written == len) |
4478 | return; |
4406 | return; |
4479 | |
4407 | |
4480 | data += written; |
4408 | data += written; |
… | |
… | |
4489 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4417 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4490 | } |
4418 | } |
4491 | |
4419 | |
4492 | void rxvt_term::pty_write () |
4420 | void rxvt_term::pty_write () |
4493 | { |
4421 | { |
4494 | 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)); |
4495 | |
4423 | |
4496 | if (written > 0) |
4424 | if (written > 0) |
4497 | { |
4425 | { |
4498 | v_buflen -= written; |
4426 | v_buflen -= written; |
4499 | |
4427 | |