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.221 by root, Sat Dec 31 18:27:57 2005 UTC vs.
Revision 1.229 by root, Tue Jan 3 17:34:44 2006 UTC

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"
53
54#if HAVE_SCHED_YIELD
55# include <sched.h>
56#endif
52 57
53#ifdef KEYSYM_RESOURCE 58#ifdef KEYSYM_RESOURCE
54# include "keyboard.h" 59# include "keyboard.h"
55#endif 60#endif
56 61
980 SET_LOCALE (locale); 985 SET_LOCALE (locale);
981 986
982 display->flush (); 987 display->flush ();
983 988
984 if (want_refresh && !flush_ev.active) 989 if (want_refresh && !flush_ev.active)
985 flush_ev.start (NOW + 0.01); 990 flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally
986} 991}
987 992
988void 993void
989rxvt_term::flush_cb (time_watcher &w) 994rxvt_term::flush_cb (time_watcher &w)
990{ 995{
1065 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1070 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1066 } 1071 }
1067} 1072}
1068#endif 1073#endif
1069 1074
1075#if HAVE_SCHED_YIELD
1076static 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
1070bool 1093bool
1071rxvt_term::pty_fill () 1094rxvt_term::pty_fill ()
1072{ 1095{
1073 ssize_t n = cmdbuf_endp - cmdbuf_ptr; 1096 ssize_t n = cmdbuf_endp - cmdbuf_ptr;
1074 1097
1080 1103
1081 memmove (cmdbuf_base, cmdbuf_ptr, n); 1104 memmove (cmdbuf_base, cmdbuf_ptr, n);
1082 cmdbuf_ptr = cmdbuf_base; 1105 cmdbuf_ptr = cmdbuf_base;
1083 cmdbuf_endp = cmdbuf_ptr + n; 1106 cmdbuf_endp = cmdbuf_ptr + n;
1084 1107
1085 n = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); 1108 ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n);
1086 1109
1087 if (n > 0) 1110 if (r > 0)
1088 { 1111 {
1089 cmdbuf_endp += n; 1112 cmdbuf_endp += r;
1090 return true; 1113 return true;
1091 } 1114 }
1092 else if ((n < 0 && errno != EAGAIN && errno != EINTR) || n == 0) 1115 else if (r < 0 && (errno == EAGAIN || errno == EINTR))
1116 {
1117#if HAVE_SCHED_YIELD
1118 if (display->is_local)
1119 event_handler.cw_yield.start ();
1120#endif
1121 }
1122 else
1093 { 1123 {
1094 pty_ev.stop (); 1124 pty_ev.stop ();
1095 1125
1096 if (!OPTION (Opt_hold)) 1126 if (!OPTION (Opt_hold))
1097 destroy (); 1127 destroy ();
1670{ 1700{
1671 if (!focus) 1701 if (!focus)
1672 { 1702 {
1673 focus = 1; 1703 focus = 1;
1674 want_refresh = 1; 1704 want_refresh = 1;
1705
1706 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1707
1675#if USE_XIM 1708#if USE_XIM
1676 if (Input_Context != NULL) 1709 if (Input_Context != NULL)
1677 { 1710 {
1678 IMSetStatusPosition (); 1711 IMSetStatusPosition ();
1679 XSetICFocus (Input_Context); 1712 XSetICFocus (Input_Context);
1699 if (focus) 1732 if (focus)
1700 { 1733 {
1701 focus = 0; 1734 focus = 0;
1702 want_refresh = 1; 1735 want_refresh = 1;
1703 1736
1737 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1738
1704#if ENABLE_FRILLS || ISO_14755 1739#if ENABLE_FRILLS || ISO_14755
1740 if (iso14755buf)
1741 {
1705 iso14755buf = 0; 1742 iso14755buf = 0;
1706#endif
1707#if ENABLE_OVERLAY 1743# if ENABLE_OVERLAY
1708 scr_overlay_off (); 1744 scr_overlay_off ();
1745# endif
1746 }
1709#endif 1747#endif
1710#if USE_XIM 1748#if USE_XIM
1711 if (Input_Context != NULL) 1749 if (Input_Context != NULL)
1712 XUnsetICFocus (Input_Context); 1750 XUnsetICFocus (Input_Context);
1713#endif 1751#endif
1757rxvt_term::button_press (XButtonEvent &ev) 1795rxvt_term::button_press (XButtonEvent &ev)
1758{ 1796{
1759 int reportmode = 0, clickintime; 1797 int reportmode = 0, clickintime;
1760 1798
1761 bypass_keystate = ev.state & (ModMetaMask | ShiftMask); 1799 bypass_keystate = ev.state & (ModMetaMask | ShiftMask);
1800
1762 if (!bypass_keystate) 1801 if (!bypass_keystate)
1763 reportmode = !! (priv_modes & PrivMode_mouse_report); 1802 reportmode = !! (priv_modes & PrivMode_mouse_report);
1764 1803
1765 /* 1804 /*
1766 * VT window processing of button press 1805 * VT window processing of button press
1815 else 1854 else
1816 { 1855 {
1817 if (ev.button != MEvent.button) 1856 if (ev.button != MEvent.button)
1818 MEvent.clicks = 0; 1857 MEvent.clicks = 0;
1819 1858
1859 if (!PERL_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END)))
1820 switch (ev.button) 1860 switch (ev.button)
1821 { 1861 {
1822 case Button1: 1862 case Button1:
1823 /* allow meta + click to select rectangular areas */ 1863 /* allow meta + click to select rectangular areas */
1824 /* should be done in screen.C */ 1864 /* should be done in screen.C */
1825#if ENABLE_FRILLS 1865#if ENABLE_FRILLS
1826 selection.rect = !!(ev.state & ModMetaMask); 1866 selection.rect = !!(ev.state & ModMetaMask);
1827#else 1867#else
1828 selection.rect = false; 1868 selection.rect = false;
1829#endif 1869#endif
1830 1870
1831 /* allow shift+left click to extend selection */ 1871 /* allow shift+left click to extend selection */
1832 if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) 1872 if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report))
1833 { 1873 {
1834 if (MEvent.button == Button1 && clickintime) 1874 if (MEvent.button == Button1 && clickintime)
1835 selection_rotate (ev.x, ev.y); 1875 selection_rotate (ev.x, ev.y);
1836 else 1876 else
1837 selection_extend (ev.x, ev.y, 1); 1877 selection_extend (ev.x, ev.y, 1);
1838 } 1878 }
1839 else 1879 else
1840 { 1880 {
1841 if (MEvent.button == Button1 && clickintime) 1881 if (MEvent.button == Button1 && clickintime)
1842 MEvent.clicks++; 1882 MEvent.clicks++;
1843 else 1883 else
1844 MEvent.clicks = 1; 1884 MEvent.clicks = 1;
1845 1885
1846 selection_click (MEvent.clicks, ev.x, ev.y); 1886 selection_click (MEvent.clicks, ev.x, ev.y);
1847 } 1887 }
1848 1888
1849 MEvent.button = Button1; 1889 MEvent.button = Button1;
1850 break; 1890 break;
1851 1891
1852 case Button3: 1892 case Button3:
1853 if (MEvent.button == Button3 && clickintime) 1893 if (MEvent.button == Button3 && clickintime)
1854 selection_rotate (ev.x, ev.y); 1894 selection_rotate (ev.x, ev.y);
1855 else 1895 else
1856 selection_extend (ev.x, ev.y, 1); 1896 selection_extend (ev.x, ev.y, 1);
1857 1897
1858 MEvent.button = Button3; 1898 MEvent.button = Button3;
1859 break; 1899 break;
1860 } 1900 }
1861 } 1901 }
1862 1902
1863 MEvent.time = ev.time; 1903 MEvent.time = ev.time;
1864 return; 1904 return;
1865 } 1905 }
1866 1906
2684 2724
2685 if (!OPTION (Opt_jumpScroll) 2725 if (!OPTION (Opt_jumpScroll)
2686 || (refresh_count >= refresh_limit * (nrow - 1))) 2726 || (refresh_count >= refresh_limit * (nrow - 1)))
2687 { 2727 {
2688 refreshnow = true; 2728 refreshnow = true;
2729 refresh_count = 0;
2689 ch = NOCHAR; 2730 ch = NOCHAR;
2690 break; 2731 break;
2691 } 2732 }
2692 2733
2693 // scr_add_lines only works for nlines <= nrow - 1. 2734 // scr_add_lines only works for nlines <= nrow - 1.
2730 refresh_limit++; 2771 refresh_limit++;
2731 else 2772 else
2732 { 2773 {
2733 flag = true; 2774 flag = true;
2734 scr_refresh (refresh_type); 2775 scr_refresh (refresh_type);
2776 flush_ev.stop ();
2735 } 2777 }
2736 } 2778 }
2737 2779
2738 } 2780 }
2739 else 2781 else
4052 case 1021: 4094 case 1021:
4053 if (mode) 4095 if (mode)
4054 SET_OPTION (Opt_intensityStyles); 4096 SET_OPTION (Opt_intensityStyles);
4055 else 4097 else
4056 CLR_OPTION (Opt_intensityStyles); 4098 CLR_OPTION (Opt_intensityStyles);
4099
4100 scr_touch (true);
4101 break;
4057#endif 4102#endif
4058 case 1048: /* alternative cursor save */ 4103 case 1048: /* alternative cursor save */
4059 case 1049: 4104 case 1049:
4060 if (OPTION (Opt_secondaryScreen)) 4105 if (OPTION (Opt_secondaryScreen))
4061 if (mode == 0) 4106 if (mode == 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines