… | |
… | |
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 |
|
|
1490 | if (!option (Opt_transparent) && bgPixmap.auto_resize) |
|
|
1491 | { |
|
|
1492 | resize_pixmap (); |
|
|
1493 | scr_touch (true); |
|
|
1494 | } |
|
|
1495 | #endif |
|
|
1496 | } |
1455 | } |
|
|
1456 | else |
|
|
1457 | { |
|
|
1458 | #ifdef HAVE_BG_PIXMAP |
|
|
1459 | if (bgPixmap.window_position_sensitive ()) |
|
|
1460 | update_background (); |
|
|
1461 | #endif |
|
|
1462 | } |
1497 | |
1463 | |
1498 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1464 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1499 | |
|
|
1500 | #ifdef ENABLE_TRANSPARENCY |
|
|
1501 | if (option (Opt_transparent)) |
|
|
1502 | check_our_parents (); |
|
|
1503 | #endif |
|
|
1504 | } |
1465 | } |
1505 | break; |
1466 | break; |
1506 | |
1467 | |
1507 | case PropertyNotify: |
1468 | case PropertyNotify: |
1508 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1469 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
… | |
… | |
1526 | break; |
1487 | break; |
1527 | |
1488 | |
1528 | case MapNotify: |
1489 | case MapNotify: |
1529 | mapped = 1; |
1490 | mapped = 1; |
1530 | #ifdef TEXT_BLINK |
1491 | #ifdef TEXT_BLINK |
1531 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
1492 | text_blink_ev.start (); |
1532 | #endif |
1493 | #endif |
1533 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1494 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1534 | break; |
1495 | break; |
1535 | |
1496 | |
1536 | case UnmapNotify: |
1497 | case UnmapNotify: |
… | |
… | |
1538 | #ifdef TEXT_BLINK |
1499 | #ifdef TEXT_BLINK |
1539 | text_blink_ev.stop (); |
1500 | text_blink_ev.stop (); |
1540 | #endif |
1501 | #endif |
1541 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1502 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1542 | break; |
1503 | break; |
1543 | |
|
|
1544 | #ifdef ENABLE_TRANSPARENCY |
|
|
1545 | case ReparentNotify: |
|
|
1546 | rootwin_cb (ev); |
|
|
1547 | break; |
|
|
1548 | #endif /* ENABLE_TRANSPARENCY */ |
|
|
1549 | |
1504 | |
1550 | case GraphicsExpose: |
1505 | case GraphicsExpose: |
1551 | case Expose: |
1506 | case Expose: |
1552 | if (ev.xany.window == vt) |
1507 | if (ev.xany.window == vt) |
1553 | { |
1508 | { |
1554 | do |
1509 | do |
|
|
1510 | { |
1555 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1511 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1556 | ev.xexpose.width, ev.xexpose.height, False); |
1512 | ev.xexpose.width, ev.xexpose.height, False); |
|
|
1513 | } |
1557 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); |
1514 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); |
1558 | |
1515 | |
1559 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1516 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1560 | |
1517 | |
1561 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) |
1518 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) |
|
|
1519 | { |
1562 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1520 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1563 | ev.xexpose.width, ev.xexpose.height, False); |
1521 | ev.xexpose.width, ev.xexpose.height, False); |
|
|
1522 | } |
1564 | |
1523 | |
1565 | want_refresh = 1; |
1524 | want_refresh = 1; |
1566 | } |
1525 | } |
1567 | else |
1526 | else |
1568 | { |
1527 | { |
… | |
… | |
1571 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event)) |
1530 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event)) |
1572 | ; |
1531 | ; |
1573 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) |
1532 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) |
1574 | ; |
1533 | ; |
1575 | |
1534 | |
1576 | if (isScrollbarWindow (ev.xany.window)) |
1535 | if (scrollBar.state && ev.xany.window == scrollBar.win) |
1577 | { |
1536 | { |
1578 | scrollBar.setIdle (); |
1537 | scrollBar.setIdle (); |
1579 | scrollbar_show (0); |
1538 | scrollbar_show (0); |
1580 | } |
1539 | } |
1581 | |
|
|
1582 | #ifdef ENABLE_TRANSPARENCY |
|
|
1583 | if (am_transparent && ev.xany.window == parent[0]) |
|
|
1584 | XClearWindow (dpy, ev.xany.window); |
|
|
1585 | #endif |
|
|
1586 | } |
1540 | } |
1587 | break; |
1541 | break; |
1588 | |
1542 | |
1589 | case MotionNotify: |
1543 | case MotionNotify: |
1590 | #ifdef POINTER_BLANK |
1544 | #ifdef POINTER_BLANK |
1591 | if (hidden_pointer) |
1545 | if (hidden_pointer) |
1592 | pointer_unblank (); |
1546 | pointer_unblank (); |
1593 | #endif |
1547 | #endif |
|
|
1548 | if ((priv_modes & PrivMode_MouseBtnEvent && ev.xbutton.state & (Button1Mask|Button2Mask|Button3Mask)) |
|
|
1549 | || priv_modes & PrivMode_MouseAnyEvent) |
|
|
1550 | mouse_report (ev.xbutton); |
1594 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1551 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1595 | break; |
1552 | break; |
1596 | |
1553 | |
1597 | if (ev.xany.window == vt) |
1554 | if (ev.xany.window == vt) |
1598 | { |
1555 | { |
… | |
… | |
1632 | int dist; |
1589 | int dist; |
1633 | |
1590 | |
1634 | /* don't clobber the current delay if we are |
1591 | /* don't clobber the current delay if we are |
1635 | * already in the middle of scrolling. |
1592 | * already in the middle of scrolling. |
1636 | */ |
1593 | */ |
1637 | if (!sel_scroll_ev.active) |
1594 | if (!sel_scroll_ev.is_active ()) |
1638 | sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); |
1595 | sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
1639 | |
1596 | |
1640 | /* save the event params so we can highlight |
1597 | /* save the event params so we can highlight |
1641 | * the selection in the pending-scroll loop |
1598 | * the selection in the pending-scroll loop |
1642 | */ |
1599 | */ |
1643 | selection_save_x = ev.xbutton.x; |
1600 | selection_save_x = ev.xbutton.x; |
… | |
… | |
1665 | else |
1622 | else |
1666 | { |
1623 | { |
1667 | /* we are within the text window, so we |
1624 | /* we are within the text window, so we |
1668 | * shouldn't be scrolling |
1625 | * shouldn't be scrolling |
1669 | */ |
1626 | */ |
1670 | if (sel_scroll_ev.active) |
|
|
1671 | sel_scroll_ev.stop(); |
1627 | sel_scroll_ev.stop(); |
1672 | } |
1628 | } |
1673 | #endif |
1629 | #endif |
1674 | #ifdef MOUSE_THRESHOLD |
1630 | #ifdef MOUSE_THRESHOLD |
1675 | } |
1631 | } |
1676 | #endif |
1632 | #endif |
1677 | } |
1633 | } |
1678 | } |
1634 | } |
1679 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1635 | else if (scrollbar_isMotion () && ev.xany.window == scrollBar.win) |
1680 | { |
1636 | { |
1681 | while (XCheckTypedWindowEvent (dpy, scrollBar.win, |
1637 | while (XCheckTypedWindowEvent (dpy, scrollBar.win, |
1682 | MotionNotify, &ev)) |
1638 | MotionNotify, &ev)) |
1683 | ; |
1639 | ; |
1684 | |
1640 | |
… | |
… | |
1702 | { |
1658 | { |
1703 | hidden_cursor = 0; |
1659 | hidden_cursor = 0; |
1704 | want_refresh = 1; |
1660 | want_refresh = 1; |
1705 | } |
1661 | } |
1706 | |
1662 | |
1707 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1663 | cursor_blink_ev.again (); |
1708 | } |
1664 | } |
1709 | #endif |
1665 | #endif |
1710 | |
1666 | |
1711 | #if defined(POINTER_BLANK) |
1667 | #if defined(POINTER_BLANK) |
1712 | if (option (Opt_pointerBlank) && pointerBlankDelay > 0) |
1668 | if (option (Opt_pointerBlank) && pointerBlankDelay > 0) |
… | |
… | |
1719 | |
1675 | |
1720 | if (ev.type == KeyPress && hidden_pointer == 0) |
1676 | if (ev.type == KeyPress && hidden_pointer == 0) |
1721 | pointer_blank (); |
1677 | pointer_blank (); |
1722 | } |
1678 | } |
1723 | #endif |
1679 | #endif |
|
|
1680 | |
|
|
1681 | refresh_check (); |
1724 | } |
1682 | } |
1725 | |
1683 | |
1726 | void |
1684 | void |
1727 | rxvt_term::focus_in () |
1685 | rxvt_term::focus_in () |
1728 | { |
1686 | { |
… | |
… | |
1740 | XSetICFocus (Input_Context); |
1698 | XSetICFocus (Input_Context); |
1741 | } |
1699 | } |
1742 | #endif |
1700 | #endif |
1743 | #if CURSOR_BLINK |
1701 | #if CURSOR_BLINK |
1744 | if (option (Opt_cursorBlink)) |
1702 | if (option (Opt_cursorBlink)) |
1745 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1703 | cursor_blink_ev.again (); |
1746 | #endif |
1704 | #endif |
1747 | #if OFF_FOCUS_FADING |
1705 | #if OFF_FOCUS_FADING |
1748 | if (rs[Rs_fade]) |
1706 | if (rs[Rs_fade]) |
1749 | { |
1707 | { |
1750 | pix_colors = pix_colors_focused; |
1708 | pix_colors = pix_colors_focused; |
… | |
… | |
1752 | } |
1710 | } |
1753 | #endif |
1711 | #endif |
1754 | #if ENABLE_FRILLS |
1712 | #if ENABLE_FRILLS |
1755 | if (option (Opt_urgentOnBell)) |
1713 | if (option (Opt_urgentOnBell)) |
1756 | { |
1714 | { |
1757 | XWMHints *h; |
|
|
1758 | |
|
|
1759 | h = XGetWMHints(dpy, parent[0]); |
1715 | if (XWMHints *h = XGetWMHints(dpy, parent[0])) |
1760 | if (h != NULL) |
|
|
1761 | { |
1716 | { |
1762 | h->flags &= ~XUrgencyHint; |
1717 | h->flags &= ~XUrgencyHint; |
1763 | XSetWMHints(dpy, parent[0], h); |
1718 | XSetWMHints (dpy, parent[0], h); |
1764 | } |
1719 | } |
1765 | } |
1720 | } |
1766 | #endif |
1721 | #endif |
1767 | } |
1722 | } |
1768 | } |
1723 | } |
… | |
… | |
1791 | XUnsetICFocus (Input_Context); |
1746 | XUnsetICFocus (Input_Context); |
1792 | #endif |
1747 | #endif |
1793 | #if CURSOR_BLINK |
1748 | #if CURSOR_BLINK |
1794 | if (option (Opt_cursorBlink)) |
1749 | if (option (Opt_cursorBlink)) |
1795 | cursor_blink_ev.stop (); |
1750 | cursor_blink_ev.stop (); |
|
|
1751 | |
1796 | hidden_cursor = 0; |
1752 | hidden_cursor = 0; |
1797 | #endif |
1753 | #endif |
1798 | #if OFF_FOCUS_FADING |
1754 | #if OFF_FOCUS_FADING |
1799 | if (rs[Rs_fade]) |
1755 | if (rs[Rs_fade]) |
1800 | { |
1756 | { |
… | |
… | |
1834 | case PropertyNotify: |
1790 | case PropertyNotify: |
1835 | /* |
1791 | /* |
1836 | * if user used some Esetroot compatible prog to set the root bg, |
1792 | * if user used some Esetroot compatible prog to set the root bg, |
1837 | * use the property to determine the pixmap. We use it later on. |
1793 | * use the property to determine the pixmap. We use it later on. |
1838 | */ |
1794 | */ |
1839 | if (ev.xproperty.atom != xa[XA_XROOTPMAP_ID] |
1795 | if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] |
1840 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1796 | || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) |
1841 | return; |
1797 | { |
|
|
1798 | bgPixmap.set_root_pixmap (); |
|
|
1799 | update_background (); |
|
|
1800 | } |
1842 | |
1801 | |
1843 | /* FALLTHROUGH */ |
|
|
1844 | case ReparentNotify: |
|
|
1845 | if (option (Opt_transparent)) |
|
|
1846 | check_our_parents (); |
|
|
1847 | break; |
1802 | break; |
1848 | } |
1803 | } |
1849 | # endif |
1804 | # endif |
|
|
1805 | |
|
|
1806 | refresh_check (); |
1850 | } |
1807 | } |
1851 | #endif |
1808 | #endif |
1852 | |
1809 | |
1853 | void |
1810 | void |
1854 | rxvt_term::button_press (XButtonEvent &ev) |
1811 | rxvt_term::button_press (XButtonEvent &ev) |
… | |
… | |
1909 | mouse_report (ev); |
1866 | mouse_report (ev); |
1910 | } |
1867 | } |
1911 | #else |
1868 | #else |
1912 | MEvent.button = ev.button; |
1869 | MEvent.button = ev.button; |
1913 | mouse_report (ev); |
1870 | mouse_report (ev); |
1914 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
1871 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
1915 | |
1872 | |
1916 | } |
1873 | } |
1917 | else |
1874 | else |
1918 | { |
1875 | { |
1919 | if (ev.button != MEvent.button) |
1876 | if (ev.button != MEvent.button) |
… | |
… | |
1967 | } |
1924 | } |
1968 | |
1925 | |
1969 | /* |
1926 | /* |
1970 | * Scrollbar window processing of button press |
1927 | * Scrollbar window processing of button press |
1971 | */ |
1928 | */ |
1972 | if (isScrollbarWindow (ev.window)) |
1929 | if (scrollBar.state && ev.window == scrollBar.win) |
1973 | { |
1930 | { |
1974 | scrollBar.setIdle (); |
1931 | scrollBar.setIdle (); |
1975 | /* |
1932 | /* |
1976 | * Rxvt-style scrollbar: |
1933 | * Rxvt-style scrollbar: |
1977 | * move up if mouse is above slider |
1934 | * move up if mouse is above slider |
… | |
… | |
2013 | tt_printf ("\033[5~"); |
1970 | tt_printf ("\033[5~"); |
2014 | break; |
1971 | break; |
2015 | } |
1972 | } |
2016 | } |
1973 | } |
2017 | else |
1974 | else |
2018 | #endif /* NO_SCROLLBAR_REPORT */ |
1975 | #endif /* NO_SCROLLBAR_REPORT */ |
2019 | |
1976 | |
2020 | { |
1977 | { |
2021 | char upordown = 0; |
1978 | char upordown = 0; |
2022 | |
1979 | |
2023 | if (scrollBar.style == R_SB_NEXT) |
1980 | if (scrollBar.style == R_SB_NEXT) |
2024 | { |
1981 | { |
2025 | if (scrollbarnext_upButton (ev.y)) |
1982 | if (scrollbarnext_upButton (ev.y)) |
2026 | upordown = -1; /* up */ |
1983 | upordown = -1; /* up */ |
… | |
… | |
2032 | if (scrollbarrxvt_upButton (ev.y)) |
1989 | if (scrollbarrxvt_upButton (ev.y)) |
2033 | upordown = -1; /* up */ |
1990 | upordown = -1; /* up */ |
2034 | else if (scrollbarrxvt_dnButton (ev.y)) |
1991 | else if (scrollbarrxvt_dnButton (ev.y)) |
2035 | upordown = 1; /* down */ |
1992 | upordown = 1; /* down */ |
2036 | } |
1993 | } |
|
|
1994 | |
2037 | if (upordown) |
1995 | if (upordown) |
2038 | { |
1996 | { |
2039 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1997 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
1998 | if (!cont_scroll_ev.is_active ()) |
2040 | cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); |
1999 | cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
2041 | #endif |
2000 | #endif |
2042 | if (scr_page (upordown < 0 ? UP : DN, 1)) |
2001 | if (scr_page (upordown < 0 ? UP : DN, 1)) |
2043 | { |
2002 | { |
2044 | if (upordown < 0) |
2003 | if (upordown < 0) |
2045 | scrollBar.setUp (); |
2004 | scrollBar.setUp (); |
… | |
… | |
2049 | } |
2008 | } |
2050 | else |
2009 | else |
2051 | switch (ev.button) |
2010 | switch (ev.button) |
2052 | { |
2011 | { |
2053 | case Button2: |
2012 | case Button2: |
2054 | switch (scrollbar_align) |
2013 | switch (scrollBar.align) |
2055 | { |
2014 | { |
2056 | case R_SB_ALIGN_TOP: |
2015 | case R_SB_ALIGN_TOP: |
2057 | csrO = 0; |
2016 | csrO = 0; |
2058 | break; |
2017 | break; |
2059 | case R_SB_ALIGN_CENTRE: |
2018 | case R_SB_ALIGN_CENTRE: |
… | |
… | |
2071 | |
2030 | |
2072 | scrollBar.setMotion (); |
2031 | scrollBar.setMotion (); |
2073 | break; |
2032 | break; |
2074 | |
2033 | |
2075 | case Button1: |
2034 | case Button1: |
2076 | if (scrollbar_align == R_SB_ALIGN_CENTRE) |
2035 | if (scrollBar.align == R_SB_ALIGN_CENTRE) |
2077 | csrO = ev.y - scrollBar.top; |
2036 | csrO = ev.y - scrollBar.top; |
2078 | /* FALLTHROUGH */ |
2037 | /* FALLTHROUGH */ |
2079 | |
2038 | |
2080 | case Button3: |
2039 | case Button3: |
2081 | if (scrollBar.style != R_SB_XTERM) |
2040 | if (scrollBar.style != R_SB_XTERM) |
… | |
… | |
2125 | scrollBar.setIdle (); |
2084 | scrollBar.setIdle (); |
2126 | scrollbar_show (0); |
2085 | scrollbar_show (0); |
2127 | } |
2086 | } |
2128 | |
2087 | |
2129 | #ifdef SELECTION_SCROLLING |
2088 | #ifdef SELECTION_SCROLLING |
2130 | if (sel_scroll_ev.active) |
|
|
2131 | sel_scroll_ev.stop(); |
2089 | sel_scroll_ev.stop(); |
2132 | #endif |
2090 | #endif |
2133 | |
2091 | |
2134 | if (ev.window == vt) |
2092 | if (ev.window == vt) |
2135 | { |
2093 | { |
2136 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
2094 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
… | |
… | |
2160 | mouse_report (ev); |
2118 | mouse_report (ev); |
2161 | } |
2119 | } |
2162 | #else /* MOUSE_REPORT_DOUBLECLICK */ |
2120 | #else /* MOUSE_REPORT_DOUBLECLICK */ |
2163 | MEvent.button = AnyButton; |
2121 | MEvent.button = AnyButton; |
2164 | mouse_report (ev); |
2122 | mouse_report (ev); |
2165 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
2123 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
2166 | return; |
2124 | return; |
2167 | } |
2125 | } |
2168 | |
2126 | |
2169 | /* |
2127 | /* |
2170 | * dumb hack to compensate for the failure of click-and-drag |
2128 | * dumb hack to compensate for the failure of click-and-drag |
… | |
… | |
2208 | { |
2166 | { |
2209 | mouse_slip_wheel_speed += v ? -1 : 1; |
2167 | mouse_slip_wheel_speed += v ? -1 : 1; |
2210 | if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; |
2168 | if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; |
2211 | if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; |
2169 | if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; |
2212 | |
2170 | |
2213 | if (slip_wheel_ev.at < NOW) |
2171 | if (!slip_wheel_ev.is_active ()) |
2214 | slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY; |
2172 | slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
2215 | |
|
|
2216 | slip_wheel_ev.start (); |
|
|
2217 | } |
2173 | } |
2218 | else |
2174 | else |
|
|
2175 | # endif |
2219 | { |
2176 | { |
2220 | # endif |
|
|
2221 | scr_page (v, i); |
2177 | scr_page (v, i); |
2222 | scrollbar_show (1); |
2178 | scrollbar_show (1); |
2223 | # ifdef MOUSE_SLIP_WHEELING |
|
|
2224 | } |
2179 | } |
2225 | # endif |
|
|
2226 | } |
2180 | } |
2227 | break; |
2181 | break; |
2228 | #endif |
2182 | #endif |
2229 | } |
2183 | } |
2230 | } |
2184 | } |
… | |
… | |
2289 | |
2243 | |
2290 | if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) |
2244 | if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) |
2291 | { |
2245 | { |
2292 | refresh_count = 0; |
2246 | refresh_count = 0; |
2293 | |
2247 | |
2294 | if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.) |
2248 | if (!option (Opt_skipScroll) || ev_time () > ev::now () + 1. / 60.) |
2295 | { |
2249 | { |
2296 | refreshnow = true; |
2250 | refreshnow = true; |
2297 | ch = NOCHAR; |
2251 | ch = NOCHAR; |
2298 | break; |
2252 | break; |
2299 | } |
2253 | } |
… | |
… | |
2510 | } |
2464 | } |
2511 | } |
2465 | } |
2512 | |
2466 | |
2513 | pclose_printer (fd); |
2467 | pclose_printer (fd); |
2514 | } |
2468 | } |
2515 | #endif /* PRINTPIPE */ |
2469 | #endif /* PRINTPIPE */ |
2516 | /*}}} */ |
2470 | /*}}} */ |
2517 | |
2471 | |
2518 | /* *INDENT-OFF* */ |
2472 | /* *INDENT-OFF* */ |
2519 | enum { |
2473 | enum { |
2520 | C1_40 = 0x40, |
2474 | C1_40 = 0x40, |
… | |
… | |
2806 | rxvt_term::process_csi_seq () |
2760 | rxvt_term::process_csi_seq () |
2807 | { |
2761 | { |
2808 | unicode_t ch, priv, i; |
2762 | unicode_t ch, priv, i; |
2809 | unsigned int nargs, p; |
2763 | unsigned int nargs, p; |
2810 | int n, ndef; |
2764 | int n, ndef; |
2811 | int arg[ESC_ARGS]; |
2765 | int arg[ESC_ARGS] = { }; |
2812 | |
2766 | |
2813 | memset (arg, 0, sizeof (arg)); |
|
|
2814 | nargs = 0; |
2767 | nargs = 0; |
2815 | |
2768 | |
2816 | priv = 0; |
2769 | priv = 0; |
2817 | ch = cmd_getc (); |
2770 | ch = cmd_getc (); |
2818 | if (ch >= '<' && ch <= '?') |
2771 | if (ch >= '<' && ch <= '?') |
|
|
2772 | { |
2819 | { /* '<' '=' '>' '?' */ |
2773 | /* '<' '=' '>' '?' */ |
2820 | priv = ch; |
2774 | priv = ch; |
2821 | ch = cmd_getc (); |
2775 | ch = cmd_getc (); |
2822 | } |
2776 | } |
2823 | |
2777 | |
2824 | /* read any numerical arguments */ |
2778 | /* read any numerical arguments */ |
… | |
… | |
2867 | { |
2821 | { |
2868 | // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, |
2822 | // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, |
2869 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
2823 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
2870 | // |
2824 | // |
2871 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
2825 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
2872 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
2826 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, 94 for urxvt <= 8.3, and 95 for later |
2873 | // that we do not support xterm mouse reporting (should be 95 when we do). |
2827 | // versions. |
2874 | // |
2828 | // |
2875 | tt_printf ("\033[>%d;94;0c", 'U'); |
2829 | tt_printf ("\033[>%d;95;0c", 'U'); |
2876 | } |
2830 | } |
2877 | break; |
2831 | break; |
2878 | case '?': |
2832 | case '?': |
2879 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
2833 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
2880 | process_terminal_mode (ch, priv, nargs, arg); |
2834 | process_terminal_mode (ch, priv, nargs, arg); |
… | |
… | |
3431 | break; |
3385 | break; |
3432 | case URxvt_Color_IT: |
3386 | case URxvt_Color_IT: |
3433 | process_color_seq (op, Color_IT, str, resp); |
3387 | process_color_seq (op, Color_IT, str, resp); |
3434 | break; |
3388 | break; |
3435 | #endif |
3389 | #endif |
3436 | #if ENABLE_TRANSPARENCY && TINTING |
3390 | #if ENABLE_TRANSPARENCY |
3437 | case URxvt_Color_tint: |
3391 | case URxvt_Color_tint: |
3438 | process_color_seq (op, Color_tint, str, resp); |
3392 | process_color_seq (op, Color_tint, str, resp); |
|
|
3393 | { |
|
|
3394 | bool changed = false; |
3439 | |
3395 | |
3440 | check_our_parents (); |
3396 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
3397 | changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
|
|
3398 | else |
|
|
3399 | changed = bgPixmap.unset_tint (); |
3441 | |
3400 | |
3442 | if (am_transparent) |
3401 | if (changed) |
3443 | want_full_refresh = want_refresh = 1; |
3402 | update_background (); |
|
|
3403 | } |
3444 | |
3404 | |
3445 | break; |
3405 | break; |
3446 | #endif |
3406 | #endif |
3447 | |
3407 | |
3448 | #if XPM_BACKGROUND |
3408 | #if BG_IMAGE_FROM_FILE |
3449 | case Rxvt_Pixmap: |
3409 | case Rxvt_Pixmap: |
3450 | { |
3410 | if (!strcmp (str, "?")) |
3451 | if (*str != ';') |
|
|
3452 | { |
3411 | { |
3453 | scale_pixmap (""); /* reset to default scaling */ |
3412 | char str[256]; |
3454 | set_bgPixmap (str); /* change pixmap */ |
3413 | |
3455 | scr_touch (true); |
3414 | sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ |
|
|
3415 | min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767), |
|
|
3416 | min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767)); |
|
|
3417 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
3456 | } |
3418 | } |
3457 | |
3419 | else |
|
|
3420 | { |
3458 | int changed = 0; |
3421 | int changed = 0; |
3459 | |
3422 | |
3460 | while ((str = strchr (str, ';')) != NULL) |
3423 | if (*str != ';') |
3461 | { |
3424 | { |
|
|
3425 | /* reset to default scaling :*/ |
|
|
3426 | bgPixmap.unset_geometry (); |
|
|
3427 | if (bgPixmap.set_file (str)) /* change pixmap */ |
|
|
3428 | changed++; |
|
|
3429 | str = strchr (str, ';'); |
|
|
3430 | if (str == NULL) |
|
|
3431 | bgPixmap.set_defaultGeometry (); |
|
|
3432 | } |
|
|
3433 | |
|
|
3434 | while (str) |
|
|
3435 | { |
3462 | str++; |
3436 | str++; |
3463 | changed += scale_pixmap (str); |
3437 | if (bgPixmap.set_geometry (str)) |
|
|
3438 | changed++; |
|
|
3439 | str = strchr (str, ';'); |
3464 | } |
3440 | } |
3465 | |
3441 | |
3466 | if (changed) |
3442 | if (changed) |
3467 | { |
3443 | update_background (); |
3468 | resize_pixmap (); |
|
|
3469 | scr_touch (true); |
|
|
3470 | } |
3444 | } |
3471 | #if ENABLE_TRANSPARENCY && defined(HAVE_AFTERIMAGE) |
|
|
3472 | if (option (Opt_transparent)) |
|
|
3473 | check_our_parents (); |
|
|
3474 | #endif |
|
|
3475 | } |
|
|
3476 | break; |
3445 | break; |
3477 | #endif |
3446 | #endif |
3478 | |
3447 | |
3479 | case Rxvt_restoreFG: |
3448 | case Rxvt_restoreFG: |
3480 | set_window_color (Color_fg, str); |
3449 | set_window_color (Color_fg, str); |
… | |
… | |
3604 | { |
3573 | { |
3605 | unsigned int i, j; |
3574 | unsigned int i, j; |
3606 | int state; |
3575 | int state; |
3607 | |
3576 | |
3608 | static const struct |
3577 | static const struct |
3609 | { |
3578 | { |
3610 | const int argval; |
3579 | const int argval; |
3611 | const unsigned long bit; |
3580 | const unsigned long bit; |
3612 | } |
|
|
3613 | |
|
|
3614 | argtopriv[] = { |
3581 | } argtopriv[] = { |
3615 | { 1, PrivMode_aplCUR }, |
3582 | { 1, PrivMode_aplCUR }, |
3616 | { 2, PrivMode_vt52 }, |
3583 | { 2, PrivMode_vt52 }, |
3617 | { 3, PrivMode_132 }, |
3584 | { 3, PrivMode_132 }, |
3618 | { 4, PrivMode_smoothScroll }, |
3585 | { 4, PrivMode_smoothScroll }, |
3619 | { 5, PrivMode_rVideo }, |
3586 | { 5, PrivMode_rVideo }, |
… | |
… | |
3635 | { 66, PrivMode_aplKP }, |
3602 | { 66, PrivMode_aplKP }, |
3636 | #ifndef NO_BACKSPACE_KEY |
3603 | #ifndef NO_BACKSPACE_KEY |
3637 | { 67, PrivMode_BackSpace }, |
3604 | { 67, PrivMode_BackSpace }, |
3638 | #endif |
3605 | #endif |
3639 | { 1000, PrivMode_MouseX11 }, |
3606 | { 1000, PrivMode_MouseX11 }, |
3640 | // 1001 Use Hilite Mouse Tracking. NYI, TODO |
3607 | { 1002, PrivMode_MouseBtnEvent }, |
3641 | // 1002 Use Cell Motion Mouse Tracking. NYI, TODO |
3608 | { 1003, PrivMode_MouseAnyEvent }, |
3642 | // 1003 Use All Motion Mouse Tracking. NYI, TODO |
|
|
3643 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3609 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3644 | { 1011, PrivMode_Keypress }, // rxvt extension |
3610 | { 1011, PrivMode_Keypress }, // rxvt extension |
3645 | // 1035 enable modifiers for alt, numlock NYI |
3611 | // 1035 enable modifiers for alt, numlock NYI |
3646 | // 1036 send ESC for meta keys NYI |
3612 | // 1036 send ESC for meta keys NYI |
3647 | // 1037 send DEL for keypad delete NYI |
3613 | // 1037 send DEL for keypad delete NYI |
… | |
… | |
3704 | */ |
3670 | */ |
3705 | PrivMode (1, PrivMode_vt52); |
3671 | PrivMode (1, PrivMode_vt52); |
3706 | break; |
3672 | break; |
3707 | case 3: /* 80/132 */ |
3673 | case 3: /* 80/132 */ |
3708 | if (priv_modes & PrivMode_132OK) |
3674 | if (priv_modes & PrivMode_132OK) |
|
|
3675 | { |
|
|
3676 | scr_poweron (); |
3709 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
3677 | set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight); |
|
|
3678 | } |
3710 | break; |
3679 | break; |
3711 | case 4: /* smooth scrolling */ |
3680 | case 4: /* smooth scrolling */ |
3712 | set_option (Opt_jumpScroll, !state); |
3681 | set_option (Opt_jumpScroll, !state); |
3713 | break; |
3682 | break; |
3714 | case 5: /* reverse video */ |
3683 | case 5: /* reverse video */ |
… | |
… | |
3721 | scr_autowrap (state); |
3690 | scr_autowrap (state); |
3722 | break; |
3691 | break; |
3723 | /* case 8: - auto repeat, can't do on a per window basis */ |
3692 | /* case 8: - auto repeat, can't do on a per window basis */ |
3724 | case 9: /* X10 mouse reporting */ |
3693 | case 9: /* X10 mouse reporting */ |
3725 | if (state) /* orthogonal */ |
3694 | if (state) /* orthogonal */ |
3726 | priv_modes &= ~PrivMode_MouseX11; |
3695 | priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
3727 | break; |
3696 | break; |
3728 | #ifdef scrollBar_esc |
3697 | #ifdef scrollBar_esc |
3729 | case scrollBar_esc: |
3698 | case scrollBar_esc: |
3730 | if (scrollbar_mapping (state)) |
3699 | if (scrollbar_mapping (state)) |
3731 | { |
3700 | { |
… | |
… | |
3744 | break; |
3713 | break; |
3745 | /* case 66: - application key pad */ |
3714 | /* case 66: - application key pad */ |
3746 | /* case 67: - backspace key */ |
3715 | /* case 67: - backspace key */ |
3747 | case 1000: /* X11 mouse reporting */ |
3716 | case 1000: /* X11 mouse reporting */ |
3748 | if (state) /* orthogonal */ |
3717 | if (state) /* orthogonal */ |
3749 | priv_modes &= ~PrivMode_MouseX10; |
3718 | priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
3750 | break; |
3719 | break; |
3751 | #if 0 |
|
|
3752 | case 1001: |
3720 | case 1002: |
3753 | break; /* X11 mouse highlighting */ |
3721 | case 1003: |
3754 | #endif |
3722 | if (state) |
|
|
3723 | { |
|
|
3724 | priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11); |
|
|
3725 | priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; |
|
|
3726 | vt_emask_mouse = PointerMotionMask; |
|
|
3727 | } |
|
|
3728 | else |
|
|
3729 | vt_emask_mouse = NoEventMask; |
|
|
3730 | vt_select_input (); |
|
|
3731 | break; |
3755 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3732 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3756 | set_option (Opt_scrollTtyOutput, !state); |
3733 | set_option (Opt_scrollTtyOutput, !state); |
3757 | break; |
3734 | break; |
3758 | case 1011: /* scroll to bottom on key press */ |
3735 | case 1011: /* scroll to bottom on key press */ |
3759 | set_option (Opt_scrollTtyKeypress, state); |
3736 | set_option (Opt_scrollTtyKeypress, state); |
… | |
… | |
3936 | rxvt_term::process_graphics () |
3913 | rxvt_term::process_graphics () |
3937 | { |
3914 | { |
3938 | unicode_t ch, cmd = cmd_getc (); |
3915 | unicode_t ch, cmd = cmd_getc (); |
3939 | |
3916 | |
3940 | if (cmd == 'Q') |
3917 | if (cmd == 'Q') |
|
|
3918 | { |
3941 | { /* query graphics */ |
3919 | /* query graphics */ |
3942 | tt_printf ("\033G0\012"); /* no graphics */ |
3920 | tt_printf ("\033G0\012"); /* no graphics */ |
3943 | return; |
3921 | return; |
3944 | } |
3922 | } |
3945 | /* swallow other graphics sequences until terminating ':' */ |
3923 | /* swallow other graphics sequences until terminating ':' */ |
3946 | do |
3924 | do |
… | |
… | |
3996 | v_buffer = (char *)realloc (v_buffer, v_buflen + len); |
3974 | v_buffer = (char *)realloc (v_buffer, v_buflen + len); |
3997 | |
3975 | |
3998 | memcpy (v_buffer + v_buflen, data, len); |
3976 | memcpy (v_buffer + v_buflen, data, len); |
3999 | v_buflen += len; |
3977 | v_buflen += len; |
4000 | |
3978 | |
4001 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
3979 | pty_ev.set (ev::READ | ev::WRITE); |
4002 | } |
3980 | } |
4003 | |
3981 | |
4004 | void rxvt_term::pty_write () |
3982 | void rxvt_term::pty_write () |
4005 | { |
3983 | { |
4006 | int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
3984 | int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
… | |
… | |
4011 | |
3989 | |
4012 | if (v_buflen == 0) |
3990 | if (v_buflen == 0) |
4013 | { |
3991 | { |
4014 | free (v_buffer); |
3992 | free (v_buffer); |
4015 | v_buffer = 0; |
3993 | v_buffer = 0; |
4016 | v_buflen = 0; |
|
|
4017 | |
3994 | |
4018 | pty_ev.set (EVENT_READ); |
3995 | pty_ev.set (ev::READ); |
4019 | return; |
3996 | return; |
4020 | } |
3997 | } |
4021 | |
3998 | |
4022 | memmove (v_buffer, v_buffer + written, v_buflen); |
3999 | memmove (v_buffer, v_buffer + written, v_buflen); |
4023 | } |
4000 | } |
4024 | else if (written != -1 || (errno != EAGAIN && errno != EINTR)) |
4001 | else if (written != -1 || (errno != EAGAIN && errno != EINTR)) |
4025 | pty_ev.set (EVENT_READ); |
4002 | pty_ev.set (ev::READ); |
4026 | } |
4003 | } |
4027 | |
4004 | |
4028 | /*----------------------- end-of-file (C source) -----------------------*/ |
4005 | /*----------------------- end-of-file (C source) -----------------------*/ |
4029 | |
4006 | |