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.224 by root, Sun Jan 1 06:18:20 2006 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"
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
984 SET_LOCALE (locale); 986 SET_LOCALE (locale);
985 987
986 display->flush (); 988 display->flush ();
987 989
988 if (want_refresh && !flush_ev.active) 990 if (want_refresh && !flush_ev.active)
989 flush_ev.start (NOW + 0.01); 991 flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally
990} 992}
991 993
992void 994void
993rxvt_term::flush_cb (time_watcher &w) 995rxvt_term::flush_cb (time_watcher &w)
994{ 996{
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
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
2694 2725
2695 if (!OPTION (Opt_jumpScroll) 2726 if (!OPTION (Opt_jumpScroll)
2696 || (refresh_count >= refresh_limit * (nrow - 1))) 2727 || (refresh_count >= refresh_limit * (nrow - 1)))
2697 { 2728 {
2698 refreshnow = true; 2729 refreshnow = true;
2730 refresh_count = 0;
2699 ch = NOCHAR; 2731 ch = NOCHAR;
2700 break; 2732 break;
2701 } 2733 }
2702 2734
2703 // scr_add_lines only works for nlines <= nrow - 1. 2735 // scr_add_lines only works for nlines <= nrow - 1.
2740 refresh_limit++; 2772 refresh_limit++;
2741 else 2773 else
2742 { 2774 {
2743 flag = true; 2775 flag = true;
2744 scr_refresh (refresh_type); 2776 scr_refresh (refresh_type);
2777 flush_ev.stop ();
2745 } 2778 }
2746 } 2779 }
2747 2780
2748 } 2781 }
2749 else 2782 else
3929 } 3962 }
3930 break; 3963 break;
3931 3964
3932 case URxvt_view_up: 3965 case URxvt_view_up:
3933 case URxvt_view_down: 3966 case URxvt_view_down:
3967 {
3934 int lines = atoi (str); 3968 int lines = atoi (str);
3935 3969
3936 if (lines) 3970 if (lines)
3937 scr_page (op == URxvt_view_up ? UP : DN, lines); 3971 scr_page (op == URxvt_view_up ? UP : DN, lines);
3938 else 3972 else
3939 {
3940 scr_erase_savelines (); 3973 scr_erase_savelines ();
3941 } 3974 }
3942 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
3943 break; 3983 break;
3944#endif 3984#endif
3945 } 3985 }
3946} 3986}
3947/*----------------------------------------------------------------------*/ 3987/*----------------------------------------------------------------------*/
4063 if (mode) 4103 if (mode)
4064 SET_OPTION (Opt_intensityStyles); 4104 SET_OPTION (Opt_intensityStyles);
4065 else 4105 else
4066 CLR_OPTION (Opt_intensityStyles); 4106 CLR_OPTION (Opt_intensityStyles);
4067 4107
4068 want_refresh = 1; 4108 scr_touch (true);
4069 want_full_refresh = 1;
4070 break; 4109 break;
4071#endif 4110#endif
4072 case 1048: /* alternative cursor save */ 4111 case 1048: /* alternative cursor save */
4073 case 1049: 4112 case 1049:
4074 if (OPTION (Opt_secondaryScreen)) 4113 if (OPTION (Opt_secondaryScreen))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines