… | |
… | |
52 | |
52 | |
53 | #include <wchar.h> |
53 | #include <wchar.h> |
54 | |
54 | |
55 | /*----------------------------------------------------------------------*/ |
55 | /*----------------------------------------------------------------------*/ |
56 | |
56 | |
|
|
57 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
|
|
58 | |
|
|
59 | // exception thrown when the command parser runs out of input data |
|
|
60 | class out_of_input { } out_of_input; |
|
|
61 | |
57 | /*{{{ Convert the keypress event into a string */ |
62 | /*{{{ Convert the keypress event into a string */ |
58 | void |
63 | void |
59 | rxvt_term::lookup_key (XKeyEvent &ev) |
64 | rxvt_term::lookup_key (XKeyEvent &ev) |
60 | { |
65 | { |
61 | int ctrl, meta, shft, len; |
66 | int ctrl, meta, shft, len; |
… | |
… | |
88 | #ifdef USE_XIM |
93 | #ifdef USE_XIM |
89 | if (Input_Context) |
94 | if (Input_Context) |
90 | { |
95 | { |
91 | Status status_return; |
96 | Status status_return; |
92 | |
97 | |
|
|
98 | #if 0 |
93 | #ifdef X_HAVE_UTF8_STRING |
99 | #ifdef X_HAVE_UTF8_STRING |
94 | if (enc_utf8 && 0) // currently disabled, doesn't seem to work, nor is useful |
100 | if (enc_utf8 && 0) // currently disabled, doesn't seem to work, nor is useful |
95 | len = Xutf8LookupString (Input_Context, &ev, (char *)kbuf, |
101 | len = Xutf8LookupString (Input_Context, &ev, (char *)kbuf, |
96 | KBUFSZ, &keysym, &status_return); |
102 | KBUFSZ, &keysym, &status_return); |
97 | else |
103 | else |
|
|
104 | #endif |
98 | #endif |
105 | #endif |
99 | { |
106 | { |
100 | wchar_t wkbuf[KBUFSZ + 1]; |
107 | wchar_t wkbuf[KBUFSZ + 1]; |
101 | |
108 | |
102 | // the XOpenIM manpage lies about hardcoding the locale |
109 | // the XOpenIM manpage lies about hardcoding the locale |
… | |
… | |
110 | SET_LOCALE (locale); |
117 | SET_LOCALE (locale); |
111 | |
118 | |
112 | if (status_return == XLookupChars |
119 | if (status_return == XLookupChars |
113 | || status_return == XLookupBoth) |
120 | || status_return == XLookupBoth) |
114 | { |
121 | { |
|
|
122 | /* make sure the user can type ctrl-@, i.e. NUL */ |
|
|
123 | if (len == 1 && *wkbuf == 0) |
|
|
124 | { |
|
|
125 | kbuf[0] = 0; |
|
|
126 | len = 1; |
|
|
127 | } |
|
|
128 | else |
|
|
129 | { |
115 | wkbuf[len] = 0; |
130 | wkbuf[len] = 0; |
116 | len = wcstombs ((char *)kbuf, wkbuf, KBUFSZ); |
131 | len = wcstombs ((char *)kbuf, wkbuf, KBUFSZ); |
117 | if (len < 0) |
132 | if (len < 0) |
118 | len = 0; |
133 | len = 0; |
|
|
134 | } |
119 | } |
135 | } |
120 | else |
136 | else |
121 | len = 0; |
137 | len = 0; |
122 | } |
138 | } |
123 | |
139 | |
… | |
… | |
131 | valid_keysym = keysym != NoSymbol; |
147 | valid_keysym = keysym != NoSymbol; |
132 | } |
148 | } |
133 | |
149 | |
134 | if (valid_keysym) |
150 | if (valid_keysym) |
135 | { |
151 | { |
136 | /* for some backwards compatibility */ |
|
|
137 | #if defined(HOTKEY_CTRL) || defined(HOTKEY_META) |
|
|
138 | # ifdef HOTKEY_CTRL |
|
|
139 | if (ctrl) |
|
|
140 | # else |
|
|
141 | if (meta) |
|
|
142 | # endif |
|
|
143 | { |
|
|
144 | if (keysym == ks_bigfont) |
|
|
145 | { |
|
|
146 | change_font (FONT_UP); |
|
|
147 | return; |
|
|
148 | } |
|
|
149 | else if (keysym == ks_smallfont) |
|
|
150 | { |
|
|
151 | change_font (FONT_DN); |
|
|
152 | return; |
|
|
153 | } |
|
|
154 | } |
|
|
155 | #endif |
|
|
156 | |
|
|
157 | if (TermWin.saveLines) |
152 | if (TermWin.saveLines) |
158 | { |
153 | { |
159 | #ifdef UNSHIFTED_SCROLLKEYS |
154 | #ifdef UNSHIFTED_SCROLLKEYS |
160 | if (!ctrl && !meta) |
155 | if (!ctrl && !meta) |
161 | { |
156 | { |
… | |
… | |
252 | #ifdef KEYSYM_RESOURCE |
247 | #ifdef KEYSYM_RESOURCE |
253 | if (! (shft | ctrl) && Keysym_map[keysym & 0xFF] != NULL) |
248 | if (! (shft | ctrl) && Keysym_map[keysym & 0xFF] != NULL) |
254 | { |
249 | { |
255 | unsigned int l; |
250 | unsigned int l; |
256 | const unsigned char *kbuf0; |
251 | const unsigned char *kbuf0; |
257 | const unsigned char ch = C0_ESC; |
|
|
258 | |
252 | |
259 | kbuf0 = (Keysym_map[keysym & 0xFF]); |
253 | kbuf0 = (Keysym_map[keysym & 0xFF]); |
260 | l = (unsigned int)*kbuf0++; |
254 | l = (unsigned int)*kbuf0++; |
261 | |
255 | |
262 | /* escape prefix */ |
256 | /* escape prefix */ |
263 | if (meta) |
257 | if (meta |
264 | # ifdef META8_OPTION |
258 | # ifdef META8_OPTION |
265 | if (meta_char == C0_ESC) |
259 | && meta_char == C0_ESC |
266 | # endif |
260 | # endif |
|
|
261 | ) |
|
|
262 | { |
|
|
263 | const unsigned char ch = C0_ESC; |
267 | tt_write (&ch, 1); |
264 | tt_write (&ch, 1); |
|
|
265 | } |
|
|
266 | |
268 | tt_write (kbuf0, l); |
267 | tt_write (kbuf0, l); |
269 | return; |
268 | return; |
270 | } |
269 | } |
271 | else |
270 | else |
272 | #endif |
271 | #endif |
… | |
… | |
282 | ^ !!ctrl) ? '\b' : '\177'; |
281 | ^ !!ctrl) ? '\b' : '\177'; |
283 | kbuf[1] = '\0'; |
282 | kbuf[1] = '\0'; |
284 | } |
283 | } |
285 | else |
284 | else |
286 | STRCPY (kbuf, key_backspace); |
285 | STRCPY (kbuf, key_backspace); |
287 | # ifdef MULTICHAR_SET |
|
|
288 | if ((Options & Opt_mc_hack) && screen.cur.col > 0) |
|
|
289 | { |
|
|
290 | int col, row; |
|
|
291 | |
|
|
292 | newlen = STRLEN (kbuf); |
|
|
293 | col = screen.cur.col - 1; |
|
|
294 | row = screen.cur.row + TermWin.saveLines; |
|
|
295 | if (IS_MULTI2 (screen.rend[row][col])) |
|
|
296 | MEMMOVE (kbuf + newlen, kbuf, newlen + 1); |
|
|
297 | } |
|
|
298 | # endif |
|
|
299 | break; |
286 | break; |
300 | #endif |
287 | #endif |
301 | #ifndef NO_DELETE_KEY |
288 | #ifndef NO_DELETE_KEY |
302 | case XK_Delete: |
289 | case XK_Delete: |
303 | STRCPY (kbuf, key_delete); |
290 | STRCPY (kbuf, key_delete); |
304 | # ifdef MULTICHAR_SET |
|
|
305 | if (Options & Opt_mc_hack) |
|
|
306 | { |
|
|
307 | int col, row; |
|
|
308 | |
|
|
309 | newlen = STRLEN (kbuf); |
|
|
310 | col = screen.cur.col; |
|
|
311 | row = screen.cur.row + TermWin.saveLines; |
|
|
312 | if (IS_MULTI1 (screen.rend[row][col])) |
|
|
313 | MEMMOVE (kbuf + newlen, kbuf, newlen + 1); |
|
|
314 | } |
|
|
315 | # endif |
|
|
316 | break; |
291 | break; |
317 | #endif |
292 | #endif |
318 | case XK_Tab: |
293 | case XK_Tab: |
319 | if (shft) |
294 | if (shft) |
320 | STRCPY (kbuf, "\033[Z"); |
295 | STRCPY (kbuf, "\033[Z"); |
… | |
… | |
362 | kbuf[1] = 'O'; |
337 | kbuf[1] = 'O'; |
363 | kbuf[2] = "dacb"[keysym - XK_Left]; |
338 | kbuf[2] = "dacb"[keysym - XK_Left]; |
364 | } |
339 | } |
365 | else if (PrivateModes & PrivMode_aplCUR) |
340 | else if (PrivateModes & PrivMode_aplCUR) |
366 | kbuf[1] = 'O'; |
341 | kbuf[1] = 'O'; |
367 | #ifdef MULTICHAR_SET |
|
|
368 | //TODO: ?? |
|
|
369 | if (Options & Opt_mc_hack) |
|
|
370 | { |
|
|
371 | int col, row, m; |
|
|
372 | |
|
|
373 | col = screen.cur.col; |
|
|
374 | row = screen.cur.row + TermWin.saveLines; |
|
|
375 | m = 0; |
|
|
376 | if (keysym == XK_Right |
|
|
377 | && IS_MULTI1 (screen.rend[row][col])) |
|
|
378 | m = 1; |
|
|
379 | else if (keysym == XK_Left) |
|
|
380 | { |
|
|
381 | if (col > 0) |
|
|
382 | { |
|
|
383 | if (IS_MULTI2 (screen.rend[row][col - 1])) |
|
|
384 | m = 1; |
|
|
385 | } |
|
|
386 | else if (screen.cur.row > 0) |
|
|
387 | { |
|
|
388 | col = screen.tlen[--row]; |
|
|
389 | if (col == -1) |
|
|
390 | col = TermWin.ncol - 1; |
|
|
391 | else |
|
|
392 | col--; |
|
|
393 | if (col > 0 |
|
|
394 | && IS_MULTI2 (screen.rend[row][col])) |
|
|
395 | m = 1; |
|
|
396 | } |
|
|
397 | } |
|
|
398 | if (m) |
|
|
399 | MEMMOVE (kbuf + 3, kbuf, 3 + 1); |
|
|
400 | } |
|
|
401 | #endif |
|
|
402 | break; |
342 | break; |
403 | |
343 | |
404 | #ifndef UNSHIFTED_SCROLLKEYS |
344 | #ifndef UNSHIFTED_SCROLLKEYS |
405 | # ifdef XK_KP_Prior |
345 | # ifdef XK_KP_Prior |
406 | case XK_KP_Prior: |
346 | case XK_KP_Prior: |
… | |
… | |
595 | break; |
535 | break; |
596 | } |
536 | } |
597 | if (newlen) |
537 | if (newlen) |
598 | len = STRLEN (kbuf); |
538 | len = STRLEN (kbuf); |
599 | } |
539 | } |
|
|
540 | |
600 | /* |
541 | /* |
601 | * Pass meta for all function keys, if 'meta' option set |
542 | * Pass meta for all function keys, if 'meta' option set |
602 | */ |
543 | */ |
603 | #ifdef META8_OPTION |
544 | #ifdef META8_OPTION |
604 | if (meta && (meta_char == 0x80) && len > 0) |
545 | if (meta && (meta_char == 0x80) && len > 0) |
… | |
… | |
619 | { |
560 | { |
620 | unsigned char *ch; |
561 | unsigned char *ch; |
621 | |
562 | |
622 | for (ch = kbuf; ch < kbuf + len; ch++) |
563 | for (ch = kbuf; ch < kbuf + len; ch++) |
623 | *ch |= 0x80; |
564 | *ch |= 0x80; |
|
|
565 | |
624 | meta = 0; |
566 | meta = 0; |
625 | } |
567 | } |
626 | #endif |
568 | #endif |
627 | /* nil */ ; |
569 | /* nil */ ; |
628 | } |
570 | } |
… | |
… | |
653 | kbuf[len - 1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~')); |
595 | kbuf[len - 1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~')); |
654 | |
596 | |
655 | /* escape prefix */ |
597 | /* escape prefix */ |
656 | if (meta |
598 | if (meta |
657 | #ifdef META8_OPTION |
599 | #ifdef META8_OPTION |
658 | && (meta_char == C0_ESC) |
600 | && meta_char == C0_ESC |
659 | #endif |
601 | #endif |
660 | ) |
602 | ) |
661 | { |
603 | { |
662 | const unsigned char ch = C0_ESC; |
604 | const unsigned char ch = C0_ESC; |
663 | |
|
|
664 | tt_write (&ch, 1); |
605 | tt_write (&ch, 1); |
665 | } |
606 | } |
|
|
607 | |
666 | #ifdef DEBUG_CMD |
608 | #if defined(DEBUG_CMD) |
667 | if (debug_key) |
|
|
668 | { /* Display keyboard buffer contents */ |
609 | /* Display keyboard buffer contents */ |
669 | char *p; |
610 | unsigned char *p; |
670 | int i; |
611 | int i; |
671 | |
612 | |
672 | fprintf (stderr, "key 0x%04X [%d]: `", (unsigned int)keysym, len); |
613 | fprintf (stderr, "key 0x%04X [%d]: `", (unsigned int)keysym, len); |
673 | for (i = 0, p = kbuf; i < len; i++, p++) |
614 | for (i = 0, p = kbuf; i < len; i++, p++) |
674 | fprintf (stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); |
615 | fprintf (stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); |
675 | fprintf (stderr, "'\n"); |
616 | fprintf (stderr, "'\n"); |
676 | } |
|
|
677 | #endif /* DEBUG_CMD */ |
617 | #endif /* DEBUG_CMD */ |
678 | tt_write (kbuf, (unsigned int)len); |
618 | tt_write (kbuf, (unsigned int)len); |
679 | } |
619 | } |
680 | /*}}} */ |
620 | /*}}} */ |
681 | |
621 | |
… | |
… | |
683 | /*{{{ rxvt_cmd_write (), rxvt_cmd_getc () */ |
623 | /*{{{ rxvt_cmd_write (), rxvt_cmd_getc () */ |
684 | /* attempt to `write' count to the input buffer */ |
624 | /* attempt to `write' count to the input buffer */ |
685 | unsigned int |
625 | unsigned int |
686 | rxvt_term::cmd_write (const unsigned char *str, unsigned int count) |
626 | rxvt_term::cmd_write (const unsigned char *str, unsigned int count) |
687 | { |
627 | { |
688 | unsigned int n, s; |
628 | unsigned int n, s; |
689 | |
629 | |
690 | n = cmdbuf_ptr - cmdbuf_base; |
630 | n = cmdbuf_ptr - cmdbuf_base; |
691 | s = cmdbuf_base + BUFSIZ - 1 - cmdbuf_endp; |
631 | s = cmdbuf_base + CBUFSIZ - 1 - cmdbuf_endp; |
|
|
632 | |
692 | if (n > 0 && s < count) |
633 | if (n > 0 && s < count) |
693 | { |
634 | { |
694 | MEMMOVE (cmdbuf_base, cmdbuf_ptr, |
635 | MEMMOVE (cmdbuf_base, cmdbuf_ptr, |
695 | (unsigned int) (cmdbuf_endp - cmdbuf_ptr)); |
636 | (unsigned int) (cmdbuf_endp - cmdbuf_ptr)); |
696 | cmdbuf_ptr = cmdbuf_base; |
637 | cmdbuf_ptr = cmdbuf_base; |
697 | cmdbuf_endp -= n; |
638 | cmdbuf_endp -= n; |
698 | s += n; |
639 | s += n; |
699 | } |
640 | } |
|
|
641 | |
700 | if (count > s) |
642 | if (count > s) |
701 | { |
643 | { |
702 | rxvt_print_error ("data loss: cmd_write too large"); |
644 | rxvt_warn ("data loss: cmd_write too large, continuing.\n"); |
703 | count = s; |
645 | count = s; |
704 | } |
646 | } |
|
|
647 | |
705 | for (; count--;) |
648 | for (; count--;) |
706 | *cmdbuf_endp++ = *str++; |
649 | *cmdbuf_endp++ = *str++; |
|
|
650 | |
|
|
651 | cmd_parse (); |
|
|
652 | |
707 | return 0; |
653 | return 0; |
708 | } |
654 | } |
709 | #endif /* MENUBAR_MAX */ |
655 | #endif /* MENUBAR_MAX */ |
710 | |
656 | |
711 | void |
657 | void |
… | |
… | |
774 | |
720 | |
775 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
721 | memmove (cmdbuf_base, cmdbuf_ptr, n); |
776 | cmdbuf_ptr = cmdbuf_base; |
722 | cmdbuf_ptr = cmdbuf_base; |
777 | cmdbuf_endp = cmdbuf_ptr + n; |
723 | cmdbuf_endp = cmdbuf_ptr + n; |
778 | |
724 | |
779 | n = read (cmd_fd, cmdbuf_endp, BUFSIZ - n); |
725 | n = read (cmd_fd, cmdbuf_endp, CBUFSIZ - n); |
780 | |
726 | |
781 | if (n > 0) |
727 | if (n > 0) |
782 | { |
728 | { |
783 | cmdbuf_endp += n; |
729 | cmdbuf_endp += n; |
784 | return true; |
730 | return true; |
785 | } |
731 | } |
786 | else if (n < 0 && errno != EAGAIN) |
732 | else if (n < 0 && errno != EAGAIN) |
787 | destroy (); |
733 | destroy (); |
788 | |
734 | |
789 | return false; |
735 | return false; |
790 | } |
736 | } |
791 | |
737 | |
792 | void |
738 | void |
793 | rxvt_term::pty_cb (io_watcher &w, short revents) |
739 | rxvt_term::pty_cb (io_watcher &w, short revents) |
… | |
… | |
797 | |
743 | |
798 | if (revents & EVENT_WRITE) |
744 | if (revents & EVENT_WRITE) |
799 | tt_write (0, 0); |
745 | tt_write (0, 0); |
800 | else if (revents & EVENT_READ) |
746 | else if (revents & EVENT_READ) |
801 | { |
747 | { |
802 | bool flag = true; |
|
|
803 | |
|
|
804 | // loop, but don't allow a single term to monopolize us |
748 | // loop, but don't allow a single term to monopolize us |
805 | // the number of loops is fully arbitrary, and thus wrong |
749 | // the number of loops is fully arbitrary, and thus wrong |
806 | while (flag && pty_fill ()) |
750 | while (pty_fill ()) |
807 | { |
751 | { |
808 | if (!seen_input) |
752 | if (!seen_input) |
809 | { |
753 | { |
810 | seen_input = 1; |
754 | seen_input = 1; |
811 | /* once we know the shell is running, send the screen size. Again! */ |
755 | /* once we know the shell is running, send the screen size. Again! */ |
|
|
756 | // I don't know why, btw. |
812 | tt_winch (); |
757 | tt_winch (); |
813 | } |
758 | } |
814 | |
759 | |
815 | uint32_t ch = NOCHAR; |
760 | if (cmd_parse ()) |
816 | |
|
|
817 | for (;;) |
|
|
818 | { |
|
|
819 | if (ch == NOCHAR) |
|
|
820 | ch = next_char (); |
|
|
821 | |
|
|
822 | if (ch == NOCHAR) // TODO: improve |
|
|
823 | break; |
761 | break; |
824 | |
|
|
825 | if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') |
|
|
826 | { |
|
|
827 | /* Read a text string from the input buffer */ |
|
|
828 | uint32_t buf[BUFSIZ]; |
|
|
829 | bool refreshnow = false; |
|
|
830 | int nlines = 0; |
|
|
831 | uint32_t *str = buf; |
|
|
832 | |
|
|
833 | *str++ = ch; |
|
|
834 | |
|
|
835 | for (;;) |
|
|
836 | { |
|
|
837 | ch = next_char (); |
|
|
838 | |
|
|
839 | if (ch == NOCHAR || (ch < ' ' && ch != '\t' && ch != '\n' && ch != '\r')) |
|
|
840 | break; |
|
|
841 | else |
|
|
842 | { |
|
|
843 | *str++ = ch; |
|
|
844 | |
|
|
845 | if (ch == '\n') |
|
|
846 | { |
|
|
847 | nlines++; |
|
|
848 | refresh_count++; |
|
|
849 | |
|
|
850 | if (! (Options & Opt_jumpScroll) |
|
|
851 | || (refresh_count >= (refresh_limit * (TermWin.nrow - 1)))) |
|
|
852 | { |
|
|
853 | refreshnow = true; |
|
|
854 | flag = false; |
|
|
855 | ch = NOCHAR; |
|
|
856 | break; |
|
|
857 | } |
|
|
858 | |
|
|
859 | // scr_add_lines only works for nlines < TermWin.nrow - 1. |
|
|
860 | if (nlines >= TermWin.nrow - 1) |
|
|
861 | { |
|
|
862 | scr_add_lines (buf, nlines, str - buf); |
|
|
863 | nlines = 0; |
|
|
864 | str = buf; |
|
|
865 | } |
|
|
866 | } |
|
|
867 | |
|
|
868 | if (str >= buf + BUFSIZ) |
|
|
869 | { |
|
|
870 | ch = NOCHAR; |
|
|
871 | break; |
|
|
872 | } |
|
|
873 | } |
|
|
874 | } |
|
|
875 | |
|
|
876 | scr_add_lines (buf, nlines, str - buf); |
|
|
877 | |
|
|
878 | /* |
|
|
879 | * If there have been a lot of new lines, then update the screen |
|
|
880 | * What the heck I'll cheat and only refresh less than every page-full. |
|
|
881 | * the number of pages between refreshes is refresh_limit, which |
|
|
882 | * is incremented here because we must be doing flat-out scrolling. |
|
|
883 | * |
|
|
884 | * refreshing should be correct for small scrolls, because of the |
|
|
885 | * time-out |
|
|
886 | */ |
|
|
887 | if (refreshnow) |
|
|
888 | { |
|
|
889 | if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
|
|
890 | refresh_limit++; |
|
|
891 | |
|
|
892 | scr_refresh (refresh_type); |
|
|
893 | } |
|
|
894 | |
|
|
895 | } |
|
|
896 | else |
|
|
897 | { |
|
|
898 | switch (ch) |
|
|
899 | { |
|
|
900 | default: |
|
|
901 | process_nonprinting (ch); |
|
|
902 | break; |
|
|
903 | case C0_ESC: /* escape char */ |
|
|
904 | process_escape_seq (); |
|
|
905 | break; |
|
|
906 | /*case 0x9b: */ /* CSI */ |
|
|
907 | /* process_csi_seq (); */ |
|
|
908 | } |
|
|
909 | |
|
|
910 | ch = NOCHAR; |
|
|
911 | } |
|
|
912 | } |
762 | } |
913 | } |
|
|
914 | } |
|
|
915 | } |
|
|
916 | |
|
|
917 | // read the next character, currently handles UTF-8 |
|
|
918 | // will probably handle all sorts of other stuff in the future |
|
|
919 | uint32_t |
|
|
920 | rxvt_term::next_char () |
|
|
921 | { |
|
|
922 | while (cmdbuf_ptr < cmdbuf_endp) |
|
|
923 | { |
|
|
924 | if (*cmdbuf_ptr < 0x80) // assume < 0x80 to be ascii ALWAYS (all shift-states etc.) uh-oh |
|
|
925 | return *cmdbuf_ptr++; |
|
|
926 | |
|
|
927 | wchar_t wc; |
|
|
928 | size_t len = mbrtowc (&wc, (char *)cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); |
|
|
929 | |
|
|
930 | if (len == (size_t)-2) |
|
|
931 | return NOCHAR; |
|
|
932 | |
|
|
933 | if (len == (size_t)-1) |
|
|
934 | return *cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
|
|
935 | |
|
|
936 | // assume wchar == unicode |
|
|
937 | cmdbuf_ptr += len; |
|
|
938 | return wc; |
|
|
939 | } |
|
|
940 | |
|
|
941 | return NOCHAR; |
|
|
942 | } |
|
|
943 | |
|
|
944 | /* rxvt_cmd_getc () - Return next input character */ |
|
|
945 | /* |
|
|
946 | * Return the next input character after first passing any keyboard input |
|
|
947 | * to the command. |
|
|
948 | */ |
|
|
949 | uint32_t |
|
|
950 | rxvt_term::cmd_getc () |
|
|
951 | { |
|
|
952 | for (;;) |
|
|
953 | { |
|
|
954 | uint32_t c = next_char (); |
|
|
955 | if (c != NOCHAR) |
|
|
956 | return c; |
|
|
957 | |
|
|
958 | // incomplete sequences should occur rarely, still, a better solution |
|
|
959 | // would be preferred. either setjmp/longjmp or better design. |
|
|
960 | fcntl (cmd_fd, F_SETFL, 0); |
|
|
961 | pty_fill (); |
|
|
962 | fcntl (cmd_fd, F_SETFL, O_NONBLOCK); |
|
|
963 | } |
763 | } |
964 | } |
764 | } |
965 | |
765 | |
966 | #ifdef POINTER_BLANK |
766 | #ifdef POINTER_BLANK |
967 | void |
767 | void |
… | |
… | |
997 | pointer_blank (); |
797 | pointer_blank (); |
998 | } |
798 | } |
999 | #endif |
799 | #endif |
1000 | |
800 | |
1001 | void |
801 | void |
1002 | rxvt_term::mouse_report (const XButtonEvent &ev) |
802 | rxvt_term::mouse_report (XButtonEvent &ev) |
1003 | { |
803 | { |
1004 | int button_number, key_state = 0; |
804 | int button_number, key_state = 0; |
1005 | int x, y; |
805 | int x, y; |
1006 | |
806 | |
1007 | x = ev.x; |
807 | x = ev.x; |
1008 | y = ev.y; |
808 | y = ev.y; |
1009 | pixel_position (&x, &y); |
809 | pixel_position (&x, &y); |
1010 | |
810 | |
… | |
… | |
1336 | |
1136 | |
1337 | } |
1137 | } |
1338 | break; |
1138 | break; |
1339 | |
1139 | |
1340 | case SelectionClear: |
1140 | case SelectionClear: |
1341 | display->set_selection_owner (0); |
1141 | selection_clear (); |
1342 | break; |
1142 | break; |
1343 | |
1143 | |
1344 | case SelectionNotify: |
1144 | case SelectionNotify: |
1345 | if (selection_wait == Sel_normal) |
1145 | if (selection_wait == Sel_normal) |
1346 | selection_paste (ev.xselection.requestor, |
1146 | selection_paste (ev.xselection.requestor, |
… | |
… | |
1415 | pointer_unblank (); |
1215 | pointer_unblank (); |
1416 | #endif |
1216 | #endif |
1417 | #if MENUBAR |
1217 | #if MENUBAR |
1418 | if (isMenuBarWindow (ev.xany.window)) |
1218 | if (isMenuBarWindow (ev.xany.window)) |
1419 | { |
1219 | { |
1420 | menubar_control (& (ev.xbutton)); |
1220 | menubar_control (ev.xbutton); |
1421 | break; |
1221 | break; |
1422 | } |
1222 | } |
1423 | #endif |
1223 | #endif |
1424 | if ((PrivateModes & PrivMode_mouse_report) && ! (bypass_keystate)) |
1224 | if ((PrivateModes & PrivMode_mouse_report) && ! (bypass_keystate)) |
1425 | break; |
1225 | break; |
… | |
… | |
1554 | #endif |
1354 | #endif |
1555 | } |
1355 | } |
1556 | } |
1356 | } |
1557 | |
1357 | |
1558 | void |
1358 | void |
1559 | rxvt_term::button_press (const XButtonEvent &ev) |
1359 | rxvt_term::button_press (XButtonEvent &ev) |
1560 | { |
1360 | { |
1561 | int reportmode = 0, clickintime; |
1361 | int reportmode = 0, clickintime; |
1562 | |
1362 | |
1563 | bypass_keystate = ev.state & (ModMetaMask | ShiftMask); |
1363 | bypass_keystate = ev.state & (ModMetaMask | ShiftMask); |
1564 | if (!bypass_keystate) |
1364 | if (!bypass_keystate) |
… | |
… | |
1792 | menubar_control (ev); |
1592 | menubar_control (ev); |
1793 | #endif |
1593 | #endif |
1794 | } |
1594 | } |
1795 | |
1595 | |
1796 | void |
1596 | void |
1797 | rxvt_term::button_release (const XButtonEvent &ev) |
1597 | rxvt_term::button_release (XButtonEvent &ev) |
1798 | { |
1598 | { |
1799 | int reportmode = 0; |
1599 | int reportmode = 0; |
1800 | |
1600 | |
1801 | csrO = 0; /* reset csr Offset */ |
1601 | csrO = 0; /* reset csr Offset */ |
1802 | if (!bypass_keystate) |
1602 | if (!bypass_keystate) |
… | |
… | |
1964 | if (have_pixmap) |
1764 | if (have_pixmap) |
1965 | { |
1765 | { |
1966 | /* |
1766 | /* |
1967 | * Copy display->root pixmap transparency |
1767 | * Copy display->root pixmap transparency |
1968 | */ |
1768 | */ |
1969 | int sx, sy, nx, ny; |
1769 | int sx, sy, nx, ny; |
1970 | unsigned int nw, nh; |
1770 | unsigned int nw, nh; |
1971 | Window cr; |
1771 | Window cr; |
1972 | XImage *image; |
1772 | XImage *image; |
1973 | GC gc; |
1773 | GC gc; |
1974 | XGCValues gcvalue; |
1774 | XGCValues gcvalue; |
1975 | |
1775 | |
1976 | XTranslateCoordinates (display->display, TermWin.parent[0], display->root, |
1776 | XTranslateCoordinates (display->display, TermWin.parent[0], display->root, |
1977 | 0, 0, &sx, &sy, &cr); |
1777 | 0, 0, &sx, &sy, &cr); |
1978 | nw = (unsigned int)szHint.width; |
1778 | nw = (unsigned int)szHint.width; |
1979 | nh = (unsigned int)szHint.height; |
1779 | nh = (unsigned int)szHint.height; |
1980 | nx = ny = 0; |
1780 | nx = ny = 0; |
|
|
1781 | |
1981 | if (sx < 0) |
1782 | if (sx < 0) |
1982 | { |
1783 | { |
1983 | nw += sx; |
1784 | nw += sx; |
1984 | nx = -sx; |
1785 | nx = -sx; |
1985 | sx = 0; |
1786 | sx = 0; |
1986 | } |
1787 | } |
|
|
1788 | |
1987 | if (sy < 0) |
1789 | if (sy < 0) |
1988 | { |
1790 | { |
1989 | nh += sy; |
1791 | nh += sy; |
1990 | ny = -sy; |
1792 | ny = -sy; |
1991 | sy = 0; |
1793 | sy = 0; |
1992 | } |
1794 | } |
|
|
1795 | |
1993 | MIN_IT (nw, (unsigned int) (wrootattr.width - sx)); |
1796 | MIN_IT (nw, (unsigned int) (wrootattr.width - sx)); |
1994 | MIN_IT (nh, (unsigned int) (wrootattr.height - sy)); |
1797 | MIN_IT (nh, (unsigned int) (wrootattr.height - sy)); |
1995 | allowedxerror = -1; |
1798 | allowedxerror = -1; |
1996 | image = XGetImage (display->display, rootpixmap, sx, sy, nw, nh, AllPlanes, |
1799 | image = XGetImage (display->display, rootpixmap, sx, sy, nw, nh, AllPlanes, |
1997 | ZPixmap); |
1800 | ZPixmap); |
… | |
… | |
2030 | if (!am_transparent || !am_pixmap_trans) |
1833 | if (!am_transparent || !am_pixmap_trans) |
2031 | pchanged = 1; |
1834 | pchanged = 1; |
2032 | am_transparent = am_pixmap_trans = 1; |
1835 | am_transparent = am_pixmap_trans = 1; |
2033 | } |
1836 | } |
2034 | } |
1837 | } |
|
|
1838 | |
2035 | if (!am_pixmap_trans) |
1839 | if (!am_pixmap_trans) |
2036 | { |
1840 | { |
2037 | unsigned int n; |
1841 | unsigned int n; |
2038 | /* |
1842 | /* |
2039 | * InheritPixmap transparency |
1843 | * InheritPixmap transparency |
… | |
… | |
2054 | break; |
1858 | break; |
2055 | } |
1859 | } |
2056 | if (oldp != TermWin.parent[i]) |
1860 | if (oldp != TermWin.parent[i]) |
2057 | pchanged = 1; |
1861 | pchanged = 1; |
2058 | } |
1862 | } |
|
|
1863 | |
2059 | n = 0; |
1864 | n = 0; |
|
|
1865 | |
2060 | if (pchanged) |
1866 | if (pchanged) |
2061 | { |
1867 | { |
2062 | for (; n < (unsigned int)i; n++) |
1868 | for (; n < (unsigned int)i; n++) |
2063 | { |
1869 | { |
2064 | XGetWindowAttributes (display->display, TermWin.parent[n], &wattr); |
1870 | XGetWindowAttributes (display->display, TermWin.parent[n], &wattr); |
… | |
… | |
2068 | n = (int) (sizeof (TermWin.parent) / sizeof (Window)) + 1; |
1874 | n = (int) (sizeof (TermWin.parent) / sizeof (Window)) + 1; |
2069 | break; |
1875 | break; |
2070 | } |
1876 | } |
2071 | } |
1877 | } |
2072 | } |
1878 | } |
|
|
1879 | |
2073 | if (n > (int) (sizeof (TermWin.parent) |
1880 | if (n > (int) (sizeof (TermWin.parent) |
2074 | / sizeof (TermWin.parent[0]))) |
1881 | / sizeof (TermWin.parent[0]))) |
2075 | { |
1882 | { |
2076 | D_X ((stderr, "InheritPixmap Turning off")); |
1883 | D_X ((stderr, "InheritPixmap Turning off")); |
2077 | XSetWindowBackground (display->display, TermWin.parent[0], |
1884 | XSetWindowBackground (display->display, TermWin.parent[0], |
… | |
… | |
2100 | ParentRelative); |
1907 | ParentRelative); |
2101 | XSetWindowBackgroundPixmap (display->display, TermWin.vt, |
1908 | XSetWindowBackgroundPixmap (display->display, TermWin.vt, |
2102 | ParentRelative); |
1909 | ParentRelative); |
2103 | am_transparent = 1; |
1910 | am_transparent = 1; |
2104 | } |
1911 | } |
|
|
1912 | |
2105 | for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) |
1913 | for (; i < (int) (sizeof (TermWin.parent) / sizeof (Window)); i++) |
2106 | TermWin.parent[i] = None; |
1914 | TermWin.parent[i] = None; |
2107 | } |
1915 | } |
2108 | return pchanged; |
1916 | return pchanged; |
2109 | } |
1917 | } |
2110 | #endif |
1918 | #endif |
2111 | |
1919 | |
2112 | /*}}} */ |
1920 | /*}}} */ |
|
|
1921 | |
|
|
1922 | bool |
|
|
1923 | rxvt_term::cmd_parse () |
|
|
1924 | { |
|
|
1925 | bool flag = false; |
|
|
1926 | unicode_t ch = NOCHAR; |
|
|
1927 | unsigned char *seq_begin; // remember start of esc-sequence here |
|
|
1928 | |
|
|
1929 | for (;;) |
|
|
1930 | { |
|
|
1931 | if (ch == NOCHAR) |
|
|
1932 | { |
|
|
1933 | seq_begin = cmdbuf_ptr; |
|
|
1934 | ch = next_char (); |
|
|
1935 | } |
|
|
1936 | |
|
|
1937 | if (ch == NOCHAR) // TODO: improve |
|
|
1938 | break; |
|
|
1939 | |
|
|
1940 | if (!IS_CONTROL (ch) || ch == '\t' || ch == '\n' || ch == '\r') |
|
|
1941 | { |
|
|
1942 | /* Read a text string from the input buffer */ |
|
|
1943 | unicode_t buf[UBUFSIZ]; |
|
|
1944 | bool refreshnow = false; |
|
|
1945 | int nlines = 0; |
|
|
1946 | unicode_t *str = buf; |
|
|
1947 | |
|
|
1948 | *str++ = ch; |
|
|
1949 | |
|
|
1950 | for (;;) |
|
|
1951 | { |
|
|
1952 | seq_begin = cmdbuf_ptr; |
|
|
1953 | ch = next_char (); |
|
|
1954 | |
|
|
1955 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != '\t' && ch != '\n' && ch != '\r')) |
|
|
1956 | break; |
|
|
1957 | |
|
|
1958 | *str++ = ch; |
|
|
1959 | |
|
|
1960 | if (ch == '\n') |
|
|
1961 | { |
|
|
1962 | nlines++; |
|
|
1963 | refresh_count++; |
|
|
1964 | |
|
|
1965 | if (! (Options & Opt_jumpScroll) |
|
|
1966 | || (refresh_count >= (refresh_limit * (TermWin.nrow - 1)))) |
|
|
1967 | { |
|
|
1968 | refreshnow = true; |
|
|
1969 | flag = true; |
|
|
1970 | ch = NOCHAR; |
|
|
1971 | break; |
|
|
1972 | } |
|
|
1973 | |
|
|
1974 | // scr_add_lines only works for nlines < TermWin.nrow - 1. |
|
|
1975 | if (nlines >= TermWin.nrow - 1) |
|
|
1976 | { |
|
|
1977 | scr_add_lines (buf, nlines, str - buf); |
|
|
1978 | nlines = 0; |
|
|
1979 | str = buf; |
|
|
1980 | } |
|
|
1981 | } |
|
|
1982 | |
|
|
1983 | if (str >= buf + UBUFSIZ) |
|
|
1984 | { |
|
|
1985 | ch = NOCHAR; |
|
|
1986 | break; |
|
|
1987 | } |
|
|
1988 | } |
|
|
1989 | |
|
|
1990 | scr_add_lines (buf, nlines, str - buf); |
|
|
1991 | |
|
|
1992 | /* |
|
|
1993 | * If there have been a lot of new lines, then update the screen |
|
|
1994 | * What the heck I'll cheat and only refresh less than every page-full. |
|
|
1995 | * the number of pages between refreshes is refresh_limit, which |
|
|
1996 | * is incremented here because we must be doing flat-out scrolling. |
|
|
1997 | * |
|
|
1998 | * refreshing should be correct for small scrolls, because of the |
|
|
1999 | * time-out |
|
|
2000 | */ |
|
|
2001 | if (refreshnow) |
|
|
2002 | { |
|
|
2003 | if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
|
|
2004 | refresh_limit++; |
|
|
2005 | |
|
|
2006 | scr_refresh (refresh_type); |
|
|
2007 | } |
|
|
2008 | |
|
|
2009 | } |
|
|
2010 | else |
|
|
2011 | { |
|
|
2012 | try |
|
|
2013 | { |
|
|
2014 | process_nonprinting (ch); |
|
|
2015 | } |
|
|
2016 | catch (const class out_of_input &o) |
|
|
2017 | { |
|
|
2018 | // we ran out of input, retry later |
|
|
2019 | cmdbuf_ptr = seq_begin; |
|
|
2020 | break; |
|
|
2021 | } |
|
|
2022 | |
|
|
2023 | ch = NOCHAR; |
|
|
2024 | } |
|
|
2025 | } |
|
|
2026 | |
|
|
2027 | return flag; |
|
|
2028 | } |
|
|
2029 | |
|
|
2030 | // read the next character |
|
|
2031 | unicode_t |
|
|
2032 | rxvt_term::next_char () |
|
|
2033 | { |
|
|
2034 | while (cmdbuf_ptr < cmdbuf_endp) |
|
|
2035 | { |
|
|
2036 | // assume 7-bit to be ascii ALWAYS |
|
|
2037 | if (*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
|
|
2038 | return *cmdbuf_ptr++; |
|
|
2039 | |
|
|
2040 | wchar_t wc; |
|
|
2041 | size_t len = mbrtowc (&wc, (char *)cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); |
|
|
2042 | |
|
|
2043 | if (len == (size_t)-2) |
|
|
2044 | { |
|
|
2045 | // the mbstate stores incomplete sequences. didn't know this :/ |
|
|
2046 | cmdbuf_ptr = cmdbuf_endp; |
|
|
2047 | break; |
|
|
2048 | } |
|
|
2049 | |
|
|
2050 | if (len == (size_t)-1) |
|
|
2051 | return *cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
|
|
2052 | |
|
|
2053 | // assume wchar == unicode |
|
|
2054 | cmdbuf_ptr += len; |
|
|
2055 | return wc; |
|
|
2056 | } |
|
|
2057 | |
|
|
2058 | return NOCHAR; |
|
|
2059 | } |
|
|
2060 | |
|
|
2061 | /* rxvt_cmd_getc () - Return next input character */ |
|
|
2062 | /* |
|
|
2063 | * Return the next input character after first passing any keyboard input |
|
|
2064 | * to the command. |
|
|
2065 | */ |
|
|
2066 | unicode_t |
|
|
2067 | rxvt_term::cmd_getc () |
|
|
2068 | { |
|
|
2069 | unicode_t c = next_char (); |
|
|
2070 | |
|
|
2071 | if (c == NOCHAR) |
|
|
2072 | throw out_of_input; |
|
|
2073 | |
|
|
2074 | return c; |
|
|
2075 | } |
2113 | |
2076 | |
2114 | /*{{{ print pipe */ |
2077 | /*{{{ print pipe */ |
2115 | /*----------------------------------------------------------------------*/ |
2078 | /*----------------------------------------------------------------------*/ |
2116 | #ifdef PRINTPIPE |
2079 | #ifdef PRINTPIPE |
2117 | FILE * |
2080 | FILE * |
2118 | rxvt_term::popen_printer () |
2081 | rxvt_term::popen_printer () |
2119 | { |
2082 | { |
2120 | FILE *stream = popen (rs[Rs_print_pipe], "w"); |
2083 | FILE *stream = popen (rs[Rs_print_pipe], "w"); |
2121 | |
2084 | |
2122 | if (stream == NULL) |
2085 | if (stream == NULL) |
2123 | rxvt_print_error ("can't open printer pipe"); |
2086 | rxvt_warn ("can't open printer pipe, not printing.\n"); |
|
|
2087 | |
2124 | return stream; |
2088 | return stream; |
2125 | } |
2089 | } |
2126 | |
2090 | |
2127 | int |
2091 | int |
2128 | rxvt_term::pclose_printer (FILE *stream) |
2092 | rxvt_term::pclose_printer (FILE *stream) |
2129 | { |
2093 | { |
2130 | fflush (stream); |
2094 | fflush (stream); |
2131 | /* pclose () reported not to work on SunOS 4.1.3 */ |
|
|
2132 | # if defined (__sun__) /* TODO: RESOLVE THIS */ |
|
|
2133 | /* pclose works provided SIGCHLD handler uses waitpid */ |
|
|
2134 | return pclose (stream); /* return fclose (stream); */ |
|
|
2135 | # else |
|
|
2136 | return pclose (stream); |
2095 | return pclose (stream); |
2137 | # endif |
|
|
2138 | } |
2096 | } |
2139 | |
2097 | |
2140 | /* |
2098 | /* |
2141 | * simulate attached vt100 printer |
2099 | * simulate attached vt100 printer |
2142 | */ |
2100 | */ |
2143 | void |
2101 | void |
2144 | rxvt_term::process_print_pipe () |
2102 | rxvt_term::process_print_pipe () |
2145 | { |
2103 | { |
2146 | int done; |
2104 | int done; |
2147 | FILE *fd; |
2105 | FILE *fd; |
2148 | |
2106 | |
2149 | if ((fd = popen_printer ()) == NULL) |
2107 | if ((fd = popen_printer ()) == NULL) |
2150 | return; |
2108 | return; |
2151 | |
2109 | |
2152 | /* |
2110 | /* |
2153 | * Send all input to the printer until either ESC[4i or ESC[?4i |
2111 | * Send all input to the printer until either ESC[4i or ESC[?4i |
2154 | * is received. |
2112 | * is received. |
2155 | */ |
2113 | */ |
2156 | for (done = 0; !done;) |
2114 | for (done = 0; !done;) |
2157 | { |
2115 | { |
2158 | unsigned char buf[8]; |
2116 | unsigned char buf[8]; |
2159 | unsigned char ch; |
2117 | unicode_t ch; |
2160 | unsigned int i, len; |
2118 | unsigned int i, len; |
2161 | |
2119 | |
2162 | if ((ch = cmd_getc ()) != C0_ESC) |
2120 | if ((ch = cmd_getc ()) != C0_ESC) |
2163 | { |
2121 | { |
2164 | if (putc (ch, fd) == EOF) |
2122 | if (putc (ch, fd) == EOF) |
2165 | break; /* done = 1 */ |
2123 | break; /* done = 1 */ |
… | |
… | |
2180 | { |
2138 | { |
2181 | if ((buf[len++] = cmd_getc ()) == 'i') |
2139 | if ((buf[len++] = cmd_getc ()) == 'i') |
2182 | break; /* done = 1 */ |
2140 | break; /* done = 1 */ |
2183 | } |
2141 | } |
2184 | } |
2142 | } |
|
|
2143 | |
2185 | for (i = 0; i < len; i++) |
2144 | for (i = 0; i < len; i++) |
2186 | if (putc (buf[i], fd) == EOF) |
2145 | if (putc (buf[i], fd) == EOF) |
2187 | { |
2146 | { |
2188 | done = 1; |
2147 | done = 1; |
2189 | break; |
2148 | break; |
2190 | } |
2149 | } |
2191 | } |
2150 | } |
2192 | } |
2151 | } |
|
|
2152 | |
2193 | pclose_printer (fd); |
2153 | pclose_printer (fd); |
2194 | } |
2154 | } |
2195 | #endif /* PRINTPIPE */ |
2155 | #endif /* PRINTPIPE */ |
2196 | /*}}} */ |
2156 | /*}}} */ |
2197 | |
2157 | |
… | |
… | |
2205 | }; |
2165 | }; |
2206 | /* *INDENT-ON* */ |
2166 | /* *INDENT-ON* */ |
2207 | |
2167 | |
2208 | /*{{{ process non-printing single characters */ |
2168 | /*{{{ process non-printing single characters */ |
2209 | void |
2169 | void |
2210 | rxvt_term::process_nonprinting (unsigned char ch) |
2170 | rxvt_term::process_nonprinting (unicode_t ch) |
2211 | { |
2171 | { |
2212 | switch (ch) |
2172 | switch (ch) |
2213 | { |
2173 | { |
|
|
2174 | case C0_ESC: |
|
|
2175 | process_escape_seq (); |
|
|
2176 | break; |
2214 | case C0_ENQ: /* terminal Status */ |
2177 | case C0_ENQ: /* terminal Status */ |
2215 | if (rs[Rs_answerbackstring]) |
2178 | if (rs[Rs_answerbackstring]) |
2216 | tt_write ( |
2179 | tt_write ( |
2217 | (const unsigned char *)rs[Rs_answerbackstring], |
2180 | (const unsigned char *)rs[Rs_answerbackstring], |
2218 | (unsigned int)STRLEN (rs[Rs_answerbackstring])); |
2181 | (unsigned int)STRLEN (rs[Rs_answerbackstring])); |
… | |
… | |
2241 | scr_charset_choose (1); |
2204 | scr_charset_choose (1); |
2242 | break; |
2205 | break; |
2243 | case C0_SI: /* shift in - acs */ |
2206 | case C0_SI: /* shift in - acs */ |
2244 | scr_charset_choose (0); |
2207 | scr_charset_choose (0); |
2245 | break; |
2208 | break; |
|
|
2209 | |
|
|
2210 | // 8-bit controls |
|
|
2211 | case 0x90: /* DCS */ |
|
|
2212 | process_dcs_seq (); |
|
|
2213 | break; |
|
|
2214 | case 0x9b: /* CSI */ |
|
|
2215 | process_csi_seq (); |
|
|
2216 | break; |
|
|
2217 | case 0x9d: /* CSI */ |
|
|
2218 | process_osc_seq (); |
|
|
2219 | break; |
2246 | } |
2220 | } |
2247 | } |
2221 | } |
2248 | /*}}} */ |
2222 | /*}}} */ |
2249 | |
2223 | |
2250 | |
2224 | |
2251 | /*{{{ process VT52 escape sequences */ |
2225 | /*{{{ process VT52 escape sequences */ |
2252 | void |
2226 | void |
2253 | rxvt_term::process_escape_vt52 (unsigned char ch) |
2227 | rxvt_term::process_escape_vt52 (unicode_t ch) |
2254 | { |
2228 | { |
2255 | int row, col; |
2229 | int row, col; |
2256 | |
2230 | |
2257 | switch (ch) |
2231 | switch (ch) |
2258 | { |
2232 | { |
… | |
… | |
2310 | |
2284 | |
2311 | /*{{{ process escape sequences */ |
2285 | /*{{{ process escape sequences */ |
2312 | void |
2286 | void |
2313 | rxvt_term::process_escape_seq () |
2287 | rxvt_term::process_escape_seq () |
2314 | { |
2288 | { |
2315 | unsigned char ch = cmd_getc (); |
2289 | unicode_t ch = cmd_getc (); |
2316 | |
2290 | |
2317 | if (PrivateModes & PrivMode_vt52) |
2291 | if (PrivateModes & PrivMode_vt52) |
2318 | { |
2292 | { |
2319 | process_escape_vt52 (ch); |
2293 | process_escape_vt52 (ch); |
2320 | return; |
2294 | return; |
… | |
… | |
2337 | scr_charset_set (2, (unsigned int)cmd_getc ()); |
2311 | scr_charset_set (2, (unsigned int)cmd_getc ()); |
2338 | break; |
2312 | break; |
2339 | case '+': |
2313 | case '+': |
2340 | scr_charset_set (3, (unsigned int)cmd_getc ()); |
2314 | scr_charset_set (3, (unsigned int)cmd_getc ()); |
2341 | break; |
2315 | break; |
2342 | #ifdef MULTICHAR_SET |
|
|
2343 | case '$': |
|
|
2344 | scr_charset_set (-2, (unsigned int)cmd_getc ()); |
|
|
2345 | break; |
|
|
2346 | #endif |
|
|
2347 | #ifndef NO_FRILLS |
2316 | #ifndef NO_FRILLS |
2348 | case '6': |
2317 | case '6': |
2349 | scr_backindex (); |
2318 | scr_backindex (); |
2350 | break; |
2319 | break; |
2351 | #endif |
2320 | #endif |
… | |
… | |
2373 | break; |
2342 | break; |
2374 | |
2343 | |
2375 | /* 8.3.87: NEXT LINE */ |
2344 | /* 8.3.87: NEXT LINE */ |
2376 | case C1_NEL: /* ESC E */ |
2345 | case C1_NEL: /* ESC E */ |
2377 | { |
2346 | { |
2378 | uint32_t nlcr[] = { '\n', '\r' }; |
2347 | unicode_t nlcr[] = { L'\n', L'\r' }; |
2379 | scr_add_lines (nlcr, 1, 2); |
2348 | scr_add_lines (nlcr, 1, 2); |
2380 | } |
2349 | } |
2381 | break; |
2350 | break; |
2382 | |
2351 | |
2383 | /* kidnapped escape sequence: Should be 8.3.48 */ |
2352 | /* kidnapped escape sequence: Should be 8.3.48 */ |
… | |
… | |
2475 | /* *INDENT-ON* */ |
2444 | /* *INDENT-ON* */ |
2476 | |
2445 | |
2477 | void |
2446 | void |
2478 | rxvt_term::process_csi_seq () |
2447 | rxvt_term::process_csi_seq () |
2479 | { |
2448 | { |
2480 | unsigned char ch, priv, i; |
2449 | unicode_t ch, priv, i; |
2481 | unsigned int nargs, p; |
2450 | unsigned int nargs, p; |
2482 | int n, ndef; |
2451 | int n, ndef; |
2483 | int arg[ESC_ARGS]; |
2452 | int arg[ESC_ARGS]; |
2484 | |
2453 | |
2485 | for (nargs = ESC_ARGS; nargs > 0;) |
2454 | for (nargs = ESC_ARGS; nargs > 0;) |
2486 | arg[--nargs] = 0; |
2455 | arg[--nargs] = 0; |
2487 | |
2456 | |
2488 | priv = 0; |
2457 | priv = 0; |
… | |
… | |
2490 | if (ch >= '<' && ch <= '?') |
2459 | if (ch >= '<' && ch <= '?') |
2491 | { /* '<' '=' '>' '?' */ |
2460 | { /* '<' '=' '>' '?' */ |
2492 | priv = ch; |
2461 | priv = ch; |
2493 | ch = cmd_getc (); |
2462 | ch = cmd_getc (); |
2494 | } |
2463 | } |
|
|
2464 | |
2495 | /* read any numerical arguments */ |
2465 | /* read any numerical arguments */ |
2496 | for (n = -1; ch < CSI_ICH; ) |
2466 | for (n = -1; ch < CSI_ICH; ) |
2497 | { |
2467 | { |
2498 | if (isdigit (ch)) |
2468 | if (isdigit (ch)) |
2499 | { |
2469 | { |
… | |
… | |
2506 | { |
2476 | { |
2507 | if (nargs < ESC_ARGS) |
2477 | if (nargs < ESC_ARGS) |
2508 | arg[nargs++] = n; |
2478 | arg[nargs++] = n; |
2509 | n = -1; |
2479 | n = -1; |
2510 | } |
2480 | } |
2511 | else if (ch == '\b') |
2481 | else if (IS_CONTROL (ch)) |
2512 | { |
|
|
2513 | scr_backspace (); |
|
|
2514 | } |
|
|
2515 | else if (ch == C0_ESC) |
|
|
2516 | { |
|
|
2517 | process_escape_seq (); |
|
|
2518 | return; |
|
|
2519 | } |
|
|
2520 | else if (ch < ' ') |
|
|
2521 | { |
|
|
2522 | process_nonprinting (ch); |
2482 | process_nonprinting (ch); |
2523 | } |
2483 | |
2524 | ch = cmd_getc (); |
2484 | ch = cmd_getc (); |
2525 | } |
2485 | } |
2526 | |
2486 | |
2527 | if (ch > CSI_7F) |
2487 | if (ch > CSI_7F) |
2528 | return; |
2488 | return; |
… | |
… | |
2692 | case 7: /* unofficial extension */ |
2652 | case 7: /* unofficial extension */ |
2693 | tt_printf ("%-.250s\n", rs[Rs_display_name]); |
2653 | tt_printf ("%-.250s\n", rs[Rs_display_name]); |
2694 | break; |
2654 | break; |
2695 | #endif |
2655 | #endif |
2696 | case 8: /* unofficial extension */ |
2656 | case 8: /* unofficial extension */ |
2697 | xterm_seq (XTerm_title, APL_NAME "-" VERSION, CHAR_ST); |
2657 | xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
2698 | break; |
|
|
2699 | |
|
|
2700 | case XTerm_locale: /* unofficial extension */ |
|
|
2701 | tt_printf ("%-.250s\n", locale); |
|
|
2702 | break; |
2658 | break; |
2703 | } |
2659 | } |
2704 | break; |
2660 | break; |
2705 | |
2661 | |
2706 | case CSI_TBC: /* 8.3.155: (0) TABULATION CLEAR */ |
2662 | case CSI_TBC: /* 8.3.155: (0) TABULATION CLEAR */ |
… | |
… | |
2774 | #endif |
2730 | #endif |
2775 | |
2731 | |
2776 | case CSI_78: /* DECREQTPARM */ |
2732 | case CSI_78: /* DECREQTPARM */ |
2777 | if (arg[0] == 0 || arg[0] == 1) |
2733 | if (arg[0] == 0 || arg[0] == 1) |
2778 | tt_printf ("\033[%d;1;1;128;128;1;0x", arg[0] + 2); |
2734 | tt_printf ("\033[%d;1;1;128;128;1;0x", arg[0] + 2); |
2779 | /* FALLTHROUGH */ |
2735 | break; |
2780 | |
2736 | |
2781 | default: |
2737 | default: |
2782 | break; |
2738 | break; |
2783 | } |
2739 | } |
2784 | } |
2740 | } |
… | |
… | |
2787 | #ifndef NO_FRILLS |
2743 | #ifndef NO_FRILLS |
2788 | /* ARGSUSED */ |
2744 | /* ARGSUSED */ |
2789 | void |
2745 | void |
2790 | rxvt_term::process_window_ops (const int *args, unsigned int nargs) |
2746 | rxvt_term::process_window_ops (const int *args, unsigned int nargs) |
2791 | { |
2747 | { |
2792 | int x, y; |
2748 | int x, y; |
2793 | #if 0 |
|
|
2794 | char *s; |
|
|
2795 | #endif |
|
|
2796 | XWindowAttributes wattr; |
2749 | XWindowAttributes wattr; |
2797 | Window wdummy; |
2750 | Window wdummy; |
2798 | |
2751 | |
2799 | if (nargs == 0) |
2752 | if (nargs == 0) |
2800 | return; |
2753 | return; |
|
|
2754 | |
2801 | switch (args[0]) |
2755 | switch (args[0]) |
2802 | { |
2756 | { |
2803 | /* |
2757 | /* |
2804 | * commands |
2758 | * commands |
2805 | */ |
2759 | */ |
2806 | case 1: /* deiconify window */ |
2760 | case 1: /* deiconify window */ |
2807 | XMapWindow (display->display, TermWin.parent[0]); |
2761 | XMapWindow (display->display, TermWin.parent[0]); |
2808 | break; |
2762 | break; |
2809 | case 2: /* iconify window */ |
2763 | case 2: /* iconify window */ |
2810 | XIconifyWindow (display->display, TermWin.parent[0], |
2764 | XIconifyWindow (display->display, TermWin.parent[0], |
… | |
… | |
2827 | break; |
2781 | break; |
2828 | case 8: /* set size (chars) */ |
2782 | case 8: /* set size (chars) */ |
2829 | set_widthheight ((unsigned int) (args[2] * TermWin.fwidth), |
2783 | set_widthheight ((unsigned int) (args[2] * TermWin.fwidth), |
2830 | (unsigned int) (args[1] * TermWin.fheight)); |
2784 | (unsigned int) (args[1] * TermWin.fheight)); |
2831 | break; |
2785 | break; |
|
|
2786 | |
|
|
2787 | //case 9: NYI, TODO, restore maximized window or maximize window |
2832 | default: |
2788 | default: |
2833 | if (args[0] >= 24) /* set height (chars) */ |
2789 | if (args[0] >= 24) /* set height (chars) */ |
2834 | set_widthheight ((unsigned int)TermWin.width, |
2790 | set_widthheight ((unsigned int)TermWin.width, |
2835 | (unsigned int) (args[1] * TermWin.fheight)); |
2791 | (unsigned int) (args[1] * TermWin.fheight)); |
2836 | break; |
2792 | break; |
|
|
2793 | |
|
|
2794 | |
2837 | /* |
2795 | /* |
2838 | * reports - some output format copied from XTerm |
2796 | * reports - some output format copied from XTerm |
2839 | */ |
2797 | */ |
2840 | case 11: /* report window state */ |
2798 | case 11: /* report window state */ |
2841 | XGetWindowAttributes (display->display, TermWin.parent[0], &wattr); |
2799 | XGetWindowAttributes (display->display, TermWin.parent[0], &wattr); |
2842 | tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); |
2800 | tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); |
2843 | break; |
2801 | break; |
2844 | case 13: /* report window position */ |
2802 | case 13: /* report window position */ |
… | |
… | |
2850 | break; |
2808 | break; |
2851 | case 14: /* report window size (pixels) */ |
2809 | case 14: /* report window size (pixels) */ |
2852 | XGetWindowAttributes (display->display, TermWin.parent[0], &wattr); |
2810 | XGetWindowAttributes (display->display, TermWin.parent[0], &wattr); |
2853 | tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); |
2811 | tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); |
2854 | break; |
2812 | break; |
2855 | case 18: /* report window size (chars) */ |
2813 | case 18: /* report text area size (chars) */ |
2856 | tt_printf ("\033[8;%d;%dt", TermWin.nrow, TermWin.ncol); |
2814 | tt_printf ("\033[8;%d;%dt", TermWin.nrow, TermWin.ncol); |
|
|
2815 | break; |
|
|
2816 | case 19: /* report window size (chars) */ |
|
|
2817 | tt_printf ("\033[9;%d;%dt", TermWin.nrow, TermWin.ncol); |
2857 | break; |
2818 | break; |
2858 | #if 0 /* XXX: currently disabled due to security concerns */ |
2819 | #if 0 /* XXX: currently disabled due to security concerns */ |
2859 | case 20: /* report icon label */ |
2820 | case 20: /* report icon label */ |
2860 | XGetIconName (display->display, TermWin.parent[0], &s); |
2821 | XGetIconName (display->display, TermWin.parent[0], &s); |
2861 | tt_printf ("\033]L%-.200s\234", s ? s : ""); /* 8bit ST */ |
2822 | tt_printf ("\033]L%-.200s\234", s ? s : ""); /* 8bit ST */ |
… | |
… | |
2863 | case 21: /* report window title */ |
2824 | case 21: /* report window title */ |
2864 | XFetchName (display->display, TermWin.parent[0], &s); |
2825 | XFetchName (display->display, TermWin.parent[0], &s); |
2865 | tt_printf ("\033]l%-.200s\234", s ? s : ""); /* 8bit ST */ |
2826 | tt_printf ("\033]l%-.200s\234", s ? s : ""); /* 8bit ST */ |
2866 | break; |
2827 | break; |
2867 | #endif |
2828 | #endif |
2868 | |
|
|
2869 | } |
2829 | } |
2870 | } |
2830 | } |
2871 | #endif |
2831 | #endif |
2872 | |
2832 | |
2873 | /*----------------------------------------------------------------------*/ |
2833 | /*----------------------------------------------------------------------*/ |
2874 | /* |
2834 | /* |
2875 | * get input up until STRING TERMINATOR (or BEL) |
2835 | * get input up until STRING TERMINATOR (or BEL) |
2876 | * ends_how is terminator used. returned input must be free ()d |
2836 | * ends_how is terminator used. returned input must be free ()d |
2877 | */ |
2837 | */ |
2878 | unsigned char * |
2838 | unsigned char * |
2879 | rxvt_term::get_to_st (unsigned char *ends_how) |
2839 | rxvt_term::get_to_st (unicode_t &ends_how) |
2880 | { |
2840 | { |
2881 | int seen_esc = 0; /* seen escape? */ |
2841 | int seen_esc = 0; /* seen escape? */ |
2882 | unsigned int n = 0; |
2842 | unsigned int n = 0; |
2883 | unsigned char *s; |
2843 | unsigned char *s; |
|
|
2844 | unicode_t ch; |
2884 | unsigned char ch, string[STRING_MAX]; |
2845 | unsigned char string[STRING_MAX]; |
2885 | |
2846 | |
2886 | for (; (ch = cmd_getc ());) |
2847 | while ((ch = cmd_getc ())) |
2887 | { |
2848 | { |
2888 | if (ch == C0_BEL |
2849 | if (ch == C0_BEL |
2889 | || ch == CHAR_ST |
2850 | || ch == CHAR_ST |
2890 | || (ch == 0x5c && seen_esc)) /* 7bit ST */ |
2851 | || (ch == 0x5c && seen_esc)) /* 7bit ST */ |
2891 | break; |
2852 | break; |
|
|
2853 | |
2892 | if (ch == C0_ESC) |
2854 | if (ch == C0_ESC) |
2893 | { |
2855 | { |
2894 | seen_esc = 1; |
2856 | seen_esc = 1; |
2895 | continue; |
2857 | continue; |
2896 | } |
2858 | } |
2897 | else if (ch == '\t') |
2859 | else if (ch == '\t') |
2898 | ch = ' '; /* translate '\t' to space */ |
2860 | ch = ' '; /* translate '\t' to space */ |
2899 | else if (ch < 0x08 || (ch > 0x0d && ch < 0x20)) |
2861 | else if (ch < 0x08 || (ch > 0x0d && ch < 0x20)) |
2900 | return NULL; /* other control character - exit */ |
2862 | return NULL; /* other control character - exit */ |
|
|
2863 | |
2901 | if (n < sizeof (string) - 1) |
2864 | if (n < sizeof (string) - 1) |
2902 | string[n++] = ch; |
2865 | string[n++] = ch; |
|
|
2866 | |
2903 | seen_esc = 0; |
2867 | seen_esc = 0; |
2904 | } |
2868 | } |
|
|
2869 | |
2905 | string[n++] = '\0'; |
2870 | string[n++] = '\0'; |
|
|
2871 | |
2906 | if ((s = (unsigned char *)rxvt_malloc (n)) == NULL) |
2872 | if ((s = (unsigned char *)rxvt_malloc (n)) == NULL) |
2907 | return NULL; |
2873 | return NULL; |
|
|
2874 | |
2908 | *ends_how = (ch == 0x5c ? C0_ESC : ch); |
2875 | ends_how = (ch == 0x5c ? C0_ESC : ch); |
2909 | STRNCPY (s, string, n); |
2876 | STRNCPY (s, string, n); |
2910 | return s; |
2877 | return s; |
2911 | } |
2878 | } |
2912 | |
2879 | |
2913 | /*----------------------------------------------------------------------*/ |
2880 | /*----------------------------------------------------------------------*/ |
… | |
… | |
2915 | * process DEVICE CONTROL STRING `ESC P ... (ST|BEL)' or `0x90 ... (ST|BEL)' |
2882 | * process DEVICE CONTROL STRING `ESC P ... (ST|BEL)' or `0x90 ... (ST|BEL)' |
2916 | */ |
2883 | */ |
2917 | void |
2884 | void |
2918 | rxvt_term::process_dcs_seq () |
2885 | rxvt_term::process_dcs_seq () |
2919 | { |
2886 | { |
2920 | unsigned char eh, *s; |
2887 | unsigned char *s; |
|
|
2888 | unicode_t eh; |
|
|
2889 | |
2921 | /* |
2890 | /* |
2922 | * Not handled yet |
2891 | * Not handled yet |
2923 | */ |
2892 | */ |
2924 | s = get_to_st (&eh); |
2893 | s = get_to_st (eh); |
2925 | if (s) |
2894 | if (s) |
2926 | free (s); |
2895 | free (s); |
|
|
2896 | |
2927 | return; |
2897 | return; |
2928 | } |
2898 | } |
2929 | |
2899 | |
2930 | /*----------------------------------------------------------------------*/ |
2900 | /*----------------------------------------------------------------------*/ |
2931 | /* |
2901 | /* |
2932 | * process OPERATING SYSTEM COMMAND sequence `ESC ] Ps ; Pt (ST|BEL)' |
2902 | * process OPERATING SYSTEM COMMAND sequence `ESC ] Ps ; Pt (ST|BEL)' |
2933 | */ |
2903 | */ |
2934 | void |
2904 | void |
2935 | rxvt_term::process_osc_seq () |
2905 | rxvt_term::process_osc_seq () |
2936 | { |
2906 | { |
2937 | unsigned char ch, eh, *s; |
2907 | unicode_t ch, eh; |
2938 | int arg; |
2908 | int arg; |
2939 | |
2909 | |
2940 | ch = cmd_getc (); |
2910 | ch = cmd_getc (); |
2941 | for (arg = 0; isdigit (ch); ch = cmd_getc ()) |
2911 | for (arg = 0; isdigit (ch); ch = cmd_getc ()) |
2942 | arg = arg * 10 + (ch - '0'); |
2912 | arg = arg * 10 + (ch - '0'); |
2943 | |
2913 | |
2944 | if (ch == ';') |
2914 | if (ch == ';') |
2945 | { |
2915 | { |
2946 | s = get_to_st (&eh); |
2916 | unsigned char *s = get_to_st (eh); |
|
|
2917 | |
2947 | if (s) |
2918 | if (s) |
2948 | { |
2919 | { |
2949 | /* |
2920 | /* |
2950 | * rxvt_menubar_dispatch () violates the constness of the string, |
2921 | * rxvt_menubar_dispatch () violates the constness of the string, |
2951 | * so do it here |
2922 | * so do it here |
… | |
… | |
2956 | #else |
2927 | #else |
2957 | (void)0; |
2928 | (void)0; |
2958 | #endif |
2929 | #endif |
2959 | else |
2930 | else |
2960 | xterm_seq (arg, (char *)s, eh); |
2931 | xterm_seq (arg, (char *)s, eh); |
|
|
2932 | |
2961 | free (s); |
2933 | free (s); |
2962 | } |
2934 | } |
2963 | } |
2935 | } |
2964 | } |
2936 | } |
2965 | /* |
2937 | /* |
… | |
… | |
2975 | * 19 = change underlined character color |
2947 | * 19 = change underlined character color |
2976 | * 46 = change logfile (not implemented) |
2948 | * 46 = change logfile (not implemented) |
2977 | * 50 = change font |
2949 | * 50 = change font |
2978 | * |
2950 | * |
2979 | * rxvt extensions: |
2951 | * rxvt extensions: |
2980 | * 9 = change locale (NYI) |
|
|
2981 | * 10 = menu (may change in future) |
2952 | * 10 = menu (may change in future) |
2982 | * 20 = bg pixmap |
2953 | * 20 = bg pixmap |
2983 | * 39 = change default fg color |
2954 | * 39 = change default fg color |
2984 | * 49 = change default bg color |
2955 | * 49 = change default bg color |
2985 | * 55 = dump scrollback buffer and all of screen |
2956 | * 55 = dump scrollback buffer and all of screen |
|
|
2957 | * 701 = change locale |
|
|
2958 | * 702 = find font |
2986 | */ |
2959 | */ |
2987 | void |
2960 | void |
2988 | rxvt_term::xterm_seq (int op, const char *str, unsigned char resp __attribute__ ((unused))) |
2961 | rxvt_term::xterm_seq (int op, const char *str, unsigned char resp __attribute__ ((unused))) |
2989 | { |
2962 | { |
2990 | int changed = 0; |
2963 | int changed = 0; |
2991 | int color; |
2964 | int color; |
2992 | char *buf, *name; |
2965 | char *buf, *name; |
2993 | |
2966 | |
2994 | assert (str != NULL); |
2967 | assert (str != NULL); |
2995 | switch (op) |
2968 | switch (op) |
2996 | { |
2969 | { |
2997 | case XTerm_name: |
2970 | case XTerm_name: |
2998 | set_title (str); |
2971 | set_title (str); |
2999 | /* FALLTHROUGH */ |
2972 | /* FALLTHROUGH */ |
3000 | case XTerm_iconName: |
2973 | case XTerm_iconName: |
3001 | set_iconName (str); |
2974 | set_icon_name (str); |
3002 | break; |
2975 | break; |
3003 | case XTerm_title: |
2976 | case XTerm_title: |
3004 | set_title (str); |
2977 | set_title (str); |
3005 | break; |
2978 | break; |
3006 | case XTerm_Color: |
2979 | case XTerm_Color: |
3007 | for (buf = (char *)str; buf && *buf;) |
2980 | for (buf = (char *)str; buf && *buf;) |
3008 | { |
2981 | { |
3009 | if ((name = STRCHR (buf, ';')) == NULL) |
2982 | if ((name = STRCHR (buf, ';')) == NULL) |
3010 | break; |
2983 | break; |
|
|
2984 | |
3011 | *name++ = '\0'; |
2985 | *name++ = '\0'; |
3012 | color = atoi (buf); |
2986 | color = atoi (buf); |
|
|
2987 | |
3013 | if (color < 0 || color >= TOTAL_COLORS) |
2988 | if (color < 0 || color >= TOTAL_COLORS) |
3014 | break; |
2989 | break; |
|
|
2990 | |
3015 | if ((buf = STRCHR (name, ';')) != NULL) |
2991 | if ((buf = STRCHR (name, ';')) != NULL) |
3016 | *buf++ = '\0'; |
2992 | *buf++ = '\0'; |
|
|
2993 | |
3017 | set_window_color (color + minCOLOR, name); |
2994 | set_window_color (color + minCOLOR, name); |
3018 | } |
2995 | } |
3019 | break; |
2996 | break; |
3020 | #ifndef NO_CURSORCOLOR |
2997 | #ifndef NO_CURSORCOLOR |
3021 | case XTerm_Color_cursor: |
2998 | case XTerm_Color_cursor: |
… | |
… | |
3074 | break; |
3051 | break; |
3075 | case XTerm_restoreBG: |
3052 | case XTerm_restoreBG: |
3076 | set_window_color (Color_bg, str); |
3053 | set_window_color (Color_bg, str); |
3077 | break; |
3054 | break; |
3078 | case XTerm_logfile: |
3055 | case XTerm_logfile: |
|
|
3056 | // TODO, when secure mode? |
3079 | break; |
3057 | break; |
3080 | case XTerm_font: |
3058 | case XTerm_font: |
3081 | change_font (str); |
3059 | change_font (str); |
3082 | break; |
3060 | break; |
|
|
3061 | #ifndef NO_FRILLS |
3083 | case XTerm_locale: |
3062 | case XTerm_locale: |
|
|
3063 | if (str[0] == '?' && !str[1]) |
|
|
3064 | tt_printf ("%-.250s\n", locale); |
|
|
3065 | else |
|
|
3066 | { |
3084 | set_locale (str); |
3067 | set_locale (str); |
|
|
3068 | # ifdef USE_XIM |
3085 | im_cb (); |
3069 | im_cb (); |
|
|
3070 | # endif |
|
|
3071 | } |
3086 | break; |
3072 | break; |
|
|
3073 | case XTerm_findfont: |
|
|
3074 | { |
|
|
3075 | int fid = TermWin.fontset->find_font (atoi (str)); |
|
|
3076 | tt_printf ("%d %-.250s\n", fid, (*TermWin.fontset)[fid]->name); |
|
|
3077 | } |
|
|
3078 | break; |
|
|
3079 | #endif |
3087 | #if 0 |
3080 | #if 0 |
3088 | case XTerm_dumpscreen: /* no error notices */ |
3081 | case XTerm_dumpscreen: /* no error notices */ |
3089 | { |
3082 | { |
3090 | int fd; |
3083 | int fd; |
3091 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
3084 | if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) |
… | |
… | |
3094 | close (fd); |
3087 | close (fd); |
3095 | } |
3088 | } |
3096 | } |
3089 | } |
3097 | break; |
3090 | break; |
3098 | #endif |
3091 | #endif |
3099 | |
|
|
3100 | } |
3092 | } |
3101 | } |
3093 | } |
3102 | /*----------------------------------------------------------------------*/ |
3094 | /*----------------------------------------------------------------------*/ |
3103 | |
3095 | |
3104 | /*{{{ process DEC private mode sequences `ESC [ ? Ps mode' */ |
3096 | /*{{{ process DEC private mode sequences `ESC [ ? Ps mode' */ |
… | |
… | |
3112 | * so no need for fancy checking |
3104 | * so no need for fancy checking |
3113 | */ |
3105 | */ |
3114 | int |
3106 | int |
3115 | rxvt_term::privcases (int mode, unsigned long bit) |
3107 | rxvt_term::privcases (int mode, unsigned long bit) |
3116 | { |
3108 | { |
3117 | int state; |
3109 | int state; |
3118 | |
3110 | |
3119 | if (mode == 's') |
3111 | if (mode == 's') |
3120 | { |
3112 | { |
3121 | SavedModes |= (PrivateModes & bit); |
3113 | SavedModes |= (PrivateModes & bit); |
3122 | return -1; |
3114 | return -1; |
… | |
… | |
3127 | state = (SavedModes & bit) ? 1 : 0; /* no overlapping */ |
3119 | state = (SavedModes & bit) ? 1 : 0; /* no overlapping */ |
3128 | else |
3120 | else |
3129 | state = (mode == 't') ? ! (PrivateModes & bit) : mode; |
3121 | state = (mode == 't') ? ! (PrivateModes & bit) : mode; |
3130 | PrivMode (state, bit); |
3122 | PrivMode (state, bit); |
3131 | } |
3123 | } |
|
|
3124 | |
3132 | return state; |
3125 | return state; |
3133 | } |
3126 | } |
3134 | |
3127 | |
3135 | /* we're not using priv _yet_ */ |
3128 | /* we're not using priv _yet_ */ |
3136 | void |
3129 | void |
3137 | rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) |
3130 | rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) |
3138 | { |
3131 | { |
3139 | unsigned int i, j; |
3132 | unsigned int i, j; |
3140 | int state; |
3133 | int state; |
|
|
3134 | |
3141 | static const struct |
3135 | static const struct |
3142 | { |
3136 | { |
3143 | const int argval; |
3137 | const int argval; |
3144 | const unsigned long bit; |
3138 | const unsigned long bit; |
3145 | } |
3139 | } |
|
|
3140 | |
3146 | argtopriv[] = { |
3141 | argtopriv[] = { |
3147 | { 1, PrivMode_aplCUR }, |
3142 | { 1, PrivMode_aplCUR }, |
3148 | { 2, PrivMode_vt52 }, |
3143 | { 2, PrivMode_vt52 }, |
3149 | { 3, PrivMode_132 }, |
3144 | { 3, PrivMode_132 }, |
3150 | { 4, PrivMode_smoothScroll }, |
3145 | { 4, PrivMode_smoothScroll }, |
… | |
… | |
3156 | { menuBar_esc, PrivMode_menuBar }, |
3151 | { menuBar_esc, PrivMode_menuBar }, |
3157 | #endif |
3152 | #endif |
3158 | #ifdef scrollBar_esc |
3153 | #ifdef scrollBar_esc |
3159 | { scrollBar_esc, PrivMode_scrollBar }, |
3154 | { scrollBar_esc, PrivMode_scrollBar }, |
3160 | #endif |
3155 | #endif |
|
|
3156 | // 18, 19 printing-related |
3161 | { 25, PrivMode_VisibleCursor }, |
3157 | { 25, PrivMode_VisibleCursor }, |
|
|
3158 | // 30 show scrollbar rxvt. extension |
3162 | { 35, PrivMode_ShiftKeys }, |
3159 | { 35, PrivMode_ShiftKeys }, // rxvt extension |
3163 | { 40, PrivMode_132OK }, |
3160 | { 40, PrivMode_132OK }, |
|
|
3161 | // 41 xterm more fixes NYI |
|
|
3162 | // 45 margin bell NYI |
|
|
3163 | // 46 start logging |
3164 | { 47, PrivMode_Screen }, |
3164 | { 47, PrivMode_Screen }, |
3165 | { 66, PrivMode_aplKP }, |
3165 | { 66, PrivMode_aplKP }, |
3166 | #ifndef NO_BACKSPACE_KEY |
3166 | #ifndef NO_BACKSPACE_KEY |
3167 | { 67, PrivMode_BackSpace }, |
3167 | { 67, PrivMode_BackSpace }, |
3168 | #endif |
3168 | #endif |
3169 | { 1000, PrivMode_MouseX11 }, |
3169 | { 1000, PrivMode_MouseX11 }, |
|
|
3170 | // 1001 Use Hilite Mouse Tracking. NYI, TODO |
|
|
3171 | // 1002 Use Cell Motion Mouse Tracking. NYI, TODO |
|
|
3172 | // 1003 Use All Motion Mouse Tracking. NYI, TODO |
3170 | { 1010, PrivMode_TtyOutputInh }, |
3173 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3171 | { 1011, PrivMode_Keypress }, |
3174 | { 1011, PrivMode_Keypress }, // rxvt extension |
|
|
3175 | // 1035 enable modifiers for alt, numlock NYI |
|
|
3176 | // 1036 send ESC for meta keys NYI |
|
|
3177 | // 1037 send DEL for keypad delete NYI |
3172 | { 1047, PrivMode_Screen }, |
3178 | { 1047, PrivMode_Screen }, |
|
|
3179 | // 1048 save and restore cursor |
3173 | { 1049, PrivMode_Screen }, /* xterm extension, not fully implemented */ |
3180 | { 1049, PrivMode_Screen }, /* xterm extension, not fully implemented */ |
|
|
3181 | // 1051, 1052, 1060, 1061 keyboard emulation NYI |
3174 | }; |
3182 | }; |
3175 | |
3183 | |
3176 | if (nargs == 0) |
3184 | if (nargs == 0) |
3177 | return; |
3185 | return; |
3178 | |
3186 | |
… | |
… | |
3193 | state = privcases (mode, argtopriv[j].bit); |
3201 | state = privcases (mode, argtopriv[j].bit); |
3194 | break; |
3202 | break; |
3195 | } |
3203 | } |
3196 | |
3204 | |
3197 | /* extra handling for values with state unkept */ |
3205 | /* extra handling for values with state unkept */ |
|
|
3206 | switch (arg[i]) |
|
|
3207 | { |
|
|
3208 | case 1048: /* alternative cursor save */ |
|
|
3209 | case 1049: |
|
|
3210 | if (mode == 0) |
|
|
3211 | scr_cursor (RESTORE); |
|
|
3212 | else if (mode == 1) |
|
|
3213 | scr_cursor (SAVE); |
|
|
3214 | /* FALLTHROUGH */ |
|
|
3215 | } |
|
|
3216 | |
3198 | if (state == -1) |
3217 | if (state >= 0) |
|
|
3218 | /* extra handling for values with valid 0 or 1 state */ |
3199 | switch (arg[i]) |
3219 | switch (arg[i]) |
3200 | { |
3220 | { |
3201 | case 1048: /* alternative cursor save */ |
3221 | /* case 1: - application cursor keys */ |
|
|
3222 | case 2: /* VT52 mode */ |
|
|
3223 | /* oddball mode. should be set regardless of set/reset |
|
|
3224 | * parameter. Return from VT52 mode with an ESC < from |
|
|
3225 | * within VT52 mode |
|
|
3226 | */ |
|
|
3227 | PrivMode (1, PrivMode_vt52); |
|
|
3228 | break; |
|
|
3229 | case 3: /* 80/132 */ |
|
|
3230 | if (PrivateModes & PrivMode_132OK) |
|
|
3231 | set_widthheight (((state ? 132 : 80) * TermWin.fwidth), TermWin.height); |
|
|
3232 | break; |
|
|
3233 | case 4: /* smooth scrolling */ |
3202 | if (mode == 0) |
3234 | if (state) |
3203 | scr_cursor (RESTORE); |
3235 | Options &= ~Opt_jumpScroll; |
3204 | else if (mode == 1) |
3236 | else |
3205 | scr_cursor (SAVE); |
3237 | Options |= Opt_jumpScroll; |
|
|
3238 | break; |
|
|
3239 | case 5: /* reverse video */ |
|
|
3240 | scr_rvideo_mode (state); |
|
|
3241 | break; |
|
|
3242 | case 6: /* relative/absolute origins */ |
|
|
3243 | scr_relative_origin (state); |
|
|
3244 | break; |
|
|
3245 | case 7: /* autowrap */ |
|
|
3246 | scr_autowrap (state); |
|
|
3247 | break; |
|
|
3248 | /* case 8: - auto repeat, can't do on a per window basis */ |
|
|
3249 | case 9: /* X10 mouse reporting */ |
|
|
3250 | if (state) /* orthogonal */ |
|
|
3251 | PrivateModes &= ~PrivMode_MouseX11; |
|
|
3252 | break; |
|
|
3253 | #ifdef menuBar_esc |
|
|
3254 | case menuBar_esc: |
|
|
3255 | #ifdef MENUBAR |
|
|
3256 | map_menuBar (state); |
|
|
3257 | #endif |
|
|
3258 | break; |
|
|
3259 | #endif |
|
|
3260 | #ifdef scrollBar_esc |
|
|
3261 | case scrollBar_esc: |
|
|
3262 | if (scrollbar_mapping (state)) |
|
|
3263 | { |
|
|
3264 | resize_all_windows (0, 0, 0); |
|
|
3265 | scr_touch (true); |
|
|
3266 | } |
|
|
3267 | break; |
|
|
3268 | #endif |
|
|
3269 | case 25: /* visible/invisible cursor */ |
|
|
3270 | scr_cursor_visible (state); |
|
|
3271 | break; |
|
|
3272 | /* case 35: - shift keys */ |
|
|
3273 | /* case 40: - 80 <--> 132 mode */ |
|
|
3274 | case 47: /* secondary screen */ |
|
|
3275 | scr_change_screen (state); |
|
|
3276 | break; |
|
|
3277 | /* case 66: - application key pad */ |
|
|
3278 | /* case 67: - backspace key */ |
|
|
3279 | case 1000: /* X11 mouse reporting */ |
|
|
3280 | if (state) /* orthogonal */ |
|
|
3281 | PrivateModes &= ~PrivMode_MouseX10; |
|
|
3282 | break; |
|
|
3283 | #if 0 |
|
|
3284 | case 1001: |
|
|
3285 | break; /* X11 mouse highlighting */ |
|
|
3286 | #endif |
|
|
3287 | case 1010: /* scroll to bottom on TTY output inhibit */ |
|
|
3288 | if (state) |
|
|
3289 | Options &= ~Opt_scrollTtyOutput; |
|
|
3290 | else |
|
|
3291 | Options |= Opt_scrollTtyOutput; |
|
|
3292 | break; |
|
|
3293 | case 1011: /* scroll to bottom on key press */ |
|
|
3294 | if (state) |
|
|
3295 | Options |= Opt_scrollTtyKeypress; |
|
|
3296 | else |
|
|
3297 | Options &= ~Opt_scrollTtyKeypress; |
|
|
3298 | break; |
|
|
3299 | case 1047: /* secondary screen w/ clearing */ |
|
|
3300 | case 1049: /* better secondary screen w/ clearing, but not fully implemented */ |
|
|
3301 | if (current_screen != PRIMARY) |
|
|
3302 | scr_erase_screen (2); |
|
|
3303 | |
|
|
3304 | scr_change_screen (state); |
3206 | /* FALLTHROUGH */ |
3305 | /* FALLTHROUGH */ |
3207 | default: |
3306 | default: |
3208 | continue; /* for (;i;) */ |
3307 | break; |
3209 | } |
3308 | } |
3210 | |
|
|
3211 | /* extra handling for values with valid 0 or 1 state */ |
|
|
3212 | switch (arg[i]) |
|
|
3213 | { |
|
|
3214 | /* case 1: - application cursor keys */ |
|
|
3215 | case 2: /* VT52 mode */ |
|
|
3216 | /* oddball mode. should be set regardless of set/reset |
|
|
3217 | * parameter. Return from VT52 mode with an ESC < from |
|
|
3218 | * within VT52 mode |
|
|
3219 | */ |
|
|
3220 | PrivMode (1, PrivMode_vt52); |
|
|
3221 | break; |
|
|
3222 | case 3: /* 80/132 */ |
|
|
3223 | if (PrivateModes & PrivMode_132OK) |
|
|
3224 | set_widthheight ( (unsigned int) ((state ? 132 : 80) * TermWin.fwidth), |
|
|
3225 | (unsigned int)TermWin.height); |
|
|
3226 | break; |
|
|
3227 | case 4: /* smooth scrolling */ |
|
|
3228 | if (state) |
|
|
3229 | Options &= ~Opt_jumpScroll; |
|
|
3230 | else |
|
|
3231 | Options |= Opt_jumpScroll; |
|
|
3232 | break; |
|
|
3233 | case 5: /* reverse video */ |
|
|
3234 | scr_rvideo_mode (state); |
|
|
3235 | break; |
|
|
3236 | case 6: /* relative/absolute origins */ |
|
|
3237 | scr_relative_origin (state); |
|
|
3238 | break; |
|
|
3239 | case 7: /* autowrap */ |
|
|
3240 | scr_autowrap (state); |
|
|
3241 | break; |
|
|
3242 | /* case 8: - auto repeat, can't do on a per window basis */ |
|
|
3243 | case 9: /* X10 mouse reporting */ |
|
|
3244 | if (state) /* orthogonal */ |
|
|
3245 | PrivateModes &= ~ (PrivMode_MouseX11); |
|
|
3246 | break; |
|
|
3247 | #ifdef menuBar_esc |
|
|
3248 | case menuBar_esc: |
|
|
3249 | #ifdef MENUBAR |
|
|
3250 | map_menuBar (state); |
|
|
3251 | #endif |
|
|
3252 | break; |
|
|
3253 | #endif |
|
|
3254 | #ifdef scrollBar_esc |
|
|
3255 | case scrollBar_esc: |
|
|
3256 | if (scrollbar_mapping (state)) |
|
|
3257 | { |
|
|
3258 | resize_all_windows (0, 0, 0); |
|
|
3259 | scr_touch (true); |
|
|
3260 | } |
|
|
3261 | break; |
|
|
3262 | #endif |
|
|
3263 | case 25: /* visible/invisible cursor */ |
|
|
3264 | scr_cursor_visible (state); |
|
|
3265 | break; |
|
|
3266 | /* case 35: - shift keys */ |
|
|
3267 | /* case 40: - 80 <--> 132 mode */ |
|
|
3268 | case 47: /* secondary screen */ |
|
|
3269 | scr_change_screen (state); |
|
|
3270 | break; |
|
|
3271 | /* case 66: - application key pad */ |
|
|
3272 | /* case 67: - backspace key */ |
|
|
3273 | case 1000: /* X11 mouse reporting */ |
|
|
3274 | if (state) /* orthogonal */ |
|
|
3275 | PrivateModes &= ~ (PrivMode_MouseX10); |
|
|
3276 | break; |
|
|
3277 | #if 0 |
|
|
3278 | case 1001: |
|
|
3279 | break; /* X11 mouse highlighting */ |
|
|
3280 | #endif |
|
|
3281 | case 1010: /* scroll to bottom on TTY output inhibit */ |
|
|
3282 | if (state) |
|
|
3283 | Options &= ~Opt_scrollTtyOutput; |
|
|
3284 | else |
|
|
3285 | Options |= Opt_scrollTtyOutput; |
|
|
3286 | break; |
|
|
3287 | case 1011: /* scroll to bottom on key press */ |
|
|
3288 | if (state) |
|
|
3289 | Options |= Opt_scrollTtyKeypress; |
|
|
3290 | else |
|
|
3291 | Options &= ~Opt_scrollTtyKeypress; |
|
|
3292 | break; |
|
|
3293 | case 1047: /* secondary screen w/ clearing */ |
|
|
3294 | case 1049: /* better secondary screen w/ clearing, but not fully implemented */ |
|
|
3295 | if (current_screen != PRIMARY) |
|
|
3296 | scr_erase_screen (2); |
|
|
3297 | scr_change_screen (state); |
|
|
3298 | /* FALLTHROUGH */ |
|
|
3299 | default: |
|
|
3300 | break; |
|
|
3301 | } |
|
|
3302 | } |
3309 | } |
3303 | } |
3310 | } |
3304 | /*}}} */ |
3311 | /*}}} */ |
3305 | |
3312 | |
3306 | /*{{{ process sgr sequences */ |
3313 | /*{{{ process sgr sequences */ |
3307 | void |
3314 | void |
3308 | rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg) |
3315 | rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg) |
3309 | { |
3316 | { |
3310 | unsigned int i; |
3317 | unsigned int i; |
3311 | short rendset; |
3318 | short rendset; |
3312 | int rendstyle; |
3319 | int rendstyle; |
3313 | |
3320 | |
3314 | if (nargs == 0) |
3321 | if (nargs == 0) |
3315 | { |
3322 | { |
3316 | scr_rendition (0, ~RS_None); |
3323 | scr_rendition (0, ~RS_None); |
3317 | return; |
3324 | return; |
3318 | } |
3325 | } |
|
|
3326 | |
3319 | for (i = 0; i < nargs; i++) |
3327 | for (i = 0; i < nargs; i++) |
3320 | { |
3328 | { |
3321 | rendset = -1; |
3329 | rendset = -1; |
3322 | switch (arg[i]) |
3330 | switch (arg[i]) |
3323 | { |
3331 | { |
… | |
… | |
3334 | rendset = 1, rendstyle = RS_Blink; |
3342 | rendset = 1, rendstyle = RS_Blink; |
3335 | break; |
3343 | break; |
3336 | case 7: |
3344 | case 7: |
3337 | rendset = 1, rendstyle = RS_RVid; |
3345 | rendset = 1, rendstyle = RS_RVid; |
3338 | break; |
3346 | break; |
|
|
3347 | case 8: |
|
|
3348 | // invisible. NYI |
|
|
3349 | break; |
3339 | case 22: |
3350 | case 22: |
3340 | rendset = 0, rendstyle = RS_Bold; |
3351 | rendset = 0, rendstyle = RS_Bold; |
3341 | break; |
3352 | break; |
3342 | case 24: |
3353 | case 24: |
3343 | rendset = 0, rendstyle = RS_Uline; |
3354 | rendset = 0, rendstyle = RS_Uline; |
… | |
… | |
3346 | rendset = 0, rendstyle = RS_Blink; |
3357 | rendset = 0, rendstyle = RS_Blink; |
3347 | break; |
3358 | break; |
3348 | case 27: |
3359 | case 27: |
3349 | rendset = 0, rendstyle = RS_RVid; |
3360 | rendset = 0, rendstyle = RS_RVid; |
3350 | break; |
3361 | break; |
|
|
3362 | case 28: |
|
|
3363 | // visible. NYI |
|
|
3364 | break; |
3351 | } |
3365 | } |
|
|
3366 | |
3352 | if (rendset != -1) |
3367 | if (rendset != -1) |
3353 | { |
3368 | { |
3354 | scr_rendition (rendset, rendstyle); |
3369 | scr_rendition (rendset, rendstyle); |
3355 | continue; /* for (;i;) */ |
3370 | continue; /* for (;i;) */ |
3356 | } |
3371 | } |
… | |
… | |
3363 | case 33: |
3378 | case 33: |
3364 | case 34: |
3379 | case 34: |
3365 | case 35: |
3380 | case 35: |
3366 | case 36: |
3381 | case 36: |
3367 | case 37: |
3382 | case 37: |
3368 | scr_color ((unsigned int) (minCOLOR + (arg[i] - 30)), |
3383 | scr_color ((unsigned int) (minCOLOR + (arg[i] - 30)), Color_fg); |
3369 | Color_fg); |
|
|
3370 | break; |
3384 | break; |
3371 | #ifdef TTY_256COLOR |
3385 | #ifdef TTY_256COLOR |
3372 | case 38: |
3386 | case 38: |
3373 | if (nargs > i + 2 && arg[i + 1] == 5) |
3387 | if (nargs > i + 2 && arg[i + 1] == 5) |
3374 | { |
3388 | { |
3375 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), |
3389 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg); |
3376 | Color_fg); |
|
|
3377 | i += 2; |
3390 | i += 2; |
3378 | } |
3391 | } |
3379 | break; |
3392 | break; |
3380 | #endif |
3393 | #endif |
3381 | case 39: /* default fg */ |
3394 | case 39: /* default fg */ |
… | |
… | |
3388 | case 43: |
3401 | case 43: |
3389 | case 44: |
3402 | case 44: |
3390 | case 45: |
3403 | case 45: |
3391 | case 46: |
3404 | case 46: |
3392 | case 47: |
3405 | case 47: |
3393 | scr_color ((unsigned int) (minCOLOR + (arg[i] - 40)), |
3406 | scr_color ((unsigned int) (minCOLOR + (arg[i] - 40)), Color_bg); |
3394 | Color_bg); |
|
|
3395 | break; |
3407 | break; |
3396 | #ifdef TTY_256COLOR |
3408 | #ifdef TTY_256COLOR |
3397 | case 48: |
3409 | case 48: |
3398 | if (nargs > i + 2 && arg[i + 1] == 5) |
3410 | if (nargs > i + 2 && arg[i + 1] == 5) |
3399 | { |
3411 | { |
3400 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), |
3412 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg); |
3401 | Color_bg); |
|
|
3402 | i += 2; |
3413 | i += 2; |
3403 | } |
3414 | } |
3404 | break; |
3415 | break; |
3405 | #endif |
3416 | #endif |
3406 | case 49: /* default bg */ |
3417 | case 49: /* default bg */ |
… | |
… | |
3439 | |
3450 | |
3440 | /*{{{ process Rob Nation's own graphics mode sequences */ |
3451 | /*{{{ process Rob Nation's own graphics mode sequences */ |
3441 | void |
3452 | void |
3442 | rxvt_term::process_graphics () |
3453 | rxvt_term::process_graphics () |
3443 | { |
3454 | { |
3444 | unsigned char ch, cmd = cmd_getc (); |
3455 | unicode_t ch, cmd = cmd_getc (); |
3445 | |
3456 | |
3446 | if (cmd == 'Q') |
3457 | if (cmd == 'Q') |
3447 | { /* query graphics */ |
3458 | { /* query graphics */ |
3448 | tt_printf ("\033G0\n"); /* no graphics */ |
3459 | tt_printf ("\033G0\n"); /* no graphics */ |
3449 | return; |
3460 | return; |