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.226 by root, Sun Jan 1 15:03:49 2006 UTC

48#include "../config.h" /* NECESSARY */ 48#include "../config.h" /* NECESSARY */
49#include "rxvt.h" /* NECESSARY */ 49#include "rxvt.h" /* NECESSARY */
50#include "version.h" 50#include "version.h"
51#include "command.h" 51#include "command.h"
52 52
53#if HAVE_SCHED_YIELD
54# include <sched.h>
55#endif
56
53#ifdef KEYSYM_RESOURCE 57#ifdef KEYSYM_RESOURCE
54# include "keyboard.h" 58# include "keyboard.h"
55#endif 59#endif
56 60
57#include <csignal> 61#include <csignal>
155 } 159 }
156 160
157 x--; 161 x--;
158 } 162 }
159} 163}
160#endif
161 164
162void 165void
163rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y) 166rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y)
164{ 167{
165#if ENABLE_OVERLAY
166 rxvt_fontset *fs = FONTSET (r); 168 rxvt_fontset *fs = FONTSET (r);
167 rxvt_font *f = (*fs)[fs->find_font (ch)]; 169 rxvt_font *f = (*fs)[fs->find_font (ch)];
168 wchar_t *chr, *alloc, ch2, *fname; 170 wchar_t *chr, *alloc, ch2, *fname;
169 int len; 171 int len;
170 172
238 240
239# if ENABLE_COMBINING 241# if ENABLE_COMBINING
240 if (alloc) 242 if (alloc)
241 delete [] alloc; 243 delete [] alloc;
242# endif 244# endif
243#endif
244} 245}
246#endif
245 247
246void 248void
247rxvt_term::commit_iso14755 () 249rxvt_term::commit_iso14755 ()
248{ 250{
249 wchar_t ch[2]; 251 wchar_t ch[2];
866 } 868 }
867 869
868 if (len <= 0) 870 if (len <= 0)
869 return; /* not mapped */ 871 return; /* not mapped */
870 872
871 if (options & Opt_scrollTtyKeypress) 873 if (OPTION (Opt_scrollTtyKeypress))
872 if (view_start) 874 if (view_start)
873 { 875 {
874 view_start = 0; 876 view_start = 0;
875 want_refresh = 1; 877 want_refresh = 1;
876 } 878 }
982 SET_LOCALE (locale); 984 SET_LOCALE (locale);
983 985
984 display->flush (); 986 display->flush ();
985 987
986 if (want_refresh && !flush_ev.active) 988 if (want_refresh && !flush_ev.active)
987 flush_ev.start (NOW + 0.01); 989 flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally
988} 990}
989 991
990void 992void
991rxvt_term::flush_cb (time_watcher &w) 993rxvt_term::flush_cb (time_watcher &w)
992{ 994{
1082 1084
1083 memmove (cmdbuf_base, cmdbuf_ptr, n); 1085 memmove (cmdbuf_base, cmdbuf_ptr, n);
1084 cmdbuf_ptr = cmdbuf_base; 1086 cmdbuf_ptr = cmdbuf_base;
1085 cmdbuf_endp = cmdbuf_ptr + n; 1087 cmdbuf_endp = cmdbuf_ptr + n;
1086 1088
1087 n = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); 1089 ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n);
1088 1090
1089 if (n > 0) 1091 if (r > 0)
1090 { 1092 {
1091 cmdbuf_endp += n; 1093 cmdbuf_endp += r;
1092 return true; 1094 return true;
1093 } 1095 }
1094 else if ((n < 0 && errno != EAGAIN && errno != EINTR) || n == 0) 1096 else if (r < 0 && (errno == EAGAIN || errno == EINTR))
1097 {
1098#if HAVE_SCHED_YIELD
1099 sched_yield ();
1100#endif
1101 }
1102 else
1095 { 1103 {
1096 pty_ev.stop (); 1104 pty_ev.stop ();
1097 1105
1098 if (!(options & Opt_hold)) 1106 if (!OPTION (Opt_hold))
1099 destroy (); 1107 destroy ();
1100 } 1108 }
1101 1109
1102 return false; 1110 return false;
1103} 1111}
1125 recolour_cursor (); 1133 recolour_cursor ();
1126 1134
1127#ifdef POINTER_BLANK 1135#ifdef POINTER_BLANK
1128 hidden_pointer = 0; 1136 hidden_pointer = 0;
1129 1137
1130 if (options & Opt_pointerBlank) 1138 if (OPTION (Opt_pointerBlank))
1131 pointer_ev.start (NOW + pointerBlankDelay); 1139 pointer_ev.start (NOW + pointerBlankDelay);
1132#endif 1140#endif
1133} 1141}
1134 1142
1135#ifdef POINTER_BLANK 1143#ifdef POINTER_BLANK
1136void 1144void
1137rxvt_term::pointer_blank () 1145rxvt_term::pointer_blank ()
1138{ 1146{
1139 if (! (options & Opt_pointerBlank)) 1147 if (! OPTION (Opt_pointerBlank))
1140 return; 1148 return;
1141 1149
1142 XDefineCursor (display->display, vt, display->blank_cursor); 1150 XDefineCursor (display->display, vt, display->blank_cursor);
1143 XFlush (display->display); 1151 XFlush (display->display);
1144 1152
1242 1250
1243 SET_R (this); 1251 SET_R (this);
1244 SET_LOCALE (locale); 1252 SET_LOCALE (locale);
1245 1253
1246#if defined(CURSOR_BLINK) 1254#if defined(CURSOR_BLINK)
1247 if ((options & Opt_cursorBlink) && ev.type == KeyPress) 1255 if (OPTION (Opt_cursorBlink) && ev.type == KeyPress)
1248 { 1256 {
1249 if (hidden_cursor) 1257 if (hidden_cursor)
1250 { 1258 {
1251 hidden_cursor = 0; 1259 hidden_cursor = 0;
1252 want_refresh = 1; 1260 want_refresh = 1;
1255 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1263 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1256 } 1264 }
1257#endif 1265#endif
1258 1266
1259#if defined(POINTER_BLANK) 1267#if defined(POINTER_BLANK)
1260 if ((options & Opt_pointerBlank) && pointerBlankDelay > 0) 1268 if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0)
1261 { 1269 {
1262 if (ev.type == MotionNotify 1270 if (ev.type == MotionNotify
1263 || ev.type == ButtonPress 1271 || ev.type == ButtonPress
1264 || ev.type == ButtonRelease) 1272 || ev.type == ButtonRelease)
1265 if (hidden_pointer) 1273 if (hidden_pointer)
1461 seen_resize = 1; 1469 seen_resize = 1;
1462 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1470 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1463 } 1471 }
1464 1472
1465#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ 1473#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */
1466 if (options & Opt_transparent) 1474 if (OPTION (Opt_transparent))
1467 check_our_parents (); 1475 check_our_parents ();
1468#endif 1476#endif
1469 } 1477 }
1470 break; 1478 break;
1471 1479
1680 IMSetStatusPosition (); 1688 IMSetStatusPosition ();
1681 XSetICFocus (Input_Context); 1689 XSetICFocus (Input_Context);
1682 } 1690 }
1683#endif 1691#endif
1684#if CURSOR_BLINK 1692#if CURSOR_BLINK
1685 if (options & Opt_cursorBlink) 1693 if (OPTION (Opt_cursorBlink))
1686 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1694 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1687#endif 1695#endif
1688#if OFF_FOCUS_FADING 1696#if OFF_FOCUS_FADING
1689 if (rs[Rs_fade]) 1697 if (rs[Rs_fade])
1690 { 1698 {
1712#if USE_XIM 1720#if USE_XIM
1713 if (Input_Context != NULL) 1721 if (Input_Context != NULL)
1714 XUnsetICFocus (Input_Context); 1722 XUnsetICFocus (Input_Context);
1715#endif 1723#endif
1716#if CURSOR_BLINK 1724#if CURSOR_BLINK
1717 if (options & Opt_cursorBlink) 1725 if (OPTION (Opt_cursorBlink))
1718 cursor_blink_ev.stop (); 1726 cursor_blink_ev.stop ();
1719 hidden_cursor = 0; 1727 hidden_cursor = 0;
1720#endif 1728#endif
1721#if OFF_FOCUS_FADING 1729#if OFF_FOCUS_FADING
1722 if (rs[Rs_fade]) 1730 if (rs[Rs_fade])
1746 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) 1754 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID])
1747 return; 1755 return;
1748 1756
1749 /* FALLTHROUGH */ 1757 /* FALLTHROUGH */
1750 case ReparentNotify: 1758 case ReparentNotify:
1751 if ((options & Opt_transparent) && check_our_parents () && am_transparent) 1759 if (OPTION (Opt_transparent) && check_our_parents () && am_transparent)
1752 want_refresh = want_full_refresh = 1; 1760 want_refresh = want_full_refresh = 1;
1753 break; 1761 break;
1754 } 1762 }
1755} 1763}
1756#endif 1764#endif
2098 2106
2099 v = ev.button == Button4 ? UP : DN; 2107 v = ev.button == Button4 ? UP : DN;
2100 2108
2101 if (ev.state & ShiftMask) 2109 if (ev.state & ShiftMask)
2102 i = 1; 2110 i = 1;
2103 else if (options & Opt_mouseWheelScrollPage) 2111 else if (OPTION (Opt_mouseWheelScrollPage))
2104 i = nrow - 1; 2112 i = nrow - 1;
2105 else 2113 else
2106 i = 5; 2114 i = 5;
2107 2115
2108# ifdef MOUSE_SLIP_WHEELING 2116# ifdef MOUSE_SLIP_WHEELING
2394 XWindowAttributes wattr, wrootattr; 2402 XWindowAttributes wattr, wrootattr;
2395 dDisp; 2403 dDisp;
2396 2404
2397 pchanged = 0; 2405 pchanged = 0;
2398 2406
2399 if (!(options & Opt_transparent)) 2407 if (!OPTION (Opt_transparent))
2400 return pchanged; /* Don't try any more */ 2408 return pchanged; /* Don't try any more */
2401 2409
2402 XGetWindowAttributes (disp, display->root, &wrootattr); 2410 XGetWindowAttributes (disp, display->root, &wrootattr);
2403 rootdepth = wrootattr.depth; 2411 rootdepth = wrootattr.depth;
2404 2412
2682 if (ch == C0_LF) 2690 if (ch == C0_LF)
2683 nlines++; 2691 nlines++;
2684 2692
2685 refresh_count++; 2693 refresh_count++;
2686 2694
2687 if (!(options & Opt_jumpScroll) 2695 if (!OPTION (Opt_jumpScroll)
2688 || (refresh_count >= refresh_limit * (nrow - 1))) 2696 || (refresh_count >= refresh_limit * (nrow - 1)))
2689 { 2697 {
2690 refreshnow = true; 2698 refreshnow = true;
2699 refresh_count = 0;
2691 ch = NOCHAR; 2700 ch = NOCHAR;
2692 break; 2701 break;
2693 } 2702 }
2694 2703
2695 // scr_add_lines only works for nlines <= nrow - 1. 2704 // scr_add_lines only works for nlines <= nrow - 1.
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);
2746 flush_ev.stop ();
2737 } 2747 }
2738 } 2748 }
2739 2749
2740 } 2750 }
2741 else 2751 else
3400 break; 3410 break;
3401 case 6: /* CPR requested */ 3411 case 6: /* CPR requested */
3402 scr_report_position (); 3412 scr_report_position ();
3403 break; 3413 break;
3404 case 7: /* unofficial extension */ 3414 case 7: /* unofficial extension */
3405 if (options & Opt_insecure) 3415 if (OPTION (Opt_insecure))
3406 tt_printf ("%-.250s\012", rs[Rs_display_name]); 3416 tt_printf ("%-.250s\012", rs[Rs_display_name]);
3407 break; 3417 break;
3408 case 8: /* unofficial extension */ 3418 case 8: /* unofficial extension */
3409 process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); 3419 process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST);
3410 break; 3420 break;
3574 break; 3584 break;
3575 case 20: /* report icon label */ 3585 case 20: /* report icon label */
3576 { 3586 {
3577 char *s; 3587 char *s;
3578 XGetIconName (disp, parent[0], &s); 3588 XGetIconName (disp, parent[0], &s);
3579 tt_printf ("\033]L%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ 3589 tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */
3580 XFree (s); 3590 XFree (s);
3581 } 3591 }
3582 break; 3592 break;
3583 case 21: /* report window title */ 3593 case 21: /* report window title */
3584 { 3594 {
3585 char *s; 3595 char *s;
3586 XFetchName (disp, parent[0], &s); 3596 XFetchName (disp, parent[0], &s);
3587 tt_printf ("\033]l%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ 3597 tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */
3588 XFree (s); 3598 XFree (s);
3589 } 3599 }
3590 break; 3600 break;
3591 } 3601 }
3592} 3602}
3868 // TODO, when secure mode? 3878 // TODO, when secure mode?
3869 break; 3879 break;
3870 3880
3871#ifdef MENUBAR 3881#ifdef MENUBAR
3872 case URxvt_Menu: 3882 case URxvt_Menu:
3873 if (options & Opt_insecure) 3883 if (OPTION (Opt_insecure))
3874 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked 3884 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked
3875 break; 3885 break;
3876#endif 3886#endif
3877#if 0 3887#if 0
3878 case XTerm_dumpscreen: /* no error notices */ 3888 case XTerm_dumpscreen: /* no error notices */
3894 case URxvt_italicFont: 3904 case URxvt_italicFont:
3895 case URxvt_boldItalicFont: 3905 case URxvt_boldItalicFont:
3896#endif 3906#endif
3897 if (query) 3907 if (query)
3898 tt_printf ("\33]%d;%-.250s%c", saveop, 3908 tt_printf ("\33]%d;%-.250s%c", saveop,
3899 (options & Opt_insecure) && fontset[op - URxvt_font]->fontdesc 3909 OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc
3900 ? fontset[op - URxvt_font]->fontdesc : "", 3910 ? fontset[op - URxvt_font]->fontdesc : "",
3901 resp); 3911 resp);
3902 else 3912 else
3903 { 3913 {
3904 const char *&res = rs[Rs_font + (op - URxvt_font)]; 3914 const char *&res = rs[Rs_font + (op - URxvt_font)];
3910 break; 3920 break;
3911 3921
3912#if ENABLE_FRILLS 3922#if ENABLE_FRILLS
3913 case URxvt_locale: 3923 case URxvt_locale:
3914 if (query) 3924 if (query)
3915 tt_printf ("\33]%d;%-.250s%c", URxvt_locale, (options & Opt_insecure) ? locale : "", resp); 3925 tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp);
3916 else 3926 else
3917 { 3927 {
3918 set_locale (str); 3928 set_locale (str);
3919 pty.set_utf8_mode (enc_utf8); 3929 pty.set_utf8_mode (enc_utf8);
3920 init_xlocale (); 3930 init_xlocale ();
4048 } 4058 }
4049 4059
4050 /* extra handling for values with state unkept */ 4060 /* extra handling for values with state unkept */
4051 switch (arg[i]) 4061 switch (arg[i])
4052 { 4062 {
4063#if ENABLE_STYLES
4064 case 1021:
4065 if (mode)
4066 SET_OPTION (Opt_intensityStyles);
4067 else
4068 CLR_OPTION (Opt_intensityStyles);
4069
4070 scr_touch (true);
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