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.521 by sf-exg, Sun Jun 10 16:00:26 2012 UTC vs.
Revision 1.544 by sf-exg, Sat Apr 26 14:55:58 2014 UTC

4 * 4 *
5 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> 6 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
7 * - original version 7 * - original version
8 * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> 8 * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com>
9 * - extensive modifications 9 * - extensive modifications
10 * Copyright (c) 1995 Garrett D'Amore <garrett@netcom.com> 10 * Copyright (c) 1995 Garrett D'Amore <garrett@netcom.com>
11 * - vt100 printing 11 * - vt100 printing
12 * Copyright (c) 1995 Steven Hirsch <hirsch@emba.uvm.edu> 12 * Copyright (c) 1995 Steven Hirsch <hirsch@emba.uvm.edu>
13 * - X11 mouse report mode and support for 13 * - X11 mouse report mode and support for
14 * DEC "private mode" save/restore functions. 14 * DEC "private mode" save/restore functions.
20 * Copyright (c) 1997 Raul Garcia Garcia <rgg@tid.es> 20 * Copyright (c) 1997 Raul Garcia Garcia <rgg@tid.es>
21 * - modification and cleanups for Solaris 2.x 21 * - modification and cleanups for Solaris 2.x
22 * and Linux 1.2.x 22 * and Linux 1.2.x
23 * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> 23 * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de>
24 * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> 24 * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com>
25 * - extensive modifications 25 * - extensive modifications
26 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> 26 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org>
27 * Copyright (c) 2001 Marius Gedminas 27 * Copyright (c) 2001 Marius Gedminas
28 * - Ctrl/Mod4+Tab works like Meta+Tab (options) 28 * - Ctrl/Mod4+Tab works like Meta+Tab (options)
29 * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> 29 * Copyright (c) 2003 Rob McMullen <robm@flipturn.org>
30 * Copyright (c) 2003-2011 Marc Lehmann <schmorp@schmorp.de> 30 * Copyright (c) 2003-2014 Marc Lehmann <schmorp@schmorp.de>
31 * Copyright (c) 2007 Emanuele Giaquinta <e.giaquinta@glauco.it> 31 * Copyright (c) 2007 Emanuele Giaquinta <e.giaquinta@glauco.it>
32 * 32 *
33 * This program is free software; you can redistribute it and/or modify 33 * This program is free software; you can redistribute it and/or modify
34 * it under the terms of the GNU General Public License as published by 34 * it under the terms of the GNU General Public License as published by
35 * the Free Software Foundation; either version 2 of the License, or 35 * the Free Software Foundation; either version 2 of the License, or
400 break; 400 break;
401 } 401 }
402 return param; 402 return param;
403} 403}
404 404
405static inline wchar_t *
406rxvt_wcsdup (const wchar_t *str, int len)
407{
408 wchar_t *r = (wchar_t *)rxvt_malloc ((len + 1) * sizeof (wchar_t));
409 memcpy (r, str, len * sizeof (wchar_t));
410 r[len] = 0;
411 return r;
412}
413
405void ecb_cold 414void ecb_cold
406rxvt_term::key_press (XKeyEvent &ev) 415rxvt_term::key_press (XKeyEvent &ev)
407{ 416{
408 int ctrl, meta, shft, len; 417 int ctrl, meta, shft, len;
409 KeySym keysym; 418 KeySym keysym;
410 int valid_keysym; 419 int valid_keysym;
411 char kbuf[KBUFSZ]; 420 char rkbuf[KBUFSZ];
421 char *kbuf = rkbuf + 1;
412 422
413#if ISO_14755 423#if ISO_14755
414 if (iso14755buf & ISO_14755_52) 424 if (iso14755buf & ISO_14755_52)
415 return; 425 return;
416#endif 426#endif
510#endif 520#endif
511 max_it (lnsppg, 1); 521 max_it (lnsppg, 1);
512 522
513 if (keysym == XK_Prior) 523 if (keysym == XK_Prior)
514 { 524 {
515 scr_page (UP, lnsppg); 525 scr_page (lnsppg);
516 return; 526 return;
517 } 527 }
518 else if (keysym == XK_Next) 528 else if (keysym == XK_Next)
519 { 529 {
520 scr_page (DN, lnsppg); 530 scr_page (-lnsppg);
521 return; 531 return;
522 } 532 }
523 } 533 }
524#ifdef SCROLL_ON_UPDOWN_KEYS 534#ifdef SCROLL_ON_UPDOWN_KEYS
525 if (IS_SCROLL_MOD) 535 if (IS_SCROLL_MOD)
526 { 536 {
527 if (keysym == XK_Up) 537 if (keysym == XK_Up)
528 { 538 {
529 scr_page (UP, 1); 539 scr_page (1);
530 return; 540 return;
531 } 541 }
532 else if (keysym == XK_Down) 542 else if (keysym == XK_Down)
533 { 543 {
534 scr_page (DN, 1); 544 scr_page (-1);
535 return; 545 return;
536 } 546 }
537 } 547 }
538#endif 548#endif
539#ifdef SCROLL_ON_HOMEEND_KEYS 549#ifdef SCROLL_ON_HOMEEND_KEYS
540 if (IS_SCROLL_MOD) 550 if (IS_SCROLL_MOD)
541 { 551 {
542 if (keysym == XK_Home) 552 if (keysym == XK_Home)
543 { 553 {
544 scr_move_to (0, 1); 554 scr_changeview (top_row);
545 return; 555 return;
546 } 556 }
547 else if (keysym == XK_End) 557 else if (keysym == XK_End)
548 { 558 {
549 scr_move_to (1, 1); 559 scr_changeview (0);
550 return; 560 return;
551 } 561 }
552 } 562 }
553#endif 563#endif
554 } 564 }
576 case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */ 586 case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */
577 return; 587 return;
578#endif 588#endif
579 } 589 }
580 } 590 }
591 }
592
593 if (ctrl && meta && (keysym == XK_c || keysym == XK_v))
594 {
595 if (keysym == XK_v)
596 selection_request (ev.time, Sel_Clipboard);
597 else if (selection.len > 0)
598 {
599 free (selection.clip_text);
600 selection.clip_text = rxvt_wcsdup (selection.text, selection.len);
601 selection.clip_len = selection.len;
602 selection_grab (CurrentTime, true);
603 }
604
605 return;
581 } 606 }
582 607
583#if ENABLE_FRILLS || ISO_14755 608#if ENABLE_FRILLS || ISO_14755
584 // ISO 14755 support 609 // ISO 14755 support
585 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_51)) 610 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_51))
832#endif 857#endif
833 /* nil */ ; 858 /* nil */ ;
834 } 859 }
835 } 860 }
836 861
862 /* escape prefix */
863 if (len && meta
864#ifdef META8_OPTION
865 && meta_char == C0_ESC
866#endif
867 )
868 {
869 *--kbuf = C0_ESC;
870 len++;
871 }
872
837 if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, DT_STR_LEN, kbuf, len, DT_END))) 873 if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, DT_STR_LEN, kbuf, len, DT_END)))
838 return; 874 return;
839 875
840 if (len <= 0) 876 if (len <= 0)
841 return; /* not mapped */ 877 return; /* not mapped */
844 if (view_start) 880 if (view_start)
845 { 881 {
846 view_start = 0; 882 view_start = 0;
847 want_refresh = 1; 883 want_refresh = 1;
848 } 884 }
849
850 /* escape prefix */
851 if (meta
852#ifdef META8_OPTION
853 && meta_char == C0_ESC
854#endif
855 )
856 {
857 const char ch = C0_ESC;
858 tt_write (&ch, 1);
859 }
860 885
861 tt_write (kbuf, (unsigned int)len); 886 tt_write (kbuf, (unsigned int)len);
862} 887}
863 888
864void ecb_cold 889void ecb_cold
941void 966void
942rxvt_term::flush () 967rxvt_term::flush ()
943{ 968{
944 flush_ev.stop (); 969 flush_ev.stop ();
945 970
946#ifdef HAVE_BG_PIXMAP 971#ifdef HAVE_IMG
947 if (bg_flags & BG_NEEDS_REFRESH) 972 if (bg_flags & BG_NEEDS_REFRESH)
948 { 973 {
949 bg_flags &= ~BG_NEEDS_REFRESH; 974 bg_flags &= ~BG_NEEDS_REFRESH;
950 scr_touch (false); 975 scr_touch (false);
951 } 976 }
1077 1102
1078#ifdef SELECTION_SCROLLING 1103#ifdef SELECTION_SCROLLING
1079void 1104void
1080rxvt_term::sel_scroll_cb (ev::timer &w, int revents) 1105rxvt_term::sel_scroll_cb (ev::timer &w, int revents)
1081{ 1106{
1082 if (scr_page (scroll_selection_dir, scroll_selection_lines)) 1107 if (scr_page (scroll_selection_lines))
1083 { 1108 {
1084 selection_extend (selection_save_x, selection_save_y, selection_save_state); 1109 selection_extend (selection_save_x, selection_save_y, selection_save_state);
1085 want_refresh = 1; 1110 want_refresh = 1;
1086 refresh_check (); 1111 refresh_check ();
1087 } 1112 }
1092 1117
1093#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1118#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
1094void 1119void
1095rxvt_term::slip_wheel_cb (ev::timer &w, int revents) 1120rxvt_term::slip_wheel_cb (ev::timer &w, int revents)
1096{ 1121{
1097 if (scr_changeview (view_start - mouse_slip_wheel_speed)) 1122 if (scr_page (mouse_slip_wheel_speed))
1098 { 1123 {
1099 want_refresh = 1; 1124 want_refresh = 1;
1100 refresh_check (); 1125 refresh_check ();
1101 } 1126 }
1102 1127
1467 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) 1492 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev))
1468 ; 1493 ;
1469 1494
1470 bool want_position_change = SHOULD_INVOKE (HOOK_POSITION_CHANGE); 1495 bool want_position_change = SHOULD_INVOKE (HOOK_POSITION_CHANGE);
1471 1496
1497 bool moved = false;
1472#ifdef HAVE_BG_PIXMAP 1498#ifdef HAVE_BG_PIXMAP
1473 if (bg_window_position_sensitive ()) 1499 if (bg_window_position_sensitive ())
1500 {
1474 want_position_change = true; 1501 want_position_change = true;
1502 if (bg_img == 0)
1503 moved = true;
1504 }
1475#endif 1505#endif
1476
1477 bool moved = false;
1478 1506
1479 if (want_position_change) 1507 if (want_position_change)
1480 { 1508 {
1481 int x, y; 1509 int x, y;
1482 1510
1493 parent_x = x; 1521 parent_x = x;
1494 parent_y = y; 1522 parent_y = y;
1495 HOOK_INVOKE ((this, HOOK_POSITION_CHANGE, DT_INT, x, DT_INT, y, DT_END)); 1523 HOOK_INVOKE ((this, HOOK_POSITION_CHANGE, DT_INT, x, DT_INT, y, DT_END));
1496 moved = true; 1524 moved = true;
1497 } 1525 }
1498
1499 if (!(bg_flags & BG_IS_VALID))
1500 moved = true;
1501 } 1526 }
1502 1527
1503 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) 1528 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height)
1504 { 1529 {
1505 seen_resize = 1; 1530 seen_resize = 1;
1529 selection_send (ev.xselectionrequest); 1554 selection_send (ev.xselectionrequest);
1530 break; 1555 break;
1531 1556
1532 case MapNotify: 1557 case MapNotify:
1533#ifdef HAVE_BG_PIXMAP 1558#ifdef HAVE_BG_PIXMAP
1534 /* This is needed specifically to fix the case of no window manager or a 1559 // This is needed at startup for the case of no window manager
1535 * non-reparenting window manager. In those cases we never get first 1560 // or a non-reparenting window manager and also because we
1536 * ConfigureNotify. Also that speeds startup under normal WM, by taking 1561 // defer bg image updates if the window is not mapped. The
1537 * care of multiplicity of ConfigureNotify events arriving while WM does 1562 // short delay is to optimize for multiple ConfigureNotify
1538 * reparenting. 1563 // events at startup when the window manager reparents the
1539 * We should not render background immediately, as there could be several 1564 // window, so as to perform the computation after we have
1540 * ConfigureNotify's to follow. Lets take care of all of them in one scoop 1565 // received all of them.
1541 * by scheduling background redraw as soon as we can, but giving a short 1566 if (bg_img == 0)
1542 * bit of time for ConfigureNotifies to arrive.
1543 * We should render background PRIOR to drawing any text, but AFTER all
1544 * of ConfigureNotifys for the best results.
1545 */
1546 if (!(bg_flags & BG_IS_VALID))
1547 update_background_ev.start (0.025); 1567 update_background_ev.start (0.025);
1548#endif 1568#endif
1549 mapped = 1; 1569 mapped = 1;
1550#ifdef TEXT_BLINK 1570#ifdef TEXT_BLINK
1551 text_blink_ev.start (); 1571 text_blink_ev.start ();
1643 1663
1644#ifdef SELECTION_SCROLLING 1664#ifdef SELECTION_SCROLLING
1645 if (ev.xbutton.y < int_bwidth 1665 if (ev.xbutton.y < int_bwidth
1646 || Pixel2Row (ev.xbutton.y) > (nrow-1)) 1666 || Pixel2Row (ev.xbutton.y) > (nrow-1))
1647 { 1667 {
1668 page_dirn scroll_selection_dir;
1648 int dist; 1669 int dist;
1649 1670
1650 /* don't clobber the current delay if we are 1671 /* don't clobber the current delay if we are
1651 * already in the middle of scrolling. 1672 * already in the middle of scrolling.
1652 */ 1673 */
1675 scroll_selection_lines = Pixel2Height (dist) 1696 scroll_selection_lines = Pixel2Height (dist)
1676 / SELECTION_SCROLL_LINE_SPEEDUP 1697 / SELECTION_SCROLL_LINE_SPEEDUP
1677 + 1; 1698 + 1;
1678 min_it (scroll_selection_lines, 1699 min_it (scroll_selection_lines,
1679 SELECTION_SCROLL_MAX_LINES); 1700 SELECTION_SCROLL_MAX_LINES);
1701 scroll_selection_lines *= scroll_selection_dir;
1680 } 1702 }
1681 else 1703 else
1682 { 1704 {
1683 /* we are within the text window, so we 1705 /* we are within the text window, so we
1684 * shouldn't be scrolling 1706 * shouldn't be scrolling
1838 pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); 1860 pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c);
1839 } 1861 }
1840#endif 1862#endif
1841} 1863}
1842 1864
1843#if ENABLE_TRANSPARENCY || ENABLE_PERL 1865#if BG_IMAGE_FROM_ROOT || ENABLE_PERL
1844void ecb_hot 1866void ecb_hot
1845rxvt_term::rootwin_cb (XEvent &ev) 1867rxvt_term::rootwin_cb (XEvent &ev)
1846{ 1868{
1847 make_current (); 1869 make_current ();
1848 1870
1858 * use the property to determine the pixmap. We use it later on. 1880 * use the property to determine the pixmap. We use it later on.
1859 */ 1881 */
1860 if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] 1882 if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID]
1861 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) 1883 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
1862 { 1884 {
1863# if ENABLE_TRANSPARENCY 1885#if BG_IMAGE_FROM_ROOT
1864 bg_set_root_pixmap (); 1886 if (option (Opt_transparent))
1887 {
1888 rxvt_img::new_from_root (this)->replace (root_img);
1865 update_background (); 1889 update_background ();
1890 }
1866#endif 1891#endif
1867#if ENABLE_PERL
1868 HOOK_INVOKE ((this, HOOK_ROOTPMAP_CHANGE, DT_END)); 1892 HOOK_INVOKE ((this, HOOK_ROOTPMAP_CHANGE, DT_END));
1869#endif
1870 } 1893 }
1871 1894
1872 break; 1895 break;
1873 } 1896 }
1874 1897
2199 2222
2200#ifdef MOUSE_WHEEL 2223#ifdef MOUSE_WHEEL
2201 case Button4: 2224 case Button4:
2202 case Button5: 2225 case Button5:
2203 { 2226 {
2204 int i; 2227 int lines;
2205 page_dirn v; 2228 page_dirn dirn;
2206 2229
2207 v = ev.button == Button4 ? UP : DN; 2230 dirn = ev.button == Button4 ? UP : DN;
2208 2231
2209 if (ev.state & ShiftMask) 2232 if (ev.state & ShiftMask)
2210 i = 1; 2233 lines = 1;
2211 else if (option (Opt_mouseWheelScrollPage)) 2234 else if (option (Opt_mouseWheelScrollPage))
2212 i = nrow - 1; 2235 lines = nrow - 1;
2213 else 2236 else
2214 i = 5; 2237 lines = 5;
2215 2238
2216# ifdef MOUSE_SLIP_WHEELING 2239# ifdef MOUSE_SLIP_WHEELING
2217 if (ev.state & ControlMask) 2240 if (ev.state & ControlMask)
2218 { 2241 {
2219 mouse_slip_wheel_speed += v ? -1 : 1; 2242 mouse_slip_wheel_speed += dirn;
2220 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; 2243 clamp_it (mouse_slip_wheel_speed, -nrow, nrow);
2221 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2222 2244
2223 if (!slip_wheel_ev.is_active ()) 2245 if (!slip_wheel_ev.is_active ())
2224 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 2246 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2225 } 2247 }
2226 else 2248 else
2227# endif 2249# endif
2228 { 2250 {
2229 scr_page (v, i); 2251 scr_page (dirn, lines);
2230 scrollBar.show (1); 2252 scrollBar.show (1);
2231 } 2253 }
2232 } 2254 }
2233 break; 2255 break;
2234#endif 2256#endif
2387 } 2409 }
2388 2410
2389 if (len == (size_t)-1) 2411 if (len == (size_t)-1)
2390 { 2412 {
2391 mbstate.reset (); // reset now undefined conversion state 2413 mbstate.reset (); // reset now undefined conversion state
2414 // a -1 might indicate that a previous incomplete char is invalid (previous return -2)
2415 // in which case we "erroneously" return the next byte which might be valid.
2392 return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through 2416 return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through
2393 } 2417 }
2394 2418
2395 // assume wchar == unicode 2419 // assume wchar == unicode
2396 cmdbuf_ptr += len; 2420 cmdbuf_ptr += len;
2801 }; 2825 };
2802 2826
2803void ecb_hot 2827void ecb_hot
2804rxvt_term::process_csi_seq () 2828rxvt_term::process_csi_seq ()
2805{ 2829{
2806 unicode_t ch, priv, i; 2830 unicode_t ch, priv, prev_ch, i;
2807 unsigned int nargs, p; 2831 unsigned int nargs, p;
2808 int n, ndef; 2832 int n, ndef;
2809 int arg[ESC_ARGS] = { }; 2833 int arg[ESC_ARGS] = { };
2810 2834
2811 nargs = 0; 2835 nargs = 0;
2817 /* '<' '=' '>' '?' '!' */ 2841 /* '<' '=' '>' '?' '!' */
2818 priv = ch; 2842 priv = ch;
2819 ch = cmd_getc (); 2843 ch = cmd_getc ();
2820 } 2844 }
2821 2845
2846 prev_ch = 0;
2822 /* read any numerical arguments */ 2847 /* read any numerical arguments */
2823 for (n = -1; ch < CSI_ICH; ) 2848 for (n = -1; ch < CSI_ICH; )
2824 { 2849 {
2825 if (isdigit (ch)) 2850 if (isdigit (ch))
2826 { 2851 {
2836 n = -1; 2861 n = -1;
2837 } 2862 }
2838 else if (IS_CONTROL (ch)) 2863 else if (IS_CONTROL (ch))
2839 process_nonprinting (ch); 2864 process_nonprinting (ch);
2840 2865
2866 prev_ch = ch;
2841 ch = cmd_getc (); 2867 ch = cmd_getc ();
2842 } 2868 }
2843 2869
2844 if (ch > CSI_7F) 2870 if (ch > CSI_7F)
2845 return; 2871 return;
3079 scr_insert_mode (1); 3105 scr_insert_mode (1);
3080 else if (arg[0] == 20) 3106 else if (arg[0] == 20)
3081 priv_modes |= PrivMode_LFNL; 3107 priv_modes |= PrivMode_LFNL;
3082 break; 3108 break;
3083 3109
3110 case CSI_71: // DESCUSR: set cursor style
3111 if (prev_ch == ' ')
3112 set_cursor_style (arg[0]);
3113 break;
3114
3084 /* 3115 /*
3085 * PRIVATE USE beyond this point. All CSI_7? sequences here 3116 * PRIVATE USE beyond this point. All CSI_7? sequences here
3086 */ 3117 */
3087 case CSI_72: /* DECSTBM: set top and bottom margins */ 3118 case CSI_72: /* DECSTBM: set top and bottom margins */
3088 if (nargs == 1) 3119 if (nargs == 1)
3221rxvt_term::get_to_st (unicode_t &ends_how) 3252rxvt_term::get_to_st (unicode_t &ends_how)
3222{ 3253{
3223 unicode_t ch; 3254 unicode_t ch;
3224 bool seen_esc = false; 3255 bool seen_esc = false;
3225 unsigned int n = 0; 3256 unsigned int n = 0;
3226 wchar_t string[STRING_MAX]; 3257 wchar_t string[CBUFSIZ];
3227 3258
3228 while ((ch = cmd_getc ()) != NOCHAR) 3259 while ((ch = cmd_getc ()) != NOCHAR)
3229 { 3260 {
3230 if (seen_esc) 3261 if (seen_esc)
3231 { 3262 {
3246 else if (ch < 0x20) 3277 else if (ch < 0x20)
3247 return NULL; /* other control character - exit */ 3278 return NULL; /* other control character - exit */
3248 3279
3249 seen_esc = false; 3280 seen_esc = false;
3250 3281
3251 if (n >= STRING_MAX - 1) 3282 if (n >= sizeof (string) - 1)
3252 // stop at some sane length 3283 // stop at some sane length
3253 return NULL; 3284 return NULL;
3254 3285
3255 string[n++] = ch; 3286 string[n++] = ch;
3256 } 3287 }
3373 &nitems, &bytes_after, &value) == Success 3404 &nitems, &bytes_after, &value) == Success
3374 && actual_type != None 3405 && actual_type != None
3375 && actual_format == 8) 3406 && actual_format == 8)
3376 str = (const char *)(value); 3407 str = (const char *)(value);
3377 3408
3378 tt_printf ("\033]%d;%s%c", op, str, resp); 3409 tt_printf ("\033]%d;%s%c", op, option (Opt_insecure) ? str : "", resp);
3379 3410
3380 XFree (value); 3411 XFree (value);
3381 } 3412 }
3382 else 3413 else
3383 { 3414 {
3451 break; 3482 break;
3452#endif 3483#endif
3453 case URxvt_Color_border: 3484 case URxvt_Color_border:
3454 process_color_seq (op, Color_border, str, resp); 3485 process_color_seq (op, Color_border, str, resp);
3455 break; 3486 break;
3456#if ENABLE_TRANSPARENCY 3487
3488#if BG_IMAGE_FROM_ROOT
3457 case URxvt_Color_tint: 3489 case URxvt_Color_tint:
3458 process_color_seq (op, Color_tint, str, resp); 3490 process_color_seq (op, Color_tint, str, resp);
3459 { 3491 {
3460 bool changed = false; 3492 bool changed = false;
3461 3493
3488 { 3520 {
3489 bool changed = false; 3521 bool changed = false;
3490 3522
3491 if (*str != ';') 3523 if (*str != ';')
3492 { 3524 {
3525 try
3526 {
3493 if (fimage.set_file_geometry (this, str)) 3527 fimage.set_file_geometry (this, str);
3494 changed = true; 3528 changed = true;
3529 }
3530 catch (const class rxvt_failure_exception &e)
3531 {
3532 }
3495 } 3533 }
3496 else 3534 else
3497 { 3535 {
3498 str++; 3536 str++;
3499 if (fimage.set_geometry (str, true)) 3537 if (fimage.set_geometry (str, true))
3986 break; 4024 break;
3987#endif 4025#endif
3988 } 4026 }
3989 } 4027 }
3990} 4028}
4029
4030void
4031rxvt_term::set_cursor_style (int style)
4032{
4033 if (!IN_RANGE_INC (style, 0, 4))
4034 return;
4035
4036 set_option (Opt_cursorUnderline, style >= 3);
4037
4038#ifdef CURSOR_BLINK
4039 set_option (Opt_cursorBlink, !style || (style & 1));
4040 cursor_blink_reset ();
4041#endif
4042
4043 want_refresh = 1;
4044}
3991/*}}} */ 4045/*}}} */
3992 4046
3993/* ------------------------------------------------------------------------- */ 4047/* ------------------------------------------------------------------------- */
3994 4048
3995/* 4049/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines