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.210 by root, Tue Dec 20 20:58:31 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
135rxvt_term::iso14755_54 (int x, int y) 140rxvt_term::iso14755_54 (int x, int y)
136{ 141{
137 x = Pixel2Col (x); 142 x = Pixel2Col (x);
138 y = Pixel2Row (y); 143 y = Pixel2Row (y);
139 144
140 if (x < 0 || x >= ncol 145 if (!IN_RANGE_EXC (x, 0, ncol)
141 || y < 0 || y >= nrow) 146 || !IN_RANGE_EXC (y, 0, nrow))
142 return; 147 return;
143 148
144 for (;;) 149 for (;;)
145 { 150 {
146 const line_t &l = save[y + saveLines - view_start]; 151 const line_t &l = ROW(y - view_start);
147 152
148 text_t t = l.t[x]; 153 text_t t = l.t[x];
149 154
150 if (t != NOCHAR || !x) 155 if (t != NOCHAR || !x)
151 { 156 {
152 iso14755_51 (l.t[x], l.r[x]); 157 iso14755_51 (l.t[x], l.r[x], x, y);
153 iso14755buf = ISO_14755_54; 158 iso14755buf = ISO_14755_54;
154 break; 159 break;
155 } 160 }
156 161
157 x--; 162 x--;
158 } 163 }
159
160} 164}
161#endif
162 165
163#if ENABLE_OVERLAY
164void 166void
165rxvt_term::iso14755_51 (unicode_t ch, rend_t r) 167rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y)
166{ 168{
167 rxvt_fontset *fs = FONTSET (r); 169 rxvt_fontset *fs = FONTSET (r);
168 rxvt_font *f = (*fs)[fs->find_font (ch)]; 170 rxvt_font *f = (*fs)[fs->find_font (ch)];
169 wchar_t *chr, *alloc, ch2, *fname; 171 wchar_t *chr, *alloc, ch2, *fname;
170 int len; 172 int len;
171 173
172 fname = rxvt_utf8towcs (f->name); 174 fname = rxvt_utf8towcs (f->name);
173 175
174#if ENABLE_COMBINING 176# if ENABLE_COMBINING
175 if (IS_COMPOSE (ch)) 177 if (IS_COMPOSE (ch))
176 { 178 {
177 len = rxvt_composite.expand (ch, 0); 179 len = rxvt_composite.expand (ch, 0);
178 alloc = chr = new wchar_t[len]; 180 alloc = chr = new wchar_t[len];
179 rxvt_composite.expand (ch, chr); 181 rxvt_composite.expand (ch, chr);
180 } 182 }
181 else 183 else
182#endif 184# endif
183 { 185 {
184 ch2 = ch; 186 ch2 = ch;
185 187
186 alloc = 0; 188 alloc = 0;
187 chr = &ch2; 189 chr = &ch2;
188 len = 1; 190 len = 1;
189 } 191 }
190 192
193 char attr[80]; // plenty
194
195 sprintf (attr, "%08x = fg %d bg %d%s%s%s%s%s%s",
196 (int)r,
197 fgcolor_of (r), bgcolor_of (r),
198 r & RS_Bold ? " bold" : "",
199 r & RS_Italic ? " italic" : "",
200 r & RS_Blink ? " blink" : "",
201 r & RS_RVid ? " rvid" : "",
202 r & RS_Uline ? " uline" : "",
203 r & RS_Careful ? " careful" : "");
204
191 int width = wcswidth (fname, wcslen (fname)); 205 int width = wcswidth (fname, wcslen (fname));
192 206
193 scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1); 207 max_it (width, 8+5); // for char + hey
208 max_it (width, strlen (attr));
209
210 if (y >= 0)
211 {
212 y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1;
213 x = 0;
214 }
215
216 scr_overlay_new (x, y, width, len + 2);
194 217
195 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); 218 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r));
196 219
197 for (int y = 0; y < len; y++) 220 for (int y = 0; y < len; y++)
198 { 221 {
201 ch = *chr++; 224 ch = *chr++;
202 225
203 sprintf (buf, "%8x", ch); 226 sprintf (buf, "%8x", ch);
204 scr_overlay_set (0, y, buf); 227 scr_overlay_set (0, y, buf);
205 scr_overlay_set (9, y, '='); 228 scr_overlay_set (9, y, '=');
206#if !UNICODE3 229# if !UNICODE3
207 if (ch >= 0x10000) 230 if (ch >= 0x10000)
208 ch = 0xfffd; 231 ch = 0xfffd;
209#endif 232# endif
210 scr_overlay_set (11, y, ch, r); 233 scr_overlay_set (11, y, ch, r);
211 scr_overlay_set (12, y, NOCHAR, r); 234 scr_overlay_set (12, y, NOCHAR, r);
212 } 235 }
213 236
237 scr_overlay_set (0, len , attr);
214 scr_overlay_set (0, len, fname); 238 scr_overlay_set (0, len + 1, fname);
215 239
216 free (fname); 240 free (fname);
217 241
218#if ENABLE_COMBINING 242# if ENABLE_COMBINING
219 if (alloc) 243 if (alloc)
220 delete [] alloc; 244 delete [] alloc;
221#endif 245# endif
222} 246}
223#endif 247#endif
224 248
225void 249void
226rxvt_term::commit_iso14755 () 250rxvt_term::commit_iso14755 ()
845 } 869 }
846 870
847 if (len <= 0) 871 if (len <= 0)
848 return; /* not mapped */ 872 return; /* not mapped */
849 873
850 if (options & Opt_scrollTtyKeypress) 874 if (OPTION (Opt_scrollTtyKeypress))
851 if (view_start) 875 if (view_start)
852 { 876 {
853 view_start = 0; 877 view_start = 0;
854 want_refresh = 1; 878 want_refresh = 1;
855 } 879 }
961 SET_LOCALE (locale); 985 SET_LOCALE (locale);
962 986
963 display->flush (); 987 display->flush ();
964 988
965 if (want_refresh && !flush_ev.active) 989 if (want_refresh && !flush_ev.active)
966 flush_ev.start (NOW + 0.01); 990 flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally
967} 991}
968 992
969void 993void
970rxvt_term::flush_cb (time_watcher &w) 994rxvt_term::flush_cb (time_watcher &w)
971{ 995{
1046 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1070 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1047 } 1071 }
1048} 1072}
1049#endif 1073#endif
1050 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
1051bool 1093bool
1052rxvt_term::pty_fill () 1094rxvt_term::pty_fill ()
1053{ 1095{
1054 ssize_t n = cmdbuf_endp - cmdbuf_ptr; 1096 ssize_t n = cmdbuf_endp - cmdbuf_ptr;
1055 1097
1061 1103
1062 memmove (cmdbuf_base, cmdbuf_ptr, n); 1104 memmove (cmdbuf_base, cmdbuf_ptr, n);
1063 cmdbuf_ptr = cmdbuf_base; 1105 cmdbuf_ptr = cmdbuf_base;
1064 cmdbuf_endp = cmdbuf_ptr + n; 1106 cmdbuf_endp = cmdbuf_ptr + n;
1065 1107
1066 n = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); 1108 ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n);
1067 1109
1068 if (n > 0) 1110 if (r > 0)
1069 { 1111 {
1070 cmdbuf_endp += n; 1112 cmdbuf_endp += r;
1071 return true; 1113 return true;
1072 } 1114 }
1073 else if (n < 0 && errno != EAGAIN) 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
1122 {
1123 pty_ev.stop ();
1124
1125 if (!OPTION (Opt_hold))
1074 destroy (); 1126 destroy ();
1127 }
1075 1128
1076 return false; 1129 return false;
1077} 1130}
1078 1131
1079void 1132void
1099 recolour_cursor (); 1152 recolour_cursor ();
1100 1153
1101#ifdef POINTER_BLANK 1154#ifdef POINTER_BLANK
1102 hidden_pointer = 0; 1155 hidden_pointer = 0;
1103 1156
1104 if (options & Opt_pointerBlank) 1157 if (OPTION (Opt_pointerBlank))
1105 pointer_ev.start (NOW + pointerBlankDelay); 1158 pointer_ev.start (NOW + pointerBlankDelay);
1106#endif 1159#endif
1107} 1160}
1108 1161
1109#ifdef POINTER_BLANK 1162#ifdef POINTER_BLANK
1110void 1163void
1111rxvt_term::pointer_blank () 1164rxvt_term::pointer_blank ()
1112{ 1165{
1113 if (! (options & Opt_pointerBlank)) 1166 if (! OPTION (Opt_pointerBlank))
1114 return; 1167 return;
1115 1168
1116 XDefineCursor (display->display, vt, display->blank_cursor); 1169 XDefineCursor (display->display, vt, display->blank_cursor);
1117 XFlush (display->display); 1170 XFlush (display->display);
1118 1171
1216 1269
1217 SET_R (this); 1270 SET_R (this);
1218 SET_LOCALE (locale); 1271 SET_LOCALE (locale);
1219 1272
1220#if defined(CURSOR_BLINK) 1273#if defined(CURSOR_BLINK)
1221 if ((options & Opt_cursorBlink) && ev.type == KeyPress) 1274 if (OPTION (Opt_cursorBlink) && ev.type == KeyPress)
1222 { 1275 {
1223 if (hidden_cursor) 1276 if (hidden_cursor)
1224 { 1277 {
1225 hidden_cursor = 0; 1278 hidden_cursor = 0;
1226 want_refresh = 1; 1279 want_refresh = 1;
1229 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1282 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1230 } 1283 }
1231#endif 1284#endif
1232 1285
1233#if defined(POINTER_BLANK) 1286#if defined(POINTER_BLANK)
1234 if ((options & Opt_pointerBlank) && pointerBlankDelay > 0) 1287 if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0)
1235 { 1288 {
1236 if (ev.type == MotionNotify 1289 if (ev.type == MotionNotify
1237 || ev.type == ButtonPress 1290 || ev.type == ButtonPress
1238 || ev.type == ButtonRelease) 1291 || ev.type == ButtonRelease)
1239 if (hidden_pointer) 1292 if (hidden_pointer)
1435 seen_resize = 1; 1488 seen_resize = 1;
1436 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1489 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1437 } 1490 }
1438 1491
1439#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ 1492#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */
1440 if (options & Opt_transparent) 1493 if (OPTION (Opt_transparent))
1441 check_our_parents (); 1494 check_our_parents ();
1442#endif 1495#endif
1443 } 1496 }
1444 break; 1497 break;
1445 1498
1601 } 1654 }
1602 1655
1603 scroll_selection_lines = Pixel2Height (dist) 1656 scroll_selection_lines = Pixel2Height (dist)
1604 / SELECTION_SCROLL_LINE_SPEEDUP 1657 / SELECTION_SCROLL_LINE_SPEEDUP
1605 + 1; 1658 + 1;
1606 MIN_IT (scroll_selection_lines, 1659 min_it (scroll_selection_lines,
1607 SELECTION_SCROLL_MAX_LINES); 1660 SELECTION_SCROLL_MAX_LINES);
1608 } 1661 }
1609 else 1662 else
1610 { 1663 {
1611 /* we are within the text window, so we 1664 /* we are within the text window, so we
1646{ 1699{
1647 if (!focus) 1700 if (!focus)
1648 { 1701 {
1649 focus = 1; 1702 focus = 1;
1650 want_refresh = 1; 1703 want_refresh = 1;
1704
1705 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1706
1651#if USE_XIM 1707#if USE_XIM
1652 if (Input_Context != NULL) 1708 if (Input_Context != NULL)
1653 { 1709 {
1654 IMSetStatusPosition (); 1710 IMSetStatusPosition ();
1655 XSetICFocus (Input_Context); 1711 XSetICFocus (Input_Context);
1656 } 1712 }
1657#endif 1713#endif
1658#if CURSOR_BLINK 1714#if CURSOR_BLINK
1659 if (options & Opt_cursorBlink) 1715 if (OPTION (Opt_cursorBlink))
1660 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1716 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1661#endif 1717#endif
1662#if OFF_FOCUS_FADING 1718#if OFF_FOCUS_FADING
1663 if (rs[Rs_fade]) 1719 if (rs[Rs_fade])
1664 { 1720 {
1675 if (focus) 1731 if (focus)
1676 { 1732 {
1677 focus = 0; 1733 focus = 0;
1678 want_refresh = 1; 1734 want_refresh = 1;
1679 1735
1736 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1737
1680#if ENABLE_FRILLS || ISO_14755 1738#if ENABLE_FRILLS || ISO_14755
1739 if (iso14755buf)
1740 {
1681 iso14755buf = 0; 1741 iso14755buf = 0;
1682#endif
1683#if ENABLE_OVERLAY 1742# if ENABLE_OVERLAY
1684 scr_overlay_off (); 1743 scr_overlay_off ();
1744# endif
1745 }
1685#endif 1746#endif
1686#if USE_XIM 1747#if USE_XIM
1687 if (Input_Context != NULL) 1748 if (Input_Context != NULL)
1688 XUnsetICFocus (Input_Context); 1749 XUnsetICFocus (Input_Context);
1689#endif 1750#endif
1690#if CURSOR_BLINK 1751#if CURSOR_BLINK
1691 if (options & Opt_cursorBlink) 1752 if (OPTION (Opt_cursorBlink))
1692 cursor_blink_ev.stop (); 1753 cursor_blink_ev.stop ();
1693 hidden_cursor = 0; 1754 hidden_cursor = 0;
1694#endif 1755#endif
1695#if OFF_FOCUS_FADING 1756#if OFF_FOCUS_FADING
1696 if (rs[Rs_fade]) 1757 if (rs[Rs_fade])
1720 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) 1781 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID])
1721 return; 1782 return;
1722 1783
1723 /* FALLTHROUGH */ 1784 /* FALLTHROUGH */
1724 case ReparentNotify: 1785 case ReparentNotify:
1725 if ((options & Opt_transparent) && check_our_parents () && am_transparent) 1786 if (OPTION (Opt_transparent) && check_our_parents () && am_transparent)
1726 want_refresh = want_full_refresh = 1; 1787 want_refresh = want_full_refresh = 1;
1727 break; 1788 break;
1728 } 1789 }
1729} 1790}
1730#endif 1791#endif
2072 2133
2073 v = ev.button == Button4 ? UP : DN; 2134 v = ev.button == Button4 ? UP : DN;
2074 2135
2075 if (ev.state & ShiftMask) 2136 if (ev.state & ShiftMask)
2076 i = 1; 2137 i = 1;
2077 else if (options & Opt_mouseWheelScrollPage) 2138 else if (OPTION (Opt_mouseWheelScrollPage))
2078 i = nrow - 1; 2139 i = nrow - 1;
2079 else 2140 else
2080 i = 5; 2141 i = 5;
2081 2142
2082# ifdef MOUSE_SLIP_WHEELING 2143# ifdef MOUSE_SLIP_WHEELING
2368 XWindowAttributes wattr, wrootattr; 2429 XWindowAttributes wattr, wrootattr;
2369 dDisp; 2430 dDisp;
2370 2431
2371 pchanged = 0; 2432 pchanged = 0;
2372 2433
2373 if (!(options & Opt_transparent)) 2434 if (!OPTION (Opt_transparent))
2374 return pchanged; /* Don't try any more */ 2435 return pchanged; /* Don't try any more */
2375 2436
2376 XGetWindowAttributes (disp, display->root, &wrootattr); 2437 XGetWindowAttributes (disp, display->root, &wrootattr);
2377 rootdepth = wrootattr.depth; 2438 rootdepth = wrootattr.depth;
2378 2439
2452 nh += sy; 2513 nh += sy;
2453 ny = -sy; 2514 ny = -sy;
2454 sy = 0; 2515 sy = 0;
2455 } 2516 }
2456 2517
2457 MIN_IT (nw, (unsigned int) (wrootattr.width - sx)); 2518 min_it (nw, (unsigned int) (wrootattr.width - sx));
2458 MIN_IT (nh, (unsigned int) (wrootattr.height - sy)); 2519 min_it (nh, (unsigned int) (wrootattr.height - sy));
2459 2520
2460 XSync (disp, False); 2521 XSync (disp, False);
2461 allowedxerror = -1; 2522 allowedxerror = -1;
2462 image = XGetImage (disp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); 2523 image = XGetImage (disp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap);
2463 2524
2656 if (ch == C0_LF) 2717 if (ch == C0_LF)
2657 nlines++; 2718 nlines++;
2658 2719
2659 refresh_count++; 2720 refresh_count++;
2660 2721
2661 if (!(options & Opt_jumpScroll) 2722 if (!OPTION (Opt_jumpScroll)
2662 || (refresh_count >= refresh_limit * (nrow - 1))) 2723 || (refresh_count >= refresh_limit * (nrow - 1)))
2663 { 2724 {
2664 refreshnow = true; 2725 refreshnow = true;
2726 refresh_count = 0;
2665 ch = NOCHAR; 2727 ch = NOCHAR;
2666 break; 2728 break;
2667 } 2729 }
2668 2730
2669 // scr_add_lines only works for nlines <= nrow - 1. 2731 // scr_add_lines only works for nlines <= nrow - 1.
2700 * the number of pages between refreshes is refresh_limit, which 2762 * the number of pages between refreshes is refresh_limit, which
2701 * is incremented here because we must be doing flat-out scrolling. 2763 * is incremented here because we must be doing flat-out scrolling.
2702 */ 2764 */
2703 if (refreshnow) 2765 if (refreshnow)
2704 { 2766 {
2705 if ((options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) 2767 if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
2706 refresh_limit++; 2768 refresh_limit++;
2707 else 2769 else
2708 { 2770 {
2709 flag = true; 2771 flag = true;
2710 scr_refresh (refresh_type); 2772 scr_refresh (refresh_type);
2773 flush_ev.stop ();
2711 } 2774 }
2712 } 2775 }
2713 2776
2714 } 2777 }
2715 else 2778 else
3374 break; 3437 break;
3375 case 6: /* CPR requested */ 3438 case 6: /* CPR requested */
3376 scr_report_position (); 3439 scr_report_position ();
3377 break; 3440 break;
3378 case 7: /* unofficial extension */ 3441 case 7: /* unofficial extension */
3379 if (options & Opt_insecure) 3442 if (OPTION (Opt_insecure))
3380 tt_printf ("%-.250s\012", rs[Rs_display_name]); 3443 tt_printf ("%-.250s\012", rs[Rs_display_name]);
3381 break; 3444 break;
3382 case 8: /* unofficial extension */ 3445 case 8: /* unofficial extension */
3383 process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); 3446 process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST);
3384 break; 3447 break;
3548 break; 3611 break;
3549 case 20: /* report icon label */ 3612 case 20: /* report icon label */
3550 { 3613 {
3551 char *s; 3614 char *s;
3552 XGetIconName (disp, parent[0], &s); 3615 XGetIconName (disp, parent[0], &s);
3553 tt_printf ("\033]L%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ 3616 tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */
3554 XFree (s); 3617 XFree (s);
3555 } 3618 }
3556 break; 3619 break;
3557 case 21: /* report window title */ 3620 case 21: /* report window title */
3558 { 3621 {
3559 char *s; 3622 char *s;
3560 XFetchName (disp, parent[0], &s); 3623 XFetchName (disp, parent[0], &s);
3561 tt_printf ("\033]l%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ 3624 tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */
3562 XFree (s); 3625 XFree (s);
3563 } 3626 }
3564 break; 3627 break;
3565 } 3628 }
3566} 3629}
3842 // TODO, when secure mode? 3905 // TODO, when secure mode?
3843 break; 3906 break;
3844 3907
3845#ifdef MENUBAR 3908#ifdef MENUBAR
3846 case URxvt_Menu: 3909 case URxvt_Menu:
3847 if (options & Opt_insecure) 3910 if (OPTION (Opt_insecure))
3848 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked 3911 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked
3849 break; 3912 break;
3850#endif 3913#endif
3851#if 0 3914#if 0
3852 case XTerm_dumpscreen: /* no error notices */ 3915 case XTerm_dumpscreen: /* no error notices */
3868 case URxvt_italicFont: 3931 case URxvt_italicFont:
3869 case URxvt_boldItalicFont: 3932 case URxvt_boldItalicFont:
3870#endif 3933#endif
3871 if (query) 3934 if (query)
3872 tt_printf ("\33]%d;%-.250s%c", saveop, 3935 tt_printf ("\33]%d;%-.250s%c", saveop,
3873 (options & Opt_insecure) && fontset[op - URxvt_font]->fontdesc 3936 OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc
3874 ? fontset[op - URxvt_font]->fontdesc : "", 3937 ? fontset[op - URxvt_font]->fontdesc : "",
3875 resp); 3938 resp);
3876 else 3939 else
3877 { 3940 {
3878 const char *&res = rs[Rs_font + (op - URxvt_font)]; 3941 const char *&res = rs[Rs_font + (op - URxvt_font)];
3884 break; 3947 break;
3885 3948
3886#if ENABLE_FRILLS 3949#if ENABLE_FRILLS
3887 case URxvt_locale: 3950 case URxvt_locale:
3888 if (query) 3951 if (query)
3889 tt_printf ("\33]%d;%-.250s%c", URxvt_locale, (options & Opt_insecure) ? locale : "", resp); 3952 tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp);
3890 else 3953 else
3891 { 3954 {
3892 set_locale (str); 3955 set_locale (str);
3893 pty.set_utf8_mode (enc_utf8); 3956 pty.set_utf8_mode (enc_utf8);
3894 init_xlocale (); 3957 init_xlocale ();
4022 } 4085 }
4023 4086
4024 /* extra handling for values with state unkept */ 4087 /* extra handling for values with state unkept */
4025 switch (arg[i]) 4088 switch (arg[i])
4026 { 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
4027 case 1048: /* alternative cursor save */ 4100 case 1048: /* alternative cursor save */
4028 case 1049: 4101 case 1049:
4029 if (options & Opt_secondaryScreen) 4102 if (OPTION (Opt_secondaryScreen))
4030 if (mode == 0) 4103 if (mode == 0)
4031 scr_cursor (RESTORE); 4104 scr_cursor (RESTORE);
4032 else if (mode == 1) 4105 else if (mode == 1)
4033 scr_cursor (SAVE); 4106 scr_cursor (SAVE);
4034 break; 4107 break;
4049 case 3: /* 80/132 */ 4122 case 3: /* 80/132 */
4050 if (priv_modes & PrivMode_132OK) 4123 if (priv_modes & PrivMode_132OK)
4051 set_widthheight (((state ? 132 : 80) * fwidth), height); 4124 set_widthheight (((state ? 132 : 80) * fwidth), height);
4052 break; 4125 break;
4053 case 4: /* smooth scrolling */ 4126 case 4: /* smooth scrolling */
4054 if (state) 4127 if (!state)
4055 options &= ~Opt_jumpScroll; 4128 SET_OPTION (Opt_jumpScroll);
4056 else 4129 else
4057 options |= Opt_jumpScroll; 4130 CLR_OPTION (Opt_jumpScroll);
4058 break; 4131 break;
4059 case 5: /* reverse video */ 4132 case 5: /* reverse video */
4060 scr_rvideo_mode (state); 4133 scr_rvideo_mode (state);
4061 break; 4134 break;
4062 case 6: /* relative/absolute origins */ 4135 case 6: /* relative/absolute origins */
4103#if 0 4176#if 0
4104 case 1001: 4177 case 1001:
4105 break; /* X11 mouse highlighting */ 4178 break; /* X11 mouse highlighting */
4106#endif 4179#endif
4107 case 1010: /* scroll to bottom on TTY output inhibit */ 4180 case 1010: /* scroll to bottom on TTY output inhibit */
4108 if (state) 4181 if (!state)
4109 options &= ~Opt_scrollTtyOutput; 4182 SET_OPTION (Opt_scrollTtyOutput);
4110 else 4183 else
4111 options |= Opt_scrollTtyOutput; 4184 CLR_OPTION (Opt_scrollTtyOutput);
4112 break; 4185 break;
4113 case 1011: /* scroll to bottom on key press */ 4186 case 1011: /* scroll to bottom on key press */
4114 if (state) 4187 if (state)
4115 options |= Opt_scrollTtyKeypress; 4188 SET_OPTION (Opt_scrollTtyKeypress);
4116 else 4189 else
4117 options &= ~Opt_scrollTtyKeypress; 4190 CLR_OPTION (Opt_scrollTtyKeypress);
4118 break; 4191 break;
4119 case 1047: /* secondary screen w/ clearing last */ 4192 case 1047: /* secondary screen w/ clearing last */
4120 if (options & Opt_secondaryScreen) 4193 if (OPTION (Opt_secondaryScreen))
4121 if (current_screen != PRIMARY) 4194 if (current_screen != PRIMARY)
4122 scr_erase_screen (2); 4195 scr_erase_screen (2);
4123 scr_change_screen (state); 4196 scr_change_screen (state);
4124 break; 4197 break;
4125 case 1049: /* secondary screen w/ clearing first */ 4198 case 1049: /* secondary screen w/ clearing first */
4126 scr_change_screen (state); 4199 scr_change_screen (state);
4127 if (options & Opt_secondaryScreen) 4200 if (OPTION (Opt_secondaryScreen))
4128 if (current_screen != PRIMARY) 4201 if (current_screen != PRIMARY)
4129 scr_erase_screen (2); 4202 scr_erase_screen (2);
4130 break; 4203 break;
4131 default: 4204 default:
4132 break; 4205 break;
4282 case 106: 4355 case 106:
4283 case 107: 4356 case 107:
4284 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); 4357 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg);
4285 break; 4358 break;
4286#endif 4359#endif
4287
4288 } 4360 }
4289 } 4361 }
4290} 4362}
4291/*}}} */ 4363/*}}} */
4292 4364
4373 } 4445 }
4374 4446
4375 memmove (v_buffer, v_buffer + written, v_buflen); 4447 memmove (v_buffer, v_buffer + written, v_buflen);
4376 } 4448 }
4377 else if (written != -1 || (errno != EAGAIN && errno != EINTR)) 4449 else if (written != -1 || (errno != EAGAIN && errno != EINTR))
4378 // original code just ignores this... 4450 pty_ev.set (EVENT_READ);
4379 destroy ();
4380} 4451}
4381 4452
4382/*----------------------- end-of-file (C source) -----------------------*/ 4453/*----------------------- end-of-file (C source) -----------------------*/
4383 4454

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines