… | |
… | |
162 | |
162 | |
163 | void |
163 | void |
164 | rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y) |
164 | rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y) |
165 | { |
165 | { |
166 | rxvt_fontset *fs = FONTSET (r); |
166 | rxvt_fontset *fs = FONTSET (r); |
167 | rxvt_font *f = (*fs)[fs->find_font (ch)]; |
|
|
168 | wchar_t *chr, *alloc, ch2, *fname; |
167 | wchar_t *chr, *alloc, ch2, **fname; |
169 | int len; |
168 | int len; |
170 | |
|
|
171 | fname = rxvt_utf8towcs (f->name); |
|
|
172 | |
169 | |
173 | # if ENABLE_COMBINING |
170 | # if ENABLE_COMBINING |
174 | if (IS_COMPOSE (ch)) |
171 | if (IS_COMPOSE (ch)) |
175 | { |
172 | { |
176 | len = rxvt_composite.expand (ch, 0); |
173 | len = rxvt_composite.expand (ch, 0); |
… | |
… | |
197 | r & RS_Blink ? " blink" : "", |
194 | r & RS_Blink ? " blink" : "", |
198 | r & RS_RVid ? " rvid" : "", |
195 | r & RS_RVid ? " rvid" : "", |
199 | r & RS_Uline ? " uline" : "", |
196 | r & RS_Uline ? " uline" : "", |
200 | r & RS_Careful ? " careful" : ""); |
197 | r & RS_Careful ? " careful" : ""); |
201 | |
198 | |
|
|
199 | int width = 0; |
|
|
200 | fname = rxvt_temp_buf<wchar_t *> (len); |
|
|
201 | for (int i = 0; i < len; i++) |
|
|
202 | { |
|
|
203 | rxvt_font *f = (*fs)[fs->find_font (chr[i])]; |
|
|
204 | fname[i] = rxvt_utf8towcs (f->name); |
202 | int width = wcswidth (fname, wcslen (fname)); |
205 | max_it (width, wcswidth (fname[i], wcslen (fname[i]))); |
|
|
206 | } |
203 | |
207 | |
204 | max_it (width, 8+5); // for char + hex |
208 | max_it (width, 8+5); // for char + hex |
205 | max_it (width, strlen (attr)); |
209 | max_it (width, strlen (attr)); |
206 | |
210 | |
207 | if (y >= 0) |
211 | if (y >= 0) |
208 | { |
212 | { |
209 | y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1; |
213 | y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1; |
210 | x = 0; |
214 | x = 0; |
211 | } |
215 | } |
212 | |
216 | |
213 | scr_overlay_new (x, y, width, len + 2); |
217 | scr_overlay_new (x, y, width, len * 2 + 1); |
214 | |
218 | |
215 | r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); |
219 | r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); |
216 | |
220 | |
217 | for (int y = 0; y < len; y++) |
221 | for (int y = 0; y < len; y++) |
218 | { |
222 | { |
… | |
… | |
237 | // char buf[4+4+3+1]; |
241 | // char buf[4+4+3+1]; |
238 | // snprintf (buf, sizeof (buf), "(%.4d|%.4d)", x, y); |
242 | // snprintf (buf, sizeof (buf), "(%.4d|%.4d)", x, y); |
239 | // scr_overlay_set (0, 0, buf); |
243 | // scr_overlay_set (0, 0, buf); |
240 | // } |
244 | // } |
241 | scr_overlay_set (0, len , attr); |
245 | scr_overlay_set (0, len , attr); |
|
|
246 | for (int i = 0; i < len; i++) |
|
|
247 | { |
242 | scr_overlay_set (0, len + 1, fname); |
248 | scr_overlay_set (0, len + 1 + i, fname[i]); |
243 | |
|
|
244 | free (fname); |
249 | free (fname[i]); |
|
|
250 | } |
245 | |
251 | |
246 | # if ENABLE_COMBINING |
252 | # if ENABLE_COMBINING |
247 | if (alloc) |
253 | if (alloc) |
248 | delete [] alloc; |
254 | delete [] alloc; |
249 | # endif |
255 | # endif |
… | |
… | |
376 | param = 5; |
382 | param = 5; |
377 | break; |
383 | break; |
378 | case XK_Next: |
384 | case XK_Next: |
379 | param = 6; |
385 | param = 6; |
380 | break; |
386 | break; |
|
|
387 | case XK_Home: |
|
|
388 | param = 7; |
|
|
389 | break; |
|
|
390 | case XK_End: |
|
|
391 | param = 8; |
|
|
392 | break; |
381 | #endif |
393 | #endif |
382 | case XK_Help: |
394 | case XK_Help: |
383 | param = 28; |
395 | param = 28; |
384 | break; |
396 | break; |
385 | case XK_Menu: |
397 | case XK_Menu: |
… | |
… | |
413 | meta = ev.state & ModMetaMask; |
425 | meta = ev.state & ModMetaMask; |
414 | |
426 | |
415 | if (numlock_state || (ev.state & ModNumLockMask)) |
427 | if (numlock_state || (ev.state & ModNumLockMask)) |
416 | { |
428 | { |
417 | numlock_state = (ev.state & ModNumLockMask); |
429 | numlock_state = (ev.state & ModNumLockMask); |
418 | PrivMode ((!numlock_state), PrivMode_aplKP); |
430 | set_privmode (PrivMode_aplKP, !numlock_state); |
419 | } |
431 | } |
420 | |
432 | |
421 | kbuf[0] = 0; |
433 | kbuf[0] = 0; |
422 | |
434 | |
423 | #ifdef USE_XIM |
435 | #ifdef USE_XIM |
… | |
… | |
499 | #ifdef PAGING_CONTEXT_LINES |
511 | #ifdef PAGING_CONTEXT_LINES |
500 | lnsppg = nrow - PAGING_CONTEXT_LINES; |
512 | lnsppg = nrow - PAGING_CONTEXT_LINES; |
501 | #else |
513 | #else |
502 | lnsppg = nrow * 4 / 5; |
514 | lnsppg = nrow * 4 / 5; |
503 | #endif |
515 | #endif |
|
|
516 | max_it (lnsppg, 1); |
|
|
517 | |
504 | if (keysym == XK_Prior) |
518 | if (keysym == XK_Prior) |
505 | { |
519 | { |
506 | scr_page (UP, lnsppg); |
520 | scr_page (UP, lnsppg); |
507 | return; |
521 | return; |
508 | } |
522 | } |
… | |
… | |
573 | } |
587 | } |
574 | } |
588 | } |
575 | |
589 | |
576 | #if ENABLE_FRILLS || ISO_14755 |
590 | #if ENABLE_FRILLS || ISO_14755 |
577 | // ISO 14755 support |
591 | // ISO 14755 support |
578 | if (shft && ctrl) |
592 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_51)) |
579 | { |
593 | { |
580 | int hv; |
594 | int hv; |
581 | |
595 | |
582 | if (iso14755buf & ISO_14755_51 |
596 | if (iso14755buf & ISO_14755_51 |
583 | && (keysym == XK_space || keysym == XK_KP_Space |
597 | && (keysym == XK_space || keysym == XK_KP_Space |
… | |
… | |
613 | scr_overlay_off (); |
627 | scr_overlay_off (); |
614 | # endif |
628 | # endif |
615 | iso14755buf = 0; |
629 | iso14755buf = 0; |
616 | } |
630 | } |
617 | } |
631 | } |
|
|
632 | else if (option (Opt_iso14755) && |
618 | else if ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R)) |
633 | ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R)) |
619 | || (shft && (keysym == XK_Control_L || keysym == XK_Control_R))) |
634 | || (shft && (keysym == XK_Control_L || keysym == XK_Control_R)))) |
620 | if (!(iso14755buf & ISO_14755_STARTED)) |
635 | if (!(iso14755buf & ISO_14755_STARTED)) |
621 | { |
636 | { |
622 | iso14755buf |= ISO_14755_STARTED; |
637 | iso14755buf |= ISO_14755_STARTED; |
623 | # if ISO_14755 |
638 | # if ISO_14755 |
624 | scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); |
639 | scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); |
… | |
… | |
635 | } |
650 | } |
636 | #endif |
651 | #endif |
637 | |
652 | |
638 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
653 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
639 | { |
654 | { |
640 | bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; |
655 | bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; |
641 | unsigned int newlen = 1; |
656 | unsigned int newlen = 1; |
642 | |
657 | |
643 | switch (translate_keypad (keysym, kp)) |
658 | switch (translate_keypad (keysym, kp)) |
|
|
659 | { |
|
|
660 | #ifndef NO_BACKSPACE_KEY |
|
|
661 | case XK_BackSpace: |
|
|
662 | if (priv_modes & PrivMode_HaveBackSpace) |
|
|
663 | { |
|
|
664 | kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) |
|
|
665 | ^ !!ctrl) ? '\b' : '\177'; |
|
|
666 | kbuf[1] = '\0'; |
|
|
667 | } |
|
|
668 | else |
|
|
669 | strcpy (kbuf, rs[Rs_backspace_key]); |
|
|
670 | break; |
|
|
671 | #endif |
|
|
672 | #ifndef NO_DELETE_KEY |
|
|
673 | case XK_Delete: |
|
|
674 | strcpy (kbuf, rs[Rs_delete_key]); |
|
|
675 | break; |
|
|
676 | #endif |
|
|
677 | case XK_Tab: |
|
|
678 | if (shft) |
|
|
679 | strcpy (kbuf, "\033[Z"); |
|
|
680 | else |
|
|
681 | { |
|
|
682 | #ifdef CTRL_TAB_MAKES_META |
|
|
683 | if (ctrl) |
|
|
684 | meta = 1; |
|
|
685 | #endif |
|
|
686 | #ifdef MOD4_TAB_MAKES_META |
|
|
687 | if (ev.state & Mod4Mask) |
|
|
688 | meta = 1; |
|
|
689 | #endif |
|
|
690 | newlen = 0; |
|
|
691 | } |
|
|
692 | break; |
|
|
693 | |
|
|
694 | case XK_Up: /* "\033[A" */ |
|
|
695 | case XK_Down: /* "\033[B" */ |
|
|
696 | case XK_Right: /* "\033[C" */ |
|
|
697 | case XK_Left: /* "\033[D" */ |
|
|
698 | strcpy (kbuf, "\033[Z"); |
|
|
699 | kbuf[2] = "DACB"[keysym - XK_Left]; |
|
|
700 | /* do Shift first */ |
|
|
701 | if (shft) |
|
|
702 | kbuf[2] = "dacb"[keysym - XK_Left]; |
|
|
703 | else if (ctrl) |
|
|
704 | { |
|
|
705 | kbuf[1] = 'O'; |
|
|
706 | kbuf[2] = "dacb"[keysym - XK_Left]; |
|
|
707 | } |
|
|
708 | else if (priv_modes & PrivMode_aplCUR) |
|
|
709 | kbuf[1] = 'O'; |
|
|
710 | break; |
|
|
711 | |
|
|
712 | case XK_KP_Enter: |
|
|
713 | /* allow shift to override */ |
|
|
714 | if (kp) |
|
|
715 | { |
|
|
716 | strcpy (kbuf, "\033OM"); |
|
|
717 | break; |
|
|
718 | } |
|
|
719 | |
|
|
720 | /* FALLTHROUGH */ |
|
|
721 | |
|
|
722 | case XK_Return: |
|
|
723 | if (priv_modes & PrivMode_LFNL) |
|
|
724 | { |
|
|
725 | kbuf[0] = '\015'; |
|
|
726 | kbuf[1] = '\012'; |
|
|
727 | kbuf[2] = '\0'; |
|
|
728 | } |
|
|
729 | else |
|
|
730 | { |
|
|
731 | kbuf[0] = '\015'; |
|
|
732 | kbuf[1] = '\0'; |
|
|
733 | } |
|
|
734 | break; |
|
|
735 | |
|
|
736 | case XK_KP_F1: /* "\033OP" */ |
|
|
737 | case XK_KP_F2: /* "\033OQ" */ |
|
|
738 | case XK_KP_F3: /* "\033OR" */ |
|
|
739 | case XK_KP_F4: /* "\033OS" */ |
|
|
740 | strcpy (kbuf, "\033OP"); |
|
|
741 | kbuf[2] += (keysym - XK_KP_F1); |
|
|
742 | break; |
|
|
743 | |
|
|
744 | case XK_KP_Multiply: /* "\033Oj" : "*" */ |
|
|
745 | case XK_KP_Add: /* "\033Ok" : "+" */ |
|
|
746 | case XK_KP_Separator: /* "\033Ol" : "," */ |
|
|
747 | case XK_KP_Subtract: /* "\033Om" : "-" */ |
|
|
748 | case XK_KP_Decimal: /* "\033On" : "." */ |
|
|
749 | case XK_KP_Divide: /* "\033Oo" : "/" */ |
|
|
750 | case XK_KP_0: /* "\033Op" : "0" */ |
|
|
751 | case XK_KP_1: /* "\033Oq" : "1" */ |
|
|
752 | case XK_KP_2: /* "\033Or" : "2" */ |
|
|
753 | case XK_KP_3: /* "\033Os" : "3" */ |
|
|
754 | case XK_KP_4: /* "\033Ot" : "4" */ |
|
|
755 | case XK_KP_5: /* "\033Ou" : "5" */ |
|
|
756 | case XK_KP_6: /* "\033Ov" : "6" */ |
|
|
757 | case XK_KP_7: /* "\033Ow" : "7" */ |
|
|
758 | case XK_KP_8: /* "\033Ox" : "8" */ |
|
|
759 | case XK_KP_9: /* "\033Oy" : "9" */ |
|
|
760 | /* allow shift to override */ |
|
|
761 | if (kp) |
|
|
762 | { |
|
|
763 | strcpy (kbuf, "\033Oj"); |
|
|
764 | kbuf[2] += (keysym - XK_KP_Multiply); |
|
|
765 | } |
|
|
766 | else |
|
|
767 | { |
|
|
768 | kbuf[0] = ('*' + (keysym - XK_KP_Multiply)); |
|
|
769 | kbuf[1] = '\0'; |
|
|
770 | } |
|
|
771 | break; |
|
|
772 | |
|
|
773 | default: |
644 | { |
774 | { |
645 | #ifndef NO_BACKSPACE_KEY |
|
|
646 | case XK_BackSpace: |
|
|
647 | if (priv_modes & PrivMode_HaveBackSpace) |
|
|
648 | { |
|
|
649 | kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) |
|
|
650 | ^ !!ctrl) ? '\b' : '\177'; |
|
|
651 | kbuf[1] = '\0'; |
|
|
652 | } |
|
|
653 | else |
|
|
654 | strcpy (kbuf, rs[Rs_backspace_key]); |
|
|
655 | break; |
|
|
656 | #endif |
|
|
657 | #ifndef NO_DELETE_KEY |
|
|
658 | case XK_Delete: |
|
|
659 | strcpy (kbuf, rs[Rs_delete_key]); |
|
|
660 | break; |
|
|
661 | #endif |
|
|
662 | case XK_Tab: |
|
|
663 | if (shft) |
|
|
664 | strcpy (kbuf, "\033[Z"); |
|
|
665 | else |
|
|
666 | { |
|
|
667 | #ifdef CTRL_TAB_MAKES_META |
|
|
668 | if (ctrl) |
|
|
669 | meta = 1; |
|
|
670 | #endif |
|
|
671 | #ifdef MOD4_TAB_MAKES_META |
|
|
672 | if (ev.state & Mod4Mask) |
|
|
673 | meta = 1; |
|
|
674 | #endif |
|
|
675 | newlen = 0; |
|
|
676 | } |
|
|
677 | break; |
|
|
678 | |
|
|
679 | case XK_Up: /* "\033[A" */ |
|
|
680 | case XK_Down: /* "\033[B" */ |
|
|
681 | case XK_Right: /* "\033[C" */ |
|
|
682 | case XK_Left: /* "\033[D" */ |
|
|
683 | strcpy (kbuf, "\033[Z"); |
|
|
684 | kbuf[2] = "DACB"[keysym - XK_Left]; |
|
|
685 | /* do Shift first */ |
|
|
686 | if (shft) |
|
|
687 | kbuf[2] = "dacb"[keysym - XK_Left]; |
|
|
688 | else if (ctrl) |
|
|
689 | { |
|
|
690 | kbuf[1] = 'O'; |
|
|
691 | kbuf[2] = "dacb"[keysym - XK_Left]; |
|
|
692 | } |
|
|
693 | else if (priv_modes & PrivMode_aplCUR) |
|
|
694 | kbuf[1] = 'O'; |
|
|
695 | break; |
|
|
696 | |
|
|
697 | case XK_KP_Enter: |
|
|
698 | /* allow shift to override */ |
|
|
699 | if (kp) |
|
|
700 | { |
|
|
701 | strcpy (kbuf, "\033OM"); |
|
|
702 | break; |
|
|
703 | } |
|
|
704 | |
|
|
705 | /* FALLTHROUGH */ |
|
|
706 | |
|
|
707 | case XK_Return: |
|
|
708 | if (priv_modes & PrivMode_LFNL) |
|
|
709 | { |
|
|
710 | kbuf[0] = '\015'; |
|
|
711 | kbuf[1] = '\012'; |
|
|
712 | kbuf[2] = '\0'; |
|
|
713 | } |
|
|
714 | else |
|
|
715 | { |
|
|
716 | kbuf[0] = '\015'; |
|
|
717 | kbuf[1] = '\0'; |
|
|
718 | } |
|
|
719 | break; |
|
|
720 | |
|
|
721 | case XK_KP_F1: /* "\033OP" */ |
|
|
722 | case XK_KP_F2: /* "\033OQ" */ |
|
|
723 | case XK_KP_F3: /* "\033OR" */ |
|
|
724 | case XK_KP_F4: /* "\033OS" */ |
|
|
725 | strcpy (kbuf, "\033OP"); |
|
|
726 | kbuf[2] += (keysym - XK_KP_F1); |
|
|
727 | break; |
|
|
728 | |
|
|
729 | case XK_KP_Multiply: /* "\033Oj" : "*" */ |
|
|
730 | case XK_KP_Add: /* "\033Ok" : "+" */ |
|
|
731 | case XK_KP_Separator: /* "\033Ol" : "," */ |
|
|
732 | case XK_KP_Subtract: /* "\033Om" : "-" */ |
|
|
733 | case XK_KP_Decimal: /* "\033On" : "." */ |
|
|
734 | case XK_KP_Divide: /* "\033Oo" : "/" */ |
|
|
735 | case XK_KP_0: /* "\033Op" : "0" */ |
|
|
736 | case XK_KP_1: /* "\033Oq" : "1" */ |
|
|
737 | case XK_KP_2: /* "\033Or" : "2" */ |
|
|
738 | case XK_KP_3: /* "\033Os" : "3" */ |
|
|
739 | case XK_KP_4: /* "\033Ot" : "4" */ |
|
|
740 | case XK_KP_5: /* "\033Ou" : "5" */ |
|
|
741 | case XK_KP_6: /* "\033Ov" : "6" */ |
|
|
742 | case XK_KP_7: /* "\033Ow" : "7" */ |
|
|
743 | case XK_KP_8: /* "\033Ox" : "8" */ |
|
|
744 | case XK_KP_9: /* "\033Oy" : "9" */ |
|
|
745 | /* allow shift to override */ |
|
|
746 | if (kp) |
|
|
747 | { |
|
|
748 | strcpy (kbuf, "\033Oj"); |
|
|
749 | kbuf[2] += (keysym - XK_KP_Multiply); |
|
|
750 | } |
|
|
751 | else |
|
|
752 | { |
|
|
753 | kbuf[0] = ('*' + (keysym - XK_KP_Multiply)); |
|
|
754 | kbuf[1] = '\0'; |
|
|
755 | } |
|
|
756 | break; |
|
|
757 | |
|
|
758 | case XK_End: |
|
|
759 | strcpy (kbuf, KS_END); |
|
|
760 | break; |
|
|
761 | case XK_Home: |
|
|
762 | strcpy (kbuf, KS_HOME); |
|
|
763 | break; |
|
|
764 | |
|
|
765 | default: |
|
|
766 | { |
|
|
767 | int param = map_function_key (keysym); |
775 | int param = map_function_key (keysym); |
768 | if (param > 0) |
776 | if (param > 0) |
769 | sprintf (kbuf,"\033[%d~", param); |
777 | sprintf (kbuf,"\033[%d~", param); |
770 | else |
778 | else |
771 | newlen = 0; |
779 | newlen = 0; |
772 | } |
|
|
773 | break; |
|
|
774 | } |
780 | } |
|
|
781 | break; |
|
|
782 | } |
775 | |
783 | |
776 | if (newlen) |
784 | if (newlen) |
777 | len = strlen (kbuf); |
785 | len = strlen (kbuf); |
778 | |
786 | |
779 | /* |
787 | /* |
780 | * Pass meta for all function keys, if 'meta' option set |
788 | * Pass meta for all function keys, if 'meta' option set |
781 | */ |
789 | */ |
782 | #ifdef META8_OPTION |
790 | #ifdef META8_OPTION |
… | |
… | |
1016 | } |
1024 | } |
1017 | while (row < end_row); |
1025 | while (row < end_row); |
1018 | } |
1026 | } |
1019 | |
1027 | |
1020 | scr_refresh (); |
1028 | scr_refresh (); |
1021 | scrollbar_show (1); |
1029 | scrollBar.show (1); |
1022 | #ifdef USE_XIM |
1030 | #ifdef USE_XIM |
1023 | IMSendSpot (); |
1031 | IMSendSpot (); |
1024 | #endif |
1032 | #endif |
1025 | } |
1033 | } |
1026 | |
1034 | |
… | |
… | |
1128 | { |
1136 | { |
1129 | // this should really be sched_yield(), but the linux guys thought |
1137 | // this should really be sched_yield(), but the linux guys thought |
1130 | // that giving a process calling sched_yield () less cpu time than |
1138 | // that giving a process calling sched_yield () less cpu time than |
1131 | // ones with high nice levels is a useful thing to do. It surely is is |
1139 | // ones with high nice levels is a useful thing to do. It surely is is |
1132 | // allowed by the sus... as is returning ENOSYS. |
1140 | // allowed by the sus... as is returning ENOSYS. |
|
|
1141 | // since the linux guys additionally thought that breaking the only |
|
|
1142 | // known workaroudn against their unusable sched_yield hack is cool, |
|
|
1143 | // we just nanosleep a bit and hope for the best. |
1133 | |
1144 | |
1134 | struct timespec ts = { 0, 0 }; |
1145 | struct timespec ts = { 0, 1000 }; |
1135 | nanosleep (&ts, 0); |
1146 | nanosleep (&ts, 0); |
1136 | |
1147 | |
1137 | w.stop (); |
1148 | w.stop (); |
1138 | } |
1149 | } |
1139 | |
1150 | |
… | |
… | |
1189 | { |
1200 | { |
1190 | make_current (); |
1201 | make_current (); |
1191 | |
1202 | |
1192 | if (revents & ev::READ) |
1203 | if (revents & ev::READ) |
1193 | // loop, but don't allow a single term to monopolize us |
1204 | // loop, but don't allow a single term to monopolize us |
1194 | while (pty_fill ()) |
1205 | for (int i = CBUFCNT; i-- && pty_fill (); ) |
1195 | if (cmd_parse ()) |
1206 | cmd_parse (); |
1196 | break; |
|
|
1197 | |
1207 | |
1198 | if (revents & ev::WRITE) |
1208 | if (revents & ev::WRITE) |
1199 | pty_write (); |
1209 | pty_write (); |
1200 | |
1210 | |
1201 | refresh_check (); |
1211 | refresh_check (); |
… | |
… | |
1460 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1470 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1461 | |
1471 | |
1462 | break; |
1472 | break; |
1463 | |
1473 | |
1464 | case SelectionClear: |
1474 | case SelectionClear: |
1465 | selection_clear (); |
1475 | selection_clear (ev.xselectionclear.selection == xa[XA_CLIPBOARD]); |
1466 | break; |
1476 | break; |
1467 | |
1477 | |
1468 | case SelectionNotify: |
1478 | case SelectionNotify: |
1469 | if (selection_wait == Sel_normal) |
1479 | if (selection_wait == Sel_normal) |
1470 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1480 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
… | |
… | |
1537 | ; |
1547 | ; |
1538 | |
1548 | |
1539 | if (scrollBar.state && ev.xany.window == scrollBar.win) |
1549 | if (scrollBar.state && ev.xany.window == scrollBar.win) |
1540 | { |
1550 | { |
1541 | scrollBar.state = STATE_IDLE; |
1551 | scrollBar.state = STATE_IDLE; |
1542 | scrollbar_show (0); |
1552 | scrollBar.show (0); |
1543 | } |
1553 | } |
1544 | } |
1554 | } |
1545 | break; |
1555 | break; |
1546 | |
1556 | |
1547 | case MotionNotify: |
1557 | case MotionNotify: |
… | |
… | |
1646 | &unused_root, &unused_child, |
1656 | &unused_root, &unused_child, |
1647 | &unused_root_x, &unused_root_y, |
1657 | &unused_root_x, &unused_root_y, |
1648 | &ev.xbutton.x, &ev.xbutton.y, |
1658 | &ev.xbutton.x, &ev.xbutton.y, |
1649 | &unused_mask); |
1659 | &unused_mask); |
1650 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1660 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1651 | scrollbar_size ()); |
1661 | scrollBar.size ()); |
1652 | want_refresh = 1; |
1662 | want_refresh = 1; |
1653 | scrollbar_show (1); |
1663 | scrollBar.show (1); |
1654 | } |
1664 | } |
1655 | break; |
1665 | break; |
1656 | } |
1666 | } |
1657 | |
1667 | |
1658 | #if defined(CURSOR_BLINK) |
1668 | #if defined(CURSOR_BLINK) |
… | |
… | |
1683 | #endif |
1693 | #endif |
1684 | |
1694 | |
1685 | refresh_check (); |
1695 | refresh_check (); |
1686 | } |
1696 | } |
1687 | |
1697 | |
|
|
1698 | #if ENABLE_FRILLS |
|
|
1699 | void |
|
|
1700 | rxvt_term::set_urgency (bool enable) |
|
|
1701 | { |
|
|
1702 | if (enable == urgency_hint) |
|
|
1703 | return; |
|
|
1704 | |
|
|
1705 | if (XWMHints *h = XGetWMHints (dpy, parent[0])) |
|
|
1706 | { |
|
|
1707 | h->flags = h->flags & ~XUrgencyHint | (enable ? XUrgencyHint : 0); |
|
|
1708 | XSetWMHints (dpy, parent[0], h); |
|
|
1709 | urgency_hint = enable; |
|
|
1710 | } |
|
|
1711 | } |
|
|
1712 | #endif |
|
|
1713 | |
1688 | void |
1714 | void |
1689 | rxvt_term::focus_in () |
1715 | rxvt_term::focus_in () |
1690 | { |
1716 | { |
1691 | if (!focus) |
1717 | if (!focus) |
1692 | { |
1718 | { |
1693 | focus = 1; |
1719 | focus = 1; |
1694 | want_refresh = 1; |
1720 | want_refresh = 1; |
1695 | |
|
|
1696 | HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END)); |
|
|
1697 | |
1721 | |
1698 | #if USE_XIM |
1722 | #if USE_XIM |
1699 | if (Input_Context != NULL) |
1723 | if (Input_Context != NULL) |
1700 | { |
1724 | { |
1701 | IMSetPosition (); |
1725 | IMSetPosition (); |
… | |
… | |
1713 | scr_recolour (); |
1737 | scr_recolour (); |
1714 | } |
1738 | } |
1715 | #endif |
1739 | #endif |
1716 | #if ENABLE_FRILLS |
1740 | #if ENABLE_FRILLS |
1717 | if (option (Opt_urgentOnBell)) |
1741 | if (option (Opt_urgentOnBell)) |
1718 | { |
1742 | set_urgency (0); |
1719 | if (XWMHints *h = XGetWMHints(dpy, parent[0])) |
|
|
1720 | { |
|
|
1721 | h->flags &= ~XUrgencyHint; |
|
|
1722 | XSetWMHints (dpy, parent[0], h); |
|
|
1723 | } |
|
|
1724 | } |
|
|
1725 | #endif |
1743 | #endif |
|
|
1744 | |
|
|
1745 | HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END)); |
1726 | } |
1746 | } |
1727 | } |
1747 | } |
1728 | |
1748 | |
1729 | void |
1749 | void |
1730 | rxvt_term::focus_out () |
1750 | rxvt_term::focus_out () |
… | |
… | |
1732 | if (focus) |
1752 | if (focus) |
1733 | { |
1753 | { |
1734 | focus = 0; |
1754 | focus = 0; |
1735 | want_refresh = 1; |
1755 | want_refresh = 1; |
1736 | |
1756 | |
1737 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1757 | #if ENABLE_FRILLS |
1738 | |
1758 | if (option (Opt_urgentOnBell)) |
|
|
1759 | set_urgency (0); |
|
|
1760 | #endif |
1739 | #if ENABLE_FRILLS || ISO_14755 |
1761 | #if ENABLE_FRILLS || ISO_14755 |
1740 | if (iso14755buf) |
1762 | if (iso14755buf) |
1741 | { |
1763 | { |
1742 | iso14755buf = 0; |
1764 | iso14755buf = 0; |
1743 | # if ISO_14755 |
1765 | # if ISO_14755 |
… | |
… | |
1760 | { |
1782 | { |
1761 | pix_colors = pix_colors_unfocused; |
1783 | pix_colors = pix_colors_unfocused; |
1762 | scr_recolour (); |
1784 | scr_recolour (); |
1763 | } |
1785 | } |
1764 | #endif |
1786 | #endif |
|
|
1787 | |
|
|
1788 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1765 | } |
1789 | } |
1766 | } |
1790 | } |
1767 | |
1791 | |
1768 | void |
1792 | void |
1769 | rxvt_term::update_fade_color (unsigned int idx) |
1793 | rxvt_term::update_fade_color (unsigned int idx) |
… | |
… | |
2011 | } |
2035 | } |
2012 | |
2036 | |
2013 | if (scrollBar.style == R_SB_XTERM |
2037 | if (scrollBar.style == R_SB_XTERM |
2014 | || scrollbar_above_slider (ev.y) |
2038 | || scrollbar_above_slider (ev.y) |
2015 | || scrollbar_below_slider (ev.y)) |
2039 | || scrollbar_below_slider (ev.y)) |
2016 | scr_move_to (scrollbar_position (ev.y) - csrO, scrollbar_size ()); |
2040 | scr_move_to (scrollbar_position (ev.y) - csrO, scrollBar.size ()); |
2017 | |
2041 | |
2018 | scrollBar.state = STATE_MOTION; |
2042 | scrollBar.state = STATE_MOTION; |
2019 | break; |
2043 | break; |
2020 | |
2044 | |
2021 | case Button1: |
2045 | case Button1: |
… | |
… | |
2044 | else |
2068 | else |
2045 | { |
2069 | { |
2046 | scr_page ((ev.button == Button1 ? DN : UP), |
2070 | scr_page ((ev.button == Button1 ? DN : UP), |
2047 | (nrow |
2071 | (nrow |
2048 | * scrollbar_position (ev.y) |
2072 | * scrollbar_position (ev.y) |
2049 | / scrollbar_size ())); |
2073 | / scrollBar.size ())); |
2050 | } |
2074 | } |
2051 | |
2075 | |
2052 | break; |
2076 | break; |
2053 | } |
2077 | } |
2054 | } |
2078 | } |
… | |
… | |
2067 | reportmode = !! (priv_modes & PrivMode_mouse_report); |
2091 | reportmode = !! (priv_modes & PrivMode_mouse_report); |
2068 | |
2092 | |
2069 | if (scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN) |
2093 | if (scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN) |
2070 | { |
2094 | { |
2071 | scrollBar.state = STATE_IDLE; |
2095 | scrollBar.state = STATE_IDLE; |
2072 | scrollbar_show (0); |
2096 | scrollBar.show (0); |
2073 | } |
2097 | } |
2074 | |
2098 | |
2075 | #ifdef SELECTION_SCROLLING |
2099 | #ifdef SELECTION_SCROLLING |
2076 | sel_scroll_ev.stop(); |
2100 | sel_scroll_ev.stop(); |
2077 | #endif |
2101 | #endif |
… | |
… | |
2160 | } |
2184 | } |
2161 | else |
2185 | else |
2162 | # endif |
2186 | # endif |
2163 | { |
2187 | { |
2164 | scr_page (v, i); |
2188 | scr_page (v, i); |
2165 | scrollbar_show (1); |
2189 | scrollBar.show (1); |
2166 | } |
2190 | } |
2167 | } |
2191 | } |
2168 | break; |
2192 | break; |
2169 | #endif |
2193 | #endif |
2170 | } |
2194 | } |
2171 | } |
2195 | } |
2172 | } |
2196 | } |
2173 | |
2197 | |
2174 | /*}}} */ |
2198 | /*}}} */ |
2175 | |
2199 | |
2176 | bool |
2200 | void |
2177 | rxvt_term::cmd_parse () |
2201 | rxvt_term::cmd_parse () |
2178 | { |
2202 | { |
2179 | bool flag = false; |
|
|
2180 | wchar_t ch = NOCHAR; |
2203 | wchar_t ch = NOCHAR; |
2181 | char *seq_begin; // remember start of esc-sequence here |
2204 | char *seq_begin; // remember start of esc-sequence here |
2182 | |
2205 | |
2183 | for (;;) |
2206 | for (;;) |
2184 | { |
2207 | { |
2185 | if (ch == NOCHAR) |
2208 | if (expect_false (ch == NOCHAR)) |
2186 | { |
2209 | { |
2187 | seq_begin = cmdbuf_ptr; |
2210 | seq_begin = cmdbuf_ptr; |
2188 | ch = next_char (); |
2211 | ch = next_char (); |
2189 | |
2212 | |
2190 | if (ch == NOCHAR) |
2213 | if (ch == NOCHAR) |
2191 | break; |
2214 | break; |
2192 | } |
2215 | } |
2193 | |
2216 | |
2194 | if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT) |
2217 | if (expect_true (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT)) |
2195 | { |
2218 | { |
2196 | if (!seen_input) |
2219 | if (expect_false (!seen_input)) |
2197 | { |
2220 | { |
2198 | seen_input = 1; |
2221 | seen_input = 1; |
2199 | // many badly-written programs (e.g. jed) contain a race condition: |
2222 | // many badly-written programs (e.g. jed) contain a race condition: |
2200 | // they first read the screensize and then install a SIGWINCH handler. |
2223 | // they first read the screensize and then install a SIGWINCH handler. |
2201 | // some window managers resize the window early, and these programs |
2224 | // some window managers resize the window early, and these programs |
… | |
… | |
2214 | wchar_t *str = buf; |
2237 | wchar_t *str = buf; |
2215 | wchar_t *eol = str + min (ncol, UBUFSIZ); |
2238 | wchar_t *eol = str + min (ncol, UBUFSIZ); |
2216 | |
2239 | |
2217 | for (;;) |
2240 | for (;;) |
2218 | { |
2241 | { |
2219 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2242 | if (expect_false (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT))) |
2220 | break; |
2243 | break; |
2221 | |
2244 | |
2222 | *str++ = ch; |
2245 | *str++ = ch; |
2223 | |
2246 | |
2224 | if (ch == C0_LF || str >= eol) |
2247 | if (expect_false (ch == C0_LF || str >= eol)) |
2225 | { |
2248 | { |
2226 | if (ch == C0_LF) |
2249 | if (ch == C0_LF) |
2227 | nlines++; |
2250 | nlines++; |
2228 | |
2251 | |
2229 | refresh_count++; |
2252 | refresh_count++; |
… | |
… | |
2278 | * What the heck we'll cheat and only refresh less than every page-full. |
2301 | * What the heck we'll cheat and only refresh less than every page-full. |
2279 | * if skipScroll is enabled. |
2302 | * if skipScroll is enabled. |
2280 | */ |
2303 | */ |
2281 | if (refreshnow) |
2304 | if (refreshnow) |
2282 | { |
2305 | { |
2283 | flag = true; |
|
|
2284 | scr_refresh (); |
2306 | scr_refresh (); |
2285 | want_refresh = 1; |
2307 | want_refresh = 1; |
2286 | } |
2308 | } |
2287 | |
|
|
2288 | } |
2309 | } |
2289 | else |
2310 | else |
2290 | { |
2311 | { |
2291 | try |
2312 | try |
2292 | { |
2313 | { |
… | |
… | |
2300 | } |
2321 | } |
2301 | |
2322 | |
2302 | ch = NOCHAR; |
2323 | ch = NOCHAR; |
2303 | } |
2324 | } |
2304 | } |
2325 | } |
2305 | |
|
|
2306 | return flag; |
|
|
2307 | } |
2326 | } |
2308 | |
2327 | |
2309 | // read the next character |
2328 | // read the next character |
2310 | wchar_t |
2329 | wchar_t |
2311 | rxvt_term::next_char () NOTHROW |
2330 | rxvt_term::next_char () NOTHROW |
2312 | { |
2331 | { |
2313 | while (cmdbuf_ptr < cmdbuf_endp) |
2332 | while (cmdbuf_ptr < cmdbuf_endp) |
2314 | { |
2333 | { |
2315 | // assume 7-bit to be ascii ALWAYS |
2334 | // assume 7-bit to be ascii ALWAYS |
2316 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2335 | if (expect_true ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b)) |
2317 | return *cmdbuf_ptr++; |
2336 | return *cmdbuf_ptr++; |
2318 | |
2337 | |
2319 | wchar_t wc; |
2338 | wchar_t wc; |
2320 | size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); |
2339 | size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); |
2321 | |
2340 | |
… | |
… | |
2325 | cmdbuf_ptr = cmdbuf_endp; |
2344 | cmdbuf_ptr = cmdbuf_endp; |
2326 | break; |
2345 | break; |
2327 | } |
2346 | } |
2328 | |
2347 | |
2329 | if (len == (size_t)-1) |
2348 | if (len == (size_t)-1) |
|
|
2349 | { |
|
|
2350 | mbstate.reset (); // reset now undefined conversion state |
2330 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2351 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
|
|
2352 | } |
2331 | |
2353 | |
2332 | // assume wchar == unicode |
2354 | // assume wchar == unicode |
2333 | cmdbuf_ptr += len; |
2355 | cmdbuf_ptr += len; |
2334 | return wc & UNICODE_MASK; |
2356 | return wc & UNICODE_MASK; |
2335 | } |
2357 | } |
… | |
… | |
2379 | /*----------------------------------------------------------------------*/ |
2401 | /*----------------------------------------------------------------------*/ |
2380 | #ifdef PRINTPIPE |
2402 | #ifdef PRINTPIPE |
2381 | FILE * |
2403 | FILE * |
2382 | rxvt_term::popen_printer () |
2404 | rxvt_term::popen_printer () |
2383 | { |
2405 | { |
2384 | FILE *stream = popen (rs[Rs_print_pipe], "w"); |
2406 | FILE *stream = popen (rs[Rs_print_pipe] ? rs[Rs_print_pipe] : PRINTPIPE, "w"); |
2385 | |
2407 | |
2386 | if (stream == NULL) |
2408 | if (stream == NULL) |
2387 | rxvt_warn ("can't open printer pipe, not printing.\n"); |
2409 | rxvt_warn ("can't open printer pipe, not printing.\n"); |
2388 | |
2410 | |
2389 | return stream; |
2411 | return stream; |
… | |
… | |
2400 | * simulate attached vt100 printer |
2422 | * simulate attached vt100 printer |
2401 | */ |
2423 | */ |
2402 | void |
2424 | void |
2403 | rxvt_term::process_print_pipe () |
2425 | rxvt_term::process_print_pipe () |
2404 | { |
2426 | { |
2405 | int done; |
2427 | FILE *fd = popen_printer (); |
2406 | FILE *fd; |
|
|
2407 | |
2428 | |
2408 | if ((fd = popen_printer ()) == NULL) |
2429 | if (!fd) |
2409 | return; |
2430 | return; |
2410 | |
2431 | |
2411 | /* |
2432 | /* |
2412 | * Send all input to the printer until either ESC[4i or ESC[?4i |
2433 | * Send all input to the printer until either ESC[4i or ESC[?4i |
2413 | * is received. |
2434 | * is received. |
2414 | */ |
2435 | */ |
2415 | for (done = 0; !done;) |
2436 | for (int done = 0; !done; ) |
2416 | { |
2437 | { |
2417 | unsigned char buf[8]; |
2438 | unsigned char buf[8]; |
2418 | unicode_t ch; |
2439 | unicode_t ch; |
2419 | unsigned int i, len; |
2440 | unsigned int i, len; |
2420 | |
2441 | |
… | |
… | |
2565 | break; |
2586 | break; |
2566 | case 'Z': /* identify the terminal type */ |
2587 | case 'Z': /* identify the terminal type */ |
2567 | tt_printf ("\033/Z"); /* I am a VT100 emulating a VT52 */ |
2588 | tt_printf ("\033/Z"); /* I am a VT100 emulating a VT52 */ |
2568 | break; |
2589 | break; |
2569 | case '<': /* turn off VT52 mode */ |
2590 | case '<': /* turn off VT52 mode */ |
2570 | PrivMode (0, PrivMode_vt52); |
2591 | set_privmode (PrivMode_vt52, 0); |
2571 | break; |
2592 | break; |
2572 | case 'F': /* use special graphics character set */ |
2593 | case 'F': /* use special graphics character set */ |
2573 | case 'G': /* use regular character set */ |
2594 | case 'G': /* use regular character set */ |
2574 | /* unimplemented */ |
2595 | /* unimplemented */ |
2575 | break; |
2596 | break; |
… | |
… | |
2629 | scr_forwardindex (); |
2650 | scr_forwardindex (); |
2630 | break; |
2651 | break; |
2631 | #endif |
2652 | #endif |
2632 | case '=': |
2653 | case '=': |
2633 | case '>': |
2654 | case '>': |
2634 | PrivMode ((ch == '='), PrivMode_aplKP); |
2655 | set_privmode (PrivMode_aplKP, ch == '='); |
2635 | break; |
2656 | break; |
2636 | |
2657 | |
2637 | case C1_40: |
2658 | case C1_40: |
2638 | cmd_getc (); |
2659 | cmd_getc (); |
2639 | break; |
2660 | break; |
… | |
… | |
2678 | /* 8.3.110: SINGLE CHARACTER INTRODUCER */ |
2699 | /* 8.3.110: SINGLE CHARACTER INTRODUCER */ |
2679 | case C1_SCI: /* ESC Z */ |
2700 | case C1_SCI: /* ESC Z */ |
2680 | tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1); |
2701 | tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1); |
2681 | break; /* steal obsolete ESC [ c */ |
2702 | break; /* steal obsolete ESC [ c */ |
2682 | |
2703 | |
2683 | /* 8.3.16: CONTROL SEQUENCE INTRODUCER */ |
2704 | /* 8.3.16: CONTROL SEQUENCE INTRODUCER (CSI) */ |
2684 | case C1_CSI: /* ESC [ */ |
2705 | case C1_CSI: /* ESC [ */ |
2685 | process_csi_seq (); |
2706 | process_csi_seq (); |
2686 | break; |
2707 | break; |
2687 | |
2708 | |
2688 | /* 8.3.90: OPERATING SYSTEM COMMAND */ |
2709 | /* 8.3.90: OPERATING SYSTEM COMMAND (OSC) */ |
2689 | case C1_OSC: /* ESC ] */ |
2710 | case C1_OSC: /* ESC ] */ |
2690 | process_osc_seq (); |
2711 | process_osc_seq (); |
2691 | break; |
2712 | break; |
2692 | |
2713 | |
2693 | /* 8.3.106: RESET TO INITIAL STATE */ |
2714 | /* 8.3.106: RESET TO INITIAL STATE (RIS) */ |
2694 | case 'c': |
2715 | case 'c': |
2695 | mbstate.reset (); |
2716 | mbstate.reset (); |
2696 | scr_poweron (); |
2717 | scr_poweron (); |
2697 | scrollbar_show (1); |
2718 | scrollBar.show (1); |
2698 | break; |
2719 | break; |
2699 | |
2720 | |
2700 | /* 8.3.79: LOCKING-SHIFT TWO (see ISO2022) */ |
2721 | /* 8.3.79: LOCKING-SHIFT TWO (see ISO2022) */ |
2701 | case 'n': |
2722 | case 'n': |
2702 | scr_charset_choose (2); |
2723 | scr_charset_choose (2); |
… | |
… | |
2753 | |
2774 | |
2754 | nargs = 0; |
2775 | nargs = 0; |
2755 | |
2776 | |
2756 | priv = 0; |
2777 | priv = 0; |
2757 | ch = cmd_getc (); |
2778 | ch = cmd_getc (); |
2758 | if (ch >= '<' && ch <= '?') |
2779 | if ((ch >= '<' && ch <= '?') || ch == '!') |
2759 | { |
2780 | { |
2760 | /* '<' '=' '>' '?' */ |
2781 | /* '<' '=' '>' '?' '!' */ |
2761 | priv = ch; |
2782 | priv = ch; |
2762 | ch = cmd_getc (); |
2783 | ch = cmd_getc (); |
2763 | } |
2784 | } |
2764 | |
2785 | |
2765 | /* read any numerical arguments */ |
2786 | /* read any numerical arguments */ |
… | |
… | |
2819 | |
2840 | |
2820 | case '?': |
2841 | case '?': |
2821 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
2842 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
2822 | process_terminal_mode (ch, priv, nargs, arg); |
2843 | process_terminal_mode (ch, priv, nargs, arg); |
2823 | break; |
2844 | break; |
|
|
2845 | |
|
|
2846 | case '!': |
|
|
2847 | if (ch == CSI_70) |
|
|
2848 | { |
|
|
2849 | /* DECSTR: soft terminal reset, used by our terminfo since 9.06 */ |
|
|
2850 | scr_soft_reset (); |
|
|
2851 | |
|
|
2852 | static const int pm_h[] = { 7, 25 }; |
|
|
2853 | static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1049 }; |
|
|
2854 | |
|
|
2855 | process_terminal_mode ('h', 0, sizeof (pm_h) / sizeof (pm_h[0]), pm_h); |
|
|
2856 | process_terminal_mode ('l', 0, sizeof (pm_l) / sizeof (pm_l[0]), pm_l); |
2824 | } |
2857 | } |
|
|
2858 | break; |
|
|
2859 | } |
|
|
2860 | |
2825 | return; |
2861 | return; |
2826 | } |
2862 | } |
2827 | |
2863 | |
2828 | switch (ch) |
2864 | switch (ch) |
2829 | { |
2865 | { |
… | |
… | |
3258 | |
3294 | |
3259 | /* |
3295 | /* |
3260 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3296 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3261 | */ |
3297 | */ |
3262 | void |
3298 | void |
3263 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3299 | rxvt_term::process_xterm_seq (int op, char *str, char resp) |
3264 | { |
3300 | { |
3265 | int color; |
3301 | int color; |
3266 | char *buf, *name; |
3302 | char *buf, *name; |
3267 | bool query = str[0] == '?' && !str[1]; |
3303 | bool query = str[0] == '?' && !str[1]; |
3268 | int saveop = op; |
3304 | int saveop = op; |
… | |
… | |
3309 | |
3345 | |
3310 | XFree (value); |
3346 | XFree (value); |
3311 | } |
3347 | } |
3312 | else |
3348 | else |
3313 | { |
3349 | { |
3314 | char *eq = strchr (str, '='); // constness lost, but verified to be ok |
3350 | char *eq = strchr (str, '='); |
3315 | |
3351 | |
3316 | if (eq) |
3352 | if (eq) |
3317 | { |
3353 | { |
3318 | *eq = 0; |
3354 | *eq = 0; |
3319 | set_utf8_property (display->atom (str), eq + 1); |
3355 | set_utf8_property (display->atom (str), eq + 1); |
… | |
… | |
3375 | break; |
3411 | break; |
3376 | case URxvt_Color_IT: |
3412 | case URxvt_Color_IT: |
3377 | process_color_seq (op, Color_IT, str, resp); |
3413 | process_color_seq (op, Color_IT, str, resp); |
3378 | break; |
3414 | break; |
3379 | #endif |
3415 | #endif |
|
|
3416 | case URxvt_Color_border: |
|
|
3417 | process_color_seq (op, Color_border, str, resp); |
|
|
3418 | break; |
3380 | #if ENABLE_TRANSPARENCY |
3419 | #if ENABLE_TRANSPARENCY |
3381 | case URxvt_Color_tint: |
3420 | case URxvt_Color_tint: |
3382 | process_color_seq (op, Color_tint, str, resp); |
3421 | process_color_seq (op, Color_tint, str, resp); |
3383 | { |
3422 | { |
3384 | bool changed = false; |
3423 | bool changed = false; |
… | |
… | |
3399 | case Rxvt_Pixmap: |
3438 | case Rxvt_Pixmap: |
3400 | if (!strcmp (str, "?")) |
3439 | if (!strcmp (str, "?")) |
3401 | { |
3440 | { |
3402 | char str[256]; |
3441 | char str[256]; |
3403 | |
3442 | |
3404 | sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ |
3443 | sprintf (str, "[%dx%d+%d+%d]", |
3405 | min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767), |
3444 | min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767), |
3406 | min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767)); |
3445 | min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767)); |
3407 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
3446 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
3408 | } |
3447 | } |
3409 | else |
3448 | else |
… | |
… | |
3508 | break; |
3547 | break; |
3509 | #endif |
3548 | #endif |
3510 | |
3549 | |
3511 | #if ENABLE_PERL |
3550 | #if ENABLE_PERL |
3512 | case URxvt_perl: |
3551 | case URxvt_perl: |
3513 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ_PERL, DT_STR, str, DT_END))) |
3552 | HOOK_INVOKE ((this, HOOK_OSC_SEQ_PERL, DT_STR, str, DT_STR_LEN, &resp, 1, DT_END)); |
3514 | ; // no responses yet |
|
|
3515 | break; |
3553 | break; |
3516 | #endif |
3554 | #endif |
3517 | } |
3555 | } |
3518 | } |
3556 | } |
3519 | /*----------------------------------------------------------------------*/ |
3557 | /*----------------------------------------------------------------------*/ |
… | |
… | |
3542 | { |
3580 | { |
3543 | if (mode == 'r') |
3581 | if (mode == 'r') |
3544 | state = (SavedModes & bit) ? 1 : 0; /* no overlapping */ |
3582 | state = (SavedModes & bit) ? 1 : 0; /* no overlapping */ |
3545 | else |
3583 | else |
3546 | state = (mode == 't') ? ! (priv_modes & bit) : mode; |
3584 | state = (mode == 't') ? ! (priv_modes & bit) : mode; |
3547 | PrivMode (state, bit); |
3585 | set_privmode (bit, state); |
3548 | } |
3586 | } |
3549 | |
3587 | |
3550 | return state; |
3588 | return state; |
3551 | } |
3589 | } |
3552 | |
3590 | |
… | |
… | |
3560 | static const struct |
3598 | static const struct |
3561 | { |
3599 | { |
3562 | const int argval; |
3600 | const int argval; |
3563 | const unsigned long bit; |
3601 | const unsigned long bit; |
3564 | } argtopriv[] = { |
3602 | } argtopriv[] = { |
3565 | { 1, PrivMode_aplCUR }, |
3603 | { 1, PrivMode_aplCUR }, // DECCKM |
3566 | { 2, PrivMode_vt52 }, |
3604 | { 2, PrivMode_vt52 }, |
3567 | { 3, PrivMode_132 }, |
3605 | { 3, PrivMode_132 }, // DECCOLM |
3568 | { 4, PrivMode_smoothScroll }, |
3606 | { 4, PrivMode_smoothScroll }, // DECSCLM |
3569 | { 5, PrivMode_rVideo }, |
3607 | { 5, PrivMode_rVideo }, // DECSCNM |
3570 | { 6, PrivMode_relOrigin }, |
3608 | { 6, PrivMode_relOrigin }, // DECOM |
3571 | { 7, PrivMode_Autowrap }, |
3609 | { 7, PrivMode_Autowrap }, // DECAWM |
3572 | // 8, bi-directional support mode |
3610 | // 8, auto-repeat keys // DECARM |
3573 | { 9, PrivMode_MouseX10 }, |
3611 | { 9, PrivMode_MouseX10 }, |
3574 | // 18, 19 printing-related |
3612 | // 18 end FF to printer after print screen |
|
|
3613 | // 19 Print screen prints full screen/scorll region |
3575 | { 25, PrivMode_VisibleCursor }, |
3614 | { 25, PrivMode_VisibleCursor }, // cnorm/cvvis/civis |
3576 | #ifdef scrollBar_esc |
3615 | #ifdef scrollBar_esc |
3577 | { scrollBar_esc, PrivMode_scrollBar }, |
3616 | { scrollBar_esc, PrivMode_scrollBar }, |
3578 | #endif |
3617 | #endif |
3579 | { 35, PrivMode_ShiftKeys }, // rxvt extension |
3618 | { 35, PrivMode_ShiftKeys }, // rxvt extension |
|
|
3619 | // 38, tektronix mode // DECTEK |
3580 | { 40, PrivMode_132OK }, |
3620 | { 40, PrivMode_132OK }, |
3581 | // 41 xterm more fixes NYI |
3621 | // 41 xterm more fixes NYI |
3582 | // 45 margin bell NYI |
3622 | // 45 margin bell NYI |
3583 | // 46 start logging |
3623 | // 46 start logging |
3584 | { 47, PrivMode_Screen }, |
3624 | { 47, PrivMode_Screen }, |
3585 | { 66, PrivMode_aplKP }, |
3625 | { 66, PrivMode_aplKP }, // DECPAM/DECPNM |
3586 | #ifndef NO_BACKSPACE_KEY |
3626 | #ifndef NO_BACKSPACE_KEY |
3587 | { 67, PrivMode_BackSpace }, |
3627 | { 67, PrivMode_BackSpace }, // DECBKM |
3588 | #endif |
3628 | #endif |
3589 | { 1000, PrivMode_MouseX11 }, |
3629 | { 1000, PrivMode_MouseX11 }, |
3590 | { 1002, PrivMode_MouseBtnEvent }, |
3630 | { 1002, PrivMode_MouseBtnEvent }, |
3591 | { 1003, PrivMode_MouseAnyEvent }, |
3631 | { 1003, PrivMode_MouseAnyEvent }, |
3592 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3632 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
… | |
… | |
3631 | |
3671 | |
3632 | scr_touch (true); |
3672 | scr_touch (true); |
3633 | break; |
3673 | break; |
3634 | #endif |
3674 | #endif |
3635 | case 1048: /* alternative cursor save */ |
3675 | case 1048: /* alternative cursor save */ |
3636 | case 1049: |
|
|
3637 | if (option (Opt_secondaryScreen)) |
3676 | if (option (Opt_secondaryScreen)) |
3638 | if (mode == 0) |
3677 | if (mode == 0) |
3639 | scr_cursor (RESTORE); |
3678 | scr_cursor (RESTORE); |
3640 | else if (mode == 1) |
3679 | else if (mode == 1) |
3641 | scr_cursor (SAVE); |
3680 | scr_cursor (SAVE); |
… | |
… | |
3650 | case 2: /* VT52 mode */ |
3689 | case 2: /* VT52 mode */ |
3651 | /* oddball mode. should be set regardless of set/reset |
3690 | /* oddball mode. should be set regardless of set/reset |
3652 | * parameter. Return from VT52 mode with an ESC < from |
3691 | * parameter. Return from VT52 mode with an ESC < from |
3653 | * within VT52 mode |
3692 | * within VT52 mode |
3654 | */ |
3693 | */ |
3655 | PrivMode (1, PrivMode_vt52); |
3694 | set_privmode (PrivMode_vt52, 1); |
3656 | break; |
3695 | break; |
3657 | case 3: /* 80/132 */ |
3696 | case 3: /* 80/132 */ |
3658 | if (priv_modes & PrivMode_132OK) |
3697 | if (priv_modes & PrivMode_132OK) |
3659 | { |
|
|
3660 | scr_poweron (); |
|
|
3661 | set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight); |
3698 | set_widthheight ((state ? 132 : 80) * fwidth, 24 * fheight); |
3662 | } |
|
|
3663 | break; |
3699 | break; |
3664 | case 4: /* smooth scrolling */ |
3700 | case 4: /* smooth scrolling */ |
3665 | set_option (Opt_jumpScroll, !state); |
3701 | set_option (Opt_jumpScroll, !state); |
3666 | break; |
3702 | break; |
3667 | case 5: /* reverse video */ |
3703 | case 5: /* reverse video */ |
… | |
… | |
3678 | if (state) /* orthogonal */ |
3714 | if (state) /* orthogonal */ |
3679 | priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
3715 | priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
3680 | break; |
3716 | break; |
3681 | #ifdef scrollBar_esc |
3717 | #ifdef scrollBar_esc |
3682 | case scrollBar_esc: |
3718 | case scrollBar_esc: |
3683 | if (scrollbar_mapping (state)) |
3719 | if (scrollBar.map (state)) |
3684 | { |
3720 | { |
3685 | resize_all_windows (0, 0, 0); |
3721 | resize_all_windows (0, 0, 0); |
3686 | scr_touch (true); |
3722 | scr_touch (true); |
3687 | } |
3723 | } |
3688 | break; |
3724 | break; |
… | |
… | |
3709 | priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; |
3745 | priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; |
3710 | vt_emask_mouse = PointerMotionMask; |
3746 | vt_emask_mouse = PointerMotionMask; |
3711 | } |
3747 | } |
3712 | else |
3748 | else |
3713 | vt_emask_mouse = NoEventMask; |
3749 | vt_emask_mouse = NoEventMask; |
|
|
3750 | |
3714 | vt_select_input (); |
3751 | vt_select_input (); |
3715 | break; |
3752 | break; |
3716 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3753 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3717 | set_option (Opt_scrollTtyOutput, !state); |
3754 | set_option (Opt_scrollTtyOutput, !state); |
3718 | break; |
3755 | break; |
3719 | case 1011: /* scroll to bottom on key press */ |
3756 | case 1011: /* scroll to bottom on key press */ |
3720 | set_option (Opt_scrollTtyKeypress, state); |
3757 | set_option (Opt_scrollTtyKeypress, state); |
3721 | break; |
3758 | break; |
3722 | case 1047: /* secondary screen w/ clearing last */ |
3759 | case 1047: /* secondary screen w/ clearing last */ |
3723 | if (option (Opt_secondaryScreen)) |
3760 | if (option (Opt_secondaryScreen)) |
3724 | if (current_screen != PRIMARY) |
3761 | if (!state) |
3725 | scr_erase_screen (2); |
3762 | scr_erase_screen (2); |
|
|
3763 | |
3726 | scr_change_screen (state); |
3764 | scr_change_screen (state); |
3727 | break; |
3765 | break; |
3728 | case 1049: /* secondary screen w/ clearing first */ |
3766 | case 1049: /* secondary screen w/ clearing first */ |
|
|
3767 | if (option (Opt_secondaryScreen)) |
|
|
3768 | if (state) |
|
|
3769 | scr_cursor (SAVE); |
|
|
3770 | |
3729 | scr_change_screen (state); |
3771 | scr_change_screen (state); |
|
|
3772 | |
3730 | if (option (Opt_secondaryScreen)) |
3773 | if (option (Opt_secondaryScreen)) |
3731 | if (current_screen != PRIMARY) |
3774 | if (state) |
3732 | scr_erase_screen (2); |
3775 | scr_erase_screen (2); |
|
|
3776 | else |
|
|
3777 | scr_cursor (RESTORE); |
3733 | break; |
3778 | break; |
3734 | default: |
3779 | default: |
3735 | break; |
3780 | break; |
3736 | } |
3781 | } |
3737 | } |
3782 | } |