… | |
… | |
419 | meta = ev.state & ModMetaMask; |
419 | meta = ev.state & ModMetaMask; |
420 | |
420 | |
421 | if (numlock_state || (ev.state & ModNumLockMask)) |
421 | if (numlock_state || (ev.state & ModNumLockMask)) |
422 | { |
422 | { |
423 | numlock_state = (ev.state & ModNumLockMask); |
423 | numlock_state = (ev.state & ModNumLockMask); |
424 | PrivMode ((!numlock_state), PrivMode_aplKP); |
424 | set_privmode (PrivMode_aplKP, !numlock_state); |
425 | } |
425 | } |
426 | |
426 | |
427 | kbuf[0] = 0; |
427 | kbuf[0] = 0; |
428 | |
428 | |
429 | #ifdef USE_XIM |
429 | #ifdef USE_XIM |
… | |
… | |
505 | #ifdef PAGING_CONTEXT_LINES |
505 | #ifdef PAGING_CONTEXT_LINES |
506 | lnsppg = nrow - PAGING_CONTEXT_LINES; |
506 | lnsppg = nrow - PAGING_CONTEXT_LINES; |
507 | #else |
507 | #else |
508 | lnsppg = nrow * 4 / 5; |
508 | lnsppg = nrow * 4 / 5; |
509 | #endif |
509 | #endif |
|
|
510 | max_it (lnsppg, 1); |
|
|
511 | |
510 | if (keysym == XK_Prior) |
512 | if (keysym == XK_Prior) |
511 | { |
513 | { |
512 | scr_page (UP, lnsppg); |
514 | scr_page (UP, lnsppg); |
513 | return; |
515 | return; |
514 | } |
516 | } |
… | |
… | |
579 | } |
581 | } |
580 | } |
582 | } |
581 | |
583 | |
582 | #if ENABLE_FRILLS || ISO_14755 |
584 | #if ENABLE_FRILLS || ISO_14755 |
583 | // ISO 14755 support |
585 | // ISO 14755 support |
584 | if (shft && ctrl) |
586 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_51)) |
585 | { |
587 | { |
586 | int hv; |
588 | int hv; |
587 | |
589 | |
588 | if (iso14755buf & ISO_14755_51 |
590 | if (iso14755buf & ISO_14755_51 |
589 | && (keysym == XK_space || keysym == XK_KP_Space |
591 | && (keysym == XK_space || keysym == XK_KP_Space |
… | |
… | |
619 | scr_overlay_off (); |
621 | scr_overlay_off (); |
620 | # endif |
622 | # endif |
621 | iso14755buf = 0; |
623 | iso14755buf = 0; |
622 | } |
624 | } |
623 | } |
625 | } |
|
|
626 | else if (option (Opt_iso14755) && |
624 | else if ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R)) |
627 | ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R)) |
625 | || (shft && (keysym == XK_Control_L || keysym == XK_Control_R))) |
628 | || (shft && (keysym == XK_Control_L || keysym == XK_Control_R)))) |
626 | if (!(iso14755buf & ISO_14755_STARTED)) |
629 | if (!(iso14755buf & ISO_14755_STARTED)) |
627 | { |
630 | { |
628 | iso14755buf |= ISO_14755_STARTED; |
631 | iso14755buf |= ISO_14755_STARTED; |
629 | # if ISO_14755 |
632 | # if ISO_14755 |
630 | scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); |
633 | scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); |
… | |
… | |
641 | } |
644 | } |
642 | #endif |
645 | #endif |
643 | |
646 | |
644 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
647 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
645 | { |
648 | { |
646 | bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; |
649 | bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; |
647 | unsigned int newlen = 1; |
650 | unsigned int newlen = 1; |
648 | |
651 | |
649 | switch (translate_keypad (keysym, kp)) |
652 | switch (translate_keypad (keysym, kp)) |
|
|
653 | { |
|
|
654 | #ifndef NO_BACKSPACE_KEY |
|
|
655 | case XK_BackSpace: |
|
|
656 | if (priv_modes & PrivMode_HaveBackSpace) |
|
|
657 | { |
|
|
658 | kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) |
|
|
659 | ^ !!ctrl) ? '\b' : '\177'; |
|
|
660 | kbuf[1] = '\0'; |
|
|
661 | } |
|
|
662 | else |
|
|
663 | strcpy (kbuf, rs[Rs_backspace_key]); |
|
|
664 | break; |
|
|
665 | #endif |
|
|
666 | #ifndef NO_DELETE_KEY |
|
|
667 | case XK_Delete: |
|
|
668 | strcpy (kbuf, rs[Rs_delete_key]); |
|
|
669 | break; |
|
|
670 | #endif |
|
|
671 | case XK_Tab: |
|
|
672 | if (shft) |
|
|
673 | strcpy (kbuf, "\033[Z"); |
|
|
674 | else |
|
|
675 | { |
|
|
676 | #ifdef CTRL_TAB_MAKES_META |
|
|
677 | if (ctrl) |
|
|
678 | meta = 1; |
|
|
679 | #endif |
|
|
680 | #ifdef MOD4_TAB_MAKES_META |
|
|
681 | if (ev.state & Mod4Mask) |
|
|
682 | meta = 1; |
|
|
683 | #endif |
|
|
684 | newlen = 0; |
|
|
685 | } |
|
|
686 | break; |
|
|
687 | |
|
|
688 | case XK_Up: /* "\033[A" */ |
|
|
689 | case XK_Down: /* "\033[B" */ |
|
|
690 | case XK_Right: /* "\033[C" */ |
|
|
691 | case XK_Left: /* "\033[D" */ |
|
|
692 | strcpy (kbuf, "\033[Z"); |
|
|
693 | kbuf[2] = "DACB"[keysym - XK_Left]; |
|
|
694 | /* do Shift first */ |
|
|
695 | if (shft) |
|
|
696 | kbuf[2] = "dacb"[keysym - XK_Left]; |
|
|
697 | else if (ctrl) |
|
|
698 | { |
|
|
699 | kbuf[1] = 'O'; |
|
|
700 | kbuf[2] = "dacb"[keysym - XK_Left]; |
|
|
701 | } |
|
|
702 | else if (priv_modes & PrivMode_aplCUR) |
|
|
703 | kbuf[1] = 'O'; |
|
|
704 | break; |
|
|
705 | |
|
|
706 | case XK_KP_Enter: |
|
|
707 | /* allow shift to override */ |
|
|
708 | if (kp) |
|
|
709 | { |
|
|
710 | strcpy (kbuf, "\033OM"); |
|
|
711 | break; |
|
|
712 | } |
|
|
713 | |
|
|
714 | /* FALLTHROUGH */ |
|
|
715 | |
|
|
716 | case XK_Return: |
|
|
717 | if (priv_modes & PrivMode_LFNL) |
|
|
718 | { |
|
|
719 | kbuf[0] = '\015'; |
|
|
720 | kbuf[1] = '\012'; |
|
|
721 | kbuf[2] = '\0'; |
|
|
722 | } |
|
|
723 | else |
|
|
724 | { |
|
|
725 | kbuf[0] = '\015'; |
|
|
726 | kbuf[1] = '\0'; |
|
|
727 | } |
|
|
728 | break; |
|
|
729 | |
|
|
730 | case XK_KP_F1: /* "\033OP" */ |
|
|
731 | case XK_KP_F2: /* "\033OQ" */ |
|
|
732 | case XK_KP_F3: /* "\033OR" */ |
|
|
733 | case XK_KP_F4: /* "\033OS" */ |
|
|
734 | strcpy (kbuf, "\033OP"); |
|
|
735 | kbuf[2] += (keysym - XK_KP_F1); |
|
|
736 | break; |
|
|
737 | |
|
|
738 | case XK_KP_Multiply: /* "\033Oj" : "*" */ |
|
|
739 | case XK_KP_Add: /* "\033Ok" : "+" */ |
|
|
740 | case XK_KP_Separator: /* "\033Ol" : "," */ |
|
|
741 | case XK_KP_Subtract: /* "\033Om" : "-" */ |
|
|
742 | case XK_KP_Decimal: /* "\033On" : "." */ |
|
|
743 | case XK_KP_Divide: /* "\033Oo" : "/" */ |
|
|
744 | case XK_KP_0: /* "\033Op" : "0" */ |
|
|
745 | case XK_KP_1: /* "\033Oq" : "1" */ |
|
|
746 | case XK_KP_2: /* "\033Or" : "2" */ |
|
|
747 | case XK_KP_3: /* "\033Os" : "3" */ |
|
|
748 | case XK_KP_4: /* "\033Ot" : "4" */ |
|
|
749 | case XK_KP_5: /* "\033Ou" : "5" */ |
|
|
750 | case XK_KP_6: /* "\033Ov" : "6" */ |
|
|
751 | case XK_KP_7: /* "\033Ow" : "7" */ |
|
|
752 | case XK_KP_8: /* "\033Ox" : "8" */ |
|
|
753 | case XK_KP_9: /* "\033Oy" : "9" */ |
|
|
754 | /* allow shift to override */ |
|
|
755 | if (kp) |
|
|
756 | { |
|
|
757 | strcpy (kbuf, "\033Oj"); |
|
|
758 | kbuf[2] += (keysym - XK_KP_Multiply); |
|
|
759 | } |
|
|
760 | else |
|
|
761 | { |
|
|
762 | kbuf[0] = ('*' + (keysym - XK_KP_Multiply)); |
|
|
763 | kbuf[1] = '\0'; |
|
|
764 | } |
|
|
765 | break; |
|
|
766 | |
|
|
767 | default: |
650 | { |
768 | { |
651 | #ifndef NO_BACKSPACE_KEY |
|
|
652 | case XK_BackSpace: |
|
|
653 | if (priv_modes & PrivMode_HaveBackSpace) |
|
|
654 | { |
|
|
655 | kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) |
|
|
656 | ^ !!ctrl) ? '\b' : '\177'; |
|
|
657 | kbuf[1] = '\0'; |
|
|
658 | } |
|
|
659 | else |
|
|
660 | strcpy (kbuf, rs[Rs_backspace_key]); |
|
|
661 | break; |
|
|
662 | #endif |
|
|
663 | #ifndef NO_DELETE_KEY |
|
|
664 | case XK_Delete: |
|
|
665 | strcpy (kbuf, rs[Rs_delete_key]); |
|
|
666 | break; |
|
|
667 | #endif |
|
|
668 | case XK_Tab: |
|
|
669 | if (shft) |
|
|
670 | strcpy (kbuf, "\033[Z"); |
|
|
671 | else |
|
|
672 | { |
|
|
673 | #ifdef CTRL_TAB_MAKES_META |
|
|
674 | if (ctrl) |
|
|
675 | meta = 1; |
|
|
676 | #endif |
|
|
677 | #ifdef MOD4_TAB_MAKES_META |
|
|
678 | if (ev.state & Mod4Mask) |
|
|
679 | meta = 1; |
|
|
680 | #endif |
|
|
681 | newlen = 0; |
|
|
682 | } |
|
|
683 | break; |
|
|
684 | |
|
|
685 | case XK_Up: /* "\033[A" */ |
|
|
686 | case XK_Down: /* "\033[B" */ |
|
|
687 | case XK_Right: /* "\033[C" */ |
|
|
688 | case XK_Left: /* "\033[D" */ |
|
|
689 | strcpy (kbuf, "\033[Z"); |
|
|
690 | kbuf[2] = "DACB"[keysym - XK_Left]; |
|
|
691 | /* do Shift first */ |
|
|
692 | if (shft) |
|
|
693 | kbuf[2] = "dacb"[keysym - XK_Left]; |
|
|
694 | else if (ctrl) |
|
|
695 | { |
|
|
696 | kbuf[1] = 'O'; |
|
|
697 | kbuf[2] = "dacb"[keysym - XK_Left]; |
|
|
698 | } |
|
|
699 | else if (priv_modes & PrivMode_aplCUR) |
|
|
700 | kbuf[1] = 'O'; |
|
|
701 | break; |
|
|
702 | |
|
|
703 | case XK_KP_Enter: |
|
|
704 | /* allow shift to override */ |
|
|
705 | if (kp) |
|
|
706 | { |
|
|
707 | strcpy (kbuf, "\033OM"); |
|
|
708 | break; |
|
|
709 | } |
|
|
710 | |
|
|
711 | /* FALLTHROUGH */ |
|
|
712 | |
|
|
713 | case XK_Return: |
|
|
714 | if (priv_modes & PrivMode_LFNL) |
|
|
715 | { |
|
|
716 | kbuf[0] = '\015'; |
|
|
717 | kbuf[1] = '\012'; |
|
|
718 | kbuf[2] = '\0'; |
|
|
719 | } |
|
|
720 | else |
|
|
721 | { |
|
|
722 | kbuf[0] = '\015'; |
|
|
723 | kbuf[1] = '\0'; |
|
|
724 | } |
|
|
725 | break; |
|
|
726 | |
|
|
727 | case XK_KP_F1: /* "\033OP" */ |
|
|
728 | case XK_KP_F2: /* "\033OQ" */ |
|
|
729 | case XK_KP_F3: /* "\033OR" */ |
|
|
730 | case XK_KP_F4: /* "\033OS" */ |
|
|
731 | strcpy (kbuf, "\033OP"); |
|
|
732 | kbuf[2] += (keysym - XK_KP_F1); |
|
|
733 | break; |
|
|
734 | |
|
|
735 | case XK_KP_Multiply: /* "\033Oj" : "*" */ |
|
|
736 | case XK_KP_Add: /* "\033Ok" : "+" */ |
|
|
737 | case XK_KP_Separator: /* "\033Ol" : "," */ |
|
|
738 | case XK_KP_Subtract: /* "\033Om" : "-" */ |
|
|
739 | case XK_KP_Decimal: /* "\033On" : "." */ |
|
|
740 | case XK_KP_Divide: /* "\033Oo" : "/" */ |
|
|
741 | case XK_KP_0: /* "\033Op" : "0" */ |
|
|
742 | case XK_KP_1: /* "\033Oq" : "1" */ |
|
|
743 | case XK_KP_2: /* "\033Or" : "2" */ |
|
|
744 | case XK_KP_3: /* "\033Os" : "3" */ |
|
|
745 | case XK_KP_4: /* "\033Ot" : "4" */ |
|
|
746 | case XK_KP_5: /* "\033Ou" : "5" */ |
|
|
747 | case XK_KP_6: /* "\033Ov" : "6" */ |
|
|
748 | case XK_KP_7: /* "\033Ow" : "7" */ |
|
|
749 | case XK_KP_8: /* "\033Ox" : "8" */ |
|
|
750 | case XK_KP_9: /* "\033Oy" : "9" */ |
|
|
751 | /* allow shift to override */ |
|
|
752 | if (kp) |
|
|
753 | { |
|
|
754 | strcpy (kbuf, "\033Oj"); |
|
|
755 | kbuf[2] += (keysym - XK_KP_Multiply); |
|
|
756 | } |
|
|
757 | else |
|
|
758 | { |
|
|
759 | kbuf[0] = ('*' + (keysym - XK_KP_Multiply)); |
|
|
760 | kbuf[1] = '\0'; |
|
|
761 | } |
|
|
762 | break; |
|
|
763 | |
|
|
764 | default: |
|
|
765 | { |
|
|
766 | int param = map_function_key (keysym); |
769 | int param = map_function_key (keysym); |
767 | if (param > 0) |
770 | if (param > 0) |
768 | sprintf (kbuf,"\033[%d~", param); |
771 | sprintf (kbuf,"\033[%d~", param); |
769 | else |
772 | else |
770 | newlen = 0; |
773 | newlen = 0; |
771 | } |
|
|
772 | break; |
|
|
773 | } |
774 | } |
|
|
775 | break; |
|
|
776 | } |
774 | |
777 | |
775 | if (newlen) |
778 | if (newlen) |
776 | len = strlen (kbuf); |
779 | len = strlen (kbuf); |
777 | |
780 | |
778 | /* |
781 | /* |
779 | * Pass meta for all function keys, if 'meta' option set |
782 | * Pass meta for all function keys, if 'meta' option set |
780 | */ |
783 | */ |
781 | #ifdef META8_OPTION |
784 | #ifdef META8_OPTION |
… | |
… | |
1015 | } |
1018 | } |
1016 | while (row < end_row); |
1019 | while (row < end_row); |
1017 | } |
1020 | } |
1018 | |
1021 | |
1019 | scr_refresh (); |
1022 | scr_refresh (); |
1020 | scrollbar_show (1); |
1023 | scrollBar.show (1); |
1021 | #ifdef USE_XIM |
1024 | #ifdef USE_XIM |
1022 | IMSendSpot (); |
1025 | IMSendSpot (); |
1023 | #endif |
1026 | #endif |
1024 | } |
1027 | } |
1025 | |
1028 | |
… | |
… | |
1127 | { |
1130 | { |
1128 | // this should really be sched_yield(), but the linux guys thought |
1131 | // this should really be sched_yield(), but the linux guys thought |
1129 | // that giving a process calling sched_yield () less cpu time than |
1132 | // that giving a process calling sched_yield () less cpu time than |
1130 | // ones with high nice levels is a useful thing to do. It surely is is |
1133 | // ones with high nice levels is a useful thing to do. It surely is is |
1131 | // allowed by the sus... as is returning ENOSYS. |
1134 | // allowed by the sus... as is returning ENOSYS. |
|
|
1135 | // since the linux guys additionally thought that breaking the only |
|
|
1136 | // known workaroudn against their unusable sched_yield hack is cool, |
|
|
1137 | // we just nanosleep a bit and hope for the best. |
1132 | |
1138 | |
1133 | struct timespec ts = { 0, 0 }; |
1139 | struct timespec ts = { 0, 1000 }; |
1134 | nanosleep (&ts, 0); |
1140 | nanosleep (&ts, 0); |
1135 | |
1141 | |
1136 | w.stop (); |
1142 | w.stop (); |
1137 | } |
1143 | } |
1138 | |
1144 | |
… | |
… | |
1188 | { |
1194 | { |
1189 | make_current (); |
1195 | make_current (); |
1190 | |
1196 | |
1191 | if (revents & ev::READ) |
1197 | if (revents & ev::READ) |
1192 | // loop, but don't allow a single term to monopolize us |
1198 | // loop, but don't allow a single term to monopolize us |
1193 | while (pty_fill ()) |
1199 | for (int i = CBUFCNT; i-- && pty_fill (); ) |
1194 | if (cmd_parse ()) |
1200 | cmd_parse (); |
1195 | break; |
|
|
1196 | |
1201 | |
1197 | if (revents & ev::WRITE) |
1202 | if (revents & ev::WRITE) |
1198 | pty_write (); |
1203 | pty_write (); |
1199 | |
1204 | |
1200 | refresh_check (); |
1205 | refresh_check (); |
… | |
… | |
1459 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1464 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1460 | |
1465 | |
1461 | break; |
1466 | break; |
1462 | |
1467 | |
1463 | case SelectionClear: |
1468 | case SelectionClear: |
1464 | selection_clear (); |
1469 | selection_clear (ev.xselectionclear.selection == xa[XA_CLIPBOARD]); |
1465 | break; |
1470 | break; |
1466 | |
1471 | |
1467 | case SelectionNotify: |
1472 | case SelectionNotify: |
1468 | if (selection_wait == Sel_normal) |
1473 | if (selection_wait == Sel_normal) |
1469 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
1474 | selection_paste (ev.xselection.requestor, ev.xselection.property, true); |
… | |
… | |
1536 | ; |
1541 | ; |
1537 | |
1542 | |
1538 | if (scrollBar.state && ev.xany.window == scrollBar.win) |
1543 | if (scrollBar.state && ev.xany.window == scrollBar.win) |
1539 | { |
1544 | { |
1540 | scrollBar.state = STATE_IDLE; |
1545 | scrollBar.state = STATE_IDLE; |
1541 | scrollbar_show (0); |
1546 | scrollBar.show (0); |
1542 | } |
1547 | } |
1543 | } |
1548 | } |
1544 | break; |
1549 | break; |
1545 | |
1550 | |
1546 | case MotionNotify: |
1551 | case MotionNotify: |
… | |
… | |
1645 | &unused_root, &unused_child, |
1650 | &unused_root, &unused_child, |
1646 | &unused_root_x, &unused_root_y, |
1651 | &unused_root_x, &unused_root_y, |
1647 | &ev.xbutton.x, &ev.xbutton.y, |
1652 | &ev.xbutton.x, &ev.xbutton.y, |
1648 | &unused_mask); |
1653 | &unused_mask); |
1649 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1654 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1650 | scrollbar_size ()); |
1655 | scrollBar.size ()); |
1651 | want_refresh = 1; |
1656 | want_refresh = 1; |
1652 | scrollbar_show (1); |
1657 | scrollBar.show (1); |
1653 | } |
1658 | } |
1654 | break; |
1659 | break; |
1655 | } |
1660 | } |
1656 | |
1661 | |
1657 | #if defined(CURSOR_BLINK) |
1662 | #if defined(CURSOR_BLINK) |
… | |
… | |
1682 | #endif |
1687 | #endif |
1683 | |
1688 | |
1684 | refresh_check (); |
1689 | refresh_check (); |
1685 | } |
1690 | } |
1686 | |
1691 | |
|
|
1692 | #if ENABLE_FRILLS |
|
|
1693 | void |
|
|
1694 | rxvt_term::set_urgency (bool enable) |
|
|
1695 | { |
|
|
1696 | if (enable == urgency_hint) |
|
|
1697 | return; |
|
|
1698 | |
|
|
1699 | if (XWMHints *h = XGetWMHints (dpy, parent[0])) |
|
|
1700 | { |
|
|
1701 | h->flags = h->flags & ~XUrgencyHint | (enable ? XUrgencyHint : 0); |
|
|
1702 | XSetWMHints (dpy, parent[0], h); |
|
|
1703 | urgency_hint = enable; |
|
|
1704 | } |
|
|
1705 | } |
|
|
1706 | #endif |
|
|
1707 | |
1687 | void |
1708 | void |
1688 | rxvt_term::focus_in () |
1709 | rxvt_term::focus_in () |
1689 | { |
1710 | { |
1690 | if (!focus) |
1711 | if (!focus) |
1691 | { |
1712 | { |
1692 | focus = 1; |
1713 | focus = 1; |
1693 | want_refresh = 1; |
1714 | want_refresh = 1; |
1694 | |
|
|
1695 | HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END)); |
|
|
1696 | |
1715 | |
1697 | #if USE_XIM |
1716 | #if USE_XIM |
1698 | if (Input_Context != NULL) |
1717 | if (Input_Context != NULL) |
1699 | { |
1718 | { |
1700 | IMSetPosition (); |
1719 | IMSetPosition (); |
… | |
… | |
1712 | scr_recolour (); |
1731 | scr_recolour (); |
1713 | } |
1732 | } |
1714 | #endif |
1733 | #endif |
1715 | #if ENABLE_FRILLS |
1734 | #if ENABLE_FRILLS |
1716 | if (option (Opt_urgentOnBell)) |
1735 | if (option (Opt_urgentOnBell)) |
1717 | { |
1736 | set_urgency (0); |
1718 | if (XWMHints *h = XGetWMHints(dpy, parent[0])) |
|
|
1719 | { |
|
|
1720 | h->flags &= ~XUrgencyHint; |
|
|
1721 | XSetWMHints (dpy, parent[0], h); |
|
|
1722 | } |
|
|
1723 | } |
|
|
1724 | #endif |
1737 | #endif |
|
|
1738 | |
|
|
1739 | HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END)); |
1725 | } |
1740 | } |
1726 | } |
1741 | } |
1727 | |
1742 | |
1728 | void |
1743 | void |
1729 | rxvt_term::focus_out () |
1744 | rxvt_term::focus_out () |
… | |
… | |
1731 | if (focus) |
1746 | if (focus) |
1732 | { |
1747 | { |
1733 | focus = 0; |
1748 | focus = 0; |
1734 | want_refresh = 1; |
1749 | want_refresh = 1; |
1735 | |
1750 | |
1736 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1751 | #if ENABLE_FRILLS |
1737 | |
1752 | if (option (Opt_urgentOnBell)) |
|
|
1753 | set_urgency (0); |
|
|
1754 | #endif |
1738 | #if ENABLE_FRILLS || ISO_14755 |
1755 | #if ENABLE_FRILLS || ISO_14755 |
1739 | if (iso14755buf) |
1756 | if (iso14755buf) |
1740 | { |
1757 | { |
1741 | iso14755buf = 0; |
1758 | iso14755buf = 0; |
1742 | # if ISO_14755 |
1759 | # if ISO_14755 |
… | |
… | |
1759 | { |
1776 | { |
1760 | pix_colors = pix_colors_unfocused; |
1777 | pix_colors = pix_colors_unfocused; |
1761 | scr_recolour (); |
1778 | scr_recolour (); |
1762 | } |
1779 | } |
1763 | #endif |
1780 | #endif |
|
|
1781 | |
|
|
1782 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1764 | } |
1783 | } |
1765 | } |
1784 | } |
1766 | |
1785 | |
1767 | void |
1786 | void |
1768 | rxvt_term::update_fade_color (unsigned int idx) |
1787 | rxvt_term::update_fade_color (unsigned int idx) |
… | |
… | |
2010 | } |
2029 | } |
2011 | |
2030 | |
2012 | if (scrollBar.style == R_SB_XTERM |
2031 | if (scrollBar.style == R_SB_XTERM |
2013 | || scrollbar_above_slider (ev.y) |
2032 | || scrollbar_above_slider (ev.y) |
2014 | || scrollbar_below_slider (ev.y)) |
2033 | || scrollbar_below_slider (ev.y)) |
2015 | scr_move_to (scrollbar_position (ev.y) - csrO, scrollbar_size ()); |
2034 | scr_move_to (scrollbar_position (ev.y) - csrO, scrollBar.size ()); |
2016 | |
2035 | |
2017 | scrollBar.state = STATE_MOTION; |
2036 | scrollBar.state = STATE_MOTION; |
2018 | break; |
2037 | break; |
2019 | |
2038 | |
2020 | case Button1: |
2039 | case Button1: |
… | |
… | |
2043 | else |
2062 | else |
2044 | { |
2063 | { |
2045 | scr_page ((ev.button == Button1 ? DN : UP), |
2064 | scr_page ((ev.button == Button1 ? DN : UP), |
2046 | (nrow |
2065 | (nrow |
2047 | * scrollbar_position (ev.y) |
2066 | * scrollbar_position (ev.y) |
2048 | / scrollbar_size ())); |
2067 | / scrollBar.size ())); |
2049 | } |
2068 | } |
2050 | |
2069 | |
2051 | break; |
2070 | break; |
2052 | } |
2071 | } |
2053 | } |
2072 | } |
… | |
… | |
2066 | reportmode = !! (priv_modes & PrivMode_mouse_report); |
2085 | reportmode = !! (priv_modes & PrivMode_mouse_report); |
2067 | |
2086 | |
2068 | if (scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN) |
2087 | if (scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN) |
2069 | { |
2088 | { |
2070 | scrollBar.state = STATE_IDLE; |
2089 | scrollBar.state = STATE_IDLE; |
2071 | scrollbar_show (0); |
2090 | scrollBar.show (0); |
2072 | } |
2091 | } |
2073 | |
2092 | |
2074 | #ifdef SELECTION_SCROLLING |
2093 | #ifdef SELECTION_SCROLLING |
2075 | sel_scroll_ev.stop(); |
2094 | sel_scroll_ev.stop(); |
2076 | #endif |
2095 | #endif |
… | |
… | |
2159 | } |
2178 | } |
2160 | else |
2179 | else |
2161 | # endif |
2180 | # endif |
2162 | { |
2181 | { |
2163 | scr_page (v, i); |
2182 | scr_page (v, i); |
2164 | scrollbar_show (1); |
2183 | scrollBar.show (1); |
2165 | } |
2184 | } |
2166 | } |
2185 | } |
2167 | break; |
2186 | break; |
2168 | #endif |
2187 | #endif |
2169 | } |
2188 | } |
2170 | } |
2189 | } |
2171 | } |
2190 | } |
2172 | |
2191 | |
2173 | /*}}} */ |
2192 | /*}}} */ |
2174 | |
2193 | |
2175 | bool |
2194 | void |
2176 | rxvt_term::cmd_parse () |
2195 | rxvt_term::cmd_parse () |
2177 | { |
2196 | { |
2178 | bool flag = false; |
|
|
2179 | wchar_t ch = NOCHAR; |
2197 | wchar_t ch = NOCHAR; |
2180 | char *seq_begin; // remember start of esc-sequence here |
2198 | char *seq_begin; // remember start of esc-sequence here |
2181 | |
2199 | |
2182 | for (;;) |
2200 | for (;;) |
2183 | { |
2201 | { |
2184 | if (ch == NOCHAR) |
2202 | if (expect_false (ch == NOCHAR)) |
2185 | { |
2203 | { |
2186 | seq_begin = cmdbuf_ptr; |
2204 | seq_begin = cmdbuf_ptr; |
2187 | ch = next_char (); |
2205 | ch = next_char (); |
2188 | |
2206 | |
2189 | if (ch == NOCHAR) |
2207 | if (ch == NOCHAR) |
2190 | break; |
2208 | break; |
2191 | } |
2209 | } |
2192 | |
2210 | |
2193 | if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT) |
2211 | if (expect_true (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT)) |
2194 | { |
2212 | { |
2195 | if (!seen_input) |
2213 | if (expect_false (!seen_input)) |
2196 | { |
2214 | { |
2197 | seen_input = 1; |
2215 | seen_input = 1; |
2198 | // many badly-written programs (e.g. jed) contain a race condition: |
2216 | // many badly-written programs (e.g. jed) contain a race condition: |
2199 | // they first read the screensize and then install a SIGWINCH handler. |
2217 | // they first read the screensize and then install a SIGWINCH handler. |
2200 | // some window managers resize the window early, and these programs |
2218 | // some window managers resize the window early, and these programs |
… | |
… | |
2213 | wchar_t *str = buf; |
2231 | wchar_t *str = buf; |
2214 | wchar_t *eol = str + min (ncol, UBUFSIZ); |
2232 | wchar_t *eol = str + min (ncol, UBUFSIZ); |
2215 | |
2233 | |
2216 | for (;;) |
2234 | for (;;) |
2217 | { |
2235 | { |
2218 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2236 | if (expect_false (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT))) |
2219 | break; |
2237 | break; |
2220 | |
2238 | |
2221 | *str++ = ch; |
2239 | *str++ = ch; |
2222 | |
2240 | |
2223 | if (ch == C0_LF || str >= eol) |
2241 | if (expect_false (ch == C0_LF || str >= eol)) |
2224 | { |
2242 | { |
2225 | if (ch == C0_LF) |
2243 | if (ch == C0_LF) |
2226 | nlines++; |
2244 | nlines++; |
2227 | |
2245 | |
2228 | refresh_count++; |
2246 | refresh_count++; |
… | |
… | |
2277 | * What the heck we'll cheat and only refresh less than every page-full. |
2295 | * What the heck we'll cheat and only refresh less than every page-full. |
2278 | * if skipScroll is enabled. |
2296 | * if skipScroll is enabled. |
2279 | */ |
2297 | */ |
2280 | if (refreshnow) |
2298 | if (refreshnow) |
2281 | { |
2299 | { |
2282 | flag = true; |
|
|
2283 | scr_refresh (); |
2300 | scr_refresh (); |
2284 | want_refresh = 1; |
2301 | want_refresh = 1; |
2285 | } |
2302 | } |
2286 | |
|
|
2287 | } |
2303 | } |
2288 | else |
2304 | else |
2289 | { |
2305 | { |
2290 | try |
2306 | try |
2291 | { |
2307 | { |
… | |
… | |
2299 | } |
2315 | } |
2300 | |
2316 | |
2301 | ch = NOCHAR; |
2317 | ch = NOCHAR; |
2302 | } |
2318 | } |
2303 | } |
2319 | } |
2304 | |
|
|
2305 | return flag; |
|
|
2306 | } |
2320 | } |
2307 | |
2321 | |
2308 | // read the next character |
2322 | // read the next character |
2309 | wchar_t |
2323 | wchar_t |
2310 | rxvt_term::next_char () NOTHROW |
2324 | rxvt_term::next_char () NOTHROW |
2311 | { |
2325 | { |
2312 | while (cmdbuf_ptr < cmdbuf_endp) |
2326 | while (cmdbuf_ptr < cmdbuf_endp) |
2313 | { |
2327 | { |
2314 | // assume 7-bit to be ascii ALWAYS |
2328 | // assume 7-bit to be ascii ALWAYS |
2315 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2329 | if (expect_true ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b)) |
2316 | return *cmdbuf_ptr++; |
2330 | return *cmdbuf_ptr++; |
2317 | |
2331 | |
2318 | wchar_t wc; |
2332 | wchar_t wc; |
2319 | size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); |
2333 | size_t len = mbrtowc (&wc, cmdbuf_ptr, cmdbuf_endp - cmdbuf_ptr, mbstate); |
2320 | |
2334 | |
… | |
… | |
2324 | cmdbuf_ptr = cmdbuf_endp; |
2338 | cmdbuf_ptr = cmdbuf_endp; |
2325 | break; |
2339 | break; |
2326 | } |
2340 | } |
2327 | |
2341 | |
2328 | if (len == (size_t)-1) |
2342 | if (len == (size_t)-1) |
|
|
2343 | { |
|
|
2344 | mbstate.reset (); // reset now undefined conversion state |
2329 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2345 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
|
|
2346 | } |
2330 | |
2347 | |
2331 | // assume wchar == unicode |
2348 | // assume wchar == unicode |
2332 | cmdbuf_ptr += len; |
2349 | cmdbuf_ptr += len; |
2333 | return wc & UNICODE_MASK; |
2350 | return wc & UNICODE_MASK; |
2334 | } |
2351 | } |
… | |
… | |
2378 | /*----------------------------------------------------------------------*/ |
2395 | /*----------------------------------------------------------------------*/ |
2379 | #ifdef PRINTPIPE |
2396 | #ifdef PRINTPIPE |
2380 | FILE * |
2397 | FILE * |
2381 | rxvt_term::popen_printer () |
2398 | rxvt_term::popen_printer () |
2382 | { |
2399 | { |
2383 | FILE *stream = popen (rs[Rs_print_pipe], "w"); |
2400 | FILE *stream = popen (rs[Rs_print_pipe] ? rs[Rs_print_pipe] : PRINTPIPE, "w"); |
2384 | |
2401 | |
2385 | if (stream == NULL) |
2402 | if (stream == NULL) |
2386 | rxvt_warn ("can't open printer pipe, not printing.\n"); |
2403 | rxvt_warn ("can't open printer pipe, not printing.\n"); |
2387 | |
2404 | |
2388 | return stream; |
2405 | return stream; |
… | |
… | |
2399 | * simulate attached vt100 printer |
2416 | * simulate attached vt100 printer |
2400 | */ |
2417 | */ |
2401 | void |
2418 | void |
2402 | rxvt_term::process_print_pipe () |
2419 | rxvt_term::process_print_pipe () |
2403 | { |
2420 | { |
2404 | int done; |
2421 | FILE *fd = popen_printer (); |
2405 | FILE *fd; |
|
|
2406 | |
2422 | |
2407 | if ((fd = popen_printer ()) == NULL) |
2423 | if (!fd) |
2408 | return; |
2424 | return; |
2409 | |
2425 | |
2410 | /* |
2426 | /* |
2411 | * Send all input to the printer until either ESC[4i or ESC[?4i |
2427 | * Send all input to the printer until either ESC[4i or ESC[?4i |
2412 | * is received. |
2428 | * is received. |
2413 | */ |
2429 | */ |
2414 | for (done = 0; !done;) |
2430 | for (int done = 0; !done; ) |
2415 | { |
2431 | { |
2416 | unsigned char buf[8]; |
2432 | unsigned char buf[8]; |
2417 | unicode_t ch; |
2433 | unicode_t ch; |
2418 | unsigned int i, len; |
2434 | unsigned int i, len; |
2419 | |
2435 | |
… | |
… | |
2564 | break; |
2580 | break; |
2565 | case 'Z': /* identify the terminal type */ |
2581 | case 'Z': /* identify the terminal type */ |
2566 | tt_printf ("\033/Z"); /* I am a VT100 emulating a VT52 */ |
2582 | tt_printf ("\033/Z"); /* I am a VT100 emulating a VT52 */ |
2567 | break; |
2583 | break; |
2568 | case '<': /* turn off VT52 mode */ |
2584 | case '<': /* turn off VT52 mode */ |
2569 | PrivMode (0, PrivMode_vt52); |
2585 | set_privmode (PrivMode_vt52, 0); |
2570 | break; |
2586 | break; |
2571 | case 'F': /* use special graphics character set */ |
2587 | case 'F': /* use special graphics character set */ |
2572 | case 'G': /* use regular character set */ |
2588 | case 'G': /* use regular character set */ |
2573 | /* unimplemented */ |
2589 | /* unimplemented */ |
2574 | break; |
2590 | break; |
… | |
… | |
2628 | scr_forwardindex (); |
2644 | scr_forwardindex (); |
2629 | break; |
2645 | break; |
2630 | #endif |
2646 | #endif |
2631 | case '=': |
2647 | case '=': |
2632 | case '>': |
2648 | case '>': |
2633 | PrivMode ((ch == '='), PrivMode_aplKP); |
2649 | set_privmode (PrivMode_aplKP, ch == '='); |
2634 | break; |
2650 | break; |
2635 | |
2651 | |
2636 | case C1_40: |
2652 | case C1_40: |
2637 | cmd_getc (); |
2653 | cmd_getc (); |
2638 | break; |
2654 | break; |
… | |
… | |
2677 | /* 8.3.110: SINGLE CHARACTER INTRODUCER */ |
2693 | /* 8.3.110: SINGLE CHARACTER INTRODUCER */ |
2678 | case C1_SCI: /* ESC Z */ |
2694 | case C1_SCI: /* ESC Z */ |
2679 | tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1); |
2695 | tt_write (ESCZ_ANSWER, sizeof (ESCZ_ANSWER) - 1); |
2680 | break; /* steal obsolete ESC [ c */ |
2696 | break; /* steal obsolete ESC [ c */ |
2681 | |
2697 | |
2682 | /* 8.3.16: CONTROL SEQUENCE INTRODUCER */ |
2698 | /* 8.3.16: CONTROL SEQUENCE INTRODUCER (CSI) */ |
2683 | case C1_CSI: /* ESC [ */ |
2699 | case C1_CSI: /* ESC [ */ |
2684 | process_csi_seq (); |
2700 | process_csi_seq (); |
2685 | break; |
2701 | break; |
2686 | |
2702 | |
2687 | /* 8.3.90: OPERATING SYSTEM COMMAND */ |
2703 | /* 8.3.90: OPERATING SYSTEM COMMAND (OSC) */ |
2688 | case C1_OSC: /* ESC ] */ |
2704 | case C1_OSC: /* ESC ] */ |
2689 | process_osc_seq (); |
2705 | process_osc_seq (); |
2690 | break; |
2706 | break; |
2691 | |
2707 | |
2692 | /* 8.3.106: RESET TO INITIAL STATE */ |
2708 | /* 8.3.106: RESET TO INITIAL STATE (RIS) */ |
2693 | case 'c': |
2709 | case 'c': |
2694 | mbstate.reset (); |
2710 | mbstate.reset (); |
2695 | scr_poweron (); |
2711 | scr_poweron (); |
2696 | scrollbar_show (1); |
2712 | scrollBar.show (1); |
2697 | break; |
2713 | break; |
2698 | |
2714 | |
2699 | /* 8.3.79: LOCKING-SHIFT TWO (see ISO2022) */ |
2715 | /* 8.3.79: LOCKING-SHIFT TWO (see ISO2022) */ |
2700 | case 'n': |
2716 | case 'n': |
2701 | scr_charset_choose (2); |
2717 | scr_charset_choose (2); |
… | |
… | |
2752 | |
2768 | |
2753 | nargs = 0; |
2769 | nargs = 0; |
2754 | |
2770 | |
2755 | priv = 0; |
2771 | priv = 0; |
2756 | ch = cmd_getc (); |
2772 | ch = cmd_getc (); |
2757 | if (ch >= '<' && ch <= '?') |
2773 | if ((ch >= '<' && ch <= '?') || ch == '!') |
2758 | { |
2774 | { |
2759 | /* '<' '=' '>' '?' */ |
2775 | /* '<' '=' '>' '?' '!' */ |
2760 | priv = ch; |
2776 | priv = ch; |
2761 | ch = cmd_getc (); |
2777 | ch = cmd_getc (); |
2762 | } |
2778 | } |
2763 | |
2779 | |
2764 | /* read any numerical arguments */ |
2780 | /* read any numerical arguments */ |
… | |
… | |
2818 | |
2834 | |
2819 | case '?': |
2835 | case '?': |
2820 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
2836 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
2821 | process_terminal_mode (ch, priv, nargs, arg); |
2837 | process_terminal_mode (ch, priv, nargs, arg); |
2822 | break; |
2838 | break; |
|
|
2839 | |
|
|
2840 | case '!': |
|
|
2841 | if (ch == CSI_70) |
|
|
2842 | { |
|
|
2843 | /* DECSTR: soft terminal reset, used by our terminfo since 9.06 */ |
|
|
2844 | scr_soft_reset (); |
|
|
2845 | |
|
|
2846 | static const int pm_h[] = { 7, 25 }; |
|
|
2847 | static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1049 }; |
|
|
2848 | |
|
|
2849 | process_terminal_mode ('h', 0, sizeof (pm_h) / sizeof (pm_h[0]), pm_h); |
|
|
2850 | process_terminal_mode ('l', 0, sizeof (pm_l) / sizeof (pm_l[0]), pm_l); |
2823 | } |
2851 | } |
|
|
2852 | break; |
|
|
2853 | } |
|
|
2854 | |
2824 | return; |
2855 | return; |
2825 | } |
2856 | } |
2826 | |
2857 | |
2827 | switch (ch) |
2858 | switch (ch) |
2828 | { |
2859 | { |
… | |
… | |
3257 | |
3288 | |
3258 | /* |
3289 | /* |
3259 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3290 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3260 | */ |
3291 | */ |
3261 | void |
3292 | void |
3262 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3293 | rxvt_term::process_xterm_seq (int op, char *str, char resp) |
3263 | { |
3294 | { |
3264 | int color; |
3295 | int color; |
3265 | char *buf, *name; |
3296 | char *buf, *name; |
3266 | bool query = str[0] == '?' && !str[1]; |
3297 | bool query = str[0] == '?' && !str[1]; |
3267 | int saveop = op; |
3298 | int saveop = op; |
… | |
… | |
3308 | |
3339 | |
3309 | XFree (value); |
3340 | XFree (value); |
3310 | } |
3341 | } |
3311 | else |
3342 | else |
3312 | { |
3343 | { |
3313 | char *eq = strchr (str, '='); // constness lost, but verified to be ok |
3344 | char *eq = strchr (str, '='); |
3314 | |
3345 | |
3315 | if (eq) |
3346 | if (eq) |
3316 | { |
3347 | { |
3317 | *eq = 0; |
3348 | *eq = 0; |
3318 | set_utf8_property (display->atom (str), eq + 1); |
3349 | set_utf8_property (display->atom (str), eq + 1); |
… | |
… | |
3374 | break; |
3405 | break; |
3375 | case URxvt_Color_IT: |
3406 | case URxvt_Color_IT: |
3376 | process_color_seq (op, Color_IT, str, resp); |
3407 | process_color_seq (op, Color_IT, str, resp); |
3377 | break; |
3408 | break; |
3378 | #endif |
3409 | #endif |
|
|
3410 | case URxvt_Color_border: |
|
|
3411 | process_color_seq (op, Color_border, str, resp); |
|
|
3412 | break; |
3379 | #if ENABLE_TRANSPARENCY |
3413 | #if ENABLE_TRANSPARENCY |
3380 | case URxvt_Color_tint: |
3414 | case URxvt_Color_tint: |
3381 | process_color_seq (op, Color_tint, str, resp); |
3415 | process_color_seq (op, Color_tint, str, resp); |
3382 | { |
3416 | { |
3383 | bool changed = false; |
3417 | bool changed = false; |
… | |
… | |
3398 | case Rxvt_Pixmap: |
3432 | case Rxvt_Pixmap: |
3399 | if (!strcmp (str, "?")) |
3433 | if (!strcmp (str, "?")) |
3400 | { |
3434 | { |
3401 | char str[256]; |
3435 | char str[256]; |
3402 | |
3436 | |
3403 | sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ |
3437 | sprintf (str, "[%dx%d+%d+%d]", |
3404 | min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767), |
3438 | min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767), |
3405 | min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767)); |
3439 | min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767)); |
3406 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
3440 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
3407 | } |
3441 | } |
3408 | else |
3442 | else |
… | |
… | |
3507 | break; |
3541 | break; |
3508 | #endif |
3542 | #endif |
3509 | |
3543 | |
3510 | #if ENABLE_PERL |
3544 | #if ENABLE_PERL |
3511 | case URxvt_perl: |
3545 | case URxvt_perl: |
3512 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ_PERL, DT_STR, str, DT_END))) |
3546 | HOOK_INVOKE ((this, HOOK_OSC_SEQ_PERL, DT_STR, str, DT_STR_LEN, &resp, 1, DT_END)); |
3513 | ; // no responses yet |
|
|
3514 | break; |
3547 | break; |
3515 | #endif |
3548 | #endif |
3516 | } |
3549 | } |
3517 | } |
3550 | } |
3518 | /*----------------------------------------------------------------------*/ |
3551 | /*----------------------------------------------------------------------*/ |
… | |
… | |
3541 | { |
3574 | { |
3542 | if (mode == 'r') |
3575 | if (mode == 'r') |
3543 | state = (SavedModes & bit) ? 1 : 0; /* no overlapping */ |
3576 | state = (SavedModes & bit) ? 1 : 0; /* no overlapping */ |
3544 | else |
3577 | else |
3545 | state = (mode == 't') ? ! (priv_modes & bit) : mode; |
3578 | state = (mode == 't') ? ! (priv_modes & bit) : mode; |
3546 | PrivMode (state, bit); |
3579 | set_privmode (bit, state); |
3547 | } |
3580 | } |
3548 | |
3581 | |
3549 | return state; |
3582 | return state; |
3550 | } |
3583 | } |
3551 | |
3584 | |
… | |
… | |
3559 | static const struct |
3592 | static const struct |
3560 | { |
3593 | { |
3561 | const int argval; |
3594 | const int argval; |
3562 | const unsigned long bit; |
3595 | const unsigned long bit; |
3563 | } argtopriv[] = { |
3596 | } argtopriv[] = { |
3564 | { 1, PrivMode_aplCUR }, |
3597 | { 1, PrivMode_aplCUR }, // DECCKM |
3565 | { 2, PrivMode_vt52 }, |
3598 | { 2, PrivMode_vt52 }, |
3566 | { 3, PrivMode_132 }, |
3599 | { 3, PrivMode_132 }, // DECCOLM |
3567 | { 4, PrivMode_smoothScroll }, |
3600 | { 4, PrivMode_smoothScroll }, // DECSCLM |
3568 | { 5, PrivMode_rVideo }, |
3601 | { 5, PrivMode_rVideo }, // DECSCNM |
3569 | { 6, PrivMode_relOrigin }, |
3602 | { 6, PrivMode_relOrigin }, // DECOM |
3570 | { 7, PrivMode_Autowrap }, |
3603 | { 7, PrivMode_Autowrap }, // DECAWM |
3571 | // 8, bi-directional support mode |
3604 | // 8, auto-repeat keys // DECARM |
3572 | { 9, PrivMode_MouseX10 }, |
3605 | { 9, PrivMode_MouseX10 }, |
3573 | // 18, 19 printing-related |
3606 | // 18 end FF to printer after print screen |
|
|
3607 | // 19 Print screen prints full screen/scorll region |
3574 | { 25, PrivMode_VisibleCursor }, |
3608 | { 25, PrivMode_VisibleCursor }, // cnorm/cvvis/civis |
3575 | #ifdef scrollBar_esc |
3609 | #ifdef scrollBar_esc |
3576 | { scrollBar_esc, PrivMode_scrollBar }, |
3610 | { scrollBar_esc, PrivMode_scrollBar }, |
3577 | #endif |
3611 | #endif |
3578 | { 35, PrivMode_ShiftKeys }, // rxvt extension |
3612 | { 35, PrivMode_ShiftKeys }, // rxvt extension |
|
|
3613 | // 38, tektronix mode // DECTEK |
3579 | { 40, PrivMode_132OK }, |
3614 | { 40, PrivMode_132OK }, |
3580 | // 41 xterm more fixes NYI |
3615 | // 41 xterm more fixes NYI |
3581 | // 45 margin bell NYI |
3616 | // 45 margin bell NYI |
3582 | // 46 start logging |
3617 | // 46 start logging |
3583 | { 47, PrivMode_Screen }, |
3618 | { 47, PrivMode_Screen }, |
3584 | { 66, PrivMode_aplKP }, |
3619 | { 66, PrivMode_aplKP }, // DECPAM/DECPNM |
3585 | #ifndef NO_BACKSPACE_KEY |
3620 | #ifndef NO_BACKSPACE_KEY |
3586 | { 67, PrivMode_BackSpace }, |
3621 | { 67, PrivMode_BackSpace }, // DECBKM |
3587 | #endif |
3622 | #endif |
3588 | { 1000, PrivMode_MouseX11 }, |
3623 | { 1000, PrivMode_MouseX11 }, |
3589 | { 1002, PrivMode_MouseBtnEvent }, |
3624 | { 1002, PrivMode_MouseBtnEvent }, |
3590 | { 1003, PrivMode_MouseAnyEvent }, |
3625 | { 1003, PrivMode_MouseAnyEvent }, |
3591 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3626 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
… | |
… | |
3630 | |
3665 | |
3631 | scr_touch (true); |
3666 | scr_touch (true); |
3632 | break; |
3667 | break; |
3633 | #endif |
3668 | #endif |
3634 | case 1048: /* alternative cursor save */ |
3669 | case 1048: /* alternative cursor save */ |
3635 | case 1049: |
|
|
3636 | if (option (Opt_secondaryScreen)) |
3670 | if (option (Opt_secondaryScreen)) |
3637 | if (mode == 0) |
3671 | if (mode == 0) |
3638 | scr_cursor (RESTORE); |
3672 | scr_cursor (RESTORE); |
3639 | else if (mode == 1) |
3673 | else if (mode == 1) |
3640 | scr_cursor (SAVE); |
3674 | scr_cursor (SAVE); |
… | |
… | |
3649 | case 2: /* VT52 mode */ |
3683 | case 2: /* VT52 mode */ |
3650 | /* oddball mode. should be set regardless of set/reset |
3684 | /* oddball mode. should be set regardless of set/reset |
3651 | * parameter. Return from VT52 mode with an ESC < from |
3685 | * parameter. Return from VT52 mode with an ESC < from |
3652 | * within VT52 mode |
3686 | * within VT52 mode |
3653 | */ |
3687 | */ |
3654 | PrivMode (1, PrivMode_vt52); |
3688 | set_privmode (PrivMode_vt52, 1); |
3655 | break; |
3689 | break; |
3656 | case 3: /* 80/132 */ |
3690 | case 3: /* 80/132 */ |
3657 | if (priv_modes & PrivMode_132OK) |
3691 | if (priv_modes & PrivMode_132OK) |
3658 | { |
|
|
3659 | scr_poweron (); |
|
|
3660 | set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight); |
3692 | set_widthheight ((state ? 132 : 80) * fwidth, 24 * fheight); |
3661 | } |
|
|
3662 | break; |
3693 | break; |
3663 | case 4: /* smooth scrolling */ |
3694 | case 4: /* smooth scrolling */ |
3664 | set_option (Opt_jumpScroll, !state); |
3695 | set_option (Opt_jumpScroll, !state); |
3665 | break; |
3696 | break; |
3666 | case 5: /* reverse video */ |
3697 | case 5: /* reverse video */ |
… | |
… | |
3677 | if (state) /* orthogonal */ |
3708 | if (state) /* orthogonal */ |
3678 | priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
3709 | priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
3679 | break; |
3710 | break; |
3680 | #ifdef scrollBar_esc |
3711 | #ifdef scrollBar_esc |
3681 | case scrollBar_esc: |
3712 | case scrollBar_esc: |
3682 | if (scrollbar_mapping (state)) |
3713 | if (scrollBar.map (state)) |
3683 | { |
3714 | { |
3684 | resize_all_windows (0, 0, 0); |
3715 | resize_all_windows (0, 0, 0); |
3685 | scr_touch (true); |
3716 | scr_touch (true); |
3686 | } |
3717 | } |
3687 | break; |
3718 | break; |
… | |
… | |
3708 | priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; |
3739 | priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; |
3709 | vt_emask_mouse = PointerMotionMask; |
3740 | vt_emask_mouse = PointerMotionMask; |
3710 | } |
3741 | } |
3711 | else |
3742 | else |
3712 | vt_emask_mouse = NoEventMask; |
3743 | vt_emask_mouse = NoEventMask; |
|
|
3744 | |
3713 | vt_select_input (); |
3745 | vt_select_input (); |
3714 | break; |
3746 | break; |
3715 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3747 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3716 | set_option (Opt_scrollTtyOutput, !state); |
3748 | set_option (Opt_scrollTtyOutput, !state); |
3717 | break; |
3749 | break; |
3718 | case 1011: /* scroll to bottom on key press */ |
3750 | case 1011: /* scroll to bottom on key press */ |
3719 | set_option (Opt_scrollTtyKeypress, state); |
3751 | set_option (Opt_scrollTtyKeypress, state); |
3720 | break; |
3752 | break; |
3721 | case 1047: /* secondary screen w/ clearing last */ |
3753 | case 1047: /* secondary screen w/ clearing last */ |
3722 | if (option (Opt_secondaryScreen)) |
3754 | if (option (Opt_secondaryScreen)) |
3723 | if (current_screen != PRIMARY) |
3755 | if (!state) |
3724 | scr_erase_screen (2); |
3756 | scr_erase_screen (2); |
|
|
3757 | |
3725 | scr_change_screen (state); |
3758 | scr_change_screen (state); |
3726 | break; |
3759 | break; |
3727 | case 1049: /* secondary screen w/ clearing first */ |
3760 | case 1049: /* secondary screen w/ clearing first */ |
|
|
3761 | if (option (Opt_secondaryScreen)) |
|
|
3762 | if (state) |
|
|
3763 | scr_cursor (SAVE); |
|
|
3764 | |
3728 | scr_change_screen (state); |
3765 | scr_change_screen (state); |
|
|
3766 | |
3729 | if (option (Opt_secondaryScreen)) |
3767 | if (option (Opt_secondaryScreen)) |
3730 | if (current_screen != PRIMARY) |
3768 | if (state) |
3731 | scr_erase_screen (2); |
3769 | scr_erase_screen (2); |
|
|
3770 | else |
|
|
3771 | scr_cursor (RESTORE); |
3732 | break; |
3772 | break; |
3733 | default: |
3773 | default: |
3734 | break; |
3774 | break; |
3735 | } |
3775 | } |
3736 | } |
3776 | } |