… | |
… | |
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 */ |
1046 | void |
1047 | void |
1047 | rxvt_term::prepare_cb (ev::prepare &w, int revents) |
1048 | rxvt_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 | |
1057 | void |
1054 | void |
1058 | rxvt_term::flush_cb (ev::timer &w, int revents) |
1055 | rxvt_term::flush_cb (ev::timer &w, int revents) |
… | |
… | |
1067 | void |
1064 | void |
1068 | rxvt_term::cursor_blink_cb (ev::timer &w, int revents) |
1065 | rxvt_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 |
1076 | void |
1074 | void |
… | |
… | |
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 |
1088 | void |
1089 | void |
1089 | rxvt_term::cont_scroll_cb (ev::timer &w, int revents) |
1090 | rxvt_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) |
1114 | void |
1119 | void |
1115 | rxvt_term::slip_wheel_cb (ev::timer &w, int revents) |
1120 | rxvt_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 |
1132 | static struct event_handler |
1137 | static 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 | |
1671 | void |
1678 | void |
1672 | rxvt_term::focus_in () |
1679 | rxvt_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 | |
1794 | void |
1803 | void |
1795 | rxvt_term::button_press (XButtonEvent &ev) |
1804 | rxvt_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); |
… | |
… | |
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 |