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.219 by root, Sat Dec 31 17:16:17 2005 UTC vs.
Revision 1.227 by root, Mon Jan 2 15:35:43 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
155 } 160 }
156 161
157 x--; 162 x--;
158 } 163 }
159} 164}
160#endif
161 165
162void 166void
163rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y) 167rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y)
164{ 168{
165#if ENABLE_OVERLAY
166 rxvt_fontset *fs = FONTSET (r); 169 rxvt_fontset *fs = FONTSET (r);
167 rxvt_font *f = (*fs)[fs->find_font (ch)]; 170 rxvt_font *f = (*fs)[fs->find_font (ch)];
168 wchar_t *chr, *alloc, ch2, *fname; 171 wchar_t *chr, *alloc, ch2, *fname;
169 int len; 172 int len;
170 173
238 241
239# if ENABLE_COMBINING 242# if ENABLE_COMBINING
240 if (alloc) 243 if (alloc)
241 delete [] alloc; 244 delete [] alloc;
242# endif 245# endif
243#endif
244} 246}
247#endif
245 248
246void 249void
247rxvt_term::commit_iso14755 () 250rxvt_term::commit_iso14755 ()
248{ 251{
249 wchar_t ch[2]; 252 wchar_t ch[2];
982 SET_LOCALE (locale); 985 SET_LOCALE (locale);
983 986
984 display->flush (); 987 display->flush ();
985 988
986 if (want_refresh && !flush_ev.active) 989 if (want_refresh && !flush_ev.active)
987 flush_ev.start (NOW + 0.01); 990 flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally
988} 991}
989 992
990void 993void
991rxvt_term::flush_cb (time_watcher &w) 994rxvt_term::flush_cb (time_watcher &w)
992{ 995{
1067 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1070 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1068 } 1071 }
1069} 1072}
1070#endif 1073#endif
1071 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
1072bool 1093bool
1073rxvt_term::pty_fill () 1094rxvt_term::pty_fill ()
1074{ 1095{
1075 ssize_t n = cmdbuf_endp - cmdbuf_ptr; 1096 ssize_t n = cmdbuf_endp - cmdbuf_ptr;
1076 1097
1082 1103
1083 memmove (cmdbuf_base, cmdbuf_ptr, n); 1104 memmove (cmdbuf_base, cmdbuf_ptr, n);
1084 cmdbuf_ptr = cmdbuf_base; 1105 cmdbuf_ptr = cmdbuf_base;
1085 cmdbuf_endp = cmdbuf_ptr + n; 1106 cmdbuf_endp = cmdbuf_ptr + n;
1086 1107
1087 n = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); 1108 ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n);
1088 1109
1089 if (n > 0) 1110 if (r > 0)
1090 { 1111 {
1091 cmdbuf_endp += n; 1112 cmdbuf_endp += r;
1092 return true; 1113 return true;
1093 } 1114 }
1094 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 event_handler.cw_yield.start ();
1119#endif
1120 }
1121 else
1095 { 1122 {
1096 pty_ev.stop (); 1123 pty_ev.stop ();
1097 1124
1098 if (!OPTION (Opt_hold)) 1125 if (!OPTION (Opt_hold))
1099 destroy (); 1126 destroy ();
1672{ 1699{
1673 if (!focus) 1700 if (!focus)
1674 { 1701 {
1675 focus = 1; 1702 focus = 1;
1676 want_refresh = 1; 1703 want_refresh = 1;
1704
1705 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1706
1677#if USE_XIM 1707#if USE_XIM
1678 if (Input_Context != NULL) 1708 if (Input_Context != NULL)
1679 { 1709 {
1680 IMSetStatusPosition (); 1710 IMSetStatusPosition ();
1681 XSetICFocus (Input_Context); 1711 XSetICFocus (Input_Context);
1701 if (focus) 1731 if (focus)
1702 { 1732 {
1703 focus = 0; 1733 focus = 0;
1704 want_refresh = 1; 1734 want_refresh = 1;
1705 1735
1736 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1737
1706#if ENABLE_FRILLS || ISO_14755 1738#if ENABLE_FRILLS || ISO_14755
1739 if (iso14755buf)
1740 {
1707 iso14755buf = 0; 1741 iso14755buf = 0;
1708#endif
1709#if ENABLE_OVERLAY 1742# if ENABLE_OVERLAY
1710 scr_overlay_off (); 1743 scr_overlay_off ();
1744# endif
1745 }
1711#endif 1746#endif
1712#if USE_XIM 1747#if USE_XIM
1713 if (Input_Context != NULL) 1748 if (Input_Context != NULL)
1714 XUnsetICFocus (Input_Context); 1749 XUnsetICFocus (Input_Context);
1715#endif 1750#endif
2686 2721
2687 if (!OPTION (Opt_jumpScroll) 2722 if (!OPTION (Opt_jumpScroll)
2688 || (refresh_count >= refresh_limit * (nrow - 1))) 2723 || (refresh_count >= refresh_limit * (nrow - 1)))
2689 { 2724 {
2690 refreshnow = true; 2725 refreshnow = true;
2726 refresh_count = 0;
2691 ch = NOCHAR; 2727 ch = NOCHAR;
2692 break; 2728 break;
2693 } 2729 }
2694 2730
2695 // scr_add_lines only works for nlines <= nrow - 1. 2731 // scr_add_lines only works for nlines <= nrow - 1.
2732 refresh_limit++; 2768 refresh_limit++;
2733 else 2769 else
2734 { 2770 {
2735 flag = true; 2771 flag = true;
2736 scr_refresh (refresh_type); 2772 scr_refresh (refresh_type);
2773 flush_ev.stop ();
2737 } 2774 }
2738 } 2775 }
2739 2776
2740 } 2777 }
2741 else 2778 else
4048 } 4085 }
4049 4086
4050 /* extra handling for values with state unkept */ 4087 /* extra handling for values with state unkept */
4051 switch (arg[i]) 4088 switch (arg[i])
4052 { 4089 {
4090#if ENABLE_STYLES
4091 case 1021:
4092 if (mode)
4093 SET_OPTION (Opt_intensityStyles);
4094 else
4095 CLR_OPTION (Opt_intensityStyles);
4096
4097 scr_touch (true);
4098 break;
4099#endif
4053 case 1048: /* alternative cursor save */ 4100 case 1048: /* alternative cursor save */
4054 case 1049: 4101 case 1049:
4055 if (OPTION (Opt_secondaryScreen)) 4102 if (OPTION (Opt_secondaryScreen))
4056 if (mode == 0) 4103 if (mode == 0)
4057 scr_cursor (RESTORE); 4104 scr_cursor (RESTORE);
4140 if (state) 4187 if (state)
4141 SET_OPTION (Opt_scrollTtyKeypress); 4188 SET_OPTION (Opt_scrollTtyKeypress);
4142 else 4189 else
4143 CLR_OPTION (Opt_scrollTtyKeypress); 4190 CLR_OPTION (Opt_scrollTtyKeypress);
4144 break; 4191 break;
4145#if ENABLE_STYLES
4146 case 1021:
4147 if (state)
4148 SET_OPTION (Opt_intensityStyles);
4149 else
4150 CLR_OPTION (Opt_intensityStyles);
4151#endif
4152 case 1047: /* secondary screen w/ clearing last */ 4192 case 1047: /* secondary screen w/ clearing last */
4153 if (OPTION (Opt_secondaryScreen)) 4193 if (OPTION (Opt_secondaryScreen))
4154 if (current_screen != PRIMARY) 4194 if (current_screen != PRIMARY)
4155 scr_erase_screen (2); 4195 scr_erase_screen (2);
4156 scr_change_screen (state); 4196 scr_change_screen (state);
4315 case 106: 4355 case 106:
4316 case 107: 4356 case 107:
4317 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); 4357 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg);
4318 break; 4358 break;
4319#endif 4359#endif
4320
4321 } 4360 }
4322 } 4361 }
4323} 4362}
4324/*}}} */ 4363/*}}} */
4325 4364

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines