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.220 by root, Sat Dec 31 18:19:06 2005 UTC vs.
Revision 1.232 by root, Wed Jan 4 01:10:08 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#undef HAVE_SCHED_YIELD // disabled for the time being
56//# include <sched.h>
57#endif
52 58
53#ifdef KEYSYM_RESOURCE 59#ifdef KEYSYM_RESOURCE
54# include "keyboard.h" 60# include "keyboard.h"
55#endif 61#endif
56 62
980 SET_LOCALE (locale); 986 SET_LOCALE (locale);
981 987
982 display->flush (); 988 display->flush ();
983 989
984 if (want_refresh && !flush_ev.active) 990 if (want_refresh && !flush_ev.active)
985 flush_ev.start (NOW + 0.01); 991 flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally
986} 992}
987 993
988void 994void
989rxvt_term::flush_cb (time_watcher &w) 995rxvt_term::flush_cb (time_watcher &w)
990{ 996{
1065 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1071 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1066 } 1072 }
1067} 1073}
1068#endif 1074#endif
1069 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
1070bool 1094bool
1071rxvt_term::pty_fill () 1095rxvt_term::pty_fill ()
1072{ 1096{
1073 ssize_t n = cmdbuf_endp - cmdbuf_ptr; 1097 ssize_t n = cmdbuf_endp - cmdbuf_ptr;
1074 1098
1080 1104
1081 memmove (cmdbuf_base, cmdbuf_ptr, n); 1105 memmove (cmdbuf_base, cmdbuf_ptr, n);
1082 cmdbuf_ptr = cmdbuf_base; 1106 cmdbuf_ptr = cmdbuf_base;
1083 cmdbuf_endp = cmdbuf_ptr + n; 1107 cmdbuf_endp = cmdbuf_ptr + n;
1084 1108
1085 n = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); 1109 ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n);
1086 1110
1087 if (n > 0) 1111 if (r > 0)
1088 { 1112 {
1089 cmdbuf_endp += n; 1113 cmdbuf_endp += r;
1090 return true; 1114 return true;
1091 } 1115 }
1092 else if ((n < 0 && errno != EAGAIN && errno != EINTR) || n == 0) 1116 else if (r < 0 && (errno == EAGAIN || errno == EINTR))
1117 {
1118#if HAVE_SCHED_YIELD
1119 if (display->is_local)
1120 event_handler.cw_yield.start ();
1121#endif
1122 }
1123 else
1093 { 1124 {
1094 pty_ev.stop (); 1125 pty_ev.stop ();
1095 1126
1096 if (!OPTION (Opt_hold)) 1127 if (!OPTION (Opt_hold))
1097 destroy (); 1128 destroy ();
1670{ 1701{
1671 if (!focus) 1702 if (!focus)
1672 { 1703 {
1673 focus = 1; 1704 focus = 1;
1674 want_refresh = 1; 1705 want_refresh = 1;
1706
1707 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1708
1675#if USE_XIM 1709#if USE_XIM
1676 if (Input_Context != NULL) 1710 if (Input_Context != NULL)
1677 { 1711 {
1678 IMSetStatusPosition (); 1712 IMSetStatusPosition ();
1679 XSetICFocus (Input_Context); 1713 XSetICFocus (Input_Context);
1699 if (focus) 1733 if (focus)
1700 { 1734 {
1701 focus = 0; 1735 focus = 0;
1702 want_refresh = 1; 1736 want_refresh = 1;
1703 1737
1738 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1739
1704#if ENABLE_FRILLS || ISO_14755 1740#if ENABLE_FRILLS || ISO_14755
1741 if (iso14755buf)
1742 {
1705 iso14755buf = 0; 1743 iso14755buf = 0;
1706#endif
1707#if ENABLE_OVERLAY 1744# if ENABLE_OVERLAY
1708 scr_overlay_off (); 1745 scr_overlay_off ();
1746# endif
1747 }
1709#endif 1748#endif
1710#if USE_XIM 1749#if USE_XIM
1711 if (Input_Context != NULL) 1750 if (Input_Context != NULL)
1712 XUnsetICFocus (Input_Context); 1751 XUnsetICFocus (Input_Context);
1713#endif 1752#endif
1757rxvt_term::button_press (XButtonEvent &ev) 1796rxvt_term::button_press (XButtonEvent &ev)
1758{ 1797{
1759 int reportmode = 0, clickintime; 1798 int reportmode = 0, clickintime;
1760 1799
1761 bypass_keystate = ev.state & (ModMetaMask | ShiftMask); 1800 bypass_keystate = ev.state & (ModMetaMask | ShiftMask);
1801
1762 if (!bypass_keystate) 1802 if (!bypass_keystate)
1763 reportmode = !! (priv_modes & PrivMode_mouse_report); 1803 reportmode = !! (priv_modes & PrivMode_mouse_report);
1764 1804
1765 /* 1805 /*
1766 * VT window processing of button press 1806 * VT window processing of button press
1815 else 1855 else
1816 { 1856 {
1817 if (ev.button != MEvent.button) 1857 if (ev.button != MEvent.button)
1818 MEvent.clicks = 0; 1858 MEvent.clicks = 0;
1819 1859
1860 if (!PERL_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END)))
1820 switch (ev.button) 1861 switch (ev.button)
1821 { 1862 {
1822 case Button1: 1863 case Button1:
1823 /* allow meta + click to select rectangular areas */ 1864 /* allow meta + click to select rectangular areas */
1824 /* should be done in screen.C */ 1865 /* should be done in screen.C */
1825#if ENABLE_FRILLS 1866#if ENABLE_FRILLS
1826 selection.rect = !!(ev.state & ModMetaMask); 1867 selection.rect = !!(ev.state & ModMetaMask);
1827#else 1868#else
1828 selection.rect = false; 1869 selection.rect = false;
1829#endif 1870#endif
1830 1871
1831 /* allow shift+left click to extend selection */ 1872 /* allow shift+left click to extend selection */
1832 if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) 1873 if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report))
1833 { 1874 {
1834 if (MEvent.button == Button1 && clickintime) 1875 if (MEvent.button == Button1 && clickintime)
1835 selection_rotate (ev.x, ev.y); 1876 selection_rotate (ev.x, ev.y);
1836 else 1877 else
1837 selection_extend (ev.x, ev.y, 1); 1878 selection_extend (ev.x, ev.y, 1);
1838 } 1879 }
1839 else 1880 else
1840 { 1881 {
1841 if (MEvent.button == Button1 && clickintime) 1882 if (MEvent.button == Button1 && clickintime)
1842 MEvent.clicks++; 1883 MEvent.clicks++;
1843 else 1884 else
1844 MEvent.clicks = 1; 1885 MEvent.clicks = 1;
1845 1886
1846 selection_click (MEvent.clicks, ev.x, ev.y); 1887 selection_click (MEvent.clicks, ev.x, ev.y);
1847 } 1888 }
1848 1889
1849 MEvent.button = Button1; 1890 MEvent.button = Button1;
1850 break; 1891 break;
1851 1892
1852 case Button3: 1893 case Button3:
1853 if (MEvent.button == Button3 && clickintime) 1894 if (MEvent.button == Button3 && clickintime)
1854 selection_rotate (ev.x, ev.y); 1895 selection_rotate (ev.x, ev.y);
1855 else 1896 else
1856 selection_extend (ev.x, ev.y, 1); 1897 selection_extend (ev.x, ev.y, 1);
1857 1898
1858 MEvent.button = Button3; 1899 MEvent.button = Button3;
1859 break; 1900 break;
1860 } 1901 }
1861 } 1902 }
1862 1903
1863 MEvent.time = ev.time; 1904 MEvent.time = ev.time;
1864 return; 1905 return;
1865 } 1906 }
1866 1907
2684 2725
2685 if (!OPTION (Opt_jumpScroll) 2726 if (!OPTION (Opt_jumpScroll)
2686 || (refresh_count >= refresh_limit * (nrow - 1))) 2727 || (refresh_count >= refresh_limit * (nrow - 1)))
2687 { 2728 {
2688 refreshnow = true; 2729 refreshnow = true;
2730 refresh_count = 0;
2689 ch = NOCHAR; 2731 ch = NOCHAR;
2690 break; 2732 break;
2691 } 2733 }
2692 2734
2693 // scr_add_lines only works for nlines <= nrow - 1. 2735 // scr_add_lines only works for nlines <= nrow - 1.
2730 refresh_limit++; 2772 refresh_limit++;
2731 else 2773 else
2732 { 2774 {
2733 flag = true; 2775 flag = true;
2734 scr_refresh (refresh_type); 2776 scr_refresh (refresh_type);
2777 flush_ev.stop ();
2735 } 2778 }
2736 } 2779 }
2737 2780
2738 } 2781 }
2739 else 2782 else
3919 } 3962 }
3920 break; 3963 break;
3921 3964
3922 case URxvt_view_up: 3965 case URxvt_view_up:
3923 case URxvt_view_down: 3966 case URxvt_view_down:
3967 {
3924 int lines = atoi (str); 3968 int lines = atoi (str);
3925 3969
3926 if (lines) 3970 if (lines)
3927 scr_page (op == URxvt_view_up ? UP : DN, lines); 3971 scr_page (op == URxvt_view_up ? UP : DN, lines);
3928 else 3972 else
3929 {
3930 scr_erase_savelines (); 3973 scr_erase_savelines ();
3931 } 3974 }
3932 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
3933 break; 3983 break;
3934#endif 3984#endif
3935 } 3985 }
3936} 3986}
3937/*----------------------------------------------------------------------*/ 3987/*----------------------------------------------------------------------*/
4052 case 1021: 4102 case 1021:
4053 if (mode) 4103 if (mode)
4054 SET_OPTION (Opt_intensityStyles); 4104 SET_OPTION (Opt_intensityStyles);
4055 else 4105 else
4056 CLR_OPTION (Opt_intensityStyles); 4106 CLR_OPTION (Opt_intensityStyles);
4107
4108 scr_touch (true);
4109 break;
4057#endif 4110#endif
4058 case 1048: /* alternative cursor save */ 4111 case 1048: /* alternative cursor save */
4059 case 1049: 4112 case 1049:
4060 if (OPTION (Opt_secondaryScreen)) 4113 if (OPTION (Opt_secondaryScreen))
4061 if (mode == 0) 4114 if (mode == 0)
4313 case 106: 4366 case 106:
4314 case 107: 4367 case 107:
4315 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); 4368 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg);
4316 break; 4369 break;
4317#endif 4370#endif
4318
4319 } 4371 }
4320 } 4372 }
4321} 4373}
4322/*}}} */ 4374/*}}} */
4323 4375

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines