… | |
… | |
133 | { |
133 | { |
134 | text_t t = screen.text[y + TermWin.saveLines - TermWin.view_start][x]; |
134 | text_t t = screen.text[y + TermWin.saveLines - TermWin.view_start][x]; |
135 | |
135 | |
136 | if (t != NOCHAR || !x) |
136 | if (t != NOCHAR || !x) |
137 | { |
137 | { |
138 | iso14755_51 (screen.text[y + TermWin.saveLines - TermWin.view_start][x]); |
138 | iso14755_51 (screen.text[y + TermWin.saveLines - TermWin.view_start][x], |
|
|
139 | screen.rend[y + TermWin.saveLines - TermWin.view_start][x]); |
139 | iso14755buf = ISO_14755_54; |
140 | iso14755buf = ISO_14755_54; |
140 | break; |
141 | break; |
141 | } |
142 | } |
142 | |
143 | |
143 | x--; |
144 | x--; |
… | |
… | |
146 | } |
147 | } |
147 | #endif |
148 | #endif |
148 | |
149 | |
149 | #if ENABLE_OVERLAY |
150 | #if ENABLE_OVERLAY |
150 | void |
151 | void |
151 | rxvt_term::iso14755_51 (wchar_t ch) |
152 | rxvt_term::iso14755_51 (unicode_t ch, rend_t r) |
152 | { |
153 | { |
|
|
154 | rxvt_fontset *fs = FONTSET (r); |
|
|
155 | rxvt_font *f = (*fs)[fs->find_font (ch)]; |
153 | wchar_t *chr, *alloc; |
156 | wchar_t *chr, *alloc, ch2; |
154 | int len; |
157 | int len; |
155 | |
158 | |
156 | #if ENABLE_COMBINING |
159 | #if ENABLE_COMBINING |
157 | if (IS_COMPOSE (ch)) |
160 | if (IS_COMPOSE (ch)) |
158 | { |
161 | { |
… | |
… | |
161 | rxvt_composite.expand (ch, chr); |
164 | rxvt_composite.expand (ch, chr); |
162 | } |
165 | } |
163 | else |
166 | else |
164 | #endif |
167 | #endif |
165 | { |
168 | { |
|
|
169 | ch2 = ch; |
|
|
170 | |
166 | alloc = 0; |
171 | alloc = 0; |
167 | chr = &ch; |
172 | chr = &ch2; |
168 | len = 1; |
173 | len = 1; |
169 | } |
174 | } |
170 | |
175 | |
171 | scr_overlay_new (0, -1, 8 + 5, len); |
176 | int width = strlen (f->name); |
|
|
177 | |
|
|
178 | scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1); |
|
|
179 | |
|
|
180 | r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); |
172 | |
181 | |
173 | for (int y = 0; y < len; y++) |
182 | for (int y = 0; y < len; y++) |
174 | { |
183 | { |
175 | char buf[9]; |
184 | char buf[9]; |
176 | |
185 | |
… | |
… | |
181 | scr_overlay_set (9, y, '='); |
190 | scr_overlay_set (9, y, '='); |
182 | #if !UNICODE3 |
191 | #if !UNICODE3 |
183 | if (ch >= 0x10000) |
192 | if (ch >= 0x10000) |
184 | ch = 0xfffd; |
193 | ch = 0xfffd; |
185 | #endif |
194 | #endif |
186 | scr_overlay_set (11, y, ch); |
195 | scr_overlay_set (11, y, ch, r); |
187 | scr_overlay_set (12, y, NOCHAR); |
196 | scr_overlay_set (12, y, NOCHAR, r); |
188 | } |
197 | } |
|
|
198 | |
|
|
199 | scr_overlay_set (0, len, f->name); |
189 | |
200 | |
190 | #if ENABLE_COMBINING |
201 | #if ENABLE_COMBINING |
191 | if (alloc) |
202 | if (alloc) |
192 | delete [] alloc; |
203 | delete [] alloc; |
193 | #endif |
204 | #endif |
… | |
… | |
899 | #endif /* MENUBAR_MAX */ |
910 | #endif /* MENUBAR_MAX */ |
900 | |
911 | |
901 | void |
912 | void |
902 | rxvt_term::flush () |
913 | rxvt_term::flush () |
903 | { |
914 | { |
|
|
915 | flush_ev.stop (); |
|
|
916 | |
904 | #ifdef TRANSPARENT |
917 | #ifdef TRANSPARENT |
905 | if (want_full_refresh) |
918 | if (want_full_refresh) |
906 | { |
919 | { |
907 | want_full_refresh = 0; |
920 | want_full_refresh = 0; |
908 | scr_clear (); |
921 | scr_clear (); |
… | |
… | |
918 | IMSendSpot (); |
931 | IMSendSpot (); |
919 | #endif |
932 | #endif |
920 | } |
933 | } |
921 | |
934 | |
922 | display->flush (); |
935 | display->flush (); |
923 | |
|
|
924 | flush_ev.stop (); |
|
|
925 | } |
936 | } |
926 | |
937 | |
927 | void |
938 | void |
928 | rxvt_term::check_cb (check_watcher &w) |
939 | rxvt_term::check_cb (check_watcher &w) |
929 | { |
940 | { |
… | |
… | |
1137 | + ((MEvent.state & ModMetaMask) ? 8 : 0) |
1148 | + ((MEvent.state & ModMetaMask) ? 8 : 0) |
1138 | + ((MEvent.state & ControlMask) ? 16 : 0); |
1149 | + ((MEvent.state & ControlMask) ? 16 : 0); |
1139 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1150 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1140 | key_state += ((MEvent.clicks > 1) ? 32 : 0); |
1151 | key_state += ((MEvent.clicks > 1) ? 32 : 0); |
1141 | #endif |
1152 | #endif |
1142 | |
|
|
1143 | } |
1153 | } |
1144 | |
1154 | |
1145 | #ifdef DEBUG_MOUSEREPORT |
1155 | #if DEBUG_MOUSEREPORT |
1146 | fprintf (stderr, "Mouse ["); |
1156 | fprintf (stderr, "Mouse ["); |
1147 | if (key_state & 16) |
1157 | if (key_state & 16) |
1148 | fputc ('C', stderr); |
1158 | fputc ('C', stderr); |
1149 | if (key_state & 4) |
1159 | if (key_state & 4) |
1150 | fputc ('S', stderr); |
1160 | fputc ('S', stderr); |
… | |
… | |
1154 | fputc ('2', stderr); |
1164 | fputc ('2', stderr); |
1155 | fprintf (stderr, "]: <%d>, %d/%d\n", |
1165 | fprintf (stderr, "]: <%d>, %d/%d\n", |
1156 | button_number, |
1166 | button_number, |
1157 | x + 1, |
1167 | x + 1, |
1158 | y + 1); |
1168 | y + 1); |
1159 | #else |
1169 | #endif |
|
|
1170 | |
1160 | tt_printf ("\033[M%c%c%c", |
1171 | tt_printf ("\033[M%c%c%c", |
1161 | (32 + button_number + key_state), |
1172 | (32 + button_number + key_state), |
1162 | (32 + x + 1), |
1173 | (32 + x + 1), |
1163 | (32 + y + 1)); |
1174 | (32 + y + 1)); |
1164 | #endif |
|
|
1165 | } |
1175 | } |
1166 | |
1176 | |
1167 | #ifdef USING_W11LIB |
1177 | #ifdef USING_W11LIB |
1168 | void |
1178 | void |
1169 | rxvt_W11_process_x_event (XEvent *ev) |
1179 | rxvt_W11_process_x_event (XEvent *ev) |
… | |
… | |
1206 | if (ev.type == KeyPress && hidden_pointer == 0) |
1216 | if (ev.type == KeyPress && hidden_pointer == 0) |
1207 | pointer_blank (); |
1217 | pointer_blank (); |
1208 | } |
1218 | } |
1209 | #endif |
1219 | #endif |
1210 | |
1220 | |
1211 | #ifdef USE_XIM |
|
|
1212 | if (XFilterEvent (&ev, None)) |
|
|
1213 | return; |
|
|
1214 | #endif |
|
|
1215 | |
|
|
1216 | Window unused_root, unused_child; |
1221 | Window unused_root, unused_child; |
1217 | int unused_root_x, unused_root_y; |
1222 | int unused_root_x, unused_root_y; |
1218 | unsigned int unused_mask; |
1223 | unsigned int unused_mask; |
1219 | |
1224 | |
1220 | switch (ev.type) |
1225 | switch (ev.type) |
… | |
… | |
1227 | |
1232 | |
1228 | break; |
1233 | break; |
1229 | |
1234 | |
1230 | case KeyRelease: |
1235 | case KeyRelease: |
1231 | { |
1236 | { |
1232 | #if (defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)) || defined (ENABLE_FRILLS) |
1237 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 |
1233 | KeySym ks; |
1238 | KeySym ks; |
1234 | |
1239 | |
1235 | ks = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
1240 | ks = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
1236 | #endif |
1241 | #endif |
1237 | |
1242 | |
… | |
… | |
1388 | #endif |
1393 | #endif |
1389 | #ifdef OFF_FOCUS_FADING |
1394 | #ifdef OFF_FOCUS_FADING |
1390 | if (rs[Rs_fade]) |
1395 | if (rs[Rs_fade]) |
1391 | { |
1396 | { |
1392 | pix_colors = pix_colors_focused; |
1397 | pix_colors = pix_colors_focused; |
1393 | set_colorfgbg (); |
|
|
1394 | scr_clear (); |
1398 | scr_recolour (); |
1395 | scr_touch (true); |
|
|
1396 | } |
1399 | } |
1397 | #endif |
1400 | #endif |
1398 | |
1401 | |
1399 | } |
1402 | } |
1400 | break; |
1403 | break; |
… | |
… | |
1402 | case FocusOut: |
1405 | case FocusOut: |
1403 | if (TermWin.focus) |
1406 | if (TermWin.focus) |
1404 | { |
1407 | { |
1405 | TermWin.focus = 0; |
1408 | TermWin.focus = 0; |
1406 | want_refresh = 1; |
1409 | want_refresh = 1; |
|
|
1410 | |
|
|
1411 | #if ENABLE_FRILLS || ISO_14755 |
|
|
1412 | iso14755buf = 0; |
|
|
1413 | #endif |
|
|
1414 | #if ENABLE_OVERLAY |
|
|
1415 | scr_overlay_off (); |
|
|
1416 | #endif |
1407 | #ifdef USE_XIM |
1417 | #ifdef USE_XIM |
1408 | if (Input_Context != NULL) |
1418 | if (Input_Context != NULL) |
1409 | XUnsetICFocus (Input_Context); |
1419 | XUnsetICFocus (Input_Context); |
1410 | #endif |
1420 | #endif |
1411 | #ifdef CURSOR_BLINK |
1421 | #ifdef CURSOR_BLINK |
… | |
… | |
1415 | #endif |
1425 | #endif |
1416 | #ifdef OFF_FOCUS_FADING |
1426 | #ifdef OFF_FOCUS_FADING |
1417 | if (rs[Rs_fade]) |
1427 | if (rs[Rs_fade]) |
1418 | { |
1428 | { |
1419 | pix_colors = pix_colors_unfocused; |
1429 | pix_colors = pix_colors_unfocused; |
1420 | set_colorfgbg (); |
|
|
1421 | scr_clear (); |
1430 | scr_recolour (); |
1422 | scr_touch (true); |
|
|
1423 | } |
1431 | } |
1424 | #endif |
1432 | #endif |
1425 | |
|
|
1426 | } |
1433 | } |
1427 | break; |
1434 | break; |
1428 | |
1435 | |
1429 | case ConfigureNotify: |
1436 | case ConfigureNotify: |
1430 | if (ev.xconfigure.window == TermWin.parent[0]) |
1437 | if (ev.xconfigure.window == TermWin.parent[0]) |
… | |
… | |
1438 | D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height)); |
1445 | D_SIZE ((stderr, "Size: ConfigureNotify: %4d x %4d", width, height)); |
1439 | } |
1446 | } |
1440 | while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev)); |
1447 | while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev)); |
1441 | |
1448 | |
1442 | if (szHint.width != width || szHint.height != height) |
1449 | if (szHint.width != width || szHint.height != height) |
|
|
1450 | { |
|
|
1451 | seen_resize = 1; |
1443 | resize_all_windows (width, height, 1); |
1452 | resize_all_windows (width, height, 1); |
|
|
1453 | } |
1444 | |
1454 | |
1445 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1455 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1446 | if (options & Opt_transparent) |
1456 | if (options & Opt_transparent) |
1447 | { |
1457 | { |
1448 | check_our_parents (); |
1458 | check_our_parents (); |
… | |
… | |
1547 | { |
1557 | { |
1548 | menubar_control (ev.xbutton); |
1558 | menubar_control (ev.xbutton); |
1549 | break; |
1559 | break; |
1550 | } |
1560 | } |
1551 | #endif |
1561 | #endif |
1552 | if ((priv_modes & PrivMode_mouse_report) && ! (bypass_keystate)) |
1562 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1553 | break; |
1563 | break; |
1554 | |
1564 | |
1555 | if (ev.xany.window == TermWin.vt) |
1565 | if (ev.xany.window == TermWin.vt) |
1556 | { |
1566 | { |
1557 | if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1567 | if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
… | |
… | |
1560 | ; |
1570 | ; |
1561 | |
1571 | |
1562 | XQueryPointer (display->display, TermWin.vt, |
1572 | XQueryPointer (display->display, TermWin.vt, |
1563 | &unused_root, &unused_child, |
1573 | &unused_root, &unused_child, |
1564 | &unused_root_x, &unused_root_y, |
1574 | &unused_root_x, &unused_root_y, |
1565 | & (ev.xbutton.x), & (ev.xbutton.y), |
1575 | &ev.xbutton.x, &ev.xbutton.y, |
1566 | &unused_mask); |
1576 | &ev.xbutton.state); |
1567 | #ifdef MOUSE_THRESHOLD |
1577 | #ifdef MOUSE_THRESHOLD |
1568 | /* deal with a `jumpy' mouse */ |
1578 | /* deal with a `jumpy' mouse */ |
1569 | if ((ev.xmotion.time - MEvent.time) > MOUSE_THRESHOLD) |
1579 | if ((ev.xmotion.time - MEvent.time) > MOUSE_THRESHOLD) |
1570 | { |
1580 | { |
1571 | #endif |
1581 | #endif |
… | |
… | |
1576 | iso14755_54 (ev.xbutton.x, ev.xbutton.y); |
1586 | iso14755_54 (ev.xbutton.x, ev.xbutton.y); |
1577 | break; |
1587 | break; |
1578 | } |
1588 | } |
1579 | #endif |
1589 | #endif |
1580 | selection_extend (ev.xbutton.x, ev.xbutton.y, |
1590 | selection_extend (ev.xbutton.x, ev.xbutton.y, |
1581 | (ev.xbutton.state & Button3Mask) ? 2 : 0); |
1591 | ev.xbutton.state & Button3Mask ? 2 : 0); |
|
|
1592 | |
1582 | #ifdef SELECTION_SCROLLING |
1593 | #ifdef SELECTION_SCROLLING |
1583 | if (ev.xbutton.y < TermWin.int_bwidth |
1594 | if (ev.xbutton.y < TermWin.int_bwidth |
1584 | || Pixel2Row (ev.xbutton.y) > (TermWin.nrow-1)) |
1595 | || Pixel2Row (ev.xbutton.y) > (TermWin.nrow-1)) |
1585 | { |
1596 | { |
1586 | int dist; |
1597 | int dist; |
… | |
… | |
1597 | selection_save_x = ev.xbutton.x; |
1608 | selection_save_x = ev.xbutton.x; |
1598 | selection_save_y = ev.xbutton.y; |
1609 | selection_save_y = ev.xbutton.y; |
1599 | selection_save_state = (ev.xbutton.state & Button3Mask) ? 2 : 0; |
1610 | selection_save_state = (ev.xbutton.state & Button3Mask) ? 2 : 0; |
1600 | |
1611 | |
1601 | /* calc number of lines to scroll */ |
1612 | /* calc number of lines to scroll */ |
1602 | if (ev.xbutton.y<TermWin.int_bwidth) |
1613 | if (ev.xbutton.y < TermWin.int_bwidth) |
1603 | { |
1614 | { |
1604 | scroll_selection_dir = UP; |
1615 | scroll_selection_dir = UP; |
1605 | dist = TermWin.int_bwidth - ev.xbutton.y; |
1616 | dist = TermWin.int_bwidth - ev.xbutton.y; |
1606 | } |
1617 | } |
1607 | else |
1618 | else |
… | |
… | |
1631 | } |
1642 | } |
1632 | } |
1643 | } |
1633 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1644 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1634 | { |
1645 | { |
1635 | while (XCheckTypedWindowEvent (display->display, scrollBar.win, |
1646 | while (XCheckTypedWindowEvent (display->display, scrollBar.win, |
1636 | MotionNotify, &ev)) ; |
1647 | MotionNotify, &ev)) |
|
|
1648 | ; |
|
|
1649 | |
1637 | XQueryPointer (display->display, scrollBar.win, |
1650 | XQueryPointer (display->display, scrollBar.win, |
1638 | &unused_root, &unused_child, |
1651 | &unused_root, &unused_child, |
1639 | &unused_root_x, &unused_root_y, |
1652 | &unused_root_x, &unused_root_y, |
1640 | & (ev.xbutton.x), & (ev.xbutton.y), |
1653 | &ev.xbutton.x, &ev.xbutton.y, |
1641 | &unused_mask); |
1654 | &unused_mask); |
1642 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1655 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1643 | scrollbar_size ()); |
1656 | scrollbar_size ()); |
1644 | scr_refresh (refresh_type); |
1657 | scr_refresh (refresh_type); |
1645 | refresh_limit = 0; |
1658 | refresh_limit = 0; |
… | |
… | |
1700 | return; |
1713 | return; |
1701 | } |
1714 | } |
1702 | #endif |
1715 | #endif |
1703 | |
1716 | |
1704 | clickintime = ev.time - MEvent.time < MULTICLICK_TIME; |
1717 | clickintime = ev.time - MEvent.time < MULTICLICK_TIME; |
|
|
1718 | |
1705 | if (reportmode) |
1719 | if (reportmode) |
1706 | { |
1720 | { |
1707 | /* mouse report from vt window */ |
1721 | /* mouse report from vt window */ |
1708 | /* save the xbutton state (for ButtonRelease) */ |
1722 | /* save the xbutton state (for ButtonRelease) */ |
1709 | MEvent.state = ev.state; |
1723 | MEvent.state = ev.state; |
… | |
… | |
1738 | } |
1752 | } |
1739 | else |
1753 | else |
1740 | { |
1754 | { |
1741 | if (ev.button != MEvent.button) |
1755 | if (ev.button != MEvent.button) |
1742 | MEvent.clicks = 0; |
1756 | MEvent.clicks = 0; |
|
|
1757 | |
1743 | switch (ev.button) |
1758 | switch (ev.button) |
1744 | { |
1759 | { |
1745 | case Button1: |
1760 | case Button1: |
|
|
1761 | /* allow meta + click to select rectangular areas */ |
|
|
1762 | /* should be done in screen.C */ |
|
|
1763 | #if ENABLE_FRILLS |
|
|
1764 | selection.rect = !! (ev.state & ModMetaMask); |
|
|
1765 | #else |
|
|
1766 | selection.rect = false; |
|
|
1767 | #endif |
|
|
1768 | |
1746 | /* allow shift+left click to extend selection */ |
1769 | /* allow shift+left click to extend selection */ |
1747 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1770 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1748 | { |
1771 | { |
1749 | if (MEvent.button == Button1 && clickintime) |
1772 | if (MEvent.button == Button1 && clickintime) |
1750 | selection_rotate (ev.x, ev.y); |
1773 | selection_rotate (ev.x, ev.y); |
… | |
… | |
2515 | |
2538 | |
2516 | for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) |
2539 | for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) |
2517 | TermWin.parent[i] = None; |
2540 | TermWin.parent[i] = None; |
2518 | } |
2541 | } |
2519 | |
2542 | |
2520 | // this is experimental |
|
|
2521 | if (scrollBar.win) |
2543 | if (scrollBar.win) |
2522 | { |
2544 | { |
2523 | XSetWindowBackgroundPixmap (display->display, scrollBar.win, ParentRelative); |
2545 | XSetWindowBackgroundPixmap (display->display, scrollBar.win, ParentRelative); |
2524 | XClearWindow (display->display, scrollBar.win); |
|
|
2525 | scrollBar.setIdle (); |
2546 | scrollBar.setIdle (); |
2526 | scrollbar_show (0); |
2547 | scrollbar_show (0); |
2527 | } |
2548 | } |
2528 | |
2549 | |
2529 | return pchanged; |
2550 | return pchanged; |
… | |
… | |
2557 | seen_input = 1; |
2578 | seen_input = 1; |
2558 | // many badly-written programs (e.g. jed) contain a race condition: |
2579 | // many badly-written programs (e.g. jed) contain a race condition: |
2559 | // they first read the screensize and then install a SIGWINCH handler. |
2580 | // they first read the screensize and then install a SIGWINCH handler. |
2560 | // some window managers resize the window early, and these programs |
2581 | // some window managers resize the window early, and these programs |
2561 | // then sometimes get the size wrong. |
2582 | // then sometimes get the size wrong. |
|
|
2583 | // unfortunately other programs are even more buggy and dislike |
|
|
2584 | // being sent SIGWINCH, so only do it when we were in fact being |
|
|
2585 | // resized. |
|
|
2586 | if (seen_resize) |
2562 | kill (-cmd_pid, SIGWINCH); |
2587 | kill (-cmd_pid, SIGWINCH); |
2563 | } |
2588 | } |
2564 | |
2589 | |
2565 | /* Read a text string from the input buffer */ |
2590 | /* Read a text string from the input buffer */ |
2566 | unicode_t buf[UBUFSIZ]; |
2591 | unicode_t buf[UBUFSIZ]; |
2567 | bool refreshnow = false; |
2592 | bool refreshnow = false; |
… | |
… | |
3487 | * ends_how is terminator used. returned input must be free()'d |
3512 | * ends_how is terminator used. returned input must be free()'d |
3488 | */ |
3513 | */ |
3489 | unsigned char * |
3514 | unsigned char * |
3490 | rxvt_term::get_to_st (unicode_t &ends_how) |
3515 | rxvt_term::get_to_st (unicode_t &ends_how) |
3491 | { |
3516 | { |
3492 | unicode_t prev = 0, ch; |
3517 | unicode_t seen_esc = 0, ch; |
3493 | unsigned int n = 0; |
3518 | unsigned int n = 0; |
3494 | unsigned char *s; |
3519 | unsigned char *s; |
3495 | unsigned char string[STRING_MAX]; |
3520 | unsigned char string[STRING_MAX]; |
3496 | |
3521 | |
3497 | while ((ch = cmd_getc ()) != NOCHAR) |
3522 | while ((ch = cmd_getc ()) != NOCHAR) |
3498 | { |
3523 | { |
3499 | if (prev == C0_ESC) |
3524 | if (seen_esc) |
3500 | { |
3525 | { |
3501 | if (ch == 0x5c) /* 7bit ST */ |
3526 | if (ch == 0x5c) /* 7bit ST */ |
3502 | break; |
3527 | break; |
3503 | else |
3528 | else |
3504 | return NULL; |
3529 | return NULL; |
3505 | } |
3530 | } |
|
|
3531 | else if (ch == C0_ESC) |
|
|
3532 | { |
|
|
3533 | seen_esc = 1; |
|
|
3534 | continue; |
|
|
3535 | } |
3506 | else if (ch == C0_BEL || ch == CHAR_ST) |
3536 | else if (ch == C0_BEL || ch == CHAR_ST) |
3507 | break; |
3537 | break; |
3508 | else if (ch < 0x20) |
3538 | else if (ch < 0x20) |
3509 | return NULL; /* other control character - exit */ |
3539 | return NULL; /* other control character - exit */ |
|
|
3540 | |
|
|
3541 | seen_esc = 0; |
3510 | |
3542 | |
3511 | if (n >= sizeof (string) - 1) |
3543 | if (n >= sizeof (string) - 1) |
3512 | // stop at some sane length |
3544 | // stop at some sane length |
3513 | return NULL; |
3545 | return NULL; |
3514 | |
3546 | |
3515 | if (ch == C0_SYN) |
3547 | if (ch == C0_SYN) |
3516 | { |
|
|
3517 | string[n++] = cmd_get8 (); |
3548 | string[n++] = cmd_get8 (); |
3518 | prev = 0; |
|
|
3519 | } |
|
|
3520 | else |
3549 | else |
3521 | string[n++] = prev = ch; |
3550 | string[n++] = ch; |
3522 | } |
3551 | } |
3523 | |
3552 | |
3524 | string[n++] = '\0'; |
3553 | string[n++] = '\0'; |
3525 | |
3554 | |
3526 | if ((s = (unsigned char *)rxvt_malloc (n)) == NULL) |
3555 | if ((s = (unsigned char *)rxvt_malloc (n)) == NULL) |
… | |
… | |
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: |
… | |
… | |
3721 | break; |
3751 | break; |
3722 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3752 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
3723 | case XTerm_Color_BD: |
3753 | case XTerm_Color_BD: |
3724 | process_color_seq (XTerm_Color_BD, Color_BD, str, resp); |
3754 | process_color_seq (XTerm_Color_BD, Color_BD, str, resp); |
3725 | break; |
3755 | break; |
|
|
3756 | case XTerm_Color_IT: |
|
|
3757 | process_color_seq (XTerm_Color_IT, Color_IT, str, resp); |
|
|
3758 | break; |
3726 | case XTerm_Color_UL: |
3759 | case XTerm_Color_UL: |
3727 | process_color_seq (XTerm_Color_UL, Color_UL, str, resp); |
3760 | process_color_seq (XTerm_Color_UL, Color_UL, str, resp); |
3728 | break; |
3761 | break; |
3729 | case XTerm_Color_RV: |
3762 | case XTerm_Color_RV: |
3730 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
3763 | process_color_seq (XTerm_Color_RV, Color_RV, str, resp); |
|
|
3764 | break; |
|
|
3765 | #endif |
|
|
3766 | #if TRANSPARENT || TINTING |
|
|
3767 | case XTerm_Color_tint: |
|
|
3768 | process_color_seq (XTerm_Color_tint, Color_tint, str, resp); |
|
|
3769 | check_our_parents (); |
|
|
3770 | if (am_transparent) |
|
|
3771 | want_full_refresh = want_refresh = 1; |
3731 | break; |
3772 | break; |
3732 | #endif |
3773 | #endif |
3733 | |
3774 | |
3734 | case XTerm_Pixmap: |
3775 | case XTerm_Pixmap: |
3735 | if (*str != ';') |
3776 | if (*str != ';') |
… | |
… | |
3767 | case XTerm_logfile: |
3808 | case XTerm_logfile: |
3768 | // TODO, when secure mode? |
3809 | // TODO, when secure mode? |
3769 | break; |
3810 | break; |
3770 | |
3811 | |
3771 | case XTerm_font: |
3812 | case XTerm_font: |
|
|
3813 | op = URxvt_font; |
|
|
3814 | case URxvt_font: |
|
|
3815 | #if ENABLE_STYLES |
|
|
3816 | case URxvt_boldFont: |
|
|
3817 | case URxvt_italicFont: |
|
|
3818 | case URxvt_boldItalicFont: |
|
|
3819 | #endif |
3772 | if (query) |
3820 | if (query) |
3773 | tt_printf ("\33]%d;%-.250s%c", XTerm_font, |
3821 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3774 | (options & Opt_insecure) && TermWin.fontset->fontdesc |
3822 | (options & Opt_insecure) && TermWin.fontset[op - URxvt_font]->fontdesc |
3775 | ? TermWin.fontset->fontdesc : "", |
3823 | ? TermWin.fontset[op - URxvt_font]->fontdesc : "", |
3776 | resp); |
3824 | resp); |
3777 | else |
3825 | else |
|
|
3826 | { |
|
|
3827 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
|
|
3828 | |
|
|
3829 | res = strdup (str); |
|
|
3830 | allocated.push_back ((void *)res); |
3778 | change_font (str); |
3831 | set_fonts (); |
|
|
3832 | } |
3779 | break; |
3833 | break; |
3780 | |
3834 | |
3781 | #if ENABLE_FRILLS |
3835 | #if ENABLE_FRILLS |
3782 | case XTerm_locale: |
3836 | case XTerm_locale: |
3783 | if (query) |
3837 | if (query) |
… | |
… | |
3787 | set_locale (str); |
3841 | set_locale (str); |
3788 | # ifdef USE_XIM |
3842 | # ifdef USE_XIM |
3789 | im_cb (); |
3843 | im_cb (); |
3790 | # endif |
3844 | # endif |
3791 | } |
3845 | } |
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; |
3846 | break; |
3803 | #endif |
3847 | #endif |
3804 | |
3848 | |
3805 | #ifdef MENUBAR |
3849 | #ifdef MENUBAR |
3806 | case XTerm_Menu: |
3850 | case XTerm_Menu: |
… | |
… | |
3935 | |
3979 | |
3936 | /* extra handling for values with state unkept */ |
3980 | /* extra handling for values with state unkept */ |
3937 | switch (arg[i]) |
3981 | switch (arg[i]) |
3938 | { |
3982 | { |
3939 | case 1048: /* alternative cursor save */ |
3983 | case 1048: /* alternative cursor save */ |
|
|
3984 | case 1049: |
3940 | if (options & Opt_secondaryScreen) |
3985 | if (options & Opt_secondaryScreen) |
3941 | if (mode == 0) |
3986 | if (mode == 0) |
3942 | scr_cursor (RESTORE); |
3987 | scr_cursor (RESTORE); |
3943 | else if (mode == 1) |
3988 | else if (mode == 1) |
3944 | scr_cursor (SAVE); |
3989 | scr_cursor (SAVE); |
… | |
… | |
4069 | rendset = 0, rendstyle = ~RS_None; |
4114 | rendset = 0, rendstyle = ~RS_None; |
4070 | break; |
4115 | break; |
4071 | case 1: |
4116 | case 1: |
4072 | rendset = 1, rendstyle = RS_Bold; |
4117 | rendset = 1, rendstyle = RS_Bold; |
4073 | break; |
4118 | break; |
4074 | //case 2: // faint or second colour |
4119 | //case 2: // low intensity |
4075 | //case 3: // italic |
4120 | case 3: |
|
|
4121 | rendset = 1, rendstyle = RS_Italic; |
|
|
4122 | break; |
4076 | case 4: |
4123 | case 4: |
4077 | rendset = 1, rendstyle = RS_Uline; |
4124 | rendset = 1, rendstyle = RS_Uline; |
4078 | break; |
4125 | break; |
4079 | case 5: // slowly blinking |
4126 | case 5: // slowly blinking |
4080 | case 6: // rapidly blinking |
4127 | case 6: // rapidly blinking |
… | |
… | |
4092 | //case 11: // scoansi acs on, first alt font |
4139 | //case 11: // scoansi acs on, first alt font |
4093 | //case 12: // scoansi acs on, |0x80, second alt font |
4140 | //case 12: // scoansi acs on, |0x80, second alt font |
4094 | //... |
4141 | //... |
4095 | //case 19: // ninth alt font |
4142 | //case 19: // ninth alt font |
4096 | //case 20: // gothic |
4143 | //case 20: // gothic |
4097 | case 21: // disable bold, faint |
4144 | case 21: // disable bold, faint, sometimes doubly underlined (iso 8613) |
4098 | rendset = 0, rendstyle = RS_Bold; |
4145 | rendset = 0, rendstyle = RS_Bold; |
4099 | break; |
4146 | break; |
4100 | case 22: |
4147 | case 22: // normal intensity |
4101 | rendset = 0, rendstyle = RS_Bold; |
4148 | rendset = 0, rendstyle = RS_Bold; |
4102 | break; |
4149 | break; |
4103 | //case 23: disable italic |
4150 | case 23: // disable italic |
|
|
4151 | rendset = 0, rendstyle = RS_Italic; |
|
|
4152 | break; |
4104 | case 24: |
4153 | case 24: |
4105 | rendset = 0, rendstyle = RS_Uline; |
4154 | rendset = 0, rendstyle = RS_Uline; |
4106 | break; |
4155 | break; |
4107 | case 25: |
4156 | case 25: |
4108 | rendset = 0, rendstyle = RS_Blink; |
4157 | rendset = 0, rendstyle = RS_Blink; |
4109 | break; |
4158 | break; |
4110 | case 26: |
4159 | case 26: // variable spacing (iso 8613) |
4111 | rendset = 0, rendstyle = RS_Blink; |
4160 | rendset = 0, rendstyle = RS_Blink; |
4112 | break; |
4161 | break; |
4113 | case 27: |
4162 | case 27: |
4114 | rendset = 0, rendstyle = RS_RVid; |
4163 | rendset = 0, rendstyle = RS_RVid; |
4115 | break; |
4164 | break; |
… | |
… | |
4133 | case 35: |
4182 | case 35: |
4134 | case 36: |
4183 | case 36: |
4135 | case 37: |
4184 | case 37: |
4136 | scr_color ((unsigned int) (minCOLOR + (arg[i] - 30)), Color_fg); |
4185 | scr_color ((unsigned int) (minCOLOR + (arg[i] - 30)), Color_fg); |
4137 | break; |
4186 | break; |
4138 | #ifdef TTY_256COLOR |
4187 | case 38: // set fg color, ISO 8613-6 |
4139 | case 38: |
|
|
4140 | if (nargs > i + 2 && arg[i + 1] == 5) |
4188 | if (nargs > i + 2 && arg[i + 1] == 5) |
4141 | { |
4189 | { |
4142 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg); |
4190 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg); |
4143 | i += 2; |
4191 | i += 2; |
4144 | } |
4192 | } |
4145 | break; |
4193 | break; |
4146 | #endif |
|
|
4147 | case 39: /* default fg */ |
4194 | case 39: /* default fg */ |
4148 | scr_color (Color_fg, Color_fg); |
4195 | scr_color (Color_fg, Color_fg); |
4149 | break; |
4196 | break; |
4150 | |
4197 | |
4151 | case 40: |
4198 | case 40: |
… | |
… | |
4156 | case 45: |
4203 | case 45: |
4157 | case 46: |
4204 | case 46: |
4158 | case 47: |
4205 | case 47: |
4159 | scr_color ((unsigned int) (minCOLOR + (arg[i] - 40)), Color_bg); |
4206 | scr_color ((unsigned int) (minCOLOR + (arg[i] - 40)), Color_bg); |
4160 | break; |
4207 | break; |
4161 | #ifdef TTY_256COLOR |
4208 | case 48: // set bg color, ISO 8613-6 |
4162 | case 48: |
|
|
4163 | if (nargs > i + 2 && arg[i + 1] == 5) |
4209 | if (nargs > i + 2 && arg[i + 1] == 5) |
4164 | { |
4210 | { |
4165 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg); |
4211 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg); |
4166 | i += 2; |
4212 | i += 2; |
4167 | } |
4213 | } |
4168 | break; |
4214 | break; |
4169 | #endif |
|
|
4170 | case 49: /* default bg */ |
4215 | case 49: /* default bg */ |
4171 | scr_color (Color_bg, Color_bg); |
4216 | scr_color (Color_bg, Color_bg); |
4172 | break; |
4217 | break; |
|
|
4218 | |
|
|
4219 | //case 50: // not variable spacing |
4173 | |
4220 | |
4174 | #ifndef NO_BRIGHTCOLOR |
4221 | #ifndef NO_BRIGHTCOLOR |
4175 | case 90: |
4222 | case 90: |
4176 | case 91: /* set bright fg color */ |
4223 | case 91: /* set bright fg color */ |
4177 | case 92: |
4224 | case 92: |
4178 | case 93: |
4225 | case 93: |
4179 | case 94: |
4226 | case 94: |
4180 | case 95: |
4227 | case 95: |
4181 | case 96: |
4228 | case 96: |
4182 | case 97: |
4229 | case 97: |
4183 | scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 90)), |
4230 | scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 90)), Color_fg); |
4184 | Color_fg); |
|
|
4185 | break; |
4231 | break; |
4186 | case 100: |
4232 | case 100: |
4187 | case 101: /* set bright bg color */ |
4233 | case 101: /* set bright bg color */ |
4188 | case 102: |
4234 | case 102: |
4189 | case 103: |
4235 | case 103: |
4190 | case 104: |
4236 | case 104: |
4191 | case 105: |
4237 | case 105: |
4192 | case 106: |
4238 | case 106: |
4193 | case 107: |
4239 | case 107: |
4194 | scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), |
4240 | scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); |
4195 | Color_bg); |
|
|
4196 | break; |
4241 | break; |
4197 | #endif |
4242 | #endif |
4198 | |
4243 | |
4199 | } |
4244 | } |
4200 | } |
4245 | } |
… | |
… | |
4242 | * or generated by us in response to a query ESC sequence. |
4287 | * or generated by us in response to a query ESC sequence. |
4243 | */ |
4288 | */ |
4244 | void |
4289 | void |
4245 | rxvt_term::tt_write (const unsigned char *data, unsigned int len) |
4290 | rxvt_term::tt_write (const unsigned char *data, unsigned int len) |
4246 | { |
4291 | { |
4247 | enum { MAX_PTY_WRITE = 255 }; // minimum MAX_INPUT |
4292 | const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4248 | |
4293 | |
4249 | if (len) |
4294 | if (len) |
4250 | { |
4295 | { |
4251 | if (v_buflen == 0) |
4296 | if (v_buflen == 0) |
4252 | { |
4297 | { |
… | |
… | |
4266 | v_buflen += len; |
4311 | v_buflen += len; |
4267 | } |
4312 | } |
4268 | |
4313 | |
4269 | for (;;) |
4314 | for (;;) |
4270 | { |
4315 | { |
4271 | int written = write (pty.pty, v_buffer, min (MAX_PTY_WRITE, v_buflen)); |
4316 | int written = write (pty.pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4272 | |
4317 | |
4273 | if (written > 0) |
4318 | if (written > 0) |
4274 | { |
4319 | { |
4275 | v_buflen -= written; |
4320 | v_buflen -= written; |
4276 | |
4321 | |