… | |
… | |
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 | |
… | |
… | |
548 | #endif |
548 | #endif |
549 | |
549 | |
550 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
550 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
551 | { |
551 | { |
552 | { |
552 | { |
|
|
553 | bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; |
553 | 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 |
554 | switch (keysym) |
585 | switch (keysym) |
555 | { |
586 | { |
556 | #ifndef NO_BACKSPACE_KEY |
587 | #ifndef NO_BACKSPACE_KEY |
557 | case XK_BackSpace: |
588 | case XK_BackSpace: |
558 | if (priv_modes & PrivMode_HaveBackSpace) |
589 | if (priv_modes & PrivMode_HaveBackSpace) |
… | |
… | |
560 | kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) |
591 | kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) |
561 | ^ !!ctrl) ? '\b' : '\177'; |
592 | ^ !!ctrl) ? '\b' : '\177'; |
562 | kbuf[1] = '\0'; |
593 | kbuf[1] = '\0'; |
563 | } |
594 | } |
564 | else |
595 | else |
565 | strcpy (kbuf, key_backspace); |
596 | strcpy (kbuf, rs[Rs_backspace_key]); |
566 | break; |
597 | break; |
567 | #endif |
598 | #endif |
568 | #ifndef NO_DELETE_KEY |
599 | #ifndef NO_DELETE_KEY |
569 | # ifdef XK_KP_Prior |
|
|
570 | case XK_KP_Delete: |
|
|
571 | /* allow shift to override */ |
|
|
572 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
573 | { |
|
|
574 | strcpy (kbuf, "\033On"); |
|
|
575 | break; |
|
|
576 | } |
|
|
577 | /* FALLTHROUGH */ |
|
|
578 | # endif |
|
|
579 | case XK_Delete: |
600 | case XK_Delete: |
580 | strcpy (kbuf, key_delete); |
601 | strcpy (kbuf, rs[Rs_delete_key]); |
581 | break; |
602 | break; |
582 | #endif |
603 | #endif |
583 | case XK_Tab: |
604 | case XK_Tab: |
584 | if (shft) |
605 | if (shft) |
585 | strcpy (kbuf, "\033[Z"); |
606 | strcpy (kbuf, "\033[Z"); |
… | |
… | |
595 | #endif |
616 | #endif |
596 | newlen = 0; |
617 | newlen = 0; |
597 | } |
618 | } |
598 | break; |
619 | break; |
599 | |
620 | |
600 | #ifdef XK_KP_Left |
|
|
601 | case XK_KP_Up: /* \033Ox or standard */ |
|
|
602 | case XK_KP_Down: /* \033Or or standard */ |
|
|
603 | case XK_KP_Right: /* \033Ov or standard */ |
|
|
604 | case XK_KP_Left: /* \033Ot or standard */ |
|
|
605 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
606 | { |
|
|
607 | strcpy (kbuf, "\033OZ"); |
|
|
608 | kbuf[2] = "txvr"[keysym - XK_KP_Left]; |
|
|
609 | break; |
|
|
610 | } |
|
|
611 | else |
|
|
612 | /* translate to std. cursor key */ |
|
|
613 | keysym = XK_Left + (keysym - XK_KP_Left); |
|
|
614 | /* FALLTHROUGH */ |
|
|
615 | #endif |
|
|
616 | case XK_Up: /* "\033[A" */ |
621 | case XK_Up: /* "\033[A" */ |
617 | case XK_Down: /* "\033[B" */ |
622 | case XK_Down: /* "\033[B" */ |
618 | case XK_Right: /* "\033[C" */ |
623 | case XK_Right: /* "\033[C" */ |
619 | case XK_Left: /* "\033[D" */ |
624 | case XK_Left: /* "\033[D" */ |
620 | strcpy (kbuf, "\033[Z"); |
625 | strcpy (kbuf, "\033[Z"); |
… | |
… | |
630 | else if (priv_modes & PrivMode_aplCUR) |
635 | else if (priv_modes & PrivMode_aplCUR) |
631 | kbuf[1] = 'O'; |
636 | kbuf[1] = 'O'; |
632 | break; |
637 | break; |
633 | |
638 | |
634 | #ifndef UNSHIFTED_SCROLLKEYS |
639 | #ifndef UNSHIFTED_SCROLLKEYS |
635 | # ifdef XK_KP_Prior |
|
|
636 | case XK_KP_Prior: |
|
|
637 | /* allow shift to override */ |
|
|
638 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
639 | { |
|
|
640 | strcpy (kbuf, "\033Oy"); |
|
|
641 | break; |
|
|
642 | } |
|
|
643 | /* FALLTHROUGH */ |
|
|
644 | # endif |
|
|
645 | case XK_Prior: |
640 | case XK_Prior: |
646 | strcpy (kbuf, "\033[5~"); |
641 | strcpy (kbuf, "\033[5~"); |
647 | break; |
642 | break; |
648 | # ifdef XK_KP_Next |
|
|
649 | case XK_KP_Next: |
|
|
650 | /* allow shift to override */ |
|
|
651 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
652 | { |
|
|
653 | strcpy (kbuf, "\033Os"); |
|
|
654 | break; |
|
|
655 | } |
|
|
656 | /* FALLTHROUGH */ |
|
|
657 | # endif |
|
|
658 | case XK_Next: |
643 | case XK_Next: |
659 | strcpy (kbuf, "\033[6~"); |
644 | strcpy (kbuf, "\033[6~"); |
660 | break; |
645 | break; |
661 | #endif |
646 | #endif |
662 | case XK_KP_Enter: |
647 | case XK_KP_Enter: |
663 | /* allow shift to override */ |
648 | /* allow shift to override */ |
664 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
649 | if (kp) |
665 | { |
650 | { |
666 | strcpy (kbuf, "\033OM"); |
651 | strcpy (kbuf, "\033OM"); |
667 | break; |
652 | break; |
668 | } |
653 | } |
669 | |
654 | |
… | |
… | |
681 | kbuf[0] = '\015'; |
666 | kbuf[0] = '\015'; |
682 | kbuf[1] = '\0'; |
667 | kbuf[1] = '\0'; |
683 | } |
668 | } |
684 | break; |
669 | break; |
685 | |
670 | |
686 | #ifdef XK_KP_Begin |
|
|
687 | case XK_KP_Begin: |
|
|
688 | strcpy (kbuf, "\033Ou"); |
|
|
689 | break; |
|
|
690 | |
|
|
691 | #endif |
|
|
692 | case XK_KP_F1: /* "\033OP" */ |
671 | case XK_KP_F1: /* "\033OP" */ |
693 | case XK_KP_F2: /* "\033OQ" */ |
672 | case XK_KP_F2: /* "\033OQ" */ |
694 | case XK_KP_F3: /* "\033OR" */ |
673 | case XK_KP_F3: /* "\033OR" */ |
695 | case XK_KP_F4: /* "\033OS" */ |
674 | case XK_KP_F4: /* "\033OS" */ |
696 | strcpy (kbuf, "\033OP"); |
675 | strcpy (kbuf, "\033OP"); |
… | |
… | |
712 | case XK_KP_6: /* "\033Ov" : "6" */ |
691 | case XK_KP_6: /* "\033Ov" : "6" */ |
713 | case XK_KP_7: /* "\033Ow" : "7" */ |
692 | case XK_KP_7: /* "\033Ow" : "7" */ |
714 | case XK_KP_8: /* "\033Ox" : "8" */ |
693 | case XK_KP_8: /* "\033Ox" : "8" */ |
715 | case XK_KP_9: /* "\033Oy" : "9" */ |
694 | case XK_KP_9: /* "\033Oy" : "9" */ |
716 | /* allow shift to override */ |
695 | /* allow shift to override */ |
717 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
696 | if (kp) |
718 | { |
697 | { |
719 | strcpy (kbuf, "\033Oj"); |
698 | strcpy (kbuf, "\033Oj"); |
720 | kbuf[2] += (keysym - XK_KP_Multiply); |
699 | kbuf[2] += (keysym - XK_KP_Multiply); |
721 | } |
700 | } |
722 | else |
701 | else |
… | |
… | |
728 | |
707 | |
729 | case XK_Find: |
708 | case XK_Find: |
730 | strcpy (kbuf, "\033[1~"); |
709 | strcpy (kbuf, "\033[1~"); |
731 | break; |
710 | break; |
732 | |
711 | |
733 | #ifdef XK_KP_Insert |
|
|
734 | case XK_KP_Insert: |
|
|
735 | /* allow shift to override */ |
|
|
736 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
737 | { |
|
|
738 | strcpy (kbuf, "\033Op"); |
|
|
739 | break; |
|
|
740 | } |
|
|
741 | /* FALLTHROUGH */ |
|
|
742 | #endif |
|
|
743 | case XK_Insert: |
712 | case XK_Insert: |
744 | strcpy (kbuf, "\033[2~"); |
713 | strcpy (kbuf, "\033[2~"); |
745 | break; |
714 | break; |
746 | #ifdef DXK_Remove /* support for DEC remove like key */ |
715 | #ifdef DXK_Remove /* support for DEC remove like key */ |
747 | case DXK_Remove: |
716 | case DXK_Remove: |
… | |
… | |
751 | strcpy (kbuf, "\033[3~"); |
720 | strcpy (kbuf, "\033[3~"); |
752 | break; |
721 | break; |
753 | case XK_Select: |
722 | case XK_Select: |
754 | strcpy (kbuf, "\033[4~"); |
723 | strcpy (kbuf, "\033[4~"); |
755 | break; |
724 | break; |
756 | #ifdef XK_KP_End |
|
|
757 | case XK_KP_End: |
|
|
758 | /* allow shift to override */ |
|
|
759 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
760 | { |
|
|
761 | strcpy (kbuf, "\033Oq"); |
|
|
762 | break; |
|
|
763 | } |
|
|
764 | /* FALLTHROUGH */ |
|
|
765 | #endif |
|
|
766 | case XK_End: |
725 | case XK_End: |
767 | strcpy (kbuf, KS_END); |
726 | strcpy (kbuf, KS_END); |
768 | break; |
727 | break; |
769 | #ifdef XK_KP_Home |
|
|
770 | case XK_KP_Home: |
|
|
771 | /* allow shift to override */ |
|
|
772 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
773 | { |
|
|
774 | strcpy (kbuf, "\033Ow"); |
|
|
775 | break; |
|
|
776 | } |
|
|
777 | /* FALLTHROUGH */ |
|
|
778 | #endif |
|
|
779 | case XK_Home: |
728 | case XK_Home: |
780 | strcpy (kbuf, KS_HOME); |
729 | strcpy (kbuf, KS_HOME); |
781 | break; |
730 | break; |
782 | |
731 | |
783 | #define FKEY(n, fkey) \ |
732 | #define FKEY(n, fkey) \ |
… | |
… | |
1035 | void |
984 | void |
1036 | rxvt_term::flush () |
985 | rxvt_term::flush () |
1037 | { |
986 | { |
1038 | flush_ev.stop (); |
987 | flush_ev.stop (); |
1039 | |
988 | |
1040 | #ifdef ENABLE_TRANSPARENCY |
989 | #ifdef HAVE_BG_PIXMAP |
1041 | if (want_full_refresh) |
990 | if (bgPixmap.check_clearChanged ()) |
1042 | { |
991 | { |
1043 | want_full_refresh = 0; |
992 | // scr_clear (true); This needs to be researched further! |
1044 | scr_clear (); |
|
|
1045 | scr_touch (false); |
993 | scr_touch (false); |
1046 | } |
994 | } |
1047 | #endif |
995 | #endif |
1048 | |
996 | |
1049 | if (want_refresh) |
997 | if (want_refresh) |
… | |
… | |
1094 | } |
1042 | } |
1095 | |
1043 | |
1096 | display->flush (); |
1044 | display->flush (); |
1097 | } |
1045 | } |
1098 | |
1046 | |
|
|
1047 | /* checks wether a refresh is requested and starts the refresh timer */ |
1099 | void |
1048 | void |
1100 | rxvt_term::check_cb (check_watcher &w) |
1049 | rxvt_term::refresh_check () |
1101 | { |
1050 | { |
1102 | make_current (); |
1051 | if (want_refresh && !flush_ev.is_active ()) |
|
|
1052 | flush_ev.start (1. / 60.); // refresh at max. 60 Hz normally |
1103 | |
1053 | |
1104 | display->flush (); |
1054 | display->flush (); |
1105 | |
|
|
1106 | if (want_refresh && !flush_ev.active) |
|
|
1107 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
|
|
1108 | } |
1055 | } |
1109 | |
1056 | |
1110 | void |
1057 | void |
1111 | rxvt_term::flush_cb (time_watcher &w) |
1058 | rxvt_term::flush_cb (ev::timer &w, int revents) |
1112 | { |
1059 | { |
1113 | make_current (); |
1060 | make_current (); |
1114 | |
1061 | |
1115 | refresh_count = 0; |
1062 | refresh_count = 0; |
1116 | flush (); |
1063 | flush (); |
1117 | } |
1064 | } |
1118 | |
1065 | |
1119 | #ifdef CURSOR_BLINK |
1066 | #ifdef CURSOR_BLINK |
1120 | void |
1067 | void |
1121 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1068 | rxvt_term::cursor_blink_cb (ev::timer &w, int revents) |
1122 | { |
1069 | { |
1123 | hidden_cursor = !hidden_cursor; |
1070 | hidden_cursor = !hidden_cursor; |
1124 | want_refresh = 1; |
1071 | want_refresh = 1; |
1125 | |
1072 | refresh_check (); |
1126 | w.start (w.at + CURSOR_BLINK_INTERVAL); |
|
|
1127 | } |
1073 | } |
1128 | #endif |
1074 | #endif |
1129 | |
1075 | |
1130 | #ifdef TEXT_BLINK |
1076 | #ifdef TEXT_BLINK |
1131 | void |
1077 | void |
1132 | rxvt_term::text_blink_cb (time_watcher &w) |
1078 | rxvt_term::text_blink_cb (ev::timer &w, int revents) |
1133 | { |
1079 | { |
1134 | if (scr_refresh_rend (RS_Blink, RS_Blink)) |
1080 | if (scr_refresh_rend (RS_Blink, RS_Blink)) |
1135 | { |
1081 | { |
1136 | hidden_text = !hidden_text; |
1082 | hidden_text = !hidden_text; |
1137 | want_refresh = 1; |
1083 | want_refresh = 1; |
1138 | w.start (w.at + TEXT_BLINK_INTERVAL); |
1084 | refresh_check (); |
1139 | } |
1085 | } |
|
|
1086 | else |
|
|
1087 | w.stop (); |
1140 | } |
1088 | } |
1141 | #endif |
1089 | #endif |
1142 | |
1090 | |
1143 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1091 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1144 | void |
1092 | void |
1145 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1093 | rxvt_term::cont_scroll_cb (ev::timer &w, int revents) |
1146 | { |
1094 | { |
1147 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1095 | if ((scrollbar_isUp () || scrollbar_isDn ()) |
1148 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1096 | && scr_page (scrollbar_isUp () ? UP : DN, 1)) |
1149 | { |
1097 | { |
1150 | want_refresh = 1; |
1098 | want_refresh = 1; |
1151 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1099 | refresh_check (); |
1152 | } |
1100 | } |
|
|
1101 | else |
|
|
1102 | w.stop (); |
1153 | } |
1103 | } |
1154 | #endif |
1104 | #endif |
1155 | |
1105 | |
1156 | #ifdef SELECTION_SCROLLING |
1106 | #ifdef SELECTION_SCROLLING |
1157 | void |
1107 | void |
1158 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1108 | rxvt_term::sel_scroll_cb (ev::timer &w, int revents) |
1159 | { |
1109 | { |
1160 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1110 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1161 | { |
1111 | { |
1162 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1112 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1163 | want_refresh = 1; |
1113 | want_refresh = 1; |
1164 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1114 | refresh_check (); |
1165 | } |
1115 | } |
|
|
1116 | else |
|
|
1117 | w.stop (); |
1166 | } |
1118 | } |
1167 | #endif |
1119 | #endif |
1168 | |
1120 | |
1169 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1121 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1170 | void |
1122 | void |
1171 | rxvt_term::slip_wheel_cb (time_watcher &w) |
1123 | rxvt_term::slip_wheel_cb (ev::timer &w, int revents) |
1172 | { |
1124 | { |
1173 | if (mouse_slip_wheel_speed == 0 |
1125 | if (scr_changeview (view_start - mouse_slip_wheel_speed)) |
1174 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
|
|
1175 | : scr_page (UP, mouse_slip_wheel_speed)) |
|
|
1176 | { |
1126 | { |
1177 | if (view_start == top_row || view_start == 0) |
|
|
1178 | mouse_slip_wheel_speed = 0; |
|
|
1179 | |
|
|
1180 | want_refresh = 1; |
1127 | want_refresh = 1; |
1181 | 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 (); |
1182 | } |
1135 | } |
1183 | } |
1136 | } |
1184 | #endif |
1137 | #endif |
1185 | |
1138 | |
1186 | #if LINUX_YIELD_HACK |
1139 | #if LINUX_YIELD_HACK |
1187 | static struct event_handler |
1140 | static struct event_handler |
1188 | { |
1141 | { |
1189 | check_watcher yield_ev; |
1142 | ev::prepare yield_ev; |
1190 | |
1143 | |
1191 | void yield_cb (check_watcher &w) |
1144 | void yield_cb (ev::prepare &w, int revents) |
1192 | { |
1145 | { |
1193 | // this should really be sched_yield(), but the linux guys thought |
1146 | // this should really be sched_yield(), but the linux guys thought |
1194 | // that giving a process calling sched_yield () less cpu time than |
1147 | // that giving a process calling sched_yield () less cpu time than |
1195 | // 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 |
1196 | // allowed by the sus... as is returning ENOSYS. |
1149 | // allowed by the sus... as is returning ENOSYS. |
… | |
… | |
1247 | |
1200 | |
1248 | return false; |
1201 | return false; |
1249 | } |
1202 | } |
1250 | |
1203 | |
1251 | void |
1204 | void |
1252 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1205 | rxvt_term::pty_cb (ev::io &w, int revents) |
1253 | { |
1206 | { |
1254 | make_current (); |
1207 | make_current (); |
1255 | |
1208 | |
1256 | if (revents & EVENT_READ) |
1209 | if (revents & ev::READ) |
1257 | // loop, but don't allow a single term to monopolize us |
1210 | // loop, but don't allow a single term to monopolize us |
1258 | while (pty_fill ()) |
1211 | while (pty_fill ()) |
1259 | if (cmd_parse ()) |
1212 | if (cmd_parse ()) |
1260 | break; |
1213 | break; |
1261 | |
1214 | |
1262 | if (revents & EVENT_WRITE) |
1215 | if (revents & ev::WRITE) |
1263 | pty_write (); |
1216 | pty_write (); |
|
|
1217 | |
|
|
1218 | refresh_check (); |
1264 | } |
1219 | } |
1265 | |
1220 | |
1266 | void |
1221 | void |
1267 | rxvt_term::pointer_unblank () |
1222 | rxvt_term::pointer_unblank () |
1268 | { |
1223 | { |
… | |
… | |
1271 | |
1226 | |
1272 | #ifdef POINTER_BLANK |
1227 | #ifdef POINTER_BLANK |
1273 | hidden_pointer = 0; |
1228 | hidden_pointer = 0; |
1274 | |
1229 | |
1275 | if (option (Opt_pointerBlank)) |
1230 | if (option (Opt_pointerBlank)) |
1276 | pointer_ev.start (NOW + pointerBlankDelay); |
1231 | pointer_ev.start (pointerBlankDelay); |
1277 | #endif |
1232 | #endif |
1278 | } |
1233 | } |
1279 | |
1234 | |
1280 | #ifdef POINTER_BLANK |
1235 | #ifdef POINTER_BLANK |
1281 | void |
1236 | void |
… | |
… | |
1289 | |
1244 | |
1290 | hidden_pointer = 1; |
1245 | hidden_pointer = 1; |
1291 | } |
1246 | } |
1292 | |
1247 | |
1293 | void |
1248 | void |
1294 | rxvt_term::pointer_cb (time_watcher &w) |
1249 | rxvt_term::pointer_cb (ev::timer &w, int revents) |
1295 | { |
1250 | { |
1296 | make_current (); |
1251 | make_current (); |
1297 | |
1252 | |
1298 | pointer_blank (); |
1253 | pointer_blank (); |
1299 | } |
1254 | } |
… | |
… | |
1302 | void |
1257 | void |
1303 | rxvt_term::mouse_report (XButtonEvent &ev) |
1258 | rxvt_term::mouse_report (XButtonEvent &ev) |
1304 | { |
1259 | { |
1305 | int button_number, key_state = 0; |
1260 | int button_number, key_state = 0; |
1306 | int x, y; |
1261 | int x, y; |
|
|
1262 | int code = 32; |
1307 | |
1263 | |
1308 | x = ev.x; |
1264 | x = Pixel2Col (ev.x); |
1309 | y = ev.y; |
1265 | y = Pixel2Row (ev.y); |
1310 | 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 | } |
1311 | |
1274 | |
1312 | if (MEvent.button == AnyButton) |
1275 | if (MEvent.button == AnyButton) |
1313 | button_number = 3; |
1276 | button_number = 3; |
1314 | else |
1277 | else |
1315 | { |
1278 | { |
… | |
… | |
1361 | x + 1, |
1324 | x + 1, |
1362 | y + 1); |
1325 | y + 1); |
1363 | #endif |
1326 | #endif |
1364 | |
1327 | |
1365 | tt_printf ("\033[M%c%c%c", |
1328 | tt_printf ("\033[M%c%c%c", |
1366 | (32 + button_number + key_state), |
1329 | (code + button_number + key_state), |
1367 | (32 + x + 1), |
1330 | (32 + x + 1), |
1368 | (32 + y + 1)); |
1331 | (32 + y + 1)); |
1369 | } |
1332 | } |
1370 | |
1333 | |
1371 | /*{{{ process an X event */ |
1334 | /*{{{ process an X event */ |
… | |
… | |
1475 | && ev.xfocus.mode != NotifyGrab) |
1438 | && ev.xfocus.mode != NotifyGrab) |
1476 | focus_out (); |
1439 | focus_out (); |
1477 | break; |
1440 | break; |
1478 | |
1441 | |
1479 | 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); */ |
1480 | if (ev.xconfigure.window == parent[0]) |
1446 | if (ev.xconfigure.window == parent[0]) |
1481 | { |
1447 | { |
1482 | while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) |
1448 | while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) |
1483 | ; |
1449 | ; |
1484 | |
1450 | |
1485 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1451 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1486 | { |
1452 | { |
1487 | seen_resize = 1; |
1453 | seen_resize = 1; |
1488 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1454 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1489 | #ifdef XPM_BACKGROUND |
1455 | } |
1490 | /* TODO: replace with update_pixmap() that should unify transparency and bg image handling ! */ |
1456 | else |
1491 | if (!option (Opt_transparent) && bgPixmap.window_size_sensitive ()) |
1457 | { |
|
|
1458 | #ifdef HAVE_BG_PIXMAP |
|
|
1459 | if (bgPixmap.window_position_sensitive ()) |
1492 | { |
1460 | { |
|
|
1461 | if (mapped) |
|
|
1462 | update_background (); |
|
|
1463 | else |
1493 | bgPixmap.render (); |
1464 | bgPixmap.invalidate (); |
1494 | scr_touch (true); |
|
|
1495 | } |
1465 | } |
1496 | #endif |
1466 | #endif |
1497 | } |
1467 | } |
1498 | |
1468 | |
1499 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1469 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1500 | |
|
|
1501 | #ifdef ENABLE_TRANSPARENCY |
|
|
1502 | if (option (Opt_transparent)) |
|
|
1503 | bgPixmap.render (); |
|
|
1504 | #endif |
|
|
1505 | } |
1470 | } |
1506 | break; |
1471 | break; |
1507 | |
1472 | |
1508 | case PropertyNotify: |
1473 | case PropertyNotify: |
1509 | 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))) |
… | |
… | |
1525 | case SelectionRequest: |
1490 | case SelectionRequest: |
1526 | selection_send (ev.xselectionrequest); |
1491 | selection_send (ev.xselectionrequest); |
1527 | break; |
1492 | break; |
1528 | |
1493 | |
1529 | 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 |
1530 | mapped = 1; |
1511 | mapped = 1; |
1531 | #ifdef TEXT_BLINK |
1512 | #ifdef TEXT_BLINK |
1532 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
1513 | text_blink_ev.start (); |
1533 | #endif |
1514 | #endif |
1534 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1515 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1535 | break; |
1516 | break; |
1536 | |
1517 | |
1537 | case UnmapNotify: |
1518 | case UnmapNotify: |
… | |
… | |
1539 | #ifdef TEXT_BLINK |
1520 | #ifdef TEXT_BLINK |
1540 | text_blink_ev.stop (); |
1521 | text_blink_ev.stop (); |
1541 | #endif |
1522 | #endif |
1542 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1523 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1543 | break; |
1524 | break; |
1544 | |
|
|
1545 | #ifdef ENABLE_TRANSPARENCY |
|
|
1546 | case ReparentNotify: |
|
|
1547 | rootwin_cb (ev); |
|
|
1548 | break; |
|
|
1549 | #endif /* ENABLE_TRANSPARENCY */ |
|
|
1550 | |
1525 | |
1551 | case GraphicsExpose: |
1526 | case GraphicsExpose: |
1552 | case Expose: |
1527 | case Expose: |
1553 | if (ev.xany.window == vt) |
1528 | if (ev.xany.window == vt) |
1554 | { |
1529 | { |
1555 | do |
1530 | do |
|
|
1531 | { |
1556 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1532 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1557 | ev.xexpose.width, ev.xexpose.height, False); |
1533 | ev.xexpose.width, ev.xexpose.height, False); |
|
|
1534 | } |
1558 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); |
1535 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); |
1559 | |
1536 | |
1560 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1537 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1561 | |
1538 | |
1562 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) |
1539 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) |
|
|
1540 | { |
1563 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1541 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1564 | ev.xexpose.width, ev.xexpose.height, False); |
1542 | ev.xexpose.width, ev.xexpose.height, False); |
|
|
1543 | } |
1565 | |
1544 | |
1566 | want_refresh = 1; |
1545 | want_refresh = 1; |
1567 | } |
1546 | } |
1568 | else |
1547 | else |
1569 | { |
1548 | { |
… | |
… | |
1572 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event)) |
1551 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event)) |
1573 | ; |
1552 | ; |
1574 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) |
1553 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) |
1575 | ; |
1554 | ; |
1576 | |
1555 | |
1577 | if (isScrollbarWindow (ev.xany.window)) |
1556 | if (scrollBar.state && ev.xany.window == scrollBar.win) |
1578 | { |
1557 | { |
1579 | scrollBar.setIdle (); |
1558 | scrollBar.setIdle (); |
1580 | scrollbar_show (0); |
1559 | scrollbar_show (0); |
1581 | } |
1560 | } |
1582 | } |
1561 | } |
… | |
… | |
1585 | case MotionNotify: |
1564 | case MotionNotify: |
1586 | #ifdef POINTER_BLANK |
1565 | #ifdef POINTER_BLANK |
1587 | if (hidden_pointer) |
1566 | if (hidden_pointer) |
1588 | pointer_unblank (); |
1567 | pointer_unblank (); |
1589 | #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); |
1590 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1572 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1591 | break; |
1573 | break; |
1592 | |
1574 | |
1593 | if (ev.xany.window == vt) |
1575 | if (ev.xany.window == vt) |
1594 | { |
1576 | { |
… | |
… | |
1628 | int dist; |
1610 | int dist; |
1629 | |
1611 | |
1630 | /* don't clobber the current delay if we are |
1612 | /* don't clobber the current delay if we are |
1631 | * already in the middle of scrolling. |
1613 | * already in the middle of scrolling. |
1632 | */ |
1614 | */ |
1633 | if (!sel_scroll_ev.active) |
1615 | if (!sel_scroll_ev.is_active ()) |
1634 | sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); |
1616 | sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
1635 | |
1617 | |
1636 | /* save the event params so we can highlight |
1618 | /* save the event params so we can highlight |
1637 | * the selection in the pending-scroll loop |
1619 | * the selection in the pending-scroll loop |
1638 | */ |
1620 | */ |
1639 | selection_save_x = ev.xbutton.x; |
1621 | selection_save_x = ev.xbutton.x; |
… | |
… | |
1661 | else |
1643 | else |
1662 | { |
1644 | { |
1663 | /* we are within the text window, so we |
1645 | /* we are within the text window, so we |
1664 | * shouldn't be scrolling |
1646 | * shouldn't be scrolling |
1665 | */ |
1647 | */ |
1666 | if (sel_scroll_ev.active) |
|
|
1667 | sel_scroll_ev.stop(); |
1648 | sel_scroll_ev.stop(); |
1668 | } |
1649 | } |
1669 | #endif |
1650 | #endif |
1670 | #ifdef MOUSE_THRESHOLD |
1651 | #ifdef MOUSE_THRESHOLD |
1671 | } |
1652 | } |
1672 | #endif |
1653 | #endif |
1673 | } |
1654 | } |
1674 | } |
1655 | } |
1675 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1656 | else if (scrollbar_isMotion () && ev.xany.window == scrollBar.win) |
1676 | { |
1657 | { |
1677 | while (XCheckTypedWindowEvent (dpy, scrollBar.win, |
1658 | while (XCheckTypedWindowEvent (dpy, scrollBar.win, |
1678 | MotionNotify, &ev)) |
1659 | MotionNotify, &ev)) |
1679 | ; |
1660 | ; |
1680 | |
1661 | |
… | |
… | |
1698 | { |
1679 | { |
1699 | hidden_cursor = 0; |
1680 | hidden_cursor = 0; |
1700 | want_refresh = 1; |
1681 | want_refresh = 1; |
1701 | } |
1682 | } |
1702 | |
1683 | |
1703 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1684 | cursor_blink_ev.again (); |
1704 | } |
1685 | } |
1705 | #endif |
1686 | #endif |
1706 | |
1687 | |
1707 | #if defined(POINTER_BLANK) |
1688 | #if defined(POINTER_BLANK) |
1708 | if (option (Opt_pointerBlank) && pointerBlankDelay > 0) |
1689 | if (option (Opt_pointerBlank) && pointerBlankDelay > 0) |
… | |
… | |
1715 | |
1696 | |
1716 | if (ev.type == KeyPress && hidden_pointer == 0) |
1697 | if (ev.type == KeyPress && hidden_pointer == 0) |
1717 | pointer_blank (); |
1698 | pointer_blank (); |
1718 | } |
1699 | } |
1719 | #endif |
1700 | #endif |
|
|
1701 | |
|
|
1702 | refresh_check (); |
1720 | } |
1703 | } |
1721 | |
1704 | |
1722 | void |
1705 | void |
1723 | rxvt_term::focus_in () |
1706 | rxvt_term::focus_in () |
1724 | { |
1707 | { |
… | |
… | |
1736 | XSetICFocus (Input_Context); |
1719 | XSetICFocus (Input_Context); |
1737 | } |
1720 | } |
1738 | #endif |
1721 | #endif |
1739 | #if CURSOR_BLINK |
1722 | #if CURSOR_BLINK |
1740 | if (option (Opt_cursorBlink)) |
1723 | if (option (Opt_cursorBlink)) |
1741 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1724 | cursor_blink_ev.again (); |
1742 | #endif |
1725 | #endif |
1743 | #if OFF_FOCUS_FADING |
1726 | #if OFF_FOCUS_FADING |
1744 | if (rs[Rs_fade]) |
1727 | if (rs[Rs_fade]) |
1745 | { |
1728 | { |
1746 | pix_colors = pix_colors_focused; |
1729 | pix_colors = pix_colors_focused; |
… | |
… | |
1748 | } |
1731 | } |
1749 | #endif |
1732 | #endif |
1750 | #if ENABLE_FRILLS |
1733 | #if ENABLE_FRILLS |
1751 | if (option (Opt_urgentOnBell)) |
1734 | if (option (Opt_urgentOnBell)) |
1752 | { |
1735 | { |
1753 | XWMHints *h; |
|
|
1754 | |
|
|
1755 | h = XGetWMHints(dpy, parent[0]); |
1736 | if (XWMHints *h = XGetWMHints(dpy, parent[0])) |
1756 | if (h != NULL) |
|
|
1757 | { |
1737 | { |
1758 | h->flags &= ~XUrgencyHint; |
1738 | h->flags &= ~XUrgencyHint; |
1759 | XSetWMHints(dpy, parent[0], h); |
1739 | XSetWMHints (dpy, parent[0], h); |
1760 | } |
1740 | } |
1761 | } |
1741 | } |
1762 | #endif |
1742 | #endif |
1763 | } |
1743 | } |
1764 | } |
1744 | } |
… | |
… | |
1787 | XUnsetICFocus (Input_Context); |
1767 | XUnsetICFocus (Input_Context); |
1788 | #endif |
1768 | #endif |
1789 | #if CURSOR_BLINK |
1769 | #if CURSOR_BLINK |
1790 | if (option (Opt_cursorBlink)) |
1770 | if (option (Opt_cursorBlink)) |
1791 | cursor_blink_ev.stop (); |
1771 | cursor_blink_ev.stop (); |
|
|
1772 | |
1792 | hidden_cursor = 0; |
1773 | hidden_cursor = 0; |
1793 | #endif |
1774 | #endif |
1794 | #if OFF_FOCUS_FADING |
1775 | #if OFF_FOCUS_FADING |
1795 | if (rs[Rs_fade]) |
1776 | if (rs[Rs_fade]) |
1796 | { |
1777 | { |
… | |
… | |
1834 | */ |
1815 | */ |
1835 | if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] |
1816 | if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] |
1836 | || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) |
1817 | || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) |
1837 | { |
1818 | { |
1838 | bgPixmap.set_root_pixmap (); |
1819 | bgPixmap.set_root_pixmap (); |
1839 | bgPixmap.render (); |
1820 | update_background (); |
1840 | } |
1821 | } |
|
|
1822 | |
1841 | break; |
1823 | break; |
1842 | } |
1824 | } |
1843 | # endif |
1825 | # endif |
|
|
1826 | |
|
|
1827 | refresh_check (); |
1844 | } |
1828 | } |
1845 | #endif |
1829 | #endif |
1846 | |
1830 | |
1847 | void |
1831 | void |
1848 | rxvt_term::button_press (XButtonEvent &ev) |
1832 | rxvt_term::button_press (XButtonEvent &ev) |
… | |
… | |
1903 | mouse_report (ev); |
1887 | mouse_report (ev); |
1904 | } |
1888 | } |
1905 | #else |
1889 | #else |
1906 | MEvent.button = ev.button; |
1890 | MEvent.button = ev.button; |
1907 | mouse_report (ev); |
1891 | mouse_report (ev); |
1908 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
1892 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
1909 | |
1893 | |
1910 | } |
1894 | } |
1911 | else |
1895 | else |
1912 | { |
1896 | { |
1913 | if (ev.button != MEvent.button) |
1897 | if (ev.button != MEvent.button) |
… | |
… | |
1961 | } |
1945 | } |
1962 | |
1946 | |
1963 | /* |
1947 | /* |
1964 | * Scrollbar window processing of button press |
1948 | * Scrollbar window processing of button press |
1965 | */ |
1949 | */ |
1966 | if (isScrollbarWindow (ev.window)) |
1950 | if (scrollBar.state && ev.window == scrollBar.win) |
1967 | { |
1951 | { |
1968 | scrollBar.setIdle (); |
1952 | scrollBar.setIdle (); |
1969 | /* |
1953 | /* |
1970 | * Rxvt-style scrollbar: |
1954 | * Rxvt-style scrollbar: |
1971 | * move up if mouse is above slider |
1955 | * move up if mouse is above slider |
… | |
… | |
2007 | tt_printf ("\033[5~"); |
1991 | tt_printf ("\033[5~"); |
2008 | break; |
1992 | break; |
2009 | } |
1993 | } |
2010 | } |
1994 | } |
2011 | else |
1995 | else |
2012 | #endif /* NO_SCROLLBAR_REPORT */ |
1996 | #endif /* NO_SCROLLBAR_REPORT */ |
2013 | |
1997 | |
2014 | { |
1998 | { |
2015 | char upordown = 0; |
1999 | char upordown = 0; |
2016 | |
2000 | |
2017 | if (scrollBar.style == R_SB_NEXT) |
2001 | if (scrollBar.style == R_SB_NEXT) |
2018 | { |
2002 | { |
2019 | if (scrollbarnext_upButton (ev.y)) |
2003 | if (scrollbarnext_upButton (ev.y)) |
2020 | upordown = -1; /* up */ |
2004 | upordown = -1; /* up */ |
… | |
… | |
2026 | if (scrollbarrxvt_upButton (ev.y)) |
2010 | if (scrollbarrxvt_upButton (ev.y)) |
2027 | upordown = -1; /* up */ |
2011 | upordown = -1; /* up */ |
2028 | else if (scrollbarrxvt_dnButton (ev.y)) |
2012 | else if (scrollbarrxvt_dnButton (ev.y)) |
2029 | upordown = 1; /* down */ |
2013 | upordown = 1; /* down */ |
2030 | } |
2014 | } |
|
|
2015 | |
2031 | if (upordown) |
2016 | if (upordown) |
2032 | { |
2017 | { |
2033 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
2018 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
2019 | if (!cont_scroll_ev.is_active ()) |
2034 | cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); |
2020 | cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
2035 | #endif |
2021 | #endif |
2036 | if (scr_page (upordown < 0 ? UP : DN, 1)) |
2022 | if (scr_page (upordown < 0 ? UP : DN, 1)) |
2037 | { |
2023 | { |
2038 | if (upordown < 0) |
2024 | if (upordown < 0) |
2039 | scrollBar.setUp (); |
2025 | scrollBar.setUp (); |
… | |
… | |
2043 | } |
2029 | } |
2044 | else |
2030 | else |
2045 | switch (ev.button) |
2031 | switch (ev.button) |
2046 | { |
2032 | { |
2047 | case Button2: |
2033 | case Button2: |
2048 | switch (scrollbar_align) |
2034 | switch (scrollBar.align) |
2049 | { |
2035 | { |
2050 | case R_SB_ALIGN_TOP: |
2036 | case R_SB_ALIGN_TOP: |
2051 | csrO = 0; |
2037 | csrO = 0; |
2052 | break; |
2038 | break; |
2053 | case R_SB_ALIGN_CENTRE: |
2039 | case R_SB_ALIGN_CENTRE: |
… | |
… | |
2065 | |
2051 | |
2066 | scrollBar.setMotion (); |
2052 | scrollBar.setMotion (); |
2067 | break; |
2053 | break; |
2068 | |
2054 | |
2069 | case Button1: |
2055 | case Button1: |
2070 | if (scrollbar_align == R_SB_ALIGN_CENTRE) |
2056 | if (scrollBar.align == R_SB_ALIGN_CENTRE) |
2071 | csrO = ev.y - scrollBar.top; |
2057 | csrO = ev.y - scrollBar.top; |
2072 | /* FALLTHROUGH */ |
2058 | /* FALLTHROUGH */ |
2073 | |
2059 | |
2074 | case Button3: |
2060 | case Button3: |
2075 | if (scrollBar.style != R_SB_XTERM) |
2061 | if (scrollBar.style != R_SB_XTERM) |
… | |
… | |
2119 | scrollBar.setIdle (); |
2105 | scrollBar.setIdle (); |
2120 | scrollbar_show (0); |
2106 | scrollbar_show (0); |
2121 | } |
2107 | } |
2122 | |
2108 | |
2123 | #ifdef SELECTION_SCROLLING |
2109 | #ifdef SELECTION_SCROLLING |
2124 | if (sel_scroll_ev.active) |
|
|
2125 | sel_scroll_ev.stop(); |
2110 | sel_scroll_ev.stop(); |
2126 | #endif |
2111 | #endif |
2127 | |
2112 | |
2128 | if (ev.window == vt) |
2113 | if (ev.window == vt) |
2129 | { |
2114 | { |
2130 | 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))) |
… | |
… | |
2154 | mouse_report (ev); |
2139 | mouse_report (ev); |
2155 | } |
2140 | } |
2156 | #else /* MOUSE_REPORT_DOUBLECLICK */ |
2141 | #else /* MOUSE_REPORT_DOUBLECLICK */ |
2157 | MEvent.button = AnyButton; |
2142 | MEvent.button = AnyButton; |
2158 | mouse_report (ev); |
2143 | mouse_report (ev); |
2159 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
2144 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
2160 | return; |
2145 | return; |
2161 | } |
2146 | } |
2162 | |
2147 | |
2163 | /* |
2148 | /* |
2164 | * dumb hack to compensate for the failure of click-and-drag |
2149 | * dumb hack to compensate for the failure of click-and-drag |
… | |
… | |
2202 | { |
2187 | { |
2203 | mouse_slip_wheel_speed += v ? -1 : 1; |
2188 | mouse_slip_wheel_speed += v ? -1 : 1; |
2204 | if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; |
2189 | if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; |
2205 | if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; |
2190 | if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; |
2206 | |
2191 | |
2207 | if (slip_wheel_ev.at < NOW) |
2192 | if (!slip_wheel_ev.is_active ()) |
2208 | slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY; |
2193 | slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
2209 | |
|
|
2210 | slip_wheel_ev.start (); |
|
|
2211 | } |
2194 | } |
2212 | else |
2195 | else |
|
|
2196 | # endif |
2213 | { |
2197 | { |
2214 | # endif |
|
|
2215 | scr_page (v, i); |
2198 | scr_page (v, i); |
2216 | scrollbar_show (1); |
2199 | scrollbar_show (1); |
2217 | # ifdef MOUSE_SLIP_WHEELING |
|
|
2218 | } |
2200 | } |
2219 | # endif |
|
|
2220 | } |
2201 | } |
2221 | break; |
2202 | break; |
2222 | #endif |
2203 | #endif |
2223 | } |
2204 | } |
2224 | } |
2205 | } |
… | |
… | |
2283 | |
2264 | |
2284 | if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) |
2265 | if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) |
2285 | { |
2266 | { |
2286 | refresh_count = 0; |
2267 | refresh_count = 0; |
2287 | |
2268 | |
2288 | if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.) |
2269 | if (!option (Opt_skipScroll) || ev_time () > ev::now () + 1. / 60.) |
2289 | { |
2270 | { |
2290 | refreshnow = true; |
2271 | refreshnow = true; |
2291 | ch = NOCHAR; |
2272 | ch = NOCHAR; |
2292 | break; |
2273 | break; |
2293 | } |
2274 | } |
… | |
… | |
2504 | } |
2485 | } |
2505 | } |
2486 | } |
2506 | |
2487 | |
2507 | pclose_printer (fd); |
2488 | pclose_printer (fd); |
2508 | } |
2489 | } |
2509 | #endif /* PRINTPIPE */ |
2490 | #endif /* PRINTPIPE */ |
2510 | /*}}} */ |
2491 | /*}}} */ |
2511 | |
2492 | |
2512 | /* *INDENT-OFF* */ |
2493 | /* *INDENT-OFF* */ |
2513 | enum { |
2494 | enum { |
2514 | C1_40 = 0x40, |
2495 | C1_40 = 0x40, |
… | |
… | |
2800 | rxvt_term::process_csi_seq () |
2781 | rxvt_term::process_csi_seq () |
2801 | { |
2782 | { |
2802 | unicode_t ch, priv, i; |
2783 | unicode_t ch, priv, i; |
2803 | unsigned int nargs, p; |
2784 | unsigned int nargs, p; |
2804 | int n, ndef; |
2785 | int n, ndef; |
2805 | int arg[ESC_ARGS]; |
2786 | int arg[ESC_ARGS] = { }; |
2806 | |
2787 | |
2807 | memset (arg, 0, sizeof (arg)); |
|
|
2808 | nargs = 0; |
2788 | nargs = 0; |
2809 | |
2789 | |
2810 | priv = 0; |
2790 | priv = 0; |
2811 | ch = cmd_getc (); |
2791 | ch = cmd_getc (); |
2812 | if (ch >= '<' && ch <= '?') |
2792 | if (ch >= '<' && ch <= '?') |
|
|
2793 | { |
2813 | { /* '<' '=' '>' '?' */ |
2794 | /* '<' '=' '>' '?' */ |
2814 | priv = ch; |
2795 | priv = ch; |
2815 | ch = cmd_getc (); |
2796 | ch = cmd_getc (); |
2816 | } |
2797 | } |
2817 | |
2798 | |
2818 | /* read any numerical arguments */ |
2799 | /* read any numerical arguments */ |
… | |
… | |
2861 | { |
2842 | { |
2862 | // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, |
2843 | // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, |
2863 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
2844 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
2864 | // |
2845 | // |
2865 | // 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 |
2866 | // 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 |
2867 | // that we do not support xterm mouse reporting (should be 95 when we do). |
2848 | // versions. |
2868 | // |
2849 | // |
2869 | tt_printf ("\033[>%d;94;0c", 'U'); |
2850 | tt_printf ("\033[>%d;95;0c", 'U'); |
2870 | } |
2851 | } |
2871 | break; |
2852 | break; |
|
|
2853 | |
2872 | case '?': |
2854 | case '?': |
2873 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
2855 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
2874 | process_terminal_mode (ch, priv, nargs, arg); |
2856 | process_terminal_mode (ch, priv, nargs, arg); |
2875 | break; |
2857 | break; |
2876 | } |
2858 | } |
… | |
… | |
3392 | *buf++ = '\0'; |
3374 | *buf++ = '\0'; |
3393 | |
3375 | |
3394 | process_color_seq (op, color, name, resp); |
3376 | process_color_seq (op, color, name, resp); |
3395 | } |
3377 | } |
3396 | break; |
3378 | break; |
|
|
3379 | case Rxvt_restoreFG: |
3397 | case XTerm_Color00: |
3380 | case XTerm_Color00: |
3398 | process_color_seq (op, Color_fg, str, resp); |
3381 | process_color_seq (op, Color_fg, str, resp); |
3399 | break; |
3382 | break; |
|
|
3383 | case Rxvt_restoreBG: |
3400 | case XTerm_Color01: |
3384 | case XTerm_Color01: |
3401 | process_color_seq (op, Color_bg, str, resp); |
3385 | process_color_seq (op, Color_bg, str, resp); |
3402 | break; |
3386 | break; |
3403 | #ifndef NO_CURSORCOLOR |
3387 | #ifndef NO_CURSORCOLOR |
3404 | case XTerm_Color_cursor: |
3388 | case XTerm_Color_cursor: |
… | |
… | |
3430 | #if ENABLE_TRANSPARENCY |
3414 | #if ENABLE_TRANSPARENCY |
3431 | case URxvt_Color_tint: |
3415 | case URxvt_Color_tint: |
3432 | process_color_seq (op, Color_tint, str, resp); |
3416 | process_color_seq (op, Color_tint, str, resp); |
3433 | { |
3417 | { |
3434 | bool changed = false; |
3418 | bool changed = false; |
|
|
3419 | |
3435 | if (ISSET_PIXCOLOR (Color_tint)) |
3420 | if (ISSET_PIXCOLOR (Color_tint)) |
3436 | changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
3421 | changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
3437 | else |
3422 | else |
3438 | changed = bgPixmap.unset_tint (); |
3423 | changed = bgPixmap.unset_tint (); |
|
|
3424 | |
3439 | if (changed) |
3425 | if (changed) |
3440 | bgPixmap.render (); |
3426 | update_background (); |
3441 | } |
3427 | } |
3442 | |
3428 | |
3443 | break; |
3429 | break; |
3444 | #endif |
3430 | #endif |
3445 | |
3431 | |
3446 | #if XPM_BACKGROUND |
3432 | #if BG_IMAGE_FROM_FILE |
3447 | case Rxvt_Pixmap: |
3433 | case Rxvt_Pixmap: |
3448 | if (!strcmp (str, "?")) |
3434 | if (!strcmp (str, "?")) |
3449 | { |
3435 | { |
3450 | char str[256]; |
3436 | char str[256]; |
3451 | |
3437 | |
… | |
… | |
3466 | changed++; |
3452 | changed++; |
3467 | str = strchr (str, ';'); |
3453 | str = strchr (str, ';'); |
3468 | if (str == NULL) |
3454 | if (str == NULL) |
3469 | bgPixmap.set_defaultGeometry (); |
3455 | bgPixmap.set_defaultGeometry (); |
3470 | } |
3456 | } |
|
|
3457 | |
3471 | while (str) |
3458 | while (str) |
3472 | { |
3459 | { |
3473 | str++; |
3460 | str++; |
3474 | if (bgPixmap.set_geometry (str)) |
3461 | if (bgPixmap.set_geometry (str)) |
3475 | changed++; |
3462 | changed++; |
3476 | str = strchr (str, ';'); |
3463 | str = strchr (str, ';'); |
3477 | } |
3464 | } |
|
|
3465 | |
3478 | if (changed) |
3466 | if (changed) |
3479 | { |
3467 | update_background (); |
3480 | bgPixmap.render (); |
|
|
3481 | scr_touch (true); |
|
|
3482 | } |
|
|
3483 | } |
3468 | } |
3484 | break; |
3469 | break; |
3485 | #endif |
3470 | #endif |
3486 | |
|
|
3487 | case Rxvt_restoreFG: |
|
|
3488 | set_window_color (Color_fg, str); |
|
|
3489 | break; |
|
|
3490 | case Rxvt_restoreBG: |
|
|
3491 | set_window_color (Color_bg, str); |
|
|
3492 | break; |
|
|
3493 | |
3471 | |
3494 | case XTerm_logfile: |
3472 | case XTerm_logfile: |
3495 | // TODO, when secure mode? |
3473 | // TODO, when secure mode? |
3496 | break; |
3474 | break; |
3497 | |
3475 | |
… | |
… | |
3641 | { 66, PrivMode_aplKP }, |
3619 | { 66, PrivMode_aplKP }, |
3642 | #ifndef NO_BACKSPACE_KEY |
3620 | #ifndef NO_BACKSPACE_KEY |
3643 | { 67, PrivMode_BackSpace }, |
3621 | { 67, PrivMode_BackSpace }, |
3644 | #endif |
3622 | #endif |
3645 | { 1000, PrivMode_MouseX11 }, |
3623 | { 1000, PrivMode_MouseX11 }, |
3646 | // 1001 Use Hilite Mouse Tracking. NYI, TODO |
3624 | { 1002, PrivMode_MouseBtnEvent }, |
3647 | // 1002 Use Cell Motion Mouse Tracking. NYI, TODO |
3625 | { 1003, PrivMode_MouseAnyEvent }, |
3648 | // 1003 Use All Motion Mouse Tracking. NYI, TODO |
|
|
3649 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3626 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3650 | { 1011, PrivMode_Keypress }, // rxvt extension |
3627 | { 1011, PrivMode_Keypress }, // rxvt extension |
3651 | // 1035 enable modifiers for alt, numlock NYI |
3628 | // 1035 enable modifiers for alt, numlock NYI |
3652 | // 1036 send ESC for meta keys NYI |
3629 | // 1036 send ESC for meta keys NYI |
3653 | // 1037 send DEL for keypad delete NYI |
3630 | // 1037 send DEL for keypad delete NYI |
3654 | { 1047, PrivMode_Screen }, |
3631 | { 1047, PrivMode_Screen }, |
3655 | // 1048 save and restore cursor |
3632 | // 1048 save and restore cursor |
3656 | { 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 */ |
3657 | // 1051, 1052, 1060, 1061 keyboard emulation NYI |
3634 | // 1051, 1052, 1060, 1061 keyboard emulation NYI |
|
|
3635 | { 2004, PrivMode_BracketPaste }, |
3658 | }; |
3636 | }; |
3659 | |
3637 | |
3660 | if (nargs == 0) |
3638 | if (nargs == 0) |
3661 | return; |
3639 | return; |
3662 | |
3640 | |
… | |
… | |
3710 | */ |
3688 | */ |
3711 | PrivMode (1, PrivMode_vt52); |
3689 | PrivMode (1, PrivMode_vt52); |
3712 | break; |
3690 | break; |
3713 | case 3: /* 80/132 */ |
3691 | case 3: /* 80/132 */ |
3714 | if (priv_modes & PrivMode_132OK) |
3692 | if (priv_modes & PrivMode_132OK) |
|
|
3693 | { |
|
|
3694 | scr_poweron (); |
3715 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
3695 | set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight); |
|
|
3696 | } |
3716 | break; |
3697 | break; |
3717 | case 4: /* smooth scrolling */ |
3698 | case 4: /* smooth scrolling */ |
3718 | set_option (Opt_jumpScroll, !state); |
3699 | set_option (Opt_jumpScroll, !state); |
3719 | break; |
3700 | break; |
3720 | case 5: /* reverse video */ |
3701 | case 5: /* reverse video */ |
… | |
… | |
3727 | scr_autowrap (state); |
3708 | scr_autowrap (state); |
3728 | break; |
3709 | break; |
3729 | /* 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 */ |
3730 | case 9: /* X10 mouse reporting */ |
3711 | case 9: /* X10 mouse reporting */ |
3731 | if (state) /* orthogonal */ |
3712 | if (state) /* orthogonal */ |
3732 | priv_modes &= ~PrivMode_MouseX11; |
3713 | priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
3733 | break; |
3714 | break; |
3734 | #ifdef scrollBar_esc |
3715 | #ifdef scrollBar_esc |
3735 | case scrollBar_esc: |
3716 | case scrollBar_esc: |
3736 | if (scrollbar_mapping (state)) |
3717 | if (scrollbar_mapping (state)) |
3737 | { |
3718 | { |
… | |
… | |
3750 | break; |
3731 | break; |
3751 | /* case 66: - application key pad */ |
3732 | /* case 66: - application key pad */ |
3752 | /* case 67: - backspace key */ |
3733 | /* case 67: - backspace key */ |
3753 | case 1000: /* X11 mouse reporting */ |
3734 | case 1000: /* X11 mouse reporting */ |
3754 | if (state) /* orthogonal */ |
3735 | if (state) /* orthogonal */ |
3755 | priv_modes &= ~PrivMode_MouseX10; |
3736 | priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
3756 | break; |
3737 | break; |
3757 | #if 0 |
|
|
3758 | case 1001: |
3738 | case 1002: |
3759 | break; /* X11 mouse highlighting */ |
3739 | case 1003: |
3760 | #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; |
3761 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3750 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3762 | set_option (Opt_scrollTtyOutput, !state); |
3751 | set_option (Opt_scrollTtyOutput, !state); |
3763 | break; |
3752 | break; |
3764 | case 1011: /* scroll to bottom on key press */ |
3753 | case 1011: /* scroll to bottom on key press */ |
3765 | set_option (Opt_scrollTtyKeypress, state); |
3754 | set_option (Opt_scrollTtyKeypress, state); |
… | |
… | |
3942 | rxvt_term::process_graphics () |
3931 | rxvt_term::process_graphics () |
3943 | { |
3932 | { |
3944 | unicode_t ch, cmd = cmd_getc (); |
3933 | unicode_t ch, cmd = cmd_getc (); |
3945 | |
3934 | |
3946 | if (cmd == 'Q') |
3935 | if (cmd == 'Q') |
|
|
3936 | { |
3947 | { /* query graphics */ |
3937 | /* query graphics */ |
3948 | tt_printf ("\033G0\012"); /* no graphics */ |
3938 | tt_printf ("\033G0\012"); /* no graphics */ |
3949 | return; |
3939 | return; |
3950 | } |
3940 | } |
3951 | /* swallow other graphics sequences until terminating ':' */ |
3941 | /* swallow other graphics sequences until terminating ':' */ |
3952 | do |
3942 | do |
… | |
… | |
4002 | v_buffer = (char *)realloc (v_buffer, v_buflen + len); |
3992 | v_buffer = (char *)realloc (v_buffer, v_buflen + len); |
4003 | |
3993 | |
4004 | memcpy (v_buffer + v_buflen, data, len); |
3994 | memcpy (v_buffer + v_buflen, data, len); |
4005 | v_buflen += len; |
3995 | v_buflen += len; |
4006 | |
3996 | |
4007 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
3997 | pty_ev.set (ev::READ | ev::WRITE); |
4008 | } |
3998 | } |
4009 | |
3999 | |
4010 | void rxvt_term::pty_write () |
4000 | void rxvt_term::pty_write () |
4011 | { |
4001 | { |
4012 | 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)); |
… | |
… | |
4017 | |
4007 | |
4018 | if (v_buflen == 0) |
4008 | if (v_buflen == 0) |
4019 | { |
4009 | { |
4020 | free (v_buffer); |
4010 | free (v_buffer); |
4021 | v_buffer = 0; |
4011 | v_buffer = 0; |
4022 | v_buflen = 0; |
|
|
4023 | |
4012 | |
4024 | pty_ev.set (EVENT_READ); |
4013 | pty_ev.set (ev::READ); |
4025 | return; |
4014 | return; |
4026 | } |
4015 | } |
4027 | |
4016 | |
4028 | memmove (v_buffer, v_buffer + written, v_buflen); |
4017 | memmove (v_buffer, v_buffer + written, v_buflen); |
4029 | } |
4018 | } |
4030 | else if (written != -1 || (errno != EAGAIN && errno != EINTR)) |
4019 | else if (written != -1 || (errno != EAGAIN && errno != EINTR)) |
4031 | pty_ev.set (EVENT_READ); |
4020 | pty_ev.set (ev::READ); |
4032 | } |
4021 | } |
4033 | |
4022 | |
4034 | /*----------------------- end-of-file (C source) -----------------------*/ |
4023 | /*----------------------- end-of-file (C source) -----------------------*/ |
4035 | |
4024 | |