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.375 by root, Tue Dec 11 21:10:46 2007 UTC vs.
Revision 1.381 by root, Fri Dec 14 05:25:23 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
1051 display->flush ();
1052
1053 if (want_refresh && !ev_is_active (&flush_ev)) 1050 if (want_refresh && !flush_ev.is_active ())
1054 flush_ev.start (1. / 60.); // refresh at max. 60 Hz normally 1051 flush_ev.start (1. / 60.); // refresh at max. 60 Hz normally
1055} 1052}
1056 1053
1057void 1054void
1058rxvt_term::flush_cb (ev::timer &w, int revents) 1055rxvt_term::flush_cb (ev::timer &w, int revents)
1067void 1064void
1068rxvt_term::cursor_blink_cb (ev::timer &w, int revents) 1065rxvt_term::cursor_blink_cb (ev::timer &w, int revents)
1069{ 1066{
1070 hidden_cursor = !hidden_cursor; 1067 hidden_cursor = !hidden_cursor;
1071 want_refresh = 1; 1068 want_refresh = 1;
1069 refresh_check ();
1072} 1070}
1073#endif 1071#endif
1074 1072
1075#ifdef TEXT_BLINK 1073#ifdef TEXT_BLINK
1076void 1074void
1078{ 1076{
1079 if (scr_refresh_rend (RS_Blink, RS_Blink)) 1077 if (scr_refresh_rend (RS_Blink, RS_Blink))
1080 { 1078 {
1081 hidden_text = !hidden_text; 1079 hidden_text = !hidden_text;
1082 want_refresh = 1; 1080 want_refresh = 1;
1081 refresh_check ();
1083 } 1082 }
1084 else 1083 else
1085 w.stop (); 1084 w.stop ();
1086} 1085}
1087#endif 1086#endif
1088 1087
1089#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1088#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1090void 1089void
1091rxvt_term::cont_scroll_cb (ev::timer &w, int revents) 1090rxvt_term::cont_scroll_cb (ev::timer &w, int revents)
1092{ 1091{
1093 if ((scrollbar_isUp() || scrollbar_isDn()) && 1092 if ((scrollbar_isUp () || scrollbar_isDn ())
1094 scr_page (scrollbar_isUp() ? UP : DN, 1)) 1093 && scr_page (scrollbar_isUp () ? UP : DN, 1))
1094 {
1095 want_refresh = 1; 1095 want_refresh = 1;
1096 refresh_check ();
1097 }
1096 else 1098 else
1097 w.stop (); 1099 w.stop ();
1098} 1100}
1099#endif 1101#endif
1100 1102
1104{ 1106{
1105 if (scr_page (scroll_selection_dir, scroll_selection_lines)) 1107 if (scr_page (scroll_selection_dir, scroll_selection_lines))
1106 { 1108 {
1107 selection_extend (selection_save_x, selection_save_y, selection_save_state); 1109 selection_extend (selection_save_x, selection_save_y, selection_save_state);
1108 want_refresh = 1; 1110 want_refresh = 1;
1111 refresh_check ();
1109 } 1112 }
1110 else 1113 else
1111 w.stop (); 1114 w.stop ();
1112} 1115}
1113#endif 1116#endif
1114 1117
1115#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1118#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
1116void 1119void
1117rxvt_term::slip_wheel_cb (ev::timer &w, int revents) 1120rxvt_term::slip_wheel_cb (ev::timer &w, int revents)
1118{ 1121{
1119 if (mouse_slip_wheel_speed == 0 1122 if (scr_changeview (view_start - mouse_slip_wheel_speed))
1120 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed)
1121 : scr_page (UP, mouse_slip_wheel_speed))
1122 { 1123 {
1123 if (view_start == top_row || view_start == 0)
1124 mouse_slip_wheel_speed = 0;
1125
1126 want_refresh = 1; 1124 want_refresh = 1;
1125 refresh_check ();
1126 }
1127
1128 if (view_start == top_row || view_start == 0 || mouse_slip_wheel_speed == 0)
1127 } 1129 {
1128 else 1130 mouse_slip_wheel_speed = 0;
1129 w.stop (); 1131 w.stop ();
1132 }
1130} 1133}
1131#endif 1134#endif
1132 1135
1133#if LINUX_YIELD_HACK 1136#if LINUX_YIELD_HACK
1134static struct event_handler 1137static struct event_handler
1509 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) 1512 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1510 { 1513 {
1511 scr_expose (ev.xexpose.x, ev.xexpose.y, 1514 scr_expose (ev.xexpose.x, ev.xexpose.y,
1512 ev.xexpose.width, ev.xexpose.height, False); 1515 ev.xexpose.width, ev.xexpose.height, False);
1513 } 1516 }
1517
1514 want_refresh = 1; 1518 want_refresh = 1;
1515 } 1519 }
1516 else 1520 else
1517 { 1521 {
1518 XEvent unused_event; 1522 XEvent unused_event;
1579 int dist; 1583 int dist;
1580 1584
1581 /* don't clobber the current delay if we are 1585 /* don't clobber the current delay if we are
1582 * already in the middle of scrolling. 1586 * already in the middle of scrolling.
1583 */ 1587 */
1584 if (!ev_is_active (&sel_scroll_ev)) 1588 if (!sel_scroll_ev.is_active ())
1585 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 1589 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1586 1590
1587 /* save the event params so we can highlight 1591 /* save the event params so we can highlight
1588 * the selection in the pending-scroll loop 1592 * the selection in the pending-scroll loop
1589 */ 1593 */
1612 else 1616 else
1613 { 1617 {
1614 /* we are within the text window, so we 1618 /* we are within the text window, so we
1615 * shouldn't be scrolling 1619 * shouldn't be scrolling
1616 */ 1620 */
1617 if (ev_is_active (&sel_scroll_ev))
1618 sel_scroll_ev.stop(); 1621 sel_scroll_ev.stop();
1619 } 1622 }
1620#endif 1623#endif
1621#ifdef MOUSE_THRESHOLD 1624#ifdef MOUSE_THRESHOLD
1622 } 1625 }
1623#endif 1626#endif
1666 1669
1667 if (ev.type == KeyPress && hidden_pointer == 0) 1670 if (ev.type == KeyPress && hidden_pointer == 0)
1668 pointer_blank (); 1671 pointer_blank ();
1669 } 1672 }
1670#endif 1673#endif
1674
1675 refresh_check ();
1671} 1676}
1672 1677
1673void 1678void
1674rxvt_term::focus_in () 1679rxvt_term::focus_in ()
1675{ 1680{
1788 update_background (); 1793 update_background ();
1789 } 1794 }
1790 break; 1795 break;
1791 } 1796 }
1792# endif 1797# endif
1798
1799 refresh_check ();
1793} 1800}
1794#endif 1801#endif
1795 1802
1796void 1803void
1797rxvt_term::button_press (XButtonEvent &ev) 1804rxvt_term::button_press (XButtonEvent &ev)
1975 if (scrollbarrxvt_upButton (ev.y)) 1982 if (scrollbarrxvt_upButton (ev.y))
1976 upordown = -1; /* up */ 1983 upordown = -1; /* up */
1977 else if (scrollbarrxvt_dnButton (ev.y)) 1984 else if (scrollbarrxvt_dnButton (ev.y))
1978 upordown = 1; /* down */ 1985 upordown = 1; /* down */
1979 } 1986 }
1987
1980 if (upordown) 1988 if (upordown)
1981 { 1989 {
1982#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1990#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1991 if (!cont_scroll_ev.is_active ())
1983 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 1992 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1984#endif 1993#endif
1985 if (scr_page (upordown < 0 ? UP : DN, 1)) 1994 if (scr_page (upordown < 0 ? UP : DN, 1))
1986 { 1995 {
1987 if (upordown < 0) 1996 if (upordown < 0)
1988 scrollBar.setUp (); 1997 scrollBar.setUp ();
2068 scrollBar.setIdle (); 2077 scrollBar.setIdle ();
2069 scrollbar_show (0); 2078 scrollbar_show (0);
2070 } 2079 }
2071 2080
2072#ifdef SELECTION_SCROLLING 2081#ifdef SELECTION_SCROLLING
2073 if (ev_is_active (&sel_scroll_ev))
2074 sel_scroll_ev.stop(); 2082 sel_scroll_ev.stop();
2075#endif 2083#endif
2076 2084
2077 if (ev.window == vt) 2085 if (ev.window == vt)
2078 { 2086 {
2079 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) 2087 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2151 { 2159 {
2152 mouse_slip_wheel_speed += v ? -1 : 1; 2160 mouse_slip_wheel_speed += v ? -1 : 1;
2153 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; 2161 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow;
2154 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; 2162 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2155 2163
2164 if (!slip_wheel_ev.is_active ())
2156 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 2165 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2157 } 2166 }
2158 else 2167 else
2159 { 2168 {
2160# endif 2169# endif
2161 scr_page (v, i); 2170 scr_page (v, i);
2299 } 2308 }
2300 2309
2301 ch = NOCHAR; 2310 ch = NOCHAR;
2302 } 2311 }
2303 } 2312 }
2313
2314 refresh_check ();
2304 2315
2305 return flag; 2316 return flag;
2306} 2317}
2307 2318
2308// read the next character 2319// read the next character

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines