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.374 by root, Tue Dec 11 18:00:06 2007 UTC vs.
Revision 1.382 by root, Fri Dec 14 06:04:56 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 && !ev_is_active (&flush_ev))
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
1507 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) 1514 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1508 { 1515 {
1509 scr_expose (ev.xexpose.x, ev.xexpose.y, 1516 scr_expose (ev.xexpose.x, ev.xexpose.y,
1510 ev.xexpose.width, ev.xexpose.height, False); 1517 ev.xexpose.width, ev.xexpose.height, False);
1511 } 1518 }
1519
1512 want_refresh = 1; 1520 want_refresh = 1;
1513 } 1521 }
1514 else 1522 else
1515 { 1523 {
1516 XEvent unused_event; 1524 XEvent unused_event;
1577 int dist; 1585 int dist;
1578 1586
1579 /* don't clobber the current delay if we are 1587 /* don't clobber the current delay if we are
1580 * already in the middle of scrolling. 1588 * already in the middle of scrolling.
1581 */ 1589 */
1582 if (!ev_is_active (&sel_scroll_ev)) 1590 if (!sel_scroll_ev.is_active ())
1583 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 1591 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1584 1592
1585 /* save the event params so we can highlight 1593 /* save the event params so we can highlight
1586 * the selection in the pending-scroll loop 1594 * the selection in the pending-scroll loop
1587 */ 1595 */
1610 else 1618 else
1611 { 1619 {
1612 /* we are within the text window, so we 1620 /* we are within the text window, so we
1613 * shouldn't be scrolling 1621 * shouldn't be scrolling
1614 */ 1622 */
1615 if (ev_is_active (&sel_scroll_ev))
1616 sel_scroll_ev.stop(); 1623 sel_scroll_ev.stop();
1617 } 1624 }
1618#endif 1625#endif
1619#ifdef MOUSE_THRESHOLD 1626#ifdef MOUSE_THRESHOLD
1620 } 1627 }
1621#endif 1628#endif
1664 1671
1665 if (ev.type == KeyPress && hidden_pointer == 0) 1672 if (ev.type == KeyPress && hidden_pointer == 0)
1666 pointer_blank (); 1673 pointer_blank ();
1667 } 1674 }
1668#endif 1675#endif
1676
1677 refresh_check ();
1669} 1678}
1670 1679
1671void 1680void
1672rxvt_term::focus_in () 1681rxvt_term::focus_in ()
1673{ 1682{
1685 XSetICFocus (Input_Context); 1694 XSetICFocus (Input_Context);
1686 } 1695 }
1687#endif 1696#endif
1688#if CURSOR_BLINK 1697#if CURSOR_BLINK
1689 if (option (Opt_cursorBlink)) 1698 if (option (Opt_cursorBlink))
1690 cursor_blink_ev.start (CURSOR_BLINK_INTERVAL, CURSOR_BLINK_INTERVAL); 1699 cursor_blink_ev.again ();
1691#endif 1700#endif
1692#if OFF_FOCUS_FADING 1701#if OFF_FOCUS_FADING
1693 if (rs[Rs_fade]) 1702 if (rs[Rs_fade])
1694 { 1703 {
1695 pix_colors = pix_colors_focused; 1704 pix_colors = pix_colors_focused;
1786 update_background (); 1795 update_background ();
1787 } 1796 }
1788 break; 1797 break;
1789 } 1798 }
1790# endif 1799# endif
1800
1801 refresh_check ();
1791} 1802}
1792#endif 1803#endif
1793 1804
1794void 1805void
1795rxvt_term::button_press (XButtonEvent &ev) 1806rxvt_term::button_press (XButtonEvent &ev)
1973 if (scrollbarrxvt_upButton (ev.y)) 1984 if (scrollbarrxvt_upButton (ev.y))
1974 upordown = -1; /* up */ 1985 upordown = -1; /* up */
1975 else if (scrollbarrxvt_dnButton (ev.y)) 1986 else if (scrollbarrxvt_dnButton (ev.y))
1976 upordown = 1; /* down */ 1987 upordown = 1; /* down */
1977 } 1988 }
1989
1978 if (upordown) 1990 if (upordown)
1979 { 1991 {
1980#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1992#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1993 if (!cont_scroll_ev.is_active ())
1981 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 1994 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1982#endif 1995#endif
1983 if (scr_page (upordown < 0 ? UP : DN, 1)) 1996 if (scr_page (upordown < 0 ? UP : DN, 1))
1984 { 1997 {
1985 if (upordown < 0) 1998 if (upordown < 0)
1986 scrollBar.setUp (); 1999 scrollBar.setUp ();
2066 scrollBar.setIdle (); 2079 scrollBar.setIdle ();
2067 scrollbar_show (0); 2080 scrollbar_show (0);
2068 } 2081 }
2069 2082
2070#ifdef SELECTION_SCROLLING 2083#ifdef SELECTION_SCROLLING
2071 if (ev_is_active (&sel_scroll_ev))
2072 sel_scroll_ev.stop(); 2084 sel_scroll_ev.stop();
2073#endif 2085#endif
2074 2086
2075 if (ev.window == vt) 2087 if (ev.window == vt)
2076 { 2088 {
2077 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) 2089 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2149 { 2161 {
2150 mouse_slip_wheel_speed += v ? -1 : 1; 2162 mouse_slip_wheel_speed += v ? -1 : 1;
2151 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; 2163 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow;
2152 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; 2164 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2153 2165
2166 if (!slip_wheel_ev.is_active ())
2154 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 2167 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2155 } 2168 }
2156 else 2169 else
2157 { 2170 {
2158# endif 2171# endif
2159 scr_page (v, i); 2172 scr_page (v, i);
2297 } 2310 }
2298 2311
2299 ch = NOCHAR; 2312 ch = NOCHAR;
2300 } 2313 }
2301 } 2314 }
2315
2316 refresh_check ();
2302 2317
2303 return flag; 2318 return flag;
2304} 2319}
2305 2320
2306// read the next character 2321// read the next character

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines