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.552 by sf-exg, Fri Jul 25 17:03:38 2014 UTC vs.
Revision 1.569 by sf-exg, Sat May 14 08:31:26 2016 UTC

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-2014 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,2015 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 3 of the License, or 35 * the Free Software Foundation; either version 3 of the License, or
36 * (at your option) any later version. 36 * (at your option) any later version.
210 210
211 max_it (width, strlen (attr)); 211 max_it (width, strlen (attr));
212 212
213 if (y >= 0) 213 if (y >= 0)
214 { 214 {
215 y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1; 215 y = (y >= nrow - len - 5 && x < width + 2) ? 0 : -1;
216 x = 0; 216 x = 0;
217 } 217 }
218 218
219 scr_overlay_new (x, y, width, len * 2 + 2); 219 scr_overlay_new (x, y, width, len * 2 + 2);
220 220
315 XK_KP_7, // XK_KP_Home 315 XK_KP_7, // XK_KP_Home
316 XK_KP_4, // XK_KP_Left 316 XK_KP_4, // XK_KP_Left
317 XK_KP_8, // XK_KP_Up 317 XK_KP_8, // XK_KP_Up
318 XK_KP_6, // XK_KP_Right 318 XK_KP_6, // XK_KP_Right
319 XK_KP_2, // XK_KP_Down 319 XK_KP_2, // XK_KP_Down
320# ifndef UNSHIFTED_SCROLLKEYS
321 XK_KP_9, // XK_KP_Prior 320 XK_KP_9, // XK_KP_Prior
322 XK_KP_3, // XK_KP_Next 321 XK_KP_3, // XK_KP_Next
323# else
324 XK_Prior,
325 XK_Next,
326# endif
327 XK_KP_1, // XK_KP_End 322 XK_KP_1, // XK_KP_End
328 XK_KP_5, // XK_KP_Begin 323 XK_KP_5, // XK_KP_Begin
329 }; 324 };
330 325
331 if (IN_RANGE_INC (keysym, XK_KP_Home, XK_KP_Begin)) 326 if (IN_RANGE_INC (keysym, XK_KP_Home, XK_KP_Begin))
376 param = 3; 371 param = 3;
377 break; 372 break;
378 case XK_Select: 373 case XK_Select:
379 param = 4; 374 param = 4;
380 break; 375 break;
381#ifndef UNSHIFTED_SCROLLKEYS
382 case XK_Prior: 376 case XK_Prior:
383 param = 5; 377 param = 5;
384 break; 378 break;
385 case XK_Next: 379 case XK_Next:
386 param = 6; 380 param = 6;
389 param = 7; 383 param = 7;
390 break; 384 break;
391 case XK_End: 385 case XK_End:
392 param = 8; 386 param = 8;
393 break; 387 break;
394#endif
395 case XK_Help: 388 case XK_Help:
396 param = 28; 389 param = 28;
397 break; 390 break;
398 case XK_Menu: 391 case XK_Menu:
399 param = 29; 392 param = 29;
683 { 676 {
684 char *ch; 677 char *ch;
685 678
686 for (ch = kbuf; ch < kbuf + len; ch++) 679 for (ch = kbuf; ch < kbuf + len; ch++)
687 *ch |= 0x80; 680 *ch |= 0x80;
688
689 meta = 0;
690 } 681 }
691#endif 682#endif
692 /* nil */ ; 683 /* nil */ ;
693 } 684 }
694 685
1043 1034
1044#ifdef CURSOR_BLINK 1035#ifdef CURSOR_BLINK
1045void 1036void
1046rxvt_term::cursor_blink_reset () 1037rxvt_term::cursor_blink_reset ()
1047{ 1038{
1039 if (!focus)
1040 return;
1041
1048 if (hidden_cursor) 1042 if (hidden_cursor)
1049 { 1043 {
1050 hidden_cursor = 0; 1044 hidden_cursor = 0;
1051 want_refresh = 1; 1045 want_refresh = 1;
1052 } 1046 }
1053 1047
1054 if (option (Opt_cursorBlink)) 1048 if (option (Opt_cursorBlink) || (priv_modes & PrivMode_BlinkingCursor))
1055 cursor_blink_ev.again (); 1049 cursor_blink_ev.again ();
1056 else 1050 else
1057 cursor_blink_ev.stop (); 1051 cursor_blink_ev.stop ();
1058} 1052}
1059 1053
1248 1242
1249void ecb_cold 1243void ecb_cold
1250rxvt_term::pointer_unblank () 1244rxvt_term::pointer_unblank ()
1251{ 1245{
1252 XDefineCursor (dpy, vt, TermWin_cursor); 1246 XDefineCursor (dpy, vt, TermWin_cursor);
1253 recolour_cursor (); 1247 recolor_cursor ();
1254 1248
1255#ifdef POINTER_BLANK 1249#ifdef POINTER_BLANK
1256 hidden_pointer = 0; 1250 hidden_pointer = 0;
1257 1251
1258 if (option (Opt_pointerBlank)) 1252 if (option (Opt_pointerBlank))
1618 case MotionNotify: 1612 case MotionNotify:
1619#ifdef POINTER_BLANK 1613#ifdef POINTER_BLANK
1620 if (hidden_pointer) 1614 if (hidden_pointer)
1621 pointer_unblank (); 1615 pointer_unblank ();
1622#endif 1616#endif
1617 if (!bypass_keystate
1623 if ((priv_modes & PrivMode_MouseBtnEvent && ev.xbutton.state & (Button1Mask|Button2Mask|Button3Mask)) 1618 && ((priv_modes & PrivMode_MouseBtnEvent && ev.xbutton.state & (Button1Mask|Button2Mask|Button3Mask))
1624 || priv_modes & PrivMode_MouseAnyEvent) 1619 || priv_modes & PrivMode_MouseAnyEvent))
1625 mouse_report (ev.xbutton); 1620 mouse_report (ev.xbutton);
1626 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) 1621 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate)
1627 break; 1622 break;
1628 1623
1629 if (ev.xany.window == vt) 1624 if (ev.xany.window == vt)
1641 &unused_root_x, &unused_root_y, 1636 &unused_root_x, &unused_root_y,
1642 &ev.xbutton.x, &ev.xbutton.y, 1637 &ev.xbutton.x, &ev.xbutton.y,
1643 &ev.xbutton.state); 1638 &ev.xbutton.state);
1644#ifdef MOUSE_THRESHOLD 1639#ifdef MOUSE_THRESHOLD
1645 /* deal with a `jumpy' mouse */ 1640 /* deal with a `jumpy' mouse */
1646 if ((ev.xmotion.time - MEvent.time) > MOUSE_THRESHOLD) 1641 if (ev.xmotion.time - MEvent.time > MOUSE_THRESHOLD)
1642#endif
1647 { 1643 {
1648#endif
1649#if ISO_14755 1644#if ISO_14755
1650 // 5.4 1645 // 5.4
1651 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) 1646 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54))
1652 { 1647 {
1653 iso14755_54 (ev.xbutton.x, ev.xbutton.y); 1648 iso14755_54 (ev.xbutton.x, ev.xbutton.y);
1702 * shouldn't be scrolling 1697 * shouldn't be scrolling
1703 */ 1698 */
1704 sel_scroll_ev.stop(); 1699 sel_scroll_ev.stop();
1705 } 1700 }
1706#endif 1701#endif
1707#ifdef MOUSE_THRESHOLD
1708 } 1702 }
1709#endif
1710 } 1703 }
1711 } 1704 }
1712 else if (scrollBar.state == SB_STATE_MOTION && ev.xany.window == scrollBar.win) 1705 else if (scrollBar.state == SB_STATE_MOTION && ev.xany.window == scrollBar.win)
1713 { 1706 {
1714 while (XCheckTypedWindowEvent (dpy, scrollBar.win, 1707 while (XCheckTypedWindowEvent (dpy, scrollBar.win,
1788#endif 1781#endif
1789#if OFF_FOCUS_FADING 1782#if OFF_FOCUS_FADING
1790 if (rs[Rs_fade]) 1783 if (rs[Rs_fade])
1791 { 1784 {
1792 pix_colors = pix_colors_focused; 1785 pix_colors = pix_colors_focused;
1793 scr_recolour (); 1786 scr_recolor ();
1794 } 1787 }
1795#endif 1788#endif
1796#if ENABLE_FRILLS 1789#if ENABLE_FRILLS
1797 if (option (Opt_urgentOnBell)) 1790 if (option (Opt_urgentOnBell))
1798 set_urgency (0); 1791 set_urgency (0);
1792
1793 if (priv_modes & PrivMode_FocusEvent)
1794 tt_printf ("\x1b[I");
1799#endif 1795#endif
1800 1796
1801 HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END)); 1797 HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END));
1802 } 1798 }
1803} 1799}
1811 want_refresh = 1; 1807 want_refresh = 1;
1812 1808
1813#if ENABLE_FRILLS 1809#if ENABLE_FRILLS
1814 if (option (Opt_urgentOnBell)) 1810 if (option (Opt_urgentOnBell))
1815 set_urgency (0); 1811 set_urgency (0);
1812
1813 if (priv_modes & PrivMode_FocusEvent)
1814 tt_printf ("\x1b[O");
1816#endif 1815#endif
1817#if ENABLE_FRILLS || ISO_14755 1816#if ENABLE_FRILLS || ISO_14755
1818 if (iso14755buf) 1817 if (iso14755buf)
1819 { 1818 {
1820 iso14755buf = 0; 1819 iso14755buf = 0;
1835#endif 1834#endif
1836#if OFF_FOCUS_FADING 1835#if OFF_FOCUS_FADING
1837 if (rs[Rs_fade]) 1836 if (rs[Rs_fade])
1838 { 1837 {
1839 pix_colors = pix_colors_unfocused; 1838 pix_colors = pix_colors_unfocused;
1840 scr_recolour (); 1839 scr_recolor ();
1841 } 1840 }
1842#endif 1841#endif
1843 1842
1844 HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); 1843 HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1845 } 1844 }
1846} 1845}
1847 1846
1848void ecb_cold 1847void ecb_cold
1849rxvt_term::update_fade_color (unsigned int idx) 1848rxvt_term::update_fade_color (unsigned int idx, bool first_time)
1850{ 1849{
1851#if OFF_FOCUS_FADING 1850#if OFF_FOCUS_FADING
1852 if (rs[Rs_fade]) 1851 if (rs[Rs_fade])
1853 { 1852 {
1853 if (!first_time)
1854 pix_colors_focused [idx].free (this);
1855
1854 rgba c; 1856 rgba c;
1855 pix_colors [Color_fade].get (c); 1857 pix_colors [Color_fade].get (c);
1856 pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); 1858 pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c);
1857 } 1859 }
1858#endif 1860#endif
1920 iso14755_54 (ev.x, ev.y); 1922 iso14755_54 (ev.x, ev.y);
1921 return; 1923 return;
1922 } 1924 }
1923#endif 1925#endif
1924 1926
1925 clickintime = ev.time - MEvent.time < MULTICLICK_TIME; 1927 clickintime = ev.time - MEvent.time < multiClickTime;
1926 1928
1927 if (reportmode) 1929 if (reportmode)
1928 { 1930 {
1929 /* mouse report from vt window */ 1931 /* mouse report from vt window */
1930 /* save the xbutton state (for ButtonRelease) */ 1932 /* save the xbutton state (for ButtonRelease) */
2180#ifdef MOUSE_REPORT_DOUBLECLICK 2182#ifdef MOUSE_REPORT_DOUBLECLICK
2181 /* only report the release of 'slow' single clicks */ 2183 /* only report the release of 'slow' single clicks */
2182 if (MEvent.button != AnyButton 2184 if (MEvent.button != AnyButton
2183 && (ev.button != MEvent.button 2185 && (ev.button != MEvent.button
2184 || (ev.time - MEvent.time 2186 || (ev.time - MEvent.time
2185 > MULTICLICK_TIME / 2))) 2187 > multiClickTime / 2)))
2186 { 2188 {
2187 MEvent.clicks = 0; 2189 MEvent.clicks = 0;
2188 MEvent.button = AnyButton; 2190 MEvent.button = AnyButton;
2189 mouse_report (ev); 2191 mouse_report (ev);
2190 } 2192 }
2580 scr_charset_choose (0); 2582 scr_charset_choose (0);
2581 break; 2583 break;
2582 2584
2583#ifdef EIGHT_BIT_CONTROLS 2585#ifdef EIGHT_BIT_CONTROLS
2584 // 8-bit controls 2586 // 8-bit controls
2585 case 0x90: /* DCS */ 2587 case 0x90: /* DCS */
2586 process_dcs_seq (); 2588 process_dcs_seq ();
2587 break; 2589 break;
2588 case 0x9b: /* CSI */ 2590 case 0x9b: /* CSI */
2589 process_csi_seq (); 2591 process_csi_seq ();
2590 break; 2592 break;
2591 case 0x9d: /* OSC */ 2593 case 0x9d: /* OSC */
2592 process_osc_seq (); 2594 process_osc_seq ();
2593 break; 2595 break;
2594#endif 2596#endif
2595 } 2597 }
2596} 2598}
3101 scr_insert_mode (1); 3103 scr_insert_mode (1);
3102 else if (arg[0] == 20) 3104 else if (arg[0] == 20)
3103 priv_modes |= PrivMode_LFNL; 3105 priv_modes |= PrivMode_LFNL;
3104 break; 3106 break;
3105 3107
3106 case CSI_71: // DESCUSR: set cursor style 3108 case CSI_71: // DECSCUSR: set cursor style
3107 if (prev_ch == ' ') 3109 if (prev_ch == ' ')
3108 set_cursor_style (arg[0]); 3110 set_cursor_style (arg[0]);
3109 break; 3111 break;
3110 3112
3111 /* 3113 /*
3342 rgba c; 3344 rgba c;
3343 pix_colors_focused[color].get (c); 3345 pix_colors_focused[color].get (c);
3344 3346
3345#if XFT 3347#if XFT
3346 if (c.a != rgba::MAX_CC) 3348 if (c.a != rgba::MAX_CC)
3347 tt_printf ("\033]%d;rgba:%04x/%04x/%04x/%04x%c", report, c.a, c.r, c.g, c.b, resp); 3349 tt_printf ("\033]%d;rgba:%04x/%04x/%04x/%04x%c", report, c.r, c.g, c.b, c.a, resp);
3348 else 3350 else
3349#endif 3351#endif
3350 tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, c.r, c.g, c.b, resp); 3352 tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, c.r, c.g, c.b, resp);
3351 } 3353 }
3352 else 3354 else
3689 { 5, PrivMode_rVideo }, // DECSCNM 3691 { 5, PrivMode_rVideo }, // DECSCNM
3690 { 6, PrivMode_relOrigin }, // DECOM 3692 { 6, PrivMode_relOrigin }, // DECOM
3691 { 7, PrivMode_Autowrap }, // DECAWM 3693 { 7, PrivMode_Autowrap }, // DECAWM
3692 // 8, auto-repeat keys // DECARM 3694 // 8, auto-repeat keys // DECARM
3693 { 9, PrivMode_MouseX10 }, 3695 { 9, PrivMode_MouseX10 },
3696 { 12, PrivMode_BlinkingCursor },
3694 // 18 end FF to printer after print screen 3697 // 18 end FF to printer after print screen
3695 // 19 Print screen prints full screen/scroll region 3698 // 19 Print screen prints full screen/scroll region
3696 { 25, PrivMode_VisibleCursor }, // DECTCEM cnorm/cvvis/civis 3699 { 25, PrivMode_VisibleCursor }, // DECTCEM cnorm/cvvis/civis
3697#ifdef scrollBar_esc 3700#ifdef scrollBar_esc
3698 { scrollBar_esc, PrivMode_scrollBar }, 3701 { scrollBar_esc, PrivMode_scrollBar },
3710#endif 3713#endif
3711 { 1000, PrivMode_MouseX11 }, 3714 { 1000, PrivMode_MouseX11 },
3712 { 1002, PrivMode_MouseBtnEvent }, 3715 { 1002, PrivMode_MouseBtnEvent },
3713 { 1003, PrivMode_MouseAnyEvent }, 3716 { 1003, PrivMode_MouseAnyEvent },
3714#if ENABLE_FRILLS 3717#if ENABLE_FRILLS
3718 { 1004, PrivMode_FocusEvent },
3715 { 1005, PrivMode_ExtModeMouse }, 3719 { 1005, PrivMode_ExtModeMouse },
3716#endif 3720#endif
3717 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3721 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3718 { 1011, PrivMode_Keypress }, // rxvt extension 3722 { 1011, PrivMode_Keypress }, // rxvt extension
3719#if ENABLE_FRILLS 3723#if ENABLE_FRILLS
3807 scrollBar.map (state); 3811 scrollBar.map (state);
3808 resize_all_windows (0, 0, 0); 3812 resize_all_windows (0, 0, 0);
3809 scr_touch (true); 3813 scr_touch (true);
3810 break; 3814 break;
3811#endif 3815#endif
3816#ifdef CURSOR_BLINK
3817 case 12:
3818 cursor_blink_reset ();
3819 break;
3820#endif
3812 case 25: /* visible/invisible cursor */ 3821 case 25: /* visible/invisible cursor */
3813 scr_cursor_visible (state); 3822 scr_cursor_visible (state);
3814 break; 3823 break;
3815 /* case 35: - shift keys */ 3824 /* case 35: - shift keys */
3816 /* case 40: - 80 <--> 132 mode */ 3825 /* case 40: - 80 <--> 132 mode */
3921 //case 19: // ninth alt font 3930 //case 19: // ninth alt font
3922 //case 20: // gothic 3931 //case 20: // gothic
3923 case 21: // disable bold, faint, sometimes doubly underlined (iso 8613) 3932 case 21: // disable bold, faint, sometimes doubly underlined (iso 8613)
3924 rendset = 0, rendstyle = RS_Bold; 3933 rendset = 0, rendstyle = RS_Bold;
3925 break; 3934 break;
3926 case 22: // normal intensity 3935 case 22: // bold off (vt220)
3927 rendset = 0, rendstyle = RS_Bold; 3936 rendset = 0, rendstyle = RS_Bold;
3928 break; 3937 break;
3929 case 23: // disable italic 3938 case 23: // disable italic
3930 rendset = 0, rendstyle = RS_Italic; 3939 rendset = 0, rendstyle = RS_Italic;
3931 break; 3940 break;
3932 case 24: 3941 case 24: // underline off (vt220)
3933 rendset = 0, rendstyle = RS_Uline; 3942 rendset = 0, rendstyle = RS_Uline;
3934 break; 3943 break;
3935 case 25: 3944 case 25: // blink off (vt220)
3936 rendset = 0, rendstyle = RS_Blink; 3945 rendset = 0, rendstyle = RS_Blink;
3937 break; 3946 break;
3938 case 26: // variable spacing (iso 8613) 3947 case 26: // variable spacing (iso 8613)
3939 rendset = 0, rendstyle = RS_Blink; 3948 rendset = 0, rendstyle = RS_Blink;
3940 break; 3949 break;
3941 case 27: 3950 case 27: // reverse off (vt220)
3942 rendset = 0, rendstyle = RS_RVid; 3951 rendset = 0, rendstyle = RS_RVid;
3943 break; 3952 break;
3944 //case 28: // visible. NYI 3953 //case 28: // visible. NYI
3945 //case 29: // not crossed-out 3954 //case 29: // not crossed-out
3946 } 3955 }
4024} 4033}
4025 4034
4026void 4035void
4027rxvt_term::set_cursor_style (int style) 4036rxvt_term::set_cursor_style (int style)
4028{ 4037{
4029 if (!IN_RANGE_INC (style, 0, 4)) 4038 if (!IN_RANGE_INC (style, 0, 6))
4030 return; 4039 return;
4031 4040
4041 if (style == 0)
4042 style = 1;
4043
4044 cursor_type = (style - 1) / 2;
4032 set_option (Opt_cursorUnderline, style >= 3); 4045 set_option (Opt_cursorUnderline, cursor_type == 1);
4033 4046
4034#ifdef CURSOR_BLINK 4047#ifdef CURSOR_BLINK
4035 set_option (Opt_cursorBlink, !style || (style & 1)); 4048 set_option (Opt_cursorBlink, style & 1);
4036 cursor_blink_reset (); 4049 cursor_blink_reset ();
4037#endif 4050#endif
4038 4051
4039 want_refresh = 1; 4052 want_refresh = 1;
4040} 4053}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines