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.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 && !flush_ev.active) 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)
1059{ 1056{
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 }
1083 else
1084 w.stop ();
1084} 1085}
1085#endif 1086#endif
1086 1087
1087#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1088#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1088void 1089void
1089rxvt_term::cont_scroll_cb (ev::timer &w, int revents) 1090rxvt_term::cont_scroll_cb (ev::timer &w, int revents)
1090{ 1091{
1091 if ((scrollbar_isUp() || scrollbar_isDn()) && 1092 if ((scrollbar_isUp () || scrollbar_isDn ())
1092 scr_page (scrollbar_isUp() ? UP : DN, 1)) 1093 && scr_page (scrollbar_isUp () ? UP : DN, 1))
1094 {
1093 want_refresh = 1; 1095 want_refresh = 1;
1096 refresh_check ();
1097 }
1094 else 1098 else
1095 w.stop (); 1099 w.stop ();
1096} 1100}
1097#endif 1101#endif
1098 1102
1102{ 1106{
1103 if (scr_page (scroll_selection_dir, scroll_selection_lines)) 1107 if (scr_page (scroll_selection_dir, scroll_selection_lines))
1104 { 1108 {
1105 selection_extend (selection_save_x, selection_save_y, selection_save_state); 1109 selection_extend (selection_save_x, selection_save_y, selection_save_state);
1106 want_refresh = 1; 1110 want_refresh = 1;
1111 refresh_check ();
1107 } 1112 }
1108 else 1113 else
1109 w.stop (); 1114 w.stop ();
1110} 1115}
1111#endif 1116#endif
1112 1117
1113#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1118#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
1114void 1119void
1115rxvt_term::slip_wheel_cb (ev::timer &w, int revents) 1120rxvt_term::slip_wheel_cb (ev::timer &w, int revents)
1116{ 1121{
1117 if (mouse_slip_wheel_speed == 0 1122 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 { 1123 {
1121 if (view_start == top_row || view_start == 0)
1122 mouse_slip_wheel_speed = 0;
1123
1124 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)
1125 } 1129 {
1126 else 1130 mouse_slip_wheel_speed = 0;
1127 w.stop (); 1131 w.stop ();
1132 }
1128} 1133}
1129#endif 1134#endif
1130 1135
1131#if LINUX_YIELD_HACK 1136#if LINUX_YIELD_HACK
1132static struct event_handler 1137static struct event_handler
1476 break; 1481 break;
1477 1482
1478 case MapNotify: 1483 case MapNotify:
1479 mapped = 1; 1484 mapped = 1;
1480#ifdef TEXT_BLINK 1485#ifdef TEXT_BLINK
1481 text_blink_ev.start (TEXT_BLINK_INTERVAL); 1486 text_blink_ev.start ();
1482#endif 1487#endif
1483 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1488 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1484 break; 1489 break;
1485 1490
1486 case UnmapNotify: 1491 case UnmapNotify:
1507 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) 1512 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1508 { 1513 {
1509 scr_expose (ev.xexpose.x, ev.xexpose.y, 1514 scr_expose (ev.xexpose.x, ev.xexpose.y,
1510 ev.xexpose.width, ev.xexpose.height, False); 1515 ev.xexpose.width, ev.xexpose.height, False);
1511 } 1516 }
1517
1512 want_refresh = 1; 1518 want_refresh = 1;
1513 } 1519 }
1514 else 1520 else
1515 { 1521 {
1516 XEvent unused_event; 1522 XEvent unused_event;
1577 int dist; 1583 int dist;
1578 1584
1579 /* don't clobber the current delay if we are 1585 /* don't clobber the current delay if we are
1580 * already in the middle of scrolling. 1586 * already in the middle of scrolling.
1581 */ 1587 */
1582 if (!sel_scroll_ev.active) 1588 if (!sel_scroll_ev.is_active ())
1583 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 1589 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1584 1590
1585 /* save the event params so we can highlight 1591 /* save the event params so we can highlight
1586 * the selection in the pending-scroll loop 1592 * the selection in the pending-scroll loop
1587 */ 1593 */
1610 else 1616 else
1611 { 1617 {
1612 /* we are within the text window, so we 1618 /* we are within the text window, so we
1613 * shouldn't be scrolling 1619 * shouldn't be scrolling
1614 */ 1620 */
1615 if (sel_scroll_ev.active)
1616 sel_scroll_ev.stop(); 1621 sel_scroll_ev.stop();
1617 } 1622 }
1618#endif 1623#endif
1619#ifdef MOUSE_THRESHOLD 1624#ifdef MOUSE_THRESHOLD
1620 } 1625 }
1621#endif 1626#endif
1664 1669
1665 if (ev.type == KeyPress && hidden_pointer == 0) 1670 if (ev.type == KeyPress && hidden_pointer == 0)
1666 pointer_blank (); 1671 pointer_blank ();
1667 } 1672 }
1668#endif 1673#endif
1674
1675 refresh_check ();
1669} 1676}
1670 1677
1671void 1678void
1672rxvt_term::focus_in () 1679rxvt_term::focus_in ()
1673{ 1680{
1685 XSetICFocus (Input_Context); 1692 XSetICFocus (Input_Context);
1686 } 1693 }
1687#endif 1694#endif
1688#if CURSOR_BLINK 1695#if CURSOR_BLINK
1689 if (option (Opt_cursorBlink)) 1696 if (option (Opt_cursorBlink))
1690 cursor_blink_ev.start (CURSOR_BLINK_INTERVAL, CURSOR_BLINK_INTERVAL); 1697 cursor_blink_ev.again ();
1691#endif 1698#endif
1692#if OFF_FOCUS_FADING 1699#if OFF_FOCUS_FADING
1693 if (rs[Rs_fade]) 1700 if (rs[Rs_fade])
1694 { 1701 {
1695 pix_colors = pix_colors_focused; 1702 pix_colors = pix_colors_focused;
1786 update_background (); 1793 update_background ();
1787 } 1794 }
1788 break; 1795 break;
1789 } 1796 }
1790# endif 1797# endif
1798
1799 refresh_check ();
1791} 1800}
1792#endif 1801#endif
1793 1802
1794void 1803void
1795rxvt_term::button_press (XButtonEvent &ev) 1804rxvt_term::button_press (XButtonEvent &ev)
1957 } 1966 }
1958 else 1967 else
1959#endif /* NO_SCROLLBAR_REPORT */ 1968#endif /* NO_SCROLLBAR_REPORT */
1960 1969
1961 { 1970 {
1962 char upordown = 0; 1971 char upordown = 0;
1963 1972
1964 if (scrollBar.style == R_SB_NEXT) 1973 if (scrollBar.style == R_SB_NEXT)
1965 { 1974 {
1966 if (scrollbarnext_upButton (ev.y)) 1975 if (scrollbarnext_upButton (ev.y))
1967 upordown = -1; /* up */ 1976 upordown = -1; /* up */
1973 if (scrollbarrxvt_upButton (ev.y)) 1982 if (scrollbarrxvt_upButton (ev.y))
1974 upordown = -1; /* up */ 1983 upordown = -1; /* up */
1975 else if (scrollbarrxvt_dnButton (ev.y)) 1984 else if (scrollbarrxvt_dnButton (ev.y))
1976 upordown = 1; /* down */ 1985 upordown = 1; /* down */
1977 } 1986 }
1987
1978 if (upordown) 1988 if (upordown)
1979 { 1989 {
1980#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1990#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1991 if (!cont_scroll_ev.is_active ())
1981 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 1992 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1982#endif 1993#endif
1983 if (scr_page (upordown < 0 ? UP : DN, 1)) 1994 if (scr_page (upordown < 0 ? UP : DN, 1))
1984 { 1995 {
1985 if (upordown < 0) 1996 if (upordown < 0)
1986 scrollBar.setUp (); 1997 scrollBar.setUp ();
2066 scrollBar.setIdle (); 2077 scrollBar.setIdle ();
2067 scrollbar_show (0); 2078 scrollbar_show (0);
2068 } 2079 }
2069 2080
2070#ifdef SELECTION_SCROLLING 2081#ifdef SELECTION_SCROLLING
2071 if (sel_scroll_ev.active)
2072 sel_scroll_ev.stop(); 2082 sel_scroll_ev.stop();
2073#endif 2083#endif
2074 2084
2075 if (ev.window == vt) 2085 if (ev.window == vt)
2076 { 2086 {
2077 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)))
2149 { 2159 {
2150 mouse_slip_wheel_speed += v ? -1 : 1; 2160 mouse_slip_wheel_speed += v ? -1 : 1;
2151 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; 2161 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow;
2152 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; 2162 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2153 2163
2164 if (!slip_wheel_ev.is_active ())
2154 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 2165 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2155 } 2166 }
2156 else 2167 else
2157 { 2168 {
2158# endif 2169# endif
2159 scr_page (v, i); 2170 scr_page (v, i);
2227 2238
2228 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) 2239 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1)
2229 { 2240 {
2230 refresh_count = 0; 2241 refresh_count = 0;
2231 2242
2232 if (!option (Opt_skipScroll) || ev::ev_time () > ev::now () + 1. / 60.) 2243 if (!option (Opt_skipScroll) || ev_time () > ev::now () + 1. / 60.)
2233 { 2244 {
2234 refreshnow = true; 2245 refreshnow = true;
2235 ch = NOCHAR; 2246 ch = NOCHAR;
2236 break; 2247 break;
2237 } 2248 }
2297 } 2308 }
2298 2309
2299 ch = NOCHAR; 2310 ch = NOCHAR;
2300 } 2311 }
2301 } 2312 }
2313
2314 refresh_check ();
2302 2315
2303 return flag; 2316 return flag;
2304} 2317}
2305 2318
2306// read the next character 2319// read the next character
2751 nargs = 0; 2764 nargs = 0;
2752 2765
2753 priv = 0; 2766 priv = 0;
2754 ch = cmd_getc (); 2767 ch = cmd_getc ();
2755 if (ch >= '<' && ch <= '?') 2768 if (ch >= '<' && ch <= '?')
2769 {
2756 { /* '<' '=' '>' '?' */ 2770 /* '<' '=' '>' '?' */
2757 priv = ch; 2771 priv = ch;
2758 ch = cmd_getc (); 2772 ch = cmd_getc ();
2759 } 2773 }
2760 2774
2761 /* read any numerical arguments */ 2775 /* read any numerical arguments */
3581 { 66, PrivMode_aplKP }, 3595 { 66, PrivMode_aplKP },
3582#ifndef NO_BACKSPACE_KEY 3596#ifndef NO_BACKSPACE_KEY
3583 { 67, PrivMode_BackSpace }, 3597 { 67, PrivMode_BackSpace },
3584#endif 3598#endif
3585 { 1000, PrivMode_MouseX11 }, 3599 { 1000, PrivMode_MouseX11 },
3586 // 1001 Use Hilite Mouse Tracking. NYI, TODO
3587 { 1002, PrivMode_MouseBtnEvent }, 3600 { 1002, PrivMode_MouseBtnEvent },
3588 { 1003, PrivMode_MouseAnyEvent }, 3601 { 1003, PrivMode_MouseAnyEvent },
3589 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3602 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3590 { 1011, PrivMode_Keypress }, // rxvt extension 3603 { 1011, PrivMode_Keypress }, // rxvt extension
3591 // 1035 enable modifiers for alt, numlock NYI 3604 // 1035 enable modifiers for alt, numlock NYI
3692 /* case 67: - backspace key */ 3705 /* case 67: - backspace key */
3693 case 1000: /* X11 mouse reporting */ 3706 case 1000: /* X11 mouse reporting */
3694 if (state) /* orthogonal */ 3707 if (state) /* orthogonal */
3695 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); 3708 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3696 break; 3709 break;
3697#if 0
3698 case 1001:
3699 break; /* X11 mouse highlighting */
3700#endif
3701 case 1002: 3710 case 1002:
3702 case 1003: 3711 case 1003:
3703 if (state) 3712 if (state)
3704 { 3713 {
3705 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11); 3714 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11);
3894rxvt_term::process_graphics () 3903rxvt_term::process_graphics ()
3895{ 3904{
3896 unicode_t ch, cmd = cmd_getc (); 3905 unicode_t ch, cmd = cmd_getc ();
3897 3906
3898 if (cmd == 'Q') 3907 if (cmd == 'Q')
3908 {
3899 { /* query graphics */ 3909 /* query graphics */
3900 tt_printf ("\033G0\012"); /* no graphics */ 3910 tt_printf ("\033G0\012"); /* no graphics */
3901 return; 3911 return;
3902 } 3912 }
3903 /* swallow other graphics sequences until terminating ':' */ 3913 /* swallow other graphics sequences until terminating ':' */
3904 do 3914 do

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines