… | |
… | |
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 | |
|
|
54 | #if HAVE_SCHED_YIELD |
|
|
55 | # include <sched.h> |
|
|
56 | #endif |
|
|
57 | |
53 | #ifdef KEYSYM_RESOURCE |
58 | #ifdef KEYSYM_RESOURCE |
54 | # include "keyboard.h" |
59 | # include "keyboard.h" |
55 | #endif |
60 | #endif |
56 | |
61 | |
57 | #include <csignal> |
62 | #include <csignal> |
58 | |
|
|
59 | #define HAVE_SCHED_YIELD 1 //D//TODO//FIXME |
|
|
60 | #if HAVE_SCHED_YIELD |
|
|
61 | # include <sched.h> |
|
|
62 | #endif |
|
|
63 | |
63 | |
64 | /*----------------------------------------------------------------------*/ |
64 | /*----------------------------------------------------------------------*/ |
65 | |
65 | |
66 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
66 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
67 | |
67 | |
… | |
… | |
985 | SET_LOCALE (locale); |
985 | SET_LOCALE (locale); |
986 | |
986 | |
987 | display->flush (); |
987 | display->flush (); |
988 | |
988 | |
989 | if (want_refresh && !flush_ev.active) |
989 | if (want_refresh && !flush_ev.active) |
990 | flush_ev.start (NOW + 0.01); |
990 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
991 | } |
991 | } |
992 | |
992 | |
993 | void |
993 | void |
994 | rxvt_term::flush_cb (time_watcher &w) |
994 | rxvt_term::flush_cb (time_watcher &w) |
995 | { |
995 | { |
… | |
… | |
1070 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1070 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1071 | } |
1071 | } |
1072 | } |
1072 | } |
1073 | #endif |
1073 | #endif |
1074 | |
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 | |
1075 | bool |
1093 | bool |
1076 | rxvt_term::pty_fill () |
1094 | rxvt_term::pty_fill () |
1077 | { |
1095 | { |
1078 | ssize_t n = cmdbuf_endp - cmdbuf_ptr; |
1096 | ssize_t n = cmdbuf_endp - cmdbuf_ptr; |
1079 | |
1097 | |
… | |
… | |
1095 | return true; |
1113 | return true; |
1096 | } |
1114 | } |
1097 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
1115 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
1098 | { |
1116 | { |
1099 | #if HAVE_SCHED_YIELD |
1117 | #if HAVE_SCHED_YIELD |
1100 | sched_yield (); |
1118 | if (display->is_local) |
|
|
1119 | event_handler.cw_yield.start (); |
1101 | #endif |
1120 | #endif |
1102 | } |
1121 | } |
1103 | else |
1122 | else |
1104 | { |
1123 | { |
1105 | pty_ev.stop (); |
1124 | pty_ev.stop (); |
… | |
… | |
1681 | { |
1700 | { |
1682 | if (!focus) |
1701 | if (!focus) |
1683 | { |
1702 | { |
1684 | focus = 1; |
1703 | focus = 1; |
1685 | want_refresh = 1; |
1704 | want_refresh = 1; |
|
|
1705 | |
|
|
1706 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
|
|
1707 | |
1686 | #if USE_XIM |
1708 | #if USE_XIM |
1687 | if (Input_Context != NULL) |
1709 | if (Input_Context != NULL) |
1688 | { |
1710 | { |
1689 | IMSetStatusPosition (); |
1711 | IMSetStatusPosition (); |
1690 | XSetICFocus (Input_Context); |
1712 | XSetICFocus (Input_Context); |
… | |
… | |
1710 | if (focus) |
1732 | if (focus) |
1711 | { |
1733 | { |
1712 | focus = 0; |
1734 | focus = 0; |
1713 | want_refresh = 1; |
1735 | want_refresh = 1; |
1714 | |
1736 | |
|
|
1737 | PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
|
|
1738 | |
1715 | #if ENABLE_FRILLS || ISO_14755 |
1739 | #if ENABLE_FRILLS || ISO_14755 |
|
|
1740 | if (iso14755buf) |
|
|
1741 | { |
1716 | iso14755buf = 0; |
1742 | iso14755buf = 0; |
1717 | #endif |
|
|
1718 | #if ENABLE_OVERLAY |
1743 | # if ENABLE_OVERLAY |
1719 | scr_overlay_off (); |
1744 | scr_overlay_off (); |
|
|
1745 | # endif |
|
|
1746 | } |
1720 | #endif |
1747 | #endif |
1721 | #if USE_XIM |
1748 | #if USE_XIM |
1722 | if (Input_Context != NULL) |
1749 | if (Input_Context != NULL) |
1723 | XUnsetICFocus (Input_Context); |
1750 | XUnsetICFocus (Input_Context); |
1724 | #endif |
1751 | #endif |
… | |
… | |
1768 | rxvt_term::button_press (XButtonEvent &ev) |
1795 | rxvt_term::button_press (XButtonEvent &ev) |
1769 | { |
1796 | { |
1770 | int reportmode = 0, clickintime; |
1797 | int reportmode = 0, clickintime; |
1771 | |
1798 | |
1772 | bypass_keystate = ev.state & (ModMetaMask | ShiftMask); |
1799 | bypass_keystate = ev.state & (ModMetaMask | ShiftMask); |
|
|
1800 | |
1773 | if (!bypass_keystate) |
1801 | if (!bypass_keystate) |
1774 | reportmode = !! (priv_modes & PrivMode_mouse_report); |
1802 | reportmode = !! (priv_modes & PrivMode_mouse_report); |
1775 | |
1803 | |
1776 | /* |
1804 | /* |
1777 | * VT window processing of button press |
1805 | * VT window processing of button press |
… | |
… | |
1826 | else |
1854 | else |
1827 | { |
1855 | { |
1828 | if (ev.button != MEvent.button) |
1856 | if (ev.button != MEvent.button) |
1829 | MEvent.clicks = 0; |
1857 | MEvent.clicks = 0; |
1830 | |
1858 | |
|
|
1859 | if (!PERL_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END))) |
1831 | switch (ev.button) |
1860 | switch (ev.button) |
1832 | { |
1861 | { |
1833 | case Button1: |
1862 | case Button1: |
1834 | /* allow meta + click to select rectangular areas */ |
1863 | /* allow meta + click to select rectangular areas */ |
1835 | /* should be done in screen.C */ |
1864 | /* should be done in screen.C */ |
1836 | #if ENABLE_FRILLS |
1865 | #if ENABLE_FRILLS |
1837 | selection.rect = !!(ev.state & ModMetaMask); |
1866 | selection.rect = !!(ev.state & ModMetaMask); |
1838 | #else |
1867 | #else |
1839 | selection.rect = false; |
1868 | selection.rect = false; |
1840 | #endif |
1869 | #endif |
1841 | |
1870 | |
1842 | /* allow shift+left click to extend selection */ |
1871 | /* allow shift+left click to extend selection */ |
1843 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1872 | if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) |
1844 | { |
1873 | { |
1845 | if (MEvent.button == Button1 && clickintime) |
1874 | if (MEvent.button == Button1 && clickintime) |
1846 | selection_rotate (ev.x, ev.y); |
1875 | selection_rotate (ev.x, ev.y); |
1847 | else |
1876 | else |
1848 | selection_extend (ev.x, ev.y, 1); |
1877 | selection_extend (ev.x, ev.y, 1); |
1849 | } |
1878 | } |
1850 | else |
1879 | else |
1851 | { |
1880 | { |
1852 | if (MEvent.button == Button1 && clickintime) |
1881 | if (MEvent.button == Button1 && clickintime) |
1853 | MEvent.clicks++; |
1882 | MEvent.clicks++; |
1854 | else |
1883 | else |
1855 | MEvent.clicks = 1; |
1884 | MEvent.clicks = 1; |
1856 | |
1885 | |
1857 | selection_click (MEvent.clicks, ev.x, ev.y); |
1886 | selection_click (MEvent.clicks, ev.x, ev.y); |
1858 | } |
1887 | } |
1859 | |
1888 | |
1860 | MEvent.button = Button1; |
1889 | MEvent.button = Button1; |
1861 | break; |
1890 | break; |
1862 | |
1891 | |
1863 | case Button3: |
1892 | case Button3: |
1864 | if (MEvent.button == Button3 && clickintime) |
1893 | if (MEvent.button == Button3 && clickintime) |
1865 | selection_rotate (ev.x, ev.y); |
1894 | selection_rotate (ev.x, ev.y); |
1866 | else |
1895 | else |
1867 | selection_extend (ev.x, ev.y, 1); |
1896 | selection_extend (ev.x, ev.y, 1); |
1868 | |
1897 | |
1869 | MEvent.button = Button3; |
1898 | MEvent.button = Button3; |
1870 | break; |
1899 | break; |
1871 | } |
1900 | } |
1872 | } |
1901 | } |
1873 | |
1902 | |
1874 | MEvent.time = ev.time; |
1903 | MEvent.time = ev.time; |
1875 | return; |
1904 | return; |
1876 | } |
1905 | } |
1877 | |
1906 | |
… | |
… | |
2695 | |
2724 | |
2696 | if (!OPTION (Opt_jumpScroll) |
2725 | if (!OPTION (Opt_jumpScroll) |
2697 | || (refresh_count >= refresh_limit * (nrow - 1))) |
2726 | || (refresh_count >= refresh_limit * (nrow - 1))) |
2698 | { |
2727 | { |
2699 | refreshnow = true; |
2728 | refreshnow = true; |
|
|
2729 | refresh_count = 0; |
2700 | ch = NOCHAR; |
2730 | ch = NOCHAR; |
2701 | break; |
2731 | break; |
2702 | } |
2732 | } |
2703 | |
2733 | |
2704 | // scr_add_lines only works for nlines <= nrow - 1. |
2734 | // scr_add_lines only works for nlines <= nrow - 1. |
… | |
… | |
2741 | refresh_limit++; |
2771 | refresh_limit++; |
2742 | else |
2772 | else |
2743 | { |
2773 | { |
2744 | flag = true; |
2774 | flag = true; |
2745 | scr_refresh (refresh_type); |
2775 | scr_refresh (refresh_type); |
|
|
2776 | flush_ev.stop (); |
2746 | } |
2777 | } |
2747 | } |
2778 | } |
2748 | |
2779 | |
2749 | } |
2780 | } |
2750 | else |
2781 | else |
… | |
… | |
4064 | if (mode) |
4095 | if (mode) |
4065 | SET_OPTION (Opt_intensityStyles); |
4096 | SET_OPTION (Opt_intensityStyles); |
4066 | else |
4097 | else |
4067 | CLR_OPTION (Opt_intensityStyles); |
4098 | CLR_OPTION (Opt_intensityStyles); |
4068 | |
4099 | |
4069 | want_refresh = 1; |
4100 | scr_touch (true); |
4070 | want_full_refresh = 1; |
|
|
4071 | break; |
4101 | break; |
4072 | #endif |
4102 | #endif |
4073 | case 1048: /* alternative cursor save */ |
4103 | case 1048: /* alternative cursor save */ |
4074 | case 1049: |
4104 | case 1049: |
4075 | if (OPTION (Opt_secondaryScreen)) |
4105 | if (OPTION (Opt_secondaryScreen)) |