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