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.366 by ayin, Thu Nov 15 11:36:15 2007 UTC vs.
Revision 1.383 by root, Fri Dec 14 06:29:28 2007 UTC

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-2006 Marc Lehmann <pcg@goof.com> 30 * Copyright (c) 2003-2007 Marc Lehmann <pcg@goof.com>
31 * 31 *
32 * This program is free software; you can redistribute it and/or modify 32 * This program is free software; you can redistribute it and/or modify
33 * it under the terms of the GNU General Public License as published by 33 * it under the terms of the GNU General Public License as published by
34 * the Free Software Foundation; either version 2 of the License, or 34 * the Free Software Foundation; either version 2 of the License, or
35 * (at your option) any later version. 35 * (at your option) any later version.
1041 } 1041 }
1042 1042
1043 display->flush (); 1043 display->flush ();
1044} 1044}
1045 1045
1046/* checks wether a refresh is requested and starts the refresh timer */
1046void 1047void
1047rxvt_term::prepare_cb (ev::prepare &w, int revents) 1048rxvt_term::refresh_check ()
1048{ 1049{
1049 make_current (); 1050 if (want_refresh && !flush_ev.is_active ())
1051 flush_ev.start (1. / 60.); // refresh at max. 60 Hz normally
1050 1052
1051 display->flush (); 1053 display->flush ();
1052
1053 if (want_refresh && !flush_ev.active)
1054 flush_ev.start (1. / 60.); // refresh at max. 60 hz normally
1055} 1054}
1056 1055
1057void 1056void
1058rxvt_term::flush_cb (ev::timer &w, int revents) 1057rxvt_term::flush_cb (ev::timer &w, int revents)
1059{ 1058{
1067void 1066void
1068rxvt_term::cursor_blink_cb (ev::timer &w, int revents) 1067rxvt_term::cursor_blink_cb (ev::timer &w, int revents)
1069{ 1068{
1070 hidden_cursor = !hidden_cursor; 1069 hidden_cursor = !hidden_cursor;
1071 want_refresh = 1; 1070 want_refresh = 1;
1071 refresh_check ();
1072} 1072}
1073#endif 1073#endif
1074 1074
1075#ifdef TEXT_BLINK 1075#ifdef TEXT_BLINK
1076void 1076void
1078{ 1078{
1079 if (scr_refresh_rend (RS_Blink, RS_Blink)) 1079 if (scr_refresh_rend (RS_Blink, RS_Blink))
1080 { 1080 {
1081 hidden_text = !hidden_text; 1081 hidden_text = !hidden_text;
1082 want_refresh = 1; 1082 want_refresh = 1;
1083 refresh_check ();
1083 } 1084 }
1085 else
1086 w.stop ();
1084} 1087}
1085#endif 1088#endif
1086 1089
1087#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1090#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1088void 1091void
1089rxvt_term::cont_scroll_cb (ev::timer &w, int revents) 1092rxvt_term::cont_scroll_cb (ev::timer &w, int revents)
1090{ 1093{
1091 if ((scrollbar_isUp() || scrollbar_isDn()) && 1094 if ((scrollbar_isUp () || scrollbar_isDn ())
1092 scr_page (scrollbar_isUp() ? UP : DN, 1)) 1095 && scr_page (scrollbar_isUp () ? UP : DN, 1))
1096 {
1093 want_refresh = 1; 1097 want_refresh = 1;
1098 refresh_check ();
1099 }
1094 else 1100 else
1095 w.stop (); 1101 w.stop ();
1096} 1102}
1097#endif 1103#endif
1098 1104
1102{ 1108{
1103 if (scr_page (scroll_selection_dir, scroll_selection_lines)) 1109 if (scr_page (scroll_selection_dir, scroll_selection_lines))
1104 { 1110 {
1105 selection_extend (selection_save_x, selection_save_y, selection_save_state); 1111 selection_extend (selection_save_x, selection_save_y, selection_save_state);
1106 want_refresh = 1; 1112 want_refresh = 1;
1113 refresh_check ();
1107 } 1114 }
1108 else 1115 else
1109 w.stop (); 1116 w.stop ();
1110} 1117}
1111#endif 1118#endif
1112 1119
1113#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1120#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
1114void 1121void
1115rxvt_term::slip_wheel_cb (ev::timer &w, int revents) 1122rxvt_term::slip_wheel_cb (ev::timer &w, int revents)
1116{ 1123{
1117 if (mouse_slip_wheel_speed == 0 1124 if (scr_changeview (view_start - mouse_slip_wheel_speed))
1118 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed)
1119 : scr_page (UP, mouse_slip_wheel_speed))
1120 { 1125 {
1121 if (view_start == top_row || view_start == 0)
1122 mouse_slip_wheel_speed = 0;
1123
1124 want_refresh = 1; 1126 want_refresh = 1;
1127 refresh_check ();
1128 }
1129
1130 if (view_start == top_row || view_start == 0 || mouse_slip_wheel_speed == 0)
1125 } 1131 {
1126 else 1132 mouse_slip_wheel_speed = 0;
1127 w.stop (); 1133 w.stop ();
1134 }
1128} 1135}
1129#endif 1136#endif
1130 1137
1131#if LINUX_YIELD_HACK 1138#if LINUX_YIELD_HACK
1132static struct event_handler 1139static struct event_handler
1204 if (cmd_parse ()) 1211 if (cmd_parse ())
1205 break; 1212 break;
1206 1213
1207 if (revents & ev::WRITE) 1214 if (revents & ev::WRITE)
1208 pty_write (); 1215 pty_write ();
1216
1217 refresh_check ();
1209} 1218}
1210 1219
1211void 1220void
1212rxvt_term::pointer_unblank () 1221rxvt_term::pointer_unblank ()
1213{ 1222{
1476 break; 1485 break;
1477 1486
1478 case MapNotify: 1487 case MapNotify:
1479 mapped = 1; 1488 mapped = 1;
1480#ifdef TEXT_BLINK 1489#ifdef TEXT_BLINK
1481 text_blink_ev.start (TEXT_BLINK_INTERVAL); 1490 text_blink_ev.start ();
1482#endif 1491#endif
1483 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1492 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1484 break; 1493 break;
1485 1494
1486 case UnmapNotify: 1495 case UnmapNotify:
1507 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) 1516 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1508 { 1517 {
1509 scr_expose (ev.xexpose.x, ev.xexpose.y, 1518 scr_expose (ev.xexpose.x, ev.xexpose.y,
1510 ev.xexpose.width, ev.xexpose.height, False); 1519 ev.xexpose.width, ev.xexpose.height, False);
1511 } 1520 }
1521
1512 want_refresh = 1; 1522 want_refresh = 1;
1513 } 1523 }
1514 else 1524 else
1515 { 1525 {
1516 XEvent unused_event; 1526 XEvent unused_event;
1577 int dist; 1587 int dist;
1578 1588
1579 /* don't clobber the current delay if we are 1589 /* don't clobber the current delay if we are
1580 * already in the middle of scrolling. 1590 * already in the middle of scrolling.
1581 */ 1591 */
1582 if (!sel_scroll_ev.active) 1592 if (!sel_scroll_ev.is_active ())
1583 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 1593 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1584 1594
1585 /* save the event params so we can highlight 1595 /* save the event params so we can highlight
1586 * the selection in the pending-scroll loop 1596 * the selection in the pending-scroll loop
1587 */ 1597 */
1610 else 1620 else
1611 { 1621 {
1612 /* we are within the text window, so we 1622 /* we are within the text window, so we
1613 * shouldn't be scrolling 1623 * shouldn't be scrolling
1614 */ 1624 */
1615 if (sel_scroll_ev.active)
1616 sel_scroll_ev.stop(); 1625 sel_scroll_ev.stop();
1617 } 1626 }
1618#endif 1627#endif
1619#ifdef MOUSE_THRESHOLD 1628#ifdef MOUSE_THRESHOLD
1620 } 1629 }
1621#endif 1630#endif
1664 1673
1665 if (ev.type == KeyPress && hidden_pointer == 0) 1674 if (ev.type == KeyPress && hidden_pointer == 0)
1666 pointer_blank (); 1675 pointer_blank ();
1667 } 1676 }
1668#endif 1677#endif
1678
1679 refresh_check ();
1669} 1680}
1670 1681
1671void 1682void
1672rxvt_term::focus_in () 1683rxvt_term::focus_in ()
1673{ 1684{
1685 XSetICFocus (Input_Context); 1696 XSetICFocus (Input_Context);
1686 } 1697 }
1687#endif 1698#endif
1688#if CURSOR_BLINK 1699#if CURSOR_BLINK
1689 if (option (Opt_cursorBlink)) 1700 if (option (Opt_cursorBlink))
1690 cursor_blink_ev.start (CURSOR_BLINK_INTERVAL, CURSOR_BLINK_INTERVAL); 1701 cursor_blink_ev.again ();
1691#endif 1702#endif
1692#if OFF_FOCUS_FADING 1703#if OFF_FOCUS_FADING
1693 if (rs[Rs_fade]) 1704 if (rs[Rs_fade])
1694 { 1705 {
1695 pix_colors = pix_colors_focused; 1706 pix_colors = pix_colors_focused;
1786 update_background (); 1797 update_background ();
1787 } 1798 }
1788 break; 1799 break;
1789 } 1800 }
1790# endif 1801# endif
1802
1803 refresh_check ();
1791} 1804}
1792#endif 1805#endif
1793 1806
1794void 1807void
1795rxvt_term::button_press (XButtonEvent &ev) 1808rxvt_term::button_press (XButtonEvent &ev)
1957 } 1970 }
1958 else 1971 else
1959#endif /* NO_SCROLLBAR_REPORT */ 1972#endif /* NO_SCROLLBAR_REPORT */
1960 1973
1961 { 1974 {
1962 char upordown = 0; 1975 char upordown = 0;
1963 1976
1964 if (scrollBar.style == R_SB_NEXT) 1977 if (scrollBar.style == R_SB_NEXT)
1965 { 1978 {
1966 if (scrollbarnext_upButton (ev.y)) 1979 if (scrollbarnext_upButton (ev.y))
1967 upordown = -1; /* up */ 1980 upordown = -1; /* up */
1973 if (scrollbarrxvt_upButton (ev.y)) 1986 if (scrollbarrxvt_upButton (ev.y))
1974 upordown = -1; /* up */ 1987 upordown = -1; /* up */
1975 else if (scrollbarrxvt_dnButton (ev.y)) 1988 else if (scrollbarrxvt_dnButton (ev.y))
1976 upordown = 1; /* down */ 1989 upordown = 1; /* down */
1977 } 1990 }
1991
1978 if (upordown) 1992 if (upordown)
1979 { 1993 {
1980#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1994#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1995 if (!cont_scroll_ev.is_active ())
1981 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 1996 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1982#endif 1997#endif
1983 if (scr_page (upordown < 0 ? UP : DN, 1)) 1998 if (scr_page (upordown < 0 ? UP : DN, 1))
1984 { 1999 {
1985 if (upordown < 0) 2000 if (upordown < 0)
1986 scrollBar.setUp (); 2001 scrollBar.setUp ();
2066 scrollBar.setIdle (); 2081 scrollBar.setIdle ();
2067 scrollbar_show (0); 2082 scrollbar_show (0);
2068 } 2083 }
2069 2084
2070#ifdef SELECTION_SCROLLING 2085#ifdef SELECTION_SCROLLING
2071 if (sel_scroll_ev.active)
2072 sel_scroll_ev.stop(); 2086 sel_scroll_ev.stop();
2073#endif 2087#endif
2074 2088
2075 if (ev.window == vt) 2089 if (ev.window == vt)
2076 { 2090 {
2077 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) 2091 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2149 { 2163 {
2150 mouse_slip_wheel_speed += v ? -1 : 1; 2164 mouse_slip_wheel_speed += v ? -1 : 1;
2151 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; 2165 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow;
2152 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; 2166 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2153 2167
2168 if (!slip_wheel_ev.is_active ())
2154 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 2169 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2155 } 2170 }
2156 else 2171 else
2157 { 2172 {
2158# endif 2173# endif
2159 scr_page (v, i); 2174 scr_page (v, i);
2227 2242
2228 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) 2243 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1)
2229 { 2244 {
2230 refresh_count = 0; 2245 refresh_count = 0;
2231 2246
2232 if (!option (Opt_skipScroll) || ev::ev_time () > ev::now () + 1. / 60.) 2247 if (!option (Opt_skipScroll) || ev_time () > ev::now () + 1. / 60.)
2233 { 2248 {
2234 refreshnow = true; 2249 refreshnow = true;
2235 ch = NOCHAR; 2250 ch = NOCHAR;
2236 break; 2251 break;
2237 } 2252 }
2751 nargs = 0; 2766 nargs = 0;
2752 2767
2753 priv = 0; 2768 priv = 0;
2754 ch = cmd_getc (); 2769 ch = cmd_getc ();
2755 if (ch >= '<' && ch <= '?') 2770 if (ch >= '<' && ch <= '?')
2771 {
2756 { /* '<' '=' '>' '?' */ 2772 /* '<' '=' '>' '?' */
2757 priv = ch; 2773 priv = ch;
2758 ch = cmd_getc (); 2774 ch = cmd_getc ();
2759 } 2775 }
2760 2776
2761 /* read any numerical arguments */ 2777 /* read any numerical arguments */
3581 { 66, PrivMode_aplKP }, 3597 { 66, PrivMode_aplKP },
3582#ifndef NO_BACKSPACE_KEY 3598#ifndef NO_BACKSPACE_KEY
3583 { 67, PrivMode_BackSpace }, 3599 { 67, PrivMode_BackSpace },
3584#endif 3600#endif
3585 { 1000, PrivMode_MouseX11 }, 3601 { 1000, PrivMode_MouseX11 },
3586 // 1001 Use Hilite Mouse Tracking. NYI, TODO
3587 { 1002, PrivMode_MouseBtnEvent }, 3602 { 1002, PrivMode_MouseBtnEvent },
3588 { 1003, PrivMode_MouseAnyEvent }, 3603 { 1003, PrivMode_MouseAnyEvent },
3589 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3604 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3590 { 1011, PrivMode_Keypress }, // rxvt extension 3605 { 1011, PrivMode_Keypress }, // rxvt extension
3591 // 1035 enable modifiers for alt, numlock NYI 3606 // 1035 enable modifiers for alt, numlock NYI
3692 /* case 67: - backspace key */ 3707 /* case 67: - backspace key */
3693 case 1000: /* X11 mouse reporting */ 3708 case 1000: /* X11 mouse reporting */
3694 if (state) /* orthogonal */ 3709 if (state) /* orthogonal */
3695 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); 3710 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3696 break; 3711 break;
3697#if 0
3698 case 1001:
3699 break; /* X11 mouse highlighting */
3700#endif
3701 case 1002: 3712 case 1002:
3702 case 1003: 3713 case 1003:
3703 if (state) 3714 if (state)
3704 { 3715 {
3705 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11); 3716 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11);
3894rxvt_term::process_graphics () 3905rxvt_term::process_graphics ()
3895{ 3906{
3896 unicode_t ch, cmd = cmd_getc (); 3907 unicode_t ch, cmd = cmd_getc ();
3897 3908
3898 if (cmd == 'Q') 3909 if (cmd == 'Q')
3910 {
3899 { /* query graphics */ 3911 /* query graphics */
3900 tt_printf ("\033G0\012"); /* no graphics */ 3912 tt_printf ("\033G0\012"); /* no graphics */
3901 return; 3913 return;
3902 } 3914 }
3903 /* swallow other graphics sequences until terminating ':' */ 3915 /* swallow other graphics sequences until terminating ':' */
3904 do 3916 do

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines