… | |
… | |
95 | XK_Shift_L, 0x21e7, |
95 | XK_Shift_L, 0x21e7, |
96 | XK_Shift_R, 0x21e7, |
96 | XK_Shift_R, 0x21e7, |
97 | |
97 | |
98 | XK_Shift_Lock, 0x21eb, |
98 | XK_Shift_Lock, 0x21eb, |
99 | XK_ISO_Lock, 0x21eb, |
99 | XK_ISO_Lock, 0x21eb, |
100 | XK_ISO_Lock, 0x21eb, |
|
|
101 | XK_Caps_Lock, 0x21ec, |
100 | XK_Caps_Lock, 0x21ec, |
102 | XK_Num_Lock, 0x21ed, |
101 | XK_Num_Lock, 0x21ed, |
103 | XK_ISO_Level3_Shift, 0x21ee, |
102 | XK_ISO_Level3_Shift, 0x21ee, |
104 | XK_ISO_Level3_Lock, 0x21ef, |
103 | XK_ISO_Level3_Lock, 0x21ef, |
105 | XK_ISO_Group_Lock, 0x21f0, |
104 | XK_ISO_Group_Lock, 0x21f0, |
… | |
… | |
500 | # if ISO_14755 |
499 | # if ISO_14755 |
501 | iso14755_51 (0); |
500 | iso14755_51 (0); |
502 | # endif |
501 | # endif |
503 | return; |
502 | return; |
504 | } |
503 | } |
|
|
504 | else if (keysym == XK_BackSpace) |
|
|
505 | { |
|
|
506 | iso14755buf = ((iso14755buf & ISO_14755_MASK) >> 4) | ISO_14755_51; |
|
|
507 | # if ISO_14755 |
|
|
508 | iso14755_51 (iso14755buf & ISO_14755_MASK); |
|
|
509 | # endif |
|
|
510 | return; |
|
|
511 | } |
505 | else if ((hv = hex_keyval (ev)) >= 0) |
512 | else if ((hv = hex_keyval (ev)) >= 0) |
506 | { |
513 | { |
507 | iso14755buf = ((iso14755buf << 4) & ISO_14755_MASK) |
514 | iso14755buf = ((iso14755buf << 4) & ISO_14755_MASK) |
508 | | hv | ISO_14755_51; |
515 | | hv | ISO_14755_51; |
509 | # if ISO_14755 |
516 | # if ISO_14755 |
… | |
… | |
511 | # endif |
518 | # endif |
512 | return; |
519 | return; |
513 | } |
520 | } |
514 | else |
521 | else |
515 | { |
522 | { |
516 | # if ENABLE_OVERLAY |
523 | # if ISO_14755 |
517 | scr_overlay_off (); |
524 | scr_overlay_off (); |
518 | # endif |
525 | # endif |
519 | iso14755buf = 0; |
526 | iso14755buf = 0; |
520 | } |
527 | } |
521 | } |
528 | } |
522 | else if ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R)) |
529 | else if ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R)) |
523 | || (shft && (keysym == XK_Control_L || keysym == XK_Control_R))) |
530 | || (shft && (keysym == XK_Control_L || keysym == XK_Control_R))) |
524 | if (!(iso14755buf & ISO_14755_STARTED)) |
531 | if (!(iso14755buf & ISO_14755_STARTED)) |
525 | { |
532 | { |
526 | iso14755buf |= ISO_14755_STARTED; |
533 | iso14755buf |= ISO_14755_STARTED; |
527 | # if ENABLE_OVERLAY |
534 | # if ISO_14755 |
528 | scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); |
535 | scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); |
529 | scr_overlay_set (0, 0, "ISO 14755 mode"); |
536 | scr_overlay_set (0, 0, "ISO 14755 mode"); |
530 | # endif |
537 | # endif |
531 | } |
538 | } |
532 | #endif |
539 | #endif |
533 | |
540 | |
534 | #ifdef PRINTPIPE |
541 | #ifdef PRINTPIPE |
535 | if (keysym == XK_Print) |
542 | if (keysym == XK_Print) |
536 | { |
543 | { |
537 | scr_printscreen (ctrl | shft); |
544 | scr_printscreen (ctrl | shft); |
538 | return; |
545 | return; |
… | |
… | |
540 | #endif |
547 | #endif |
541 | |
548 | |
542 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
549 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
543 | { |
550 | { |
544 | { |
551 | { |
|
|
552 | bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; |
545 | newlen = 1; |
553 | newlen = 1; |
|
|
554 | #ifdef XK_KP_Home |
|
|
555 | static const KeySym keypadtrans[] = { |
|
|
556 | XK_KP_7, // XK_KP_Home |
|
|
557 | XK_KP_4, // XK_KP_Left |
|
|
558 | XK_KP_8, // XK_KP_Up |
|
|
559 | XK_KP_6, // XK_KP_Right |
|
|
560 | XK_KP_2, // XK_KP_Down |
|
|
561 | #ifndef UNSHIFTED_SCROLLKEYS |
|
|
562 | XK_KP_9, // XK_KP_Prior |
|
|
563 | XK_KP_3, // XK_KP_Next |
|
|
564 | #else |
|
|
565 | XK_Prior, |
|
|
566 | XK_Next, |
|
|
567 | #endif |
|
|
568 | XK_KP_1, // XK_KP_End |
|
|
569 | XK_KP_5, // XK_KP_Begin |
|
|
570 | }; |
|
|
571 | |
|
|
572 | if (IN_RANGE_INC (keysym, XK_KP_Home, XK_KP_Begin)) |
|
|
573 | { |
|
|
574 | unsigned int index = keysym - XK_KP_Home; |
|
|
575 | keysym = kp ? keypadtrans[index] : XK_Home + index; |
|
|
576 | } |
|
|
577 | else if (keysym == XK_KP_Insert) |
|
|
578 | keysym = kp ? XK_KP_0 : XK_Insert; |
|
|
579 | #ifndef NO_DELETE_KEY |
|
|
580 | else if (keysym == XK_KP_Delete) |
|
|
581 | keysym = kp ? XK_KP_Decimal : XK_Delete; |
|
|
582 | #endif |
|
|
583 | #endif |
546 | switch (keysym) |
584 | switch (keysym) |
547 | { |
585 | { |
548 | #ifndef NO_BACKSPACE_KEY |
586 | #ifndef NO_BACKSPACE_KEY |
549 | case XK_BackSpace: |
587 | case XK_BackSpace: |
550 | if (priv_modes & PrivMode_HaveBackSpace) |
588 | if (priv_modes & PrivMode_HaveBackSpace) |
… | |
… | |
552 | kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) |
590 | kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) |
553 | ^ !!ctrl) ? '\b' : '\177'; |
591 | ^ !!ctrl) ? '\b' : '\177'; |
554 | kbuf[1] = '\0'; |
592 | kbuf[1] = '\0'; |
555 | } |
593 | } |
556 | else |
594 | else |
557 | strcpy (kbuf, key_backspace); |
595 | strcpy (kbuf, rs[Rs_backspace_key]); |
558 | break; |
596 | break; |
559 | #endif |
597 | #endif |
560 | #ifndef NO_DELETE_KEY |
598 | #ifndef NO_DELETE_KEY |
561 | # ifdef XK_KP_Prior |
|
|
562 | case XK_KP_Delete: |
|
|
563 | /* allow shift to override */ |
|
|
564 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
565 | { |
|
|
566 | strcpy (kbuf, "\033On"); |
|
|
567 | break; |
|
|
568 | } |
|
|
569 | /* FALLTHROUGH */ |
|
|
570 | # endif |
|
|
571 | case XK_Delete: |
599 | case XK_Delete: |
572 | strcpy (kbuf, key_delete); |
600 | strcpy (kbuf, rs[Rs_delete_key]); |
573 | break; |
601 | break; |
574 | #endif |
602 | #endif |
575 | case XK_Tab: |
603 | case XK_Tab: |
576 | if (shft) |
604 | if (shft) |
577 | strcpy (kbuf, "\033[Z"); |
605 | strcpy (kbuf, "\033[Z"); |
… | |
… | |
587 | #endif |
615 | #endif |
588 | newlen = 0; |
616 | newlen = 0; |
589 | } |
617 | } |
590 | break; |
618 | break; |
591 | |
619 | |
592 | #ifdef XK_KP_Left |
|
|
593 | case XK_KP_Up: /* \033Ox or standard */ |
|
|
594 | case XK_KP_Down: /* \033Or or standard */ |
|
|
595 | case XK_KP_Right: /* \033Ov or standard */ |
|
|
596 | case XK_KP_Left: /* \033Ot or standard */ |
|
|
597 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
598 | { |
|
|
599 | strcpy (kbuf, "\033OZ"); |
|
|
600 | kbuf[2] = "txvr"[keysym - XK_KP_Left]; |
|
|
601 | break; |
|
|
602 | } |
|
|
603 | else |
|
|
604 | /* translate to std. cursor key */ |
|
|
605 | keysym = XK_Left + (keysym - XK_KP_Left); |
|
|
606 | /* FALLTHROUGH */ |
|
|
607 | #endif |
|
|
608 | case XK_Up: /* "\033[A" */ |
620 | case XK_Up: /* "\033[A" */ |
609 | case XK_Down: /* "\033[B" */ |
621 | case XK_Down: /* "\033[B" */ |
610 | case XK_Right: /* "\033[C" */ |
622 | case XK_Right: /* "\033[C" */ |
611 | case XK_Left: /* "\033[D" */ |
623 | case XK_Left: /* "\033[D" */ |
612 | strcpy (kbuf, "\033[Z"); |
624 | strcpy (kbuf, "\033[Z"); |
… | |
… | |
622 | else if (priv_modes & PrivMode_aplCUR) |
634 | else if (priv_modes & PrivMode_aplCUR) |
623 | kbuf[1] = 'O'; |
635 | kbuf[1] = 'O'; |
624 | break; |
636 | break; |
625 | |
637 | |
626 | #ifndef UNSHIFTED_SCROLLKEYS |
638 | #ifndef UNSHIFTED_SCROLLKEYS |
627 | # ifdef XK_KP_Prior |
|
|
628 | case XK_KP_Prior: |
|
|
629 | /* allow shift to override */ |
|
|
630 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
631 | { |
|
|
632 | strcpy (kbuf, "\033Oy"); |
|
|
633 | break; |
|
|
634 | } |
|
|
635 | /* FALLTHROUGH */ |
|
|
636 | # endif |
|
|
637 | case XK_Prior: |
639 | case XK_Prior: |
638 | strcpy (kbuf, "\033[5~"); |
640 | strcpy (kbuf, "\033[5~"); |
639 | break; |
641 | break; |
640 | # ifdef XK_KP_Next |
|
|
641 | case XK_KP_Next: |
|
|
642 | /* allow shift to override */ |
|
|
643 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
644 | { |
|
|
645 | strcpy (kbuf, "\033Os"); |
|
|
646 | break; |
|
|
647 | } |
|
|
648 | /* FALLTHROUGH */ |
|
|
649 | # endif |
|
|
650 | case XK_Next: |
642 | case XK_Next: |
651 | strcpy (kbuf, "\033[6~"); |
643 | strcpy (kbuf, "\033[6~"); |
652 | break; |
644 | break; |
653 | #endif |
645 | #endif |
654 | case XK_KP_Enter: |
646 | case XK_KP_Enter: |
655 | /* allow shift to override */ |
647 | /* allow shift to override */ |
656 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
648 | if (kp) |
657 | { |
649 | { |
658 | strcpy (kbuf, "\033OM"); |
650 | strcpy (kbuf, "\033OM"); |
659 | break; |
651 | break; |
660 | } |
652 | } |
661 | |
653 | |
… | |
… | |
673 | kbuf[0] = '\015'; |
665 | kbuf[0] = '\015'; |
674 | kbuf[1] = '\0'; |
666 | kbuf[1] = '\0'; |
675 | } |
667 | } |
676 | break; |
668 | break; |
677 | |
669 | |
678 | #ifdef XK_KP_Begin |
|
|
679 | case XK_KP_Begin: |
|
|
680 | strcpy (kbuf, "\033Ou"); |
|
|
681 | break; |
|
|
682 | |
|
|
683 | #endif |
|
|
684 | case XK_KP_F1: /* "\033OP" */ |
670 | case XK_KP_F1: /* "\033OP" */ |
685 | case XK_KP_F2: /* "\033OQ" */ |
671 | case XK_KP_F2: /* "\033OQ" */ |
686 | case XK_KP_F3: /* "\033OR" */ |
672 | case XK_KP_F3: /* "\033OR" */ |
687 | case XK_KP_F4: /* "\033OS" */ |
673 | case XK_KP_F4: /* "\033OS" */ |
688 | strcpy (kbuf, "\033OP"); |
674 | strcpy (kbuf, "\033OP"); |
… | |
… | |
704 | case XK_KP_6: /* "\033Ov" : "6" */ |
690 | case XK_KP_6: /* "\033Ov" : "6" */ |
705 | case XK_KP_7: /* "\033Ow" : "7" */ |
691 | case XK_KP_7: /* "\033Ow" : "7" */ |
706 | case XK_KP_8: /* "\033Ox" : "8" */ |
692 | case XK_KP_8: /* "\033Ox" : "8" */ |
707 | case XK_KP_9: /* "\033Oy" : "9" */ |
693 | case XK_KP_9: /* "\033Oy" : "9" */ |
708 | /* allow shift to override */ |
694 | /* allow shift to override */ |
709 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
695 | if (kp) |
710 | { |
696 | { |
711 | strcpy (kbuf, "\033Oj"); |
697 | strcpy (kbuf, "\033Oj"); |
712 | kbuf[2] += (keysym - XK_KP_Multiply); |
698 | kbuf[2] += (keysym - XK_KP_Multiply); |
713 | } |
699 | } |
714 | else |
700 | else |
… | |
… | |
720 | |
706 | |
721 | case XK_Find: |
707 | case XK_Find: |
722 | strcpy (kbuf, "\033[1~"); |
708 | strcpy (kbuf, "\033[1~"); |
723 | break; |
709 | break; |
724 | |
710 | |
725 | #ifdef XK_KP_End |
|
|
726 | case XK_KP_Insert: |
|
|
727 | /* allow shift to override */ |
|
|
728 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
729 | { |
|
|
730 | strcpy (kbuf, "\033Op"); |
|
|
731 | break; |
|
|
732 | } |
|
|
733 | /* FALLTHROUGH */ |
|
|
734 | #endif |
|
|
735 | case XK_Insert: |
711 | case XK_Insert: |
736 | strcpy (kbuf, "\033[2~"); |
712 | strcpy (kbuf, "\033[2~"); |
737 | break; |
713 | break; |
738 | #ifdef DXK_Remove /* support for DEC remove like key */ |
714 | #ifdef DXK_Remove /* support for DEC remove like key */ |
739 | case DXK_Remove: |
715 | case DXK_Remove: |
… | |
… | |
743 | strcpy (kbuf, "\033[3~"); |
719 | strcpy (kbuf, "\033[3~"); |
744 | break; |
720 | break; |
745 | case XK_Select: |
721 | case XK_Select: |
746 | strcpy (kbuf, "\033[4~"); |
722 | strcpy (kbuf, "\033[4~"); |
747 | break; |
723 | break; |
748 | #ifdef XK_KP_End |
|
|
749 | case XK_KP_End: |
|
|
750 | /* allow shift to override */ |
|
|
751 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
752 | { |
|
|
753 | strcpy (kbuf, "\033Oq"); |
|
|
754 | break; |
|
|
755 | } |
|
|
756 | /* FALLTHROUGH */ |
|
|
757 | #endif |
|
|
758 | case XK_End: |
724 | case XK_End: |
759 | strcpy (kbuf, KS_END); |
725 | strcpy (kbuf, KS_END); |
760 | break; |
726 | break; |
761 | #ifdef XK_KP_Home |
|
|
762 | case XK_KP_Home: |
|
|
763 | /* allow shift to override */ |
|
|
764 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
765 | { |
|
|
766 | strcpy (kbuf, "\033Ow"); |
|
|
767 | break; |
|
|
768 | } |
|
|
769 | /* FALLTHROUGH */ |
|
|
770 | #endif |
|
|
771 | case XK_Home: |
727 | case XK_Home: |
772 | strcpy (kbuf, KS_HOME); |
728 | strcpy (kbuf, KS_HOME); |
773 | break; |
729 | break; |
774 | |
730 | |
775 | #define FKEY(n, fkey) \ |
731 | #define FKEY(n, fkey) \ |
… | |
… | |
877 | return; |
833 | return; |
878 | |
834 | |
879 | if (len <= 0) |
835 | if (len <= 0) |
880 | return; /* not mapped */ |
836 | return; /* not mapped */ |
881 | |
837 | |
882 | if (OPTION (Opt_scrollTtyKeypress)) |
838 | if (option (Opt_scrollTtyKeypress)) |
883 | if (view_start) |
839 | if (view_start) |
884 | { |
840 | { |
885 | view_start = 0; |
841 | view_start = 0; |
886 | want_refresh = 1; |
842 | want_refresh = 1; |
887 | } |
843 | } |
… | |
… | |
926 | #if ENABLE_FRILLS || ISO_14755 |
882 | #if ENABLE_FRILLS || ISO_14755 |
927 | // ISO 14755 support |
883 | // ISO 14755 support |
928 | if (iso14755buf) |
884 | if (iso14755buf) |
929 | if (iso14755buf & ISO_14755_52) |
885 | if (iso14755buf & ISO_14755_52) |
930 | { |
886 | { |
931 | # if ENABLE_OVERLAY |
887 | # if ISO_14755 |
932 | scr_overlay_off (); |
888 | scr_overlay_off (); |
933 | # endif |
889 | # endif |
934 | # if ISO_14755 |
890 | # if ISO_14755 |
935 | // iso14755 part 5.2 handling: release time |
891 | // iso14755 part 5.2 handling: release time |
936 | // first: controls |
892 | // first: controls |
… | |
… | |
959 | |
915 | |
960 | return; |
916 | return; |
961 | } |
917 | } |
962 | else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) |
918 | else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) |
963 | { |
919 | { |
964 | # if ENABLE_OVERLAY |
920 | # if ISO_14755 |
965 | scr_overlay_off (); |
921 | scr_overlay_off (); |
966 | # endif |
922 | # endif |
967 | if (iso14755buf & ISO_14755_51) |
923 | if (iso14755buf & ISO_14755_51) |
968 | commit_iso14755 (); |
924 | commit_iso14755 (); |
969 | #if ISO_14755 |
925 | #if ISO_14755 |
970 | else if (iso14755buf & ISO_14755_STARTED) |
926 | else if (option (Opt_iso14755_52) && iso14755buf & ISO_14755_STARTED) |
971 | { |
927 | { |
972 | iso14755buf = ISO_14755_52; // iso14755 part 5.2: remember empty begin/end pair |
928 | iso14755buf = ISO_14755_52; // iso14755 part 5.2: remember empty begin/end pair |
973 | |
929 | |
974 | scr_overlay_new (0, -1, sizeof ("KEYCAP PICTURE INSERT MODE") - 1, 1); |
930 | scr_overlay_new (0, -1, sizeof ("KEYCAP PICTURE INSERT MODE") - 1, 1); |
975 | scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE"); |
931 | scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE"); |
… | |
… | |
1027 | void |
983 | void |
1028 | rxvt_term::flush () |
984 | rxvt_term::flush () |
1029 | { |
985 | { |
1030 | flush_ev.stop (); |
986 | flush_ev.stop (); |
1031 | |
987 | |
1032 | #ifdef TRANSPARENT |
988 | #ifdef HAVE_BG_PIXMAP |
1033 | if (want_full_refresh) |
989 | if (bgPixmap.check_clearChanged ()) |
1034 | { |
990 | { |
1035 | want_full_refresh = 0; |
991 | // scr_clear (true); This needs to be researched further! |
1036 | scr_clear (); |
|
|
1037 | scr_touch (false); |
992 | scr_touch (false); |
1038 | } |
993 | } |
1039 | #endif |
994 | #endif |
1040 | |
995 | |
1041 | if (want_refresh) |
996 | if (want_refresh) |
… | |
… | |
1087 | |
1042 | |
1088 | display->flush (); |
1043 | display->flush (); |
1089 | } |
1044 | } |
1090 | |
1045 | |
1091 | void |
1046 | void |
1092 | rxvt_term::check_cb (check_watcher &w) |
1047 | rxvt_term::prepare_cb (ev::prepare &w, int revents) |
1093 | { |
1048 | { |
1094 | make_current (); |
1049 | make_current (); |
1095 | |
1050 | |
1096 | display->flush (); |
1051 | display->flush (); |
1097 | |
1052 | |
1098 | if (want_refresh && !flush_ev.active) |
1053 | if (want_refresh && !flush_ev.active) |
1099 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
1054 | flush_ev.start (1. / 60.); // refresh at max. 60 hz normally |
1100 | } |
1055 | } |
1101 | |
1056 | |
1102 | void |
1057 | void |
1103 | rxvt_term::flush_cb (time_watcher &w) |
1058 | rxvt_term::flush_cb (ev::timer &w, int revents) |
1104 | { |
1059 | { |
1105 | make_current (); |
1060 | make_current (); |
1106 | |
1061 | |
1107 | refresh_limit = 1; |
|
|
1108 | refresh_count = 0; |
1062 | refresh_count = 0; |
1109 | flush (); |
1063 | flush (); |
1110 | } |
1064 | } |
1111 | |
1065 | |
1112 | #ifdef CURSOR_BLINK |
1066 | #ifdef CURSOR_BLINK |
1113 | void |
1067 | void |
1114 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1068 | rxvt_term::cursor_blink_cb (ev::timer &w, int revents) |
1115 | { |
1069 | { |
1116 | hidden_cursor = !hidden_cursor; |
1070 | hidden_cursor = !hidden_cursor; |
1117 | want_refresh = 1; |
1071 | want_refresh = 1; |
1118 | |
|
|
1119 | w.start (w.at + CURSOR_BLINK_INTERVAL); |
|
|
1120 | } |
1072 | } |
1121 | #endif |
1073 | #endif |
1122 | |
1074 | |
1123 | #ifdef TEXT_BLINK |
1075 | #ifdef TEXT_BLINK |
1124 | void |
1076 | void |
1125 | rxvt_term::text_blink_cb (time_watcher &w) |
1077 | rxvt_term::text_blink_cb (ev::timer &w, int revents) |
1126 | { |
1078 | { |
1127 | if (scr_refresh_rend (RS_Blink, RS_Blink)) |
1079 | if (scr_refresh_rend (RS_Blink, RS_Blink)) |
1128 | { |
1080 | { |
1129 | hidden_text = !hidden_text; |
1081 | hidden_text = !hidden_text; |
1130 | want_refresh = 1; |
1082 | want_refresh = 1; |
1131 | w.start (w.at + TEXT_BLINK_INTERVAL); |
|
|
1132 | } |
1083 | } |
1133 | } |
1084 | } |
1134 | #endif |
1085 | #endif |
1135 | |
1086 | |
1136 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1087 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1137 | void |
1088 | void |
1138 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1089 | rxvt_term::cont_scroll_cb (ev::timer &w, int revents) |
1139 | { |
1090 | { |
1140 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1091 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1141 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1092 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1142 | { |
|
|
1143 | want_refresh = 1; |
1093 | want_refresh = 1; |
1144 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1094 | else |
1145 | } |
1095 | w.stop (); |
1146 | } |
1096 | } |
1147 | #endif |
1097 | #endif |
1148 | |
1098 | |
1149 | #ifdef SELECTION_SCROLLING |
1099 | #ifdef SELECTION_SCROLLING |
1150 | void |
1100 | void |
1151 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1101 | rxvt_term::sel_scroll_cb (ev::timer &w, int revents) |
1152 | { |
1102 | { |
1153 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1103 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1154 | { |
1104 | { |
1155 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1105 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1156 | want_refresh = 1; |
1106 | want_refresh = 1; |
1157 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
|
|
1158 | } |
1107 | } |
|
|
1108 | else |
|
|
1109 | w.stop (); |
1159 | } |
1110 | } |
1160 | #endif |
1111 | #endif |
1161 | |
1112 | |
1162 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1113 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1163 | void |
1114 | void |
1164 | rxvt_term::slip_wheel_cb (time_watcher &w) |
1115 | rxvt_term::slip_wheel_cb (ev::timer &w, int revents) |
1165 | { |
1116 | { |
1166 | if (mouse_slip_wheel_speed == 0 |
1117 | if (mouse_slip_wheel_speed == 0 |
1167 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
1118 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
1168 | : scr_page (UP, mouse_slip_wheel_speed)) |
1119 | : scr_page (UP, mouse_slip_wheel_speed)) |
1169 | { |
1120 | { |
1170 | if (view_start == top_row || view_start == 0) |
1121 | if (view_start == top_row || view_start == 0) |
1171 | mouse_slip_wheel_speed = 0; |
1122 | mouse_slip_wheel_speed = 0; |
1172 | |
1123 | |
1173 | want_refresh = 1; |
1124 | want_refresh = 1; |
1174 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
|
|
1175 | } |
1125 | } |
|
|
1126 | else |
|
|
1127 | w.stop (); |
1176 | } |
1128 | } |
1177 | #endif |
1129 | #endif |
1178 | |
1130 | |
1179 | #if LINUX_YIELD_HACK |
1131 | #if LINUX_YIELD_HACK |
1180 | static struct event_handler |
1132 | static struct event_handler |
1181 | { |
1133 | { |
1182 | check_watcher yield_ev; |
1134 | ev::prepare yield_ev; |
1183 | |
1135 | |
1184 | void yield_cb (check_watcher &w) |
1136 | void yield_cb (ev::prepare &w, int revents) |
1185 | { |
1137 | { |
1186 | // this should really be sched_yield(), but the linux guys thought |
1138 | // this should really be sched_yield(), but the linux guys thought |
1187 | // that giving a process calling sched_yield () less cpu time than |
1139 | // that giving a process calling sched_yield () less cpu time than |
1188 | // ones with high nice levels is a useful thing to do. It surely is is |
1140 | // ones with high nice levels is a useful thing to do. It surely is is |
1189 | // allowed by the sus... as is returning ENOSYS. |
1141 | // allowed by the sus... as is returning ENOSYS. |
… | |
… | |
1232 | } |
1184 | } |
1233 | else |
1185 | else |
1234 | { |
1186 | { |
1235 | pty_ev.stop (); |
1187 | pty_ev.stop (); |
1236 | |
1188 | |
1237 | if (!OPTION (Opt_hold)) |
1189 | if (!option (Opt_hold)) |
1238 | destroy (); |
1190 | destroy (); |
1239 | } |
1191 | } |
1240 | |
1192 | |
1241 | return false; |
1193 | return false; |
1242 | } |
1194 | } |
1243 | |
1195 | |
1244 | void |
1196 | void |
1245 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1197 | rxvt_term::pty_cb (ev::io &w, int revents) |
1246 | { |
1198 | { |
1247 | make_current (); |
1199 | make_current (); |
1248 | |
1200 | |
1249 | if (revents & EVENT_READ) |
1201 | if (revents & ev::READ) |
1250 | // loop, but don't allow a single term to monopolize us |
1202 | // loop, but don't allow a single term to monopolize us |
1251 | while (pty_fill ()) |
1203 | while (pty_fill ()) |
1252 | if (cmd_parse ()) |
1204 | if (cmd_parse ()) |
1253 | break; |
1205 | break; |
1254 | |
1206 | |
1255 | if (revents & EVENT_WRITE) |
1207 | if (revents & ev::WRITE) |
1256 | pty_write (); |
1208 | pty_write (); |
1257 | } |
1209 | } |
1258 | |
1210 | |
1259 | void |
1211 | void |
1260 | rxvt_term::pointer_unblank () |
1212 | rxvt_term::pointer_unblank () |
… | |
… | |
1263 | recolour_cursor (); |
1215 | recolour_cursor (); |
1264 | |
1216 | |
1265 | #ifdef POINTER_BLANK |
1217 | #ifdef POINTER_BLANK |
1266 | hidden_pointer = 0; |
1218 | hidden_pointer = 0; |
1267 | |
1219 | |
1268 | if (OPTION (Opt_pointerBlank)) |
1220 | if (option (Opt_pointerBlank)) |
1269 | pointer_ev.start (NOW + pointerBlankDelay); |
1221 | pointer_ev.start (pointerBlankDelay); |
1270 | #endif |
1222 | #endif |
1271 | } |
1223 | } |
1272 | |
1224 | |
1273 | #ifdef POINTER_BLANK |
1225 | #ifdef POINTER_BLANK |
1274 | void |
1226 | void |
1275 | rxvt_term::pointer_blank () |
1227 | rxvt_term::pointer_blank () |
1276 | { |
1228 | { |
1277 | if (!OPTION (Opt_pointerBlank)) |
1229 | if (!option (Opt_pointerBlank)) |
1278 | return; |
1230 | return; |
1279 | |
1231 | |
1280 | XDefineCursor (dpy, vt, display->blank_cursor); |
1232 | XDefineCursor (dpy, vt, display->blank_cursor); |
1281 | XFlush (dpy); |
1233 | XFlush (dpy); |
1282 | |
1234 | |
1283 | hidden_pointer = 1; |
1235 | hidden_pointer = 1; |
1284 | } |
1236 | } |
1285 | |
1237 | |
1286 | void |
1238 | void |
1287 | rxvt_term::pointer_cb (time_watcher &w) |
1239 | rxvt_term::pointer_cb (ev::timer &w, int revents) |
1288 | { |
1240 | { |
1289 | make_current (); |
1241 | make_current (); |
1290 | |
1242 | |
1291 | pointer_blank (); |
1243 | pointer_blank (); |
1292 | } |
1244 | } |
… | |
… | |
1295 | void |
1247 | void |
1296 | rxvt_term::mouse_report (XButtonEvent &ev) |
1248 | rxvt_term::mouse_report (XButtonEvent &ev) |
1297 | { |
1249 | { |
1298 | int button_number, key_state = 0; |
1250 | int button_number, key_state = 0; |
1299 | int x, y; |
1251 | int x, y; |
|
|
1252 | int code = 32; |
1300 | |
1253 | |
1301 | x = ev.x; |
1254 | x = Pixel2Col (ev.x); |
1302 | y = ev.y; |
1255 | y = Pixel2Row (ev.y); |
1303 | pixel_position (&x, &y); |
1256 | if (ev.type == MotionNotify) |
|
|
1257 | { |
|
|
1258 | if (x == mouse_row && y == mouse_col) |
|
|
1259 | return; |
|
|
1260 | mouse_row = x; |
|
|
1261 | mouse_col = y; |
|
|
1262 | code += 32; |
|
|
1263 | } |
1304 | |
1264 | |
1305 | if (MEvent.button == AnyButton) |
1265 | if (MEvent.button == AnyButton) |
1306 | button_number = 3; |
1266 | button_number = 3; |
1307 | else |
1267 | else |
1308 | { |
1268 | { |
… | |
… | |
1354 | x + 1, |
1314 | x + 1, |
1355 | y + 1); |
1315 | y + 1); |
1356 | #endif |
1316 | #endif |
1357 | |
1317 | |
1358 | tt_printf ("\033[M%c%c%c", |
1318 | tt_printf ("\033[M%c%c%c", |
1359 | (32 + button_number + key_state), |
1319 | (code + button_number + key_state), |
1360 | (32 + x + 1), |
1320 | (32 + x + 1), |
1361 | (32 + y + 1)); |
1321 | (32 + y + 1)); |
1362 | } |
1322 | } |
1363 | |
1323 | |
1364 | /*{{{ process an X event */ |
1324 | /*{{{ process an X event */ |
… | |
… | |
1426 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
1386 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
1427 | focus_out (); |
1387 | focus_out (); |
1428 | } |
1388 | } |
1429 | #endif |
1389 | #endif |
1430 | } |
1390 | } |
1431 | break; |
|
|
1432 | |
|
|
1433 | case MappingNotify: |
|
|
1434 | XRefreshKeyboardMapping (&ev.xmapping); |
|
|
1435 | break; |
1391 | break; |
1436 | |
1392 | |
1437 | /* |
1393 | /* |
1438 | * XXX: this is not the _current_ arrangement |
1394 | * XXX: this is not the _current_ arrangement |
1439 | * Here's my conclusion: |
1395 | * Here's my conclusion: |
… | |
… | |
1458 | break; |
1414 | break; |
1459 | } |
1415 | } |
1460 | break; |
1416 | break; |
1461 | |
1417 | |
1462 | case FocusIn: |
1418 | case FocusIn: |
|
|
1419 | if (ev.xfocus.detail != NotifyInferior |
|
|
1420 | && ev.xfocus.detail != NotifyPointer |
|
|
1421 | && ev.xfocus.mode != NotifyGrab) |
1463 | focus_in (); |
1422 | focus_in (); |
1464 | break; |
1423 | break; |
1465 | |
1424 | |
1466 | case FocusOut: |
1425 | case FocusOut: |
|
|
1426 | if (ev.xfocus.detail != NotifyInferior |
|
|
1427 | && ev.xfocus.detail != NotifyPointer |
|
|
1428 | && ev.xfocus.mode != NotifyGrab) |
1467 | focus_out (); |
1429 | focus_out (); |
1468 | break; |
1430 | break; |
1469 | |
1431 | |
1470 | case ConfigureNotify: |
1432 | case ConfigureNotify: |
|
|
1433 | /* fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n", |
|
|
1434 | ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y, |
|
|
1435 | szHint.width, szHint.height); */ |
1471 | if (ev.xconfigure.window == parent[0]) |
1436 | if (ev.xconfigure.window == parent[0]) |
1472 | { |
1437 | { |
1473 | while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) |
1438 | while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) |
1474 | ; |
1439 | ; |
1475 | |
1440 | |
1476 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1441 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1477 | { |
1442 | { |
1478 | seen_resize = 1; |
1443 | seen_resize = 1; |
1479 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1444 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1480 | } |
1445 | } |
1481 | |
1446 | else |
|
|
1447 | { |
|
|
1448 | #ifdef HAVE_BG_PIXMAP |
|
|
1449 | if (bgPixmap.window_position_sensitive ()) |
|
|
1450 | update_background (); |
|
|
1451 | #endif |
|
|
1452 | } |
1482 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1453 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1483 | |
|
|
1484 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
|
|
1485 | if (OPTION (Opt_transparent)) |
|
|
1486 | check_our_parents (); |
|
|
1487 | #endif |
|
|
1488 | } |
1454 | } |
1489 | break; |
1455 | break; |
1490 | |
1456 | |
1491 | case PropertyNotify: |
1457 | case PropertyNotify: |
1492 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1458 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
… | |
… | |
1510 | break; |
1476 | break; |
1511 | |
1477 | |
1512 | case MapNotify: |
1478 | case MapNotify: |
1513 | mapped = 1; |
1479 | mapped = 1; |
1514 | #ifdef TEXT_BLINK |
1480 | #ifdef TEXT_BLINK |
1515 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
1481 | text_blink_ev.start (TEXT_BLINK_INTERVAL); |
1516 | #endif |
1482 | #endif |
1517 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1483 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1518 | break; |
1484 | break; |
1519 | |
1485 | |
1520 | case UnmapNotify: |
1486 | case UnmapNotify: |
… | |
… | |
1522 | #ifdef TEXT_BLINK |
1488 | #ifdef TEXT_BLINK |
1523 | text_blink_ev.stop (); |
1489 | text_blink_ev.stop (); |
1524 | #endif |
1490 | #endif |
1525 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1491 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1526 | break; |
1492 | break; |
1527 | |
|
|
1528 | #ifdef TRANSPARENT |
|
|
1529 | case ReparentNotify: |
|
|
1530 | rootwin_cb (ev); |
|
|
1531 | break; |
|
|
1532 | #endif /* TRANSPARENT */ |
|
|
1533 | |
1493 | |
1534 | case GraphicsExpose: |
1494 | case GraphicsExpose: |
1535 | case Expose: |
1495 | case Expose: |
1536 | if (ev.xany.window == vt) |
1496 | if (ev.xany.window == vt) |
1537 | { |
1497 | { |
1538 | do |
1498 | do |
|
|
1499 | { |
1539 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1500 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1540 | ev.xexpose.width, ev.xexpose.height, False); |
1501 | ev.xexpose.width, ev.xexpose.height, False); |
|
|
1502 | } |
1541 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); |
1503 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); |
1542 | |
1504 | |
1543 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1505 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1544 | |
1506 | |
1545 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) |
1507 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) |
|
|
1508 | { |
1546 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1509 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1547 | ev.xexpose.width, ev.xexpose.height, False); |
1510 | ev.xexpose.width, ev.xexpose.height, False); |
1548 | |
1511 | } |
1549 | want_refresh = 1; |
1512 | want_refresh = 1; |
1550 | } |
1513 | } |
1551 | else |
1514 | else |
1552 | { |
1515 | { |
1553 | XEvent unused_event; |
1516 | XEvent unused_event; |
… | |
… | |
1560 | if (isScrollbarWindow (ev.xany.window)) |
1523 | if (isScrollbarWindow (ev.xany.window)) |
1561 | { |
1524 | { |
1562 | scrollBar.setIdle (); |
1525 | scrollBar.setIdle (); |
1563 | scrollbar_show (0); |
1526 | scrollbar_show (0); |
1564 | } |
1527 | } |
1565 | |
|
|
1566 | #ifdef TRANSPARENT |
|
|
1567 | if (am_transparent && ev.xany.window == parent[0]) |
|
|
1568 | XClearWindow (dpy, ev.xany.window); |
|
|
1569 | #endif |
|
|
1570 | } |
1528 | } |
1571 | break; |
1529 | break; |
1572 | |
1530 | |
1573 | case MotionNotify: |
1531 | case MotionNotify: |
1574 | #ifdef POINTER_BLANK |
1532 | #ifdef POINTER_BLANK |
1575 | if (hidden_pointer) |
1533 | if (hidden_pointer) |
1576 | pointer_unblank (); |
1534 | pointer_unblank (); |
1577 | #endif |
1535 | #endif |
|
|
1536 | if ((priv_modes & PrivMode_MouseBtnEvent && ev.xbutton.state & (Button1Mask|Button2Mask|Button3Mask)) |
|
|
1537 | || priv_modes & PrivMode_MouseAnyEvent) |
|
|
1538 | mouse_report (ev.xbutton); |
1578 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1539 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1579 | break; |
1540 | break; |
1580 | |
1541 | |
1581 | if (ev.xany.window == vt) |
1542 | if (ev.xany.window == vt) |
1582 | { |
1543 | { |
… | |
… | |
1617 | |
1578 | |
1618 | /* don't clobber the current delay if we are |
1579 | /* don't clobber the current delay if we are |
1619 | * already in the middle of scrolling. |
1580 | * already in the middle of scrolling. |
1620 | */ |
1581 | */ |
1621 | if (!sel_scroll_ev.active) |
1582 | if (!sel_scroll_ev.active) |
1622 | sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); |
1583 | sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
1623 | |
1584 | |
1624 | /* save the event params so we can highlight |
1585 | /* save the event params so we can highlight |
1625 | * the selection in the pending-scroll loop |
1586 | * the selection in the pending-scroll loop |
1626 | */ |
1587 | */ |
1627 | selection_save_x = ev.xbutton.x; |
1588 | selection_save_x = ev.xbutton.x; |
… | |
… | |
1672 | &ev.xbutton.x, &ev.xbutton.y, |
1633 | &ev.xbutton.x, &ev.xbutton.y, |
1673 | &unused_mask); |
1634 | &unused_mask); |
1674 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1635 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1675 | scrollbar_size ()); |
1636 | scrollbar_size ()); |
1676 | want_refresh = 1; |
1637 | want_refresh = 1; |
1677 | refresh_limit = 0; |
|
|
1678 | scrollbar_show (1); |
1638 | scrollbar_show (1); |
1679 | } |
1639 | } |
1680 | break; |
1640 | break; |
1681 | } |
1641 | } |
1682 | |
1642 | |
1683 | #if defined(CURSOR_BLINK) |
1643 | #if defined(CURSOR_BLINK) |
1684 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
1644 | if (option (Opt_cursorBlink) && ev.type == KeyPress) |
1685 | { |
1645 | { |
1686 | if (hidden_cursor) |
1646 | if (hidden_cursor) |
1687 | { |
1647 | { |
1688 | hidden_cursor = 0; |
1648 | hidden_cursor = 0; |
1689 | want_refresh = 1; |
1649 | want_refresh = 1; |
1690 | } |
1650 | } |
1691 | |
1651 | |
1692 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1652 | cursor_blink_ev.again (); |
1693 | } |
1653 | } |
1694 | #endif |
1654 | #endif |
1695 | |
1655 | |
1696 | #if defined(POINTER_BLANK) |
1656 | #if defined(POINTER_BLANK) |
1697 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
1657 | if (option (Opt_pointerBlank) && pointerBlankDelay > 0) |
1698 | { |
1658 | { |
1699 | if (ev.type == MotionNotify |
1659 | if (ev.type == MotionNotify |
1700 | || ev.type == ButtonPress |
1660 | || ev.type == ButtonPress |
1701 | || ev.type == ButtonRelease) |
1661 | || ev.type == ButtonRelease) |
1702 | if (hidden_pointer) |
1662 | if (hidden_pointer) |
… | |
… | |
1724 | IMSetPosition (); |
1684 | IMSetPosition (); |
1725 | XSetICFocus (Input_Context); |
1685 | XSetICFocus (Input_Context); |
1726 | } |
1686 | } |
1727 | #endif |
1687 | #endif |
1728 | #if CURSOR_BLINK |
1688 | #if CURSOR_BLINK |
1729 | if (OPTION (Opt_cursorBlink)) |
1689 | if (option (Opt_cursorBlink)) |
1730 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1690 | cursor_blink_ev.start (CURSOR_BLINK_INTERVAL, CURSOR_BLINK_INTERVAL); |
1731 | #endif |
1691 | #endif |
1732 | #if OFF_FOCUS_FADING |
1692 | #if OFF_FOCUS_FADING |
1733 | if (rs[Rs_fade]) |
1693 | if (rs[Rs_fade]) |
1734 | { |
1694 | { |
1735 | pix_colors = pix_colors_focused; |
1695 | pix_colors = pix_colors_focused; |
1736 | scr_recolour (); |
1696 | scr_recolour (); |
1737 | } |
1697 | } |
1738 | #endif |
1698 | #endif |
|
|
1699 | #if ENABLE_FRILLS |
|
|
1700 | if (option (Opt_urgentOnBell)) |
|
|
1701 | { |
|
|
1702 | if (XWMHints *h = XGetWMHints(dpy, parent[0])) |
|
|
1703 | { |
|
|
1704 | h->flags &= ~XUrgencyHint; |
|
|
1705 | XSetWMHints (dpy, parent[0], h); |
|
|
1706 | } |
|
|
1707 | } |
|
|
1708 | #endif |
1739 | } |
1709 | } |
1740 | } |
1710 | } |
1741 | |
1711 | |
1742 | void |
1712 | void |
1743 | rxvt_term::focus_out () |
1713 | rxvt_term::focus_out () |
… | |
… | |
1751 | |
1721 | |
1752 | #if ENABLE_FRILLS || ISO_14755 |
1722 | #if ENABLE_FRILLS || ISO_14755 |
1753 | if (iso14755buf) |
1723 | if (iso14755buf) |
1754 | { |
1724 | { |
1755 | iso14755buf = 0; |
1725 | iso14755buf = 0; |
1756 | # if ENABLE_OVERLAY |
1726 | # if ISO_14755 |
1757 | scr_overlay_off (); |
1727 | scr_overlay_off (); |
1758 | # endif |
1728 | # endif |
1759 | } |
1729 | } |
1760 | #endif |
1730 | #endif |
1761 | #if USE_XIM |
1731 | #if USE_XIM |
1762 | if (Input_Context != NULL) |
1732 | if (Input_Context != NULL) |
1763 | XUnsetICFocus (Input_Context); |
1733 | XUnsetICFocus (Input_Context); |
1764 | #endif |
1734 | #endif |
1765 | #if CURSOR_BLINK |
1735 | #if CURSOR_BLINK |
1766 | if (OPTION (Opt_cursorBlink)) |
1736 | if (option (Opt_cursorBlink)) |
1767 | cursor_blink_ev.stop (); |
1737 | cursor_blink_ev.stop (); |
|
|
1738 | |
1768 | hidden_cursor = 0; |
1739 | hidden_cursor = 0; |
1769 | #endif |
1740 | #endif |
1770 | #if OFF_FOCUS_FADING |
1741 | #if OFF_FOCUS_FADING |
1771 | if (rs[Rs_fade]) |
1742 | if (rs[Rs_fade]) |
1772 | { |
1743 | { |
… | |
… | |
1775 | } |
1746 | } |
1776 | #endif |
1747 | #endif |
1777 | } |
1748 | } |
1778 | } |
1749 | } |
1779 | |
1750 | |
1780 | #if TRANSPARENT |
1751 | void |
|
|
1752 | rxvt_term::update_fade_color (unsigned int idx) |
|
|
1753 | { |
|
|
1754 | #if OFF_FOCUS_FADING |
|
|
1755 | if (rs[Rs_fade]) |
|
|
1756 | { |
|
|
1757 | rgba c; |
|
|
1758 | pix_colors [Color_fade].get (c); |
|
|
1759 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
|
|
1760 | } |
|
|
1761 | #endif |
|
|
1762 | } |
|
|
1763 | |
|
|
1764 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1781 | void |
1765 | void |
1782 | rxvt_term::rootwin_cb (XEvent &ev) |
1766 | rxvt_term::rootwin_cb (XEvent &ev) |
1783 | { |
1767 | { |
1784 | make_current (); |
1768 | make_current (); |
1785 | |
1769 | |
|
|
1770 | if (SHOULD_INVOKE (HOOK_ROOT_EVENT) |
|
|
1771 | && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) |
|
|
1772 | return; |
|
|
1773 | |
|
|
1774 | # if ENABLE_TRANSPARENCY |
1786 | switch (ev.type) |
1775 | switch (ev.type) |
1787 | { |
1776 | { |
1788 | case PropertyNotify: |
1777 | case PropertyNotify: |
1789 | /* |
1778 | /* |
1790 | * if user used some Esetroot compatible prog to set the root bg, |
1779 | * if user used some Esetroot compatible prog to set the root bg, |
1791 | * use the property to determine the pixmap. We use it later on. |
1780 | * use the property to determine the pixmap. We use it later on. |
1792 | */ |
1781 | */ |
1793 | if (ev.xproperty.atom != xa[XA_XROOTPMAP_ID] |
1782 | if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] |
1794 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1783 | || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) |
1795 | return; |
1784 | { |
1796 | |
1785 | bgPixmap.set_root_pixmap (); |
1797 | /* FALLTHROUGH */ |
1786 | update_background (); |
1798 | case ReparentNotify: |
1787 | } |
1799 | if (OPTION (Opt_transparent) && check_our_parents () && am_transparent) |
|
|
1800 | want_refresh = want_full_refresh = 1; |
|
|
1801 | break; |
1788 | break; |
1802 | } |
1789 | } |
|
|
1790 | # endif |
1803 | } |
1791 | } |
1804 | #endif |
1792 | #endif |
1805 | |
1793 | |
1806 | void |
1794 | void |
1807 | rxvt_term::button_press (XButtonEvent &ev) |
1795 | rxvt_term::button_press (XButtonEvent &ev) |
… | |
… | |
1988 | upordown = 1; /* down */ |
1976 | upordown = 1; /* down */ |
1989 | } |
1977 | } |
1990 | if (upordown) |
1978 | if (upordown) |
1991 | { |
1979 | { |
1992 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1980 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1993 | cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); |
1981 | cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
1994 | #endif |
1982 | #endif |
1995 | if (scr_page (upordown < 0 ? UP : DN, 1)) |
1983 | if (scr_page (upordown < 0 ? UP : DN, 1)) |
1996 | { |
1984 | { |
1997 | if (upordown < 0) |
1985 | if (upordown < 0) |
1998 | scrollBar.setUp (); |
1986 | scrollBar.setUp (); |
… | |
… | |
2135 | selection_make (ev.time); |
2123 | selection_make (ev.time); |
2136 | break; |
2124 | break; |
2137 | |
2125 | |
2138 | case Button2: |
2126 | case Button2: |
2139 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
2127 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
2140 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary); |
2128 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Clipboard : Sel_Primary); |
2141 | break; |
2129 | break; |
2142 | |
2130 | |
2143 | #ifdef MOUSE_WHEEL |
2131 | #ifdef MOUSE_WHEEL |
2144 | case Button4: |
2132 | case Button4: |
2145 | case Button5: |
2133 | case Button5: |
… | |
… | |
2149 | |
2137 | |
2150 | v = ev.button == Button4 ? UP : DN; |
2138 | v = ev.button == Button4 ? UP : DN; |
2151 | |
2139 | |
2152 | if (ev.state & ShiftMask) |
2140 | if (ev.state & ShiftMask) |
2153 | i = 1; |
2141 | i = 1; |
2154 | else if (OPTION (Opt_mouseWheelScrollPage)) |
2142 | else if (option (Opt_mouseWheelScrollPage)) |
2155 | i = nrow - 1; |
2143 | i = nrow - 1; |
2156 | else |
2144 | else |
2157 | i = 5; |
2145 | i = 5; |
2158 | |
2146 | |
2159 | # ifdef MOUSE_SLIP_WHEELING |
2147 | # ifdef MOUSE_SLIP_WHEELING |
… | |
… | |
2161 | { |
2149 | { |
2162 | mouse_slip_wheel_speed += v ? -1 : 1; |
2150 | mouse_slip_wheel_speed += v ? -1 : 1; |
2163 | if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; |
2151 | if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; |
2164 | if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; |
2152 | if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; |
2165 | |
2153 | |
2166 | if (slip_wheel_ev.at < NOW) |
2154 | slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
2167 | slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY; |
|
|
2168 | |
|
|
2169 | slip_wheel_ev.start (); |
|
|
2170 | } |
2155 | } |
2171 | else |
2156 | else |
2172 | { |
2157 | { |
2173 | # endif |
2158 | # endif |
2174 | scr_page (v, i); |
2159 | scr_page (v, i); |
… | |
… | |
2180 | break; |
2165 | break; |
2181 | #endif |
2166 | #endif |
2182 | } |
2167 | } |
2183 | } |
2168 | } |
2184 | } |
2169 | } |
2185 | |
|
|
2186 | #ifdef TRANSPARENT |
|
|
2187 | #if TINTING |
|
|
2188 | /* taken from aterm-0.4.2 */ |
|
|
2189 | |
|
|
2190 | typedef uint32_t RUINT32T; |
|
|
2191 | |
|
|
2192 | void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm) |
|
|
2193 | { |
|
|
2194 | int sh_r, sh_g, sh_b; |
|
|
2195 | RUINT32T mask_r, mask_g, mask_b; |
|
|
2196 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
|
|
2197 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
|
|
2198 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
|
|
2199 | int i; |
|
|
2200 | |
|
|
2201 | Visual *visual = term->visual; |
|
|
2202 | |
|
|
2203 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
|
|
2204 | |
|
|
2205 | /* for convenience */ |
|
|
2206 | mask_r = visual->red_mask; |
|
|
2207 | mask_g = visual->green_mask; |
|
|
2208 | mask_b = visual->blue_mask; |
|
|
2209 | |
|
|
2210 | /* boring lookup table pre-initialization */ |
|
|
2211 | switch (srcImage->bits_per_pixel) { |
|
|
2212 | case 15: |
|
|
2213 | if ((mask_r != 0x7c00) || |
|
|
2214 | (mask_g != 0x03e0) || |
|
|
2215 | (mask_b != 0x001f)) |
|
|
2216 | return; |
|
|
2217 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+32+32)); |
|
|
2218 | lookup_r = lookup; |
|
|
2219 | lookup_g = lookup+32; |
|
|
2220 | lookup_b = lookup+32+32; |
|
|
2221 | sh_r = 10; |
|
|
2222 | sh_g = 5; |
|
|
2223 | sh_b = 0; |
|
|
2224 | break; |
|
|
2225 | case 16: |
|
|
2226 | if ((mask_r != 0xf800) || |
|
|
2227 | (mask_g != 0x07e0) || |
|
|
2228 | (mask_b != 0x001f)) |
|
|
2229 | return; |
|
|
2230 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+64+32)); |
|
|
2231 | lookup_r = lookup; |
|
|
2232 | lookup_g = lookup+32; |
|
|
2233 | lookup_b = lookup+32+64; |
|
|
2234 | sh_r = 11; |
|
|
2235 | sh_g = 5; |
|
|
2236 | sh_b = 0; |
|
|
2237 | break; |
|
|
2238 | case 24: |
|
|
2239 | if ((mask_r != 0xff0000) || |
|
|
2240 | (mask_g != 0x00ff00) || |
|
|
2241 | (mask_b != 0x0000ff)) |
|
|
2242 | return; |
|
|
2243 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
|
|
2244 | lookup_r = lookup; |
|
|
2245 | lookup_g = lookup+256; |
|
|
2246 | lookup_b = lookup+256+256; |
|
|
2247 | sh_r = 16; |
|
|
2248 | sh_g = 8; |
|
|
2249 | sh_b = 0; |
|
|
2250 | break; |
|
|
2251 | case 32: |
|
|
2252 | if ((mask_r != 0xff0000) || |
|
|
2253 | (mask_g != 0x00ff00) || |
|
|
2254 | (mask_b != 0x0000ff)) |
|
|
2255 | return; |
|
|
2256 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
|
|
2257 | lookup_r = lookup; |
|
|
2258 | lookup_g = lookup+256; |
|
|
2259 | lookup_b = lookup+256+256; |
|
|
2260 | sh_r = 16; |
|
|
2261 | sh_g = 8; |
|
|
2262 | sh_b = 0; |
|
|
2263 | break; |
|
|
2264 | default: |
|
|
2265 | return; /* we do not support this color depth */ |
|
|
2266 | } |
|
|
2267 | |
|
|
2268 | /* prepare limits for color transformation (each channel is handled separately) */ |
|
|
2269 | if (shade < 0) { |
|
|
2270 | shade = -shade; |
|
|
2271 | if (shade < 0) shade = 0; |
|
|
2272 | if (shade > 100) shade = 100; |
|
|
2273 | |
|
|
2274 | lower_lim_r = 65535-rm; |
|
|
2275 | lower_lim_g = 65535-gm; |
|
|
2276 | lower_lim_b = 65535-bm; |
|
|
2277 | |
|
|
2278 | lower_lim_r = 65535-(unsigned int)(((RUINT32T)lower_lim_r)*((RUINT32T)shade)/100); |
|
|
2279 | lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100); |
|
|
2280 | lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100); |
|
|
2281 | |
|
|
2282 | upper_lim_r = upper_lim_g = upper_lim_b = 65535; |
|
|
2283 | } else { |
|
|
2284 | if (shade < 0) shade = 0; |
|
|
2285 | if (shade > 100) shade = 100; |
|
|
2286 | |
|
|
2287 | lower_lim_r = lower_lim_g = lower_lim_b = 0; |
|
|
2288 | |
|
|
2289 | upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100); |
|
|
2290 | upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100); |
|
|
2291 | upper_lim_b = (unsigned int)((((RUINT32T)bm)*((RUINT32T)shade))/100); |
|
|
2292 | } |
|
|
2293 | |
|
|
2294 | /* switch red and blue bytes if necessary, we need it for some weird XServers like XFree86 3.3.3.1 */ |
|
|
2295 | if ((srcImage->bits_per_pixel == 24) && (mask_r >= 0xFF0000 )) |
|
|
2296 | { |
|
|
2297 | unsigned int tmp; |
|
|
2298 | |
|
|
2299 | tmp = lower_lim_r; |
|
|
2300 | lower_lim_r = lower_lim_b; |
|
|
2301 | lower_lim_b = tmp; |
|
|
2302 | |
|
|
2303 | tmp = upper_lim_r; |
|
|
2304 | upper_lim_r = upper_lim_b; |
|
|
2305 | upper_lim_b = tmp; |
|
|
2306 | } |
|
|
2307 | |
|
|
2308 | /* fill our lookup tables */ |
|
|
2309 | for (i = 0; i <= mask_r>>sh_r; i++) |
|
|
2310 | { |
|
|
2311 | RUINT32T tmp; |
|
|
2312 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_r-lower_lim_r)); |
|
|
2313 | tmp += ((RUINT32T)(mask_r>>sh_r))*((RUINT32T)lower_lim_r); |
|
|
2314 | lookup_r[i] = (tmp/65535)<<sh_r; |
|
|
2315 | } |
|
|
2316 | for (i = 0; i <= mask_g>>sh_g; i++) |
|
|
2317 | { |
|
|
2318 | RUINT32T tmp; |
|
|
2319 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_g-lower_lim_g)); |
|
|
2320 | tmp += ((RUINT32T)(mask_g>>sh_g))*((RUINT32T)lower_lim_g); |
|
|
2321 | lookup_g[i] = (tmp/65535)<<sh_g; |
|
|
2322 | } |
|
|
2323 | for (i = 0; i <= mask_b>>sh_b; i++) |
|
|
2324 | { |
|
|
2325 | RUINT32T tmp; |
|
|
2326 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_b-lower_lim_b)); |
|
|
2327 | tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b); |
|
|
2328 | lookup_b[i] = (tmp/65535)<<sh_b; |
|
|
2329 | } |
|
|
2330 | |
|
|
2331 | /* apply table to input image (replacing colors by newly calculated ones) */ |
|
|
2332 | switch (srcImage->bits_per_pixel) |
|
|
2333 | { |
|
|
2334 | case 15: |
|
|
2335 | { |
|
|
2336 | unsigned short *p1, *pf, *p, *pl; |
|
|
2337 | p1 = (unsigned short *) srcImage->data; |
|
|
2338 | pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2339 | while (p1 < pf) |
|
|
2340 | { |
|
|
2341 | p = p1; |
|
|
2342 | pl = p1 + srcImage->width; |
|
|
2343 | for (; p < pl; p++) |
|
|
2344 | { |
|
|
2345 | *p = lookup_r[(*p & 0x7c00)>>10] | |
|
|
2346 | lookup_g[(*p & 0x03e0)>> 5] | |
|
|
2347 | lookup_b[(*p & 0x001f)]; |
|
|
2348 | } |
|
|
2349 | p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2350 | } |
|
|
2351 | break; |
|
|
2352 | } |
|
|
2353 | case 16: |
|
|
2354 | { |
|
|
2355 | unsigned short *p1, *pf, *p, *pl; |
|
|
2356 | p1 = (unsigned short *) srcImage->data; |
|
|
2357 | pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2358 | while (p1 < pf) |
|
|
2359 | { |
|
|
2360 | p = p1; |
|
|
2361 | pl = p1 + srcImage->width; |
|
|
2362 | for (; p < pl; p++) |
|
|
2363 | { |
|
|
2364 | *p = lookup_r[(*p & 0xf800)>>11] | |
|
|
2365 | lookup_g[(*p & 0x07e0)>> 5] | |
|
|
2366 | lookup_b[(*p & 0x001f)]; |
|
|
2367 | } |
|
|
2368 | p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2369 | } |
|
|
2370 | break; |
|
|
2371 | } |
|
|
2372 | case 24: |
|
|
2373 | { |
|
|
2374 | unsigned char *p1, *pf, *p, *pl; |
|
|
2375 | p1 = (unsigned char *) srcImage->data; |
|
|
2376 | pf = (unsigned char *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2377 | while (p1 < pf) |
|
|
2378 | { |
|
|
2379 | p = p1; |
|
|
2380 | pl = p1 + srcImage->width * 3; |
|
|
2381 | for (; p < pl; p += 3) |
|
|
2382 | { |
|
|
2383 | p[0] = lookup_r[(p[0] & 0xff0000)>>16]; |
|
|
2384 | p[1] = lookup_r[(p[1] & 0x00ff00)>> 8]; |
|
|
2385 | p[2] = lookup_r[(p[2] & 0x0000ff)]; |
|
|
2386 | } |
|
|
2387 | p1 = (unsigned char *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2388 | } |
|
|
2389 | break; |
|
|
2390 | } |
|
|
2391 | case 32: |
|
|
2392 | { |
|
|
2393 | RUINT32T *p1, *pf, *p, *pl; |
|
|
2394 | p1 = (RUINT32T *) srcImage->data; |
|
|
2395 | pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2396 | |
|
|
2397 | while (p1 < pf) |
|
|
2398 | { |
|
|
2399 | p = p1; |
|
|
2400 | pl = p1 + srcImage->width; |
|
|
2401 | for (; p < pl; p++) |
|
|
2402 | { |
|
|
2403 | *p = lookup_r[(*p & 0xff0000)>>16] | |
|
|
2404 | lookup_g[(*p & 0x00ff00)>> 8] | |
|
|
2405 | lookup_b[(*p & 0x0000ff)] | |
|
|
2406 | (*p & ~0xffffff); |
|
|
2407 | } |
|
|
2408 | p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2409 | } |
|
|
2410 | break; |
|
|
2411 | } |
|
|
2412 | } |
|
|
2413 | |
|
|
2414 | free (lookup); |
|
|
2415 | } |
|
|
2416 | #endif |
|
|
2417 | |
|
|
2418 | /* |
|
|
2419 | * Check our parents are still who we think they are. |
|
|
2420 | * Do transparency updates if required |
|
|
2421 | */ |
|
|
2422 | int |
|
|
2423 | rxvt_term::check_our_parents () |
|
|
2424 | { |
|
|
2425 | int i, pchanged, aformat, have_pixmap, rootdepth; |
|
|
2426 | unsigned long nitems, bytes_after; |
|
|
2427 | Atom atype; |
|
|
2428 | unsigned char *prop = NULL; |
|
|
2429 | Window root, oldp, *list; |
|
|
2430 | Pixmap rootpixmap = None; |
|
|
2431 | XWindowAttributes wattr, wrootattr; |
|
|
2432 | |
|
|
2433 | pchanged = 0; |
|
|
2434 | |
|
|
2435 | if (!OPTION (Opt_transparent)) |
|
|
2436 | return pchanged; /* Don't try any more */ |
|
|
2437 | |
|
|
2438 | XGetWindowAttributes (dpy, display->root, &wrootattr); |
|
|
2439 | rootdepth = wrootattr.depth; |
|
|
2440 | |
|
|
2441 | XGetWindowAttributes (dpy, parent[0], &wattr); |
|
|
2442 | |
|
|
2443 | if (rootdepth != wattr.depth) |
|
|
2444 | { |
|
|
2445 | if (am_transparent) |
|
|
2446 | { |
|
|
2447 | pchanged = 1; |
|
|
2448 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
|
|
2449 | am_transparent = am_pixmap_trans = 0; |
|
|
2450 | } |
|
|
2451 | |
|
|
2452 | return pchanged; /* Don't try any more */ |
|
|
2453 | } |
|
|
2454 | |
|
|
2455 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
|
|
2456 | XSync (dpy, False); |
|
|
2457 | |
|
|
2458 | /* |
|
|
2459 | * Make the frame window set by the window manager have |
|
|
2460 | * the root background. Some window managers put multiple nested frame |
|
|
2461 | * windows for each client, so we have to take care about that. |
|
|
2462 | */ |
|
|
2463 | i = (xa[XA_XROOTPMAP_ID] |
|
|
2464 | && XGetWindowProperty (dpy, display->root, xa[XA_XROOTPMAP_ID], |
|
|
2465 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
2466 | &nitems, &bytes_after, &prop) == Success); |
|
|
2467 | |
|
|
2468 | if (!i || prop == NULL) |
|
|
2469 | i = (xa[XA_ESETROOT_PMAP_ID] |
|
|
2470 | && XGetWindowProperty (dpy, display->root, xa[XA_ESETROOT_PMAP_ID], |
|
|
2471 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
2472 | &nitems, &bytes_after, &prop) == Success); |
|
|
2473 | |
|
|
2474 | if (!i || prop == NULL |
|
|
2475 | #if TINTING |
|
|
2476 | || !ISSET_PIXCOLOR (Color_tint) |
|
|
2477 | #endif |
|
|
2478 | ) |
|
|
2479 | have_pixmap = 0; |
|
|
2480 | else |
|
|
2481 | { |
|
|
2482 | have_pixmap = 1; |
|
|
2483 | rootpixmap = *(Pixmap *)prop; |
|
|
2484 | XFree (prop); |
|
|
2485 | } |
|
|
2486 | |
|
|
2487 | if (have_pixmap) |
|
|
2488 | { |
|
|
2489 | /* |
|
|
2490 | * Copy display->root pixmap transparency |
|
|
2491 | */ |
|
|
2492 | int sx, sy, nx, ny; |
|
|
2493 | unsigned int nw, nh; |
|
|
2494 | Window cr; |
|
|
2495 | XImage *image; |
|
|
2496 | GC gc; |
|
|
2497 | XGCValues gcvalue; |
|
|
2498 | |
|
|
2499 | XTranslateCoordinates (dpy, parent[0], display->root, |
|
|
2500 | 0, 0, &sx, &sy, &cr); |
|
|
2501 | nw = (unsigned int)szHint.width; |
|
|
2502 | nh = (unsigned int)szHint.height; |
|
|
2503 | nx = ny = 0; |
|
|
2504 | |
|
|
2505 | if (sx < 0) |
|
|
2506 | { |
|
|
2507 | nw += sx; |
|
|
2508 | nx = -sx; |
|
|
2509 | sx = 0; |
|
|
2510 | } |
|
|
2511 | |
|
|
2512 | if (sy < 0) |
|
|
2513 | { |
|
|
2514 | nh += sy; |
|
|
2515 | ny = -sy; |
|
|
2516 | sy = 0; |
|
|
2517 | } |
|
|
2518 | |
|
|
2519 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
|
|
2520 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
|
|
2521 | |
|
|
2522 | XSync (dpy, False); |
|
|
2523 | allowedxerror = -1; |
|
|
2524 | image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
|
|
2525 | |
|
|
2526 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
|
|
2527 | /* XXX: may need a delay here? */ |
|
|
2528 | allowedxerror = 0; |
|
|
2529 | |
|
|
2530 | if (image == NULL) |
|
|
2531 | { |
|
|
2532 | if (am_transparent && am_pixmap_trans) |
|
|
2533 | { |
|
|
2534 | pchanged = 1; |
|
|
2535 | if (pixmap != None) |
|
|
2536 | { |
|
|
2537 | XFreePixmap (dpy, pixmap); |
|
|
2538 | pixmap = None; |
|
|
2539 | } |
|
|
2540 | } |
|
|
2541 | |
|
|
2542 | am_pixmap_trans = 0; |
|
|
2543 | } |
|
|
2544 | else |
|
|
2545 | { |
|
|
2546 | if (pixmap != None) |
|
|
2547 | XFreePixmap (dpy, pixmap); |
|
|
2548 | |
|
|
2549 | #if TINTING |
|
|
2550 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
2551 | { |
|
|
2552 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
|
|
2553 | |
|
|
2554 | rgba c; |
|
|
2555 | pix_colors_focused [Color_tint].get (c); |
|
|
2556 | |
|
|
2557 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
|
|
2558 | } |
|
|
2559 | #endif |
|
|
2560 | |
|
|
2561 | pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, image->depth); |
|
|
2562 | gc = XCreateGC (dpy, vt, 0UL, &gcvalue); |
|
|
2563 | XPutImage (dpy, pixmap, gc, image, 0, 0, |
|
|
2564 | nx, ny, image->width, image->height); |
|
|
2565 | XFreeGC (dpy, gc); |
|
|
2566 | XDestroyImage (image); |
|
|
2567 | XSetWindowBackgroundPixmap (dpy, parent[0], pixmap); |
|
|
2568 | XClearWindow (dpy, parent[0]); |
|
|
2569 | |
|
|
2570 | if (!am_transparent || !am_pixmap_trans) |
|
|
2571 | pchanged = 1; |
|
|
2572 | |
|
|
2573 | am_transparent = am_pixmap_trans = 1; |
|
|
2574 | } |
|
|
2575 | } |
|
|
2576 | |
|
|
2577 | if (am_pixmap_trans) |
|
|
2578 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
|
|
2579 | else |
|
|
2580 | { |
|
|
2581 | unsigned int n; |
|
|
2582 | /* |
|
|
2583 | * InheritPixmap transparency |
|
|
2584 | */ |
|
|
2585 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
|
|
2586 | { |
|
|
2587 | oldp = parent[i]; |
|
|
2588 | XQueryTree (dpy, parent[i - 1], &root, &parent[i], &list, &n); |
|
|
2589 | XFree (list); |
|
|
2590 | |
|
|
2591 | if (parent[i] == display->root) |
|
|
2592 | { |
|
|
2593 | if (oldp != None) |
|
|
2594 | pchanged = 1; |
|
|
2595 | |
|
|
2596 | break; |
|
|
2597 | } |
|
|
2598 | |
|
|
2599 | if (oldp != parent[i]) |
|
|
2600 | pchanged = 1; |
|
|
2601 | } |
|
|
2602 | |
|
|
2603 | n = 0; |
|
|
2604 | |
|
|
2605 | if (pchanged) |
|
|
2606 | for (; n < (unsigned int)i; n++) |
|
|
2607 | { |
|
|
2608 | XGetWindowAttributes (dpy, parent[n], &wattr); |
|
|
2609 | |
|
|
2610 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
|
|
2611 | { |
|
|
2612 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
|
|
2613 | break; |
|
|
2614 | } |
|
|
2615 | } |
|
|
2616 | |
|
|
2617 | if (n > (sizeof (parent) / sizeof (parent[0]))) |
|
|
2618 | { |
|
|
2619 | XSetWindowBackground (dpy, parent[0], pix_colors_focused[Color_border]); |
|
|
2620 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
|
|
2621 | am_transparent = 0; |
|
|
2622 | /* XXX: also turn off Opt_transparent? */ |
|
|
2623 | } |
|
|
2624 | else |
|
|
2625 | { |
|
|
2626 | for (n = 0; n < (unsigned int)i; n++) |
|
|
2627 | { |
|
|
2628 | XSetWindowBackgroundPixmap (dpy, parent[n], ParentRelative); |
|
|
2629 | XClearWindow (dpy, parent[n]); |
|
|
2630 | } |
|
|
2631 | |
|
|
2632 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
|
|
2633 | am_transparent = 1; |
|
|
2634 | } |
|
|
2635 | |
|
|
2636 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
|
|
2637 | parent[i] = None; |
|
|
2638 | } |
|
|
2639 | |
|
|
2640 | if (scrollBar.win) |
|
|
2641 | { |
|
|
2642 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
|
|
2643 | scrollBar.setIdle (); |
|
|
2644 | scrollbar_show (0); |
|
|
2645 | } |
|
|
2646 | |
|
|
2647 | if (am_transparent) |
|
|
2648 | { |
|
|
2649 | want_refresh = want_full_refresh = 1; |
|
|
2650 | if (am_pixmap_trans) |
|
|
2651 | flush (); |
|
|
2652 | } |
|
|
2653 | |
|
|
2654 | return pchanged; |
|
|
2655 | } |
|
|
2656 | #endif |
|
|
2657 | |
2170 | |
2658 | /*}}} */ |
2171 | /*}}} */ |
2659 | |
2172 | |
2660 | bool |
2173 | bool |
2661 | rxvt_term::cmd_parse () |
2174 | rxvt_term::cmd_parse () |
… | |
… | |
2710 | if (ch == C0_LF) |
2223 | if (ch == C0_LF) |
2711 | nlines++; |
2224 | nlines++; |
2712 | |
2225 | |
2713 | refresh_count++; |
2226 | refresh_count++; |
2714 | |
2227 | |
2715 | if (!OPTION (Opt_jumpScroll) |
2228 | if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) |
2716 | || (refresh_count >= refresh_limit * (nrow - 1))) |
|
|
2717 | { |
2229 | { |
2718 | refreshnow = true; |
|
|
2719 | refresh_count = 0; |
2230 | refresh_count = 0; |
|
|
2231 | |
|
|
2232 | if (!option (Opt_skipScroll) || ev::ev_time () > ev::now () + 1. / 60.) |
|
|
2233 | { |
|
|
2234 | refreshnow = true; |
2720 | ch = NOCHAR; |
2235 | ch = NOCHAR; |
2721 | break; |
2236 | break; |
|
|
2237 | } |
2722 | } |
2238 | } |
2723 | |
2239 | |
2724 | // scr_add_lines only works for nlines <= nrow - 1. |
2240 | // scr_add_lines only works for nlines <= nrow - 1. |
2725 | if (nlines >= nrow - 1) |
2241 | if (nlines >= nrow - 1) |
2726 | { |
2242 | { |
… | |
… | |
2754 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2270 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2755 | scr_add_lines (buf, str - buf, nlines); |
2271 | scr_add_lines (buf, str - buf, nlines); |
2756 | |
2272 | |
2757 | /* |
2273 | /* |
2758 | * If there have been a lot of new lines, then update the screen |
2274 | * If there have been a lot of new lines, then update the screen |
2759 | * What the heck I'll cheat and only refresh less than every page-full. |
2275 | * What the heck we'll cheat and only refresh less than every page-full. |
2760 | * the number of pages between refreshes is refresh_limit, which |
2276 | * if skipScroll is enabled. |
2761 | * is incremented here because we must be doing flat-out scrolling. |
|
|
2762 | */ |
2277 | */ |
2763 | if (refreshnow) |
2278 | if (refreshnow) |
2764 | { |
2279 | { |
2765 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
|
|
2766 | refresh_limit++; |
|
|
2767 | else |
|
|
2768 | { |
|
|
2769 | flag = true; |
2280 | flag = true; |
2770 | //TODO: due to popular request, implement "skipscroll" option here |
|
|
2771 | scr_refresh (); |
2281 | scr_refresh (); |
2772 | want_refresh = 1; |
2282 | want_refresh = 1; |
2773 | } |
|
|
2774 | } |
2283 | } |
2775 | |
2284 | |
2776 | } |
2285 | } |
2777 | else |
2286 | else |
2778 | { |
2287 | { |
… | |
… | |
2927 | { |
2436 | { |
2928 | if ((buf[len++] = cmd_getc ()) == 'i') |
2437 | if ((buf[len++] = cmd_getc ()) == 'i') |
2929 | break; /* done = 1 */ |
2438 | break; /* done = 1 */ |
2930 | } |
2439 | } |
2931 | } |
2440 | } |
2932 | |
2441 | |
2933 | for (i = 0; i < len; i++) |
2442 | for (i = 0; i < len; i++) |
2934 | if (putc (buf[i], fd) == EOF) |
2443 | if (putc (buf[i], fd) == EOF) |
2935 | { |
2444 | { |
2936 | done = 1; |
2445 | done = 1; |
2937 | break; |
2446 | break; |
… | |
… | |
2999 | process_dcs_seq (); |
2508 | process_dcs_seq (); |
3000 | break; |
2509 | break; |
3001 | case 0x9b: /* CSI */ |
2510 | case 0x9b: /* CSI */ |
3002 | process_csi_seq (); |
2511 | process_csi_seq (); |
3003 | break; |
2512 | break; |
3004 | case 0x9d: /* CSI */ |
2513 | case 0x9d: /* OSC */ |
3005 | process_osc_seq (); |
2514 | process_osc_seq (); |
3006 | break; |
2515 | break; |
3007 | #endif |
2516 | #endif |
3008 | } |
2517 | } |
3009 | } |
2518 | } |
… | |
… | |
3235 | rxvt_term::process_csi_seq () |
2744 | rxvt_term::process_csi_seq () |
3236 | { |
2745 | { |
3237 | unicode_t ch, priv, i; |
2746 | unicode_t ch, priv, i; |
3238 | unsigned int nargs, p; |
2747 | unsigned int nargs, p; |
3239 | int n, ndef; |
2748 | int n, ndef; |
3240 | int arg[ESC_ARGS]; |
2749 | int arg[ESC_ARGS] = { }; |
3241 | |
2750 | |
3242 | for (nargs = ESC_ARGS; nargs > 0;) |
2751 | nargs = 0; |
3243 | arg[--nargs] = 0; |
|
|
3244 | |
2752 | |
3245 | priv = 0; |
2753 | priv = 0; |
3246 | ch = cmd_getc (); |
2754 | ch = cmd_getc (); |
3247 | if (ch >= '<' && ch <= '?') |
2755 | if (ch >= '<' && ch <= '?') |
3248 | { /* '<' '=' '>' '?' */ |
2756 | { /* '<' '=' '>' '?' */ |
… | |
… | |
3292 | switch (priv) |
2800 | switch (priv) |
3293 | { |
2801 | { |
3294 | case '>': |
2802 | case '>': |
3295 | if (ch == CSI_DA) /* secondary device attributes */ |
2803 | if (ch == CSI_DA) /* secondary device attributes */ |
3296 | { |
2804 | { |
3297 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
2805 | // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, |
3298 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
2806 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
3299 | // |
2807 | // |
3300 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
2808 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
3301 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
2809 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, 94 for urxvt <= 8.3, and 95 for later |
3302 | // that we do not support xterm mouse reporting (should be 95 when we do). |
2810 | // versions. |
3303 | // |
2811 | // |
3304 | tt_printf ("\033[>%d;94;0c", 'U'); |
2812 | tt_printf ("\033[>%d;95;0c", 'U'); |
3305 | } |
2813 | } |
3306 | break; |
2814 | break; |
3307 | case '?': |
2815 | case '?': |
3308 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
2816 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3309 | process_terminal_mode (ch, priv, nargs, arg); |
2817 | process_terminal_mode (ch, priv, nargs, arg); |
… | |
… | |
3436 | break; |
2944 | break; |
3437 | case 6: /* CPR requested */ |
2945 | case 6: /* CPR requested */ |
3438 | scr_report_position (); |
2946 | scr_report_position (); |
3439 | break; |
2947 | break; |
3440 | case 7: /* unofficial extension */ |
2948 | case 7: /* unofficial extension */ |
3441 | if (OPTION (Opt_insecure)) |
2949 | if (option (Opt_insecure)) |
3442 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
2950 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
3443 | break; |
2951 | break; |
3444 | case 8: /* unofficial extension */ |
2952 | case 8: /* unofficial extension */ |
3445 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
2953 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
3446 | break; |
2954 | break; |
… | |
… | |
3610 | break; |
3118 | break; |
3611 | case 20: /* report icon label */ |
3119 | case 20: /* report icon label */ |
3612 | { |
3120 | { |
3613 | char *s; |
3121 | char *s; |
3614 | XGetIconName (dpy, parent[0], &s); |
3122 | XGetIconName (dpy, parent[0], &s); |
3615 | tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3123 | tt_printf ("\033]L%-.250s\234", option (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3616 | XFree (s); |
3124 | XFree (s); |
3617 | } |
3125 | } |
3618 | break; |
3126 | break; |
3619 | case 21: /* report window title */ |
3127 | case 21: /* report window title */ |
3620 | { |
3128 | { |
3621 | char *s; |
3129 | char *s; |
3622 | XFetchName (dpy, parent[0], &s); |
3130 | XFetchName (dpy, parent[0], &s); |
3623 | tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3131 | tt_printf ("\033]l%-.250s\234", option (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3624 | XFree (s); |
3132 | XFree (s); |
3625 | } |
3133 | } |
3626 | break; |
3134 | break; |
3627 | } |
3135 | } |
3628 | } |
3136 | } |
… | |
… | |
3655 | seen_esc = true; |
3163 | seen_esc = true; |
3656 | continue; |
3164 | continue; |
3657 | } |
3165 | } |
3658 | else if (ch == C0_BEL || ch == CHAR_ST) |
3166 | else if (ch == C0_BEL || ch == CHAR_ST) |
3659 | break; |
3167 | break; |
|
|
3168 | else if (ch == C0_SYN) |
|
|
3169 | ch = cmd_get8 (); |
3660 | else if (ch < 0x20) |
3170 | else if (ch < 0x20) |
3661 | return NULL; /* other control character - exit */ |
3171 | return NULL; /* other control character - exit */ |
3662 | |
3172 | |
3663 | seen_esc = false; |
3173 | seen_esc = false; |
3664 | |
3174 | |
3665 | if (n >= STRING_MAX - 1) |
3175 | if (n >= STRING_MAX - 1) |
3666 | // stop at some sane length |
3176 | // stop at some sane length |
3667 | return NULL; |
3177 | return NULL; |
3668 | |
3178 | |
3669 | if (ch == C0_SYN) |
|
|
3670 | string[n++] = cmd_get8 (); |
|
|
3671 | else |
|
|
3672 | string[n++] = ch; |
3179 | string[n++] = ch; |
3673 | } |
3180 | } |
3674 | |
3181 | |
3675 | string[n++] = '\0'; |
3182 | string[n++] = '\0'; |
3676 | |
3183 | |
3677 | ends_how = (ch == 0x5c ? C0_ESC : ch); |
3184 | ends_how = (ch == 0x5c ? C0_ESC : ch); |
… | |
… | |
3756 | int saveop = op; |
3263 | int saveop = op; |
3757 | |
3264 | |
3758 | dLocal (Display *, dpy); |
3265 | dLocal (Display *, dpy); |
3759 | |
3266 | |
3760 | assert (str != NULL); |
3267 | assert (str != NULL); |
3761 | |
3268 | |
3762 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
3269 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
3763 | ; // no responses yet |
3270 | return; |
3764 | |
3271 | |
3765 | switch (op) |
3272 | switch (op) |
3766 | { |
3273 | { |
3767 | case XTerm_name: |
3274 | case XTerm_name: |
3768 | set_title (str); |
3275 | set_title (str); |
… | |
… | |
3861 | break; |
3368 | break; |
3862 | case URxvt_Color_IT: |
3369 | case URxvt_Color_IT: |
3863 | process_color_seq (op, Color_IT, str, resp); |
3370 | process_color_seq (op, Color_IT, str, resp); |
3864 | break; |
3371 | break; |
3865 | #endif |
3372 | #endif |
3866 | #if TRANSPARENT && TINTING |
3373 | #if ENABLE_TRANSPARENCY |
3867 | case URxvt_Color_tint: |
3374 | case URxvt_Color_tint: |
3868 | process_color_seq (op, Color_tint, str, resp); |
3375 | process_color_seq (op, Color_tint, str, resp); |
|
|
3376 | { |
|
|
3377 | bool changed = false; |
|
|
3378 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
3379 | changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
|
|
3380 | else |
|
|
3381 | changed = bgPixmap.unset_tint (); |
|
|
3382 | if (changed) |
|
|
3383 | update_background (); |
|
|
3384 | } |
3869 | |
3385 | |
3870 | check_our_parents (); |
|
|
3871 | |
|
|
3872 | if (am_transparent) |
|
|
3873 | want_full_refresh = want_refresh = 1; |
|
|
3874 | |
|
|
3875 | break; |
3386 | break; |
3876 | #endif |
3387 | #endif |
3877 | |
3388 | |
|
|
3389 | #if BG_IMAGE_FROM_FILE |
3878 | case Rxvt_Pixmap: |
3390 | case Rxvt_Pixmap: |
3879 | { |
3391 | if (!strcmp (str, "?")) |
3880 | if (*str != ';') |
|
|
3881 | { |
3392 | { |
3882 | #if XPM_BACKGROUND |
3393 | char str[256]; |
3883 | scale_pixmap (""); /* reset to default scaling */ |
3394 | |
3884 | set_bgPixmap (str); /* change pixmap */ |
3395 | sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ |
3885 | scr_touch (true); |
3396 | min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767), |
3886 | #endif |
3397 | min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767)); |
|
|
3398 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
3887 | } |
3399 | } |
3888 | |
3400 | else |
|
|
3401 | { |
3889 | int changed = 0; |
3402 | int changed = 0; |
3890 | |
3403 | |
3891 | while ((str = strchr (str, ';')) != NULL) |
3404 | if (*str != ';') |
3892 | { |
3405 | { |
|
|
3406 | /* reset to default scaling :*/ |
|
|
3407 | bgPixmap.unset_geometry (); |
|
|
3408 | if (bgPixmap.set_file (str)) /* change pixmap */ |
|
|
3409 | changed++; |
|
|
3410 | str = strchr (str, ';'); |
|
|
3411 | if (str == NULL) |
|
|
3412 | bgPixmap.set_defaultGeometry (); |
|
|
3413 | } |
|
|
3414 | while (str) |
|
|
3415 | { |
3893 | str++; |
3416 | str++; |
3894 | #if XPM_BACKGROUND |
3417 | if (bgPixmap.set_geometry (str)) |
3895 | changed += scale_pixmap (str); |
3418 | changed++; |
3896 | #endif |
3419 | str = strchr (str, ';'); |
3897 | } |
3420 | } |
3898 | |
|
|
3899 | if (changed) |
3421 | if (changed) |
3900 | { |
3422 | update_background (); |
3901 | #ifdef XPM_BACKGROUND |
|
|
3902 | resize_pixmap (); |
|
|
3903 | scr_touch (true); |
|
|
3904 | #endif |
|
|
3905 | } |
3423 | } |
3906 | } |
|
|
3907 | break; |
3424 | break; |
|
|
3425 | #endif |
3908 | |
3426 | |
3909 | case Rxvt_restoreFG: |
3427 | case Rxvt_restoreFG: |
3910 | set_window_color (Color_fg, str); |
3428 | set_window_color (Color_fg, str); |
3911 | break; |
3429 | break; |
3912 | case Rxvt_restoreBG: |
3430 | case Rxvt_restoreBG: |
… | |
… | |
3937 | case URxvt_italicFont: |
3455 | case URxvt_italicFont: |
3938 | case URxvt_boldItalicFont: |
3456 | case URxvt_boldItalicFont: |
3939 | #endif |
3457 | #endif |
3940 | if (query) |
3458 | if (query) |
3941 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3459 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3942 | OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3460 | option (Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3943 | ? fontset[op - URxvt_font]->fontdesc : "", |
3461 | ? fontset[op - URxvt_font]->fontdesc : "", |
3944 | resp); |
3462 | resp); |
3945 | else |
3463 | else |
3946 | { |
3464 | { |
3947 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
3465 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
… | |
… | |
3961 | break; |
3479 | break; |
3962 | |
3480 | |
3963 | #if !ENABLE_MINIMAL |
3481 | #if !ENABLE_MINIMAL |
3964 | case URxvt_locale: |
3482 | case URxvt_locale: |
3965 | if (query) |
3483 | if (query) |
3966 | tt_printf ("\33]%d;%-.250s%c", op, OPTION (Opt_insecure) ? locale : "", resp); |
3484 | tt_printf ("\33]%d;%-.250s%c", op, option (Opt_insecure) ? locale : "", resp); |
3967 | else |
3485 | else |
3968 | { |
3486 | { |
3969 | set_locale (str); |
3487 | set_locale (str); |
3970 | pty->set_utf8_mode (enc_utf8); |
3488 | pty->set_utf8_mode (enc_utf8); |
3971 | init_xlocale (); |
3489 | init_xlocale (); |
… | |
… | |
4034 | { |
3552 | { |
4035 | unsigned int i, j; |
3553 | unsigned int i, j; |
4036 | int state; |
3554 | int state; |
4037 | |
3555 | |
4038 | static const struct |
3556 | static const struct |
4039 | { |
3557 | { |
4040 | const int argval; |
3558 | const int argval; |
4041 | const unsigned long bit; |
3559 | const unsigned long bit; |
4042 | } |
|
|
4043 | |
|
|
4044 | argtopriv[] = { |
3560 | } argtopriv[] = { |
4045 | { 1, PrivMode_aplCUR }, |
3561 | { 1, PrivMode_aplCUR }, |
4046 | { 2, PrivMode_vt52 }, |
3562 | { 2, PrivMode_vt52 }, |
4047 | { 3, PrivMode_132 }, |
3563 | { 3, PrivMode_132 }, |
4048 | { 4, PrivMode_smoothScroll }, |
3564 | { 4, PrivMode_smoothScroll }, |
4049 | { 5, PrivMode_rVideo }, |
3565 | { 5, PrivMode_rVideo }, |
… | |
… | |
4066 | #ifndef NO_BACKSPACE_KEY |
3582 | #ifndef NO_BACKSPACE_KEY |
4067 | { 67, PrivMode_BackSpace }, |
3583 | { 67, PrivMode_BackSpace }, |
4068 | #endif |
3584 | #endif |
4069 | { 1000, PrivMode_MouseX11 }, |
3585 | { 1000, PrivMode_MouseX11 }, |
4070 | // 1001 Use Hilite Mouse Tracking. NYI, TODO |
3586 | // 1001 Use Hilite Mouse Tracking. NYI, TODO |
4071 | // 1002 Use Cell Motion Mouse Tracking. NYI, TODO |
3587 | { 1002, PrivMode_MouseBtnEvent }, |
4072 | // 1003 Use All Motion Mouse Tracking. NYI, TODO |
3588 | { 1003, PrivMode_MouseAnyEvent }, |
4073 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3589 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
4074 | { 1011, PrivMode_Keypress }, // rxvt extension |
3590 | { 1011, PrivMode_Keypress }, // rxvt extension |
4075 | // 1035 enable modifiers for alt, numlock NYI |
3591 | // 1035 enable modifiers for alt, numlock NYI |
4076 | // 1036 send ESC for meta keys NYI |
3592 | // 1036 send ESC for meta keys NYI |
4077 | // 1037 send DEL for keypad delete NYI |
3593 | // 1037 send DEL for keypad delete NYI |
… | |
… | |
4112 | scr_touch (true); |
3628 | scr_touch (true); |
4113 | break; |
3629 | break; |
4114 | #endif |
3630 | #endif |
4115 | case 1048: /* alternative cursor save */ |
3631 | case 1048: /* alternative cursor save */ |
4116 | case 1049: |
3632 | case 1049: |
4117 | if (OPTION (Opt_secondaryScreen)) |
3633 | if (option (Opt_secondaryScreen)) |
4118 | if (mode == 0) |
3634 | if (mode == 0) |
4119 | scr_cursor (RESTORE); |
3635 | scr_cursor (RESTORE); |
4120 | else if (mode == 1) |
3636 | else if (mode == 1) |
4121 | scr_cursor (SAVE); |
3637 | scr_cursor (SAVE); |
4122 | break; |
3638 | break; |
… | |
… | |
4151 | scr_autowrap (state); |
3667 | scr_autowrap (state); |
4152 | break; |
3668 | break; |
4153 | /* case 8: - auto repeat, can't do on a per window basis */ |
3669 | /* case 8: - auto repeat, can't do on a per window basis */ |
4154 | case 9: /* X10 mouse reporting */ |
3670 | case 9: /* X10 mouse reporting */ |
4155 | if (state) /* orthogonal */ |
3671 | if (state) /* orthogonal */ |
4156 | priv_modes &= ~PrivMode_MouseX11; |
3672 | priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
4157 | break; |
3673 | break; |
4158 | #ifdef scrollBar_esc |
3674 | #ifdef scrollBar_esc |
4159 | case scrollBar_esc: |
3675 | case scrollBar_esc: |
4160 | if (scrollbar_mapping (state)) |
3676 | if (scrollbar_mapping (state)) |
4161 | { |
3677 | { |
… | |
… | |
4174 | break; |
3690 | break; |
4175 | /* case 66: - application key pad */ |
3691 | /* case 66: - application key pad */ |
4176 | /* case 67: - backspace key */ |
3692 | /* case 67: - backspace key */ |
4177 | case 1000: /* X11 mouse reporting */ |
3693 | case 1000: /* X11 mouse reporting */ |
4178 | if (state) /* orthogonal */ |
3694 | if (state) /* orthogonal */ |
4179 | priv_modes &= ~PrivMode_MouseX10; |
3695 | priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
4180 | break; |
3696 | break; |
4181 | #if 0 |
3697 | #if 0 |
4182 | case 1001: |
3698 | case 1001: |
4183 | break; /* X11 mouse highlighting */ |
3699 | break; /* X11 mouse highlighting */ |
4184 | #endif |
3700 | #endif |
|
|
3701 | case 1002: |
|
|
3702 | case 1003: |
|
|
3703 | if (state) |
|
|
3704 | { |
|
|
3705 | priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11); |
|
|
3706 | priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; |
|
|
3707 | vt_emask_mouse = PointerMotionMask; |
|
|
3708 | } |
|
|
3709 | else |
|
|
3710 | vt_emask_mouse = NoEventMask; |
|
|
3711 | vt_select_input (); |
|
|
3712 | break; |
4185 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3713 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4186 | set_option (Opt_scrollTtyOutput, !state); |
3714 | set_option (Opt_scrollTtyOutput, !state); |
4187 | break; |
3715 | break; |
4188 | case 1011: /* scroll to bottom on key press */ |
3716 | case 1011: /* scroll to bottom on key press */ |
4189 | set_option (Opt_scrollTtyKeypress, state); |
3717 | set_option (Opt_scrollTtyKeypress, state); |
4190 | break; |
3718 | break; |
4191 | case 1047: /* secondary screen w/ clearing last */ |
3719 | case 1047: /* secondary screen w/ clearing last */ |
4192 | if (OPTION (Opt_secondaryScreen)) |
3720 | if (option (Opt_secondaryScreen)) |
4193 | if (current_screen != PRIMARY) |
3721 | if (current_screen != PRIMARY) |
4194 | scr_erase_screen (2); |
3722 | scr_erase_screen (2); |
4195 | scr_change_screen (state); |
3723 | scr_change_screen (state); |
4196 | break; |
3724 | break; |
4197 | case 1049: /* secondary screen w/ clearing first */ |
3725 | case 1049: /* secondary screen w/ clearing first */ |
4198 | scr_change_screen (state); |
3726 | scr_change_screen (state); |
4199 | if (OPTION (Opt_secondaryScreen)) |
3727 | if (option (Opt_secondaryScreen)) |
4200 | if (current_screen != PRIMARY) |
3728 | if (current_screen != PRIMARY) |
4201 | scr_erase_screen (2); |
3729 | scr_erase_screen (2); |
4202 | break; |
3730 | break; |
4203 | default: |
3731 | default: |
4204 | break; |
3732 | break; |
… | |
… | |
4426 | v_buffer = (char *)realloc (v_buffer, v_buflen + len); |
3954 | v_buffer = (char *)realloc (v_buffer, v_buflen + len); |
4427 | |
3955 | |
4428 | memcpy (v_buffer + v_buflen, data, len); |
3956 | memcpy (v_buffer + v_buflen, data, len); |
4429 | v_buflen += len; |
3957 | v_buflen += len; |
4430 | |
3958 | |
4431 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
3959 | pty_ev.set (ev::READ | ev::WRITE); |
4432 | } |
3960 | } |
4433 | |
3961 | |
4434 | void rxvt_term::pty_write () |
3962 | void rxvt_term::pty_write () |
4435 | { |
3963 | { |
4436 | int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
3964 | int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
… | |
… | |
4441 | |
3969 | |
4442 | if (v_buflen == 0) |
3970 | if (v_buflen == 0) |
4443 | { |
3971 | { |
4444 | free (v_buffer); |
3972 | free (v_buffer); |
4445 | v_buffer = 0; |
3973 | v_buffer = 0; |
4446 | v_buflen = 0; |
|
|
4447 | |
3974 | |
4448 | pty_ev.set (EVENT_READ); |
3975 | pty_ev.set (ev::READ); |
4449 | return; |
3976 | return; |
4450 | } |
3977 | } |
4451 | |
3978 | |
4452 | memmove (v_buffer, v_buffer + written, v_buflen); |
3979 | memmove (v_buffer, v_buffer + written, v_buflen); |
4453 | } |
3980 | } |
4454 | else if (written != -1 || (errno != EAGAIN && errno != EINTR)) |
3981 | else if (written != -1 || (errno != EAGAIN && errno != EINTR)) |
4455 | pty_ev.set (EVENT_READ); |
3982 | pty_ev.set (ev::READ); |
4456 | } |
3983 | } |
4457 | |
3984 | |
4458 | /*----------------------- end-of-file (C source) -----------------------*/ |
3985 | /*----------------------- end-of-file (C source) -----------------------*/ |
4459 | |
3986 | |