… | |
… | |
64 | |
64 | |
65 | /*----------------------------------------------------------------------*/ |
65 | /*----------------------------------------------------------------------*/ |
66 | |
66 | |
67 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
67 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
68 | |
68 | |
69 | // exception thrown when the command parser runs out of input data |
|
|
70 | class out_of_input { } out_of_input; |
|
|
71 | |
|
|
72 | #if ENABLE_FRILLS || ISO_14755 |
69 | #if ENABLE_FRILLS || ISO_14755 |
73 | |
70 | |
74 | #define ISO_14755_STARTED 0x80000000UL |
71 | #define ISO_14755_STARTED 0x80000000UL |
75 | #define ISO_14755_51 0x40000000UL // basic (section 5.1) |
72 | #define ISO_14755_51 0x40000000UL // basic (section 5.1) |
76 | #define ISO_14755_52 0x20000000UL // keycap (section 5.2) |
73 | #define ISO_14755_52 0x20000000UL // keycap (section 5.2) |
… | |
… | |
147 | || !IN_RANGE_EXC (y, 0, nrow)) |
144 | || !IN_RANGE_EXC (y, 0, nrow)) |
148 | return; |
145 | return; |
149 | |
146 | |
150 | for (;;) |
147 | for (;;) |
151 | { |
148 | { |
152 | const line_t &l = ROW(y - view_start); |
149 | const line_t &l = ROW(y + view_start); |
153 | |
150 | |
154 | text_t t = l.t[x]; |
151 | text_t t = l.t[x]; |
155 | |
152 | |
156 | if (t != NOCHAR || !x) |
153 | if (t != NOCHAR || !x) |
157 | { |
154 | { |
… | |
… | |
443 | scr_move_to (0, 1); |
440 | scr_move_to (0, 1); |
444 | return; |
441 | return; |
445 | } |
442 | } |
446 | else if (keysym == XK_End) |
443 | else if (keysym == XK_End) |
447 | { |
444 | { |
448 | scr_move_to (1, 0); |
445 | scr_move_to (1, 1); |
449 | return; |
446 | return; |
450 | } |
447 | } |
451 | } |
448 | } |
452 | #endif |
449 | #endif |
453 | } |
450 | } |
… | |
… | |
464 | { |
461 | { |
465 | switch (keysym) |
462 | switch (keysym) |
466 | { |
463 | { |
467 | /* normal XTerm key bindings */ |
464 | /* normal XTerm key bindings */ |
468 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
465 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
469 | selection_request (ev.time, 0, 0); |
466 | selection_request (ev.time); |
470 | return; |
467 | return; |
471 | #if TODO |
468 | #if TODO |
472 | /* rxvt extras */ |
469 | /* rxvt extras */ |
473 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
470 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
474 | change_font (FONT_UP); |
471 | change_font (FONT_UP); |
… | |
… | |
867 | #endif |
864 | #endif |
868 | /* nil */ ; |
865 | /* nil */ ; |
869 | } |
866 | } |
870 | } |
867 | } |
871 | |
868 | |
872 | if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_STRING_LEN, kbuf, len, DT_END))) |
869 | if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, DT_STR_LEN, kbuf, len, DT_END))) |
873 | return; |
870 | return; |
874 | |
871 | |
875 | if (len <= 0) |
872 | if (len <= 0) |
876 | return; /* not mapped */ |
873 | return; /* not mapped */ |
877 | |
874 | |
… | |
… | |
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; |
|
|
973 | int end_row = row + nrow; |
978 | |
974 | |
979 | while (row > -nsaved && ROW (row - 1).is_longer ()) |
975 | while (row > top_row && ROW (row - 1).is_longer ()) |
980 | --row; |
976 | --row; |
981 | |
977 | |
982 | while (row < -view_start + nrow) |
978 | do |
983 | { |
979 | { |
984 | int start_row = row; |
980 | int start_row = row; |
985 | line_t *l; |
981 | line_t *l; |
986 | |
982 | |
987 | do |
983 | do |
988 | { |
984 | { |
989 | l = &ROW (row); |
985 | l = &ROW (row++); |
990 | |
986 | |
991 | if (!(l->f & LINE_FILTERED)) |
987 | if (!(l->f & LINE_FILTERED)) |
992 | { |
988 | { |
993 | // line not filtered, mark it as filtered |
989 | // line not filtered, mark it as filtered |
994 | l->f |= LINE_FILTERED; |
990 | l->f |= LINE_FILTERED; |
995 | while (l->is_longer ()) |
991 | while (l->is_longer ()) |
996 | { |
992 | { |
997 | l = &ROW (++row); |
993 | l = &ROW (row++); |
998 | l->f |= LINE_FILTERED; |
994 | l->f |= LINE_FILTERED; |
999 | } |
995 | } |
1000 | |
996 | |
1001 | // and filter it |
997 | // and filter it |
1002 | 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)); |
1003 | |
999 | |
1004 | break; |
1000 | break; |
1005 | } |
1001 | } |
1006 | } |
1002 | } |
1007 | while (l->is_longer ()); |
1003 | while (l->is_longer () && row < end_row); |
1008 | |
|
|
1009 | row++; |
|
|
1010 | } |
1004 | } |
|
|
1005 | while (row < end_row); |
1011 | |
1006 | } |
1012 | } |
|
|
1013 | |
1007 | |
1014 | scr_refresh (refresh_type); |
1008 | scr_refresh (); |
1015 | scrollbar_show (1); |
1009 | scrollbar_show (1); |
1016 | #ifdef USE_XIM |
1010 | #ifdef USE_XIM |
1017 | IMSendSpot (); |
1011 | IMSendSpot (); |
1018 | #endif |
1012 | #endif |
1019 | } |
1013 | } |
… | |
… | |
1022 | } |
1016 | } |
1023 | |
1017 | |
1024 | void |
1018 | void |
1025 | rxvt_term::check_cb (check_watcher &w) |
1019 | rxvt_term::check_cb (check_watcher &w) |
1026 | { |
1020 | { |
1027 | SET_R (this); |
1021 | make_current (); |
1028 | SET_LOCALE (locale); |
|
|
1029 | |
1022 | |
1030 | display->flush (); |
1023 | display->flush (); |
1031 | |
1024 | |
1032 | if (want_refresh && !flush_ev.active) |
1025 | if (want_refresh && !flush_ev.active) |
1033 | 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 |
1034 | } |
1027 | } |
1035 | |
1028 | |
1036 | void |
1029 | void |
1037 | rxvt_term::flush_cb (time_watcher &w) |
1030 | rxvt_term::flush_cb (time_watcher &w) |
1038 | { |
1031 | { |
1039 | SET_R (this); |
1032 | make_current (); |
1040 | SET_LOCALE (locale); |
|
|
1041 | |
1033 | |
1042 | refresh_limit = 1; |
1034 | refresh_limit = 1; |
1043 | refresh_count = 0; |
1035 | refresh_count = 0; |
1044 | flush (); |
1036 | flush (); |
1045 | } |
1037 | } |
… | |
… | |
1049 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1041 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1050 | { |
1042 | { |
1051 | hidden_cursor = !hidden_cursor; |
1043 | hidden_cursor = !hidden_cursor; |
1052 | want_refresh = 1; |
1044 | want_refresh = 1; |
1053 | |
1045 | |
1054 | w.start (w.at + BLINK_INTERVAL); |
1046 | w.start (w.at + CURSOR_BLINK_INTERVAL); |
1055 | } |
1047 | } |
1056 | #endif |
1048 | #endif |
1057 | |
1049 | |
1058 | #ifdef TEXT_BLINK |
1050 | #ifdef TEXT_BLINK |
1059 | void |
1051 | void |
… | |
… | |
1073 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1065 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1074 | { |
1066 | { |
1075 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1067 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1076 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1068 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1077 | { |
1069 | { |
1078 | refresh_type |= SMOOTH_REFRESH; |
|
|
1079 | want_refresh = 1; |
1070 | want_refresh = 1; |
1080 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1071 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1081 | } |
1072 | } |
1082 | } |
1073 | } |
1083 | #endif |
1074 | #endif |
… | |
… | |
1087 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1078 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1088 | { |
1079 | { |
1089 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1080 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1090 | { |
1081 | { |
1091 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1082 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1092 | refresh_type |= SMOOTH_REFRESH; |
|
|
1093 | want_refresh = 1; |
1083 | want_refresh = 1; |
1094 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1084 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1095 | } |
1085 | } |
1096 | } |
1086 | } |
1097 | #endif |
1087 | #endif |
… | |
… | |
1102 | { |
1092 | { |
1103 | if (mouse_slip_wheel_speed == 0 |
1093 | if (mouse_slip_wheel_speed == 0 |
1104 | || 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) |
1105 | : scr_page (UP, mouse_slip_wheel_speed)) |
1095 | : scr_page (UP, mouse_slip_wheel_speed)) |
1106 | { |
1096 | { |
1107 | if (view_start == nsaved || |
1097 | if (view_start == top_row || view_start == 0) |
1108 | view_start == 0) |
|
|
1109 | mouse_slip_wheel_speed = 0; |
1098 | mouse_slip_wheel_speed = 0; |
1110 | |
1099 | |
1111 | refresh_type |= SMOOTH_REFRESH; |
|
|
1112 | want_refresh = 1; |
1100 | want_refresh = 1; |
1113 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1101 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1114 | } |
1102 | } |
1115 | } |
1103 | } |
1116 | #endif |
1104 | #endif |
… | |
… | |
1146 | |
1134 | |
1147 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1135 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
1148 | cmdbuf_ptr = cmdbuf_base; |
1136 | cmdbuf_ptr = cmdbuf_base; |
1149 | cmdbuf_endp = cmdbuf_ptr + n; |
1137 | cmdbuf_endp = cmdbuf_ptr + n; |
1150 | |
1138 | |
1151 | ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); |
1139 | ssize_t r = read (pty->pty, cmdbuf_endp, CBUFSIZ - n); |
1152 | |
1140 | |
1153 | if (r > 0) |
1141 | if (r > 0) |
1154 | { |
1142 | { |
1155 | cmdbuf_endp += r; |
1143 | cmdbuf_endp += r; |
1156 | return true; |
1144 | return true; |
… | |
… | |
1174 | } |
1162 | } |
1175 | |
1163 | |
1176 | void |
1164 | void |
1177 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1165 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1178 | { |
1166 | { |
1179 | SET_R (this); |
1167 | make_current (); |
1180 | SET_LOCALE (locale); |
|
|
1181 | |
1168 | |
1182 | if (revents & EVENT_READ) |
1169 | if (revents & EVENT_READ) |
1183 | // loop, but don't allow a single term to monopolize us |
1170 | // loop, but don't allow a single term to monopolize us |
1184 | while (pty_fill ()) |
1171 | while (pty_fill ()) |
1185 | if (cmd_parse ()) |
1172 | if (cmd_parse ()) |
… | |
… | |
1217 | } |
1204 | } |
1218 | |
1205 | |
1219 | void |
1206 | void |
1220 | rxvt_term::pointer_cb (time_watcher &w) |
1207 | rxvt_term::pointer_cb (time_watcher &w) |
1221 | { |
1208 | { |
1222 | SET_R (this); |
1209 | make_current (); |
1223 | SET_LOCALE (locale); |
|
|
1224 | |
1210 | |
1225 | pointer_blank (); |
1211 | pointer_blank (); |
1226 | } |
1212 | } |
1227 | #endif |
1213 | #endif |
1228 | |
1214 | |
… | |
… | |
1307 | |
1293 | |
1308 | /*{{{ process an X event */ |
1294 | /*{{{ process an X event */ |
1309 | void |
1295 | void |
1310 | rxvt_term::x_cb (XEvent &ev) |
1296 | rxvt_term::x_cb (XEvent &ev) |
1311 | { |
1297 | { |
|
|
1298 | make_current (); |
|
|
1299 | |
1312 | dDisp; |
1300 | dDisp; |
1313 | |
1301 | |
1314 | SET_R (this); |
1302 | if (ev.xany.window == vt |
1315 | SET_LOCALE (locale); |
1303 | && SHOULD_INVOKE (HOOK_X_EVENT) |
|
|
1304 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
|
|
1305 | return; |
1316 | |
1306 | |
1317 | #if defined(CURSOR_BLINK) |
1307 | // for XQueryPointer |
1318 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
|
|
1319 | { |
|
|
1320 | if (hidden_cursor) |
|
|
1321 | { |
|
|
1322 | hidden_cursor = 0; |
|
|
1323 | want_refresh = 1; |
|
|
1324 | } |
|
|
1325 | |
|
|
1326 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
|
|
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; |
1308 | Window unused_root, unused_child; |
1345 | int unused_root_x, unused_root_y; |
1309 | int unused_root_x, unused_root_y; |
1346 | unsigned int unused_mask; |
1310 | unsigned int unused_mask; |
1347 | |
1311 | |
1348 | switch (ev.type) |
1312 | switch (ev.type) |
… | |
… | |
1355 | |
1319 | |
1356 | break; |
1320 | break; |
1357 | |
1321 | |
1358 | case KeyRelease: |
1322 | case KeyRelease: |
1359 | { |
1323 | { |
1360 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 |
1324 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 || ENABLE_PERL |
1361 | KeySym ks; |
1325 | KeySym keysym; |
1362 | |
1326 | |
1363 | ks = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
1327 | keysym = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
1364 | #endif |
1328 | #endif |
1365 | |
1329 | |
1366 | #if ENABLE_FRILLS || ISO_14755 |
1330 | #if ENABLE_FRILLS || ISO_14755 |
1367 | // ISO 14755 support |
1331 | // ISO 14755 support |
1368 | if (iso14755buf) |
1332 | if (iso14755buf) |
… | |
… | |
1373 | # endif |
1337 | # endif |
1374 | # if ISO_14755 |
1338 | # if ISO_14755 |
1375 | // iso14755 part 5.2 handling: release time |
1339 | // iso14755 part 5.2 handling: release time |
1376 | // first: controls |
1340 | // first: controls |
1377 | if ((ev.xkey.state & ControlMask) |
1341 | if ((ev.xkey.state & ControlMask) |
1378 | && ((ks >= 0x40 && ks <= 0x5f) |
1342 | && ((keysym >= 0x40 && keysym <= 0x5f) |
1379 | || (ks >= 0x61 && ks <= 0x7f))) |
1343 | || (keysym >= 0x61 && keysym <= 0x7f))) |
1380 | { |
1344 | { |
1381 | iso14755buf = ISO_14755_51 | 0x2400 | (ks & 0x1f); |
1345 | iso14755buf = ISO_14755_51 | 0x2400 | (keysym & 0x1f); |
1382 | commit_iso14755 (); |
1346 | commit_iso14755 (); |
1383 | return; // case-break; |
1347 | goto skip_switch; |
1384 | } |
1348 | } |
1385 | |
1349 | |
1386 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
1350 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
1387 | if (i[0] == ks) |
1351 | if (i[0] == keysym) |
1388 | { |
1352 | { |
1389 | iso14755buf = ISO_14755_51 | i[1]; |
1353 | iso14755buf = ISO_14755_51 | i[1]; |
1390 | commit_iso14755 (); |
1354 | commit_iso14755 (); |
1391 | return; // case-break; |
1355 | goto skip_switch; |
1392 | } |
1356 | } |
1393 | |
1357 | |
1394 | scr_bell (); |
1358 | scr_bell (); |
1395 | # endif |
1359 | # endif |
1396 | iso14755buf = 0; |
1360 | iso14755buf = 0; |
… | |
… | |
1416 | iso14755buf = 0; |
1380 | iso14755buf = 0; |
1417 | } |
1381 | } |
1418 | #endif |
1382 | #endif |
1419 | |
1383 | |
1420 | if (ev.xany.window == vt |
1384 | if (ev.xany.window == vt |
1421 | && HOOK_INVOKE ((this, HOOK_KEY_RELEASE, DT_XEVENT, &ev, DT_END))) |
1385 | && HOOK_INVOKE ((this, HOOK_KEY_RELEASE, DT_XEVENT, &ev, DT_INT, keysym, DT_END))) |
1422 | break; |
1386 | break; |
1423 | |
1387 | |
1424 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1388 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1425 | if (!(ev.xkey.state & ControlMask)) |
1389 | if (!(ev.xkey.state & ControlMask)) |
1426 | slip_wheel_ev.stop (); |
1390 | slip_wheel_ev.stop (); |
1427 | else if (ks == XK_Control_L || ks == XK_Control_R) |
1391 | else if (keysym == XK_Control_L || keysym == XK_Control_R) |
1428 | mouse_slip_wheel_speed = 0; |
1392 | mouse_slip_wheel_speed = 0; |
1429 | #endif |
1393 | #endif |
1430 | break; |
1394 | break; |
1431 | } |
1395 | } |
1432 | |
1396 | |
… | |
… | |
1438 | button_release (ev.xbutton); |
1402 | button_release (ev.xbutton); |
1439 | break; |
1403 | break; |
1440 | |
1404 | |
1441 | case ClientMessage: |
1405 | case ClientMessage: |
1442 | if (ev.xclient.format == 32 |
1406 | if (ev.xclient.format == 32 |
1443 | && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
1407 | && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END))) |
1444 | { |
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 | { |
1445 | 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))) |
1446 | destroy (); |
1416 | destroy (); |
|
|
1417 | } |
1447 | #if ENABLE_EWMH |
1418 | #if ENABLE_EWMH |
1448 | 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]) |
1449 | XSendEvent (disp, ev.xclient.window = display->root, |
1420 | XSendEvent (disp, ev.xclient.window = display->root, |
1450 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1421 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1451 | &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 | } |
1452 | #endif |
1434 | #endif |
1453 | } |
1435 | } |
1454 | #if ENABLE_XEMBED |
|
|
1455 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1456 | { |
|
|
1457 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1458 | focus_in (); |
|
|
1459 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1460 | focus_out (); |
|
|
1461 | } |
|
|
1462 | #endif |
|
|
1463 | #ifdef OFFIX_DND |
|
|
1464 | /* OffiX Dnd (drag 'n' drop) protocol */ |
|
|
1465 | else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL] |
|
|
1466 | && (ev.xclient.data.l[0] == DndFile |
|
|
1467 | || ev.xclient.data.l[0] == DndDir |
|
|
1468 | || ev.xclient.data.l[0] == DndLink)) |
|
|
1469 | { |
|
|
1470 | /* Get Dnd data */ |
|
|
1471 | Atom ActualType; |
|
|
1472 | int ActualFormat; |
|
|
1473 | unsigned char *data; |
|
|
1474 | unsigned long Size, RemainingBytes; |
|
|
1475 | |
|
|
1476 | XGetWindowProperty (disp, display->root, |
|
|
1477 | xa[XA_DNDSELECTION], |
|
|
1478 | 0L, 1000000L, |
|
|
1479 | False, AnyPropertyType, |
|
|
1480 | &ActualType, &ActualFormat, |
|
|
1481 | &Size, &RemainingBytes, |
|
|
1482 | &data); |
|
|
1483 | set_string_property (XA_CUT_BUFFER0, data); |
|
|
1484 | XFree (data); |
|
|
1485 | selection_paste (display->root, XA_CUT_BUFFER0, true); |
|
|
1486 | XSetInputFocus (disp, display->root, RevertToNone, CurrentTime); |
|
|
1487 | } |
|
|
1488 | #endif /* OFFIX_DND */ |
|
|
1489 | break; |
1436 | break; |
1490 | |
1437 | |
1491 | case MappingNotify: |
1438 | case MappingNotify: |
1492 | XRefreshKeyboardMapping (&ev.xmapping); |
1439 | XRefreshKeyboardMapping (&ev.xmapping); |
1493 | break; |
1440 | break; |
… | |
… | |
1535 | { |
1482 | { |
1536 | seen_resize = 1; |
1483 | seen_resize = 1; |
1537 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1484 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1538 | } |
1485 | } |
1539 | |
1486 | |
|
|
1487 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
|
|
1488 | |
1540 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1489 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1541 | if (OPTION (Opt_transparent)) |
1490 | if (OPTION (Opt_transparent)) |
1542 | check_our_parents (); |
1491 | check_our_parents (); |
1543 | #endif |
1492 | #endif |
1544 | } |
1493 | } |
1545 | break; |
1494 | break; |
1546 | |
1495 | |
1547 | case PropertyNotify: |
1496 | case PropertyNotify: |
|
|
1497 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1548 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1498 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1549 | && ev.xproperty.state == PropertyNewValue) |
1499 | && ev.xproperty.state == PropertyNewValue) |
1550 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1500 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1551 | |
1501 | |
1552 | break; |
1502 | break; |
1553 | |
1503 | |
1554 | case SelectionClear: |
1504 | case SelectionClear: |
1555 | selection_clear (); |
1505 | selection_clear (); |
… | |
… | |
1560 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1510 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1561 | break; |
1511 | break; |
1562 | |
1512 | |
1563 | case SelectionRequest: |
1513 | case SelectionRequest: |
1564 | selection_send (ev.xselectionrequest); |
1514 | selection_send (ev.xselectionrequest); |
|
|
1515 | break; |
|
|
1516 | |
|
|
1517 | case MapNotify: |
|
|
1518 | mapped = 1; |
|
|
1519 | #ifdef TEXT_BLINK |
|
|
1520 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
|
|
1521 | #endif |
|
|
1522 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1565 | break; |
1523 | break; |
1566 | |
1524 | |
1567 | case UnmapNotify: |
1525 | case UnmapNotify: |
1568 | mapped = 0; |
1526 | mapped = 0; |
1569 | #ifdef TEXT_BLINK |
1527 | #ifdef TEXT_BLINK |
1570 | text_blink_ev.stop (); |
1528 | text_blink_ev.stop (); |
1571 | #endif |
1529 | #endif |
1572 | break; |
1530 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1573 | |
|
|
1574 | case MapNotify: |
|
|
1575 | mapped = 1; |
|
|
1576 | #ifdef TEXT_BLINK |
|
|
1577 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
|
|
1578 | #endif |
|
|
1579 | break; |
1531 | break; |
1580 | |
1532 | |
1581 | #ifdef TRANSPARENT |
1533 | #ifdef TRANSPARENT |
1582 | case ReparentNotify: |
1534 | case ReparentNotify: |
1583 | rootwin_cb (ev); |
1535 | rootwin_cb (ev); |
… | |
… | |
1597 | |
1549 | |
1598 | while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)) |
1550 | while (XCheckTypedWindowEvent (disp, vt, ev.xany.type, &ev)) |
1599 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1551 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1600 | ev.xexpose.width, ev.xexpose.height, False); |
1552 | ev.xexpose.width, ev.xexpose.height, False); |
1601 | |
1553 | |
1602 | scr_refresh (refresh_type); |
1554 | want_refresh = 1; |
1603 | } |
1555 | } |
1604 | else |
1556 | else |
1605 | { |
1557 | { |
1606 | XEvent unused_event; |
1558 | XEvent unused_event; |
1607 | |
1559 | |
… | |
… | |
1613 | if (isScrollbarWindow (ev.xany.window)) |
1565 | if (isScrollbarWindow (ev.xany.window)) |
1614 | { |
1566 | { |
1615 | scrollBar.setIdle (); |
1567 | scrollBar.setIdle (); |
1616 | scrollbar_show (0); |
1568 | scrollbar_show (0); |
1617 | } |
1569 | } |
1618 | #ifdef MENUBAR |
|
|
1619 | if (menubar_visible () && isMenuBarWindow (ev.xany.window)) |
|
|
1620 | menubar_expose (); |
|
|
1621 | #endif |
|
|
1622 | |
1570 | |
1623 | #ifdef TRANSPARENT |
1571 | #ifdef TRANSPARENT |
1624 | if (am_transparent && ev.xany.window == parent[0]) |
1572 | if (am_transparent && ev.xany.window == parent[0]) |
1625 | XClearWindow (disp, ev.xany.window); |
1573 | XClearWindow (disp, ev.xany.window); |
1626 | #endif |
1574 | #endif |
… | |
… | |
1630 | case MotionNotify: |
1578 | case MotionNotify: |
1631 | #ifdef POINTER_BLANK |
1579 | #ifdef POINTER_BLANK |
1632 | if (hidden_pointer) |
1580 | if (hidden_pointer) |
1633 | pointer_unblank (); |
1581 | pointer_unblank (); |
1634 | #endif |
1582 | #endif |
1635 | #if MENUBAR |
|
|
1636 | if (isMenuBarWindow (ev.xany.window)) |
|
|
1637 | { |
|
|
1638 | menubar_control (ev.xbutton); |
|
|
1639 | break; |
|
|
1640 | } |
|
|
1641 | #endif |
|
|
1642 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1583 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1643 | break; |
1584 | break; |
1644 | |
1585 | |
1645 | if (ev.xany.window == vt) |
1586 | if (ev.xany.window == vt) |
1646 | { |
1587 | { |
|
|
1588 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
1647 | if (HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1589 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1648 | ; // nop |
1590 | ; // nop |
1649 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1591 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1650 | { |
1592 | { |
1651 | while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) |
1593 | while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) |
1652 | ; |
1594 | ; |
… | |
… | |
1734 | &unused_root_x, &unused_root_y, |
1676 | &unused_root_x, &unused_root_y, |
1735 | &ev.xbutton.x, &ev.xbutton.y, |
1677 | &ev.xbutton.x, &ev.xbutton.y, |
1736 | &unused_mask); |
1678 | &unused_mask); |
1737 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1679 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1738 | scrollbar_size ()); |
1680 | scrollbar_size ()); |
1739 | scr_refresh (refresh_type); |
1681 | want_refresh = 1; |
1740 | refresh_limit = 0; |
1682 | refresh_limit = 0; |
1741 | scrollbar_show (1); |
1683 | scrollbar_show (1); |
1742 | } |
1684 | } |
1743 | break; |
1685 | break; |
1744 | } |
1686 | } |
|
|
1687 | |
|
|
1688 | skip_switch: ; |
|
|
1689 | |
|
|
1690 | #if defined(CURSOR_BLINK) |
|
|
1691 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
|
|
1692 | { |
|
|
1693 | if (hidden_cursor) |
|
|
1694 | { |
|
|
1695 | hidden_cursor = 0; |
|
|
1696 | want_refresh = 1; |
|
|
1697 | } |
|
|
1698 | |
|
|
1699 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
|
|
1700 | } |
|
|
1701 | #endif |
|
|
1702 | |
|
|
1703 | #if defined(POINTER_BLANK) |
|
|
1704 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
|
|
1705 | { |
|
|
1706 | if (ev.type == MotionNotify |
|
|
1707 | || ev.type == ButtonPress |
|
|
1708 | || ev.type == ButtonRelease) |
|
|
1709 | if (hidden_pointer) |
|
|
1710 | pointer_unblank (); |
|
|
1711 | |
|
|
1712 | if (ev.type == KeyPress && hidden_pointer == 0) |
|
|
1713 | pointer_blank (); |
|
|
1714 | } |
|
|
1715 | #endif |
1745 | } |
1716 | } |
1746 | |
1717 | |
1747 | void |
1718 | void |
1748 | rxvt_term::focus_in () |
1719 | rxvt_term::focus_in () |
1749 | { |
1720 | { |
… | |
… | |
1761 | XSetICFocus (Input_Context); |
1732 | XSetICFocus (Input_Context); |
1762 | } |
1733 | } |
1763 | #endif |
1734 | #endif |
1764 | #if CURSOR_BLINK |
1735 | #if CURSOR_BLINK |
1765 | if (OPTION (Opt_cursorBlink)) |
1736 | if (OPTION (Opt_cursorBlink)) |
1766 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1737 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1767 | #endif |
1738 | #endif |
1768 | #if OFF_FOCUS_FADING |
1739 | #if OFF_FOCUS_FADING |
1769 | if (rs[Rs_fade]) |
1740 | if (rs[Rs_fade]) |
1770 | { |
1741 | { |
1771 | pix_colors = pix_colors_focused; |
1742 | pix_colors = pix_colors_focused; |
… | |
… | |
1815 | |
1786 | |
1816 | #if TRANSPARENT |
1787 | #if TRANSPARENT |
1817 | void |
1788 | void |
1818 | rxvt_term::rootwin_cb (XEvent &ev) |
1789 | rxvt_term::rootwin_cb (XEvent &ev) |
1819 | { |
1790 | { |
1820 | SET_R (this); |
1791 | make_current (); |
1821 | SET_LOCALE (locale); |
|
|
1822 | |
1792 | |
1823 | switch (ev.type) |
1793 | switch (ev.type) |
1824 | { |
1794 | { |
1825 | case PropertyNotify: |
1795 | case PropertyNotify: |
1826 | /* |
1796 | /* |
… | |
… | |
1853 | /* |
1823 | /* |
1854 | * VT window processing of button press |
1824 | * VT window processing of button press |
1855 | */ |
1825 | */ |
1856 | if (ev.window == vt) |
1826 | if (ev.window == vt) |
1857 | { |
1827 | { |
|
|
1828 | if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1829 | return; |
|
|
1830 | |
1858 | #if ISO_14755 |
1831 | #if ISO_14755 |
1859 | // 5.4 |
1832 | // 5.4 |
1860 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1833 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1861 | { |
1834 | { |
1862 | iso14755_54 (ev.x, ev.y); |
1835 | iso14755_54 (ev.x, ev.y); |
… | |
… | |
1904 | else |
1877 | else |
1905 | { |
1878 | { |
1906 | if (ev.button != MEvent.button) |
1879 | if (ev.button != MEvent.button) |
1907 | MEvent.clicks = 0; |
1880 | MEvent.clicks = 0; |
1908 | |
1881 | |
1909 | if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1910 | switch (ev.button) |
1882 | switch (ev.button) |
1911 | { |
1883 | { |
1912 | case Button1: |
1884 | case Button1: |
1913 | /* allow meta + click to select rectangular areas */ |
1885 | /* allow meta + click to select rectangular areas */ |
1914 | /* should be done in screen.C */ |
1886 | /* should be done in screen.C */ |
1915 | #if ENABLE_FRILLS |
1887 | #if ENABLE_FRILLS |
1916 | selection.rect = !!(ev.state & ModMetaMask); |
1888 | selection.rect = !!(ev.state & ModMetaMask); |
1917 | #else |
1889 | #else |
1918 | selection.rect = false; |
1890 | selection.rect = false; |
1919 | #endif |
1891 | #endif |
1920 | |
1892 | |
1921 | /* allow shift+left click to extend selection */ |
1893 | /* allow shift+left click to extend selection */ |
1922 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1894 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1923 | { |
1895 | { |
1924 | if (MEvent.button == Button1 && clickintime) |
1896 | if (MEvent.button == Button1 && clickintime) |
1925 | selection_rotate (ev.x, ev.y); |
1897 | selection_rotate (ev.x, ev.y); |
1926 | else |
1898 | else |
1927 | selection_extend (ev.x, ev.y, 1); |
1899 | selection_extend (ev.x, ev.y, 1); |
1928 | } |
1900 | } |
1929 | else |
1901 | else |
1930 | { |
1902 | { |
1931 | if (MEvent.button == Button1 && clickintime) |
1903 | if (MEvent.button == Button1 && clickintime) |
1932 | MEvent.clicks++; |
1904 | MEvent.clicks++; |
1933 | else |
1905 | else |
1934 | MEvent.clicks = 1; |
1906 | MEvent.clicks = 1; |
1935 | |
1907 | |
1936 | selection_click (MEvent.clicks, ev.x, ev.y); |
1908 | selection_click (MEvent.clicks, ev.x, ev.y); |
1937 | } |
1909 | } |
1938 | |
1910 | |
1939 | MEvent.button = Button1; |
1911 | MEvent.button = Button1; |
1940 | break; |
1912 | break; |
1941 | |
1913 | |
1942 | case Button3: |
1914 | case Button3: |
1943 | if (MEvent.button == Button3 && clickintime) |
1915 | if (MEvent.button == Button3 && clickintime) |
1944 | selection_rotate (ev.x, ev.y); |
1916 | selection_rotate (ev.x, ev.y); |
1945 | else |
1917 | else |
1946 | selection_extend (ev.x, ev.y, 1); |
1918 | selection_extend (ev.x, ev.y, 1); |
1947 | |
1919 | |
1948 | MEvent.button = Button3; |
1920 | MEvent.button = Button3; |
1949 | break; |
1921 | break; |
1950 | } |
1922 | } |
1951 | } |
1923 | } |
1952 | |
1924 | |
1953 | MEvent.time = ev.time; |
1925 | MEvent.time = ev.time; |
1954 | return; |
1926 | return; |
1955 | } |
1927 | } |
1956 | |
1928 | |
… | |
… | |
2095 | } |
2067 | } |
2096 | } |
2068 | } |
2097 | |
2069 | |
2098 | return; |
2070 | return; |
2099 | } |
2071 | } |
2100 | |
|
|
2101 | #if MENUBAR |
|
|
2102 | /* |
|
|
2103 | * Menubar window processing of button press |
|
|
2104 | */ |
|
|
2105 | if (isMenuBarWindow (ev.window)) |
|
|
2106 | menubar_control (ev); |
|
|
2107 | #endif |
|
|
2108 | } |
2072 | } |
2109 | |
2073 | |
2110 | void |
2074 | void |
2111 | rxvt_term::button_release (XButtonEvent &ev) |
2075 | rxvt_term::button_release (XButtonEvent &ev) |
2112 | { |
2076 | { |
… | |
… | |
2118 | |
2082 | |
2119 | if (scrollbar_isUpDn ()) |
2083 | if (scrollbar_isUpDn ()) |
2120 | { |
2084 | { |
2121 | scrollBar.setIdle (); |
2085 | scrollBar.setIdle (); |
2122 | scrollbar_show (0); |
2086 | scrollbar_show (0); |
2123 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
2124 | refresh_type &= ~SMOOTH_REFRESH; |
|
|
2125 | #endif |
|
|
2126 | } |
2087 | } |
2127 | |
2088 | |
2128 | #ifdef SELECTION_SCROLLING |
2089 | #ifdef SELECTION_SCROLLING |
2129 | if (sel_scroll_ev.active) |
2090 | if (sel_scroll_ev.active) |
2130 | sel_scroll_ev.stop(); |
2091 | sel_scroll_ev.stop(); |
2131 | #endif |
2092 | #endif |
2132 | |
2093 | |
2133 | if (ev.window == vt) |
2094 | if (ev.window == vt) |
2134 | { |
2095 | { |
|
|
2096 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2097 | return; |
|
|
2098 | |
2135 | #if ISO_14755 |
2099 | #if ISO_14755 |
2136 | // 5.4 |
2100 | // 5.4 |
2137 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2101 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2138 | return; |
2102 | return; |
2139 | #endif |
2103 | #endif |
|
|
2104 | |
2140 | if (reportmode) |
2105 | if (reportmode) |
2141 | { |
2106 | { |
2142 | /* mouse report from vt window */ |
2107 | /* mouse report from vt window */ |
2143 | /* don't report release of wheel "buttons" */ |
2108 | /* don't report release of wheel "buttons" */ |
2144 | if (ev.button >= 4) |
2109 | if (ev.button >= 4) |
… | |
… | |
2168 | if (priv_modes & PrivMode_mouse_report |
2133 | if (priv_modes & PrivMode_mouse_report |
2169 | && bypass_keystate |
2134 | && bypass_keystate |
2170 | && ev.button == Button1 && MEvent.clicks <= 1) |
2135 | && ev.button == Button1 && MEvent.clicks <= 1) |
2171 | selection_extend (ev.x, ev.y, 0); |
2136 | selection_extend (ev.x, ev.y, 0); |
2172 | |
2137 | |
2173 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2174 | return; |
|
|
2175 | |
|
|
2176 | switch (ev.button) |
2138 | switch (ev.button) |
2177 | { |
2139 | { |
2178 | case Button1: |
2140 | case Button1: |
2179 | case Button3: |
2141 | case Button3: |
2180 | selection_make (ev.time); |
2142 | selection_make (ev.time); |
2181 | break; |
2143 | break; |
|
|
2144 | |
2182 | case Button2: |
2145 | case Button2: |
2183 | 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 & ModMetaMask ? Sel_Primary : Sel_Primary); |
2184 | break; |
2148 | break; |
|
|
2149 | |
2185 | #ifdef MOUSE_WHEEL |
2150 | #ifdef MOUSE_WHEEL |
2186 | case Button4: |
2151 | case Button4: |
2187 | case Button5: |
2152 | case Button5: |
2188 | { |
2153 | { |
2189 | int i; |
2154 | int i; |
… | |
… | |
2211 | slip_wheel_ev.start (); |
2176 | slip_wheel_ev.start (); |
2212 | } |
2177 | } |
2213 | else |
2178 | else |
2214 | { |
2179 | { |
2215 | # endif |
2180 | # endif |
2216 | # ifdef JUMP_MOUSE_WHEEL |
|
|
2217 | scr_page (v, i); |
2181 | scr_page (v, i); |
2218 | scr_refresh (SMOOTH_REFRESH); |
|
|
2219 | scrollbar_show (1); |
2182 | scrollbar_show (1); |
2220 | # else |
|
|
2221 | while (i--) |
|
|
2222 | { |
|
|
2223 | scr_page (v, 1); |
|
|
2224 | scr_refresh (SMOOTH_REFRESH); |
|
|
2225 | scrollbar_show (1); |
|
|
2226 | } |
|
|
2227 | # endif |
|
|
2228 | # ifdef MOUSE_SLIP_WHEELING |
2183 | # ifdef MOUSE_SLIP_WHEELING |
2229 | } |
2184 | } |
2230 | #endif |
2185 | # endif |
2231 | } |
2186 | } |
2232 | break; |
2187 | break; |
2233 | #endif |
2188 | #endif |
2234 | } |
2189 | } |
2235 | } |
2190 | } |
2236 | #ifdef MENUBAR |
|
|
2237 | else if (isMenuBarWindow (ev.window)) |
|
|
2238 | menubar_control (ev); |
|
|
2239 | #endif |
|
|
2240 | } |
2191 | } |
2241 | |
2192 | |
2242 | #ifdef TRANSPARENT |
2193 | #ifdef TRANSPARENT |
2243 | #if TINTING |
2194 | #if TINTING |
2244 | /* taken from aterm-0.4.2 */ |
2195 | /* taken from aterm-0.4.2 */ |
… | |
… | |
2681 | am_transparent = 0; |
2632 | am_transparent = 0; |
2682 | /* XXX: also turn off Opt_transparent? */ |
2633 | /* XXX: also turn off Opt_transparent? */ |
2683 | } |
2634 | } |
2684 | else |
2635 | else |
2685 | { |
2636 | { |
2686 | #if WAIT_FOR_WM |
|
|
2687 | /* wait (an arbitrary period) for the WM to do its thing |
|
|
2688 | * needed for fvwm2.2.2 (and before?) */ |
|
|
2689 | sleep (1); |
|
|
2690 | #endif |
|
|
2691 | for (n = 0; n < (unsigned int)i; n++) |
2637 | for (n = 0; n < (unsigned int)i; n++) |
2692 | { |
2638 | { |
2693 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2639 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2694 | XClearWindow (disp, parent[n]); |
2640 | XClearWindow (disp, parent[n]); |
2695 | } |
2641 | } |
… | |
… | |
2724 | |
2670 | |
2725 | bool |
2671 | bool |
2726 | rxvt_term::cmd_parse () |
2672 | rxvt_term::cmd_parse () |
2727 | { |
2673 | { |
2728 | bool flag = false; |
2674 | bool flag = false; |
2729 | unicode_t ch = NOCHAR; |
2675 | wchar_t ch = NOCHAR; |
2730 | char *seq_begin; // remember start of esc-sequence here |
2676 | char *seq_begin; // remember start of esc-sequence here |
2731 | |
2677 | |
2732 | for (;;) |
2678 | for (;;) |
2733 | { |
2679 | { |
2734 | if (ch == NOCHAR) |
2680 | if (ch == NOCHAR) |
… | |
… | |
2755 | if (seen_resize && cmd_pid) |
2701 | if (seen_resize && cmd_pid) |
2756 | kill (-cmd_pid, SIGWINCH); |
2702 | kill (-cmd_pid, SIGWINCH); |
2757 | } |
2703 | } |
2758 | |
2704 | |
2759 | /* Read a text string from the input buffer */ |
2705 | /* Read a text string from the input buffer */ |
2760 | unicode_t buf[UBUFSIZ]; |
2706 | wchar_t buf[UBUFSIZ]; |
2761 | bool refreshnow = false; |
2707 | bool refreshnow = false; |
2762 | int nlines = 0; |
2708 | int nlines = 0; |
2763 | unicode_t *str = buf; |
2709 | wchar_t *str = buf; |
2764 | unicode_t *eol = str + min (ncol, UBUFSIZ); |
2710 | wchar_t *eol = str + min (ncol, UBUFSIZ); |
2765 | |
2711 | |
2766 | for (;;) |
2712 | for (;;) |
2767 | { |
2713 | { |
2768 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2714 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2769 | break; |
2715 | break; |
… | |
… | |
2787 | } |
2733 | } |
2788 | |
2734 | |
2789 | // scr_add_lines only works for nlines <= nrow - 1. |
2735 | // scr_add_lines only works for nlines <= nrow - 1. |
2790 | if (nlines >= nrow - 1) |
2736 | if (nlines >= nrow - 1) |
2791 | { |
2737 | { |
|
|
2738 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
2792 | if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_USTRING_LEN, buf, str - buf, DT_END))) |
2739 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2793 | scr_add_lines (buf, nlines, str - buf); |
2740 | scr_add_lines (buf, str - buf, nlines); |
2794 | |
2741 | |
2795 | nlines = 0; |
2742 | nlines = 0; |
2796 | str = buf; |
2743 | str = buf; |
2797 | eol = str + min (ncol, UBUFSIZ); |
2744 | eol = str + min (ncol, UBUFSIZ); |
2798 | } |
2745 | } |
… | |
… | |
2812 | |
2759 | |
2813 | seq_begin = cmdbuf_ptr; |
2760 | seq_begin = cmdbuf_ptr; |
2814 | ch = next_char (); |
2761 | ch = next_char (); |
2815 | } |
2762 | } |
2816 | |
2763 | |
|
|
2764 | if (!(SHOULD_INVOKE (HOOK_ADD_LINES) |
2817 | if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_USTRING_LEN, buf, str - buf, DT_END))) |
2765 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2818 | scr_add_lines (buf, nlines, str - buf); |
2766 | scr_add_lines (buf, str - buf, nlines); |
2819 | |
2767 | |
2820 | /* |
2768 | /* |
2821 | * 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 |
2822 | * 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 | * the number of pages between refreshes is refresh_limit, which |
2771 | * the number of pages between refreshes is refresh_limit, which |
… | |
… | |
2828 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2776 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
2829 | refresh_limit++; |
2777 | refresh_limit++; |
2830 | else |
2778 | else |
2831 | { |
2779 | { |
2832 | flag = true; |
2780 | flag = true; |
2833 | scr_refresh (refresh_type); |
2781 | scr_refresh (); |
2834 | flush_ev.stop (); |
2782 | want_refresh = 1; |
2835 | } |
2783 | } |
2836 | } |
2784 | } |
2837 | |
2785 | |
2838 | } |
2786 | } |
2839 | else |
2787 | else |
… | |
… | |
2854 | } |
2802 | } |
2855 | |
2803 | |
2856 | return flag; |
2804 | return flag; |
2857 | } |
2805 | } |
2858 | |
2806 | |
2859 | // read the next octet |
|
|
2860 | unicode_t |
|
|
2861 | rxvt_term::next_octet () |
|
|
2862 | { |
|
|
2863 | return cmdbuf_ptr < cmdbuf_endp |
|
|
2864 | ? *cmdbuf_ptr++ |
|
|
2865 | : NOCHAR; |
|
|
2866 | } |
|
|
2867 | |
|
|
2868 | // read the next character |
2807 | // read the next character |
2869 | unicode_t |
2808 | wchar_t |
2870 | rxvt_term::next_char () |
2809 | rxvt_term::next_char () NOTHROW |
2871 | { |
2810 | { |
2872 | while (cmdbuf_ptr < cmdbuf_endp) |
2811 | while (cmdbuf_ptr < cmdbuf_endp) |
2873 | { |
2812 | { |
2874 | // assume 7-bit to be ascii ALWAYS |
2813 | // assume 7-bit to be ascii ALWAYS |
2875 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2814 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
… | |
… | |
2884 | cmdbuf_ptr = cmdbuf_endp; |
2823 | cmdbuf_ptr = cmdbuf_endp; |
2885 | break; |
2824 | break; |
2886 | } |
2825 | } |
2887 | |
2826 | |
2888 | if (len == (size_t)-1) |
2827 | if (len == (size_t)-1) |
2889 | return *cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2828 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2890 | |
2829 | |
2891 | // assume wchar == unicode |
2830 | // assume wchar == unicode |
2892 | cmdbuf_ptr += len; |
2831 | cmdbuf_ptr += len; |
2893 | return wc & UNICODE_MASK; |
2832 | return wc & UNICODE_MASK; |
2894 | } |
2833 | } |
2895 | |
2834 | |
2896 | return NOCHAR; |
2835 | return NOCHAR; |
2897 | } |
2836 | } |
|
|
2837 | |
|
|
2838 | // read the next octet |
|
|
2839 | uint32_t |
|
|
2840 | rxvt_term::next_octet () NOTHROW |
|
|
2841 | { |
|
|
2842 | return cmdbuf_ptr < cmdbuf_endp |
|
|
2843 | ? (unsigned char)*cmdbuf_ptr++ |
|
|
2844 | : NOCHAR; |
|
|
2845 | } |
|
|
2846 | |
|
|
2847 | static class out_of_input out_of_input; |
2898 | |
2848 | |
2899 | /* rxvt_cmd_getc () - Return next input character */ |
2849 | /* rxvt_cmd_getc () - Return next input character */ |
2900 | /* |
2850 | /* |
2901 | * Return the next input character after first passing any keyboard input |
2851 | * Return the next input character after first passing any keyboard input |
2902 | * to the command. |
2852 | * to the command. |
2903 | */ |
2853 | */ |
2904 | unicode_t |
2854 | wchar_t |
2905 | rxvt_term::cmd_getc () |
2855 | rxvt_term::cmd_getc () THROW ((class out_of_input)) |
2906 | { |
2856 | { |
2907 | unicode_t c = next_char (); |
2857 | wchar_t c = next_char (); |
2908 | |
2858 | |
2909 | if (c == NOCHAR) |
2859 | if (c == NOCHAR) |
2910 | throw out_of_input; |
2860 | throw out_of_input; |
2911 | |
2861 | |
2912 | return c; |
2862 | return c; |
2913 | } |
2863 | } |
2914 | |
2864 | |
2915 | unicode_t |
2865 | uint32_t |
2916 | rxvt_term::cmd_get8 () |
2866 | rxvt_term::cmd_get8 () THROW ((class out_of_input)) |
2917 | { |
2867 | { |
2918 | unicode_t c = next_octet (); |
2868 | uint32_t c = next_octet (); |
2919 | |
2869 | |
2920 | if (c == NOCHAR) |
2870 | if (c == NOCHAR) |
2921 | throw out_of_input; |
2871 | throw out_of_input; |
2922 | |
2872 | |
2923 | return c; |
2873 | return c; |
… | |
… | |
3190 | break; |
3140 | break; |
3191 | |
3141 | |
3192 | /* 8.3.87: NEXT LINE */ |
3142 | /* 8.3.87: NEXT LINE */ |
3193 | case C1_NEL: /* ESC E */ |
3143 | case C1_NEL: /* ESC E */ |
3194 | { |
3144 | { |
3195 | unicode_t nlcr[] = { C0_LF, C0_CR }; |
3145 | wchar_t nlcr[] = { C0_LF, C0_CR }; |
3196 | scr_add_lines (nlcr, 1, 2); |
3146 | scr_add_lines (nlcr, sizeof (nlcr) / sizeof (nlcr [0]), 1); |
3197 | } |
3147 | } |
3198 | break; |
3148 | break; |
3199 | |
3149 | |
3200 | /* kidnapped escape sequence: Should be 8.3.48 */ |
3150 | /* kidnapped escape sequence: Should be 8.3.48 */ |
3201 | case C1_ESA: /* ESC G */ |
3151 | case C1_ESA: /* ESC G */ |
… | |
… | |
3358 | { |
3308 | { |
3359 | switch (priv) |
3309 | switch (priv) |
3360 | { |
3310 | { |
3361 | case '>': |
3311 | case '>': |
3362 | if (ch == CSI_DA) /* secondary device attributes */ |
3312 | if (ch == CSI_DA) /* secondary device attributes */ |
|
|
3313 | { |
|
|
3314 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
|
|
3315 | // 'U' for rxvt-unicode <= 7.2, and Mm85 (e.g. 7385 for 7.3) for later versions. |
|
|
3316 | // |
|
|
3317 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
|
|
3318 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
|
|
3319 | // that we do not support xterm mouse reporting (should be 95 when we do). |
|
|
3320 | // |
3363 | tt_printf ("\033[>%d;%c%c;0c", 'U', VERSION[0], VERSION[2]); |
3321 | tt_printf ("\033[>%c%c85;94;0c", VERSION[0], VERSION[1]); |
|
|
3322 | } |
3364 | break; |
3323 | break; |
3365 | case '?': |
3324 | case '?': |
3366 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3325 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3367 | process_terminal_mode (ch, priv, nargs, arg); |
3326 | process_terminal_mode (ch, priv, nargs, arg); |
3368 | break; |
3327 | break; |
… | |
… | |
3800 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3759 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3801 | */ |
3760 | */ |
3802 | void |
3761 | void |
3803 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3762 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3804 | { |
3763 | { |
3805 | int changed = 0; |
|
|
3806 | int color; |
3764 | int color; |
3807 | char *buf, *name; |
3765 | char *buf, *name; |
3808 | bool query = str[0] == '?' && !str[1]; |
3766 | bool query = str[0] == '?' && !str[1]; |
3809 | int saveop = op; |
3767 | int saveop = op; |
3810 | dDisp; |
3768 | dDisp; |
… | |
… | |
3865 | { |
3823 | { |
3866 | if ((name = strchr (buf, ';')) == NULL) |
3824 | if ((name = strchr (buf, ';')) == NULL) |
3867 | break; |
3825 | break; |
3868 | |
3826 | |
3869 | *name++ = '\0'; |
3827 | *name++ = '\0'; |
3870 | color = atoi (buf); |
3828 | color = atoi (buf) + minCOLOR; |
3871 | |
3829 | |
3872 | if (color < 0 || color >= TOTAL_COLORS) |
3830 | if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) |
3873 | break; |
3831 | break; |
3874 | |
3832 | |
3875 | if ((buf = strchr (name, ';')) != NULL) |
3833 | if ((buf = strchr (name, ';')) != NULL) |
3876 | *buf++ = '\0'; |
3834 | *buf++ = '\0'; |
3877 | |
3835 | |
3878 | if (name[0] == '?' && !name[1]) |
3836 | if (name[0] == '?' && !name[1]) |
3879 | { |
3837 | { |
3880 | unsigned short r, g, b; |
3838 | unsigned short r, g, b; |
3881 | pix_colors_focused[color + minCOLOR].get (display, r, g, b); |
3839 | pix_colors_focused[color].get (display, r, g, b); |
3882 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
3840 | tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", XTerm_Color, color, r, g, b, resp); |
3883 | } |
3841 | } |
3884 | else |
3842 | else |
3885 | set_window_color (color + minCOLOR, name); |
3843 | set_window_color (color, name); |
3886 | } |
3844 | } |
3887 | break; |
3845 | break; |
3888 | case XTerm_Color00: |
3846 | case XTerm_Color00: |
3889 | process_color_seq (XTerm_Color00, Color_fg, str, resp); |
3847 | process_color_seq (XTerm_Color00, Color_fg, str, resp); |
3890 | break; |
3848 | break; |
3891 | case XTerm_Color01: |
3849 | case XTerm_Color01: |
3892 | process_color_seq (XTerm_Color00, Color_bg, str, resp); |
3850 | process_color_seq (XTerm_Color01, Color_bg, str, resp); |
3893 | break; |
3851 | break; |
3894 | #ifndef NO_CURSORCOLOR |
3852 | #ifndef NO_CURSORCOLOR |
3895 | case XTerm_Color_cursor: |
3853 | case XTerm_Color_cursor: |
3896 | process_color_seq (XTerm_Color_cursor, Color_cursor, str, resp); |
3854 | process_color_seq (XTerm_Color_cursor, Color_cursor, str, resp); |
3897 | break; |
3855 | break; |
… | |
… | |
3901 | break; |
3859 | break; |
3902 | case XTerm_Color_pointer_bg: |
3860 | case XTerm_Color_pointer_bg: |
3903 | process_color_seq (XTerm_Color_pointer_bg, Color_pointer_bg, str, resp); |
3861 | process_color_seq (XTerm_Color_pointer_bg, Color_pointer_bg, str, resp); |
3904 | break; |
3862 | break; |
3905 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3863 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3906 | case XTerm_Color_BD: |
|
|
3907 | process_color_seq (XTerm_Color_BD, Color_BD, str, resp); |
|
|
3908 | break; |
|
|
3909 | case XTerm_Color_UL: |
|
|
3910 | process_color_seq (XTerm_Color_UL, Color_UL, str, resp); |
|
|
3911 | break; |
|
|
3912 | case XTerm_Color_RV: |
3864 | case XTerm_Color_RV: |
3913 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
3865 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
|
|
3866 | break; |
|
|
3867 | case Rxvt_Color_BD: |
|
|
3868 | case URxvt_Color_BD: |
|
|
3869 | process_color_seq (op, Color_BD, str, resp); |
|
|
3870 | break; |
|
|
3871 | case Rxvt_Color_UL: |
|
|
3872 | case URxvt_Color_UL: |
|
|
3873 | process_color_seq (op, Color_UL, str, resp); |
3914 | break; |
3874 | break; |
3915 | case URxvt_Color_IT: |
3875 | case URxvt_Color_IT: |
3916 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
3876 | process_color_seq (URxvt_Color_IT, Color_IT, str, resp); |
3917 | break; |
3877 | break; |
3918 | #endif |
3878 | #endif |
… | |
… | |
3923 | if (am_transparent) |
3883 | if (am_transparent) |
3924 | want_full_refresh = want_refresh = 1; |
3884 | want_full_refresh = want_refresh = 1; |
3925 | break; |
3885 | break; |
3926 | #endif |
3886 | #endif |
3927 | |
3887 | |
3928 | case XTerm_Pixmap: |
3888 | case Rxvt_Pixmap: |
|
|
3889 | { |
3929 | if (*str != ';') |
3890 | if (*str != ';') |
3930 | { |
3891 | { |
3931 | #if XPM_BACKGROUND |
3892 | #if XPM_BACKGROUND |
3932 | scale_pixmap (""); /* reset to default scaling */ |
3893 | scale_pixmap (""); /* reset to default scaling */ |
3933 | set_bgPixmap (str); /* change pixmap */ |
3894 | set_bgPixmap (str); /* change pixmap */ |
3934 | #endif |
|
|
3935 | scr_touch (true); |
3895 | scr_touch (true); |
|
|
3896 | #endif |
3936 | } |
3897 | } |
|
|
3898 | |
|
|
3899 | int changed = 0; |
|
|
3900 | |
3937 | while ((str = strchr (str, ';')) != NULL) |
3901 | while ((str = strchr (str, ';')) != NULL) |
3938 | { |
3902 | { |
3939 | str++; |
3903 | str++; |
3940 | #if XPM_BACKGROUND |
3904 | #if XPM_BACKGROUND |
3941 | changed += scale_pixmap (str); |
3905 | changed += scale_pixmap (str); |
3942 | #endif |
3906 | #endif |
3943 | } |
3907 | } |
3944 | |
3908 | |
3945 | if (changed) |
3909 | if (changed) |
3946 | { |
3910 | { |
3947 | #ifdef XPM_BACKGROUND |
3911 | #ifdef XPM_BACKGROUND |
3948 | resize_pixmap (); |
3912 | resize_pixmap (); |
3949 | #endif |
|
|
3950 | scr_touch (true); |
3913 | scr_touch (true); |
|
|
3914 | #endif |
3951 | } |
3915 | } |
|
|
3916 | } |
3952 | break; |
3917 | break; |
3953 | |
3918 | |
3954 | case XTerm_restoreFG: |
3919 | case Rxvt_restoreFG: |
3955 | set_window_color (Color_fg, str); |
3920 | set_window_color (Color_fg, str); |
3956 | break; |
3921 | break; |
3957 | case XTerm_restoreBG: |
3922 | case Rxvt_restoreBG: |
3958 | set_window_color (Color_bg, str); |
3923 | set_window_color (Color_bg, str); |
3959 | break; |
3924 | break; |
3960 | |
3925 | |
3961 | case XTerm_logfile: |
3926 | case XTerm_logfile: |
3962 | // TODO, when secure mode? |
3927 | // TODO, when secure mode? |
3963 | break; |
3928 | break; |
3964 | |
3929 | |
3965 | #ifdef MENUBAR |
|
|
3966 | case URxvt_Menu: |
|
|
3967 | if (OPTION (Opt_insecure)) |
|
|
3968 | menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked |
|
|
3969 | break; |
|
|
3970 | #endif |
|
|
3971 | #if 0 |
3930 | #if 0 |
3972 | case XTerm_dumpscreen: /* no error notices */ |
3931 | case Rxvt_dumpscreen: /* no error notices */ |
3973 | { |
3932 | { |
3974 | int fd; |
3933 | int fd; |
3975 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3934 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3976 | { |
3935 | { |
3977 | scr_dump (fd); |
3936 | scr_dump (fd); |
… | |
… | |
4008 | if (query) |
3967 | if (query) |
4009 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); |
3968 | tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); |
4010 | else |
3969 | else |
4011 | { |
3970 | { |
4012 | set_locale (str); |
3971 | set_locale (str); |
4013 | pty.set_utf8_mode (enc_utf8); |
3972 | pty->set_utf8_mode (enc_utf8); |
4014 | init_xlocale (); |
3973 | init_xlocale (); |
4015 | } |
3974 | } |
4016 | break; |
3975 | break; |
4017 | |
3976 | |
4018 | case URxvt_view_up: |
3977 | case URxvt_view_up: |
… | |
… | |
4029 | break; |
3988 | break; |
4030 | #endif |
3989 | #endif |
4031 | |
3990 | |
4032 | #if ENABLE_PERL |
3991 | #if ENABLE_PERL |
4033 | case URxvt_perl: |
3992 | case URxvt_perl: |
4034 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_STRING, str, DT_END))) |
3993 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_STR, str, DT_END))) |
4035 | ; // no responses yet |
3994 | ; // no responses yet |
4036 | break; |
3995 | break; |
4037 | #endif |
3996 | #endif |
4038 | } |
3997 | } |
4039 | } |
3998 | } |
… | |
… | |
4071 | return state; |
4030 | return state; |
4072 | } |
4031 | } |
4073 | |
4032 | |
4074 | /* we're not using priv _yet_ */ |
4033 | /* we're not using priv _yet_ */ |
4075 | void |
4034 | void |
4076 | rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) |
4035 | rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg) |
4077 | { |
4036 | { |
4078 | unsigned int i, j; |
4037 | unsigned int i, j; |
4079 | int state; |
4038 | int state; |
4080 | |
4039 | |
4081 | static const struct |
4040 | static const struct |
… | |
… | |
4092 | { 5, PrivMode_rVideo }, |
4051 | { 5, PrivMode_rVideo }, |
4093 | { 6, PrivMode_relOrigin }, |
4052 | { 6, PrivMode_relOrigin }, |
4094 | { 7, PrivMode_Autowrap }, |
4053 | { 7, PrivMode_Autowrap }, |
4095 | // 8, bi-directional support mode |
4054 | // 8, bi-directional support mode |
4096 | { 9, PrivMode_MouseX10 }, |
4055 | { 9, PrivMode_MouseX10 }, |
4097 | #ifdef menuBar_esc |
|
|
4098 | { menuBar_esc, PrivMode_menuBar }, |
|
|
4099 | #endif |
|
|
4100 | // 18, 19 printing-related |
4056 | // 18, 19 printing-related |
4101 | { 25, PrivMode_VisibleCursor }, |
4057 | { 25, PrivMode_VisibleCursor }, |
4102 | #ifdef scrollBar_esc |
4058 | #ifdef scrollBar_esc |
4103 | { scrollBar_esc, PrivMode_scrollBar }, |
4059 | { scrollBar_esc, PrivMode_scrollBar }, |
4104 | #endif |
4060 | #endif |
… | |
… | |
4151 | /* extra handling for values with state unkept */ |
4107 | /* extra handling for values with state unkept */ |
4152 | switch (arg[i]) |
4108 | switch (arg[i]) |
4153 | { |
4109 | { |
4154 | #if ENABLE_STYLES |
4110 | #if ENABLE_STYLES |
4155 | case 1021: |
4111 | case 1021: |
4156 | if (mode) |
4112 | set_option (Opt_intensityStyles, mode); |
4157 | SET_OPTION (Opt_intensityStyles); |
|
|
4158 | else |
|
|
4159 | CLR_OPTION (Opt_intensityStyles); |
|
|
4160 | |
4113 | |
4161 | scr_touch (true); |
4114 | scr_touch (true); |
4162 | break; |
4115 | break; |
4163 | #endif |
4116 | #endif |
4164 | case 1048: /* alternative cursor save */ |
4117 | case 1048: /* alternative cursor save */ |
… | |
… | |
4186 | case 3: /* 80/132 */ |
4139 | case 3: /* 80/132 */ |
4187 | if (priv_modes & PrivMode_132OK) |
4140 | if (priv_modes & PrivMode_132OK) |
4188 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4141 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
4189 | break; |
4142 | break; |
4190 | case 4: /* smooth scrolling */ |
4143 | case 4: /* smooth scrolling */ |
4191 | if (!state) |
4144 | set_option (Opt_jumpScroll, !state); |
4192 | SET_OPTION (Opt_jumpScroll); |
|
|
4193 | else |
|
|
4194 | CLR_OPTION (Opt_jumpScroll); |
|
|
4195 | break; |
4145 | break; |
4196 | case 5: /* reverse video */ |
4146 | case 5: /* reverse video */ |
4197 | scr_rvideo_mode (state); |
4147 | scr_rvideo_mode (state); |
4198 | break; |
4148 | break; |
4199 | case 6: /* relative/absolute origins */ |
4149 | case 6: /* relative/absolute origins */ |
… | |
… | |
4205 | /* case 8: - auto repeat, can't do on a per window basis */ |
4155 | /* case 8: - auto repeat, can't do on a per window basis */ |
4206 | case 9: /* X10 mouse reporting */ |
4156 | case 9: /* X10 mouse reporting */ |
4207 | if (state) /* orthogonal */ |
4157 | if (state) /* orthogonal */ |
4208 | priv_modes &= ~PrivMode_MouseX11; |
4158 | priv_modes &= ~PrivMode_MouseX11; |
4209 | break; |
4159 | break; |
4210 | #ifdef menuBar_esc |
|
|
4211 | case menuBar_esc: |
|
|
4212 | #ifdef MENUBAR |
|
|
4213 | map_menuBar (state); |
|
|
4214 | #endif |
|
|
4215 | break; |
|
|
4216 | #endif |
|
|
4217 | #ifdef scrollBar_esc |
4160 | #ifdef scrollBar_esc |
4218 | case scrollBar_esc: |
4161 | case scrollBar_esc: |
4219 | if (scrollbar_mapping (state)) |
4162 | if (scrollbar_mapping (state)) |
4220 | { |
4163 | { |
4221 | resize_all_windows (0, 0, 0); |
4164 | resize_all_windows (0, 0, 0); |
… | |
… | |
4240 | #if 0 |
4183 | #if 0 |
4241 | case 1001: |
4184 | case 1001: |
4242 | break; /* X11 mouse highlighting */ |
4185 | break; /* X11 mouse highlighting */ |
4243 | #endif |
4186 | #endif |
4244 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4187 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4245 | if (!state) |
4188 | set_option (Opt_scrollTtyOutput, !state); |
4246 | SET_OPTION (Opt_scrollTtyOutput); |
|
|
4247 | else |
|
|
4248 | CLR_OPTION (Opt_scrollTtyOutput); |
|
|
4249 | break; |
4189 | break; |
4250 | case 1011: /* scroll to bottom on key press */ |
4190 | case 1011: /* scroll to bottom on key press */ |
4251 | if (state) |
4191 | set_option (Opt_scrollTtyKeypress, state); |
4252 | SET_OPTION (Opt_scrollTtyKeypress); |
|
|
4253 | else |
|
|
4254 | CLR_OPTION (Opt_scrollTtyKeypress); |
|
|
4255 | break; |
4192 | break; |
4256 | case 1047: /* secondary screen w/ clearing last */ |
4193 | case 1047: /* secondary screen w/ clearing last */ |
4257 | if (OPTION (Opt_secondaryScreen)) |
4194 | if (OPTION (Opt_secondaryScreen)) |
4258 | if (current_screen != PRIMARY) |
4195 | if (current_screen != PRIMARY) |
4259 | scr_erase_screen (2); |
4196 | scr_erase_screen (2); |
… | |
… | |
4469 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4406 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4470 | |
4407 | |
4471 | void |
4408 | void |
4472 | rxvt_term::tt_write (const char *data, unsigned int len) |
4409 | rxvt_term::tt_write (const char *data, unsigned int len) |
4473 | { |
4410 | { |
4474 | if (pty.pty < 0) |
4411 | if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) |
4475 | return; |
4412 | return; |
4476 | |
4413 | |
|
|
4414 | if (pty->pty < 0) |
|
|
4415 | return; |
|
|
4416 | |
4477 | if (v_buflen == 0) |
4417 | if (v_buflen == 0) |
4478 | { |
4418 | { |
4479 | ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE)); |
4419 | ssize_t written = write (pty->pty, data, min (len, MAX_PTY_WRITE)); |
4480 | |
4420 | |
4481 | if ((unsigned int)written == len) |
4421 | if ((unsigned int)written == len) |
4482 | return; |
4422 | return; |
4483 | |
4423 | |
4484 | data += written; |
4424 | data += written; |
… | |
… | |
4493 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4433 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
4494 | } |
4434 | } |
4495 | |
4435 | |
4496 | void rxvt_term::pty_write () |
4436 | void rxvt_term::pty_write () |
4497 | { |
4437 | { |
4498 | int written = write (pty.pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4438 | int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4499 | |
4439 | |
4500 | if (written > 0) |
4440 | if (written > 0) |
4501 | { |
4441 | { |
4502 | v_buflen -= written; |
4442 | v_buflen -= written; |
4503 | |
4443 | |