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.226 by root, Sun Jan 1 15:03:49 2006 UTC vs.
Revision 1.233 by root, Wed Jan 4 01:16:34 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"
52 53
53#if HAVE_SCHED_YIELD 54#if HAVE_SCHED_YIELD
55#undef HAVE_SCHED_YIELD // disabled for the time being
54# include <sched.h> 56//# include <sched.h>
55#endif 57#endif
56 58
57#ifdef KEYSYM_RESOURCE 59#ifdef KEYSYM_RESOURCE
58# include "keyboard.h" 60# include "keyboard.h"
59#endif 61#endif
1069 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1071 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1070 } 1072 }
1071} 1073}
1072#endif 1074#endif
1073 1075
1076#if HAVE_SCHED_YIELD
1077static struct event_handler
1078{
1079 check_watcher cw_yield;
1080
1081 void yield (check_watcher &w)
1082 {
1083 sched_yield ();
1084 w.stop ();
1085 }
1086
1087 event_handler ()
1088 : cw_yield (this, &event_handler::yield)
1089 {
1090 }
1091} event_handler;
1092#endif
1093
1074bool 1094bool
1075rxvt_term::pty_fill () 1095rxvt_term::pty_fill ()
1076{ 1096{
1077 ssize_t n = cmdbuf_endp - cmdbuf_ptr; 1097 ssize_t n = cmdbuf_endp - cmdbuf_ptr;
1078 1098
1079 if (CBUFSIZ == n) 1099 if (CBUFSIZ == n)
1080 { 1100 {
1081 rxvt_warn ("pty_fill on full buffer, draining input, continuing.\n"); 1101 rxvt_warn ("PLEASE REPORT: pty_fill on full buffer, draining input, continuing.\n");
1082 n = 0; 1102 n = 0;
1083 } 1103 }
1084 1104
1085 memmove (cmdbuf_base, cmdbuf_ptr, n); 1105 memmove (cmdbuf_base, cmdbuf_ptr, n);
1086 cmdbuf_ptr = cmdbuf_base; 1106 cmdbuf_ptr = cmdbuf_base;
1094 return true; 1114 return true;
1095 } 1115 }
1096 else if (r < 0 && (errno == EAGAIN || errno == EINTR)) 1116 else if (r < 0 && (errno == EAGAIN || errno == EINTR))
1097 { 1117 {
1098#if HAVE_SCHED_YIELD 1118#if HAVE_SCHED_YIELD
1099 sched_yield (); 1119 if (display->is_local)
1120 event_handler.cw_yield.start ();
1100#endif 1121#endif
1101 } 1122 }
1102 else 1123 else
1103 { 1124 {
1104 pty_ev.stop (); 1125 pty_ev.stop ();
1680{ 1701{
1681 if (!focus) 1702 if (!focus)
1682 { 1703 {
1683 focus = 1; 1704 focus = 1;
1684 want_refresh = 1; 1705 want_refresh = 1;
1706
1707 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1708
1685#if USE_XIM 1709#if USE_XIM
1686 if (Input_Context != NULL) 1710 if (Input_Context != NULL)
1687 { 1711 {
1688 IMSetStatusPosition (); 1712 IMSetStatusPosition ();
1689 XSetICFocus (Input_Context); 1713 XSetICFocus (Input_Context);
1709 if (focus) 1733 if (focus)
1710 { 1734 {
1711 focus = 0; 1735 focus = 0;
1712 want_refresh = 1; 1736 want_refresh = 1;
1713 1737
1738 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1739
1714#if ENABLE_FRILLS || ISO_14755 1740#if ENABLE_FRILLS || ISO_14755
1741 if (iso14755buf)
1742 {
1715 iso14755buf = 0; 1743 iso14755buf = 0;
1716#endif
1717#if ENABLE_OVERLAY 1744# if ENABLE_OVERLAY
1718 scr_overlay_off (); 1745 scr_overlay_off ();
1746# endif
1747 }
1719#endif 1748#endif
1720#if USE_XIM 1749#if USE_XIM
1721 if (Input_Context != NULL) 1750 if (Input_Context != NULL)
1722 XUnsetICFocus (Input_Context); 1751 XUnsetICFocus (Input_Context);
1723#endif 1752#endif
1767rxvt_term::button_press (XButtonEvent &ev) 1796rxvt_term::button_press (XButtonEvent &ev)
1768{ 1797{
1769 int reportmode = 0, clickintime; 1798 int reportmode = 0, clickintime;
1770 1799
1771 bypass_keystate = ev.state & (ModMetaMask | ShiftMask); 1800 bypass_keystate = ev.state & (ModMetaMask | ShiftMask);
1801
1772 if (!bypass_keystate) 1802 if (!bypass_keystate)
1773 reportmode = !! (priv_modes & PrivMode_mouse_report); 1803 reportmode = !! (priv_modes & PrivMode_mouse_report);
1774 1804
1775 /* 1805 /*
1776 * VT window processing of button press 1806 * VT window processing of button press
1825 else 1855 else
1826 { 1856 {
1827 if (ev.button != MEvent.button) 1857 if (ev.button != MEvent.button)
1828 MEvent.clicks = 0; 1858 MEvent.clicks = 0;
1829 1859
1860 if (!PERL_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END)))
1830 switch (ev.button) 1861 switch (ev.button)
1831 { 1862 {
1832 case Button1: 1863 case Button1:
1833 /* allow meta + click to select rectangular areas */ 1864 /* allow meta + click to select rectangular areas */
1834 /* should be done in screen.C */ 1865 /* should be done in screen.C */
1835#if ENABLE_FRILLS 1866#if ENABLE_FRILLS
1836 selection.rect = !!(ev.state & ModMetaMask); 1867 selection.rect = !!(ev.state & ModMetaMask);
1837#else 1868#else
1838 selection.rect = false; 1869 selection.rect = false;
1839#endif 1870#endif
1840 1871
1841 /* allow shift+left click to extend selection */ 1872 /* allow shift+left click to extend selection */
1842 if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) 1873 if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report))
1843 { 1874 {
1844 if (MEvent.button == Button1 && clickintime) 1875 if (MEvent.button == Button1 && clickintime)
1845 selection_rotate (ev.x, ev.y); 1876 selection_rotate (ev.x, ev.y);
1846 else 1877 else
1847 selection_extend (ev.x, ev.y, 1); 1878 selection_extend (ev.x, ev.y, 1);
1848 } 1879 }
1849 else 1880 else
1850 { 1881 {
1851 if (MEvent.button == Button1 && clickintime) 1882 if (MEvent.button == Button1 && clickintime)
1852 MEvent.clicks++; 1883 MEvent.clicks++;
1853 else 1884 else
1854 MEvent.clicks = 1; 1885 MEvent.clicks = 1;
1855 1886
1856 selection_click (MEvent.clicks, ev.x, ev.y); 1887 selection_click (MEvent.clicks, ev.x, ev.y);
1857 } 1888 }
1858 1889
1859 MEvent.button = Button1; 1890 MEvent.button = Button1;
1860 break; 1891 break;
1861 1892
1862 case Button3: 1893 case Button3:
1863 if (MEvent.button == Button3 && clickintime) 1894 if (MEvent.button == Button3 && clickintime)
1864 selection_rotate (ev.x, ev.y); 1895 selection_rotate (ev.x, ev.y);
1865 else 1896 else
1866 selection_extend (ev.x, ev.y, 1); 1897 selection_extend (ev.x, ev.y, 1);
1867 1898
1868 MEvent.button = Button3; 1899 MEvent.button = Button3;
1869 break; 1900 break;
1870 } 1901 }
1871 } 1902 }
1872 1903
1873 MEvent.time = ev.time; 1904 MEvent.time = ev.time;
1874 return; 1905 return;
1875 } 1906 }
1876 1907
3931 } 3962 }
3932 break; 3963 break;
3933 3964
3934 case URxvt_view_up: 3965 case URxvt_view_up:
3935 case URxvt_view_down: 3966 case URxvt_view_down:
3967 {
3936 int lines = atoi (str); 3968 int lines = atoi (str);
3937 3969
3938 if (lines) 3970 if (lines)
3939 scr_page (op == URxvt_view_up ? UP : DN, lines); 3971 scr_page (op == URxvt_view_up ? UP : DN, lines);
3940 else 3972 else
3941 {
3942 scr_erase_savelines (); 3973 scr_erase_savelines ();
3943 } 3974 }
3944 3975
3976 break;
3977#endif
3978
3979#if ENABLE_PERL
3980 case URxvt_perl:
3981 if (PERL_INVOKE ((this, HOOK_OSC_SEQ, DT_STRING, str, DT_END)))
3982 ; // no responses yet
3945 break; 3983 break;
3946#endif 3984#endif
3947 } 3985 }
3948} 3986}
3949/*----------------------------------------------------------------------*/ 3987/*----------------------------------------------------------------------*/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines