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.218 by root, Sat Dec 31 16:40:28 2005 UTC vs.
Revision 1.223 by root, Sun Jan 1 05:28:28 2006 UTC

54# include "keyboard.h" 54# include "keyboard.h"
55#endif 55#endif
56 56
57#include <csignal> 57#include <csignal>
58 58
59#define HAVE_SCHED_YIELD 1 //D//TODO//FIXME
60#if HAVE_SCHED_YIELD
61# include <sched.h>
62#endif
63
59/*----------------------------------------------------------------------*/ 64/*----------------------------------------------------------------------*/
60 65
61#define IS_CONTROL(ch) !((ch) & 0xffffff60UL) 66#define IS_CONTROL(ch) !((ch) & 0xffffff60UL)
62 67
63// exception thrown when the command parser runs out of input data 68// exception thrown when the command parser runs out of input data
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];
866 } 869 }
867 870
868 if (len <= 0) 871 if (len <= 0)
869 return; /* not mapped */ 872 return; /* not mapped */
870 873
871 if (options & Opt_scrollTtyKeypress) 874 if (OPTION (Opt_scrollTtyKeypress))
872 if (view_start) 875 if (view_start)
873 { 876 {
874 view_start = 0; 877 view_start = 0;
875 want_refresh = 1; 878 want_refresh = 1;
876 } 879 }
1082 1085
1083 memmove (cmdbuf_base, cmdbuf_ptr, n); 1086 memmove (cmdbuf_base, cmdbuf_ptr, n);
1084 cmdbuf_ptr = cmdbuf_base; 1087 cmdbuf_ptr = cmdbuf_base;
1085 cmdbuf_endp = cmdbuf_ptr + n; 1088 cmdbuf_endp = cmdbuf_ptr + n;
1086 1089
1087 n = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); 1090 ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n);
1088 1091
1089 if (n > 0) 1092 if (r > 0)
1090 { 1093 {
1091 cmdbuf_endp += n; 1094 cmdbuf_endp += r;
1092 return true; 1095 return true;
1093 } 1096 }
1094 else if ((n < 0 && errno != EAGAIN && errno != EINTR) || n == 0) 1097 else if (r < 0 && (errno == EAGAIN || errno == EINTR))
1098 {
1099#if HAVE_SCHED_YIELD
1100 sched_yield ();
1101#endif
1102 }
1103 else
1095 { 1104 {
1096 pty_ev.stop (); 1105 pty_ev.stop ();
1097 1106
1098 if (!(options & Opt_hold)) 1107 if (!OPTION (Opt_hold))
1099 destroy (); 1108 destroy ();
1100 } 1109 }
1101 1110
1102 return false; 1111 return false;
1103} 1112}
1125 recolour_cursor (); 1134 recolour_cursor ();
1126 1135
1127#ifdef POINTER_BLANK 1136#ifdef POINTER_BLANK
1128 hidden_pointer = 0; 1137 hidden_pointer = 0;
1129 1138
1130 if (options & Opt_pointerBlank) 1139 if (OPTION (Opt_pointerBlank))
1131 pointer_ev.start (NOW + pointerBlankDelay); 1140 pointer_ev.start (NOW + pointerBlankDelay);
1132#endif 1141#endif
1133} 1142}
1134 1143
1135#ifdef POINTER_BLANK 1144#ifdef POINTER_BLANK
1136void 1145void
1137rxvt_term::pointer_blank () 1146rxvt_term::pointer_blank ()
1138{ 1147{
1139 if (! (options & Opt_pointerBlank)) 1148 if (! OPTION (Opt_pointerBlank))
1140 return; 1149 return;
1141 1150
1142 XDefineCursor (display->display, vt, display->blank_cursor); 1151 XDefineCursor (display->display, vt, display->blank_cursor);
1143 XFlush (display->display); 1152 XFlush (display->display);
1144 1153
1242 1251
1243 SET_R (this); 1252 SET_R (this);
1244 SET_LOCALE (locale); 1253 SET_LOCALE (locale);
1245 1254
1246#if defined(CURSOR_BLINK) 1255#if defined(CURSOR_BLINK)
1247 if ((options & Opt_cursorBlink) && ev.type == KeyPress) 1256 if (OPTION (Opt_cursorBlink) && ev.type == KeyPress)
1248 { 1257 {
1249 if (hidden_cursor) 1258 if (hidden_cursor)
1250 { 1259 {
1251 hidden_cursor = 0; 1260 hidden_cursor = 0;
1252 want_refresh = 1; 1261 want_refresh = 1;
1255 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1264 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1256 } 1265 }
1257#endif 1266#endif
1258 1267
1259#if defined(POINTER_BLANK) 1268#if defined(POINTER_BLANK)
1260 if ((options & Opt_pointerBlank) && pointerBlankDelay > 0) 1269 if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0)
1261 { 1270 {
1262 if (ev.type == MotionNotify 1271 if (ev.type == MotionNotify
1263 || ev.type == ButtonPress 1272 || ev.type == ButtonPress
1264 || ev.type == ButtonRelease) 1273 || ev.type == ButtonRelease)
1265 if (hidden_pointer) 1274 if (hidden_pointer)
1461 seen_resize = 1; 1470 seen_resize = 1;
1462 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1471 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1463 } 1472 }
1464 1473
1465#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ 1474#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */
1466 if (options & Opt_transparent) 1475 if (OPTION (Opt_transparent))
1467 check_our_parents (); 1476 check_our_parents ();
1468#endif 1477#endif
1469 } 1478 }
1470 break; 1479 break;
1471 1480
1680 IMSetStatusPosition (); 1689 IMSetStatusPosition ();
1681 XSetICFocus (Input_Context); 1690 XSetICFocus (Input_Context);
1682 } 1691 }
1683#endif 1692#endif
1684#if CURSOR_BLINK 1693#if CURSOR_BLINK
1685 if (options & Opt_cursorBlink) 1694 if (OPTION (Opt_cursorBlink))
1686 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1695 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1687#endif 1696#endif
1688#if OFF_FOCUS_FADING 1697#if OFF_FOCUS_FADING
1689 if (rs[Rs_fade]) 1698 if (rs[Rs_fade])
1690 { 1699 {
1712#if USE_XIM 1721#if USE_XIM
1713 if (Input_Context != NULL) 1722 if (Input_Context != NULL)
1714 XUnsetICFocus (Input_Context); 1723 XUnsetICFocus (Input_Context);
1715#endif 1724#endif
1716#if CURSOR_BLINK 1725#if CURSOR_BLINK
1717 if (options & Opt_cursorBlink) 1726 if (OPTION (Opt_cursorBlink))
1718 cursor_blink_ev.stop (); 1727 cursor_blink_ev.stop ();
1719 hidden_cursor = 0; 1728 hidden_cursor = 0;
1720#endif 1729#endif
1721#if OFF_FOCUS_FADING 1730#if OFF_FOCUS_FADING
1722 if (rs[Rs_fade]) 1731 if (rs[Rs_fade])
1746 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) 1755 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID])
1747 return; 1756 return;
1748 1757
1749 /* FALLTHROUGH */ 1758 /* FALLTHROUGH */
1750 case ReparentNotify: 1759 case ReparentNotify:
1751 if ((options & Opt_transparent) && check_our_parents () && am_transparent) 1760 if (OPTION (Opt_transparent) && check_our_parents () && am_transparent)
1752 want_refresh = want_full_refresh = 1; 1761 want_refresh = want_full_refresh = 1;
1753 break; 1762 break;
1754 } 1763 }
1755} 1764}
1756#endif 1765#endif
2098 2107
2099 v = ev.button == Button4 ? UP : DN; 2108 v = ev.button == Button4 ? UP : DN;
2100 2109
2101 if (ev.state & ShiftMask) 2110 if (ev.state & ShiftMask)
2102 i = 1; 2111 i = 1;
2103 else if (options & Opt_mouseWheelScrollPage) 2112 else if (OPTION (Opt_mouseWheelScrollPage))
2104 i = nrow - 1; 2113 i = nrow - 1;
2105 else 2114 else
2106 i = 5; 2115 i = 5;
2107 2116
2108# ifdef MOUSE_SLIP_WHEELING 2117# ifdef MOUSE_SLIP_WHEELING
2394 XWindowAttributes wattr, wrootattr; 2403 XWindowAttributes wattr, wrootattr;
2395 dDisp; 2404 dDisp;
2396 2405
2397 pchanged = 0; 2406 pchanged = 0;
2398 2407
2399 if (!(options & Opt_transparent)) 2408 if (!OPTION (Opt_transparent))
2400 return pchanged; /* Don't try any more */ 2409 return pchanged; /* Don't try any more */
2401 2410
2402 XGetWindowAttributes (disp, display->root, &wrootattr); 2411 XGetWindowAttributes (disp, display->root, &wrootattr);
2403 rootdepth = wrootattr.depth; 2412 rootdepth = wrootattr.depth;
2404 2413
2682 if (ch == C0_LF) 2691 if (ch == C0_LF)
2683 nlines++; 2692 nlines++;
2684 2693
2685 refresh_count++; 2694 refresh_count++;
2686 2695
2687 if (!(options & Opt_jumpScroll) 2696 if (!OPTION (Opt_jumpScroll)
2688 || (refresh_count >= refresh_limit * (nrow - 1))) 2697 || (refresh_count >= refresh_limit * (nrow - 1)))
2689 { 2698 {
2690 refreshnow = true; 2699 refreshnow = true;
2691 ch = NOCHAR; 2700 ch = NOCHAR;
2692 break; 2701 break;
2726 * the number of pages between refreshes is refresh_limit, which 2735 * the number of pages between refreshes is refresh_limit, which
2727 * is incremented here because we must be doing flat-out scrolling. 2736 * is incremented here because we must be doing flat-out scrolling.
2728 */ 2737 */
2729 if (refreshnow) 2738 if (refreshnow)
2730 { 2739 {
2731 if ((options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) 2740 if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
2732 refresh_limit++; 2741 refresh_limit++;
2733 else 2742 else
2734 { 2743 {
2735 flag = true; 2744 flag = true;
2736 scr_refresh (refresh_type); 2745 scr_refresh (refresh_type);
3400 break; 3409 break;
3401 case 6: /* CPR requested */ 3410 case 6: /* CPR requested */
3402 scr_report_position (); 3411 scr_report_position ();
3403 break; 3412 break;
3404 case 7: /* unofficial extension */ 3413 case 7: /* unofficial extension */
3405 if (options & Opt_insecure) 3414 if (OPTION (Opt_insecure))
3406 tt_printf ("%-.250s\012", rs[Rs_display_name]); 3415 tt_printf ("%-.250s\012", rs[Rs_display_name]);
3407 break; 3416 break;
3408 case 8: /* unofficial extension */ 3417 case 8: /* unofficial extension */
3409 process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); 3418 process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST);
3410 break; 3419 break;
3574 break; 3583 break;
3575 case 20: /* report icon label */ 3584 case 20: /* report icon label */
3576 { 3585 {
3577 char *s; 3586 char *s;
3578 XGetIconName (disp, parent[0], &s); 3587 XGetIconName (disp, parent[0], &s);
3579 tt_printf ("\033]L%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ 3588 tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */
3580 XFree (s); 3589 XFree (s);
3581 } 3590 }
3582 break; 3591 break;
3583 case 21: /* report window title */ 3592 case 21: /* report window title */
3584 { 3593 {
3585 char *s; 3594 char *s;
3586 XFetchName (disp, parent[0], &s); 3595 XFetchName (disp, parent[0], &s);
3587 tt_printf ("\033]l%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ 3596 tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */
3588 XFree (s); 3597 XFree (s);
3589 } 3598 }
3590 break; 3599 break;
3591 } 3600 }
3592} 3601}
3868 // TODO, when secure mode? 3877 // TODO, when secure mode?
3869 break; 3878 break;
3870 3879
3871#ifdef MENUBAR 3880#ifdef MENUBAR
3872 case URxvt_Menu: 3881 case URxvt_Menu:
3873 if (options & Opt_insecure) 3882 if (OPTION (Opt_insecure))
3874 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked 3883 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked
3875 break; 3884 break;
3876#endif 3885#endif
3877#if 0 3886#if 0
3878 case XTerm_dumpscreen: /* no error notices */ 3887 case XTerm_dumpscreen: /* no error notices */
3894 case URxvt_italicFont: 3903 case URxvt_italicFont:
3895 case URxvt_boldItalicFont: 3904 case URxvt_boldItalicFont:
3896#endif 3905#endif
3897 if (query) 3906 if (query)
3898 tt_printf ("\33]%d;%-.250s%c", saveop, 3907 tt_printf ("\33]%d;%-.250s%c", saveop,
3899 (options & Opt_insecure) && fontset[op - URxvt_font]->fontdesc 3908 OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc
3900 ? fontset[op - URxvt_font]->fontdesc : "", 3909 ? fontset[op - URxvt_font]->fontdesc : "",
3901 resp); 3910 resp);
3902 else 3911 else
3903 { 3912 {
3904 const char *&res = rs[Rs_font + (op - URxvt_font)]; 3913 const char *&res = rs[Rs_font + (op - URxvt_font)];
3910 break; 3919 break;
3911 3920
3912#if ENABLE_FRILLS 3921#if ENABLE_FRILLS
3913 case URxvt_locale: 3922 case URxvt_locale:
3914 if (query) 3923 if (query)
3915 tt_printf ("\33]%d;%-.250s%c", URxvt_locale, (options & Opt_insecure) ? locale : "", resp); 3924 tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp);
3916 else 3925 else
3917 { 3926 {
3918 set_locale (str); 3927 set_locale (str);
3919 pty.set_utf8_mode (enc_utf8); 3928 pty.set_utf8_mode (enc_utf8);
3920 init_xlocale (); 3929 init_xlocale ();
4048 } 4057 }
4049 4058
4050 /* extra handling for values with state unkept */ 4059 /* extra handling for values with state unkept */
4051 switch (arg[i]) 4060 switch (arg[i])
4052 { 4061 {
4062#if ENABLE_STYLES
4063 case 1021:
4064 if (mode)
4065 SET_OPTION (Opt_intensityStyles);
4066 else
4067 CLR_OPTION (Opt_intensityStyles);
4068
4069 want_refresh = 1;
4070 want_full_refresh = 1;
4071 break;
4072#endif
4053 case 1048: /* alternative cursor save */ 4073 case 1048: /* alternative cursor save */
4054 case 1049: 4074 case 1049:
4055 if (options & Opt_secondaryScreen) 4075 if (OPTION (Opt_secondaryScreen))
4056 if (mode == 0) 4076 if (mode == 0)
4057 scr_cursor (RESTORE); 4077 scr_cursor (RESTORE);
4058 else if (mode == 1) 4078 else if (mode == 1)
4059 scr_cursor (SAVE); 4079 scr_cursor (SAVE);
4060 break; 4080 break;
4075 case 3: /* 80/132 */ 4095 case 3: /* 80/132 */
4076 if (priv_modes & PrivMode_132OK) 4096 if (priv_modes & PrivMode_132OK)
4077 set_widthheight (((state ? 132 : 80) * fwidth), height); 4097 set_widthheight (((state ? 132 : 80) * fwidth), height);
4078 break; 4098 break;
4079 case 4: /* smooth scrolling */ 4099 case 4: /* smooth scrolling */
4080 if (state) 4100 if (!state)
4081 options &= ~Opt_jumpScroll; 4101 SET_OPTION (Opt_jumpScroll);
4082 else 4102 else
4083 options |= Opt_jumpScroll; 4103 CLR_OPTION (Opt_jumpScroll);
4084 break; 4104 break;
4085 case 5: /* reverse video */ 4105 case 5: /* reverse video */
4086 scr_rvideo_mode (state); 4106 scr_rvideo_mode (state);
4087 break; 4107 break;
4088 case 6: /* relative/absolute origins */ 4108 case 6: /* relative/absolute origins */
4129#if 0 4149#if 0
4130 case 1001: 4150 case 1001:
4131 break; /* X11 mouse highlighting */ 4151 break; /* X11 mouse highlighting */
4132#endif 4152#endif
4133 case 1010: /* scroll to bottom on TTY output inhibit */ 4153 case 1010: /* scroll to bottom on TTY output inhibit */
4134 if (state) 4154 if (!state)
4135 options &= ~Opt_scrollTtyOutput; 4155 SET_OPTION (Opt_scrollTtyOutput);
4136 else 4156 else
4137 options |= Opt_scrollTtyOutput; 4157 CLR_OPTION (Opt_scrollTtyOutput);
4138 break; 4158 break;
4139 case 1011: /* scroll to bottom on key press */ 4159 case 1011: /* scroll to bottom on key press */
4140 if (state) 4160 if (state)
4141 options |= Opt_scrollTtyKeypress; 4161 SET_OPTION (Opt_scrollTtyKeypress);
4142 else 4162 else
4143 options &= ~Opt_scrollTtyKeypress; 4163 CLR_OPTION (Opt_scrollTtyKeypress);
4144 break; 4164 break;
4145 case 1047: /* secondary screen w/ clearing last */ 4165 case 1047: /* secondary screen w/ clearing last */
4146 if (options & Opt_secondaryScreen) 4166 if (OPTION (Opt_secondaryScreen))
4147 if (current_screen != PRIMARY) 4167 if (current_screen != PRIMARY)
4148 scr_erase_screen (2); 4168 scr_erase_screen (2);
4149 scr_change_screen (state); 4169 scr_change_screen (state);
4150 break; 4170 break;
4151 case 1049: /* secondary screen w/ clearing first */ 4171 case 1049: /* secondary screen w/ clearing first */
4152 scr_change_screen (state); 4172 scr_change_screen (state);
4153 if (options & Opt_secondaryScreen) 4173 if (OPTION (Opt_secondaryScreen))
4154 if (current_screen != PRIMARY) 4174 if (current_screen != PRIMARY)
4155 scr_erase_screen (2); 4175 scr_erase_screen (2);
4156 break; 4176 break;
4157 default: 4177 default:
4158 break; 4178 break;
4308 case 106: 4328 case 106:
4309 case 107: 4329 case 107:
4310 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); 4330 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg);
4311 break; 4331 break;
4312#endif 4332#endif
4313
4314 } 4333 }
4315 } 4334 }
4316} 4335}
4317/*}}} */ 4336/*}}} */
4318 4337

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines