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.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
980 SET_LOCALE (locale); 985 SET_LOCALE (locale);
981 986
982 display->flush (); 987 display->flush ();
983 988
984 if (want_refresh && !flush_ev.active) 989 if (want_refresh && !flush_ev.active)
985 flush_ev.start (NOW + 0.01); 990 flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally
986} 991}
987 992
988void 993void
989rxvt_term::flush_cb (time_watcher &w) 994rxvt_term::flush_cb (time_watcher &w)
990{ 995{
1065 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1070 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1066 } 1071 }
1067} 1072}
1068#endif 1073#endif
1069 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
1070bool 1093bool
1071rxvt_term::pty_fill () 1094rxvt_term::pty_fill ()
1072{ 1095{
1073 ssize_t n = cmdbuf_endp - cmdbuf_ptr; 1096 ssize_t n = cmdbuf_endp - cmdbuf_ptr;
1074 1097
1080 1103
1081 memmove (cmdbuf_base, cmdbuf_ptr, n); 1104 memmove (cmdbuf_base, cmdbuf_ptr, n);
1082 cmdbuf_ptr = cmdbuf_base; 1105 cmdbuf_ptr = cmdbuf_base;
1083 cmdbuf_endp = cmdbuf_ptr + n; 1106 cmdbuf_endp = cmdbuf_ptr + n;
1084 1107
1085 n = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); 1108 ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n);
1086 1109
1087 if (n > 0) 1110 if (r > 0)
1088 { 1111 {
1089 cmdbuf_endp += n; 1112 cmdbuf_endp += r;
1090 return true; 1113 return true;
1091 } 1114 }
1092 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
1093 { 1122 {
1094 pty_ev.stop (); 1123 pty_ev.stop ();
1095 1124
1096 if (!OPTION (Opt_hold)) 1125 if (!OPTION (Opt_hold))
1097 destroy (); 1126 destroy ();
1670{ 1699{
1671 if (!focus) 1700 if (!focus)
1672 { 1701 {
1673 focus = 1; 1702 focus = 1;
1674 want_refresh = 1; 1703 want_refresh = 1;
1704
1705 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1706
1675#if USE_XIM 1707#if USE_XIM
1676 if (Input_Context != NULL) 1708 if (Input_Context != NULL)
1677 { 1709 {
1678 IMSetStatusPosition (); 1710 IMSetStatusPosition ();
1679 XSetICFocus (Input_Context); 1711 XSetICFocus (Input_Context);
1699 if (focus) 1731 if (focus)
1700 { 1732 {
1701 focus = 0; 1733 focus = 0;
1702 want_refresh = 1; 1734 want_refresh = 1;
1703 1735
1736 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1737
1704#if ENABLE_FRILLS || ISO_14755 1738#if ENABLE_FRILLS || ISO_14755
1739 if (iso14755buf)
1740 {
1705 iso14755buf = 0; 1741 iso14755buf = 0;
1706#endif
1707#if ENABLE_OVERLAY 1742# if ENABLE_OVERLAY
1708 scr_overlay_off (); 1743 scr_overlay_off ();
1744# endif
1745 }
1709#endif 1746#endif
1710#if USE_XIM 1747#if USE_XIM
1711 if (Input_Context != NULL) 1748 if (Input_Context != NULL)
1712 XUnsetICFocus (Input_Context); 1749 XUnsetICFocus (Input_Context);
1713#endif 1750#endif
2684 2721
2685 if (!OPTION (Opt_jumpScroll) 2722 if (!OPTION (Opt_jumpScroll)
2686 || (refresh_count >= refresh_limit * (nrow - 1))) 2723 || (refresh_count >= refresh_limit * (nrow - 1)))
2687 { 2724 {
2688 refreshnow = true; 2725 refreshnow = true;
2726 refresh_count = 0;
2689 ch = NOCHAR; 2727 ch = NOCHAR;
2690 break; 2728 break;
2691 } 2729 }
2692 2730
2693 // scr_add_lines only works for nlines <= nrow - 1. 2731 // scr_add_lines only works for nlines <= nrow - 1.
2730 refresh_limit++; 2768 refresh_limit++;
2731 else 2769 else
2732 { 2770 {
2733 flag = true; 2771 flag = true;
2734 scr_refresh (refresh_type); 2772 scr_refresh (refresh_type);
2773 flush_ev.stop ();
2735 } 2774 }
2736 } 2775 }
2737 2776
2738 } 2777 }
2739 else 2778 else
4052 case 1021: 4091 case 1021:
4053 if (mode) 4092 if (mode)
4054 SET_OPTION (Opt_intensityStyles); 4093 SET_OPTION (Opt_intensityStyles);
4055 else 4094 else
4056 CLR_OPTION (Opt_intensityStyles); 4095 CLR_OPTION (Opt_intensityStyles);
4096
4097 scr_touch (true);
4098 break;
4057#endif 4099#endif
4058 case 1048: /* alternative cursor save */ 4100 case 1048: /* alternative cursor save */
4059 case 1049: 4101 case 1049:
4060 if (OPTION (Opt_secondaryScreen)) 4102 if (OPTION (Opt_secondaryScreen))
4061 if (mode == 0) 4103 if (mode == 0)
4313 case 106: 4355 case 106:
4314 case 107: 4356 case 107:
4315 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); 4357 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg);
4316 break; 4358 break;
4317#endif 4359#endif
4318
4319 } 4360 }
4320 } 4361 }
4321} 4362}
4322/*}}} */ 4363/*}}} */
4323 4364

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines