… | |
… | |
140 | valid_keysym = keysym != NoSymbol; |
140 | valid_keysym = keysym != NoSymbol; |
141 | } |
141 | } |
142 | |
142 | |
143 | if (valid_keysym) |
143 | if (valid_keysym) |
144 | { |
144 | { |
145 | /* for some backwards compatibility */ |
|
|
146 | #if defined(HOTKEY_CTRL) || defined(HOTKEY_META) |
|
|
147 | # ifdef HOTKEY_CTRL |
|
|
148 | if (ctrl) |
|
|
149 | # else |
|
|
150 | if (meta) |
|
|
151 | # endif |
|
|
152 | { |
|
|
153 | if (keysym == ks_bigfont) |
|
|
154 | { |
|
|
155 | change_font (FONT_UP); |
|
|
156 | return; |
|
|
157 | } |
|
|
158 | else if (keysym == ks_smallfont) |
|
|
159 | { |
|
|
160 | change_font (FONT_DN); |
|
|
161 | return; |
|
|
162 | } |
|
|
163 | } |
|
|
164 | #endif |
|
|
165 | |
|
|
166 | if (TermWin.saveLines) |
145 | if (TermWin.saveLines) |
167 | { |
146 | { |
168 | #ifdef UNSHIFTED_SCROLLKEYS |
147 | #ifdef UNSHIFTED_SCROLLKEYS |
169 | if (!ctrl && !meta) |
148 | if (!ctrl && !meta) |
170 | { |
149 | { |
… | |
… | |
261 | #ifdef KEYSYM_RESOURCE |
240 | #ifdef KEYSYM_RESOURCE |
262 | if (! (shft | ctrl) && Keysym_map[keysym & 0xFF] != NULL) |
241 | if (! (shft | ctrl) && Keysym_map[keysym & 0xFF] != NULL) |
263 | { |
242 | { |
264 | unsigned int l; |
243 | unsigned int l; |
265 | const unsigned char *kbuf0; |
244 | const unsigned char *kbuf0; |
266 | const unsigned char ch = C0_ESC; |
|
|
267 | |
245 | |
268 | kbuf0 = (Keysym_map[keysym & 0xFF]); |
246 | kbuf0 = (Keysym_map[keysym & 0xFF]); |
269 | l = (unsigned int)*kbuf0++; |
247 | l = (unsigned int)*kbuf0++; |
270 | |
248 | |
271 | /* escape prefix */ |
249 | /* escape prefix */ |
272 | if (meta) |
250 | if (meta |
273 | # ifdef META8_OPTION |
251 | # ifdef META8_OPTION |
274 | if (meta_char == C0_ESC) |
252 | && meta_char == C0_ESC |
275 | # endif |
253 | # endif |
|
|
254 | ) |
|
|
255 | { |
|
|
256 | const unsigned char ch = C0_ESC; |
276 | tt_write (&ch, 1); |
257 | tt_write (&ch, 1); |
|
|
258 | } |
|
|
259 | |
277 | tt_write (kbuf0, l); |
260 | tt_write (kbuf0, l); |
278 | return; |
261 | return; |
279 | } |
262 | } |
280 | else |
263 | else |
281 | #endif |
264 | #endif |
… | |
… | |
545 | break; |
528 | break; |
546 | } |
529 | } |
547 | if (newlen) |
530 | if (newlen) |
548 | len = STRLEN (kbuf); |
531 | len = STRLEN (kbuf); |
549 | } |
532 | } |
|
|
533 | |
550 | /* |
534 | /* |
551 | * Pass meta for all function keys, if 'meta' option set |
535 | * Pass meta for all function keys, if 'meta' option set |
552 | */ |
536 | */ |
553 | #ifdef META8_OPTION |
537 | #ifdef META8_OPTION |
554 | if (meta && (meta_char == 0x80) && len > 0) |
538 | if (meta && (meta_char == 0x80) && len > 0) |
… | |
… | |
569 | { |
553 | { |
570 | unsigned char *ch; |
554 | unsigned char *ch; |
571 | |
555 | |
572 | for (ch = kbuf; ch < kbuf + len; ch++) |
556 | for (ch = kbuf; ch < kbuf + len; ch++) |
573 | *ch |= 0x80; |
557 | *ch |= 0x80; |
|
|
558 | |
574 | meta = 0; |
559 | meta = 0; |
575 | } |
560 | } |
576 | #endif |
561 | #endif |
577 | /* nil */ ; |
562 | /* nil */ ; |
578 | } |
563 | } |
… | |
… | |
774 | |
759 | |
775 | bool |
760 | bool |
776 | rxvt_term::cmd_parse () |
761 | rxvt_term::cmd_parse () |
777 | { |
762 | { |
778 | bool flag = false; |
763 | bool flag = false; |
779 | uint32_t ch = NOCHAR; |
764 | unicode_t ch = NOCHAR; |
780 | |
765 | |
781 | for (;;) |
766 | for (;;) |
782 | { |
767 | { |
783 | if (ch == NOCHAR) |
768 | if (ch == NOCHAR) |
784 | ch = next_char (); |
769 | ch = next_char (); |
… | |
… | |
787 | break; |
772 | break; |
788 | |
773 | |
789 | if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') |
774 | if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') |
790 | { |
775 | { |
791 | /* Read a text string from the input buffer */ |
776 | /* Read a text string from the input buffer */ |
792 | uint32_t buf[BUFSIZ]; |
777 | unicode_t buf[BUFSIZ]; |
793 | bool refreshnow = false; |
778 | bool refreshnow = false; |
794 | int nlines = 0; |
779 | int nlines = 0; |
795 | uint32_t *str = buf; |
780 | unicode_t *str = buf; |
796 | |
781 | |
797 | *str++ = ch; |
782 | *str++ = ch; |
798 | |
783 | |
799 | for (;;) |
784 | for (;;) |
800 | { |
785 | { |
… | |
… | |
878 | return flag; |
863 | return flag; |
879 | } |
864 | } |
880 | |
865 | |
881 | // read the next character, currently handles UTF-8 |
866 | // read the next character, currently handles UTF-8 |
882 | // will probably handle all sorts of other stuff in the future |
867 | // will probably handle all sorts of other stuff in the future |
883 | uint32_t |
868 | unicode_t |
884 | rxvt_term::next_char () |
869 | rxvt_term::next_char () |
885 | { |
870 | { |
886 | while (cmdbuf_ptr < cmdbuf_endp) |
871 | while (cmdbuf_ptr < cmdbuf_endp) |
887 | { |
872 | { |
888 | // assume 0x20 .. 0x7f to be ascii ALWAYS (all shift-states etc.) uh-oh |
873 | // assume 0x20 .. 0x7f to be ascii ALWAYS (all shift-states etc.) uh-oh |
… | |
… | |
914 | /* rxvt_cmd_getc () - Return next input character */ |
899 | /* rxvt_cmd_getc () - Return next input character */ |
915 | /* |
900 | /* |
916 | * Return the next input character after first passing any keyboard input |
901 | * Return the next input character after first passing any keyboard input |
917 | * to the command. |
902 | * to the command. |
918 | */ |
903 | */ |
919 | uint32_t |
904 | unicode_t |
920 | rxvt_term::cmd_getc () |
905 | rxvt_term::cmd_getc () |
921 | { |
906 | { |
922 | for (;;) |
907 | for (;;) |
923 | { |
908 | { |
924 | uint32_t c = next_char (); |
909 | unicode_t c = next_char (); |
925 | if (c != NOCHAR) |
910 | if (c != NOCHAR) |
926 | return c; |
911 | return c; |
927 | |
912 | |
928 | // incomplete sequences should occur rarely, still, a better solution |
913 | // incomplete sequences should occur rarely, still, a better solution |
929 | // would be preferred. either setjmp/longjmp or better design. |
914 | // would be preferred. either setjmp/longjmp or better design. |
… | |
… | |
1934 | if (have_pixmap) |
1919 | if (have_pixmap) |
1935 | { |
1920 | { |
1936 | /* |
1921 | /* |
1937 | * Copy display->root pixmap transparency |
1922 | * Copy display->root pixmap transparency |
1938 | */ |
1923 | */ |
1939 | int sx, sy, nx, ny; |
1924 | int sx, sy, nx, ny; |
1940 | unsigned int nw, nh; |
1925 | unsigned int nw, nh; |
1941 | Window cr; |
1926 | Window cr; |
1942 | XImage *image; |
1927 | XImage *image; |
1943 | GC gc; |
1928 | GC gc; |
1944 | XGCValues gcvalue; |
1929 | XGCValues gcvalue; |
1945 | |
1930 | |
1946 | XTranslateCoordinates (display->display, TermWin.parent[0], display->root, |
1931 | XTranslateCoordinates (display->display, TermWin.parent[0], display->root, |
1947 | 0, 0, &sx, &sy, &cr); |
1932 | 0, 0, &sx, &sy, &cr); |
1948 | nw = (unsigned int)szHint.width; |
1933 | nw = (unsigned int)szHint.width; |
1949 | nh = (unsigned int)szHint.height; |
1934 | nh = (unsigned int)szHint.height; |
1950 | nx = ny = 0; |
1935 | nx = ny = 0; |
|
|
1936 | |
1951 | if (sx < 0) |
1937 | if (sx < 0) |
1952 | { |
1938 | { |
1953 | nw += sx; |
1939 | nw += sx; |
1954 | nx = -sx; |
1940 | nx = -sx; |
1955 | sx = 0; |
1941 | sx = 0; |
1956 | } |
1942 | } |
|
|
1943 | |
1957 | if (sy < 0) |
1944 | if (sy < 0) |
1958 | { |
1945 | { |
1959 | nh += sy; |
1946 | nh += sy; |
1960 | ny = -sy; |
1947 | ny = -sy; |
1961 | sy = 0; |
1948 | sy = 0; |
1962 | } |
1949 | } |
|
|
1950 | |
1963 | MIN_IT (nw, (unsigned int) (wrootattr.width - sx)); |
1951 | MIN_IT (nw, (unsigned int) (wrootattr.width - sx)); |
1964 | MIN_IT (nh, (unsigned int) (wrootattr.height - sy)); |
1952 | MIN_IT (nh, (unsigned int) (wrootattr.height - sy)); |
1965 | allowedxerror = -1; |
1953 | allowedxerror = -1; |
1966 | image = XGetImage (display->display, rootpixmap, sx, sy, nw, nh, AllPlanes, |
1954 | image = XGetImage (display->display, rootpixmap, sx, sy, nw, nh, AllPlanes, |
1967 | ZPixmap); |
1955 | ZPixmap); |
… | |
… | |
2000 | if (!am_transparent || !am_pixmap_trans) |
1988 | if (!am_transparent || !am_pixmap_trans) |
2001 | pchanged = 1; |
1989 | pchanged = 1; |
2002 | am_transparent = am_pixmap_trans = 1; |
1990 | am_transparent = am_pixmap_trans = 1; |
2003 | } |
1991 | } |
2004 | } |
1992 | } |
|
|
1993 | |
2005 | if (!am_pixmap_trans) |
1994 | if (!am_pixmap_trans) |
2006 | { |
1995 | { |
2007 | unsigned int n; |
1996 | unsigned int n; |
2008 | /* |
1997 | /* |
2009 | * InheritPixmap transparency |
1998 | * InheritPixmap transparency |
… | |
… | |
2024 | break; |
2013 | break; |
2025 | } |
2014 | } |
2026 | if (oldp != TermWin.parent[i]) |
2015 | if (oldp != TermWin.parent[i]) |
2027 | pchanged = 1; |
2016 | pchanged = 1; |
2028 | } |
2017 | } |
|
|
2018 | |
2029 | n = 0; |
2019 | n = 0; |
|
|
2020 | |
2030 | if (pchanged) |
2021 | if (pchanged) |
2031 | { |
2022 | { |
2032 | for (; n < (unsigned int)i; n++) |
2023 | for (; n < (unsigned int)i; n++) |
2033 | { |
2024 | { |
2034 | XGetWindowAttributes (display->display, TermWin.parent[n], &wattr); |
2025 | XGetWindowAttributes (display->display, TermWin.parent[n], &wattr); |
… | |
… | |
2038 | n = (int) (sizeof (TermWin.parent) / sizeof (Window)) + 1; |
2029 | n = (int) (sizeof (TermWin.parent) / sizeof (Window)) + 1; |
2039 | break; |
2030 | break; |
2040 | } |
2031 | } |
2041 | } |
2032 | } |
2042 | } |
2033 | } |
|
|
2034 | |
2043 | if (n > (int) (sizeof (TermWin.parent) |
2035 | if (n > (int) (sizeof (TermWin.parent) |
2044 | / sizeof (TermWin.parent[0]))) |
2036 | / sizeof (TermWin.parent[0]))) |
2045 | { |
2037 | { |
2046 | D_X ((stderr, "InheritPixmap Turning off")); |
2038 | D_X ((stderr, "InheritPixmap Turning off")); |
2047 | XSetWindowBackground (display->display, TermWin.parent[0], |
2039 | XSetWindowBackground (display->display, TermWin.parent[0], |
… | |
… | |
2070 | ParentRelative); |
2062 | ParentRelative); |
2071 | XSetWindowBackgroundPixmap (display->display, TermWin.vt, |
2063 | XSetWindowBackgroundPixmap (display->display, TermWin.vt, |
2072 | ParentRelative); |
2064 | ParentRelative); |
2073 | am_transparent = 1; |
2065 | am_transparent = 1; |
2074 | } |
2066 | } |
|
|
2067 | |
2075 | for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) |
2068 | for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) |
2076 | TermWin.parent[i] = None; |
2069 | TermWin.parent[i] = None; |
2077 | } |
2070 | } |
2078 | return pchanged; |
2071 | return pchanged; |
2079 | } |
2072 | } |
… | |
… | |
2085 | /*----------------------------------------------------------------------*/ |
2078 | /*----------------------------------------------------------------------*/ |
2086 | #ifdef PRINTPIPE |
2079 | #ifdef PRINTPIPE |
2087 | FILE * |
2080 | FILE * |
2088 | rxvt_term::popen_printer () |
2081 | rxvt_term::popen_printer () |
2089 | { |
2082 | { |
2090 | FILE *stream = popen (rs[Rs_print_pipe], "w"); |
2083 | FILE *stream = popen (rs[Rs_print_pipe], "w"); |
2091 | |
2084 | |
2092 | if (stream == NULL) |
2085 | if (stream == NULL) |
2093 | rxvt_print_error ("can't open printer pipe"); |
2086 | rxvt_print_error ("can't open printer pipe"); |
2094 | return stream; |
2087 | return stream; |
2095 | } |
2088 | } |
… | |
… | |
2338 | break; |
2331 | break; |
2339 | |
2332 | |
2340 | /* 8.3.87: NEXT LINE */ |
2333 | /* 8.3.87: NEXT LINE */ |
2341 | case C1_NEL: /* ESC E */ |
2334 | case C1_NEL: /* ESC E */ |
2342 | { |
2335 | { |
2343 | uint32_t nlcr[] = { '\n', '\r' }; |
2336 | unicode_t nlcr[] = { L'\n', L'\r' }; |
2344 | scr_add_lines (nlcr, 1, 2); |
2337 | scr_add_lines (nlcr, 1, 2); |
2345 | } |
2338 | } |
2346 | break; |
2339 | break; |
2347 | |
2340 | |
2348 | /* kidnapped escape sequence: Should be 8.3.48 */ |
2341 | /* kidnapped escape sequence: Should be 8.3.48 */ |
… | |
… | |
2936 | * 19 = change underlined character color |
2929 | * 19 = change underlined character color |
2937 | * 46 = change logfile (not implemented) |
2930 | * 46 = change logfile (not implemented) |
2938 | * 50 = change font |
2931 | * 50 = change font |
2939 | * |
2932 | * |
2940 | * rxvt extensions: |
2933 | * rxvt extensions: |
2941 | * 9 = change locale (NYI) |
|
|
2942 | * 10 = menu (may change in future) |
2934 | * 10 = menu (may change in future) |
2943 | * 20 = bg pixmap |
2935 | * 20 = bg pixmap |
2944 | * 39 = change default fg color |
2936 | * 39 = change default fg color |
2945 | * 49 = change default bg color |
2937 | * 49 = change default bg color |
2946 | * 55 = dump scrollback buffer and all of screen |
2938 | * 55 = dump scrollback buffer and all of screen |
|
|
2939 | * 701 = change locale |
|
|
2940 | * 702 = find font |
2947 | */ |
2941 | */ |
2948 | void |
2942 | void |
2949 | rxvt_term::xterm_seq (int op, const char *str, unsigned char resp __attribute__ ((unused))) |
2943 | rxvt_term::xterm_seq (int op, const char *str, unsigned char resp __attribute__ ((unused))) |
2950 | { |
2944 | { |
2951 | int changed = 0; |
2945 | int changed = 0; |
… | |
… | |
3049 | { |
3043 | { |
3050 | set_locale (str); |
3044 | set_locale (str); |
3051 | # ifdef USE_XIM |
3045 | # ifdef USE_XIM |
3052 | im_cb (); |
3046 | im_cb (); |
3053 | # endif |
3047 | # endif |
3054 | // TODO: call selection_make with the right values set |
|
|
3055 | // to re-fresh the selection. |
|
|
3056 | if (display->selection_owner == this) |
|
|
3057 | display->set_selection_owner (0); |
|
|
3058 | } |
3048 | } |
|
|
3049 | break; |
|
|
3050 | case XTerm_findfont: |
|
|
3051 | { |
|
|
3052 | int fid = TermWin.fontset->find_font (atoi (str)); |
|
|
3053 | tt_printf ("%d %-.250s\n", fid, (*TermWin.fontset)[fid]->name); |
|
|
3054 | } |
3059 | break; |
3055 | break; |
3060 | #endif |
3056 | #endif |
3061 | #if 0 |
3057 | #if 0 |
3062 | case XTerm_dumpscreen: /* no error notices */ |
3058 | case XTerm_dumpscreen: /* no error notices */ |
3063 | { |
3059 | { |
… | |
… | |
3130 | { menuBar_esc, PrivMode_menuBar }, |
3126 | { menuBar_esc, PrivMode_menuBar }, |
3131 | #endif |
3127 | #endif |
3132 | #ifdef scrollBar_esc |
3128 | #ifdef scrollBar_esc |
3133 | { scrollBar_esc, PrivMode_scrollBar }, |
3129 | { scrollBar_esc, PrivMode_scrollBar }, |
3134 | #endif |
3130 | #endif |
|
|
3131 | // 18, 19 printing-related |
3135 | { 25, PrivMode_VisibleCursor }, |
3132 | { 25, PrivMode_VisibleCursor }, |
|
|
3133 | // 30 show scrollbar rxvt. extension |
3136 | { 35, PrivMode_ShiftKeys }, |
3134 | { 35, PrivMode_ShiftKeys }, // rxvt extension |
3137 | { 40, PrivMode_132OK }, |
3135 | { 40, PrivMode_132OK }, |
|
|
3136 | // 41 xterm more fixes NYI |
|
|
3137 | // 45 margin bell NYI |
|
|
3138 | // 46 start logging |
3138 | { 47, PrivMode_Screen }, |
3139 | { 47, PrivMode_Screen }, |
3139 | { 66, PrivMode_aplKP }, |
3140 | { 66, PrivMode_aplKP }, |
3140 | #ifndef NO_BACKSPACE_KEY |
3141 | #ifndef NO_BACKSPACE_KEY |
3141 | { 67, PrivMode_BackSpace }, |
3142 | { 67, PrivMode_BackSpace }, |
3142 | #endif |
3143 | #endif |
3143 | { 1000, PrivMode_MouseX11 }, |
3144 | { 1000, PrivMode_MouseX11 }, |
|
|
3145 | // 1001 Use Hilite Mouse Tracking. NYI, TODO |
|
|
3146 | // 1002 Use Cell Motion Mouse Tracking. NYI, TODO |
|
|
3147 | // 1003 Use All Motion Mouse Tracking. NYI, TODO |
3144 | { 1010, PrivMode_TtyOutputInh }, |
3148 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3145 | { 1011, PrivMode_Keypress }, |
3149 | { 1011, PrivMode_Keypress }, // rxvt extension |
|
|
3150 | // 1035 enable modifiers for alt, numlock NYI |
|
|
3151 | // 1036 send ESC for meta keys NYI |
|
|
3152 | // 1037 send DEL for keypad delete NYI |
3146 | { 1047, PrivMode_Screen }, |
3153 | { 1047, PrivMode_Screen }, |
|
|
3154 | // 1048 save and restore cursor |
3147 | { 1049, PrivMode_Screen }, /* xterm extension, not fully implemented */ |
3155 | { 1049, PrivMode_Screen }, /* xterm extension, not fully implemented */ |
|
|
3156 | // 1051, 1052, 1060, 1061 keyboard emulation NYI |
3148 | }; |
3157 | }; |
3149 | |
3158 | |
3150 | if (nargs == 0) |
3159 | if (nargs == 0) |
3151 | return; |
3160 | return; |
3152 | |
3161 | |
… | |
… | |
3167 | state = privcases (mode, argtopriv[j].bit); |
3176 | state = privcases (mode, argtopriv[j].bit); |
3168 | break; |
3177 | break; |
3169 | } |
3178 | } |
3170 | |
3179 | |
3171 | /* extra handling for values with state unkept */ |
3180 | /* extra handling for values with state unkept */ |
|
|
3181 | switch (arg[i]) |
|
|
3182 | { |
|
|
3183 | case 1048: /* alternative cursor save */ |
|
|
3184 | case 1049: |
|
|
3185 | if (mode == 0) |
|
|
3186 | scr_cursor (RESTORE); |
|
|
3187 | else if (mode == 1) |
|
|
3188 | scr_cursor (SAVE); |
|
|
3189 | /* FALLTHROUGH */ |
|
|
3190 | } |
|
|
3191 | |
3172 | if (state == -1) |
3192 | if (state >= 0) |
|
|
3193 | /* extra handling for values with valid 0 or 1 state */ |
3173 | switch (arg[i]) |
3194 | switch (arg[i]) |
3174 | { |
3195 | { |
3175 | case 1048: /* alternative cursor save */ |
3196 | /* case 1: - application cursor keys */ |
|
|
3197 | case 2: /* VT52 mode */ |
|
|
3198 | /* oddball mode. should be set regardless of set/reset |
|
|
3199 | * parameter. Return from VT52 mode with an ESC < from |
|
|
3200 | * within VT52 mode |
|
|
3201 | */ |
|
|
3202 | PrivMode (1, PrivMode_vt52); |
|
|
3203 | break; |
|
|
3204 | case 3: /* 80/132 */ |
|
|
3205 | if (PrivateModes & PrivMode_132OK) |
|
|
3206 | set_widthheight (((state ? 132 : 80) * TermWin.fwidth), TermWin.height); |
|
|
3207 | break; |
|
|
3208 | case 4: /* smooth scrolling */ |
3176 | if (mode == 0) |
3209 | if (state) |
3177 | scr_cursor (RESTORE); |
3210 | Options &= ~Opt_jumpScroll; |
3178 | else if (mode == 1) |
3211 | else |
3179 | scr_cursor (SAVE); |
3212 | Options |= Opt_jumpScroll; |
|
|
3213 | break; |
|
|
3214 | case 5: /* reverse video */ |
|
|
3215 | scr_rvideo_mode (state); |
|
|
3216 | break; |
|
|
3217 | case 6: /* relative/absolute origins */ |
|
|
3218 | scr_relative_origin (state); |
|
|
3219 | break; |
|
|
3220 | case 7: /* autowrap */ |
|
|
3221 | scr_autowrap (state); |
|
|
3222 | break; |
|
|
3223 | /* case 8: - auto repeat, can't do on a per window basis */ |
|
|
3224 | case 9: /* X10 mouse reporting */ |
|
|
3225 | if (state) /* orthogonal */ |
|
|
3226 | PrivateModes &= ~ (PrivMode_MouseX11); |
|
|
3227 | break; |
|
|
3228 | #ifdef menuBar_esc |
|
|
3229 | case menuBar_esc: |
|
|
3230 | #ifdef MENUBAR |
|
|
3231 | map_menuBar (state); |
|
|
3232 | #endif |
|
|
3233 | break; |
|
|
3234 | #endif |
|
|
3235 | #ifdef scrollBar_esc |
|
|
3236 | case scrollBar_esc: |
|
|
3237 | if (scrollbar_mapping (state)) |
|
|
3238 | { |
|
|
3239 | resize_all_windows (0, 0, 0); |
|
|
3240 | scr_touch (true); |
|
|
3241 | } |
|
|
3242 | break; |
|
|
3243 | #endif |
|
|
3244 | case 25: /* visible/invisible cursor */ |
|
|
3245 | scr_cursor_visible (state); |
|
|
3246 | break; |
|
|
3247 | /* case 35: - shift keys */ |
|
|
3248 | /* case 40: - 80 <--> 132 mode */ |
|
|
3249 | case 47: /* secondary screen */ |
|
|
3250 | scr_change_screen (state); |
|
|
3251 | break; |
|
|
3252 | /* case 66: - application key pad */ |
|
|
3253 | /* case 67: - backspace key */ |
|
|
3254 | case 1000: /* X11 mouse reporting */ |
|
|
3255 | if (state) /* orthogonal */ |
|
|
3256 | PrivateModes &= ~ (PrivMode_MouseX10); |
|
|
3257 | break; |
|
|
3258 | #if 0 |
|
|
3259 | case 1001: |
|
|
3260 | break; /* X11 mouse highlighting */ |
|
|
3261 | #endif |
|
|
3262 | case 1010: /* scroll to bottom on TTY output inhibit */ |
|
|
3263 | if (state) |
|
|
3264 | Options &= ~Opt_scrollTtyOutput; |
|
|
3265 | else |
|
|
3266 | Options |= Opt_scrollTtyOutput; |
|
|
3267 | break; |
|
|
3268 | case 1011: /* scroll to bottom on key press */ |
|
|
3269 | if (state) |
|
|
3270 | Options |= Opt_scrollTtyKeypress; |
|
|
3271 | else |
|
|
3272 | Options &= ~Opt_scrollTtyKeypress; |
|
|
3273 | break; |
|
|
3274 | case 1047: /* secondary screen w/ clearing */ |
|
|
3275 | case 1049: /* better secondary screen w/ clearing, but not fully implemented */ |
|
|
3276 | if (current_screen != PRIMARY) |
|
|
3277 | scr_erase_screen (2); |
|
|
3278 | scr_change_screen (state); |
3180 | /* FALLTHROUGH */ |
3279 | /* FALLTHROUGH */ |
3181 | default: |
3280 | default: |
3182 | continue; /* for (;i;) */ |
3281 | break; |
3183 | } |
3282 | } |
3184 | |
|
|
3185 | /* extra handling for values with valid 0 or 1 state */ |
|
|
3186 | switch (arg[i]) |
|
|
3187 | { |
|
|
3188 | /* case 1: - application cursor keys */ |
|
|
3189 | case 2: /* VT52 mode */ |
|
|
3190 | /* oddball mode. should be set regardless of set/reset |
|
|
3191 | * parameter. Return from VT52 mode with an ESC < from |
|
|
3192 | * within VT52 mode |
|
|
3193 | */ |
|
|
3194 | PrivMode (1, PrivMode_vt52); |
|
|
3195 | break; |
|
|
3196 | case 3: /* 80/132 */ |
|
|
3197 | if (PrivateModes & PrivMode_132OK) |
|
|
3198 | set_widthheight ( (unsigned int) ((state ? 132 : 80) * TermWin.fwidth), |
|
|
3199 | (unsigned int)TermWin.height); |
|
|
3200 | break; |
|
|
3201 | case 4: /* smooth scrolling */ |
|
|
3202 | if (state) |
|
|
3203 | Options &= ~Opt_jumpScroll; |
|
|
3204 | else |
|
|
3205 | Options |= Opt_jumpScroll; |
|
|
3206 | break; |
|
|
3207 | case 5: /* reverse video */ |
|
|
3208 | scr_rvideo_mode (state); |
|
|
3209 | break; |
|
|
3210 | case 6: /* relative/absolute origins */ |
|
|
3211 | scr_relative_origin (state); |
|
|
3212 | break; |
|
|
3213 | case 7: /* autowrap */ |
|
|
3214 | scr_autowrap (state); |
|
|
3215 | break; |
|
|
3216 | /* case 8: - auto repeat, can't do on a per window basis */ |
|
|
3217 | case 9: /* X10 mouse reporting */ |
|
|
3218 | if (state) /* orthogonal */ |
|
|
3219 | PrivateModes &= ~ (PrivMode_MouseX11); |
|
|
3220 | break; |
|
|
3221 | #ifdef menuBar_esc |
|
|
3222 | case menuBar_esc: |
|
|
3223 | #ifdef MENUBAR |
|
|
3224 | map_menuBar (state); |
|
|
3225 | #endif |
|
|
3226 | break; |
|
|
3227 | #endif |
|
|
3228 | #ifdef scrollBar_esc |
|
|
3229 | case scrollBar_esc: |
|
|
3230 | if (scrollbar_mapping (state)) |
|
|
3231 | { |
|
|
3232 | resize_all_windows (0, 0, 0); |
|
|
3233 | scr_touch (true); |
|
|
3234 | } |
|
|
3235 | break; |
|
|
3236 | #endif |
|
|
3237 | case 25: /* visible/invisible cursor */ |
|
|
3238 | scr_cursor_visible (state); |
|
|
3239 | break; |
|
|
3240 | /* case 35: - shift keys */ |
|
|
3241 | /* case 40: - 80 <--> 132 mode */ |
|
|
3242 | case 47: /* secondary screen */ |
|
|
3243 | scr_change_screen (state); |
|
|
3244 | break; |
|
|
3245 | /* case 66: - application key pad */ |
|
|
3246 | /* case 67: - backspace key */ |
|
|
3247 | case 1000: /* X11 mouse reporting */ |
|
|
3248 | if (state) /* orthogonal */ |
|
|
3249 | PrivateModes &= ~ (PrivMode_MouseX10); |
|
|
3250 | break; |
|
|
3251 | #if 0 |
|
|
3252 | case 1001: |
|
|
3253 | break; /* X11 mouse highlighting */ |
|
|
3254 | #endif |
|
|
3255 | case 1010: /* scroll to bottom on TTY output inhibit */ |
|
|
3256 | if (state) |
|
|
3257 | Options &= ~Opt_scrollTtyOutput; |
|
|
3258 | else |
|
|
3259 | Options |= Opt_scrollTtyOutput; |
|
|
3260 | break; |
|
|
3261 | case 1011: /* scroll to bottom on key press */ |
|
|
3262 | if (state) |
|
|
3263 | Options |= Opt_scrollTtyKeypress; |
|
|
3264 | else |
|
|
3265 | Options &= ~Opt_scrollTtyKeypress; |
|
|
3266 | break; |
|
|
3267 | case 1047: /* secondary screen w/ clearing */ |
|
|
3268 | case 1049: /* better secondary screen w/ clearing, but not fully implemented */ |
|
|
3269 | if (current_screen != PRIMARY) |
|
|
3270 | scr_erase_screen (2); |
|
|
3271 | scr_change_screen (state); |
|
|
3272 | /* FALLTHROUGH */ |
|
|
3273 | default: |
|
|
3274 | break; |
|
|
3275 | } |
|
|
3276 | } |
3283 | } |
3277 | } |
3284 | } |
3278 | /*}}} */ |
3285 | /*}}} */ |
3279 | |
3286 | |
3280 | /*{{{ process sgr sequences */ |
3287 | /*{{{ process sgr sequences */ |
… | |
… | |
3308 | rendset = 1, rendstyle = RS_Blink; |
3315 | rendset = 1, rendstyle = RS_Blink; |
3309 | break; |
3316 | break; |
3310 | case 7: |
3317 | case 7: |
3311 | rendset = 1, rendstyle = RS_RVid; |
3318 | rendset = 1, rendstyle = RS_RVid; |
3312 | break; |
3319 | break; |
|
|
3320 | case 8: |
|
|
3321 | // invisible. NYI |
|
|
3322 | break; |
3313 | case 22: |
3323 | case 22: |
3314 | rendset = 0, rendstyle = RS_Bold; |
3324 | rendset = 0, rendstyle = RS_Bold; |
3315 | break; |
3325 | break; |
3316 | case 24: |
3326 | case 24: |
3317 | rendset = 0, rendstyle = RS_Uline; |
3327 | rendset = 0, rendstyle = RS_Uline; |
… | |
… | |
3320 | rendset = 0, rendstyle = RS_Blink; |
3330 | rendset = 0, rendstyle = RS_Blink; |
3321 | break; |
3331 | break; |
3322 | case 27: |
3332 | case 27: |
3323 | rendset = 0, rendstyle = RS_RVid; |
3333 | rendset = 0, rendstyle = RS_RVid; |
3324 | break; |
3334 | break; |
|
|
3335 | case 28: |
|
|
3336 | // visible. NYI |
|
|
3337 | break; |
3325 | } |
3338 | } |
|
|
3339 | |
3326 | if (rendset != -1) |
3340 | if (rendset != -1) |
3327 | { |
3341 | { |
3328 | scr_rendition (rendset, rendstyle); |
3342 | scr_rendition (rendset, rendstyle); |
3329 | continue; /* for (;i;) */ |
3343 | continue; /* for (;i;) */ |
3330 | } |
3344 | } |
… | |
… | |
3337 | case 33: |
3351 | case 33: |
3338 | case 34: |
3352 | case 34: |
3339 | case 35: |
3353 | case 35: |
3340 | case 36: |
3354 | case 36: |
3341 | case 37: |
3355 | case 37: |
3342 | scr_color ((unsigned int) (minCOLOR + (arg[i] - 30)), |
3356 | scr_color ((unsigned int) (minCOLOR + (arg[i] - 30)), Color_fg); |
3343 | Color_fg); |
|
|
3344 | break; |
3357 | break; |
3345 | #ifdef TTY_256COLOR |
3358 | #ifdef TTY_256COLOR |
3346 | case 38: |
3359 | case 38: |
3347 | if (nargs > i + 2 && arg[i + 1] == 5) |
3360 | if (nargs > i + 2 && arg[i + 1] == 5) |
3348 | { |
3361 | { |
3349 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), |
3362 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg); |
3350 | Color_fg); |
|
|
3351 | i += 2; |
3363 | i += 2; |
3352 | } |
3364 | } |
3353 | break; |
3365 | break; |
3354 | #endif |
3366 | #endif |
3355 | case 39: /* default fg */ |
3367 | case 39: /* default fg */ |
… | |
… | |
3362 | case 43: |
3374 | case 43: |
3363 | case 44: |
3375 | case 44: |
3364 | case 45: |
3376 | case 45: |
3365 | case 46: |
3377 | case 46: |
3366 | case 47: |
3378 | case 47: |
3367 | scr_color ((unsigned int) (minCOLOR + (arg[i] - 40)), |
3379 | scr_color ((unsigned int) (minCOLOR + (arg[i] - 40)), Color_bg); |
3368 | Color_bg); |
|
|
3369 | break; |
3380 | break; |
3370 | #ifdef TTY_256COLOR |
3381 | #ifdef TTY_256COLOR |
3371 | case 48: |
3382 | case 48: |
3372 | if (nargs > i + 2 && arg[i + 1] == 5) |
3383 | if (nargs > i + 2 && arg[i + 1] == 5) |
3373 | { |
3384 | { |
3374 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), |
3385 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg); |
3375 | Color_bg); |
|
|
3376 | i += 2; |
3386 | i += 2; |
3377 | } |
3387 | } |
3378 | break; |
3388 | break; |
3379 | #endif |
3389 | #endif |
3380 | case 49: /* default bg */ |
3390 | case 49: /* default bg */ |