… | |
… | |
43 | * along with this program; if not, write to the Free Software |
43 | * along with this program; if not, write to the Free Software |
44 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
44 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
45 | *----------------------------------------------------------------------*/ |
45 | *----------------------------------------------------------------------*/ |
46 | |
46 | |
47 | /*{{{ includes: */ |
47 | /*{{{ includes: */ |
48 | #include "../config.h" /* NECESSARY */ |
48 | #include "../config.h" |
49 | #include "rxvt.h" /* NECESSARY */ |
49 | #include "rxvt.h" |
|
|
50 | #include "rxvtperl.h" |
50 | #include "version.h" |
51 | #include "version.h" |
51 | #include "command.h" |
52 | #include "command.h" |
52 | |
53 | |
53 | #if HAVE_SCHED_YIELD |
54 | #if HAVE_SCHED_YIELD |
54 | # include <sched.h> |
55 | # include <sched.h> |
… | |
… | |
984 | SET_LOCALE (locale); |
985 | SET_LOCALE (locale); |
985 | |
986 | |
986 | display->flush (); |
987 | display->flush (); |
987 | |
988 | |
988 | if (want_refresh && !flush_ev.active) |
989 | if (want_refresh && !flush_ev.active) |
989 | flush_ev.start (NOW + 0.01); |
990 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
990 | } |
991 | } |
991 | |
992 | |
992 | void |
993 | void |
993 | rxvt_term::flush_cb (time_watcher &w) |
994 | rxvt_term::flush_cb (time_watcher &w) |
994 | { |
995 | { |
… | |
… | |
1069 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1070 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1070 | } |
1071 | } |
1071 | } |
1072 | } |
1072 | #endif |
1073 | #endif |
1073 | |
1074 | |
|
|
1075 | #if HAVE_SCHED_YIELD |
|
|
1076 | static struct event_handler |
|
|
1077 | { |
|
|
1078 | check_watcher cw_yield; |
|
|
1079 | |
|
|
1080 | void yield (check_watcher &w) |
|
|
1081 | { |
|
|
1082 | sched_yield (); |
|
|
1083 | w.stop (); |
|
|
1084 | } |
|
|
1085 | |
|
|
1086 | event_handler () |
|
|
1087 | : cw_yield (this, &event_handler::yield) |
|
|
1088 | { |
|
|
1089 | } |
|
|
1090 | } event_handler; |
|
|
1091 | #endif |
|
|
1092 | |
1074 | bool |
1093 | bool |
1075 | rxvt_term::pty_fill () |
1094 | rxvt_term::pty_fill () |
1076 | { |
1095 | { |
1077 | ssize_t n = cmdbuf_endp - cmdbuf_ptr; |
1096 | ssize_t n = cmdbuf_endp - cmdbuf_ptr; |
1078 | |
1097 | |
… | |
… | |
1094 | return true; |
1113 | return true; |
1095 | } |
1114 | } |
1096 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
1115 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
1097 | { |
1116 | { |
1098 | #if HAVE_SCHED_YIELD |
1117 | #if HAVE_SCHED_YIELD |
1099 | sched_yield (); |
1118 | if (display->is_local) |
|
|
1119 | event_handler.cw_yield.start (); |
1100 | #endif |
1120 | #endif |
1101 | } |
1121 | } |
1102 | else |
1122 | else |
1103 | { |
1123 | { |
1104 | pty_ev.stop (); |
1124 | pty_ev.stop (); |
… | |
… | |
1680 | { |
1700 | { |
1681 | if (!focus) |
1701 | if (!focus) |
1682 | { |
1702 | { |
1683 | focus = 1; |
1703 | focus = 1; |
1684 | want_refresh = 1; |
1704 | want_refresh = 1; |
|
|
1705 | |
|
|
1706 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
|
|
1707 | |
1685 | #if USE_XIM |
1708 | #if USE_XIM |
1686 | if (Input_Context != NULL) |
1709 | if (Input_Context != NULL) |
1687 | { |
1710 | { |
1688 | IMSetStatusPosition (); |
1711 | IMSetStatusPosition (); |
1689 | XSetICFocus (Input_Context); |
1712 | XSetICFocus (Input_Context); |
… | |
… | |
1709 | if (focus) |
1732 | if (focus) |
1710 | { |
1733 | { |
1711 | focus = 0; |
1734 | focus = 0; |
1712 | want_refresh = 1; |
1735 | want_refresh = 1; |
1713 | |
1736 | |
|
|
1737 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
|
|
1738 | |
1714 | #if ENABLE_FRILLS || ISO_14755 |
1739 | #if ENABLE_FRILLS || ISO_14755 |
|
|
1740 | if (iso14755buf) |
|
|
1741 | { |
1715 | iso14755buf = 0; |
1742 | iso14755buf = 0; |
1716 | #endif |
|
|
1717 | #if ENABLE_OVERLAY |
1743 | # if ENABLE_OVERLAY |
1718 | scr_overlay_off (); |
1744 | scr_overlay_off (); |
|
|
1745 | # endif |
|
|
1746 | } |
1719 | #endif |
1747 | #endif |
1720 | #if USE_XIM |
1748 | #if USE_XIM |
1721 | if (Input_Context != NULL) |
1749 | if (Input_Context != NULL) |
1722 | XUnsetICFocus (Input_Context); |
1750 | XUnsetICFocus (Input_Context); |
1723 | #endif |
1751 | #endif |
… | |
… | |
1767 | rxvt_term::button_press (XButtonEvent &ev) |
1795 | rxvt_term::button_press (XButtonEvent &ev) |
1768 | { |
1796 | { |
1769 | int reportmode = 0, clickintime; |
1797 | int reportmode = 0, clickintime; |
1770 | |
1798 | |
1771 | bypass_keystate = ev.state & (ModMetaMask | ShiftMask); |
1799 | bypass_keystate = ev.state & (ModMetaMask | ShiftMask); |
|
|
1800 | |
1772 | if (!bypass_keystate) |
1801 | if (!bypass_keystate) |
1773 | reportmode = !! (priv_modes & PrivMode_mouse_report); |
1802 | reportmode = !! (priv_modes & PrivMode_mouse_report); |
1774 | |
1803 | |
1775 | /* |
1804 | /* |
1776 | * VT window processing of button press |
1805 | * VT window processing of button press |
… | |
… | |
1825 | else |
1854 | else |
1826 | { |
1855 | { |
1827 | if (ev.button != MEvent.button) |
1856 | if (ev.button != MEvent.button) |
1828 | MEvent.clicks = 0; |
1857 | MEvent.clicks = 0; |
1829 | |
1858 | |
|
|
1859 | if (!PERL_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END))) |
1830 | switch (ev.button) |
1860 | switch (ev.button) |
1831 | { |
1861 | { |
1832 | case Button1: |
1862 | case Button1: |
1833 | /* allow meta + click to select rectangular areas */ |
1863 | /* allow meta + click to select rectangular areas */ |
1834 | /* should be done in screen.C */ |
1864 | /* should be done in screen.C */ |
1835 | #if ENABLE_FRILLS |
1865 | #if ENABLE_FRILLS |
1836 | selection.rect = !!(ev.state & ModMetaMask); |
1866 | selection.rect = !!(ev.state & ModMetaMask); |
1837 | #else |
1867 | #else |
1838 | selection.rect = false; |
1868 | selection.rect = false; |
1839 | #endif |
1869 | #endif |
1840 | |
1870 | |
1841 | /* allow shift+left click to extend selection */ |
1871 | /* allow shift+left click to extend selection */ |
1842 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1872 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1843 | { |
1873 | { |
1844 | if (MEvent.button == Button1 && clickintime) |
1874 | if (MEvent.button == Button1 && clickintime) |
1845 | selection_rotate (ev.x, ev.y); |
1875 | selection_rotate (ev.x, ev.y); |
1846 | else |
1876 | else |
1847 | selection_extend (ev.x, ev.y, 1); |
1877 | selection_extend (ev.x, ev.y, 1); |
1848 | } |
1878 | } |
1849 | else |
1879 | else |
1850 | { |
1880 | { |
1851 | if (MEvent.button == Button1 && clickintime) |
1881 | if (MEvent.button == Button1 && clickintime) |
1852 | MEvent.clicks++; |
1882 | MEvent.clicks++; |
1853 | else |
1883 | else |
1854 | MEvent.clicks = 1; |
1884 | MEvent.clicks = 1; |
1855 | |
1885 | |
1856 | selection_click (MEvent.clicks, ev.x, ev.y); |
1886 | selection_click (MEvent.clicks, ev.x, ev.y); |
1857 | } |
1887 | } |
1858 | |
1888 | |
1859 | MEvent.button = Button1; |
1889 | MEvent.button = Button1; |
1860 | break; |
1890 | break; |
1861 | |
1891 | |
1862 | case Button3: |
1892 | case Button3: |
1863 | if (MEvent.button == Button3 && clickintime) |
1893 | if (MEvent.button == Button3 && clickintime) |
1864 | selection_rotate (ev.x, ev.y); |
1894 | selection_rotate (ev.x, ev.y); |
1865 | else |
1895 | else |
1866 | selection_extend (ev.x, ev.y, 1); |
1896 | selection_extend (ev.x, ev.y, 1); |
1867 | |
1897 | |
1868 | MEvent.button = Button3; |
1898 | MEvent.button = Button3; |
1869 | break; |
1899 | break; |
1870 | } |
1900 | } |
1871 | } |
1901 | } |
1872 | |
1902 | |
1873 | MEvent.time = ev.time; |
1903 | MEvent.time = ev.time; |
1874 | return; |
1904 | return; |
1875 | } |
1905 | } |
1876 | |
1906 | |
… | |
… | |
2694 | |
2724 | |
2695 | if (!OPTION (Opt_jumpScroll) |
2725 | if (!OPTION (Opt_jumpScroll) |
2696 | || (refresh_count >= refresh_limit * (nrow - 1))) |
2726 | || (refresh_count >= refresh_limit * (nrow - 1))) |
2697 | { |
2727 | { |
2698 | refreshnow = true; |
2728 | refreshnow = true; |
|
|
2729 | refresh_count = 0; |
2699 | ch = NOCHAR; |
2730 | ch = NOCHAR; |
2700 | break; |
2731 | break; |
2701 | } |
2732 | } |
2702 | |
2733 | |
2703 | // scr_add_lines only works for nlines <= nrow - 1. |
2734 | // scr_add_lines only works for nlines <= nrow - 1. |
… | |
… | |
2740 | refresh_limit++; |
2771 | refresh_limit++; |
2741 | else |
2772 | else |
2742 | { |
2773 | { |
2743 | flag = true; |
2774 | flag = true; |
2744 | scr_refresh (refresh_type); |
2775 | scr_refresh (refresh_type); |
|
|
2776 | flush_ev.stop (); |
2745 | } |
2777 | } |
2746 | } |
2778 | } |
2747 | |
2779 | |
2748 | } |
2780 | } |
2749 | else |
2781 | else |
… | |
… | |
3929 | } |
3961 | } |
3930 | break; |
3962 | break; |
3931 | |
3963 | |
3932 | case URxvt_view_up: |
3964 | case URxvt_view_up: |
3933 | case URxvt_view_down: |
3965 | case URxvt_view_down: |
|
|
3966 | { |
3934 | int lines = atoi (str); |
3967 | int lines = atoi (str); |
3935 | |
3968 | |
3936 | if (lines) |
3969 | if (lines) |
3937 | scr_page (op == URxvt_view_up ? UP : DN, lines); |
3970 | scr_page (op == URxvt_view_up ? UP : DN, lines); |
3938 | else |
3971 | else |
3939 | { |
|
|
3940 | scr_erase_savelines (); |
3972 | scr_erase_savelines (); |
3941 | } |
3973 | } |
3942 | |
3974 | |
|
|
3975 | break; |
|
|
3976 | #endif |
|
|
3977 | |
|
|
3978 | #if ENABLE_PERL |
|
|
3979 | case URxvt_perl: |
|
|
3980 | if (PERL_INVOKE ((this, HOOK_OSC_SEQ, DT_STRING, str, DT_END))) |
|
|
3981 | ; // no responses yet |
3943 | break; |
3982 | break; |
3944 | #endif |
3983 | #endif |
3945 | } |
3984 | } |
3946 | } |
3985 | } |
3947 | /*----------------------------------------------------------------------*/ |
3986 | /*----------------------------------------------------------------------*/ |
… | |
… | |
4063 | if (mode) |
4102 | if (mode) |
4064 | SET_OPTION (Opt_intensityStyles); |
4103 | SET_OPTION (Opt_intensityStyles); |
4065 | else |
4104 | else |
4066 | CLR_OPTION (Opt_intensityStyles); |
4105 | CLR_OPTION (Opt_intensityStyles); |
4067 | |
4106 | |
4068 | want_refresh = 1; |
4107 | scr_touch (true); |
4069 | want_full_refresh = 1; |
|
|
4070 | break; |
4108 | break; |
4071 | #endif |
4109 | #endif |
4072 | case 1048: /* alternative cursor save */ |
4110 | case 1048: /* alternative cursor save */ |
4073 | case 1049: |
4111 | case 1049: |
4074 | if (OPTION (Opt_secondaryScreen)) |
4112 | if (OPTION (Opt_secondaryScreen)) |