… | |
… | |
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. |
… | |
… | |
1048 | { |
1048 | { |
1049 | make_current (); |
1049 | make_current (); |
1050 | |
1050 | |
1051 | display->flush (); |
1051 | display->flush (); |
1052 | |
1052 | |
1053 | if (want_refresh && !flush_ev.active) |
1053 | if (want_refresh && !flush_ev.is_active ()) |
1054 | flush_ev.start (1. / 60.); // refresh at max. 60 hz normally |
1054 | flush_ev.start (1. / 60.); // refresh at max. 60 Hz normally |
1055 | } |
1055 | } |
1056 | |
1056 | |
1057 | void |
1057 | void |
1058 | rxvt_term::flush_cb (ev::timer &w, int revents) |
1058 | rxvt_term::flush_cb (ev::timer &w, int revents) |
1059 | { |
1059 | { |
… | |
… | |
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 | } |
1083 | } |
|
|
1084 | else |
|
|
1085 | w.stop (); |
1084 | } |
1086 | } |
1085 | #endif |
1087 | #endif |
1086 | |
1088 | |
1087 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1089 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1088 | void |
1090 | void |
… | |
… | |
1112 | |
1114 | |
1113 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1115 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1114 | void |
1116 | void |
1115 | rxvt_term::slip_wheel_cb (ev::timer &w, int revents) |
1117 | rxvt_term::slip_wheel_cb (ev::timer &w, int revents) |
1116 | { |
1118 | { |
1117 | if (mouse_slip_wheel_speed == 0 |
|
|
1118 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
1119 | if (mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
1119 | : scr_page (UP, mouse_slip_wheel_speed)) |
1120 | : scr_page (UP, mouse_slip_wheel_speed)) |
|
|
1121 | want_refresh = 1; |
|
|
1122 | |
|
|
1123 | if (view_start == top_row || view_start == 0 || mouse_slip_wheel_speed == 0) |
1120 | { |
1124 | { |
1121 | if (view_start == top_row || view_start == 0) |
|
|
1122 | mouse_slip_wheel_speed = 0; |
1125 | mouse_slip_wheel_speed = 0; |
1123 | |
|
|
1124 | want_refresh = 1; |
|
|
1125 | } |
|
|
1126 | else |
|
|
1127 | w.stop (); |
1126 | w.stop (); |
|
|
1127 | } |
1128 | } |
1128 | } |
1129 | #endif |
1129 | #endif |
1130 | |
1130 | |
1131 | #if LINUX_YIELD_HACK |
1131 | #if LINUX_YIELD_HACK |
1132 | static struct event_handler |
1132 | static struct event_handler |
… | |
… | |
1251 | int x, y; |
1251 | int x, y; |
1252 | int code = 32; |
1252 | int code = 32; |
1253 | |
1253 | |
1254 | x = Pixel2Col (ev.x); |
1254 | x = Pixel2Col (ev.x); |
1255 | y = Pixel2Row (ev.y); |
1255 | y = Pixel2Row (ev.y); |
1256 | if (ev.type == MotionNotify) { |
1256 | if (ev.type == MotionNotify) |
|
|
1257 | { |
1257 | if (x == mouse_row && y == mouse_col) |
1258 | if (x == mouse_row && y == mouse_col) |
1258 | return; |
1259 | return; |
1259 | mouse_row = x; |
1260 | mouse_row = x; |
1260 | mouse_col = y; |
1261 | mouse_col = y; |
1261 | code += 32; |
1262 | code += 32; |
1262 | } |
1263 | } |
1263 | |
1264 | |
1264 | if (MEvent.button == AnyButton) |
1265 | if (MEvent.button == AnyButton) |
1265 | button_number = 3; |
1266 | button_number = 3; |
1266 | else |
1267 | else |
1267 | { |
1268 | { |
… | |
… | |
1475 | break; |
1476 | break; |
1476 | |
1477 | |
1477 | case MapNotify: |
1478 | case MapNotify: |
1478 | mapped = 1; |
1479 | mapped = 1; |
1479 | #ifdef TEXT_BLINK |
1480 | #ifdef TEXT_BLINK |
1480 | text_blink_ev.start (TEXT_BLINK_INTERVAL); |
1481 | text_blink_ev.start (); |
1481 | #endif |
1482 | #endif |
1482 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1483 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1483 | break; |
1484 | break; |
1484 | |
1485 | |
1485 | case UnmapNotify: |
1486 | case UnmapNotify: |
… | |
… | |
1576 | int dist; |
1577 | int dist; |
1577 | |
1578 | |
1578 | /* don't clobber the current delay if we are |
1579 | /* don't clobber the current delay if we are |
1579 | * already in the middle of scrolling. |
1580 | * already in the middle of scrolling. |
1580 | */ |
1581 | */ |
1581 | if (!sel_scroll_ev.active) |
1582 | if (!sel_scroll_ev.is_active ()) |
1582 | sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
1583 | sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
1583 | |
1584 | |
1584 | /* save the event params so we can highlight |
1585 | /* save the event params so we can highlight |
1585 | * the selection in the pending-scroll loop |
1586 | * the selection in the pending-scroll loop |
1586 | */ |
1587 | */ |
… | |
… | |
1609 | else |
1610 | else |
1610 | { |
1611 | { |
1611 | /* we are within the text window, so we |
1612 | /* we are within the text window, so we |
1612 | * shouldn't be scrolling |
1613 | * shouldn't be scrolling |
1613 | */ |
1614 | */ |
1614 | if (sel_scroll_ev.active) |
|
|
1615 | sel_scroll_ev.stop(); |
1615 | sel_scroll_ev.stop(); |
1616 | } |
1616 | } |
1617 | #endif |
1617 | #endif |
1618 | #ifdef MOUSE_THRESHOLD |
1618 | #ifdef MOUSE_THRESHOLD |
1619 | } |
1619 | } |
1620 | #endif |
1620 | #endif |
… | |
… | |
1684 | XSetICFocus (Input_Context); |
1684 | XSetICFocus (Input_Context); |
1685 | } |
1685 | } |
1686 | #endif |
1686 | #endif |
1687 | #if CURSOR_BLINK |
1687 | #if CURSOR_BLINK |
1688 | if (option (Opt_cursorBlink)) |
1688 | if (option (Opt_cursorBlink)) |
1689 | cursor_blink_ev.start (CURSOR_BLINK_INTERVAL, CURSOR_BLINK_INTERVAL); |
1689 | cursor_blink_ev.again (); |
1690 | #endif |
1690 | #endif |
1691 | #if OFF_FOCUS_FADING |
1691 | #if OFF_FOCUS_FADING |
1692 | if (rs[Rs_fade]) |
1692 | if (rs[Rs_fade]) |
1693 | { |
1693 | { |
1694 | pix_colors = pix_colors_focused; |
1694 | pix_colors = pix_colors_focused; |
… | |
… | |
1849 | mouse_report (ev); |
1849 | mouse_report (ev); |
1850 | } |
1850 | } |
1851 | #else |
1851 | #else |
1852 | MEvent.button = ev.button; |
1852 | MEvent.button = ev.button; |
1853 | mouse_report (ev); |
1853 | mouse_report (ev); |
1854 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
1854 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
1855 | |
1855 | |
1856 | } |
1856 | } |
1857 | else |
1857 | else |
1858 | { |
1858 | { |
1859 | if (ev.button != MEvent.button) |
1859 | if (ev.button != MEvent.button) |
… | |
… | |
1953 | tt_printf ("\033[5~"); |
1953 | tt_printf ("\033[5~"); |
1954 | break; |
1954 | break; |
1955 | } |
1955 | } |
1956 | } |
1956 | } |
1957 | else |
1957 | else |
1958 | #endif /* NO_SCROLLBAR_REPORT */ |
1958 | #endif /* NO_SCROLLBAR_REPORT */ |
1959 | |
1959 | |
1960 | { |
1960 | { |
1961 | char upordown = 0; |
1961 | char upordown = 0; |
1962 | |
1962 | |
1963 | if (scrollBar.style == R_SB_NEXT) |
1963 | if (scrollBar.style == R_SB_NEXT) |
1964 | { |
1964 | { |
1965 | if (scrollbarnext_upButton (ev.y)) |
1965 | if (scrollbarnext_upButton (ev.y)) |
1966 | upordown = -1; /* up */ |
1966 | upordown = -1; /* up */ |
… | |
… | |
1972 | if (scrollbarrxvt_upButton (ev.y)) |
1972 | if (scrollbarrxvt_upButton (ev.y)) |
1973 | upordown = -1; /* up */ |
1973 | upordown = -1; /* up */ |
1974 | else if (scrollbarrxvt_dnButton (ev.y)) |
1974 | else if (scrollbarrxvt_dnButton (ev.y)) |
1975 | upordown = 1; /* down */ |
1975 | upordown = 1; /* down */ |
1976 | } |
1976 | } |
|
|
1977 | |
1977 | if (upordown) |
1978 | if (upordown) |
1978 | { |
1979 | { |
1979 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1980 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
1981 | if (!cont_scroll_ev.is_active ()) |
1980 | cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
1982 | cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
1981 | #endif |
1983 | #endif |
1982 | if (scr_page (upordown < 0 ? UP : DN, 1)) |
1984 | if (scr_page (upordown < 0 ? UP : DN, 1)) |
1983 | { |
1985 | { |
1984 | if (upordown < 0) |
1986 | if (upordown < 0) |
1985 | scrollBar.setUp (); |
1987 | scrollBar.setUp (); |
… | |
… | |
2065 | scrollBar.setIdle (); |
2067 | scrollBar.setIdle (); |
2066 | scrollbar_show (0); |
2068 | scrollbar_show (0); |
2067 | } |
2069 | } |
2068 | |
2070 | |
2069 | #ifdef SELECTION_SCROLLING |
2071 | #ifdef SELECTION_SCROLLING |
2070 | if (sel_scroll_ev.active) |
|
|
2071 | sel_scroll_ev.stop(); |
2072 | sel_scroll_ev.stop(); |
2072 | #endif |
2073 | #endif |
2073 | |
2074 | |
2074 | if (ev.window == vt) |
2075 | if (ev.window == vt) |
2075 | { |
2076 | { |
2076 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
2077 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
… | |
… | |
2100 | mouse_report (ev); |
2101 | mouse_report (ev); |
2101 | } |
2102 | } |
2102 | #else /* MOUSE_REPORT_DOUBLECLICK */ |
2103 | #else /* MOUSE_REPORT_DOUBLECLICK */ |
2103 | MEvent.button = AnyButton; |
2104 | MEvent.button = AnyButton; |
2104 | mouse_report (ev); |
2105 | mouse_report (ev); |
2105 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
2106 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
2106 | return; |
2107 | return; |
2107 | } |
2108 | } |
2108 | |
2109 | |
2109 | /* |
2110 | /* |
2110 | * dumb hack to compensate for the failure of click-and-drag |
2111 | * dumb hack to compensate for the failure of click-and-drag |
… | |
… | |
2148 | { |
2149 | { |
2149 | mouse_slip_wheel_speed += v ? -1 : 1; |
2150 | mouse_slip_wheel_speed += v ? -1 : 1; |
2150 | if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; |
2151 | if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; |
2151 | if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; |
2152 | if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; |
2152 | |
2153 | |
|
|
2154 | if (!slip_wheel_ev.is_active ()) |
2153 | slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
2155 | slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
2154 | } |
2156 | } |
2155 | else |
2157 | else |
2156 | { |
2158 | { |
2157 | # endif |
2159 | # endif |
2158 | scr_page (v, i); |
2160 | scr_page (v, i); |
… | |
… | |
2226 | |
2228 | |
2227 | if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) |
2229 | if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) |
2228 | { |
2230 | { |
2229 | refresh_count = 0; |
2231 | refresh_count = 0; |
2230 | |
2232 | |
2231 | if (!option (Opt_skipScroll) || ev::ev_time () > ev::now () + 1. / 60.) |
2233 | if (!option (Opt_skipScroll) || ev_time () > ev::now () + 1. / 60.) |
2232 | { |
2234 | { |
2233 | refreshnow = true; |
2235 | refreshnow = true; |
2234 | ch = NOCHAR; |
2236 | ch = NOCHAR; |
2235 | break; |
2237 | break; |
2236 | } |
2238 | } |
… | |
… | |
2447 | } |
2449 | } |
2448 | } |
2450 | } |
2449 | |
2451 | |
2450 | pclose_printer (fd); |
2452 | pclose_printer (fd); |
2451 | } |
2453 | } |
2452 | #endif /* PRINTPIPE */ |
2454 | #endif /* PRINTPIPE */ |
2453 | /*}}} */ |
2455 | /*}}} */ |
2454 | |
2456 | |
2455 | /* *INDENT-OFF* */ |
2457 | /* *INDENT-OFF* */ |
2456 | enum { |
2458 | enum { |
2457 | C1_40 = 0x40, |
2459 | C1_40 = 0x40, |
… | |
… | |
2750 | nargs = 0; |
2752 | nargs = 0; |
2751 | |
2753 | |
2752 | priv = 0; |
2754 | priv = 0; |
2753 | ch = cmd_getc (); |
2755 | ch = cmd_getc (); |
2754 | if (ch >= '<' && ch <= '?') |
2756 | if (ch >= '<' && ch <= '?') |
|
|
2757 | { |
2755 | { /* '<' '=' '>' '?' */ |
2758 | /* '<' '=' '>' '?' */ |
2756 | priv = ch; |
2759 | priv = ch; |
2757 | ch = cmd_getc (); |
2760 | ch = cmd_getc (); |
2758 | } |
2761 | } |
2759 | |
2762 | |
2760 | /* read any numerical arguments */ |
2763 | /* read any numerical arguments */ |
… | |
… | |
3580 | { 66, PrivMode_aplKP }, |
3583 | { 66, PrivMode_aplKP }, |
3581 | #ifndef NO_BACKSPACE_KEY |
3584 | #ifndef NO_BACKSPACE_KEY |
3582 | { 67, PrivMode_BackSpace }, |
3585 | { 67, PrivMode_BackSpace }, |
3583 | #endif |
3586 | #endif |
3584 | { 1000, PrivMode_MouseX11 }, |
3587 | { 1000, PrivMode_MouseX11 }, |
3585 | // 1001 Use Hilite Mouse Tracking. NYI, TODO |
|
|
3586 | { 1002, PrivMode_MouseBtnEvent }, |
3588 | { 1002, PrivMode_MouseBtnEvent }, |
3587 | { 1003, PrivMode_MouseAnyEvent }, |
3589 | { 1003, PrivMode_MouseAnyEvent }, |
3588 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3590 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3589 | { 1011, PrivMode_Keypress }, // rxvt extension |
3591 | { 1011, PrivMode_Keypress }, // rxvt extension |
3590 | // 1035 enable modifiers for alt, numlock NYI |
3592 | // 1035 enable modifiers for alt, numlock NYI |
… | |
… | |
3691 | /* case 67: - backspace key */ |
3693 | /* case 67: - backspace key */ |
3692 | case 1000: /* X11 mouse reporting */ |
3694 | case 1000: /* X11 mouse reporting */ |
3693 | if (state) /* orthogonal */ |
3695 | if (state) /* orthogonal */ |
3694 | priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
3696 | priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
3695 | break; |
3697 | break; |
3696 | #if 0 |
|
|
3697 | case 1001: |
|
|
3698 | break; /* X11 mouse highlighting */ |
|
|
3699 | #endif |
|
|
3700 | case 1002: |
3698 | case 1002: |
3701 | case 1003: |
3699 | case 1003: |
3702 | if (state) { |
3700 | if (state) |
|
|
3701 | { |
3703 | priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11); |
3702 | priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11); |
3704 | priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; |
3703 | priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; |
3705 | vt_emask_mouse = PointerMotionMask; |
3704 | vt_emask_mouse = PointerMotionMask; |
|
|
3705 | } |
3706 | } else |
3706 | else |
3707 | vt_emask_mouse = NoEventMask; |
3707 | vt_emask_mouse = NoEventMask; |
3708 | vt_select_input (); |
3708 | vt_select_input (); |
3709 | break; |
3709 | break; |
3710 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3710 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3711 | set_option (Opt_scrollTtyOutput, !state); |
3711 | set_option (Opt_scrollTtyOutput, !state); |
… | |
… | |
3891 | rxvt_term::process_graphics () |
3891 | rxvt_term::process_graphics () |
3892 | { |
3892 | { |
3893 | unicode_t ch, cmd = cmd_getc (); |
3893 | unicode_t ch, cmd = cmd_getc (); |
3894 | |
3894 | |
3895 | if (cmd == 'Q') |
3895 | if (cmd == 'Q') |
|
|
3896 | { |
3896 | { /* query graphics */ |
3897 | /* query graphics */ |
3897 | tt_printf ("\033G0\012"); /* no graphics */ |
3898 | tt_printf ("\033G0\012"); /* no graphics */ |
3898 | return; |
3899 | return; |
3899 | } |
3900 | } |
3900 | /* swallow other graphics sequences until terminating ':' */ |
3901 | /* swallow other graphics sequences until terminating ':' */ |
3901 | do |
3902 | do |