ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.145 by root, Mon Aug 16 12:04:57 2004 UTC vs.
Revision 1.171 by root, Wed Dec 1 02:12:18 2004 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines