… | |
… | |
49 | #include "rxvt.h" /* NECESSARY */ |
49 | #include "rxvt.h" /* NECESSARY */ |
50 | #include "version.h" |
50 | #include "version.h" |
51 | #include "command.h" |
51 | #include "command.h" |
52 | |
52 | |
53 | #include <wchar.h> |
53 | #include <wchar.h> |
|
|
54 | #include <signal.h> |
54 | |
55 | |
55 | /*----------------------------------------------------------------------*/ |
56 | /*----------------------------------------------------------------------*/ |
56 | |
57 | |
57 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
58 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
58 | |
59 | |
… | |
… | |
133 | { |
134 | { |
134 | text_t t = screen.text[y + TermWin.saveLines - TermWin.view_start][x]; |
135 | text_t t = screen.text[y + TermWin.saveLines - TermWin.view_start][x]; |
135 | |
136 | |
136 | if (t != NOCHAR || !x) |
137 | if (t != NOCHAR || !x) |
137 | { |
138 | { |
138 | iso14755_51 (screen.text[y + TermWin.saveLines - TermWin.view_start][x]); |
139 | iso14755_51 (screen.text[y + TermWin.saveLines - TermWin.view_start][x], |
|
|
140 | screen.rend[y + TermWin.saveLines - TermWin.view_start][x]); |
139 | iso14755buf = ISO_14755_54; |
141 | iso14755buf = ISO_14755_54; |
140 | break; |
142 | break; |
141 | } |
143 | } |
142 | |
144 | |
143 | x--; |
145 | x--; |
… | |
… | |
146 | } |
148 | } |
147 | #endif |
149 | #endif |
148 | |
150 | |
149 | #if ENABLE_OVERLAY |
151 | #if ENABLE_OVERLAY |
150 | void |
152 | void |
151 | rxvt_term::iso14755_51 (wchar_t ch) |
153 | rxvt_term::iso14755_51 (unicode_t ch, rend_t r) |
152 | { |
154 | { |
|
|
155 | rxvt_fontset *fs = FONTSET (r); |
|
|
156 | rxvt_font *f = (*fs)[fs->find_font (ch)]; |
153 | wchar_t *chr, *alloc; |
157 | wchar_t *chr, *alloc, ch2; |
154 | int len; |
158 | int len; |
155 | |
159 | |
156 | #if ENABLE_COMBINING |
160 | #if ENABLE_COMBINING |
157 | if (IS_COMPOSE (ch)) |
161 | if (IS_COMPOSE (ch)) |
158 | { |
162 | { |
… | |
… | |
161 | rxvt_composite.expand (ch, chr); |
165 | rxvt_composite.expand (ch, chr); |
162 | } |
166 | } |
163 | else |
167 | else |
164 | #endif |
168 | #endif |
165 | { |
169 | { |
|
|
170 | ch2 = ch; |
|
|
171 | |
166 | alloc = 0; |
172 | alloc = 0; |
167 | chr = &ch; |
173 | chr = &ch2; |
168 | len = 1; |
174 | len = 1; |
169 | } |
175 | } |
170 | |
176 | |
171 | scr_overlay_new (0, -1, 8 + 5, len); |
177 | int width = strlen (f->name); |
|
|
178 | |
|
|
179 | scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1); |
|
|
180 | |
|
|
181 | r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); |
172 | |
182 | |
173 | for (int y = 0; y < len; y++) |
183 | for (int y = 0; y < len; y++) |
174 | { |
184 | { |
175 | char buf[9]; |
185 | char buf[9]; |
176 | |
186 | |
… | |
… | |
181 | scr_overlay_set (9, y, '='); |
191 | scr_overlay_set (9, y, '='); |
182 | #if !UNICODE3 |
192 | #if !UNICODE3 |
183 | if (ch >= 0x10000) |
193 | if (ch >= 0x10000) |
184 | ch = 0xfffd; |
194 | ch = 0xfffd; |
185 | #endif |
195 | #endif |
186 | scr_overlay_set (11, y, ch); |
196 | scr_overlay_set (11, y, ch, r); |
187 | scr_overlay_set (12, y, NOCHAR); |
197 | scr_overlay_set (12, y, NOCHAR, r); |
188 | } |
198 | } |
|
|
199 | |
|
|
200 | scr_overlay_set (0, len, f->name); |
189 | |
201 | |
190 | #if ENABLE_COMBINING |
202 | #if ENABLE_COMBINING |
191 | if (alloc) |
203 | if (alloc) |
192 | delete [] alloc; |
204 | delete [] alloc; |
193 | #endif |
205 | #endif |
… | |
… | |
406 | { |
418 | { |
407 | /* normal XTerm key bindings */ |
419 | /* normal XTerm key bindings */ |
408 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
420 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
409 | selection_request (ev.time, 0, 0); |
421 | selection_request (ev.time, 0, 0); |
410 | return; |
422 | return; |
411 | #if TODO // TODO |
423 | #if TODO |
412 | /* rxvt extras */ |
424 | /* rxvt extras */ |
413 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
425 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
414 | change_font (FONT_UP); |
426 | change_font (FONT_UP); |
415 | return; |
427 | return; |
416 | case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */ |
428 | case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */ |
… | |
… | |
899 | #endif /* MENUBAR_MAX */ |
911 | #endif /* MENUBAR_MAX */ |
900 | |
912 | |
901 | void |
913 | void |
902 | rxvt_term::flush () |
914 | rxvt_term::flush () |
903 | { |
915 | { |
|
|
916 | flush_ev.stop (); |
|
|
917 | |
904 | #ifdef TRANSPARENT |
918 | #ifdef TRANSPARENT |
905 | if (want_full_refresh) |
919 | if (want_full_refresh) |
906 | { |
920 | { |
907 | want_full_refresh = 0; |
921 | want_full_refresh = 0; |
908 | scr_clear (); |
922 | scr_clear (); |
… | |
… | |
918 | IMSendSpot (); |
932 | IMSendSpot (); |
919 | #endif |
933 | #endif |
920 | } |
934 | } |
921 | |
935 | |
922 | display->flush (); |
936 | display->flush (); |
923 | |
|
|
924 | flush_ev.stop (); |
|
|
925 | } |
937 | } |
926 | |
938 | |
927 | void |
939 | void |
928 | rxvt_term::check_cb (check_watcher &w) |
940 | rxvt_term::check_cb (check_watcher &w) |
929 | { |
941 | { |
… | |
… | |
1046 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1058 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1047 | { |
1059 | { |
1048 | SET_R (this); |
1060 | SET_R (this); |
1049 | SET_LOCALE (locale); |
1061 | SET_LOCALE (locale); |
1050 | |
1062 | |
1051 | if (revents & EVENT_WRITE) |
|
|
1052 | tt_write (0, 0); |
|
|
1053 | else if (revents & EVENT_READ) |
1063 | if (revents & EVENT_READ) |
1054 | // loop, but don't allow a single term to monopolize us |
1064 | // loop, but don't allow a single term to monopolize us |
1055 | while (pty_fill ()) |
1065 | while (pty_fill ()) |
1056 | if (cmd_parse ()) |
1066 | if (cmd_parse ()) |
1057 | break; |
1067 | break; |
|
|
1068 | |
|
|
1069 | if (revents & EVENT_WRITE) |
|
|
1070 | pty_write (); |
1058 | } |
1071 | } |
1059 | |
1072 | |
1060 | void |
1073 | void |
1061 | rxvt_term::pointer_unblank () |
1074 | rxvt_term::pointer_unblank () |
1062 | { |
1075 | { |
… | |
… | |
1137 | + ((MEvent.state & ModMetaMask) ? 8 : 0) |
1150 | + ((MEvent.state & ModMetaMask) ? 8 : 0) |
1138 | + ((MEvent.state & ControlMask) ? 16 : 0); |
1151 | + ((MEvent.state & ControlMask) ? 16 : 0); |
1139 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1152 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1140 | key_state += ((MEvent.clicks > 1) ? 32 : 0); |
1153 | key_state += ((MEvent.clicks > 1) ? 32 : 0); |
1141 | #endif |
1154 | #endif |
1142 | |
|
|
1143 | } |
1155 | } |
1144 | |
1156 | |
1145 | #ifdef DEBUG_MOUSEREPORT |
1157 | #if DEBUG_MOUSEREPORT |
1146 | fprintf (stderr, "Mouse ["); |
1158 | fprintf (stderr, "Mouse ["); |
1147 | if (key_state & 16) |
1159 | if (key_state & 16) |
1148 | fputc ('C', stderr); |
1160 | fputc ('C', stderr); |
1149 | if (key_state & 4) |
1161 | if (key_state & 4) |
1150 | fputc ('S', stderr); |
1162 | fputc ('S', stderr); |
… | |
… | |
1154 | fputc ('2', stderr); |
1166 | fputc ('2', stderr); |
1155 | fprintf (stderr, "]: <%d>, %d/%d\n", |
1167 | fprintf (stderr, "]: <%d>, %d/%d\n", |
1156 | button_number, |
1168 | button_number, |
1157 | x + 1, |
1169 | x + 1, |
1158 | y + 1); |
1170 | y + 1); |
1159 | #else |
1171 | #endif |
|
|
1172 | |
1160 | tt_printf ("\033[M%c%c%c", |
1173 | tt_printf ("\033[M%c%c%c", |
1161 | (32 + button_number + key_state), |
1174 | (32 + button_number + key_state), |
1162 | (32 + x + 1), |
1175 | (32 + x + 1), |
1163 | (32 + y + 1)); |
1176 | (32 + y + 1)); |
1164 | #endif |
|
|
1165 | } |
1177 | } |
1166 | |
1178 | |
1167 | #ifdef USING_W11LIB |
1179 | #ifdef USING_W11LIB |
1168 | void |
1180 | void |
1169 | rxvt_W11_process_x_event (XEvent *ev) |
1181 | rxvt_W11_process_x_event (XEvent *ev) |
… | |
… | |
1206 | if (ev.type == KeyPress && hidden_pointer == 0) |
1218 | if (ev.type == KeyPress && hidden_pointer == 0) |
1207 | pointer_blank (); |
1219 | pointer_blank (); |
1208 | } |
1220 | } |
1209 | #endif |
1221 | #endif |
1210 | |
1222 | |
1211 | #ifdef USE_XIM |
|
|
1212 | if (XFilterEvent (&ev, None)) |
|
|
1213 | return; |
|
|
1214 | #endif |
|
|
1215 | |
|
|
1216 | Window unused_root, unused_child; |
1223 | Window unused_root, unused_child; |
1217 | int unused_root_x, unused_root_y; |
1224 | int unused_root_x, unused_root_y; |
1218 | unsigned int unused_mask; |
1225 | unsigned int unused_mask; |
1219 | |
1226 | |
1220 | switch (ev.type) |
1227 | switch (ev.type) |
1221 | { |
1228 | { |
1222 | case KeyPress: |
1229 | case KeyPress: |
1223 | #if ISO_14755 |
1230 | #if ISO_14755 |
… | |
… | |
1227 | |
1234 | |
1228 | break; |
1235 | break; |
1229 | |
1236 | |
1230 | case KeyRelease: |
1237 | case KeyRelease: |
1231 | { |
1238 | { |
1232 | #if (defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)) || defined (ENABLE_FRILLS) |
1239 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 |
1233 | KeySym ks; |
1240 | KeySym ks; |
1234 | |
1241 | |
1235 | ks = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
1242 | ks = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
1236 | #endif |
1243 | #endif |
1237 | |
1244 | |
… | |
… | |
1328 | 0L, 1000000L, |
1335 | 0L, 1000000L, |
1329 | False, AnyPropertyType, |
1336 | False, AnyPropertyType, |
1330 | &ActualType, &ActualFormat, |
1337 | &ActualType, &ActualFormat, |
1331 | &Size, &RemainingBytes, |
1338 | &Size, &RemainingBytes, |
1332 | &data); |
1339 | &data); |
1333 | XChangeProperty (display->display, display->root, |
1340 | set_string_property (XA_CUT_BUFFER0, data); |
1334 | XA_CUT_BUFFER0, XA_STRING, |
|
|
1335 | 8, PropModeReplace, |
|
|
1336 | data, strlen (data)); |
|
|
1337 | XFree (data); |
1341 | XFree (data); |
1338 | selection_paste (display->root, XA_CUT_BUFFER0, True); |
1342 | selection_paste (display->root, XA_CUT_BUFFER0, true); |
1339 | XSetInputFocus (display->display, display->root, RevertToNone, CurrentTime); |
1343 | XSetInputFocus (display->display, display->root, RevertToNone, CurrentTime); |
1340 | } |
1344 | } |
1341 | #endif /* OFFIX_DND */ |
1345 | #endif /* OFFIX_DND */ |
1342 | break; |
1346 | break; |
1343 | |
1347 | |
… | |
… | |
1388 | #endif |
1392 | #endif |
1389 | #ifdef OFF_FOCUS_FADING |
1393 | #ifdef OFF_FOCUS_FADING |
1390 | if (rs[Rs_fade]) |
1394 | if (rs[Rs_fade]) |
1391 | { |
1395 | { |
1392 | pix_colors = pix_colors_focused; |
1396 | pix_colors = pix_colors_focused; |
1393 | set_colorfgbg (); |
|
|
1394 | scr_clear (); |
1397 | scr_recolour (); |
1395 | scr_touch (true); |
|
|
1396 | } |
1398 | } |
1397 | #endif |
1399 | #endif |
1398 | |
1400 | |
1399 | } |
1401 | } |
1400 | break; |
1402 | break; |
… | |
… | |
1402 | case FocusOut: |
1404 | case FocusOut: |
1403 | if (TermWin.focus) |
1405 | if (TermWin.focus) |
1404 | { |
1406 | { |
1405 | TermWin.focus = 0; |
1407 | TermWin.focus = 0; |
1406 | want_refresh = 1; |
1408 | want_refresh = 1; |
|
|
1409 | |
|
|
1410 | #if ENABLE_FRILLS || ISO_14755 |
|
|
1411 | iso14755buf = 0; |
|
|
1412 | #endif |
|
|
1413 | #if ENABLE_OVERLAY |
|
|
1414 | scr_overlay_off (); |
|
|
1415 | #endif |
1407 | #ifdef USE_XIM |
1416 | #ifdef USE_XIM |
1408 | if (Input_Context != NULL) |
1417 | if (Input_Context != NULL) |
1409 | XUnsetICFocus (Input_Context); |
1418 | XUnsetICFocus (Input_Context); |
1410 | #endif |
1419 | #endif |
1411 | #ifdef CURSOR_BLINK |
1420 | #ifdef CURSOR_BLINK |
… | |
… | |
1415 | #endif |
1424 | #endif |
1416 | #ifdef OFF_FOCUS_FADING |
1425 | #ifdef OFF_FOCUS_FADING |
1417 | if (rs[Rs_fade]) |
1426 | if (rs[Rs_fade]) |
1418 | { |
1427 | { |
1419 | pix_colors = pix_colors_unfocused; |
1428 | pix_colors = pix_colors_unfocused; |
1420 | set_colorfgbg (); |
|
|
1421 | scr_clear (); |
1429 | scr_recolour (); |
1422 | scr_touch (true); |
|
|
1423 | } |
1430 | } |
1424 | #endif |
1431 | #endif |
1425 | |
|
|
1426 | } |
1432 | } |
1427 | break; |
1433 | break; |
1428 | |
1434 | |
1429 | case ConfigureNotify: |
1435 | case ConfigureNotify: |
1430 | if (ev.xconfigure.window == TermWin.parent[0]) |
1436 | if (ev.xconfigure.window == TermWin.parent[0]) |
… | |
… | |
1438 | D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height)); |
1444 | D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height)); |
1439 | } |
1445 | } |
1440 | while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev)); |
1446 | while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev)); |
1441 | |
1447 | |
1442 | if (szHint.width != width || szHint.height != height) |
1448 | if (szHint.width != width || szHint.height != height) |
|
|
1449 | { |
|
|
1450 | seen_resize = 1; |
1443 | resize_all_windows (width, height, 1); |
1451 | resize_all_windows (width, height, 1); |
|
|
1452 | } |
1444 | |
1453 | |
1445 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1454 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1446 | if (options & Opt_transparent) |
1455 | if (options & Opt_transparent) |
1447 | { |
|
|
1448 | check_our_parents (); |
1456 | check_our_parents (); |
1449 | if (am_transparent) |
|
|
1450 | want_refresh = want_full_refresh = 1; |
|
|
1451 | } |
|
|
1452 | #endif |
1457 | #endif |
1453 | } |
1458 | } |
1454 | break; |
1459 | break; |
1455 | |
1460 | |
1456 | case PropertyNotify: |
1461 | case PropertyNotify: |
… | |
… | |
1464 | selection_clear (); |
1469 | selection_clear (); |
1465 | break; |
1470 | break; |
1466 | |
1471 | |
1467 | case SelectionNotify: |
1472 | case SelectionNotify: |
1468 | if (selection_wait == Sel_normal) |
1473 | if (selection_wait == Sel_normal) |
1469 | selection_paste (ev.xselection.requestor, |
1474 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1470 | ev.xselection.property, True); |
|
|
1471 | break; |
1475 | break; |
1472 | |
1476 | |
1473 | case SelectionRequest: |
1477 | case SelectionRequest: |
1474 | selection_send (ev.xselectionrequest); |
1478 | selection_send (ev.xselectionrequest); |
1475 | break; |
1479 | break; |
… | |
… | |
1547 | { |
1551 | { |
1548 | menubar_control (ev.xbutton); |
1552 | menubar_control (ev.xbutton); |
1549 | break; |
1553 | break; |
1550 | } |
1554 | } |
1551 | #endif |
1555 | #endif |
1552 | if ((priv_modes & PrivMode_mouse_report) && ! (bypass_keystate)) |
1556 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1553 | break; |
1557 | break; |
1554 | |
1558 | |
1555 | if (ev.xany.window == TermWin.vt) |
1559 | if (ev.xany.window == TermWin.vt) |
1556 | { |
1560 | { |
1557 | if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1561 | if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
… | |
… | |
1560 | ; |
1564 | ; |
1561 | |
1565 | |
1562 | XQueryPointer (display->display, TermWin.vt, |
1566 | XQueryPointer (display->display, TermWin.vt, |
1563 | &unused_root, &unused_child, |
1567 | &unused_root, &unused_child, |
1564 | &unused_root_x, &unused_root_y, |
1568 | &unused_root_x, &unused_root_y, |
1565 | & (ev.xbutton.x), & (ev.xbutton.y), |
1569 | &ev.xbutton.x, &ev.xbutton.y, |
1566 | &unused_mask); |
1570 | &ev.xbutton.state); |
1567 | #ifdef MOUSE_THRESHOLD |
1571 | #ifdef MOUSE_THRESHOLD |
1568 | /* deal with a `jumpy' mouse */ |
1572 | /* deal with a `jumpy' mouse */ |
1569 | if ((ev.xmotion.time - MEvent.time) > MOUSE_THRESHOLD) |
1573 | if ((ev.xmotion.time - MEvent.time) > MOUSE_THRESHOLD) |
1570 | { |
1574 | { |
1571 | #endif |
1575 | #endif |
… | |
… | |
1576 | iso14755_54 (ev.xbutton.x, ev.xbutton.y); |
1580 | iso14755_54 (ev.xbutton.x, ev.xbutton.y); |
1577 | break; |
1581 | break; |
1578 | } |
1582 | } |
1579 | #endif |
1583 | #endif |
1580 | selection_extend (ev.xbutton.x, ev.xbutton.y, |
1584 | selection_extend (ev.xbutton.x, ev.xbutton.y, |
1581 | (ev.xbutton.state & Button3Mask) ? 2 : 0); |
1585 | ev.xbutton.state & Button3Mask ? 2 : 0); |
|
|
1586 | |
1582 | #ifdef SELECTION_SCROLLING |
1587 | #ifdef SELECTION_SCROLLING |
1583 | if (ev.xbutton.y < TermWin.int_bwidth |
1588 | if (ev.xbutton.y < TermWin.int_bwidth |
1584 | || Pixel2Row (ev.xbutton.y) > (TermWin.nrow-1)) |
1589 | || Pixel2Row (ev.xbutton.y) > (TermWin.nrow-1)) |
1585 | { |
1590 | { |
1586 | int dist; |
1591 | int dist; |
… | |
… | |
1597 | selection_save_x = ev.xbutton.x; |
1602 | selection_save_x = ev.xbutton.x; |
1598 | selection_save_y = ev.xbutton.y; |
1603 | selection_save_y = ev.xbutton.y; |
1599 | selection_save_state = (ev.xbutton.state & Button3Mask) ? 2 : 0; |
1604 | selection_save_state = (ev.xbutton.state & Button3Mask) ? 2 : 0; |
1600 | |
1605 | |
1601 | /* calc number of lines to scroll */ |
1606 | /* calc number of lines to scroll */ |
1602 | if (ev.xbutton.y<TermWin.int_bwidth) |
1607 | if (ev.xbutton.y < TermWin.int_bwidth) |
1603 | { |
1608 | { |
1604 | scroll_selection_dir = UP; |
1609 | scroll_selection_dir = UP; |
1605 | dist = TermWin.int_bwidth - ev.xbutton.y; |
1610 | dist = TermWin.int_bwidth - ev.xbutton.y; |
1606 | } |
1611 | } |
1607 | else |
1612 | else |
… | |
… | |
1631 | } |
1636 | } |
1632 | } |
1637 | } |
1633 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1638 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1634 | { |
1639 | { |
1635 | while (XCheckTypedWindowEvent (display->display, scrollBar.win, |
1640 | while (XCheckTypedWindowEvent (display->display, scrollBar.win, |
1636 | MotionNotify, &ev)) ; |
1641 | MotionNotify, &ev)) |
|
|
1642 | ; |
|
|
1643 | |
1637 | XQueryPointer (display->display, scrollBar.win, |
1644 | XQueryPointer (display->display, scrollBar.win, |
1638 | &unused_root, &unused_child, |
1645 | &unused_root, &unused_child, |
1639 | &unused_root_x, &unused_root_y, |
1646 | &unused_root_x, &unused_root_y, |
1640 | & (ev.xbutton.x), & (ev.xbutton.y), |
1647 | &ev.xbutton.x, &ev.xbutton.y, |
1641 | &unused_mask); |
1648 | &unused_mask); |
1642 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1649 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1643 | scrollbar_size ()); |
1650 | scrollbar_size ()); |
1644 | scr_refresh (refresh_type); |
1651 | scr_refresh (refresh_type); |
1645 | refresh_limit = 0; |
1652 | refresh_limit = 0; |
… | |
… | |
1661 | case PropertyNotify: |
1668 | case PropertyNotify: |
1662 | /* |
1669 | /* |
1663 | * if user used some Esetroot compatible prog to set the root bg, |
1670 | * if user used some Esetroot compatible prog to set the root bg, |
1664 | * use the property to determine the pixmap. We use it later on. |
1671 | * use the property to determine the pixmap. We use it later on. |
1665 | */ |
1672 | */ |
1666 | if (xa[XA_XROOTPMAPID] == 0) |
|
|
1667 | xa[XA_XROOTPMAPID] = XInternAtom (display->display, "_XROOTPMAP_ID", False); |
|
|
1668 | |
|
|
1669 | if (ev.xproperty.atom != xa[XA_XROOTPMAPID]) |
1673 | if (ev.xproperty.atom != xa[XA_XROOTPMAP_ID] |
|
|
1674 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1670 | return; |
1675 | return; |
1671 | |
1676 | |
1672 | /* FALLTHROUGH */ |
1677 | /* FALLTHROUGH */ |
1673 | case ReparentNotify: |
1678 | case ReparentNotify: |
1674 | if ((options & Opt_transparent) && check_our_parents () && am_transparent) |
1679 | if ((options & Opt_transparent) && check_our_parents () && am_transparent) |
… | |
… | |
1700 | return; |
1705 | return; |
1701 | } |
1706 | } |
1702 | #endif |
1707 | #endif |
1703 | |
1708 | |
1704 | clickintime = ev.time - MEvent.time < MULTICLICK_TIME; |
1709 | clickintime = ev.time - MEvent.time < MULTICLICK_TIME; |
|
|
1710 | |
1705 | if (reportmode) |
1711 | if (reportmode) |
1706 | { |
1712 | { |
1707 | /* mouse report from vt window */ |
1713 | /* mouse report from vt window */ |
1708 | /* save the xbutton state (for ButtonRelease) */ |
1714 | /* save the xbutton state (for ButtonRelease) */ |
1709 | MEvent.state = ev.state; |
1715 | MEvent.state = ev.state; |
… | |
… | |
1738 | } |
1744 | } |
1739 | else |
1745 | else |
1740 | { |
1746 | { |
1741 | if (ev.button != MEvent.button) |
1747 | if (ev.button != MEvent.button) |
1742 | MEvent.clicks = 0; |
1748 | MEvent.clicks = 0; |
|
|
1749 | |
1743 | switch (ev.button) |
1750 | switch (ev.button) |
1744 | { |
1751 | { |
1745 | case Button1: |
1752 | case Button1: |
|
|
1753 | /* allow meta + click to select rectangular areas */ |
|
|
1754 | /* should be done in screen.C */ |
|
|
1755 | #if ENABLE_FRILLS |
|
|
1756 | selection.rect = !! (ev.state & ModMetaMask); |
|
|
1757 | #else |
|
|
1758 | selection.rect = false; |
|
|
1759 | #endif |
|
|
1760 | |
1746 | /* allow shift+left click to extend selection */ |
1761 | /* allow shift+left click to extend selection */ |
1747 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1762 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1748 | { |
1763 | { |
1749 | if (MEvent.button == Button1 && clickintime) |
1764 | if (MEvent.button == Button1 && clickintime) |
1750 | selection_rotate (ev.x, ev.y); |
1765 | selection_rotate (ev.x, ev.y); |
… | |
… | |
2334 | /* |
2349 | /* |
2335 | * Make the frame window set by the window manager have |
2350 | * Make the frame window set by the window manager have |
2336 | * the root background. Some window managers put multiple nested frame |
2351 | * the root background. Some window managers put multiple nested frame |
2337 | * windows for each client, so we have to take care about that. |
2352 | * windows for each client, so we have to take care about that. |
2338 | */ |
2353 | */ |
2339 | i = (xa[XA_XROOTPMAPID] |
2354 | i = (xa[XA_XROOTPMAP_ID] |
2340 | && XGetWindowProperty (display->display, display->root, xa[XA_XROOTPMAPID], |
2355 | && XGetWindowProperty (display->display, display->root, xa[XA_XROOTPMAP_ID], |
2341 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2356 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2342 | &nitems, &bytes_after, &prop) == Success); |
2357 | &nitems, &bytes_after, &prop) == Success); |
2343 | |
2358 | |
2344 | if (!i || prop == NULL) |
2359 | if (!i || prop == NULL) |
2345 | i = (xa[XA_XSETROOTID] |
2360 | i = (xa[XA_ESETROOT_PMAP_ID] |
2346 | && XGetWindowProperty (display->display, display->root, xa[XA_XSETROOTID], |
2361 | && XGetWindowProperty (display->display, display->root, xa[XA_ESETROOT_PMAP_ID], |
2347 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2362 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2348 | &nitems, &bytes_after, &prop) == Success); |
2363 | &nitems, &bytes_after, &prop) == Success); |
2349 | |
2364 | |
2350 | if (!i || prop == NULL |
2365 | if (!i || prop == NULL |
2351 | #if TINTING |
2366 | #if TINTING |
… | |
… | |
2392 | sy = 0; |
2407 | sy = 0; |
2393 | } |
2408 | } |
2394 | |
2409 | |
2395 | MIN_IT (nw, (unsigned int) (wrootattr.width - sx)); |
2410 | MIN_IT (nw, (unsigned int) (wrootattr.width - sx)); |
2396 | MIN_IT (nh, (unsigned int) (wrootattr.height - sy)); |
2411 | MIN_IT (nh, (unsigned int) (wrootattr.height - sy)); |
|
|
2412 | |
|
|
2413 | XSync (display->display, False); |
2397 | allowedxerror = -1; |
2414 | allowedxerror = -1; |
2398 | image = XGetImage (display->display, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
2415 | image = XGetImage (display->display, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
2399 | |
2416 | |
2400 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
2417 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
2401 | /* XXX: may need a delay here? */ |
2418 | /* XXX: may need a delay here? */ |
… | |
… | |
2447 | |
2464 | |
2448 | am_transparent = am_pixmap_trans = 1; |
2465 | am_transparent = am_pixmap_trans = 1; |
2449 | } |
2466 | } |
2450 | } |
2467 | } |
2451 | |
2468 | |
2452 | if (!am_pixmap_trans) |
2469 | if (am_pixmap_trans) |
|
|
2470 | XSetWindowBackgroundPixmap (display->display, TermWin.vt, ParentRelative); |
|
|
2471 | else |
2453 | { |
2472 | { |
2454 | unsigned int n; |
2473 | unsigned int n; |
2455 | /* |
2474 | /* |
2456 | * InheritPixmap transparency |
2475 | * InheritPixmap transparency |
2457 | */ |
2476 | */ |
… | |
… | |
2515 | |
2534 | |
2516 | for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) |
2535 | for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) |
2517 | TermWin.parent[i] = None; |
2536 | TermWin.parent[i] = None; |
2518 | } |
2537 | } |
2519 | |
2538 | |
2520 | // this is experimental |
|
|
2521 | if (scrollBar.win) |
2539 | if (scrollBar.win) |
2522 | { |
2540 | { |
2523 | XSetWindowBackgroundPixmap (display->display, scrollBar.win, ParentRelative); |
2541 | XSetWindowBackgroundPixmap (display->display, scrollBar.win, ParentRelative); |
2524 | XClearWindow (display->display, scrollBar.win); |
|
|
2525 | scrollBar.setIdle (); |
2542 | scrollBar.setIdle (); |
2526 | scrollbar_show (0); |
2543 | scrollbar_show (0); |
|
|
2544 | } |
|
|
2545 | |
|
|
2546 | if (am_transparent) |
|
|
2547 | { |
|
|
2548 | want_refresh = want_full_refresh = 1; |
|
|
2549 | if (am_pixmap_trans) |
|
|
2550 | flush (); |
2527 | } |
2551 | } |
2528 | |
2552 | |
2529 | return pchanged; |
2553 | return pchanged; |
2530 | } |
2554 | } |
2531 | #endif |
2555 | #endif |
… | |
… | |
2557 | seen_input = 1; |
2581 | seen_input = 1; |
2558 | // many badly-written programs (e.g. jed) contain a race condition: |
2582 | // many badly-written programs (e.g. jed) contain a race condition: |
2559 | // they first read the screensize and then install a SIGWINCH handler. |
2583 | // they first read the screensize and then install a SIGWINCH handler. |
2560 | // some window managers resize the window early, and these programs |
2584 | // some window managers resize the window early, and these programs |
2561 | // then sometimes get the size wrong. |
2585 | // then sometimes get the size wrong. |
|
|
2586 | // unfortunately other programs are even more buggy and dislike |
|
|
2587 | // being sent SIGWINCH, so only do it when we were in fact being |
|
|
2588 | // resized. |
|
|
2589 | if (seen_resize) |
2562 | kill (-cmd_pid, SIGWINCH); |
2590 | kill (-cmd_pid, SIGWINCH); |
2563 | } |
2591 | } |
2564 | |
2592 | |
2565 | /* Read a text string from the input buffer */ |
2593 | /* Read a text string from the input buffer */ |
2566 | unicode_t buf[UBUFSIZ]; |
2594 | unicode_t buf[UBUFSIZ]; |
2567 | bool refreshnow = false; |
2595 | bool refreshnow = false; |
… | |
… | |
3487 | * ends_how is terminator used. returned input must be free()'d |
3515 | * ends_how is terminator used. returned input must be free()'d |
3488 | */ |
3516 | */ |
3489 | unsigned char * |
3517 | unsigned char * |
3490 | rxvt_term::get_to_st (unicode_t &ends_how) |
3518 | rxvt_term::get_to_st (unicode_t &ends_how) |
3491 | { |
3519 | { |
3492 | unicode_t prev = 0, ch; |
3520 | unicode_t ch; |
|
|
3521 | bool seen_esc = false; |
3493 | unsigned int n = 0; |
3522 | unsigned int n = 0; |
3494 | unsigned char *s; |
|
|
3495 | unsigned char string[STRING_MAX]; |
3523 | wchar_t string[STRING_MAX]; |
3496 | |
3524 | |
3497 | while ((ch = cmd_getc ()) != NOCHAR) |
3525 | while ((ch = cmd_getc ()) != NOCHAR) |
3498 | { |
3526 | { |
3499 | if (prev == C0_ESC) |
3527 | if (seen_esc) |
3500 | { |
3528 | { |
3501 | if (ch == 0x5c) /* 7bit ST */ |
3529 | if (ch == 0x5c) /* 7bit ST */ |
3502 | break; |
3530 | break; |
3503 | else |
3531 | else |
3504 | return NULL; |
3532 | return NULL; |
3505 | } |
3533 | } |
|
|
3534 | else if (ch == C0_ESC) |
|
|
3535 | { |
|
|
3536 | seen_esc = true; |
|
|
3537 | continue; |
|
|
3538 | } |
3506 | else if (ch == C0_BEL || ch == CHAR_ST) |
3539 | else if (ch == C0_BEL || ch == CHAR_ST) |
3507 | break; |
3540 | break; |
3508 | else if (ch < 0x20) |
3541 | else if (ch < 0x20) |
3509 | return NULL; /* other control character - exit */ |
3542 | return NULL; /* other control character - exit */ |
|
|
3543 | |
|
|
3544 | seen_esc = false; |
3510 | |
3545 | |
3511 | if (n >= sizeof (string) - 1) |
3546 | if (n >= sizeof (string) - 1) |
3512 | // stop at some sane length |
3547 | // stop at some sane length |
3513 | return NULL; |
3548 | return NULL; |
3514 | |
3549 | |
3515 | if (ch == C0_SYN) |
3550 | if (ch == C0_SYN) |
3516 | { |
|
|
3517 | string[n++] = cmd_get8 (); |
3551 | string[n++] = cmd_get8 (); |
3518 | prev = 0; |
|
|
3519 | } |
|
|
3520 | else |
3552 | else |
3521 | string[n++] = prev = ch; |
3553 | string[n++] = ch; |
3522 | } |
3554 | } |
3523 | |
3555 | |
3524 | string[n++] = '\0'; |
3556 | string[n++] = '\0'; |
3525 | |
3557 | |
3526 | if ((s = (unsigned char *)rxvt_malloc (n)) == NULL) |
|
|
3527 | return NULL; |
|
|
3528 | |
|
|
3529 | ends_how = (ch == 0x5c ? C0_ESC : ch); |
3558 | ends_how = (ch == 0x5c ? C0_ESC : ch); |
3530 | strncpy (s, string, n); |
3559 | |
3531 | return s; |
3560 | return (unsigned char *)rxvt_wcstombs (string); |
3532 | } |
3561 | } |
3533 | |
3562 | |
3534 | /*----------------------------------------------------------------------*/ |
3563 | /*----------------------------------------------------------------------*/ |
3535 | /* |
3564 | /* |
3536 | * process DEVICE CONTROL STRING `ESC P ... (ST|BEL)' or `0x90 ... (ST|BEL)' |
3565 | * process DEVICE CONTROL STRING `ESC P ... (ST|BEL)' or `0x90 ... (ST|BEL)' |
… | |
… | |
3620 | { |
3649 | { |
3621 | int changed = 0; |
3650 | int changed = 0; |
3622 | int color; |
3651 | int color; |
3623 | char *buf, *name; |
3652 | char *buf, *name; |
3624 | bool query = str[0] == '?' && !str[1]; |
3653 | bool query = str[0] == '?' && !str[1]; |
|
|
3654 | int saveop = op; |
3625 | |
3655 | |
3626 | assert (str != NULL); |
3656 | assert (str != NULL); |
3627 | switch (op) |
3657 | switch (op) |
3628 | { |
3658 | { |
3629 | case XTerm_name: |
3659 | case XTerm_name: |
… | |
… | |
3636 | set_title (str); |
3666 | set_title (str); |
3637 | break; |
3667 | break; |
3638 | case XTerm_property: |
3668 | case XTerm_property: |
3639 | if (str[0] == '?') |
3669 | if (str[0] == '?') |
3640 | { |
3670 | { |
3641 | Atom prop = XInternAtom (display->display, str + 1, True); |
3671 | Atom prop = display->atom (str + 1); |
3642 | Atom actual_type; |
3672 | Atom actual_type; |
3643 | int actual_format; |
3673 | int actual_format; |
3644 | unsigned long nitems; |
3674 | unsigned long nitems; |
3645 | unsigned long bytes_after; |
3675 | unsigned long bytes_after; |
3646 | unsigned char *value = 0; |
3676 | unsigned char *value = 0; |
… | |
… | |
3664 | char *eq = strchr (str, '='); // constness lost, but verified to be ok |
3694 | char *eq = strchr (str, '='); // constness lost, but verified to be ok |
3665 | |
3695 | |
3666 | if (eq) |
3696 | if (eq) |
3667 | { |
3697 | { |
3668 | *eq = 0; |
3698 | *eq = 0; |
3669 | XChangeProperty (display->display, TermWin.parent[0], |
3699 | set_utf8_property (display->atom (str), eq + 1); |
3670 | display->atom (str), XA_STRING, 8, |
|
|
3671 | PropModeReplace, (unsigned char *)eq + 1, |
|
|
3672 | strlen (eq + 1)); |
|
|
3673 | } |
3700 | } |
3674 | else |
3701 | else |
3675 | XDeleteProperty (display->display, TermWin.parent[0], |
3702 | XDeleteProperty (display->display, TermWin.parent[0], |
3676 | display->atom (str)); |
3703 | display->atom (str)); |
3677 | } |
3704 | } |
… | |
… | |
3721 | break; |
3748 | break; |
3722 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3749 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3723 | case XTerm_Color_BD: |
3750 | case XTerm_Color_BD: |
3724 | process_color_seq (XTerm_Color_BD, Color_BD, str, resp); |
3751 | process_color_seq (XTerm_Color_BD, Color_BD, str, resp); |
3725 | break; |
3752 | break; |
|
|
3753 | case XTerm_Color_IT: |
|
|
3754 | process_color_seq (XTerm_Color_IT, Color_IT, str, resp); |
|
|
3755 | break; |
3726 | case XTerm_Color_UL: |
3756 | case XTerm_Color_UL: |
3727 | process_color_seq (XTerm_Color_UL, Color_UL, str, resp); |
3757 | process_color_seq (XTerm_Color_UL, Color_UL, str, resp); |
3728 | break; |
3758 | break; |
3729 | case XTerm_Color_RV: |
3759 | case XTerm_Color_RV: |
3730 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
3760 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
|
|
3761 | break; |
|
|
3762 | #endif |
|
|
3763 | #if TRANSPARENT && TINTING |
|
|
3764 | case XTerm_Color_tint: |
|
|
3765 | process_color_seq (XTerm_Color_tint, Color_tint, str, resp); |
|
|
3766 | check_our_parents (); |
|
|
3767 | if (am_transparent) |
|
|
3768 | want_full_refresh = want_refresh = 1; |
3731 | break; |
3769 | break; |
3732 | #endif |
3770 | #endif |
3733 | |
3771 | |
3734 | case XTerm_Pixmap: |
3772 | case XTerm_Pixmap: |
3735 | if (*str != ';') |
3773 | if (*str != ';') |
… | |
… | |
3767 | case XTerm_logfile: |
3805 | case XTerm_logfile: |
3768 | // TODO, when secure mode? |
3806 | // TODO, when secure mode? |
3769 | break; |
3807 | break; |
3770 | |
3808 | |
3771 | case XTerm_font: |
3809 | case XTerm_font: |
|
|
3810 | op = URxvt_font; |
|
|
3811 | case URxvt_font: |
|
|
3812 | #if ENABLE_STYLES |
|
|
3813 | case URxvt_boldFont: |
|
|
3814 | case URxvt_italicFont: |
|
|
3815 | case URxvt_boldItalicFont: |
|
|
3816 | #endif |
3772 | if (query) |
3817 | if (query) |
3773 | tt_printf ("\33]%d;%-.250s%c", XTerm_font, |
3818 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3774 | (options & Opt_insecure) && TermWin.fontset->fontdesc |
3819 | (options & Opt_insecure) && TermWin.fontset[op - URxvt_font]->fontdesc |
3775 | ? TermWin.fontset->fontdesc : "", |
3820 | ? TermWin.fontset[op - URxvt_font]->fontdesc : "", |
3776 | resp); |
3821 | resp); |
3777 | else |
3822 | else |
|
|
3823 | { |
|
|
3824 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
|
|
3825 | |
|
|
3826 | res = strdup (str); |
|
|
3827 | allocated.push_back ((void *)res); |
3778 | change_font (str); |
3828 | set_fonts (); |
|
|
3829 | } |
3779 | break; |
3830 | break; |
3780 | |
3831 | |
3781 | #if ENABLE_FRILLS |
3832 | #if ENABLE_FRILLS |
3782 | case XTerm_locale: |
3833 | case XTerm_locale: |
3783 | if (query) |
3834 | if (query) |
… | |
… | |
3787 | set_locale (str); |
3838 | set_locale (str); |
3788 | # ifdef USE_XIM |
3839 | # ifdef USE_XIM |
3789 | im_cb (); |
3840 | im_cb (); |
3790 | # endif |
3841 | # endif |
3791 | } |
3842 | } |
3792 | break; |
|
|
3793 | |
|
|
3794 | case XTerm_findfont: |
|
|
3795 | { |
|
|
3796 | int fid = TermWin.fontset->find_font (atoi (str)); |
|
|
3797 | tt_printf ("\33]%d;%d;%-.250s%c", XTerm_findfont, |
|
|
3798 | fid, |
|
|
3799 | (options & Opt_insecure) ? (*TermWin.fontset)[fid]->name : "", |
|
|
3800 | resp); |
|
|
3801 | } |
|
|
3802 | break; |
3843 | break; |
3803 | #endif |
3844 | #endif |
3804 | |
3845 | |
3805 | #ifdef MENUBAR |
3846 | #ifdef MENUBAR |
3806 | case XTerm_Menu: |
3847 | case XTerm_Menu: |
… | |
… | |
3935 | |
3976 | |
3936 | /* extra handling for values with state unkept */ |
3977 | /* extra handling for values with state unkept */ |
3937 | switch (arg[i]) |
3978 | switch (arg[i]) |
3938 | { |
3979 | { |
3939 | case 1048: /* alternative cursor save */ |
3980 | case 1048: /* alternative cursor save */ |
|
|
3981 | case 1049: |
3940 | if (options & Opt_secondaryScreen) |
3982 | if (options & Opt_secondaryScreen) |
3941 | if (mode == 0) |
3983 | if (mode == 0) |
3942 | scr_cursor (RESTORE); |
3984 | scr_cursor (RESTORE); |
3943 | else if (mode == 1) |
3985 | else if (mode == 1) |
3944 | scr_cursor (SAVE); |
3986 | scr_cursor (SAVE); |
… | |
… | |
4069 | rendset = 0, rendstyle = ~RS_None; |
4111 | rendset = 0, rendstyle = ~RS_None; |
4070 | break; |
4112 | break; |
4071 | case 1: |
4113 | case 1: |
4072 | rendset = 1, rendstyle = RS_Bold; |
4114 | rendset = 1, rendstyle = RS_Bold; |
4073 | break; |
4115 | break; |
4074 | //case 2: // faint or second colour |
4116 | //case 2: // low intensity |
4075 | //case 3: // italic |
4117 | case 3: |
|
|
4118 | rendset = 1, rendstyle = RS_Italic; |
|
|
4119 | break; |
4076 | case 4: |
4120 | case 4: |
4077 | rendset = 1, rendstyle = RS_Uline; |
4121 | rendset = 1, rendstyle = RS_Uline; |
4078 | break; |
4122 | break; |
4079 | case 5: // slowly blinking |
4123 | case 5: // slowly blinking |
4080 | case 6: // rapidly blinking |
4124 | case 6: // rapidly blinking |
… | |
… | |
4092 | //case 11: // scoansi acs on, first alt font |
4136 | //case 11: // scoansi acs on, first alt font |
4093 | //case 12: // scoansi acs on, |0x80, second alt font |
4137 | //case 12: // scoansi acs on, |0x80, second alt font |
4094 | //... |
4138 | //... |
4095 | //case 19: // ninth alt font |
4139 | //case 19: // ninth alt font |
4096 | //case 20: // gothic |
4140 | //case 20: // gothic |
4097 | case 21: // disable bold, faint |
4141 | case 21: // disable bold, faint, sometimes doubly underlined (iso 8613) |
4098 | rendset = 0, rendstyle = RS_Bold; |
4142 | rendset = 0, rendstyle = RS_Bold; |
4099 | break; |
4143 | break; |
4100 | case 22: |
4144 | case 22: // normal intensity |
4101 | rendset = 0, rendstyle = RS_Bold; |
4145 | rendset = 0, rendstyle = RS_Bold; |
4102 | break; |
4146 | break; |
4103 | //case 23: disable italic |
4147 | case 23: // disable italic |
|
|
4148 | rendset = 0, rendstyle = RS_Italic; |
|
|
4149 | break; |
4104 | case 24: |
4150 | case 24: |
4105 | rendset = 0, rendstyle = RS_Uline; |
4151 | rendset = 0, rendstyle = RS_Uline; |
4106 | break; |
4152 | break; |
4107 | case 25: |
4153 | case 25: |
4108 | rendset = 0, rendstyle = RS_Blink; |
4154 | rendset = 0, rendstyle = RS_Blink; |
4109 | break; |
4155 | break; |
4110 | case 26: |
4156 | case 26: // variable spacing (iso 8613) |
4111 | rendset = 0, rendstyle = RS_Blink; |
4157 | rendset = 0, rendstyle = RS_Blink; |
4112 | break; |
4158 | break; |
4113 | case 27: |
4159 | case 27: |
4114 | rendset = 0, rendstyle = RS_RVid; |
4160 | rendset = 0, rendstyle = RS_RVid; |
4115 | break; |
4161 | break; |
… | |
… | |
4133 | case 35: |
4179 | case 35: |
4134 | case 36: |
4180 | case 36: |
4135 | case 37: |
4181 | case 37: |
4136 | scr_color ((unsigned int) (minCOLOR + (arg[i] - 30)), Color_fg); |
4182 | scr_color ((unsigned int) (minCOLOR + (arg[i] - 30)), Color_fg); |
4137 | break; |
4183 | break; |
4138 | #ifdef TTY_256COLOR |
4184 | case 38: // set fg color, ISO 8613-6 |
4139 | case 38: |
|
|
4140 | if (nargs > i + 2 && arg[i + 1] == 5) |
4185 | if (nargs > i + 2 && arg[i + 1] == 5) |
4141 | { |
4186 | { |
4142 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg); |
4187 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg); |
4143 | i += 2; |
4188 | i += 2; |
4144 | } |
4189 | } |
4145 | break; |
4190 | break; |
4146 | #endif |
|
|
4147 | case 39: /* default fg */ |
4191 | case 39: /* default fg */ |
4148 | scr_color (Color_fg, Color_fg); |
4192 | scr_color (Color_fg, Color_fg); |
4149 | break; |
4193 | break; |
4150 | |
4194 | |
4151 | case 40: |
4195 | case 40: |
… | |
… | |
4156 | case 45: |
4200 | case 45: |
4157 | case 46: |
4201 | case 46: |
4158 | case 47: |
4202 | case 47: |
4159 | scr_color ((unsigned int) (minCOLOR + (arg[i] - 40)), Color_bg); |
4203 | scr_color ((unsigned int) (minCOLOR + (arg[i] - 40)), Color_bg); |
4160 | break; |
4204 | break; |
4161 | #ifdef TTY_256COLOR |
4205 | case 48: // set bg color, ISO 8613-6 |
4162 | case 48: |
|
|
4163 | if (nargs > i + 2 && arg[i + 1] == 5) |
4206 | if (nargs > i + 2 && arg[i + 1] == 5) |
4164 | { |
4207 | { |
4165 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg); |
4208 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg); |
4166 | i += 2; |
4209 | i += 2; |
4167 | } |
4210 | } |
4168 | break; |
4211 | break; |
4169 | #endif |
|
|
4170 | case 49: /* default bg */ |
4212 | case 49: /* default bg */ |
4171 | scr_color (Color_bg, Color_bg); |
4213 | scr_color (Color_bg, Color_bg); |
4172 | break; |
4214 | break; |
|
|
4215 | |
|
|
4216 | //case 50: // not variable spacing |
4173 | |
4217 | |
4174 | #ifndef NO_BRIGHTCOLOR |
4218 | #ifndef NO_BRIGHTCOLOR |
4175 | case 90: |
4219 | case 90: |
4176 | case 91: /* set bright fg color */ |
4220 | case 91: /* set bright fg color */ |
4177 | case 92: |
4221 | case 92: |
4178 | case 93: |
4222 | case 93: |
4179 | case 94: |
4223 | case 94: |
4180 | case 95: |
4224 | case 95: |
4181 | case 96: |
4225 | case 96: |
4182 | case 97: |
4226 | case 97: |
4183 | scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 90)), |
4227 | scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 90)), Color_fg); |
4184 | Color_fg); |
|
|
4185 | break; |
4228 | break; |
4186 | case 100: |
4229 | case 100: |
4187 | case 101: /* set bright bg color */ |
4230 | case 101: /* set bright bg color */ |
4188 | case 102: |
4231 | case 102: |
4189 | case 103: |
4232 | case 103: |
4190 | case 104: |
4233 | case 104: |
4191 | case 105: |
4234 | case 105: |
4192 | case 106: |
4235 | case 106: |
4193 | case 107: |
4236 | case 107: |
4194 | scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), |
4237 | scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); |
4195 | Color_bg); |
|
|
4196 | break; |
4238 | break; |
4197 | #endif |
4239 | #endif |
4198 | |
4240 | |
4199 | } |
4241 | } |
4200 | } |
4242 | } |
… | |
… | |
4239 | |
4281 | |
4240 | /* ---------------------------------------------------------------------- */ |
4282 | /* ---------------------------------------------------------------------- */ |
4241 | /* Write data to the pty as typed by the user, pasted with the mouse, |
4283 | /* Write data to the pty as typed by the user, pasted with the mouse, |
4242 | * or generated by us in response to a query ESC sequence. |
4284 | * or generated by us in response to a query ESC sequence. |
4243 | */ |
4285 | */ |
|
|
4286 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
|
|
4287 | |
4244 | void |
4288 | void |
4245 | rxvt_term::tt_write (const unsigned char *data, unsigned int len) |
4289 | rxvt_term::tt_write (const unsigned char *data, unsigned int len) |
4246 | { |
4290 | { |
4247 | enum { MAX_PTY_WRITE = 255 }; // minimum MAX_INPUT |
4291 | if (v_buflen == 0) |
|
|
4292 | { |
|
|
4293 | ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE)); |
4248 | |
4294 | |
4249 | if (len) |
4295 | if ((unsigned int)written == len) |
|
|
4296 | return; |
|
|
4297 | |
|
|
4298 | data += written; |
|
|
4299 | len -= written; |
4250 | { |
4300 | } |
|
|
4301 | |
|
|
4302 | v_buffer = (unsigned char *)realloc (v_buffer, v_buflen + len); |
|
|
4303 | |
|
|
4304 | memcpy (v_buffer + v_buflen, data, len); |
|
|
4305 | v_buflen += len; |
|
|
4306 | |
|
|
4307 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
|
|
4308 | } |
|
|
4309 | |
|
|
4310 | void rxvt_term::pty_write () |
|
|
4311 | { |
|
|
4312 | int written = write (pty.pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
|
|
4313 | |
|
|
4314 | if (written > 0) |
|
|
4315 | { |
|
|
4316 | v_buflen -= written; |
|
|
4317 | |
4251 | if (v_buflen == 0) |
4318 | if (v_buflen == 0) |
4252 | { |
4319 | { |
4253 | ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE)); |
|
|
4254 | |
|
|
4255 | if ((unsigned int)written == len) |
|
|
4256 | return; |
|
|
4257 | |
|
|
4258 | data += written; |
|
|
4259 | len -= written; |
|
|
4260 | } |
|
|
4261 | |
|
|
4262 | |
|
|
4263 | v_buffer = (unsigned char *)realloc (v_buffer, v_buflen + len); |
|
|
4264 | |
|
|
4265 | memcpy (v_buffer + v_buflen, data, len); |
|
|
4266 | v_buflen += len; |
|
|
4267 | } |
|
|
4268 | |
|
|
4269 | for (;;) |
|
|
4270 | { |
|
|
4271 | int written = write (pty.pty, v_buffer, min (MAX_PTY_WRITE, v_buflen)); |
|
|
4272 | |
|
|
4273 | if (written > 0) |
|
|
4274 | { |
|
|
4275 | v_buflen -= written; |
|
|
4276 | |
|
|
4277 | if (v_buflen == 0) |
|
|
4278 | { |
|
|
4279 | free (v_buffer); |
4320 | free (v_buffer); |
4280 | v_buffer = 0; |
4321 | v_buffer = 0; |
4281 | v_buflen = 0; |
4322 | v_buflen = 0; |
4282 | |
4323 | |
4283 | pty_ev.set (EVENT_READ); |
4324 | pty_ev.set (EVENT_READ); |
4284 | return; |
|
|
4285 | } |
|
|
4286 | |
|
|
4287 | memmove (v_buffer, v_buffer + written, v_buflen); |
|
|
4288 | } |
|
|
4289 | else if (written != -1 || (errno != EAGAIN && errno != EINTR)) |
|
|
4290 | // original code just ignores this... |
|
|
4291 | destroy (); |
|
|
4292 | else |
|
|
4293 | { |
|
|
4294 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
|
|
4295 | return; |
4325 | return; |
4296 | } |
4326 | } |
|
|
4327 | |
|
|
4328 | memmove (v_buffer, v_buffer + written, v_buflen); |
4297 | } |
4329 | } |
|
|
4330 | else if (written != -1 || (errno != EAGAIN && errno != EINTR)) |
|
|
4331 | // original code just ignores this... |
|
|
4332 | destroy (); |
4298 | } |
4333 | } |
4299 | |
4334 | |
4300 | /*----------------------- end-of-file (C source) -----------------------*/ |
4335 | /*----------------------- end-of-file (C source) -----------------------*/ |
4301 | |
4336 | |