… | |
… | |
64 | |
64 | |
65 | /*----------------------------------------------------------------------*/ |
65 | /*----------------------------------------------------------------------*/ |
66 | |
66 | |
67 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
67 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
68 | |
68 | |
69 | // exception thrown when the command parser runs out of input data |
|
|
70 | class out_of_input { } out_of_input; |
|
|
71 | |
|
|
72 | #if ENABLE_FRILLS || ISO_14755 |
69 | #if ENABLE_FRILLS || ISO_14755 |
73 | |
70 | |
74 | #define ISO_14755_STARTED 0x80000000UL |
71 | #define ISO_14755_STARTED 0x80000000UL |
75 | #define ISO_14755_51 0x40000000UL // basic (section 5.1) |
72 | #define ISO_14755_51 0x40000000UL // basic (section 5.1) |
76 | #define ISO_14755_52 0x20000000UL // keycap (section 5.2) |
73 | #define ISO_14755_52 0x20000000UL // keycap (section 5.2) |
… | |
… | |
147 | || !IN_RANGE_EXC (y, 0, nrow)) |
144 | || !IN_RANGE_EXC (y, 0, nrow)) |
148 | return; |
145 | return; |
149 | |
146 | |
150 | for (;;) |
147 | for (;;) |
151 | { |
148 | { |
152 | const line_t &l = ROW(y - view_start); |
149 | const line_t &l = ROW(y + view_start); |
153 | |
150 | |
154 | text_t t = l.t[x]; |
151 | text_t t = l.t[x]; |
155 | |
152 | |
156 | if (t != NOCHAR || !x) |
153 | if (t != NOCHAR || !x) |
157 | { |
154 | { |
… | |
… | |
443 | scr_move_to (0, 1); |
440 | scr_move_to (0, 1); |
444 | return; |
441 | return; |
445 | } |
442 | } |
446 | else if (keysym == XK_End) |
443 | else if (keysym == XK_End) |
447 | { |
444 | { |
448 | scr_move_to (1, 0); |
445 | scr_move_to (1, 1); |
449 | return; |
446 | return; |
450 | } |
447 | } |
451 | } |
448 | } |
452 | #endif |
449 | #endif |
453 | } |
450 | } |
… | |
… | |
464 | { |
461 | { |
465 | switch (keysym) |
462 | switch (keysym) |
466 | { |
463 | { |
467 | /* normal XTerm key bindings */ |
464 | /* normal XTerm key bindings */ |
468 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
465 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
469 | selection_request (ev.time, 0, 0); |
466 | selection_request (ev.time); |
470 | return; |
467 | return; |
471 | #if TODO |
468 | #if TODO |
472 | /* rxvt extras */ |
469 | /* rxvt extras */ |
473 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
470 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
474 | change_font (FONT_UP); |
471 | change_font (FONT_UP); |
… | |
… | |
919 | #endif /* DEBUG_CMD */ |
916 | #endif /* DEBUG_CMD */ |
920 | tt_write (kbuf, (unsigned int)len); |
917 | tt_write (kbuf, (unsigned int)len); |
921 | } |
918 | } |
922 | /*}}} */ |
919 | /*}}} */ |
923 | |
920 | |
924 | #if MENUBAR_MAX || defined (KEYSYM_RESOURCE) |
921 | #if defined (KEYSYM_RESOURCE) |
925 | /*{{{ rxvt_cmd_write (), rxvt_cmd_getc () */ |
|
|
926 | /* attempt to `write' count to the input buffer */ |
|
|
927 | unsigned int |
922 | unsigned int |
928 | rxvt_term::cmd_write (const char *str, unsigned int count) |
923 | rxvt_term::cmd_write (const char *str, unsigned int count) |
929 | { |
924 | { |
930 | unsigned int n, s; |
925 | unsigned int n, s; |
931 | |
926 | |
… | |
… | |
972 | |
967 | |
973 | if (want_refresh) |
968 | if (want_refresh) |
974 | { |
969 | { |
975 | if (SHOULD_INVOKE (HOOK_LINE_UPDATE)) |
970 | if (SHOULD_INVOKE (HOOK_LINE_UPDATE)) |
976 | { |
971 | { |
977 | int row = -view_start; |
972 | int row = view_start; |
978 | int end_row = row + nrow; |
973 | int end_row = row + nrow; |
979 | |
974 | |
980 | while (row > -nsaved && ROW (row - 1).is_longer ()) |
975 | while (row > top_row && ROW (row - 1).is_longer ()) |
981 | --row; |
976 | --row; |
982 | |
977 | |
983 | do |
978 | do |
984 | { |
979 | { |
985 | int start_row = row; |
980 | int start_row = row; |
986 | line_t *l; |
981 | line_t *l; |
987 | |
982 | |
988 | do |
983 | do |
989 | { |
984 | { |
990 | l = &ROW (row); |
985 | l = &ROW (row++); |
991 | |
986 | |
992 | if (l->f & LINE_FILTERED) |
987 | if (!(l->f & LINE_FILTERED)) |
993 | row++; |
|
|
994 | else |
|
|
995 | { |
988 | { |
996 | // line not filtered, mark it as filtered |
989 | // line not filtered, mark it as filtered |
997 | l->f |= LINE_FILTERED; |
990 | l->f |= LINE_FILTERED; |
998 | while (l->is_longer ()) |
991 | while (l->is_longer ()) |
999 | { |
992 | { |
1000 | l = &ROW (++row); |
993 | l = &ROW (row++); |
1001 | l->f |= LINE_FILTERED; |
994 | l->f |= LINE_FILTERED; |
1002 | } |
995 | } |
1003 | |
996 | |
1004 | // and filter it |
997 | // and filter it |
1005 | HOOK_INVOKE ((this, HOOK_LINE_UPDATE, DT_INT, start_row, DT_END)); |
998 | HOOK_INVOKE ((this, HOOK_LINE_UPDATE, DT_INT, start_row, DT_END)); |
… | |
… | |
1007 | break; |
1000 | break; |
1008 | } |
1001 | } |
1009 | } |
1002 | } |
1010 | while (l->is_longer () && row < end_row); |
1003 | while (l->is_longer () && row < end_row); |
1011 | } |
1004 | } |
1012 | while (++row < end_row); |
1005 | while (row < end_row); |
1013 | } |
1006 | } |
1014 | |
1007 | |
1015 | scr_refresh (refresh_type); |
1008 | scr_refresh (); |
1016 | scrollbar_show (1); |
1009 | scrollbar_show (1); |
1017 | #ifdef USE_XIM |
1010 | #ifdef USE_XIM |
1018 | IMSendSpot (); |
1011 | IMSendSpot (); |
1019 | #endif |
1012 | #endif |
1020 | } |
1013 | } |
… | |
… | |
1023 | } |
1016 | } |
1024 | |
1017 | |
1025 | void |
1018 | void |
1026 | rxvt_term::check_cb (check_watcher &w) |
1019 | rxvt_term::check_cb (check_watcher &w) |
1027 | { |
1020 | { |
1028 | SET_R (this); |
1021 | make_current (); |
1029 | SET_LOCALE (locale); |
|
|
1030 | |
1022 | |
1031 | display->flush (); |
1023 | display->flush (); |
1032 | |
1024 | |
1033 | if (want_refresh && !flush_ev.active) |
1025 | if (want_refresh && !flush_ev.active) |
1034 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
1026 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
1035 | } |
1027 | } |
1036 | |
1028 | |
1037 | void |
1029 | void |
1038 | rxvt_term::flush_cb (time_watcher &w) |
1030 | rxvt_term::flush_cb (time_watcher &w) |
1039 | { |
1031 | { |
1040 | SET_R (this); |
1032 | make_current (); |
1041 | SET_LOCALE (locale); |
|
|
1042 | |
1033 | |
1043 | refresh_limit = 1; |
1034 | refresh_limit = 1; |
1044 | refresh_count = 0; |
1035 | refresh_count = 0; |
1045 | flush (); |
1036 | flush (); |
1046 | } |
1037 | } |
… | |
… | |
1050 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1041 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1051 | { |
1042 | { |
1052 | hidden_cursor = !hidden_cursor; |
1043 | hidden_cursor = !hidden_cursor; |
1053 | want_refresh = 1; |
1044 | want_refresh = 1; |
1054 | |
1045 | |
1055 | w.start (w.at + BLINK_INTERVAL); |
1046 | w.start (w.at + CURSOR_BLINK_INTERVAL); |
1056 | } |
1047 | } |
1057 | #endif |
1048 | #endif |
1058 | |
1049 | |
1059 | #ifdef TEXT_BLINK |
1050 | #ifdef TEXT_BLINK |
1060 | void |
1051 | void |
… | |
… | |
1074 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1065 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1075 | { |
1066 | { |
1076 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1067 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1077 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1068 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1078 | { |
1069 | { |
1079 | refresh_type |= SMOOTH_REFRESH; |
|
|
1080 | want_refresh = 1; |
1070 | want_refresh = 1; |
1081 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1071 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1082 | } |
1072 | } |
1083 | } |
1073 | } |
1084 | #endif |
1074 | #endif |
… | |
… | |
1088 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1078 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1089 | { |
1079 | { |
1090 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1080 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1091 | { |
1081 | { |
1092 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1082 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1093 | refresh_type |= SMOOTH_REFRESH; |
|
|
1094 | want_refresh = 1; |
1083 | want_refresh = 1; |
1095 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1084 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1096 | } |
1085 | } |
1097 | } |
1086 | } |
1098 | #endif |
1087 | #endif |
… | |
… | |
1103 | { |
1092 | { |
1104 | if (mouse_slip_wheel_speed == 0 |
1093 | if (mouse_slip_wheel_speed == 0 |
1105 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
1094 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
1106 | : scr_page (UP, mouse_slip_wheel_speed)) |
1095 | : scr_page (UP, mouse_slip_wheel_speed)) |
1107 | { |
1096 | { |
1108 | if (view_start == nsaved || |
1097 | if (view_start == top_row || view_start == 0) |
1109 | view_start == 0) |
|
|
1110 | mouse_slip_wheel_speed = 0; |
1098 | mouse_slip_wheel_speed = 0; |
1111 | |
1099 | |
1112 | refresh_type |= SMOOTH_REFRESH; |
|
|
1113 | want_refresh = 1; |
1100 | want_refresh = 1; |
1114 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1101 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1115 | } |
1102 | } |
1116 | } |
1103 | } |
1117 | #endif |
1104 | #endif |
… | |
… | |
1147 | |
1134 | |
1148 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1135 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1149 | cmdbuf_ptr = cmdbuf_base; |
1136 | cmdbuf_ptr = cmdbuf_base; |
1150 | cmdbuf_endp = cmdbuf_ptr + n; |
1137 | cmdbuf_endp = cmdbuf_ptr + n; |
1151 | |
1138 | |
1152 | ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); |
1139 | ssize_t r = read (pty->pty, cmdbuf_endp, CBUFSIZ - n); |
1153 | |
1140 | |
1154 | if (r > 0) |
1141 | if (r > 0) |
1155 | { |
1142 | { |
1156 | cmdbuf_endp += r; |
1143 | cmdbuf_endp += r; |
1157 | return true; |
1144 | return true; |
… | |
… | |
1175 | } |
1162 | } |
1176 | |
1163 | |
1177 | void |
1164 | void |
1178 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1165 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1179 | { |
1166 | { |
1180 | SET_R (this); |
1167 | make_current (); |
1181 | SET_LOCALE (locale); |
|
|
1182 | |
1168 | |
1183 | if (revents & EVENT_READ) |
1169 | if (revents & EVENT_READ) |
1184 | // loop, but don't allow a single term to monopolize us |
1170 | // loop, but don't allow a single term to monopolize us |
1185 | while (pty_fill ()) |
1171 | while (pty_fill ()) |
1186 | if (cmd_parse ()) |
1172 | if (cmd_parse ()) |
… | |
… | |
1218 | } |
1204 | } |
1219 | |
1205 | |
1220 | void |
1206 | void |
1221 | rxvt_term::pointer_cb (time_watcher &w) |
1207 | rxvt_term::pointer_cb (time_watcher &w) |
1222 | { |
1208 | { |
1223 | SET_R (this); |
1209 | make_current (); |
1224 | SET_LOCALE (locale); |
|
|
1225 | |
1210 | |
1226 | pointer_blank (); |
1211 | pointer_blank (); |
1227 | } |
1212 | } |
1228 | #endif |
1213 | #endif |
1229 | |
1214 | |
… | |
… | |
1308 | |
1293 | |
1309 | /*{{{ process an X event */ |
1294 | /*{{{ process an X event */ |
1310 | void |
1295 | void |
1311 | rxvt_term::x_cb (XEvent &ev) |
1296 | rxvt_term::x_cb (XEvent &ev) |
1312 | { |
1297 | { |
|
|
1298 | make_current (); |
|
|
1299 | |
1313 | dDisp; |
1300 | dDisp; |
1314 | |
1301 | |
1315 | SET_R (this); |
1302 | if (ev.xany.window == vt |
1316 | SET_LOCALE (locale); |
1303 | && SHOULD_INVOKE (HOOK_X_EVENT) |
|
|
1304 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
|
|
1305 | return; |
1317 | |
1306 | |
|
|
1307 | // for XQueryPointer |
1318 | Window unused_root, unused_child; |
1308 | Window unused_root, unused_child; |
1319 | int unused_root_x, unused_root_y; |
1309 | int unused_root_x, unused_root_y; |
1320 | unsigned int unused_mask; |
1310 | unsigned int unused_mask; |
1321 | |
1311 | |
1322 | switch (ev.type) |
1312 | switch (ev.type) |
… | |
… | |
1412 | button_release (ev.xbutton); |
1402 | button_release (ev.xbutton); |
1413 | break; |
1403 | break; |
1414 | |
1404 | |
1415 | case ClientMessage: |
1405 | case ClientMessage: |
1416 | if (ev.xclient.format == 32 |
1406 | if (ev.xclient.format == 32 |
1417 | && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
1407 | && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END))) |
1418 | { |
1408 | { |
|
|
1409 | if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
|
|
1410 | { |
|
|
1411 | if (!HOOK_INVOKE ((this, HOOK_WM_PROTOCOLS, DT_XEVENT, &ev, DT_END))) |
|
|
1412 | { |
1419 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
1413 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
|
|
1414 | { |
|
|
1415 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) |
1420 | destroy (); |
1416 | destroy (); |
|
|
1417 | } |
1421 | #if ENABLE_EWMH |
1418 | #if ENABLE_EWMH |
1422 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1419 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1423 | XSendEvent (disp, ev.xclient.window = display->root, |
1420 | XSendEvent (disp, ev.xclient.window = display->root, |
1424 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1421 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1425 | &ev); |
1422 | &ev); |
|
|
1423 | #endif |
|
|
1424 | } |
|
|
1425 | } |
|
|
1426 | #if ENABLE_XEMBED |
|
|
1427 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1428 | { |
|
|
1429 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1430 | focus_in (); |
|
|
1431 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1432 | focus_out (); |
|
|
1433 | } |
1426 | #endif |
1434 | #endif |
1427 | } |
1435 | } |
1428 | #if ENABLE_XEMBED |
|
|
1429 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1430 | { |
|
|
1431 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1432 | focus_in (); |
|
|
1433 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1434 | focus_out (); |
|
|
1435 | } |
|
|
1436 | #endif |
|
|
1437 | #ifdef OFFIX_DND |
|
|
1438 | /* OffiX Dnd (drag 'n' drop) protocol */ |
|
|
1439 | else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL] |
|
|
1440 | && (ev.xclient.data.l[0] == DndFile |
|
|
1441 | || ev.xclient.data.l[0] == DndDir |
|
|
1442 | || ev.xclient.data.l[0] == DndLink)) |
|
|
1443 | { |
|
|
1444 | /* Get Dnd data */ |
|
|
1445 | Atom ActualType; |
|
|
1446 | int ActualFormat; |
|
|
1447 | unsigned char *data; |
|
|
1448 | unsigned long Size, RemainingBytes; |
|
|
1449 | |
|
|
1450 | XGetWindowProperty (disp, display->root, |
|
|
1451 | xa[XA_DNDSELECTION], |
|
|
1452 | 0L, 1000000L, |
|
|
1453 | False, AnyPropertyType, |
|
|
1454 | &ActualType, &ActualFormat, |
|
|
1455 | &Size, &RemainingBytes, |
|
|
1456 | &data); |
|
|
1457 | set_string_property (XA_CUT_BUFFER0, data); |
|
|
1458 | XFree (data); |
|
|
1459 | selection_paste (display->root, XA_CUT_BUFFER0, true); |
|
|
1460 | XSetInputFocus (disp, display->root, RevertToNone, CurrentTime); |
|
|
1461 | } |
|
|
1462 | #endif /* OFFIX_DND */ |
|
|
1463 | break; |
1436 | break; |
1464 | |
1437 | |
1465 | case MappingNotify: |
1438 | case MappingNotify: |
1466 | XRefreshKeyboardMapping (&ev.xmapping); |
1439 | XRefreshKeyboardMapping (&ev.xmapping); |
1467 | break; |
1440 | break; |
… | |
… | |
1509 | { |
1482 | { |
1510 | seen_resize = 1; |
1483 | seen_resize = 1; |
1511 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1484 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1512 | } |
1485 | } |
1513 | |
1486 | |
|
|
1487 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
|
|
1488 | |
1514 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1489 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1515 | if (OPTION (Opt_transparent)) |
1490 | if (OPTION (Opt_transparent)) |
1516 | check_our_parents (); |
1491 | check_our_parents (); |
1517 | #endif |
1492 | #endif |
1518 | } |
1493 | } |
1519 | break; |
1494 | break; |
1520 | |
1495 | |
1521 | case PropertyNotify: |
1496 | case PropertyNotify: |
|
|
1497 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1522 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1498 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1523 | && ev.xproperty.state == PropertyNewValue) |
1499 | && ev.xproperty.state == PropertyNewValue) |
1524 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1500 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1525 | |
1501 | |
1526 | break; |
1502 | break; |
1527 | |
1503 | |
1528 | case SelectionClear: |
1504 | case SelectionClear: |
1529 | selection_clear (); |
1505 | selection_clear (); |
… | |
… | |
1589 | if (isScrollbarWindow (ev.xany.window)) |
1565 | if (isScrollbarWindow (ev.xany.window)) |
1590 | { |
1566 | { |
1591 | scrollBar.setIdle (); |
1567 | scrollBar.setIdle (); |
1592 | scrollbar_show (0); |
1568 | scrollbar_show (0); |
1593 | } |
1569 | } |
1594 | #ifdef MENUBAR |
|
|
1595 | if (menubar_visible () && isMenuBarWindow (ev.xany.window)) |
|
|
1596 | menubar_expose (); |
|
|
1597 | #endif |
|
|
1598 | |
1570 | |
1599 | #ifdef TRANSPARENT |
1571 | #ifdef TRANSPARENT |
1600 | if (am_transparent && ev.xany.window == parent[0]) |
1572 | if (am_transparent && ev.xany.window == parent[0]) |
1601 | XClearWindow (disp, ev.xany.window); |
1573 | XClearWindow (disp, ev.xany.window); |
1602 | #endif |
1574 | #endif |
… | |
… | |
1606 | case MotionNotify: |
1578 | case MotionNotify: |
1607 | #ifdef POINTER_BLANK |
1579 | #ifdef POINTER_BLANK |
1608 | if (hidden_pointer) |
1580 | if (hidden_pointer) |
1609 | pointer_unblank (); |
1581 | pointer_unblank (); |
1610 | #endif |
1582 | #endif |
1611 | #if MENUBAR |
|
|
1612 | if (isMenuBarWindow (ev.xany.window)) |
|
|
1613 | { |
|
|
1614 | menubar_control (ev.xbutton); |
|
|
1615 | break; |
|
|
1616 | } |
|
|
1617 | #endif |
|
|
1618 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1583 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1619 | break; |
1584 | break; |
1620 | |
1585 | |
1621 | if (ev.xany.window == vt) |
1586 | if (ev.xany.window == vt) |
1622 | { |
1587 | { |
|
|
1588 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
1623 | if (HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1589 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1624 | ; // nop |
1590 | ; // nop |
1625 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1591 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1626 | { |
1592 | { |
1627 | while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) |
1593 | while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) |
1628 | ; |
1594 | ; |
… | |
… | |
1728 | { |
1694 | { |
1729 | hidden_cursor = 0; |
1695 | hidden_cursor = 0; |
1730 | want_refresh = 1; |
1696 | want_refresh = 1; |
1731 | } |
1697 | } |
1732 | |
1698 | |
1733 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1699 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1734 | } |
1700 | } |
1735 | #endif |
1701 | #endif |
1736 | |
1702 | |
1737 | #if defined(POINTER_BLANK) |
1703 | #if defined(POINTER_BLANK) |
1738 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
1704 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
… | |
… | |
1766 | XSetICFocus (Input_Context); |
1732 | XSetICFocus (Input_Context); |
1767 | } |
1733 | } |
1768 | #endif |
1734 | #endif |
1769 | #if CURSOR_BLINK |
1735 | #if CURSOR_BLINK |
1770 | if (OPTION (Opt_cursorBlink)) |
1736 | if (OPTION (Opt_cursorBlink)) |
1771 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1737 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1772 | #endif |
1738 | #endif |
1773 | #if OFF_FOCUS_FADING |
1739 | #if OFF_FOCUS_FADING |
1774 | if (rs[Rs_fade]) |
1740 | if (rs[Rs_fade]) |
1775 | { |
1741 | { |
1776 | pix_colors = pix_colors_focused; |
1742 | pix_colors = pix_colors_focused; |
… | |
… | |
1820 | |
1786 | |
1821 | #if TRANSPARENT |
1787 | #if TRANSPARENT |
1822 | void |
1788 | void |
1823 | rxvt_term::rootwin_cb (XEvent &ev) |
1789 | rxvt_term::rootwin_cb (XEvent &ev) |
1824 | { |
1790 | { |
1825 | SET_R (this); |
1791 | make_current (); |
1826 | SET_LOCALE (locale); |
|
|
1827 | |
1792 | |
1828 | switch (ev.type) |
1793 | switch (ev.type) |
1829 | { |
1794 | { |
1830 | case PropertyNotify: |
1795 | case PropertyNotify: |
1831 | /* |
1796 | /* |
… | |
… | |
1858 | /* |
1823 | /* |
1859 | * VT window processing of button press |
1824 | * VT window processing of button press |
1860 | */ |
1825 | */ |
1861 | if (ev.window == vt) |
1826 | if (ev.window == vt) |
1862 | { |
1827 | { |
|
|
1828 | if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1829 | return; |
|
|
1830 | |
1863 | #if ISO_14755 |
1831 | #if ISO_14755 |
1864 | // 5.4 |
1832 | // 5.4 |
1865 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1833 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1866 | { |
1834 | { |
1867 | iso14755_54 (ev.x, ev.y); |
1835 | iso14755_54 (ev.x, ev.y); |
… | |
… | |
1909 | else |
1877 | else |
1910 | { |
1878 | { |
1911 | if (ev.button != MEvent.button) |
1879 | if (ev.button != MEvent.button) |
1912 | MEvent.clicks = 0; |
1880 | MEvent.clicks = 0; |
1913 | |
1881 | |
1914 | if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1915 | switch (ev.button) |
1882 | switch (ev.button) |
1916 | { |
1883 | { |
1917 | case Button1: |
1884 | case Button1: |
1918 | /* allow meta + click to select rectangular areas */ |
1885 | /* allow meta + click to select rectangular areas */ |
1919 | /* should be done in screen.C */ |
1886 | /* should be done in screen.C */ |
1920 | #if ENABLE_FRILLS |
1887 | #if ENABLE_FRILLS |
1921 | selection.rect = !!(ev.state & ModMetaMask); |
1888 | selection.rect = !!(ev.state & ModMetaMask); |
1922 | #else |
1889 | #else |
1923 | selection.rect = false; |
1890 | selection.rect = false; |
1924 | #endif |
1891 | #endif |
1925 | |
1892 | |
1926 | /* allow shift+left click to extend selection */ |
1893 | /* allow shift+left click to extend selection */ |
1927 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1894 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1928 | { |
1895 | { |
1929 | if (MEvent.button == Button1 && clickintime) |
1896 | if (MEvent.button == Button1 && clickintime) |
1930 | selection_rotate (ev.x, ev.y); |
1897 | selection_rotate (ev.x, ev.y); |
1931 | else |
1898 | else |
1932 | selection_extend (ev.x, ev.y, 1); |
1899 | selection_extend (ev.x, ev.y, 1); |
1933 | } |
1900 | } |
1934 | else |
1901 | else |
1935 | { |
1902 | { |
1936 | if (MEvent.button == Button1 && clickintime) |
1903 | if (MEvent.button == Button1 && clickintime) |
1937 | MEvent.clicks++; |
1904 | MEvent.clicks++; |
1938 | else |
1905 | else |
1939 | MEvent.clicks = 1; |
1906 | MEvent.clicks = 1; |
1940 | |
1907 | |
1941 | selection_click (MEvent.clicks, ev.x, ev.y); |
1908 | selection_click (MEvent.clicks, ev.x, ev.y); |
1942 | } |
1909 | } |
1943 | |
1910 | |
1944 | MEvent.button = Button1; |
1911 | MEvent.button = Button1; |
1945 | break; |
1912 | break; |
1946 | |
1913 | |
1947 | case Button3: |
1914 | case Button3: |
1948 | if (MEvent.button == Button3 && clickintime) |
1915 | if (MEvent.button == Button3 && clickintime) |
1949 | selection_rotate (ev.x, ev.y); |
1916 | selection_rotate (ev.x, ev.y); |
1950 | else |
1917 | else |
1951 | selection_extend (ev.x, ev.y, 1); |
1918 | selection_extend (ev.x, ev.y, 1); |
1952 | |
1919 | |
1953 | MEvent.button = Button3; |
1920 | MEvent.button = Button3; |
1954 | break; |
1921 | break; |
1955 | } |
1922 | } |
1956 | } |
1923 | } |
1957 | |
1924 | |
1958 | MEvent.time = ev.time; |
1925 | MEvent.time = ev.time; |
1959 | return; |
1926 | return; |
1960 | } |
1927 | } |
1961 | |
1928 | |
… | |
… | |
2100 | } |
2067 | } |
2101 | } |
2068 | } |
2102 | |
2069 | |
2103 | return; |
2070 | return; |
2104 | } |
2071 | } |
2105 | |
|
|
2106 | #if MENUBAR |
|
|
2107 | /* |
|
|
2108 | * Menubar window processing of button press |
|
|
2109 | */ |
|
|
2110 | if (isMenuBarWindow (ev.window)) |
|
|
2111 | menubar_control (ev); |
|
|
2112 | #endif |
|
|
2113 | } |
2072 | } |
2114 | |
2073 | |
2115 | void |
2074 | void |
2116 | rxvt_term::button_release (XButtonEvent &ev) |
2075 | rxvt_term::button_release (XButtonEvent &ev) |
2117 | { |
2076 | { |
… | |
… | |
2123 | |
2082 | |
2124 | if (scrollbar_isUpDn ()) |
2083 | if (scrollbar_isUpDn ()) |
2125 | { |
2084 | { |
2126 | scrollBar.setIdle (); |
2085 | scrollBar.setIdle (); |
2127 | scrollbar_show (0); |
2086 | scrollbar_show (0); |
2128 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
2129 | refresh_type &= ~SMOOTH_REFRESH; |
|
|
2130 | #endif |
|
|
2131 | } |
2087 | } |
2132 | |
2088 | |
2133 | #ifdef SELECTION_SCROLLING |
2089 | #ifdef SELECTION_SCROLLING |
2134 | if (sel_scroll_ev.active) |
2090 | if (sel_scroll_ev.active) |
2135 | sel_scroll_ev.stop(); |
2091 | sel_scroll_ev.stop(); |
2136 | #endif |
2092 | #endif |
2137 | |
2093 | |
2138 | if (ev.window == vt) |
2094 | if (ev.window == vt) |
2139 | { |
2095 | { |
|
|
2096 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2097 | return; |
|
|
2098 | |
2140 | #if ISO_14755 |
2099 | #if ISO_14755 |
2141 | // 5.4 |
2100 | // 5.4 |
2142 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2101 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2143 | return; |
2102 | return; |
2144 | #endif |
2103 | #endif |
|
|
2104 | |
2145 | if (reportmode) |
2105 | if (reportmode) |
2146 | { |
2106 | { |
2147 | /* mouse report from vt window */ |
2107 | /* mouse report from vt window */ |
2148 | /* don't report release of wheel "buttons" */ |
2108 | /* don't report release of wheel "buttons" */ |
2149 | if (ev.button >= 4) |
2109 | if (ev.button >= 4) |
… | |
… | |
2173 | if (priv_modes & PrivMode_mouse_report |
2133 | if (priv_modes & PrivMode_mouse_report |
2174 | && bypass_keystate |
2134 | && bypass_keystate |
2175 | && ev.button == Button1 && MEvent.clicks <= 1) |
2135 | && ev.button == Button1 && MEvent.clicks <= 1) |
2176 | selection_extend (ev.x, ev.y, 0); |
2136 | selection_extend (ev.x, ev.y, 0); |
2177 | |
2137 | |
2178 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2179 | return; |
|
|
2180 | |
|
|
2181 | switch (ev.button) |
2138 | switch (ev.button) |
2182 | { |
2139 | { |
2183 | case Button1: |
2140 | case Button1: |
2184 | case Button3: |
2141 | case Button3: |
2185 | selection_make (ev.time); |
2142 | selection_make (ev.time); |
2186 | break; |
2143 | break; |
|
|
2144 | |
2187 | case Button2: |
2145 | case Button2: |
2188 | selection_request (ev.time, ev.x, ev.y); |
2146 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
|
|
2147 | selection_request (ev.time, ev.state & ShiftMask ? Sel_Clipboard : Sel_Primary); |
2189 | break; |
2148 | break; |
|
|
2149 | |
2190 | #ifdef MOUSE_WHEEL |
2150 | #ifdef MOUSE_WHEEL |
2191 | case Button4: |
2151 | case Button4: |
2192 | case Button5: |
2152 | case Button5: |
2193 | { |
2153 | { |
2194 | int i; |
2154 | int i; |
… | |
… | |
2226 | } |
2186 | } |
2227 | break; |
2187 | break; |
2228 | #endif |
2188 | #endif |
2229 | } |
2189 | } |
2230 | } |
2190 | } |
2231 | #ifdef MENUBAR |
|
|
2232 | else if (isMenuBarWindow (ev.window)) |
|
|
2233 | menubar_control (ev); |
|
|
2234 | #endif |
|
|
2235 | } |
2191 | } |
2236 | |
2192 | |
2237 | #ifdef TRANSPARENT |
2193 | #ifdef TRANSPARENT |
2238 | #if TINTING |
2194 | #if TINTING |
2239 | /* taken from aterm-0.4.2 */ |
2195 | /* taken from aterm-0.4.2 */ |
… | |
… | |
2676 | am_transparent = 0; |
2632 | am_transparent = 0; |
2677 | /* XXX: also turn off Opt_transparent? */ |
2633 | /* XXX: also turn off Opt_transparent? */ |
2678 | } |
2634 | } |
2679 | else |
2635 | else |
2680 | { |
2636 | { |
2681 | #if WAIT_FOR_WM |
|
|
2682 | /* wait (an arbitrary period) for the WM to do its thing |
|
|
2683 | * needed for fvwm2.2.2 (and before?) */ |
|
|
2684 | sleep (1); |
|
|
2685 | #endif |
|
|
2686 | for (n = 0; n < (unsigned int)i; n++) |
2637 | for (n = 0; n < (unsigned int)i; n++) |
2687 | { |
2638 | { |
2688 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2639 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2689 | XClearWindow (disp, parent[n]); |
2640 | XClearWindow (disp, parent[n]); |
2690 | } |
2641 | } |
… | |
… | |
2782 | } |
2733 | } |
2783 | |
2734 | |
2784 | // scr_add_lines only works for nlines <= nrow - 1. |
2735 | // scr_add_lines only works for nlines <= nrow - 1. |
2785 | if (nlines >= nrow - 1) |
2736 | if (nlines >= nrow - 1) |
2786 | { |
2737 | { |
|
|
2738 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
2787 | if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END))) |
2739 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2788 | scr_add_lines (buf, str - buf, nlines); |
2740 | scr_add_lines (buf, str - buf, nlines); |
2789 | |
2741 | |
2790 | nlines = 0; |
2742 | nlines = 0; |
2791 | str = buf; |
2743 | str = buf; |
2792 | eol = str + min (ncol, UBUFSIZ); |
2744 | eol = str + min (ncol, UBUFSIZ); |
… | |
… | |
2807 | |
2759 | |
2808 | seq_begin = cmdbuf_ptr; |
2760 | seq_begin = cmdbuf_ptr; |
2809 | ch = next_char (); |
2761 | ch = next_char (); |
2810 | } |
2762 | } |
2811 | |
2763 | |
|
|
2764 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
2812 | if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END))) |
2765 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2813 | scr_add_lines (buf, str - buf, nlines); |
2766 | scr_add_lines (buf, str - buf, nlines); |
2814 | |
2767 | |
2815 | /* |
2768 | /* |
2816 | * If there have been a lot of new lines, then update the screen |
2769 | * If there have been a lot of new lines, then update the screen |
2817 | * What the heck I'll cheat and only refresh less than every page-full. |
2770 | * What the heck I'll cheat and only refresh less than every page-full. |
… | |
… | |
2823 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2776 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2824 | refresh_limit++; |
2777 | refresh_limit++; |
2825 | else |
2778 | else |
2826 | { |
2779 | { |
2827 | flag = true; |
2780 | flag = true; |
2828 | scr_refresh (refresh_type); |
2781 | scr_refresh (); |
2829 | want_refresh = 1; |
2782 | want_refresh = 1; |
2830 | } |
2783 | } |
2831 | } |
2784 | } |
2832 | |
2785 | |
2833 | } |
2786 | } |
… | |
… | |
2851 | return flag; |
2804 | return flag; |
2852 | } |
2805 | } |
2853 | |
2806 | |
2854 | // read the next character |
2807 | // read the next character |
2855 | wchar_t |
2808 | wchar_t |
2856 | rxvt_term::next_char () |
2809 | rxvt_term::next_char () NOTHROW |
2857 | { |
2810 | { |
2858 | while (cmdbuf_ptr < cmdbuf_endp) |
2811 | while (cmdbuf_ptr < cmdbuf_endp) |
2859 | { |
2812 | { |
2860 | // assume 7-bit to be ascii ALWAYS |
2813 | // assume 7-bit to be ascii ALWAYS |
2861 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2814 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
… | |
… | |
2882 | return NOCHAR; |
2835 | return NOCHAR; |
2883 | } |
2836 | } |
2884 | |
2837 | |
2885 | // read the next octet |
2838 | // read the next octet |
2886 | uint32_t |
2839 | uint32_t |
2887 | rxvt_term::next_octet () |
2840 | rxvt_term::next_octet () NOTHROW |
2888 | { |
2841 | { |
2889 | return cmdbuf_ptr < cmdbuf_endp |
2842 | return cmdbuf_ptr < cmdbuf_endp |
2890 | ? (unsigned char)*cmdbuf_ptr++ |
2843 | ? (unsigned char)*cmdbuf_ptr++ |
2891 | : NOCHAR; |
2844 | : NOCHAR; |
2892 | } |
2845 | } |
|
|
2846 | |
|
|
2847 | static class out_of_input out_of_input; |
2893 | |
2848 | |
2894 | /* rxvt_cmd_getc () - Return next input character */ |
2849 | /* rxvt_cmd_getc () - Return next input character */ |
2895 | /* |
2850 | /* |
2896 | * Return the next input character after first passing any keyboard input |
2851 | * Return the next input character after first passing any keyboard input |
2897 | * to the command. |
2852 | * to the command. |
2898 | */ |
2853 | */ |
2899 | wchar_t |
2854 | wchar_t |
2900 | rxvt_term::cmd_getc () |
2855 | rxvt_term::cmd_getc () THROW ((class out_of_input)) |
2901 | { |
2856 | { |
2902 | wchar_t c = next_char (); |
2857 | wchar_t c = next_char (); |
2903 | |
2858 | |
2904 | if (c == NOCHAR) |
2859 | if (c == NOCHAR) |
2905 | throw out_of_input; |
2860 | throw out_of_input; |
2906 | |
2861 | |
2907 | return c; |
2862 | return c; |
2908 | } |
2863 | } |
2909 | |
2864 | |
2910 | uint32_t |
2865 | uint32_t |
2911 | rxvt_term::cmd_get8 () |
2866 | rxvt_term::cmd_get8 () THROW ((class out_of_input)) |
2912 | { |
2867 | { |
2913 | uint32_t c = next_octet (); |
2868 | uint32_t c = next_octet (); |
2914 | |
2869 | |
2915 | if (c == NOCHAR) |
2870 | if (c == NOCHAR) |
2916 | throw out_of_input; |
2871 | throw out_of_input; |
… | |
… | |
3795 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3750 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3796 | */ |
3751 | */ |
3797 | void |
3752 | void |
3798 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3753 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3799 | { |
3754 | { |
3800 | int changed = 0; |
|
|
3801 | int color; |
3755 | int color; |
3802 | char *buf, *name; |
3756 | char *buf, *name; |
3803 | bool query = str[0] == '?' && !str[1]; |
3757 | bool query = str[0] == '?' && !str[1]; |
3804 | int saveop = op; |
3758 | int saveop = op; |
3805 | dDisp; |
3759 | dDisp; |
… | |
… | |
3860 | { |
3814 | { |
3861 | if ((name = strchr (buf, ';')) == NULL) |
3815 | if ((name = strchr (buf, ';')) == NULL) |
3862 | break; |
3816 | break; |
3863 | |
3817 | |
3864 | *name++ = '\0'; |
3818 | *name++ = '\0'; |
3865 | color = atoi (buf); |
3819 | color = atoi (buf) + minCOLOR; |
3866 | |
3820 | |
3867 | if (color < 0 || color >= TOTAL_COLORS) |
3821 | if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) |
3868 | break; |
3822 | break; |
3869 | |
3823 | |
3870 | if ((buf = strchr (name, ';')) != NULL) |
3824 | if ((buf = strchr (name, ';')) != NULL) |
3871 | *buf++ = '\0'; |
3825 | *buf++ = '\0'; |
3872 | |
3826 | |
3873 | if (name[0] == '?' && !name[1]) |
3827 | if (name[0] == '?' && !name[1]) |
3874 | { |
3828 | { |
3875 | unsigned short r, g, b; |
3829 | unsigned short r, g, b; |
3876 | pix_colors_focused[color + minCOLOR].get (display, r, g, b); |
3830 | pix_colors_focused[color].get (display, r, g, b); |
3877 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
3831 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
3878 | } |
3832 | } |
3879 | else |
3833 | else |
3880 | set_window_color (color + minCOLOR, name); |
3834 | set_window_color (color, name); |
3881 | } |
3835 | } |
3882 | break; |
3836 | break; |
3883 | case XTerm_Color00: |
3837 | case XTerm_Color00: |
3884 | process_color_seq (XTerm_Color00, Color_fg, str, resp); |
3838 | process_color_seq (XTerm_Color00, Color_fg, str, resp); |
3885 | break; |
3839 | break; |
3886 | case XTerm_Color01: |
3840 | case XTerm_Color01: |
3887 | process_color_seq (XTerm_Color00, Color_bg, str, resp); |
3841 | process_color_seq (XTerm_Color01, Color_bg, str, resp); |
3888 | break; |
3842 | break; |
3889 | #ifndef NO_CURSORCOLOR |
3843 | #ifndef NO_CURSORCOLOR |
3890 | case XTerm_Color_cursor: |
3844 | case XTerm_Color_cursor: |
3891 | process_color_seq (XTerm_Color_cursor, Color_cursor, str, resp); |
3845 | process_color_seq (XTerm_Color_cursor, Color_cursor, str, resp); |
3892 | break; |
3846 | break; |
… | |
… | |
3896 | break; |
3850 | break; |
3897 | case XTerm_Color_pointer_bg: |
3851 | case XTerm_Color_pointer_bg: |
3898 | process_color_seq (XTerm_Color_pointer_bg, Color_pointer_bg, str, resp); |
3852 | process_color_seq (XTerm_Color_pointer_bg, Color_pointer_bg, str, resp); |
3899 | break; |
3853 | break; |
3900 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3854 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3901 | case XTerm_Color_BD: |
|
|
3902 | process_color_seq (XTerm_Color_BD, Color_BD, str, resp); |
|
|
3903 | break; |
|
|
3904 | case XTerm_Color_UL: |
|
|
3905 | process_color_seq (XTerm_Color_UL, Color_UL, str, resp); |
|
|
3906 | break; |
|
|
3907 | case XTerm_Color_RV: |
3855 | case XTerm_Color_RV: |
3908 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
3856 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
|
|
3857 | break; |
|
|
3858 | case Rxvt_Color_BD: |
|
|
3859 | case URxvt_Color_BD: |
|
|
3860 | process_color_seq (op, Color_BD, str, resp); |
|
|
3861 | break; |
|
|
3862 | case Rxvt_Color_UL: |
|
|
3863 | case URxvt_Color_UL: |
|
|
3864 | process_color_seq (op, Color_UL, str, resp); |
3909 | break; |
3865 | break; |
3910 | case URxvt_Color_IT: |
3866 | case URxvt_Color_IT: |
3911 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
3867 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
3912 | break; |
3868 | break; |
3913 | #endif |
3869 | #endif |
… | |
… | |
3918 | if (am_transparent) |
3874 | if (am_transparent) |
3919 | want_full_refresh = want_refresh = 1; |
3875 | want_full_refresh = want_refresh = 1; |
3920 | break; |
3876 | break; |
3921 | #endif |
3877 | #endif |
3922 | |
3878 | |
3923 | case XTerm_Pixmap: |
3879 | case Rxvt_Pixmap: |
|
|
3880 | { |
3924 | if (*str != ';') |
3881 | if (*str != ';') |
3925 | { |
3882 | { |
3926 | #if XPM_BACKGROUND |
3883 | #if XPM_BACKGROUND |
3927 | scale_pixmap (""); /* reset to default scaling */ |
3884 | scale_pixmap (""); /* reset to default scaling */ |
3928 | set_bgPixmap (str); /* change pixmap */ |
3885 | set_bgPixmap (str); /* change pixmap */ |
3929 | #endif |
|
|
3930 | scr_touch (true); |
3886 | scr_touch (true); |
|
|
3887 | #endif |
3931 | } |
3888 | } |
|
|
3889 | |
|
|
3890 | int changed = 0; |
|
|
3891 | |
3932 | while ((str = strchr (str, ';')) != NULL) |
3892 | while ((str = strchr (str, ';')) != NULL) |
3933 | { |
3893 | { |
3934 | str++; |
3894 | str++; |
3935 | #if XPM_BACKGROUND |
3895 | #if XPM_BACKGROUND |
3936 | changed += scale_pixmap (str); |
3896 | changed += scale_pixmap (str); |
3937 | #endif |
3897 | #endif |
3938 | } |
3898 | } |
3939 | |
3899 | |
3940 | if (changed) |
3900 | if (changed) |
3941 | { |
3901 | { |
3942 | #ifdef XPM_BACKGROUND |
3902 | #ifdef XPM_BACKGROUND |
3943 | resize_pixmap (); |
3903 | resize_pixmap (); |
3944 | #endif |
|
|
3945 | scr_touch (true); |
3904 | scr_touch (true); |
|
|
3905 | #endif |
3946 | } |
3906 | } |
|
|
3907 | } |
3947 | break; |
3908 | break; |
3948 | |
3909 | |
3949 | case XTerm_restoreFG: |
3910 | case Rxvt_restoreFG: |
3950 | set_window_color (Color_fg, str); |
3911 | set_window_color (Color_fg, str); |
3951 | break; |
3912 | break; |
3952 | case XTerm_restoreBG: |
3913 | case Rxvt_restoreBG: |
3953 | set_window_color (Color_bg, str); |
3914 | set_window_color (Color_bg, str); |
3954 | break; |
3915 | break; |
3955 | |
3916 | |
3956 | case XTerm_logfile: |
3917 | case XTerm_logfile: |
3957 | // TODO, when secure mode? |
3918 | // TODO, when secure mode? |
3958 | break; |
3919 | break; |
3959 | |
3920 | |
3960 | #ifdef MENUBAR |
|
|
3961 | case URxvt_Menu: |
|
|
3962 | if (OPTION (Opt_insecure)) |
|
|
3963 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
|
|
3964 | break; |
|
|
3965 | #endif |
|
|
3966 | #if 0 |
3921 | #if 0 |
3967 | case XTerm_dumpscreen: /* no error notices */ |
3922 | case Rxvt_dumpscreen: /* no error notices */ |
3968 | { |
3923 | { |
3969 | int fd; |
3924 | int fd; |
3970 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3925 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3971 | { |
3926 | { |
3972 | scr_dump (fd); |
3927 | scr_dump (fd); |
… | |
… | |
4003 | if (query) |
3958 | if (query) |
4004 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); |
3959 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); |
4005 | else |
3960 | else |
4006 | { |
3961 | { |
4007 | set_locale (str); |
3962 | set_locale (str); |
4008 | pty.set_utf8_mode (enc_utf8); |
3963 | pty->set_utf8_mode (enc_utf8); |
4009 | init_xlocale (); |
3964 | init_xlocale (); |
4010 | } |
3965 | } |
4011 | break; |
3966 | break; |
4012 | |
3967 | |
4013 | case URxvt_view_up: |
3968 | case URxvt_view_up: |
… | |
… | |
4066 | return state; |
4021 | return state; |
4067 | } |
4022 | } |
4068 | |
4023 | |
4069 | /* we're not using priv _yet_ */ |
4024 | /* we're not using priv _yet_ */ |
4070 | void |
4025 | void |
4071 | rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) |
4026 | rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg) |
4072 | { |
4027 | { |
4073 | unsigned int i, j; |
4028 | unsigned int i, j; |
4074 | int state; |
4029 | int state; |
4075 | |
4030 | |
4076 | static const struct |
4031 | static const struct |
… | |
… | |
4087 | { 5, PrivMode_rVideo }, |
4042 | { 5, PrivMode_rVideo }, |
4088 | { 6, PrivMode_relOrigin }, |
4043 | { 6, PrivMode_relOrigin }, |
4089 | { 7, PrivMode_Autowrap }, |
4044 | { 7, PrivMode_Autowrap }, |
4090 | // 8, bi-directional support mode |
4045 | // 8, bi-directional support mode |
4091 | { 9, PrivMode_MouseX10 }, |
4046 | { 9, PrivMode_MouseX10 }, |
4092 | #ifdef menuBar_esc |
|
|
4093 | { menuBar_esc, PrivMode_menuBar }, |
|
|
4094 | #endif |
|
|
4095 | // 18, 19 printing-related |
4047 | // 18, 19 printing-related |
4096 | { 25, PrivMode_VisibleCursor }, |
4048 | { 25, PrivMode_VisibleCursor }, |
4097 | #ifdef scrollBar_esc |
4049 | #ifdef scrollBar_esc |
4098 | { scrollBar_esc, PrivMode_scrollBar }, |
4050 | { scrollBar_esc, PrivMode_scrollBar }, |
4099 | #endif |
4051 | #endif |
… | |
… | |
4194 | /* case 8: - auto repeat, can't do on a per window basis */ |
4146 | /* case 8: - auto repeat, can't do on a per window basis */ |
4195 | case 9: /* X10 mouse reporting */ |
4147 | case 9: /* X10 mouse reporting */ |
4196 | if (state) /* orthogonal */ |
4148 | if (state) /* orthogonal */ |
4197 | priv_modes &= ~PrivMode_MouseX11; |
4149 | priv_modes &= ~PrivMode_MouseX11; |
4198 | break; |
4150 | break; |
4199 | #ifdef menuBar_esc |
|
|
4200 | case menuBar_esc: |
|
|
4201 | #ifdef MENUBAR |
|
|
4202 | map_menuBar (state); |
|
|
4203 | #endif |
|
|
4204 | break; |
|
|
4205 | #endif |
|
|
4206 | #ifdef scrollBar_esc |
4151 | #ifdef scrollBar_esc |
4207 | case scrollBar_esc: |
4152 | case scrollBar_esc: |
4208 | if (scrollbar_mapping (state)) |
4153 | if (scrollbar_mapping (state)) |
4209 | { |
4154 | { |
4210 | resize_all_windows (0, 0, 0); |
4155 | resize_all_windows (0, 0, 0); |
… | |
… | |
4455 | rxvt_term::tt_write (const char *data, unsigned int len) |
4400 | rxvt_term::tt_write (const char *data, unsigned int len) |
4456 | { |
4401 | { |
4457 | if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) |
4402 | if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) |
4458 | return; |
4403 | return; |
4459 | |
4404 | |
4460 | if (pty.pty < 0) |
4405 | if (pty->pty < 0) |
4461 | return; |
4406 | return; |
4462 | |
4407 | |
4463 | if (v_buflen == 0) |
4408 | if (v_buflen == 0) |
4464 | { |
4409 | { |
4465 | ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE)); |
4410 | ssize_t written = write (pty->pty, data, min (len, MAX_PTY_WRITE)); |
4466 | |
4411 | |
4467 | if ((unsigned int)written == len) |
4412 | if ((unsigned int)written == len) |
4468 | return; |
4413 | return; |
4469 | |
4414 | |
4470 | data += written; |
4415 | data += written; |
… | |
… | |
4479 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4424 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4480 | } |
4425 | } |
4481 | |
4426 | |
4482 | void rxvt_term::pty_write () |
4427 | void rxvt_term::pty_write () |
4483 | { |
4428 | { |
4484 | int written = write (pty.pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4429 | int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4485 | |
4430 | |
4486 | if (written > 0) |
4431 | if (written > 0) |
4487 | { |
4432 | { |
4488 | v_buflen -= written; |
4433 | v_buflen -= written; |
4489 | |
4434 | |