--- rxvt-unicode/src/command.C 2005/12/31 17:16:17 1.219 +++ rxvt-unicode/src/command.C 2006/01/02 16:08:34 1.228 @@ -45,11 +45,16 @@ *----------------------------------------------------------------------*/ /*{{{ includes: */ -#include "../config.h" /* NECESSARY */ -#include "rxvt.h" /* NECESSARY */ +#include "../config.h" +#include "rxvt.h" +#include "rxvtperl.h" #include "version.h" #include "command.h" +#if HAVE_SCHED_YIELD +# include +#endif + #ifdef KEYSYM_RESOURCE # include "keyboard.h" #endif @@ -157,12 +162,10 @@ x--; } } -#endif void rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y) { -#if ENABLE_OVERLAY rxvt_fontset *fs = FONTSET (r); rxvt_font *f = (*fs)[fs->find_font (ch)]; wchar_t *chr, *alloc, ch2, *fname; @@ -240,8 +243,8 @@ if (alloc) delete [] alloc; # endif -#endif } +#endif void rxvt_term::commit_iso14755 () @@ -984,7 +987,7 @@ display->flush (); if (want_refresh && !flush_ev.active) - flush_ev.start (NOW + 0.01); + flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally } void @@ -1069,6 +1072,24 @@ } #endif +#if HAVE_SCHED_YIELD +static struct event_handler +{ + check_watcher cw_yield; + + void yield (check_watcher &w) + { + sched_yield (); + w.stop (); + } + + event_handler () + : cw_yield (this, &event_handler::yield) + { + } +} event_handler; +#endif + bool rxvt_term::pty_fill () { @@ -1084,14 +1105,21 @@ cmdbuf_ptr = cmdbuf_base; cmdbuf_endp = cmdbuf_ptr + n; - n = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); + ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); - if (n > 0) + if (r > 0) { - cmdbuf_endp += n; + cmdbuf_endp += r; return true; } - else if ((n < 0 && errno != EAGAIN && errno != EINTR) || n == 0) + else if (r < 0 && (errno == EAGAIN || errno == EINTR)) + { +#if HAVE_SCHED_YIELD + if (display->is_local) + event_handler.cw_yield.start (); +#endif + } + else { pty_ev.stop (); @@ -1674,6 +1702,9 @@ { focus = 1; want_refresh = 1; + + PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); + #if USE_XIM if (Input_Context != NULL) { @@ -1703,11 +1734,16 @@ focus = 0; want_refresh = 1; + PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); + #if ENABLE_FRILLS || ISO_14755 - iso14755buf = 0; -#endif -#if ENABLE_OVERLAY - scr_overlay_off (); + if (iso14755buf) + { + iso14755buf = 0; +# if ENABLE_OVERLAY + scr_overlay_off (); +# endif + } #endif #if USE_XIM if (Input_Context != NULL) @@ -2688,6 +2724,7 @@ || (refresh_count >= refresh_limit * (nrow - 1))) { refreshnow = true; + refresh_count = 0; ch = NOCHAR; break; } @@ -2734,6 +2771,7 @@ { flag = true; scr_refresh (refresh_type); + flush_ev.stop (); } } @@ -4050,6 +4088,16 @@ /* extra handling for values with state unkept */ switch (arg[i]) { +#if ENABLE_STYLES + case 1021: + if (mode) + SET_OPTION (Opt_intensityStyles); + else + CLR_OPTION (Opt_intensityStyles); + + scr_touch (true); + break; +#endif case 1048: /* alternative cursor save */ case 1049: if (OPTION (Opt_secondaryScreen)) @@ -4142,13 +4190,6 @@ else CLR_OPTION (Opt_scrollTtyKeypress); break; -#if ENABLE_STYLES - case 1021: - if (state) - SET_OPTION (Opt_intensityStyles); - else - CLR_OPTION (Opt_intensityStyles); -#endif case 1047: /* secondary screen w/ clearing last */ if (OPTION (Opt_secondaryScreen)) if (current_screen != PRIMARY) @@ -4317,7 +4358,6 @@ scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); break; #endif - } } }