… | |
… | |
25 | * - extensive modifications |
25 | * - extensive modifications |
26 | * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> |
26 | * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> |
27 | * Copyright (c) 2001 Marius Gedminas |
27 | * Copyright (c) 2001 Marius Gedminas |
28 | * - Ctrl/Mod4+Tab works like Meta+Tab (options) |
28 | * - Ctrl/Mod4+Tab works like Meta+Tab (options) |
29 | * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> |
29 | * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> |
30 | * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com> |
30 | * Copyright (c) 2003-2007 Marc Lehmann <pcg@goof.com> |
|
|
31 | * Copyright (c) 2007 Emanuele Giaquinta <e.giaquinta@glauco.it> |
31 | * |
32 | * |
32 | * This program is free software; you can redistribute it and/or modify |
33 | * This program is free software; you can redistribute it and/or modify |
33 | * it under the terms of the GNU General Public License as published by |
34 | * it under the terms of the GNU General Public License as published by |
34 | * the Free Software Foundation; either version 2 of the License, or |
35 | * the Free Software Foundation; either version 2 of the License, or |
35 | * (at your option) any later version. |
36 | * (at your option) any later version. |
… | |
… | |
95 | XK_Shift_L, 0x21e7, |
96 | XK_Shift_L, 0x21e7, |
96 | XK_Shift_R, 0x21e7, |
97 | XK_Shift_R, 0x21e7, |
97 | |
98 | |
98 | XK_Shift_Lock, 0x21eb, |
99 | XK_Shift_Lock, 0x21eb, |
99 | XK_ISO_Lock, 0x21eb, |
100 | XK_ISO_Lock, 0x21eb, |
100 | XK_ISO_Lock, 0x21eb, |
|
|
101 | XK_Caps_Lock, 0x21ec, |
101 | XK_Caps_Lock, 0x21ec, |
102 | XK_Num_Lock, 0x21ed, |
102 | XK_Num_Lock, 0x21ed, |
103 | XK_ISO_Level3_Shift, 0x21ee, |
103 | XK_ISO_Level3_Shift, 0x21ee, |
104 | XK_ISO_Level3_Lock, 0x21ef, |
104 | XK_ISO_Level3_Lock, 0x21ef, |
105 | XK_ISO_Group_Lock, 0x21f0, |
105 | XK_ISO_Group_Lock, 0x21f0, |
… | |
… | |
199 | r & RS_Uline ? " uline" : "", |
199 | r & RS_Uline ? " uline" : "", |
200 | r & RS_Careful ? " careful" : ""); |
200 | r & RS_Careful ? " careful" : ""); |
201 | |
201 | |
202 | int width = wcswidth (fname, wcslen (fname)); |
202 | int width = wcswidth (fname, wcslen (fname)); |
203 | |
203 | |
204 | max_it (width, 8+5); // for char + hey |
204 | max_it (width, 8+5); // for char + hex |
205 | max_it (width, strlen (attr)); |
205 | max_it (width, strlen (attr)); |
206 | |
206 | |
207 | if (y >= 0) |
207 | if (y >= 0) |
208 | { |
208 | { |
209 | y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1; |
209 | y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1; |
… | |
… | |
221 | ch = *chr++; |
221 | ch = *chr++; |
222 | |
222 | |
223 | sprintf (buf, "%8x", ch); |
223 | sprintf (buf, "%8x", ch); |
224 | scr_overlay_set (0, y, buf); |
224 | scr_overlay_set (0, y, buf); |
225 | scr_overlay_set (9, y, '='); |
225 | scr_overlay_set (9, y, '='); |
226 | # if !UNICODE3 |
226 | # if !UNICODE_3 |
227 | if (ch >= 0x10000) |
227 | if (ch >= 0x10000) |
228 | ch = 0xfffd; |
228 | ch = 0xfffd; |
229 | # endif |
229 | # endif |
230 | scr_overlay_set (11, y, ch, r); |
230 | scr_overlay_set (11, y, ch, r); |
231 | |
231 | |
… | |
… | |
500 | # if ISO_14755 |
500 | # if ISO_14755 |
501 | iso14755_51 (0); |
501 | iso14755_51 (0); |
502 | # endif |
502 | # endif |
503 | return; |
503 | return; |
504 | } |
504 | } |
|
|
505 | else if (keysym == XK_BackSpace) |
|
|
506 | { |
|
|
507 | iso14755buf = ((iso14755buf & ISO_14755_MASK) >> 4) | ISO_14755_51; |
|
|
508 | # if ISO_14755 |
|
|
509 | iso14755_51 (iso14755buf & ISO_14755_MASK); |
|
|
510 | # endif |
|
|
511 | return; |
|
|
512 | } |
505 | else if ((hv = hex_keyval (ev)) >= 0) |
513 | else if ((hv = hex_keyval (ev)) >= 0) |
506 | { |
514 | { |
507 | iso14755buf = ((iso14755buf << 4) & ISO_14755_MASK) |
515 | iso14755buf = ((iso14755buf << 4) & ISO_14755_MASK) |
508 | | hv | ISO_14755_51; |
516 | | hv | ISO_14755_51; |
509 | # if ISO_14755 |
517 | # if ISO_14755 |
… | |
… | |
511 | # endif |
519 | # endif |
512 | return; |
520 | return; |
513 | } |
521 | } |
514 | else |
522 | else |
515 | { |
523 | { |
516 | # if ENABLE_OVERLAY |
524 | # if ISO_14755 |
517 | scr_overlay_off (); |
525 | scr_overlay_off (); |
518 | # endif |
526 | # endif |
519 | iso14755buf = 0; |
527 | iso14755buf = 0; |
520 | } |
528 | } |
521 | } |
529 | } |
522 | else if ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R)) |
530 | else if ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R)) |
523 | || (shft && (keysym == XK_Control_L || keysym == XK_Control_R))) |
531 | || (shft && (keysym == XK_Control_L || keysym == XK_Control_R))) |
524 | if (!(iso14755buf & ISO_14755_STARTED)) |
532 | if (!(iso14755buf & ISO_14755_STARTED)) |
525 | { |
533 | { |
526 | iso14755buf |= ISO_14755_STARTED; |
534 | iso14755buf |= ISO_14755_STARTED; |
527 | # if ENABLE_OVERLAY |
535 | # if ISO_14755 |
528 | scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); |
536 | scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); |
529 | scr_overlay_set (0, 0, "ISO 14755 mode"); |
537 | scr_overlay_set (0, 0, "ISO 14755 mode"); |
530 | # endif |
538 | # endif |
531 | } |
539 | } |
532 | #endif |
540 | #endif |
533 | |
541 | |
534 | #ifdef PRINTPIPE |
542 | #ifdef PRINTPIPE |
535 | if (keysym == XK_Print) |
543 | if (keysym == XK_Print) |
536 | { |
544 | { |
537 | scr_printscreen (ctrl | shft); |
545 | scr_printscreen (ctrl | shft); |
538 | return; |
546 | return; |
… | |
… | |
540 | #endif |
548 | #endif |
541 | |
549 | |
542 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
550 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
543 | { |
551 | { |
544 | { |
552 | { |
|
|
553 | bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; |
545 | newlen = 1; |
554 | newlen = 1; |
|
|
555 | #ifdef XK_KP_Home |
|
|
556 | static const KeySym keypadtrans[] = { |
|
|
557 | XK_KP_7, // XK_KP_Home |
|
|
558 | XK_KP_4, // XK_KP_Left |
|
|
559 | XK_KP_8, // XK_KP_Up |
|
|
560 | XK_KP_6, // XK_KP_Right |
|
|
561 | XK_KP_2, // XK_KP_Down |
|
|
562 | #ifndef UNSHIFTED_SCROLLKEYS |
|
|
563 | XK_KP_9, // XK_KP_Prior |
|
|
564 | XK_KP_3, // XK_KP_Next |
|
|
565 | #else |
|
|
566 | XK_Prior, |
|
|
567 | XK_Next, |
|
|
568 | #endif |
|
|
569 | XK_KP_1, // XK_KP_End |
|
|
570 | XK_KP_5, // XK_KP_Begin |
|
|
571 | }; |
|
|
572 | |
|
|
573 | if (IN_RANGE_INC (keysym, XK_KP_Home, XK_KP_Begin)) |
|
|
574 | { |
|
|
575 | unsigned int index = keysym - XK_KP_Home; |
|
|
576 | keysym = kp ? keypadtrans[index] : XK_Home + index; |
|
|
577 | } |
|
|
578 | else if (keysym == XK_KP_Insert) |
|
|
579 | keysym = kp ? XK_KP_0 : XK_Insert; |
|
|
580 | #ifndef NO_DELETE_KEY |
|
|
581 | else if (keysym == XK_KP_Delete) |
|
|
582 | keysym = kp ? XK_KP_Decimal : XK_Delete; |
|
|
583 | #endif |
|
|
584 | #endif |
546 | switch (keysym) |
585 | switch (keysym) |
547 | { |
586 | { |
548 | #ifndef NO_BACKSPACE_KEY |
587 | #ifndef NO_BACKSPACE_KEY |
549 | case XK_BackSpace: |
588 | case XK_BackSpace: |
550 | if (priv_modes & PrivMode_HaveBackSpace) |
589 | if (priv_modes & PrivMode_HaveBackSpace) |
… | |
… | |
552 | kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) |
591 | kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) |
553 | ^ !!ctrl) ? '\b' : '\177'; |
592 | ^ !!ctrl) ? '\b' : '\177'; |
554 | kbuf[1] = '\0'; |
593 | kbuf[1] = '\0'; |
555 | } |
594 | } |
556 | else |
595 | else |
557 | strcpy (kbuf, key_backspace); |
596 | strcpy (kbuf, rs[Rs_backspace_key]); |
558 | break; |
597 | break; |
559 | #endif |
598 | #endif |
560 | #ifndef NO_DELETE_KEY |
599 | #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: |
600 | case XK_Delete: |
572 | strcpy (kbuf, key_delete); |
601 | strcpy (kbuf, rs[Rs_delete_key]); |
573 | break; |
602 | break; |
574 | #endif |
603 | #endif |
575 | case XK_Tab: |
604 | case XK_Tab: |
576 | if (shft) |
605 | if (shft) |
577 | strcpy (kbuf, "\033[Z"); |
606 | strcpy (kbuf, "\033[Z"); |
… | |
… | |
587 | #endif |
616 | #endif |
588 | newlen = 0; |
617 | newlen = 0; |
589 | } |
618 | } |
590 | break; |
619 | break; |
591 | |
620 | |
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" */ |
621 | case XK_Up: /* "\033[A" */ |
609 | case XK_Down: /* "\033[B" */ |
622 | case XK_Down: /* "\033[B" */ |
610 | case XK_Right: /* "\033[C" */ |
623 | case XK_Right: /* "\033[C" */ |
611 | case XK_Left: /* "\033[D" */ |
624 | case XK_Left: /* "\033[D" */ |
612 | strcpy (kbuf, "\033[Z"); |
625 | strcpy (kbuf, "\033[Z"); |
… | |
… | |
622 | else if (priv_modes & PrivMode_aplCUR) |
635 | else if (priv_modes & PrivMode_aplCUR) |
623 | kbuf[1] = 'O'; |
636 | kbuf[1] = 'O'; |
624 | break; |
637 | break; |
625 | |
638 | |
626 | #ifndef UNSHIFTED_SCROLLKEYS |
639 | #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: |
640 | case XK_Prior: |
638 | strcpy (kbuf, "\033[5~"); |
641 | strcpy (kbuf, "\033[5~"); |
639 | break; |
642 | 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: |
643 | case XK_Next: |
651 | strcpy (kbuf, "\033[6~"); |
644 | strcpy (kbuf, "\033[6~"); |
652 | break; |
645 | break; |
653 | #endif |
646 | #endif |
654 | case XK_KP_Enter: |
647 | case XK_KP_Enter: |
655 | /* allow shift to override */ |
648 | /* allow shift to override */ |
656 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
649 | if (kp) |
657 | { |
650 | { |
658 | strcpy (kbuf, "\033OM"); |
651 | strcpy (kbuf, "\033OM"); |
659 | break; |
652 | break; |
660 | } |
653 | } |
661 | |
654 | |
… | |
… | |
673 | kbuf[0] = '\015'; |
666 | kbuf[0] = '\015'; |
674 | kbuf[1] = '\0'; |
667 | kbuf[1] = '\0'; |
675 | } |
668 | } |
676 | break; |
669 | break; |
677 | |
670 | |
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" */ |
671 | case XK_KP_F1: /* "\033OP" */ |
685 | case XK_KP_F2: /* "\033OQ" */ |
672 | case XK_KP_F2: /* "\033OQ" */ |
686 | case XK_KP_F3: /* "\033OR" */ |
673 | case XK_KP_F3: /* "\033OR" */ |
687 | case XK_KP_F4: /* "\033OS" */ |
674 | case XK_KP_F4: /* "\033OS" */ |
688 | strcpy (kbuf, "\033OP"); |
675 | strcpy (kbuf, "\033OP"); |
… | |
… | |
704 | case XK_KP_6: /* "\033Ov" : "6" */ |
691 | case XK_KP_6: /* "\033Ov" : "6" */ |
705 | case XK_KP_7: /* "\033Ow" : "7" */ |
692 | case XK_KP_7: /* "\033Ow" : "7" */ |
706 | case XK_KP_8: /* "\033Ox" : "8" */ |
693 | case XK_KP_8: /* "\033Ox" : "8" */ |
707 | case XK_KP_9: /* "\033Oy" : "9" */ |
694 | case XK_KP_9: /* "\033Oy" : "9" */ |
708 | /* allow shift to override */ |
695 | /* allow shift to override */ |
709 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
696 | if (kp) |
710 | { |
697 | { |
711 | strcpy (kbuf, "\033Oj"); |
698 | strcpy (kbuf, "\033Oj"); |
712 | kbuf[2] += (keysym - XK_KP_Multiply); |
699 | kbuf[2] += (keysym - XK_KP_Multiply); |
713 | } |
700 | } |
714 | else |
701 | else |
… | |
… | |
720 | |
707 | |
721 | case XK_Find: |
708 | case XK_Find: |
722 | strcpy (kbuf, "\033[1~"); |
709 | strcpy (kbuf, "\033[1~"); |
723 | break; |
710 | break; |
724 | |
711 | |
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: |
712 | case XK_Insert: |
736 | strcpy (kbuf, "\033[2~"); |
713 | strcpy (kbuf, "\033[2~"); |
737 | break; |
714 | break; |
738 | #ifdef DXK_Remove /* support for DEC remove like key */ |
715 | #ifdef DXK_Remove /* support for DEC remove like key */ |
739 | case DXK_Remove: |
716 | case DXK_Remove: |
… | |
… | |
743 | strcpy (kbuf, "\033[3~"); |
720 | strcpy (kbuf, "\033[3~"); |
744 | break; |
721 | break; |
745 | case XK_Select: |
722 | case XK_Select: |
746 | strcpy (kbuf, "\033[4~"); |
723 | strcpy (kbuf, "\033[4~"); |
747 | break; |
724 | 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: |
725 | case XK_End: |
759 | strcpy (kbuf, KS_END); |
726 | strcpy (kbuf, KS_END); |
760 | break; |
727 | 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: |
728 | case XK_Home: |
772 | strcpy (kbuf, KS_HOME); |
729 | strcpy (kbuf, KS_HOME); |
773 | break; |
730 | break; |
774 | |
731 | |
775 | #define FKEY(n, fkey) \ |
732 | #define FKEY(n, fkey) \ |
… | |
… | |
877 | return; |
834 | return; |
878 | |
835 | |
879 | if (len <= 0) |
836 | if (len <= 0) |
880 | return; /* not mapped */ |
837 | return; /* not mapped */ |
881 | |
838 | |
882 | if (OPTION (Opt_scrollTtyKeypress)) |
839 | if (option (Opt_scrollTtyKeypress)) |
883 | if (view_start) |
840 | if (view_start) |
884 | { |
841 | { |
885 | view_start = 0; |
842 | view_start = 0; |
886 | want_refresh = 1; |
843 | want_refresh = 1; |
887 | } |
844 | } |
… | |
… | |
926 | #if ENABLE_FRILLS || ISO_14755 |
883 | #if ENABLE_FRILLS || ISO_14755 |
927 | // ISO 14755 support |
884 | // ISO 14755 support |
928 | if (iso14755buf) |
885 | if (iso14755buf) |
929 | if (iso14755buf & ISO_14755_52) |
886 | if (iso14755buf & ISO_14755_52) |
930 | { |
887 | { |
931 | # if ENABLE_OVERLAY |
888 | # if ISO_14755 |
932 | scr_overlay_off (); |
889 | scr_overlay_off (); |
933 | # endif |
890 | # endif |
934 | # if ISO_14755 |
891 | # if ISO_14755 |
935 | // iso14755 part 5.2 handling: release time |
892 | // iso14755 part 5.2 handling: release time |
936 | // first: controls |
893 | // first: controls |
… | |
… | |
959 | |
916 | |
960 | return; |
917 | return; |
961 | } |
918 | } |
962 | else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) |
919 | else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) |
963 | { |
920 | { |
964 | # if ENABLE_OVERLAY |
921 | # if ISO_14755 |
965 | scr_overlay_off (); |
922 | scr_overlay_off (); |
966 | # endif |
923 | # endif |
967 | if (iso14755buf & ISO_14755_51) |
924 | if (iso14755buf & ISO_14755_51) |
968 | commit_iso14755 (); |
925 | commit_iso14755 (); |
969 | #if ISO_14755 |
926 | #if ISO_14755 |
970 | else if (iso14755buf & ISO_14755_STARTED) |
927 | else if (option (Opt_iso14755_52) && iso14755buf & ISO_14755_STARTED) |
971 | { |
928 | { |
972 | iso14755buf = ISO_14755_52; // iso14755 part 5.2: remember empty begin/end pair |
929 | iso14755buf = ISO_14755_52; // iso14755 part 5.2: remember empty begin/end pair |
973 | |
930 | |
974 | scr_overlay_new (0, -1, sizeof ("KEYCAP PICTURE INSERT MODE") - 1, 1); |
931 | scr_overlay_new (0, -1, sizeof ("KEYCAP PICTURE INSERT MODE") - 1, 1); |
975 | scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE"); |
932 | scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE"); |
… | |
… | |
1027 | void |
984 | void |
1028 | rxvt_term::flush () |
985 | rxvt_term::flush () |
1029 | { |
986 | { |
1030 | flush_ev.stop (); |
987 | flush_ev.stop (); |
1031 | |
988 | |
1032 | #ifdef TRANSPARENT |
989 | #ifdef HAVE_BG_PIXMAP |
1033 | if (want_full_refresh) |
990 | if (bgPixmap.check_clearChanged ()) |
1034 | { |
991 | { |
1035 | want_full_refresh = 0; |
992 | // scr_clear (true); This needs to be researched further! |
1036 | scr_clear (); |
|
|
1037 | scr_touch (false); |
993 | scr_touch (false); |
1038 | } |
994 | } |
1039 | #endif |
995 | #endif |
1040 | |
996 | |
1041 | if (want_refresh) |
997 | if (want_refresh) |
… | |
… | |
1086 | } |
1042 | } |
1087 | |
1043 | |
1088 | display->flush (); |
1044 | display->flush (); |
1089 | } |
1045 | } |
1090 | |
1046 | |
|
|
1047 | /* checks wether a refresh is requested and starts the refresh timer */ |
1091 | void |
1048 | void |
1092 | rxvt_term::check_cb (check_watcher &w) |
1049 | rxvt_term::refresh_check () |
|
|
1050 | { |
|
|
1051 | if (want_refresh && !flush_ev.is_active ()) |
|
|
1052 | flush_ev.start (1. / 60.); // refresh at max. 60 Hz normally |
|
|
1053 | |
|
|
1054 | display->flush (); |
|
|
1055 | } |
|
|
1056 | |
|
|
1057 | void |
|
|
1058 | rxvt_term::flush_cb (ev::timer &w, int revents) |
1093 | { |
1059 | { |
1094 | make_current (); |
1060 | make_current (); |
1095 | |
1061 | |
1096 | display->flush (); |
|
|
1097 | |
|
|
1098 | if (want_refresh && !flush_ev.active) |
|
|
1099 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
|
|
1100 | } |
|
|
1101 | |
|
|
1102 | void |
|
|
1103 | rxvt_term::flush_cb (time_watcher &w) |
|
|
1104 | { |
|
|
1105 | make_current (); |
|
|
1106 | |
|
|
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 | |
1072 | refresh_check (); |
1119 | w.start (w.at + CURSOR_BLINK_INTERVAL); |
|
|
1120 | } |
1073 | } |
1121 | #endif |
1074 | #endif |
1122 | |
1075 | |
1123 | #ifdef TEXT_BLINK |
1076 | #ifdef TEXT_BLINK |
1124 | void |
1077 | void |
1125 | rxvt_term::text_blink_cb (time_watcher &w) |
1078 | rxvt_term::text_blink_cb (ev::timer &w, int revents) |
1126 | { |
1079 | { |
1127 | if (scr_refresh_rend (RS_Blink, RS_Blink)) |
1080 | if (scr_refresh_rend (RS_Blink, RS_Blink)) |
1128 | { |
1081 | { |
1129 | hidden_text = !hidden_text; |
1082 | hidden_text = !hidden_text; |
1130 | want_refresh = 1; |
1083 | want_refresh = 1; |
1131 | w.start (w.at + TEXT_BLINK_INTERVAL); |
1084 | refresh_check (); |
1132 | } |
1085 | } |
|
|
1086 | else |
|
|
1087 | w.stop (); |
1133 | } |
1088 | } |
1134 | #endif |
1089 | #endif |
1135 | |
1090 | |
1136 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1091 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1137 | void |
1092 | void |
1138 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1093 | rxvt_term::cont_scroll_cb (ev::timer &w, int revents) |
1139 | { |
1094 | { |
1140 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1095 | if ((scrollbar_isUp () || scrollbar_isDn ()) |
1141 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1096 | && scr_page (scrollbar_isUp () ? UP : DN, 1)) |
1142 | { |
1097 | { |
1143 | want_refresh = 1; |
1098 | want_refresh = 1; |
1144 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1099 | refresh_check (); |
1145 | } |
1100 | } |
|
|
1101 | else |
|
|
1102 | w.stop (); |
1146 | } |
1103 | } |
1147 | #endif |
1104 | #endif |
1148 | |
1105 | |
1149 | #ifdef SELECTION_SCROLLING |
1106 | #ifdef SELECTION_SCROLLING |
1150 | void |
1107 | void |
1151 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1108 | rxvt_term::sel_scroll_cb (ev::timer &w, int revents) |
1152 | { |
1109 | { |
1153 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1110 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1154 | { |
1111 | { |
1155 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1112 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1156 | want_refresh = 1; |
1113 | want_refresh = 1; |
1157 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1114 | refresh_check (); |
1158 | } |
1115 | } |
|
|
1116 | else |
|
|
1117 | w.stop (); |
1159 | } |
1118 | } |
1160 | #endif |
1119 | #endif |
1161 | |
1120 | |
1162 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1121 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1163 | void |
1122 | void |
1164 | rxvt_term::slip_wheel_cb (time_watcher &w) |
1123 | rxvt_term::slip_wheel_cb (ev::timer &w, int revents) |
1165 | { |
1124 | { |
1166 | if (mouse_slip_wheel_speed == 0 |
1125 | if (scr_changeview (view_start - mouse_slip_wheel_speed)) |
1167 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
|
|
1168 | : scr_page (UP, mouse_slip_wheel_speed)) |
|
|
1169 | { |
1126 | { |
1170 | if (view_start == top_row || view_start == 0) |
|
|
1171 | mouse_slip_wheel_speed = 0; |
|
|
1172 | |
|
|
1173 | want_refresh = 1; |
1127 | want_refresh = 1; |
1174 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1128 | refresh_check (); |
|
|
1129 | } |
|
|
1130 | |
|
|
1131 | if (view_start == top_row || view_start == 0 || mouse_slip_wheel_speed == 0) |
|
|
1132 | { |
|
|
1133 | mouse_slip_wheel_speed = 0; |
|
|
1134 | w.stop (); |
1175 | } |
1135 | } |
1176 | } |
1136 | } |
1177 | #endif |
1137 | #endif |
1178 | |
1138 | |
1179 | #if LINUX_YIELD_HACK |
1139 | #if LINUX_YIELD_HACK |
1180 | static struct event_handler |
1140 | static struct event_handler |
1181 | { |
1141 | { |
1182 | check_watcher yield_ev; |
1142 | ev::prepare yield_ev; |
1183 | |
1143 | |
1184 | void yield_cb (check_watcher &w) |
1144 | void yield_cb (ev::prepare &w, int revents) |
1185 | { |
1145 | { |
1186 | // this should really be sched_yield(), but the linux guys thought |
1146 | // this should really be sched_yield(), but the linux guys thought |
1187 | // that giving a process calling sched_yield () less cpu time than |
1147 | // 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 |
1148 | // ones with high nice levels is a useful thing to do. It surely is is |
1189 | // allowed by the sus... as is returning ENOSYS. |
1149 | // allowed by the sus... as is returning ENOSYS. |
… | |
… | |
1232 | } |
1192 | } |
1233 | else |
1193 | else |
1234 | { |
1194 | { |
1235 | pty_ev.stop (); |
1195 | pty_ev.stop (); |
1236 | |
1196 | |
1237 | if (!OPTION (Opt_hold)) |
1197 | if (!option (Opt_hold)) |
1238 | destroy (); |
1198 | destroy (); |
1239 | } |
1199 | } |
1240 | |
1200 | |
1241 | return false; |
1201 | return false; |
1242 | } |
1202 | } |
1243 | |
1203 | |
1244 | void |
1204 | void |
1245 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1205 | rxvt_term::pty_cb (ev::io &w, int revents) |
1246 | { |
1206 | { |
1247 | make_current (); |
1207 | make_current (); |
1248 | |
1208 | |
1249 | if (revents & EVENT_READ) |
1209 | if (revents & ev::READ) |
1250 | // loop, but don't allow a single term to monopolize us |
1210 | // loop, but don't allow a single term to monopolize us |
1251 | while (pty_fill ()) |
1211 | while (pty_fill ()) |
1252 | if (cmd_parse ()) |
1212 | if (cmd_parse ()) |
1253 | break; |
1213 | break; |
1254 | |
1214 | |
1255 | if (revents & EVENT_WRITE) |
1215 | if (revents & ev::WRITE) |
1256 | pty_write (); |
1216 | pty_write (); |
|
|
1217 | |
|
|
1218 | refresh_check (); |
1257 | } |
1219 | } |
1258 | |
1220 | |
1259 | void |
1221 | void |
1260 | rxvt_term::pointer_unblank () |
1222 | rxvt_term::pointer_unblank () |
1261 | { |
1223 | { |
… | |
… | |
1263 | recolour_cursor (); |
1225 | recolour_cursor (); |
1264 | |
1226 | |
1265 | #ifdef POINTER_BLANK |
1227 | #ifdef POINTER_BLANK |
1266 | hidden_pointer = 0; |
1228 | hidden_pointer = 0; |
1267 | |
1229 | |
1268 | if (OPTION (Opt_pointerBlank)) |
1230 | if (option (Opt_pointerBlank)) |
1269 | pointer_ev.start (NOW + pointerBlankDelay); |
1231 | pointer_ev.start (pointerBlankDelay); |
1270 | #endif |
1232 | #endif |
1271 | } |
1233 | } |
1272 | |
1234 | |
1273 | #ifdef POINTER_BLANK |
1235 | #ifdef POINTER_BLANK |
1274 | void |
1236 | void |
1275 | rxvt_term::pointer_blank () |
1237 | rxvt_term::pointer_blank () |
1276 | { |
1238 | { |
1277 | if (!OPTION (Opt_pointerBlank)) |
1239 | if (!option (Opt_pointerBlank)) |
1278 | return; |
1240 | return; |
1279 | |
1241 | |
1280 | XDefineCursor (dpy, vt, display->blank_cursor); |
1242 | XDefineCursor (dpy, vt, display->blank_cursor); |
1281 | XFlush (dpy); |
1243 | XFlush (dpy); |
1282 | |
1244 | |
1283 | hidden_pointer = 1; |
1245 | hidden_pointer = 1; |
1284 | } |
1246 | } |
1285 | |
1247 | |
1286 | void |
1248 | void |
1287 | rxvt_term::pointer_cb (time_watcher &w) |
1249 | rxvt_term::pointer_cb (ev::timer &w, int revents) |
1288 | { |
1250 | { |
1289 | make_current (); |
1251 | make_current (); |
1290 | |
1252 | |
1291 | pointer_blank (); |
1253 | pointer_blank (); |
1292 | } |
1254 | } |
… | |
… | |
1295 | void |
1257 | void |
1296 | rxvt_term::mouse_report (XButtonEvent &ev) |
1258 | rxvt_term::mouse_report (XButtonEvent &ev) |
1297 | { |
1259 | { |
1298 | int button_number, key_state = 0; |
1260 | int button_number, key_state = 0; |
1299 | int x, y; |
1261 | int x, y; |
|
|
1262 | int code = 32; |
1300 | |
1263 | |
1301 | x = ev.x; |
1264 | x = Pixel2Col (ev.x); |
1302 | y = ev.y; |
1265 | y = Pixel2Row (ev.y); |
1303 | pixel_position (&x, &y); |
1266 | if (ev.type == MotionNotify) |
|
|
1267 | { |
|
|
1268 | if (x == mouse_row && y == mouse_col) |
|
|
1269 | return; |
|
|
1270 | mouse_row = x; |
|
|
1271 | mouse_col = y; |
|
|
1272 | code += 32; |
|
|
1273 | } |
1304 | |
1274 | |
1305 | if (MEvent.button == AnyButton) |
1275 | if (MEvent.button == AnyButton) |
1306 | button_number = 3; |
1276 | button_number = 3; |
1307 | else |
1277 | else |
1308 | { |
1278 | { |
… | |
… | |
1354 | x + 1, |
1324 | x + 1, |
1355 | y + 1); |
1325 | y + 1); |
1356 | #endif |
1326 | #endif |
1357 | |
1327 | |
1358 | tt_printf ("\033[M%c%c%c", |
1328 | tt_printf ("\033[M%c%c%c", |
1359 | (32 + button_number + key_state), |
1329 | (code + button_number + key_state), |
1360 | (32 + x + 1), |
1330 | (32 + x + 1), |
1361 | (32 + y + 1)); |
1331 | (32 + y + 1)); |
1362 | } |
1332 | } |
1363 | |
1333 | |
1364 | /*{{{ process an X event */ |
1334 | /*{{{ process an X event */ |
… | |
… | |
1426 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
1396 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
1427 | focus_out (); |
1397 | focus_out (); |
1428 | } |
1398 | } |
1429 | #endif |
1399 | #endif |
1430 | } |
1400 | } |
1431 | break; |
|
|
1432 | |
|
|
1433 | case MappingNotify: |
|
|
1434 | XRefreshKeyboardMapping (&ev.xmapping); |
|
|
1435 | break; |
1401 | break; |
1436 | |
1402 | |
1437 | /* |
1403 | /* |
1438 | * XXX: this is not the _current_ arrangement |
1404 | * XXX: this is not the _current_ arrangement |
1439 | * Here's my conclusion: |
1405 | * Here's my conclusion: |
… | |
… | |
1458 | break; |
1424 | break; |
1459 | } |
1425 | } |
1460 | break; |
1426 | break; |
1461 | |
1427 | |
1462 | case FocusIn: |
1428 | case FocusIn: |
1463 | if (ev.xfocus.detail != NotifyInferior && ev.xfocus.detail != NotifyPointer) |
1429 | if (ev.xfocus.detail != NotifyInferior |
|
|
1430 | && ev.xfocus.detail != NotifyPointer |
|
|
1431 | && ev.xfocus.mode != NotifyGrab) |
1464 | focus_in (); |
1432 | focus_in (); |
1465 | break; |
1433 | break; |
1466 | |
1434 | |
1467 | case FocusOut: |
1435 | case FocusOut: |
1468 | if (ev.xfocus.detail != NotifyInferior && ev.xfocus.detail != NotifyPointer) |
1436 | if (ev.xfocus.detail != NotifyInferior |
|
|
1437 | && ev.xfocus.detail != NotifyPointer |
|
|
1438 | && ev.xfocus.mode != NotifyGrab) |
1469 | focus_out (); |
1439 | focus_out (); |
1470 | break; |
1440 | break; |
1471 | |
1441 | |
1472 | case ConfigureNotify: |
1442 | case ConfigureNotify: |
|
|
1443 | fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n", |
|
|
1444 | ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y, |
|
|
1445 | szHint.width, szHint.height); |
1473 | if (ev.xconfigure.window == parent[0]) |
1446 | if (ev.xconfigure.window == parent[0]) |
1474 | { |
1447 | { |
1475 | while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) |
1448 | //while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) |
1476 | ; |
1449 | ; |
1477 | |
1450 | |
1478 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1451 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1479 | { |
1452 | { |
1480 | seen_resize = 1; |
1453 | seen_resize = 1; |
1481 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1454 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1482 | } |
1455 | } |
|
|
1456 | else |
|
|
1457 | { |
|
|
1458 | #ifdef HAVE_BG_PIXMAP |
|
|
1459 | if (bgPixmap.window_position_sensitive ()) |
|
|
1460 | { |
|
|
1461 | if (mapped) |
|
|
1462 | update_background (); |
|
|
1463 | else |
|
|
1464 | bgPixmap.invalidate (); |
|
|
1465 | } |
|
|
1466 | #endif |
|
|
1467 | } |
1483 | |
1468 | |
1484 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1469 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1485 | |
|
|
1486 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
|
|
1487 | if (OPTION (Opt_transparent)) |
|
|
1488 | check_our_parents (); |
|
|
1489 | #endif |
|
|
1490 | } |
1470 | } |
1491 | break; |
1471 | break; |
1492 | |
1472 | |
1493 | case PropertyNotify: |
1473 | case PropertyNotify: |
1494 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1474 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
… | |
… | |
1510 | case SelectionRequest: |
1490 | case SelectionRequest: |
1511 | selection_send (ev.xselectionrequest); |
1491 | selection_send (ev.xselectionrequest); |
1512 | break; |
1492 | break; |
1513 | |
1493 | |
1514 | case MapNotify: |
1494 | case MapNotify: |
|
|
1495 | #ifdef HAVE_BG_PIXMAP |
|
|
1496 | /* This is needed spcifically to fix the case of no window manager or a |
|
|
1497 | * non-reparenting window manager. In those cases we never get first |
|
|
1498 | * ConfigureNotify. Also that speeds startup under normal WM, by taking |
|
|
1499 | * care of multiplicity of ConfigureNotify events arriwing while WM does |
|
|
1500 | * reparenting. |
|
|
1501 | * We should not render background immidiately, as there could be several |
|
|
1502 | * ConfigureNotify's to follow. Lets take care of all of them in one scoop |
|
|
1503 | * by scheduling background redraw as soon as we can, but giving a short |
|
|
1504 | * bit of time for ConfigureNotifies to arrive. |
|
|
1505 | * We should render background PRIOR to drawing any text, but AFTER all |
|
|
1506 | * of ConfigureNotifys for the best results. |
|
|
1507 | */ |
|
|
1508 | if (bgPixmap.flags & bgPixmap_t::isInvalid) |
|
|
1509 | update_background_ev.start (0.025); |
|
|
1510 | #endif |
1515 | mapped = 1; |
1511 | mapped = 1; |
1516 | #ifdef TEXT_BLINK |
1512 | #ifdef TEXT_BLINK |
1517 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
1513 | text_blink_ev.start (); |
1518 | #endif |
1514 | #endif |
1519 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1515 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1520 | break; |
1516 | break; |
1521 | |
1517 | |
1522 | case UnmapNotify: |
1518 | case UnmapNotify: |
… | |
… | |
1524 | #ifdef TEXT_BLINK |
1520 | #ifdef TEXT_BLINK |
1525 | text_blink_ev.stop (); |
1521 | text_blink_ev.stop (); |
1526 | #endif |
1522 | #endif |
1527 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1523 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1528 | break; |
1524 | break; |
1529 | |
|
|
1530 | #ifdef TRANSPARENT |
|
|
1531 | case ReparentNotify: |
|
|
1532 | rootwin_cb (ev); |
|
|
1533 | break; |
|
|
1534 | #endif /* TRANSPARENT */ |
|
|
1535 | |
1525 | |
1536 | case GraphicsExpose: |
1526 | case GraphicsExpose: |
1537 | case Expose: |
1527 | case Expose: |
1538 | if (ev.xany.window == vt) |
1528 | if (ev.xany.window == vt) |
1539 | { |
1529 | { |
1540 | do |
1530 | do |
|
|
1531 | { |
1541 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1532 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1542 | ev.xexpose.width, ev.xexpose.height, False); |
1533 | ev.xexpose.width, ev.xexpose.height, False); |
|
|
1534 | } |
1543 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); |
1535 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); |
1544 | |
1536 | |
1545 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1537 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1546 | |
1538 | |
1547 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) |
1539 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) |
|
|
1540 | { |
1548 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1541 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1549 | ev.xexpose.width, ev.xexpose.height, False); |
1542 | ev.xexpose.width, ev.xexpose.height, False); |
|
|
1543 | } |
1550 | |
1544 | |
1551 | want_refresh = 1; |
1545 | want_refresh = 1; |
1552 | } |
1546 | } |
1553 | else |
1547 | else |
1554 | { |
1548 | { |
… | |
… | |
1557 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event)) |
1551 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event)) |
1558 | ; |
1552 | ; |
1559 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) |
1553 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) |
1560 | ; |
1554 | ; |
1561 | |
1555 | |
1562 | if (isScrollbarWindow (ev.xany.window)) |
1556 | if (scrollBar.state && ev.xany.window == scrollBar.win) |
1563 | { |
1557 | { |
1564 | scrollBar.setIdle (); |
1558 | scrollBar.setIdle (); |
1565 | scrollbar_show (0); |
1559 | scrollbar_show (0); |
1566 | } |
1560 | } |
1567 | |
|
|
1568 | #ifdef TRANSPARENT |
|
|
1569 | if (am_transparent && ev.xany.window == parent[0]) |
|
|
1570 | XClearWindow (dpy, ev.xany.window); |
|
|
1571 | #endif |
|
|
1572 | } |
1561 | } |
1573 | break; |
1562 | break; |
1574 | |
1563 | |
1575 | case MotionNotify: |
1564 | case MotionNotify: |
1576 | #ifdef POINTER_BLANK |
1565 | #ifdef POINTER_BLANK |
1577 | if (hidden_pointer) |
1566 | if (hidden_pointer) |
1578 | pointer_unblank (); |
1567 | pointer_unblank (); |
1579 | #endif |
1568 | #endif |
|
|
1569 | if ((priv_modes & PrivMode_MouseBtnEvent && ev.xbutton.state & (Button1Mask|Button2Mask|Button3Mask)) |
|
|
1570 | || priv_modes & PrivMode_MouseAnyEvent) |
|
|
1571 | mouse_report (ev.xbutton); |
1580 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1572 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1581 | break; |
1573 | break; |
1582 | |
1574 | |
1583 | if (ev.xany.window == vt) |
1575 | if (ev.xany.window == vt) |
1584 | { |
1576 | { |
… | |
… | |
1618 | int dist; |
1610 | int dist; |
1619 | |
1611 | |
1620 | /* don't clobber the current delay if we are |
1612 | /* don't clobber the current delay if we are |
1621 | * already in the middle of scrolling. |
1613 | * already in the middle of scrolling. |
1622 | */ |
1614 | */ |
1623 | if (!sel_scroll_ev.active) |
1615 | if (!sel_scroll_ev.is_active ()) |
1624 | sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); |
1616 | sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
1625 | |
1617 | |
1626 | /* save the event params so we can highlight |
1618 | /* save the event params so we can highlight |
1627 | * the selection in the pending-scroll loop |
1619 | * the selection in the pending-scroll loop |
1628 | */ |
1620 | */ |
1629 | selection_save_x = ev.xbutton.x; |
1621 | selection_save_x = ev.xbutton.x; |
… | |
… | |
1651 | else |
1643 | else |
1652 | { |
1644 | { |
1653 | /* we are within the text window, so we |
1645 | /* we are within the text window, so we |
1654 | * shouldn't be scrolling |
1646 | * shouldn't be scrolling |
1655 | */ |
1647 | */ |
1656 | if (sel_scroll_ev.active) |
|
|
1657 | sel_scroll_ev.stop(); |
1648 | sel_scroll_ev.stop(); |
1658 | } |
1649 | } |
1659 | #endif |
1650 | #endif |
1660 | #ifdef MOUSE_THRESHOLD |
1651 | #ifdef MOUSE_THRESHOLD |
1661 | } |
1652 | } |
1662 | #endif |
1653 | #endif |
1663 | } |
1654 | } |
1664 | } |
1655 | } |
1665 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1656 | else if (scrollbar_isMotion () && ev.xany.window == scrollBar.win) |
1666 | { |
1657 | { |
1667 | while (XCheckTypedWindowEvent (dpy, scrollBar.win, |
1658 | while (XCheckTypedWindowEvent (dpy, scrollBar.win, |
1668 | MotionNotify, &ev)) |
1659 | MotionNotify, &ev)) |
1669 | ; |
1660 | ; |
1670 | |
1661 | |
… | |
… | |
1674 | &ev.xbutton.x, &ev.xbutton.y, |
1665 | &ev.xbutton.x, &ev.xbutton.y, |
1675 | &unused_mask); |
1666 | &unused_mask); |
1676 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1667 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1677 | scrollbar_size ()); |
1668 | scrollbar_size ()); |
1678 | want_refresh = 1; |
1669 | want_refresh = 1; |
1679 | refresh_limit = 0; |
|
|
1680 | scrollbar_show (1); |
1670 | scrollbar_show (1); |
1681 | } |
1671 | } |
1682 | break; |
1672 | break; |
1683 | } |
1673 | } |
1684 | |
1674 | |
1685 | #if defined(CURSOR_BLINK) |
1675 | #if defined(CURSOR_BLINK) |
1686 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
1676 | if (option (Opt_cursorBlink) && ev.type == KeyPress) |
1687 | { |
1677 | { |
1688 | if (hidden_cursor) |
1678 | if (hidden_cursor) |
1689 | { |
1679 | { |
1690 | hidden_cursor = 0; |
1680 | hidden_cursor = 0; |
1691 | want_refresh = 1; |
1681 | want_refresh = 1; |
1692 | } |
1682 | } |
1693 | |
1683 | |
1694 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1684 | cursor_blink_ev.again (); |
1695 | } |
1685 | } |
1696 | #endif |
1686 | #endif |
1697 | |
1687 | |
1698 | #if defined(POINTER_BLANK) |
1688 | #if defined(POINTER_BLANK) |
1699 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
1689 | if (option (Opt_pointerBlank) && pointerBlankDelay > 0) |
1700 | { |
1690 | { |
1701 | if (ev.type == MotionNotify |
1691 | if (ev.type == MotionNotify |
1702 | || ev.type == ButtonPress |
1692 | || ev.type == ButtonPress |
1703 | || ev.type == ButtonRelease) |
1693 | || ev.type == ButtonRelease) |
1704 | if (hidden_pointer) |
1694 | if (hidden_pointer) |
… | |
… | |
1706 | |
1696 | |
1707 | if (ev.type == KeyPress && hidden_pointer == 0) |
1697 | if (ev.type == KeyPress && hidden_pointer == 0) |
1708 | pointer_blank (); |
1698 | pointer_blank (); |
1709 | } |
1699 | } |
1710 | #endif |
1700 | #endif |
|
|
1701 | |
|
|
1702 | refresh_check (); |
1711 | } |
1703 | } |
1712 | |
1704 | |
1713 | void |
1705 | void |
1714 | rxvt_term::focus_in () |
1706 | rxvt_term::focus_in () |
1715 | { |
1707 | { |
… | |
… | |
1726 | IMSetPosition (); |
1718 | IMSetPosition (); |
1727 | XSetICFocus (Input_Context); |
1719 | XSetICFocus (Input_Context); |
1728 | } |
1720 | } |
1729 | #endif |
1721 | #endif |
1730 | #if CURSOR_BLINK |
1722 | #if CURSOR_BLINK |
1731 | if (OPTION (Opt_cursorBlink)) |
1723 | if (option (Opt_cursorBlink)) |
1732 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1724 | cursor_blink_ev.again (); |
1733 | #endif |
1725 | #endif |
1734 | #if OFF_FOCUS_FADING |
1726 | #if OFF_FOCUS_FADING |
1735 | if (rs[Rs_fade]) |
1727 | if (rs[Rs_fade]) |
1736 | { |
1728 | { |
1737 | pix_colors = pix_colors_focused; |
1729 | pix_colors = pix_colors_focused; |
1738 | scr_recolour (); |
1730 | scr_recolour (); |
1739 | } |
1731 | } |
1740 | #endif |
1732 | #endif |
|
|
1733 | #if ENABLE_FRILLS |
|
|
1734 | if (option (Opt_urgentOnBell)) |
|
|
1735 | { |
|
|
1736 | if (XWMHints *h = XGetWMHints(dpy, parent[0])) |
|
|
1737 | { |
|
|
1738 | h->flags &= ~XUrgencyHint; |
|
|
1739 | XSetWMHints (dpy, parent[0], h); |
|
|
1740 | } |
|
|
1741 | } |
|
|
1742 | #endif |
1741 | } |
1743 | } |
1742 | } |
1744 | } |
1743 | |
1745 | |
1744 | void |
1746 | void |
1745 | rxvt_term::focus_out () |
1747 | rxvt_term::focus_out () |
… | |
… | |
1753 | |
1755 | |
1754 | #if ENABLE_FRILLS || ISO_14755 |
1756 | #if ENABLE_FRILLS || ISO_14755 |
1755 | if (iso14755buf) |
1757 | if (iso14755buf) |
1756 | { |
1758 | { |
1757 | iso14755buf = 0; |
1759 | iso14755buf = 0; |
1758 | # if ENABLE_OVERLAY |
1760 | # if ISO_14755 |
1759 | scr_overlay_off (); |
1761 | scr_overlay_off (); |
1760 | # endif |
1762 | # endif |
1761 | } |
1763 | } |
1762 | #endif |
1764 | #endif |
1763 | #if USE_XIM |
1765 | #if USE_XIM |
1764 | if (Input_Context != NULL) |
1766 | if (Input_Context != NULL) |
1765 | XUnsetICFocus (Input_Context); |
1767 | XUnsetICFocus (Input_Context); |
1766 | #endif |
1768 | #endif |
1767 | #if CURSOR_BLINK |
1769 | #if CURSOR_BLINK |
1768 | if (OPTION (Opt_cursorBlink)) |
1770 | if (option (Opt_cursorBlink)) |
1769 | cursor_blink_ev.stop (); |
1771 | cursor_blink_ev.stop (); |
|
|
1772 | |
1770 | hidden_cursor = 0; |
1773 | hidden_cursor = 0; |
1771 | #endif |
1774 | #endif |
1772 | #if OFF_FOCUS_FADING |
1775 | #if OFF_FOCUS_FADING |
1773 | if (rs[Rs_fade]) |
1776 | if (rs[Rs_fade]) |
1774 | { |
1777 | { |
… | |
… | |
1790 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
1793 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
1791 | } |
1794 | } |
1792 | #endif |
1795 | #endif |
1793 | } |
1796 | } |
1794 | |
1797 | |
1795 | #if TRANSPARENT || ENABLE_PERL |
1798 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1796 | void |
1799 | void |
1797 | rxvt_term::rootwin_cb (XEvent &ev) |
1800 | rxvt_term::rootwin_cb (XEvent &ev) |
1798 | { |
1801 | { |
1799 | make_current (); |
1802 | make_current (); |
1800 | |
1803 | |
1801 | if (SHOULD_INVOKE (HOOK_ROOT_EVENT) |
1804 | if (SHOULD_INVOKE (HOOK_ROOT_EVENT) |
1802 | && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) |
1805 | && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) |
1803 | return; |
1806 | return; |
1804 | |
1807 | |
1805 | # if TRANSPARENT |
1808 | # if ENABLE_TRANSPARENCY |
1806 | switch (ev.type) |
1809 | switch (ev.type) |
1807 | { |
1810 | { |
1808 | case PropertyNotify: |
1811 | case PropertyNotify: |
1809 | /* |
1812 | /* |
1810 | * if user used some Esetroot compatible prog to set the root bg, |
1813 | * if user used some Esetroot compatible prog to set the root bg, |
1811 | * use the property to determine the pixmap. We use it later on. |
1814 | * use the property to determine the pixmap. We use it later on. |
1812 | */ |
1815 | */ |
1813 | if (ev.xproperty.atom != xa[XA_XROOTPMAP_ID] |
1816 | if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] |
1814 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1817 | || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) |
1815 | return; |
1818 | { |
|
|
1819 | bgPixmap.set_root_pixmap (); |
|
|
1820 | update_background (); |
|
|
1821 | } |
1816 | |
1822 | |
1817 | /* FALLTHROUGH */ |
|
|
1818 | case ReparentNotify: |
|
|
1819 | if (OPTION (Opt_transparent) && check_our_parents () && am_transparent) |
|
|
1820 | want_refresh = want_full_refresh = 1; |
|
|
1821 | break; |
1823 | break; |
1822 | } |
1824 | } |
1823 | # endif |
1825 | # endif |
|
|
1826 | |
|
|
1827 | refresh_check (); |
1824 | } |
1828 | } |
1825 | #endif |
1829 | #endif |
1826 | |
1830 | |
1827 | void |
1831 | void |
1828 | rxvt_term::button_press (XButtonEvent &ev) |
1832 | rxvt_term::button_press (XButtonEvent &ev) |
… | |
… | |
1883 | mouse_report (ev); |
1887 | mouse_report (ev); |
1884 | } |
1888 | } |
1885 | #else |
1889 | #else |
1886 | MEvent.button = ev.button; |
1890 | MEvent.button = ev.button; |
1887 | mouse_report (ev); |
1891 | mouse_report (ev); |
1888 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
1892 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
1889 | |
1893 | |
1890 | } |
1894 | } |
1891 | else |
1895 | else |
1892 | { |
1896 | { |
1893 | if (ev.button != MEvent.button) |
1897 | if (ev.button != MEvent.button) |
… | |
… | |
1941 | } |
1945 | } |
1942 | |
1946 | |
1943 | /* |
1947 | /* |
1944 | * Scrollbar window processing of button press |
1948 | * Scrollbar window processing of button press |
1945 | */ |
1949 | */ |
1946 | if (isScrollbarWindow (ev.window)) |
1950 | if (scrollBar.state && ev.window == scrollBar.win) |
1947 | { |
1951 | { |
1948 | scrollBar.setIdle (); |
1952 | scrollBar.setIdle (); |
1949 | /* |
1953 | /* |
1950 | * Rxvt-style scrollbar: |
1954 | * Rxvt-style scrollbar: |
1951 | * move up if mouse is above slider |
1955 | * move up if mouse is above slider |
… | |
… | |
1987 | tt_printf ("\033[5~"); |
1991 | tt_printf ("\033[5~"); |
1988 | break; |
1992 | break; |
1989 | } |
1993 | } |
1990 | } |
1994 | } |
1991 | else |
1995 | else |
1992 | #endif /* NO_SCROLLBAR_REPORT */ |
1996 | #endif /* NO_SCROLLBAR_REPORT */ |
1993 | |
1997 | |
1994 | { |
1998 | { |
1995 | char upordown = 0; |
1999 | char upordown = 0; |
1996 | |
2000 | |
1997 | if (scrollBar.style == R_SB_NEXT) |
2001 | if (scrollBar.style == R_SB_NEXT) |
1998 | { |
2002 | { |
1999 | if (scrollbarnext_upButton (ev.y)) |
2003 | if (scrollbarnext_upButton (ev.y)) |
2000 | upordown = -1; /* up */ |
2004 | upordown = -1; /* up */ |
… | |
… | |
2006 | if (scrollbarrxvt_upButton (ev.y)) |
2010 | if (scrollbarrxvt_upButton (ev.y)) |
2007 | upordown = -1; /* up */ |
2011 | upordown = -1; /* up */ |
2008 | else if (scrollbarrxvt_dnButton (ev.y)) |
2012 | else if (scrollbarrxvt_dnButton (ev.y)) |
2009 | upordown = 1; /* down */ |
2013 | upordown = 1; /* down */ |
2010 | } |
2014 | } |
|
|
2015 | |
2011 | if (upordown) |
2016 | if (upordown) |
2012 | { |
2017 | { |
2013 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
2018 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
2019 | if (!cont_scroll_ev.is_active ()) |
2014 | cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); |
2020 | cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
2015 | #endif |
2021 | #endif |
2016 | if (scr_page (upordown < 0 ? UP : DN, 1)) |
2022 | if (scr_page (upordown < 0 ? UP : DN, 1)) |
2017 | { |
2023 | { |
2018 | if (upordown < 0) |
2024 | if (upordown < 0) |
2019 | scrollBar.setUp (); |
2025 | scrollBar.setUp (); |
… | |
… | |
2023 | } |
2029 | } |
2024 | else |
2030 | else |
2025 | switch (ev.button) |
2031 | switch (ev.button) |
2026 | { |
2032 | { |
2027 | case Button2: |
2033 | case Button2: |
2028 | switch (scrollbar_align) |
2034 | switch (scrollBar.align) |
2029 | { |
2035 | { |
2030 | case R_SB_ALIGN_TOP: |
2036 | case R_SB_ALIGN_TOP: |
2031 | csrO = 0; |
2037 | csrO = 0; |
2032 | break; |
2038 | break; |
2033 | case R_SB_ALIGN_CENTRE: |
2039 | case R_SB_ALIGN_CENTRE: |
… | |
… | |
2045 | |
2051 | |
2046 | scrollBar.setMotion (); |
2052 | scrollBar.setMotion (); |
2047 | break; |
2053 | break; |
2048 | |
2054 | |
2049 | case Button1: |
2055 | case Button1: |
2050 | if (scrollbar_align == R_SB_ALIGN_CENTRE) |
2056 | if (scrollBar.align == R_SB_ALIGN_CENTRE) |
2051 | csrO = ev.y - scrollBar.top; |
2057 | csrO = ev.y - scrollBar.top; |
2052 | /* FALLTHROUGH */ |
2058 | /* FALLTHROUGH */ |
2053 | |
2059 | |
2054 | case Button3: |
2060 | case Button3: |
2055 | if (scrollBar.style != R_SB_XTERM) |
2061 | if (scrollBar.style != R_SB_XTERM) |
… | |
… | |
2099 | scrollBar.setIdle (); |
2105 | scrollBar.setIdle (); |
2100 | scrollbar_show (0); |
2106 | scrollbar_show (0); |
2101 | } |
2107 | } |
2102 | |
2108 | |
2103 | #ifdef SELECTION_SCROLLING |
2109 | #ifdef SELECTION_SCROLLING |
2104 | if (sel_scroll_ev.active) |
|
|
2105 | sel_scroll_ev.stop(); |
2110 | sel_scroll_ev.stop(); |
2106 | #endif |
2111 | #endif |
2107 | |
2112 | |
2108 | if (ev.window == vt) |
2113 | if (ev.window == vt) |
2109 | { |
2114 | { |
2110 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
2115 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
… | |
… | |
2134 | mouse_report (ev); |
2139 | mouse_report (ev); |
2135 | } |
2140 | } |
2136 | #else /* MOUSE_REPORT_DOUBLECLICK */ |
2141 | #else /* MOUSE_REPORT_DOUBLECLICK */ |
2137 | MEvent.button = AnyButton; |
2142 | MEvent.button = AnyButton; |
2138 | mouse_report (ev); |
2143 | mouse_report (ev); |
2139 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
2144 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
2140 | return; |
2145 | return; |
2141 | } |
2146 | } |
2142 | |
2147 | |
2143 | /* |
2148 | /* |
2144 | * dumb hack to compensate for the failure of click-and-drag |
2149 | * dumb hack to compensate for the failure of click-and-drag |
… | |
… | |
2156 | selection_make (ev.time); |
2161 | selection_make (ev.time); |
2157 | break; |
2162 | break; |
2158 | |
2163 | |
2159 | case Button2: |
2164 | case Button2: |
2160 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
2165 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
2161 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary); |
2166 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Clipboard : Sel_Primary); |
2162 | break; |
2167 | break; |
2163 | |
2168 | |
2164 | #ifdef MOUSE_WHEEL |
2169 | #ifdef MOUSE_WHEEL |
2165 | case Button4: |
2170 | case Button4: |
2166 | case Button5: |
2171 | case Button5: |
… | |
… | |
2170 | |
2175 | |
2171 | v = ev.button == Button4 ? UP : DN; |
2176 | v = ev.button == Button4 ? UP : DN; |
2172 | |
2177 | |
2173 | if (ev.state & ShiftMask) |
2178 | if (ev.state & ShiftMask) |
2174 | i = 1; |
2179 | i = 1; |
2175 | else if (OPTION (Opt_mouseWheelScrollPage)) |
2180 | else if (option (Opt_mouseWheelScrollPage)) |
2176 | i = nrow - 1; |
2181 | i = nrow - 1; |
2177 | else |
2182 | else |
2178 | i = 5; |
2183 | i = 5; |
2179 | |
2184 | |
2180 | # ifdef MOUSE_SLIP_WHEELING |
2185 | # ifdef MOUSE_SLIP_WHEELING |
… | |
… | |
2182 | { |
2187 | { |
2183 | mouse_slip_wheel_speed += v ? -1 : 1; |
2188 | mouse_slip_wheel_speed += v ? -1 : 1; |
2184 | if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; |
2189 | if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; |
2185 | if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; |
2190 | if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; |
2186 | |
2191 | |
2187 | if (slip_wheel_ev.at < NOW) |
2192 | if (!slip_wheel_ev.is_active ()) |
2188 | slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY; |
2193 | slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
2189 | |
|
|
2190 | slip_wheel_ev.start (); |
|
|
2191 | } |
2194 | } |
2192 | else |
2195 | else |
|
|
2196 | # endif |
2193 | { |
2197 | { |
2194 | # endif |
|
|
2195 | scr_page (v, i); |
2198 | scr_page (v, i); |
2196 | scrollbar_show (1); |
2199 | scrollbar_show (1); |
2197 | # ifdef MOUSE_SLIP_WHEELING |
|
|
2198 | } |
2200 | } |
2199 | # endif |
|
|
2200 | } |
2201 | } |
2201 | break; |
2202 | break; |
2202 | #endif |
2203 | #endif |
2203 | } |
2204 | } |
2204 | } |
2205 | } |
2205 | } |
2206 | } |
2206 | |
|
|
2207 | #ifdef TRANSPARENT |
|
|
2208 | #if TINTING |
|
|
2209 | /* taken from aterm-0.4.2 */ |
|
|
2210 | |
|
|
2211 | typedef uint32_t RUINT32T; |
|
|
2212 | |
|
|
2213 | void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm) |
|
|
2214 | { |
|
|
2215 | int sh_r, sh_g, sh_b; |
|
|
2216 | RUINT32T mask_r, mask_g, mask_b; |
|
|
2217 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
|
|
2218 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
|
|
2219 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
|
|
2220 | int i; |
|
|
2221 | |
|
|
2222 | Visual *visual = term->visual; |
|
|
2223 | |
|
|
2224 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
|
|
2225 | |
|
|
2226 | /* for convenience */ |
|
|
2227 | mask_r = visual->red_mask; |
|
|
2228 | mask_g = visual->green_mask; |
|
|
2229 | mask_b = visual->blue_mask; |
|
|
2230 | |
|
|
2231 | /* boring lookup table pre-initialization */ |
|
|
2232 | switch (srcImage->bits_per_pixel) { |
|
|
2233 | case 15: |
|
|
2234 | if ((mask_r != 0x7c00) || |
|
|
2235 | (mask_g != 0x03e0) || |
|
|
2236 | (mask_b != 0x001f)) |
|
|
2237 | return; |
|
|
2238 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+32+32)); |
|
|
2239 | lookup_r = lookup; |
|
|
2240 | lookup_g = lookup+32; |
|
|
2241 | lookup_b = lookup+32+32; |
|
|
2242 | sh_r = 10; |
|
|
2243 | sh_g = 5; |
|
|
2244 | sh_b = 0; |
|
|
2245 | break; |
|
|
2246 | case 16: |
|
|
2247 | if ((mask_r != 0xf800) || |
|
|
2248 | (mask_g != 0x07e0) || |
|
|
2249 | (mask_b != 0x001f)) |
|
|
2250 | return; |
|
|
2251 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+64+32)); |
|
|
2252 | lookup_r = lookup; |
|
|
2253 | lookup_g = lookup+32; |
|
|
2254 | lookup_b = lookup+32+64; |
|
|
2255 | sh_r = 11; |
|
|
2256 | sh_g = 5; |
|
|
2257 | sh_b = 0; |
|
|
2258 | break; |
|
|
2259 | case 24: |
|
|
2260 | if ((mask_r != 0xff0000) || |
|
|
2261 | (mask_g != 0x00ff00) || |
|
|
2262 | (mask_b != 0x0000ff)) |
|
|
2263 | return; |
|
|
2264 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
|
|
2265 | lookup_r = lookup; |
|
|
2266 | lookup_g = lookup+256; |
|
|
2267 | lookup_b = lookup+256+256; |
|
|
2268 | sh_r = 16; |
|
|
2269 | sh_g = 8; |
|
|
2270 | sh_b = 0; |
|
|
2271 | break; |
|
|
2272 | case 32: |
|
|
2273 | if ((mask_r != 0xff0000) || |
|
|
2274 | (mask_g != 0x00ff00) || |
|
|
2275 | (mask_b != 0x0000ff)) |
|
|
2276 | return; |
|
|
2277 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
|
|
2278 | lookup_r = lookup; |
|
|
2279 | lookup_g = lookup+256; |
|
|
2280 | lookup_b = lookup+256+256; |
|
|
2281 | sh_r = 16; |
|
|
2282 | sh_g = 8; |
|
|
2283 | sh_b = 0; |
|
|
2284 | break; |
|
|
2285 | default: |
|
|
2286 | return; /* we do not support this color depth */ |
|
|
2287 | } |
|
|
2288 | |
|
|
2289 | /* prepare limits for color transformation (each channel is handled separately) */ |
|
|
2290 | if (shade < 0) { |
|
|
2291 | shade = -shade; |
|
|
2292 | if (shade < 0) shade = 0; |
|
|
2293 | if (shade > 100) shade = 100; |
|
|
2294 | |
|
|
2295 | lower_lim_r = 65535-rm; |
|
|
2296 | lower_lim_g = 65535-gm; |
|
|
2297 | lower_lim_b = 65535-bm; |
|
|
2298 | |
|
|
2299 | lower_lim_r = 65535-(unsigned int)(((RUINT32T)lower_lim_r)*((RUINT32T)shade)/100); |
|
|
2300 | lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100); |
|
|
2301 | lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100); |
|
|
2302 | |
|
|
2303 | upper_lim_r = upper_lim_g = upper_lim_b = 65535; |
|
|
2304 | } else { |
|
|
2305 | if (shade < 0) shade = 0; |
|
|
2306 | if (shade > 100) shade = 100; |
|
|
2307 | |
|
|
2308 | lower_lim_r = lower_lim_g = lower_lim_b = 0; |
|
|
2309 | |
|
|
2310 | upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100); |
|
|
2311 | upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100); |
|
|
2312 | upper_lim_b = (unsigned int)((((RUINT32T)bm)*((RUINT32T)shade))/100); |
|
|
2313 | } |
|
|
2314 | |
|
|
2315 | /* switch red and blue bytes if necessary, we need it for some weird XServers like XFree86 3.3.3.1 */ |
|
|
2316 | if ((srcImage->bits_per_pixel == 24) && (mask_r >= 0xFF0000 )) |
|
|
2317 | { |
|
|
2318 | unsigned int tmp; |
|
|
2319 | |
|
|
2320 | tmp = lower_lim_r; |
|
|
2321 | lower_lim_r = lower_lim_b; |
|
|
2322 | lower_lim_b = tmp; |
|
|
2323 | |
|
|
2324 | tmp = upper_lim_r; |
|
|
2325 | upper_lim_r = upper_lim_b; |
|
|
2326 | upper_lim_b = tmp; |
|
|
2327 | } |
|
|
2328 | |
|
|
2329 | /* fill our lookup tables */ |
|
|
2330 | for (i = 0; i <= mask_r>>sh_r; i++) |
|
|
2331 | { |
|
|
2332 | RUINT32T tmp; |
|
|
2333 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_r-lower_lim_r)); |
|
|
2334 | tmp += ((RUINT32T)(mask_r>>sh_r))*((RUINT32T)lower_lim_r); |
|
|
2335 | lookup_r[i] = (tmp/65535)<<sh_r; |
|
|
2336 | } |
|
|
2337 | for (i = 0; i <= mask_g>>sh_g; i++) |
|
|
2338 | { |
|
|
2339 | RUINT32T tmp; |
|
|
2340 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_g-lower_lim_g)); |
|
|
2341 | tmp += ((RUINT32T)(mask_g>>sh_g))*((RUINT32T)lower_lim_g); |
|
|
2342 | lookup_g[i] = (tmp/65535)<<sh_g; |
|
|
2343 | } |
|
|
2344 | for (i = 0; i <= mask_b>>sh_b; i++) |
|
|
2345 | { |
|
|
2346 | RUINT32T tmp; |
|
|
2347 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_b-lower_lim_b)); |
|
|
2348 | tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b); |
|
|
2349 | lookup_b[i] = (tmp/65535)<<sh_b; |
|
|
2350 | } |
|
|
2351 | |
|
|
2352 | /* apply table to input image (replacing colors by newly calculated ones) */ |
|
|
2353 | switch (srcImage->bits_per_pixel) |
|
|
2354 | { |
|
|
2355 | case 15: |
|
|
2356 | { |
|
|
2357 | unsigned short *p1, *pf, *p, *pl; |
|
|
2358 | p1 = (unsigned short *) srcImage->data; |
|
|
2359 | pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2360 | while (p1 < pf) |
|
|
2361 | { |
|
|
2362 | p = p1; |
|
|
2363 | pl = p1 + srcImage->width; |
|
|
2364 | for (; p < pl; p++) |
|
|
2365 | { |
|
|
2366 | *p = lookup_r[(*p & 0x7c00)>>10] | |
|
|
2367 | lookup_g[(*p & 0x03e0)>> 5] | |
|
|
2368 | lookup_b[(*p & 0x001f)]; |
|
|
2369 | } |
|
|
2370 | p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2371 | } |
|
|
2372 | break; |
|
|
2373 | } |
|
|
2374 | case 16: |
|
|
2375 | { |
|
|
2376 | unsigned short *p1, *pf, *p, *pl; |
|
|
2377 | p1 = (unsigned short *) srcImage->data; |
|
|
2378 | pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2379 | while (p1 < pf) |
|
|
2380 | { |
|
|
2381 | p = p1; |
|
|
2382 | pl = p1 + srcImage->width; |
|
|
2383 | for (; p < pl; p++) |
|
|
2384 | { |
|
|
2385 | *p = lookup_r[(*p & 0xf800)>>11] | |
|
|
2386 | lookup_g[(*p & 0x07e0)>> 5] | |
|
|
2387 | lookup_b[(*p & 0x001f)]; |
|
|
2388 | } |
|
|
2389 | p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2390 | } |
|
|
2391 | break; |
|
|
2392 | } |
|
|
2393 | case 24: |
|
|
2394 | { |
|
|
2395 | unsigned char *p1, *pf, *p, *pl; |
|
|
2396 | p1 = (unsigned char *) srcImage->data; |
|
|
2397 | pf = (unsigned char *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2398 | while (p1 < pf) |
|
|
2399 | { |
|
|
2400 | p = p1; |
|
|
2401 | pl = p1 + srcImage->width * 3; |
|
|
2402 | for (; p < pl; p += 3) |
|
|
2403 | { |
|
|
2404 | p[0] = lookup_r[(p[0] & 0xff0000)>>16]; |
|
|
2405 | p[1] = lookup_r[(p[1] & 0x00ff00)>> 8]; |
|
|
2406 | p[2] = lookup_r[(p[2] & 0x0000ff)]; |
|
|
2407 | } |
|
|
2408 | p1 = (unsigned char *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2409 | } |
|
|
2410 | break; |
|
|
2411 | } |
|
|
2412 | case 32: |
|
|
2413 | { |
|
|
2414 | RUINT32T *p1, *pf, *p, *pl; |
|
|
2415 | p1 = (RUINT32T *) srcImage->data; |
|
|
2416 | pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2417 | |
|
|
2418 | while (p1 < pf) |
|
|
2419 | { |
|
|
2420 | p = p1; |
|
|
2421 | pl = p1 + srcImage->width; |
|
|
2422 | for (; p < pl; p++) |
|
|
2423 | { |
|
|
2424 | *p = lookup_r[(*p & 0xff0000)>>16] | |
|
|
2425 | lookup_g[(*p & 0x00ff00)>> 8] | |
|
|
2426 | lookup_b[(*p & 0x0000ff)] | |
|
|
2427 | (*p & ~0xffffff); |
|
|
2428 | } |
|
|
2429 | p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2430 | } |
|
|
2431 | break; |
|
|
2432 | } |
|
|
2433 | } |
|
|
2434 | |
|
|
2435 | free (lookup); |
|
|
2436 | } |
|
|
2437 | #endif |
|
|
2438 | |
|
|
2439 | /* |
|
|
2440 | * Check our parents are still who we think they are. |
|
|
2441 | * Do transparency updates if required |
|
|
2442 | */ |
|
|
2443 | int |
|
|
2444 | rxvt_term::check_our_parents () |
|
|
2445 | { |
|
|
2446 | int i, pchanged, aformat, have_pixmap, rootdepth; |
|
|
2447 | unsigned long nitems, bytes_after; |
|
|
2448 | Atom atype; |
|
|
2449 | unsigned char *prop = NULL; |
|
|
2450 | Window root, oldp, *list; |
|
|
2451 | Pixmap rootpixmap = None; |
|
|
2452 | XWindowAttributes wattr, wrootattr; |
|
|
2453 | |
|
|
2454 | pchanged = 0; |
|
|
2455 | |
|
|
2456 | if (!OPTION (Opt_transparent)) |
|
|
2457 | return pchanged; /* Don't try any more */ |
|
|
2458 | |
|
|
2459 | XGetWindowAttributes (dpy, display->root, &wrootattr); |
|
|
2460 | rootdepth = wrootattr.depth; |
|
|
2461 | |
|
|
2462 | XGetWindowAttributes (dpy, parent[0], &wattr); |
|
|
2463 | |
|
|
2464 | if (rootdepth != wattr.depth) |
|
|
2465 | { |
|
|
2466 | if (am_transparent) |
|
|
2467 | { |
|
|
2468 | pchanged = 1; |
|
|
2469 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
|
|
2470 | am_transparent = am_pixmap_trans = 0; |
|
|
2471 | } |
|
|
2472 | |
|
|
2473 | return pchanged; /* Don't try any more */ |
|
|
2474 | } |
|
|
2475 | |
|
|
2476 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
|
|
2477 | XSync (dpy, False); |
|
|
2478 | |
|
|
2479 | /* |
|
|
2480 | * Make the frame window set by the window manager have |
|
|
2481 | * the root background. Some window managers put multiple nested frame |
|
|
2482 | * windows for each client, so we have to take care about that. |
|
|
2483 | */ |
|
|
2484 | i = (xa[XA_XROOTPMAP_ID] |
|
|
2485 | && XGetWindowProperty (dpy, display->root, xa[XA_XROOTPMAP_ID], |
|
|
2486 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
2487 | &nitems, &bytes_after, &prop) == Success); |
|
|
2488 | |
|
|
2489 | if (!i || prop == NULL) |
|
|
2490 | i = (xa[XA_ESETROOT_PMAP_ID] |
|
|
2491 | && XGetWindowProperty (dpy, display->root, xa[XA_ESETROOT_PMAP_ID], |
|
|
2492 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
2493 | &nitems, &bytes_after, &prop) == Success); |
|
|
2494 | |
|
|
2495 | if (!i || prop == NULL |
|
|
2496 | #if TINTING |
|
|
2497 | || !ISSET_PIXCOLOR (Color_tint) |
|
|
2498 | #endif |
|
|
2499 | ) |
|
|
2500 | have_pixmap = 0; |
|
|
2501 | else |
|
|
2502 | { |
|
|
2503 | have_pixmap = 1; |
|
|
2504 | rootpixmap = *(Pixmap *)prop; |
|
|
2505 | XFree (prop); |
|
|
2506 | } |
|
|
2507 | |
|
|
2508 | if (have_pixmap) |
|
|
2509 | { |
|
|
2510 | /* |
|
|
2511 | * Copy display->root pixmap transparency |
|
|
2512 | */ |
|
|
2513 | int sx, sy, nx, ny; |
|
|
2514 | unsigned int nw, nh; |
|
|
2515 | Window cr; |
|
|
2516 | XImage *image; |
|
|
2517 | GC gc; |
|
|
2518 | XGCValues gcvalue; |
|
|
2519 | |
|
|
2520 | XTranslateCoordinates (dpy, parent[0], display->root, |
|
|
2521 | 0, 0, &sx, &sy, &cr); |
|
|
2522 | nw = (unsigned int)szHint.width; |
|
|
2523 | nh = (unsigned int)szHint.height; |
|
|
2524 | nx = ny = 0; |
|
|
2525 | |
|
|
2526 | if (sx < 0) |
|
|
2527 | { |
|
|
2528 | nw += sx; |
|
|
2529 | nx = -sx; |
|
|
2530 | sx = 0; |
|
|
2531 | } |
|
|
2532 | |
|
|
2533 | if (sy < 0) |
|
|
2534 | { |
|
|
2535 | nh += sy; |
|
|
2536 | ny = -sy; |
|
|
2537 | sy = 0; |
|
|
2538 | } |
|
|
2539 | |
|
|
2540 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
|
|
2541 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
|
|
2542 | |
|
|
2543 | XSync (dpy, False); |
|
|
2544 | allowedxerror = -1; |
|
|
2545 | image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
|
|
2546 | |
|
|
2547 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
|
|
2548 | /* XXX: may need a delay here? */ |
|
|
2549 | allowedxerror = 0; |
|
|
2550 | |
|
|
2551 | if (image == NULL) |
|
|
2552 | { |
|
|
2553 | if (am_transparent && am_pixmap_trans) |
|
|
2554 | { |
|
|
2555 | pchanged = 1; |
|
|
2556 | if (pixmap != None) |
|
|
2557 | { |
|
|
2558 | XFreePixmap (dpy, pixmap); |
|
|
2559 | pixmap = None; |
|
|
2560 | } |
|
|
2561 | } |
|
|
2562 | |
|
|
2563 | am_pixmap_trans = 0; |
|
|
2564 | } |
|
|
2565 | else |
|
|
2566 | { |
|
|
2567 | if (pixmap != None) |
|
|
2568 | XFreePixmap (dpy, pixmap); |
|
|
2569 | |
|
|
2570 | #if TINTING |
|
|
2571 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
2572 | { |
|
|
2573 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
|
|
2574 | |
|
|
2575 | rgba c; |
|
|
2576 | pix_colors_focused [Color_tint].get (c); |
|
|
2577 | |
|
|
2578 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
|
|
2579 | } |
|
|
2580 | #endif |
|
|
2581 | |
|
|
2582 | pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, image->depth); |
|
|
2583 | gc = XCreateGC (dpy, vt, 0UL, &gcvalue); |
|
|
2584 | XPutImage (dpy, pixmap, gc, image, 0, 0, |
|
|
2585 | nx, ny, image->width, image->height); |
|
|
2586 | XFreeGC (dpy, gc); |
|
|
2587 | XDestroyImage (image); |
|
|
2588 | XSetWindowBackgroundPixmap (dpy, parent[0], pixmap); |
|
|
2589 | XClearWindow (dpy, parent[0]); |
|
|
2590 | |
|
|
2591 | if (!am_transparent || !am_pixmap_trans) |
|
|
2592 | pchanged = 1; |
|
|
2593 | |
|
|
2594 | am_transparent = am_pixmap_trans = 1; |
|
|
2595 | } |
|
|
2596 | } |
|
|
2597 | |
|
|
2598 | if (am_pixmap_trans) |
|
|
2599 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
|
|
2600 | else |
|
|
2601 | { |
|
|
2602 | unsigned int n; |
|
|
2603 | /* |
|
|
2604 | * InheritPixmap transparency |
|
|
2605 | */ |
|
|
2606 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
|
|
2607 | { |
|
|
2608 | oldp = parent[i]; |
|
|
2609 | XQueryTree (dpy, parent[i - 1], &root, &parent[i], &list, &n); |
|
|
2610 | XFree (list); |
|
|
2611 | |
|
|
2612 | if (parent[i] == display->root) |
|
|
2613 | { |
|
|
2614 | if (oldp != None) |
|
|
2615 | pchanged = 1; |
|
|
2616 | |
|
|
2617 | break; |
|
|
2618 | } |
|
|
2619 | |
|
|
2620 | if (oldp != parent[i]) |
|
|
2621 | pchanged = 1; |
|
|
2622 | } |
|
|
2623 | |
|
|
2624 | n = 0; |
|
|
2625 | |
|
|
2626 | if (pchanged) |
|
|
2627 | for (; n < (unsigned int)i; n++) |
|
|
2628 | { |
|
|
2629 | XGetWindowAttributes (dpy, parent[n], &wattr); |
|
|
2630 | |
|
|
2631 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
|
|
2632 | { |
|
|
2633 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
|
|
2634 | break; |
|
|
2635 | } |
|
|
2636 | } |
|
|
2637 | |
|
|
2638 | if (n > (sizeof (parent) / sizeof (parent[0]))) |
|
|
2639 | { |
|
|
2640 | XSetWindowBackground (dpy, parent[0], pix_colors_focused[Color_border]); |
|
|
2641 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
|
|
2642 | am_transparent = 0; |
|
|
2643 | /* XXX: also turn off Opt_transparent? */ |
|
|
2644 | } |
|
|
2645 | else |
|
|
2646 | { |
|
|
2647 | for (n = 0; n < (unsigned int)i; n++) |
|
|
2648 | { |
|
|
2649 | XSetWindowBackgroundPixmap (dpy, parent[n], ParentRelative); |
|
|
2650 | XClearWindow (dpy, parent[n]); |
|
|
2651 | } |
|
|
2652 | |
|
|
2653 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
|
|
2654 | am_transparent = 1; |
|
|
2655 | } |
|
|
2656 | |
|
|
2657 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
|
|
2658 | parent[i] = None; |
|
|
2659 | } |
|
|
2660 | |
|
|
2661 | if (scrollBar.win) |
|
|
2662 | { |
|
|
2663 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
|
|
2664 | scrollBar.setIdle (); |
|
|
2665 | scrollbar_show (0); |
|
|
2666 | } |
|
|
2667 | |
|
|
2668 | if (am_transparent) |
|
|
2669 | { |
|
|
2670 | want_refresh = want_full_refresh = 1; |
|
|
2671 | if (am_pixmap_trans) |
|
|
2672 | flush (); |
|
|
2673 | } |
|
|
2674 | |
|
|
2675 | return pchanged; |
|
|
2676 | } |
|
|
2677 | #endif |
|
|
2678 | |
2207 | |
2679 | /*}}} */ |
2208 | /*}}} */ |
2680 | |
2209 | |
2681 | bool |
2210 | bool |
2682 | rxvt_term::cmd_parse () |
2211 | rxvt_term::cmd_parse () |
… | |
… | |
2731 | if (ch == C0_LF) |
2260 | if (ch == C0_LF) |
2732 | nlines++; |
2261 | nlines++; |
2733 | |
2262 | |
2734 | refresh_count++; |
2263 | refresh_count++; |
2735 | |
2264 | |
2736 | if (!OPTION (Opt_jumpScroll) |
2265 | if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) |
2737 | || (refresh_count >= refresh_limit * (nrow - 1))) |
|
|
2738 | { |
2266 | { |
2739 | refreshnow = true; |
|
|
2740 | refresh_count = 0; |
2267 | refresh_count = 0; |
|
|
2268 | |
|
|
2269 | if (!option (Opt_skipScroll) || ev_time () > ev::now () + 1. / 60.) |
|
|
2270 | { |
|
|
2271 | refreshnow = true; |
2741 | ch = NOCHAR; |
2272 | ch = NOCHAR; |
2742 | break; |
2273 | break; |
|
|
2274 | } |
2743 | } |
2275 | } |
2744 | |
2276 | |
2745 | // scr_add_lines only works for nlines <= nrow - 1. |
2277 | // scr_add_lines only works for nlines <= nrow - 1. |
2746 | if (nlines >= nrow - 1) |
2278 | if (nlines >= nrow - 1) |
2747 | { |
2279 | { |
… | |
… | |
2775 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2307 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2776 | scr_add_lines (buf, str - buf, nlines); |
2308 | scr_add_lines (buf, str - buf, nlines); |
2777 | |
2309 | |
2778 | /* |
2310 | /* |
2779 | * If there have been a lot of new lines, then update the screen |
2311 | * If there have been a lot of new lines, then update the screen |
2780 | * What the heck I'll cheat and only refresh less than every page-full. |
2312 | * What the heck we'll cheat and only refresh less than every page-full. |
2781 | * the number of pages between refreshes is refresh_limit, which |
2313 | * if skipScroll is enabled. |
2782 | * is incremented here because we must be doing flat-out scrolling. |
|
|
2783 | */ |
2314 | */ |
2784 | if (refreshnow) |
2315 | if (refreshnow) |
2785 | { |
2316 | { |
2786 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
|
|
2787 | refresh_limit++; |
|
|
2788 | else |
|
|
2789 | { |
|
|
2790 | flag = true; |
2317 | flag = true; |
2791 | //TODO: due to popular request, implement "skipscroll" option here |
|
|
2792 | scr_refresh (); |
2318 | scr_refresh (); |
2793 | want_refresh = 1; |
2319 | want_refresh = 1; |
2794 | } |
|
|
2795 | } |
2320 | } |
2796 | |
2321 | |
2797 | } |
2322 | } |
2798 | else |
2323 | else |
2799 | { |
2324 | { |
… | |
… | |
2948 | { |
2473 | { |
2949 | if ((buf[len++] = cmd_getc ()) == 'i') |
2474 | if ((buf[len++] = cmd_getc ()) == 'i') |
2950 | break; /* done = 1 */ |
2475 | break; /* done = 1 */ |
2951 | } |
2476 | } |
2952 | } |
2477 | } |
2953 | |
2478 | |
2954 | for (i = 0; i < len; i++) |
2479 | for (i = 0; i < len; i++) |
2955 | if (putc (buf[i], fd) == EOF) |
2480 | if (putc (buf[i], fd) == EOF) |
2956 | { |
2481 | { |
2957 | done = 1; |
2482 | done = 1; |
2958 | break; |
2483 | break; |
… | |
… | |
2960 | } |
2485 | } |
2961 | } |
2486 | } |
2962 | |
2487 | |
2963 | pclose_printer (fd); |
2488 | pclose_printer (fd); |
2964 | } |
2489 | } |
2965 | #endif /* PRINTPIPE */ |
2490 | #endif /* PRINTPIPE */ |
2966 | /*}}} */ |
2491 | /*}}} */ |
2967 | |
2492 | |
2968 | /* *INDENT-OFF* */ |
2493 | /* *INDENT-OFF* */ |
2969 | enum { |
2494 | enum { |
2970 | C1_40 = 0x40, |
2495 | C1_40 = 0x40, |
… | |
… | |
3020 | process_dcs_seq (); |
2545 | process_dcs_seq (); |
3021 | break; |
2546 | break; |
3022 | case 0x9b: /* CSI */ |
2547 | case 0x9b: /* CSI */ |
3023 | process_csi_seq (); |
2548 | process_csi_seq (); |
3024 | break; |
2549 | break; |
3025 | case 0x9d: /* CSI */ |
2550 | case 0x9d: /* OSC */ |
3026 | process_osc_seq (); |
2551 | process_osc_seq (); |
3027 | break; |
2552 | break; |
3028 | #endif |
2553 | #endif |
3029 | } |
2554 | } |
3030 | } |
2555 | } |
… | |
… | |
3256 | rxvt_term::process_csi_seq () |
2781 | rxvt_term::process_csi_seq () |
3257 | { |
2782 | { |
3258 | unicode_t ch, priv, i; |
2783 | unicode_t ch, priv, i; |
3259 | unsigned int nargs, p; |
2784 | unsigned int nargs, p; |
3260 | int n, ndef; |
2785 | int n, ndef; |
3261 | int arg[ESC_ARGS]; |
2786 | int arg[ESC_ARGS] = { }; |
3262 | |
2787 | |
3263 | for (nargs = ESC_ARGS; nargs > 0;) |
2788 | nargs = 0; |
3264 | arg[--nargs] = 0; |
|
|
3265 | |
2789 | |
3266 | priv = 0; |
2790 | priv = 0; |
3267 | ch = cmd_getc (); |
2791 | ch = cmd_getc (); |
3268 | if (ch >= '<' && ch <= '?') |
2792 | if (ch >= '<' && ch <= '?') |
|
|
2793 | { |
3269 | { /* '<' '=' '>' '?' */ |
2794 | /* '<' '=' '>' '?' */ |
3270 | priv = ch; |
2795 | priv = ch; |
3271 | ch = cmd_getc (); |
2796 | ch = cmd_getc (); |
3272 | } |
2797 | } |
3273 | |
2798 | |
3274 | /* read any numerical arguments */ |
2799 | /* read any numerical arguments */ |
… | |
… | |
3313 | switch (priv) |
2838 | switch (priv) |
3314 | { |
2839 | { |
3315 | case '>': |
2840 | case '>': |
3316 | if (ch == CSI_DA) /* secondary device attributes */ |
2841 | if (ch == CSI_DA) /* secondary device attributes */ |
3317 | { |
2842 | { |
3318 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
2843 | // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, |
3319 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
2844 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
3320 | // |
2845 | // |
3321 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
2846 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
3322 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
2847 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, 94 for urxvt <= 8.3, and 95 for later |
3323 | // that we do not support xterm mouse reporting (should be 95 when we do). |
2848 | // versions. |
3324 | // |
2849 | // |
3325 | tt_printf ("\033[>%d;94;0c", 'U'); |
2850 | tt_printf ("\033[>%d;95;0c", 'U'); |
3326 | } |
2851 | } |
3327 | break; |
2852 | break; |
|
|
2853 | |
3328 | case '?': |
2854 | case '?': |
3329 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
2855 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3330 | process_terminal_mode (ch, priv, nargs, arg); |
2856 | process_terminal_mode (ch, priv, nargs, arg); |
3331 | break; |
2857 | break; |
3332 | } |
2858 | } |
… | |
… | |
3457 | break; |
2983 | break; |
3458 | case 6: /* CPR requested */ |
2984 | case 6: /* CPR requested */ |
3459 | scr_report_position (); |
2985 | scr_report_position (); |
3460 | break; |
2986 | break; |
3461 | case 7: /* unofficial extension */ |
2987 | case 7: /* unofficial extension */ |
3462 | if (OPTION (Opt_insecure)) |
2988 | if (option (Opt_insecure)) |
3463 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
2989 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
3464 | break; |
2990 | break; |
3465 | case 8: /* unofficial extension */ |
2991 | case 8: /* unofficial extension */ |
3466 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
2992 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
3467 | break; |
2993 | break; |
… | |
… | |
3631 | break; |
3157 | break; |
3632 | case 20: /* report icon label */ |
3158 | case 20: /* report icon label */ |
3633 | { |
3159 | { |
3634 | char *s; |
3160 | char *s; |
3635 | XGetIconName (dpy, parent[0], &s); |
3161 | XGetIconName (dpy, parent[0], &s); |
3636 | tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3162 | tt_printf ("\033]L%-.250s\234", option (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3637 | XFree (s); |
3163 | XFree (s); |
3638 | } |
3164 | } |
3639 | break; |
3165 | break; |
3640 | case 21: /* report window title */ |
3166 | case 21: /* report window title */ |
3641 | { |
3167 | { |
3642 | char *s; |
3168 | char *s; |
3643 | XFetchName (dpy, parent[0], &s); |
3169 | XFetchName (dpy, parent[0], &s); |
3644 | tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3170 | tt_printf ("\033]l%-.250s\234", option (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3645 | XFree (s); |
3171 | XFree (s); |
3646 | } |
3172 | } |
3647 | break; |
3173 | break; |
3648 | } |
3174 | } |
3649 | } |
3175 | } |
… | |
… | |
3776 | int saveop = op; |
3302 | int saveop = op; |
3777 | |
3303 | |
3778 | dLocal (Display *, dpy); |
3304 | dLocal (Display *, dpy); |
3779 | |
3305 | |
3780 | assert (str != NULL); |
3306 | assert (str != NULL); |
3781 | |
3307 | |
3782 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
3308 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
3783 | return; |
3309 | return; |
3784 | |
3310 | |
3785 | switch (op) |
3311 | switch (op) |
3786 | { |
3312 | { |
… | |
… | |
3848 | *buf++ = '\0'; |
3374 | *buf++ = '\0'; |
3849 | |
3375 | |
3850 | process_color_seq (op, color, name, resp); |
3376 | process_color_seq (op, color, name, resp); |
3851 | } |
3377 | } |
3852 | break; |
3378 | break; |
|
|
3379 | case Rxvt_restoreFG: |
3853 | case XTerm_Color00: |
3380 | case XTerm_Color00: |
3854 | process_color_seq (op, Color_fg, str, resp); |
3381 | process_color_seq (op, Color_fg, str, resp); |
3855 | break; |
3382 | break; |
|
|
3383 | case Rxvt_restoreBG: |
3856 | case XTerm_Color01: |
3384 | case XTerm_Color01: |
3857 | process_color_seq (op, Color_bg, str, resp); |
3385 | process_color_seq (op, Color_bg, str, resp); |
3858 | break; |
3386 | break; |
3859 | #ifndef NO_CURSORCOLOR |
3387 | #ifndef NO_CURSORCOLOR |
3860 | case XTerm_Color_cursor: |
3388 | case XTerm_Color_cursor: |
… | |
… | |
3881 | break; |
3409 | break; |
3882 | case URxvt_Color_IT: |
3410 | case URxvt_Color_IT: |
3883 | process_color_seq (op, Color_IT, str, resp); |
3411 | process_color_seq (op, Color_IT, str, resp); |
3884 | break; |
3412 | break; |
3885 | #endif |
3413 | #endif |
3886 | #if TRANSPARENT && TINTING |
3414 | #if ENABLE_TRANSPARENCY |
3887 | case URxvt_Color_tint: |
3415 | case URxvt_Color_tint: |
3888 | process_color_seq (op, Color_tint, str, resp); |
3416 | process_color_seq (op, Color_tint, str, resp); |
|
|
3417 | { |
|
|
3418 | bool changed = false; |
3889 | |
3419 | |
3890 | check_our_parents (); |
3420 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
3421 | changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
|
|
3422 | else |
|
|
3423 | changed = bgPixmap.unset_tint (); |
3891 | |
3424 | |
3892 | if (am_transparent) |
3425 | if (changed) |
3893 | want_full_refresh = want_refresh = 1; |
3426 | update_background (); |
|
|
3427 | } |
3894 | |
3428 | |
3895 | break; |
3429 | break; |
3896 | #endif |
3430 | #endif |
3897 | |
3431 | |
|
|
3432 | #if BG_IMAGE_FROM_FILE |
3898 | case Rxvt_Pixmap: |
3433 | case Rxvt_Pixmap: |
3899 | { |
3434 | if (!strcmp (str, "?")) |
3900 | if (*str != ';') |
|
|
3901 | { |
3435 | { |
3902 | #if XPM_BACKGROUND |
3436 | char str[256]; |
3903 | scale_pixmap (""); /* reset to default scaling */ |
3437 | |
3904 | set_bgPixmap (str); /* change pixmap */ |
3438 | sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ |
3905 | scr_touch (true); |
3439 | min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767), |
3906 | #endif |
3440 | min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767)); |
|
|
3441 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
3907 | } |
3442 | } |
3908 | |
3443 | else |
|
|
3444 | { |
3909 | int changed = 0; |
3445 | int changed = 0; |
3910 | |
3446 | |
3911 | while ((str = strchr (str, ';')) != NULL) |
3447 | if (*str != ';') |
3912 | { |
3448 | { |
|
|
3449 | /* reset to default scaling :*/ |
|
|
3450 | bgPixmap.unset_geometry (); |
|
|
3451 | if (bgPixmap.set_file (str)) /* change pixmap */ |
|
|
3452 | changed++; |
|
|
3453 | str = strchr (str, ';'); |
|
|
3454 | if (str == NULL) |
|
|
3455 | bgPixmap.set_defaultGeometry (); |
|
|
3456 | } |
|
|
3457 | |
|
|
3458 | while (str) |
|
|
3459 | { |
3913 | str++; |
3460 | str++; |
3914 | #if XPM_BACKGROUND |
3461 | if (bgPixmap.set_geometry (str)) |
3915 | changed += scale_pixmap (str); |
3462 | changed++; |
3916 | #endif |
3463 | str = strchr (str, ';'); |
3917 | } |
3464 | } |
3918 | |
3465 | |
3919 | if (changed) |
3466 | if (changed) |
3920 | { |
3467 | update_background (); |
3921 | #ifdef XPM_BACKGROUND |
|
|
3922 | resize_pixmap (); |
|
|
3923 | scr_touch (true); |
|
|
3924 | #endif |
|
|
3925 | } |
3468 | } |
3926 | } |
|
|
3927 | break; |
3469 | break; |
3928 | |
3470 | #endif |
3929 | case Rxvt_restoreFG: |
|
|
3930 | set_window_color (Color_fg, str); |
|
|
3931 | break; |
|
|
3932 | case Rxvt_restoreBG: |
|
|
3933 | set_window_color (Color_bg, str); |
|
|
3934 | break; |
|
|
3935 | |
3471 | |
3936 | case XTerm_logfile: |
3472 | case XTerm_logfile: |
3937 | // TODO, when secure mode? |
3473 | // TODO, when secure mode? |
3938 | break; |
3474 | break; |
3939 | |
3475 | |
… | |
… | |
3957 | case URxvt_italicFont: |
3493 | case URxvt_italicFont: |
3958 | case URxvt_boldItalicFont: |
3494 | case URxvt_boldItalicFont: |
3959 | #endif |
3495 | #endif |
3960 | if (query) |
3496 | if (query) |
3961 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3497 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3962 | OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3498 | option (Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3963 | ? fontset[op - URxvt_font]->fontdesc : "", |
3499 | ? fontset[op - URxvt_font]->fontdesc : "", |
3964 | resp); |
3500 | resp); |
3965 | else |
3501 | else |
3966 | { |
3502 | { |
3967 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
3503 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
… | |
… | |
3981 | break; |
3517 | break; |
3982 | |
3518 | |
3983 | #if !ENABLE_MINIMAL |
3519 | #if !ENABLE_MINIMAL |
3984 | case URxvt_locale: |
3520 | case URxvt_locale: |
3985 | if (query) |
3521 | if (query) |
3986 | tt_printf ("\33]%d;%-.250s%c", op, OPTION (Opt_insecure) ? locale : "", resp); |
3522 | tt_printf ("\33]%d;%-.250s%c", op, option (Opt_insecure) ? locale : "", resp); |
3987 | else |
3523 | else |
3988 | { |
3524 | { |
3989 | set_locale (str); |
3525 | set_locale (str); |
3990 | pty->set_utf8_mode (enc_utf8); |
3526 | pty->set_utf8_mode (enc_utf8); |
3991 | init_xlocale (); |
3527 | init_xlocale (); |
… | |
… | |
4054 | { |
3590 | { |
4055 | unsigned int i, j; |
3591 | unsigned int i, j; |
4056 | int state; |
3592 | int state; |
4057 | |
3593 | |
4058 | static const struct |
3594 | static const struct |
4059 | { |
3595 | { |
4060 | const int argval; |
3596 | const int argval; |
4061 | const unsigned long bit; |
3597 | const unsigned long bit; |
4062 | } |
|
|
4063 | |
|
|
4064 | argtopriv[] = { |
3598 | } argtopriv[] = { |
4065 | { 1, PrivMode_aplCUR }, |
3599 | { 1, PrivMode_aplCUR }, |
4066 | { 2, PrivMode_vt52 }, |
3600 | { 2, PrivMode_vt52 }, |
4067 | { 3, PrivMode_132 }, |
3601 | { 3, PrivMode_132 }, |
4068 | { 4, PrivMode_smoothScroll }, |
3602 | { 4, PrivMode_smoothScroll }, |
4069 | { 5, PrivMode_rVideo }, |
3603 | { 5, PrivMode_rVideo }, |
… | |
… | |
4085 | { 66, PrivMode_aplKP }, |
3619 | { 66, PrivMode_aplKP }, |
4086 | #ifndef NO_BACKSPACE_KEY |
3620 | #ifndef NO_BACKSPACE_KEY |
4087 | { 67, PrivMode_BackSpace }, |
3621 | { 67, PrivMode_BackSpace }, |
4088 | #endif |
3622 | #endif |
4089 | { 1000, PrivMode_MouseX11 }, |
3623 | { 1000, PrivMode_MouseX11 }, |
4090 | // 1001 Use Hilite Mouse Tracking. NYI, TODO |
3624 | { 1002, PrivMode_MouseBtnEvent }, |
4091 | // 1002 Use Cell Motion Mouse Tracking. NYI, TODO |
3625 | { 1003, PrivMode_MouseAnyEvent }, |
4092 | // 1003 Use All Motion Mouse Tracking. NYI, TODO |
|
|
4093 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3626 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
4094 | { 1011, PrivMode_Keypress }, // rxvt extension |
3627 | { 1011, PrivMode_Keypress }, // rxvt extension |
4095 | // 1035 enable modifiers for alt, numlock NYI |
3628 | // 1035 enable modifiers for alt, numlock NYI |
4096 | // 1036 send ESC for meta keys NYI |
3629 | // 1036 send ESC for meta keys NYI |
4097 | // 1037 send DEL for keypad delete NYI |
3630 | // 1037 send DEL for keypad delete NYI |
4098 | { 1047, PrivMode_Screen }, |
3631 | { 1047, PrivMode_Screen }, |
4099 | // 1048 save and restore cursor |
3632 | // 1048 save and restore cursor |
4100 | { 1049, PrivMode_Screen }, /* xterm extension, clear screen on ti rather than te */ |
3633 | { 1049, PrivMode_Screen }, /* xterm extension, clear screen on ti rather than te */ |
4101 | // 1051, 1052, 1060, 1061 keyboard emulation NYI |
3634 | // 1051, 1052, 1060, 1061 keyboard emulation NYI |
|
|
3635 | { 2004, PrivMode_BracketPaste }, |
4102 | }; |
3636 | }; |
4103 | |
3637 | |
4104 | if (nargs == 0) |
3638 | if (nargs == 0) |
4105 | return; |
3639 | return; |
4106 | |
3640 | |
… | |
… | |
4132 | scr_touch (true); |
3666 | scr_touch (true); |
4133 | break; |
3667 | break; |
4134 | #endif |
3668 | #endif |
4135 | case 1048: /* alternative cursor save */ |
3669 | case 1048: /* alternative cursor save */ |
4136 | case 1049: |
3670 | case 1049: |
4137 | if (OPTION (Opt_secondaryScreen)) |
3671 | if (option (Opt_secondaryScreen)) |
4138 | if (mode == 0) |
3672 | if (mode == 0) |
4139 | scr_cursor (RESTORE); |
3673 | scr_cursor (RESTORE); |
4140 | else if (mode == 1) |
3674 | else if (mode == 1) |
4141 | scr_cursor (SAVE); |
3675 | scr_cursor (SAVE); |
4142 | break; |
3676 | break; |
… | |
… | |
4154 | */ |
3688 | */ |
4155 | PrivMode (1, PrivMode_vt52); |
3689 | PrivMode (1, PrivMode_vt52); |
4156 | break; |
3690 | break; |
4157 | case 3: /* 80/132 */ |
3691 | case 3: /* 80/132 */ |
4158 | if (priv_modes & PrivMode_132OK) |
3692 | if (priv_modes & PrivMode_132OK) |
|
|
3693 | { |
|
|
3694 | scr_poweron (); |
4159 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
3695 | set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight); |
|
|
3696 | } |
4160 | break; |
3697 | break; |
4161 | case 4: /* smooth scrolling */ |
3698 | case 4: /* smooth scrolling */ |
4162 | set_option (Opt_jumpScroll, !state); |
3699 | set_option (Opt_jumpScroll, !state); |
4163 | break; |
3700 | break; |
4164 | case 5: /* reverse video */ |
3701 | case 5: /* reverse video */ |
… | |
… | |
4171 | scr_autowrap (state); |
3708 | scr_autowrap (state); |
4172 | break; |
3709 | break; |
4173 | /* case 8: - auto repeat, can't do on a per window basis */ |
3710 | /* case 8: - auto repeat, can't do on a per window basis */ |
4174 | case 9: /* X10 mouse reporting */ |
3711 | case 9: /* X10 mouse reporting */ |
4175 | if (state) /* orthogonal */ |
3712 | if (state) /* orthogonal */ |
4176 | priv_modes &= ~PrivMode_MouseX11; |
3713 | priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
4177 | break; |
3714 | break; |
4178 | #ifdef scrollBar_esc |
3715 | #ifdef scrollBar_esc |
4179 | case scrollBar_esc: |
3716 | case scrollBar_esc: |
4180 | if (scrollbar_mapping (state)) |
3717 | if (scrollbar_mapping (state)) |
4181 | { |
3718 | { |
… | |
… | |
4194 | break; |
3731 | break; |
4195 | /* case 66: - application key pad */ |
3732 | /* case 66: - application key pad */ |
4196 | /* case 67: - backspace key */ |
3733 | /* case 67: - backspace key */ |
4197 | case 1000: /* X11 mouse reporting */ |
3734 | case 1000: /* X11 mouse reporting */ |
4198 | if (state) /* orthogonal */ |
3735 | if (state) /* orthogonal */ |
4199 | priv_modes &= ~PrivMode_MouseX10; |
3736 | priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
4200 | break; |
3737 | break; |
4201 | #if 0 |
|
|
4202 | case 1001: |
3738 | case 1002: |
4203 | break; /* X11 mouse highlighting */ |
3739 | case 1003: |
4204 | #endif |
3740 | if (state) |
|
|
3741 | { |
|
|
3742 | priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11); |
|
|
3743 | priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; |
|
|
3744 | vt_emask_mouse = PointerMotionMask; |
|
|
3745 | } |
|
|
3746 | else |
|
|
3747 | vt_emask_mouse = NoEventMask; |
|
|
3748 | vt_select_input (); |
|
|
3749 | break; |
4205 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3750 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4206 | set_option (Opt_scrollTtyOutput, !state); |
3751 | set_option (Opt_scrollTtyOutput, !state); |
4207 | break; |
3752 | break; |
4208 | case 1011: /* scroll to bottom on key press */ |
3753 | case 1011: /* scroll to bottom on key press */ |
4209 | set_option (Opt_scrollTtyKeypress, state); |
3754 | set_option (Opt_scrollTtyKeypress, state); |
4210 | break; |
3755 | break; |
4211 | case 1047: /* secondary screen w/ clearing last */ |
3756 | case 1047: /* secondary screen w/ clearing last */ |
4212 | if (OPTION (Opt_secondaryScreen)) |
3757 | if (option (Opt_secondaryScreen)) |
4213 | if (current_screen != PRIMARY) |
3758 | if (current_screen != PRIMARY) |
4214 | scr_erase_screen (2); |
3759 | scr_erase_screen (2); |
4215 | scr_change_screen (state); |
3760 | scr_change_screen (state); |
4216 | break; |
3761 | break; |
4217 | case 1049: /* secondary screen w/ clearing first */ |
3762 | case 1049: /* secondary screen w/ clearing first */ |
4218 | scr_change_screen (state); |
3763 | scr_change_screen (state); |
4219 | if (OPTION (Opt_secondaryScreen)) |
3764 | if (option (Opt_secondaryScreen)) |
4220 | if (current_screen != PRIMARY) |
3765 | if (current_screen != PRIMARY) |
4221 | scr_erase_screen (2); |
3766 | scr_erase_screen (2); |
4222 | break; |
3767 | break; |
4223 | default: |
3768 | default: |
4224 | break; |
3769 | break; |
… | |
… | |
4386 | rxvt_term::process_graphics () |
3931 | rxvt_term::process_graphics () |
4387 | { |
3932 | { |
4388 | unicode_t ch, cmd = cmd_getc (); |
3933 | unicode_t ch, cmd = cmd_getc (); |
4389 | |
3934 | |
4390 | if (cmd == 'Q') |
3935 | if (cmd == 'Q') |
|
|
3936 | { |
4391 | { /* query graphics */ |
3937 | /* query graphics */ |
4392 | tt_printf ("\033G0\012"); /* no graphics */ |
3938 | tt_printf ("\033G0\012"); /* no graphics */ |
4393 | return; |
3939 | return; |
4394 | } |
3940 | } |
4395 | /* swallow other graphics sequences until terminating ':' */ |
3941 | /* swallow other graphics sequences until terminating ':' */ |
4396 | do |
3942 | do |
… | |
… | |
4446 | v_buffer = (char *)realloc (v_buffer, v_buflen + len); |
3992 | v_buffer = (char *)realloc (v_buffer, v_buflen + len); |
4447 | |
3993 | |
4448 | memcpy (v_buffer + v_buflen, data, len); |
3994 | memcpy (v_buffer + v_buflen, data, len); |
4449 | v_buflen += len; |
3995 | v_buflen += len; |
4450 | |
3996 | |
4451 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
3997 | pty_ev.set (ev::READ | ev::WRITE); |
4452 | } |
3998 | } |
4453 | |
3999 | |
4454 | void rxvt_term::pty_write () |
4000 | void rxvt_term::pty_write () |
4455 | { |
4001 | { |
4456 | int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4002 | int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
… | |
… | |
4461 | |
4007 | |
4462 | if (v_buflen == 0) |
4008 | if (v_buflen == 0) |
4463 | { |
4009 | { |
4464 | free (v_buffer); |
4010 | free (v_buffer); |
4465 | v_buffer = 0; |
4011 | v_buffer = 0; |
4466 | v_buflen = 0; |
|
|
4467 | |
4012 | |
4468 | pty_ev.set (EVENT_READ); |
4013 | pty_ev.set (ev::READ); |
4469 | return; |
4014 | return; |
4470 | } |
4015 | } |
4471 | |
4016 | |
4472 | memmove (v_buffer, v_buffer + written, v_buflen); |
4017 | memmove (v_buffer, v_buffer + written, v_buflen); |
4473 | } |
4018 | } |
4474 | else if (written != -1 || (errno != EAGAIN && errno != EINTR)) |
4019 | else if (written != -1 || (errno != EAGAIN && errno != EINTR)) |
4475 | pty_ev.set (EVENT_READ); |
4020 | pty_ev.set (ev::READ); |
4476 | } |
4021 | } |
4477 | |
4022 | |
4478 | /*----------------------- end-of-file (C source) -----------------------*/ |
4023 | /*----------------------- end-of-file (C source) -----------------------*/ |
4479 | |
4024 | |