1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: command.C |
2 | * File: command.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
6 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
… | |
… | |
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. |
… | |
… | |
49 | #include "rxvt.h" |
50 | #include "rxvt.h" |
50 | #include "rxvtperl.h" |
51 | #include "rxvtperl.h" |
51 | #include "version.h" |
52 | #include "version.h" |
52 | #include "command.h" |
53 | #include "command.h" |
53 | |
54 | |
54 | #if HAVE_SCHED_YIELD |
|
|
55 | #undef HAVE_SCHED_YIELD // disabled for the time being |
|
|
56 | //# include <sched.h> |
|
|
57 | #endif |
|
|
58 | |
|
|
59 | #ifdef KEYSYM_RESOURCE |
55 | #ifdef KEYSYM_RESOURCE |
60 | # include "keyboard.h" |
56 | # include "keyboard.h" |
61 | #endif |
57 | #endif |
62 | |
58 | |
63 | #include <csignal> |
59 | #include <csignal> |
|
|
60 | |
|
|
61 | #if LINUX_YIELD_HACK |
|
|
62 | # include <ctime> |
|
|
63 | #endif |
64 | |
64 | |
65 | /*----------------------------------------------------------------------*/ |
65 | /*----------------------------------------------------------------------*/ |
66 | |
66 | |
67 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
67 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
68 | |
68 | |
… | |
… | |
96 | XK_Shift_L, 0x21e7, |
96 | XK_Shift_L, 0x21e7, |
97 | XK_Shift_R, 0x21e7, |
97 | XK_Shift_R, 0x21e7, |
98 | |
98 | |
99 | XK_Shift_Lock, 0x21eb, |
99 | XK_Shift_Lock, 0x21eb, |
100 | XK_ISO_Lock, 0x21eb, |
100 | XK_ISO_Lock, 0x21eb, |
101 | XK_ISO_Lock, 0x21eb, |
|
|
102 | XK_Caps_Lock, 0x21ec, |
101 | XK_Caps_Lock, 0x21ec, |
103 | XK_Num_Lock, 0x21ed, |
102 | XK_Num_Lock, 0x21ed, |
104 | XK_ISO_Level3_Shift, 0x21ee, |
103 | XK_ISO_Level3_Shift, 0x21ee, |
105 | XK_ISO_Level3_Lock, 0x21ef, |
104 | XK_ISO_Level3_Lock, 0x21ef, |
106 | XK_ISO_Group_Lock, 0x21f0, |
105 | XK_ISO_Group_Lock, 0x21f0, |
… | |
… | |
200 | r & RS_Uline ? " uline" : "", |
199 | r & RS_Uline ? " uline" : "", |
201 | r & RS_Careful ? " careful" : ""); |
200 | r & RS_Careful ? " careful" : ""); |
202 | |
201 | |
203 | int width = wcswidth (fname, wcslen (fname)); |
202 | int width = wcswidth (fname, wcslen (fname)); |
204 | |
203 | |
205 | max_it (width, 8+5); // for char + hey |
204 | max_it (width, 8+5); // for char + hex |
206 | max_it (width, strlen (attr)); |
205 | max_it (width, strlen (attr)); |
207 | |
206 | |
208 | if (y >= 0) |
207 | if (y >= 0) |
209 | { |
208 | { |
210 | y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1; |
209 | y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1; |
… | |
… | |
222 | ch = *chr++; |
221 | ch = *chr++; |
223 | |
222 | |
224 | sprintf (buf, "%8x", ch); |
223 | sprintf (buf, "%8x", ch); |
225 | scr_overlay_set (0, y, buf); |
224 | scr_overlay_set (0, y, buf); |
226 | scr_overlay_set (9, y, '='); |
225 | scr_overlay_set (9, y, '='); |
227 | # if !UNICODE3 |
226 | # if !UNICODE_3 |
228 | if (ch >= 0x10000) |
227 | if (ch >= 0x10000) |
229 | ch = 0xfffd; |
228 | ch = 0xfffd; |
230 | # endif |
229 | # endif |
231 | scr_overlay_set (11, y, ch, r); |
230 | scr_overlay_set (11, y, ch, r); |
232 | |
231 | |
… | |
… | |
299 | |
298 | |
300 | return -1; |
299 | return -1; |
301 | } |
300 | } |
302 | #endif |
301 | #endif |
303 | |
302 | |
304 | /*{{{ Convert the keypress event into a string */ |
|
|
305 | void |
303 | void |
306 | rxvt_term::lookup_key (XKeyEvent &ev) |
304 | rxvt_term::key_press (XKeyEvent &ev) |
307 | { |
305 | { |
308 | int ctrl, meta, shft, len; |
306 | int ctrl, meta, shft, len; |
309 | unsigned int newlen; |
307 | unsigned int newlen; |
310 | KeySym keysym; |
308 | KeySym keysym; |
311 | int valid_keysym; |
309 | int valid_keysym; |
312 | char kbuf[KBUFSZ]; |
310 | char kbuf[KBUFSZ]; |
|
|
311 | |
|
|
312 | #if ISO_14755 |
|
|
313 | if (iso14755buf & ISO_14755_52) |
|
|
314 | return; |
|
|
315 | #endif |
313 | |
316 | |
314 | /* |
317 | /* |
315 | * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an |
318 | * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an |
316 | * escape sequence to toggle the Keypad. |
319 | * escape sequence to toggle the Keypad. |
317 | * |
320 | * |
… | |
… | |
497 | # if ISO_14755 |
500 | # if ISO_14755 |
498 | iso14755_51 (0); |
501 | iso14755_51 (0); |
499 | # endif |
502 | # endif |
500 | return; |
503 | return; |
501 | } |
504 | } |
|
|
505 | else if (keysym == XK_BackSpace) |
|
|
506 | { |
|
|
507 | iso14755buf = ((iso14755buf & ISO_14755_MASK) >> 4) | ISO_14755_51; |
|
|
508 | # if ISO_14755 |
|
|
509 | iso14755_51 (iso14755buf & ISO_14755_MASK); |
|
|
510 | # endif |
|
|
511 | return; |
|
|
512 | } |
502 | else if ((hv = hex_keyval (ev)) >= 0) |
513 | else if ((hv = hex_keyval (ev)) >= 0) |
503 | { |
514 | { |
504 | iso14755buf = ((iso14755buf << 4) & ISO_14755_MASK) |
515 | iso14755buf = ((iso14755buf << 4) & ISO_14755_MASK) |
505 | | hv | ISO_14755_51; |
516 | | hv | ISO_14755_51; |
506 | # if ISO_14755 |
517 | # if ISO_14755 |
… | |
… | |
508 | # endif |
519 | # endif |
509 | return; |
520 | return; |
510 | } |
521 | } |
511 | else |
522 | else |
512 | { |
523 | { |
513 | # if ENABLE_OVERLAY |
524 | # if ISO_14755 |
514 | scr_overlay_off (); |
525 | scr_overlay_off (); |
515 | # endif |
526 | # endif |
516 | iso14755buf = 0; |
527 | iso14755buf = 0; |
517 | } |
528 | } |
518 | } |
529 | } |
519 | else if ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R)) |
530 | else if ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R)) |
520 | || (shft && (keysym == XK_Control_L || keysym == XK_Control_R))) |
531 | || (shft && (keysym == XK_Control_L || keysym == XK_Control_R))) |
521 | if (!(iso14755buf & ISO_14755_STARTED)) |
532 | if (!(iso14755buf & ISO_14755_STARTED)) |
522 | { |
533 | { |
523 | iso14755buf |= ISO_14755_STARTED; |
534 | iso14755buf |= ISO_14755_STARTED; |
524 | # if ENABLE_OVERLAY |
535 | # if ISO_14755 |
525 | scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); |
536 | scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); |
526 | scr_overlay_set (0, 0, "ISO 14755 mode"); |
537 | scr_overlay_set (0, 0, "ISO 14755 mode"); |
527 | # endif |
538 | # endif |
528 | } |
539 | } |
529 | #endif |
540 | #endif |
530 | |
541 | |
531 | #ifdef PRINTPIPE |
542 | #ifdef PRINTPIPE |
532 | if (keysym == XK_Print) |
543 | if (keysym == XK_Print) |
533 | { |
544 | { |
534 | scr_printscreen (ctrl | shft); |
545 | scr_printscreen (ctrl | shft); |
535 | return; |
546 | return; |
… | |
… | |
537 | #endif |
548 | #endif |
538 | |
549 | |
539 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
550 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
540 | { |
551 | { |
541 | { |
552 | { |
|
|
553 | bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; |
542 | 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 |
543 | switch (keysym) |
585 | switch (keysym) |
544 | { |
586 | { |
545 | #ifndef NO_BACKSPACE_KEY |
587 | #ifndef NO_BACKSPACE_KEY |
546 | case XK_BackSpace: |
588 | case XK_BackSpace: |
547 | if (priv_modes & PrivMode_HaveBackSpace) |
589 | if (priv_modes & PrivMode_HaveBackSpace) |
… | |
… | |
549 | kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) |
591 | kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) |
550 | ^ !!ctrl) ? '\b' : '\177'; |
592 | ^ !!ctrl) ? '\b' : '\177'; |
551 | kbuf[1] = '\0'; |
593 | kbuf[1] = '\0'; |
552 | } |
594 | } |
553 | else |
595 | else |
554 | strcpy (kbuf, key_backspace); |
596 | strcpy (kbuf, rs[Rs_backspace_key]); |
555 | break; |
597 | break; |
556 | #endif |
598 | #endif |
557 | #ifndef NO_DELETE_KEY |
599 | #ifndef NO_DELETE_KEY |
558 | # ifdef XK_KP_Prior |
|
|
559 | case XK_KP_Delete: |
|
|
560 | /* allow shift to override */ |
|
|
561 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
562 | { |
|
|
563 | strcpy (kbuf, "\033On"); |
|
|
564 | break; |
|
|
565 | } |
|
|
566 | /* FALLTHROUGH */ |
|
|
567 | # endif |
|
|
568 | case XK_Delete: |
600 | case XK_Delete: |
569 | strcpy (kbuf, key_delete); |
601 | strcpy (kbuf, rs[Rs_delete_key]); |
570 | break; |
602 | break; |
571 | #endif |
603 | #endif |
572 | case XK_Tab: |
604 | case XK_Tab: |
573 | if (shft) |
605 | if (shft) |
574 | strcpy (kbuf, "\033[Z"); |
606 | strcpy (kbuf, "\033[Z"); |
… | |
… | |
584 | #endif |
616 | #endif |
585 | newlen = 0; |
617 | newlen = 0; |
586 | } |
618 | } |
587 | break; |
619 | break; |
588 | |
620 | |
589 | #ifdef XK_KP_Left |
|
|
590 | case XK_KP_Up: /* \033Ox or standard */ |
|
|
591 | case XK_KP_Down: /* \033Or or standard */ |
|
|
592 | case XK_KP_Right: /* \033Ov or standard */ |
|
|
593 | case XK_KP_Left: /* \033Ot or standard */ |
|
|
594 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
595 | { |
|
|
596 | strcpy (kbuf, "\033OZ"); |
|
|
597 | kbuf[2] = "txvr"[keysym - XK_KP_Left]; |
|
|
598 | break; |
|
|
599 | } |
|
|
600 | else |
|
|
601 | /* translate to std. cursor key */ |
|
|
602 | keysym = XK_Left + (keysym - XK_KP_Left); |
|
|
603 | /* FALLTHROUGH */ |
|
|
604 | #endif |
|
|
605 | case XK_Up: /* "\033[A" */ |
621 | case XK_Up: /* "\033[A" */ |
606 | case XK_Down: /* "\033[B" */ |
622 | case XK_Down: /* "\033[B" */ |
607 | case XK_Right: /* "\033[C" */ |
623 | case XK_Right: /* "\033[C" */ |
608 | case XK_Left: /* "\033[D" */ |
624 | case XK_Left: /* "\033[D" */ |
609 | strcpy (kbuf, "\033[Z"); |
625 | strcpy (kbuf, "\033[Z"); |
… | |
… | |
619 | else if (priv_modes & PrivMode_aplCUR) |
635 | else if (priv_modes & PrivMode_aplCUR) |
620 | kbuf[1] = 'O'; |
636 | kbuf[1] = 'O'; |
621 | break; |
637 | break; |
622 | |
638 | |
623 | #ifndef UNSHIFTED_SCROLLKEYS |
639 | #ifndef UNSHIFTED_SCROLLKEYS |
624 | # ifdef XK_KP_Prior |
|
|
625 | case XK_KP_Prior: |
|
|
626 | /* allow shift to override */ |
|
|
627 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
628 | { |
|
|
629 | strcpy (kbuf, "\033Oy"); |
|
|
630 | break; |
|
|
631 | } |
|
|
632 | /* FALLTHROUGH */ |
|
|
633 | # endif |
|
|
634 | case XK_Prior: |
640 | case XK_Prior: |
635 | strcpy (kbuf, "\033[5~"); |
641 | strcpy (kbuf, "\033[5~"); |
636 | break; |
642 | break; |
637 | # ifdef XK_KP_Next |
|
|
638 | case XK_KP_Next: |
|
|
639 | /* allow shift to override */ |
|
|
640 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
641 | { |
|
|
642 | strcpy (kbuf, "\033Os"); |
|
|
643 | break; |
|
|
644 | } |
|
|
645 | /* FALLTHROUGH */ |
|
|
646 | # endif |
|
|
647 | case XK_Next: |
643 | case XK_Next: |
648 | strcpy (kbuf, "\033[6~"); |
644 | strcpy (kbuf, "\033[6~"); |
649 | break; |
645 | break; |
650 | #endif |
646 | #endif |
651 | case XK_KP_Enter: |
647 | case XK_KP_Enter: |
652 | /* allow shift to override */ |
648 | /* allow shift to override */ |
653 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
649 | if (kp) |
654 | { |
650 | { |
655 | strcpy (kbuf, "\033OM"); |
651 | strcpy (kbuf, "\033OM"); |
656 | break; |
652 | break; |
657 | } |
653 | } |
658 | |
654 | |
… | |
… | |
670 | kbuf[0] = '\015'; |
666 | kbuf[0] = '\015'; |
671 | kbuf[1] = '\0'; |
667 | kbuf[1] = '\0'; |
672 | } |
668 | } |
673 | break; |
669 | break; |
674 | |
670 | |
675 | #ifdef XK_KP_Begin |
|
|
676 | case XK_KP_Begin: |
|
|
677 | strcpy (kbuf, "\033Ou"); |
|
|
678 | break; |
|
|
679 | |
|
|
680 | #endif |
|
|
681 | case XK_KP_F1: /* "\033OP" */ |
671 | case XK_KP_F1: /* "\033OP" */ |
682 | case XK_KP_F2: /* "\033OQ" */ |
672 | case XK_KP_F2: /* "\033OQ" */ |
683 | case XK_KP_F3: /* "\033OR" */ |
673 | case XK_KP_F3: /* "\033OR" */ |
684 | case XK_KP_F4: /* "\033OS" */ |
674 | case XK_KP_F4: /* "\033OS" */ |
685 | strcpy (kbuf, "\033OP"); |
675 | strcpy (kbuf, "\033OP"); |
… | |
… | |
701 | case XK_KP_6: /* "\033Ov" : "6" */ |
691 | case XK_KP_6: /* "\033Ov" : "6" */ |
702 | case XK_KP_7: /* "\033Ow" : "7" */ |
692 | case XK_KP_7: /* "\033Ow" : "7" */ |
703 | case XK_KP_8: /* "\033Ox" : "8" */ |
693 | case XK_KP_8: /* "\033Ox" : "8" */ |
704 | case XK_KP_9: /* "\033Oy" : "9" */ |
694 | case XK_KP_9: /* "\033Oy" : "9" */ |
705 | /* allow shift to override */ |
695 | /* allow shift to override */ |
706 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
696 | if (kp) |
707 | { |
697 | { |
708 | strcpy (kbuf, "\033Oj"); |
698 | strcpy (kbuf, "\033Oj"); |
709 | kbuf[2] += (keysym - XK_KP_Multiply); |
699 | kbuf[2] += (keysym - XK_KP_Multiply); |
710 | } |
700 | } |
711 | else |
701 | else |
… | |
… | |
717 | |
707 | |
718 | case XK_Find: |
708 | case XK_Find: |
719 | strcpy (kbuf, "\033[1~"); |
709 | strcpy (kbuf, "\033[1~"); |
720 | break; |
710 | break; |
721 | |
711 | |
722 | #ifdef XK_KP_End |
|
|
723 | case XK_KP_Insert: |
|
|
724 | /* allow shift to override */ |
|
|
725 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
726 | { |
|
|
727 | strcpy (kbuf, "\033Op"); |
|
|
728 | break; |
|
|
729 | } |
|
|
730 | /* FALLTHROUGH */ |
|
|
731 | #endif |
|
|
732 | case XK_Insert: |
712 | case XK_Insert: |
733 | strcpy (kbuf, "\033[2~"); |
713 | strcpy (kbuf, "\033[2~"); |
734 | break; |
714 | break; |
735 | #ifdef DXK_Remove /* support for DEC remove like key */ |
715 | #ifdef DXK_Remove /* support for DEC remove like key */ |
736 | case DXK_Remove: |
716 | case DXK_Remove: |
… | |
… | |
740 | strcpy (kbuf, "\033[3~"); |
720 | strcpy (kbuf, "\033[3~"); |
741 | break; |
721 | break; |
742 | case XK_Select: |
722 | case XK_Select: |
743 | strcpy (kbuf, "\033[4~"); |
723 | strcpy (kbuf, "\033[4~"); |
744 | break; |
724 | break; |
745 | #ifdef XK_KP_End |
|
|
746 | case XK_KP_End: |
|
|
747 | /* allow shift to override */ |
|
|
748 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
749 | { |
|
|
750 | strcpy (kbuf, "\033Oq"); |
|
|
751 | break; |
|
|
752 | } |
|
|
753 | /* FALLTHROUGH */ |
|
|
754 | #endif |
|
|
755 | case XK_End: |
725 | case XK_End: |
756 | strcpy (kbuf, KS_END); |
726 | strcpy (kbuf, KS_END); |
757 | break; |
727 | break; |
758 | #ifdef XK_KP_Home |
|
|
759 | case XK_KP_Home: |
|
|
760 | /* allow shift to override */ |
|
|
761 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
762 | { |
|
|
763 | strcpy (kbuf, "\033Ow"); |
|
|
764 | break; |
|
|
765 | } |
|
|
766 | /* FALLTHROUGH */ |
|
|
767 | #endif |
|
|
768 | case XK_Home: |
728 | case XK_Home: |
769 | strcpy (kbuf, KS_HOME); |
729 | strcpy (kbuf, KS_HOME); |
770 | break; |
730 | break; |
771 | |
731 | |
772 | #define FKEY(n, fkey) \ |
732 | #define FKEY(n, fkey) \ |
… | |
… | |
874 | return; |
834 | return; |
875 | |
835 | |
876 | if (len <= 0) |
836 | if (len <= 0) |
877 | return; /* not mapped */ |
837 | return; /* not mapped */ |
878 | |
838 | |
879 | if (OPTION (Opt_scrollTtyKeypress)) |
839 | if (option (Opt_scrollTtyKeypress)) |
880 | if (view_start) |
840 | if (view_start) |
881 | { |
841 | { |
882 | view_start = 0; |
842 | view_start = 0; |
883 | want_refresh = 1; |
843 | want_refresh = 1; |
884 | } |
844 | } |
… | |
… | |
908 | tt_write (&ch, 1); |
868 | tt_write (&ch, 1); |
909 | } |
869 | } |
910 | |
870 | |
911 | tt_write (kbuf, (unsigned int)len); |
871 | tt_write (kbuf, (unsigned int)len); |
912 | } |
872 | } |
913 | /*}}} */ |
873 | |
|
|
874 | void |
|
|
875 | rxvt_term::key_release (XKeyEvent &ev) |
|
|
876 | { |
|
|
877 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 || ENABLE_PERL |
|
|
878 | KeySym keysym; |
|
|
879 | |
|
|
880 | keysym = XLookupKeysym (&ev, ev.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
|
|
881 | #endif |
|
|
882 | |
|
|
883 | #if ENABLE_FRILLS || ISO_14755 |
|
|
884 | // ISO 14755 support |
|
|
885 | if (iso14755buf) |
|
|
886 | if (iso14755buf & ISO_14755_52) |
|
|
887 | { |
|
|
888 | # if ISO_14755 |
|
|
889 | scr_overlay_off (); |
|
|
890 | # endif |
|
|
891 | # if ISO_14755 |
|
|
892 | // iso14755 part 5.2 handling: release time |
|
|
893 | // first: controls |
|
|
894 | if ((ev.state & ControlMask) |
|
|
895 | && ((keysym >= 0x40 && keysym <= 0x5f) |
|
|
896 | || (keysym >= 0x61 && keysym <= 0x7f))) |
|
|
897 | { |
|
|
898 | iso14755buf = ISO_14755_51 | 0x2400 | (keysym & 0x1f); |
|
|
899 | commit_iso14755 (); |
|
|
900 | |
|
|
901 | return; |
|
|
902 | } |
|
|
903 | |
|
|
904 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
|
|
905 | if (i[0] == keysym) |
|
|
906 | { |
|
|
907 | iso14755buf = ISO_14755_51 | i[1]; |
|
|
908 | commit_iso14755 (); |
|
|
909 | |
|
|
910 | return; |
|
|
911 | } |
|
|
912 | |
|
|
913 | scr_bell (); |
|
|
914 | # endif |
|
|
915 | iso14755buf = 0; |
|
|
916 | |
|
|
917 | return; |
|
|
918 | } |
|
|
919 | else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) |
|
|
920 | { |
|
|
921 | # if ISO_14755 |
|
|
922 | scr_overlay_off (); |
|
|
923 | # endif |
|
|
924 | if (iso14755buf & ISO_14755_51) |
|
|
925 | commit_iso14755 (); |
|
|
926 | #if ISO_14755 |
|
|
927 | else if (option (Opt_iso14755_52) && iso14755buf & ISO_14755_STARTED) |
|
|
928 | { |
|
|
929 | iso14755buf = ISO_14755_52; // iso14755 part 5.2: remember empty begin/end pair |
|
|
930 | |
|
|
931 | scr_overlay_new (0, -1, sizeof ("KEYCAP PICTURE INSERT MODE") - 1, 1); |
|
|
932 | scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE"); |
|
|
933 | } |
|
|
934 | # endif |
|
|
935 | else |
|
|
936 | iso14755buf = 0; |
|
|
937 | } |
|
|
938 | #endif |
|
|
939 | |
|
|
940 | if (HOOK_INVOKE ((this, HOOK_KEY_RELEASE, DT_XEVENT, &ev, DT_INT, keysym, DT_END))) |
|
|
941 | return; |
|
|
942 | |
|
|
943 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
|
|
944 | if (!(ev.state & ControlMask)) |
|
|
945 | slip_wheel_ev.stop (); |
|
|
946 | else if (keysym == XK_Control_L || keysym == XK_Control_R) |
|
|
947 | mouse_slip_wheel_speed = 0; |
|
|
948 | #endif |
|
|
949 | } |
914 | |
950 | |
915 | #if defined (KEYSYM_RESOURCE) |
951 | #if defined (KEYSYM_RESOURCE) |
916 | unsigned int |
952 | unsigned int |
917 | rxvt_term::cmd_write (const char *str, unsigned int count) |
953 | rxvt_term::cmd_write (const char *str, unsigned int count) |
918 | { |
954 | { |
… | |
… | |
948 | void |
984 | void |
949 | rxvt_term::flush () |
985 | rxvt_term::flush () |
950 | { |
986 | { |
951 | flush_ev.stop (); |
987 | flush_ev.stop (); |
952 | |
988 | |
953 | #ifdef TRANSPARENT |
989 | #ifdef HAVE_BG_PIXMAP |
954 | if (want_full_refresh) |
990 | if (bgPixmap.check_clearChanged ()) |
955 | { |
991 | { |
956 | want_full_refresh = 0; |
992 | // scr_clear (true); This needs to be researched further! |
957 | scr_clear (); |
|
|
958 | scr_touch (false); |
993 | scr_touch (false); |
959 | } |
994 | } |
960 | #endif |
995 | #endif |
961 | |
996 | |
962 | if (want_refresh) |
997 | if (want_refresh) |
… | |
… | |
1007 | } |
1042 | } |
1008 | |
1043 | |
1009 | display->flush (); |
1044 | display->flush (); |
1010 | } |
1045 | } |
1011 | |
1046 | |
|
|
1047 | /* checks wether a refresh is requested and starts the refresh timer */ |
1012 | void |
1048 | void |
1013 | rxvt_term::check_cb (check_watcher &w) |
1049 | rxvt_term::refresh_check () |
|
|
1050 | { |
|
|
1051 | if (want_refresh && !flush_ev.is_active ()) |
|
|
1052 | flush_ev.start (1. / 60.); // refresh at max. 60 Hz normally |
|
|
1053 | |
|
|
1054 | display->flush (); |
|
|
1055 | } |
|
|
1056 | |
|
|
1057 | void |
|
|
1058 | rxvt_term::flush_cb (ev::timer &w, int revents) |
1014 | { |
1059 | { |
1015 | make_current (); |
1060 | make_current (); |
1016 | |
1061 | |
1017 | display->flush (); |
|
|
1018 | |
|
|
1019 | if (want_refresh && !flush_ev.active) |
|
|
1020 | flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally |
|
|
1021 | } |
|
|
1022 | |
|
|
1023 | void |
|
|
1024 | rxvt_term::flush_cb (time_watcher &w) |
|
|
1025 | { |
|
|
1026 | make_current (); |
|
|
1027 | |
|
|
1028 | refresh_limit = 1; |
|
|
1029 | refresh_count = 0; |
1062 | refresh_count = 0; |
1030 | flush (); |
1063 | flush (); |
1031 | } |
1064 | } |
1032 | |
1065 | |
1033 | #ifdef CURSOR_BLINK |
1066 | #ifdef CURSOR_BLINK |
1034 | void |
1067 | void |
1035 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1068 | rxvt_term::cursor_blink_cb (ev::timer &w, int revents) |
1036 | { |
1069 | { |
1037 | hidden_cursor = !hidden_cursor; |
1070 | hidden_cursor = !hidden_cursor; |
1038 | want_refresh = 1; |
1071 | want_refresh = 1; |
1039 | |
1072 | refresh_check (); |
1040 | w.start (w.at + CURSOR_BLINK_INTERVAL); |
|
|
1041 | } |
1073 | } |
1042 | #endif |
1074 | #endif |
1043 | |
1075 | |
1044 | #ifdef TEXT_BLINK |
1076 | #ifdef TEXT_BLINK |
1045 | void |
1077 | void |
1046 | rxvt_term::text_blink_cb (time_watcher &w) |
1078 | rxvt_term::text_blink_cb (ev::timer &w, int revents) |
1047 | { |
1079 | { |
1048 | if (scr_refresh_rend (RS_Blink, RS_Blink)) |
1080 | if (scr_refresh_rend (RS_Blink, RS_Blink)) |
1049 | { |
1081 | { |
1050 | hidden_text = !hidden_text; |
1082 | hidden_text = !hidden_text; |
1051 | want_refresh = 1; |
1083 | want_refresh = 1; |
1052 | w.start (w.at + TEXT_BLINK_INTERVAL); |
1084 | refresh_check (); |
1053 | } |
1085 | } |
|
|
1086 | else |
|
|
1087 | w.stop (); |
1054 | } |
1088 | } |
1055 | #endif |
1089 | #endif |
1056 | |
1090 | |
1057 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1091 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1058 | void |
1092 | void |
1059 | rxvt_term::cont_scroll_cb (time_watcher &w) |
1093 | rxvt_term::cont_scroll_cb (ev::timer &w, int revents) |
1060 | { |
1094 | { |
1061 | if ((scrollbar_isUp() || scrollbar_isDn()) && |
1095 | if ((scrollbar_isUp () || scrollbar_isDn ()) |
1062 | scr_page (scrollbar_isUp() ? UP : DN, 1)) |
1096 | && scr_page (scrollbar_isUp () ? UP : DN, 1)) |
1063 | { |
1097 | { |
1064 | want_refresh = 1; |
1098 | want_refresh = 1; |
1065 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1099 | refresh_check (); |
1066 | } |
1100 | } |
|
|
1101 | else |
|
|
1102 | w.stop (); |
1067 | } |
1103 | } |
1068 | #endif |
1104 | #endif |
1069 | |
1105 | |
1070 | #ifdef SELECTION_SCROLLING |
1106 | #ifdef SELECTION_SCROLLING |
1071 | void |
1107 | void |
1072 | rxvt_term::sel_scroll_cb (time_watcher &w) |
1108 | rxvt_term::sel_scroll_cb (ev::timer &w, int revents) |
1073 | { |
1109 | { |
1074 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1110 | if (scr_page (scroll_selection_dir, scroll_selection_lines)) |
1075 | { |
1111 | { |
1076 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1112 | selection_extend (selection_save_x, selection_save_y, selection_save_state); |
1077 | want_refresh = 1; |
1113 | want_refresh = 1; |
1078 | w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); |
1114 | refresh_check (); |
1079 | } |
1115 | } |
|
|
1116 | else |
|
|
1117 | w.stop (); |
1080 | } |
1118 | } |
1081 | #endif |
1119 | #endif |
1082 | |
1120 | |
1083 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1121 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1084 | void |
1122 | void |
1085 | rxvt_term::slip_wheel_cb (time_watcher &w) |
1123 | rxvt_term::slip_wheel_cb (ev::timer &w, int revents) |
1086 | { |
1124 | { |
1087 | if (mouse_slip_wheel_speed == 0 |
1125 | if (scr_changeview (view_start - mouse_slip_wheel_speed)) |
1088 | || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) |
|
|
1089 | : scr_page (UP, mouse_slip_wheel_speed)) |
|
|
1090 | { |
1126 | { |
1091 | if (view_start == top_row || view_start == 0) |
|
|
1092 | mouse_slip_wheel_speed = 0; |
|
|
1093 | |
|
|
1094 | want_refresh = 1; |
1127 | want_refresh = 1; |
1095 | 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) |
1096 | } |
1132 | { |
|
|
1133 | mouse_slip_wheel_speed = 0; |
|
|
1134 | w.stop (); |
|
|
1135 | } |
1097 | } |
1136 | } |
1098 | #endif |
1137 | #endif |
1099 | |
1138 | |
1100 | #if HAVE_SCHED_YIELD |
1139 | #if LINUX_YIELD_HACK |
1101 | static struct event_handler |
1140 | static struct event_handler |
1102 | { |
1141 | { |
1103 | check_watcher cw_yield; |
1142 | ev::prepare yield_ev; |
1104 | |
1143 | |
1105 | void yield (check_watcher &w) |
1144 | void yield_cb (ev::prepare &w, int revents) |
1106 | { |
1145 | { |
1107 | sched_yield (); |
1146 | // this should really be sched_yield(), but the linux guys thought |
|
|
1147 | // that giving a process calling sched_yield () less cpu time than |
|
|
1148 | // ones with high nice levels is a useful thing to do. It surely is is |
|
|
1149 | // allowed by the sus... as is returning ENOSYS. |
|
|
1150 | |
|
|
1151 | struct timespec ts = { 0, 0 }; |
|
|
1152 | nanosleep (&ts, 0); |
|
|
1153 | |
1108 | w.stop (); |
1154 | w.stop (); |
1109 | } |
1155 | } |
1110 | |
1156 | |
1111 | event_handler () |
1157 | event_handler () |
1112 | : cw_yield (this, &event_handler::yield) |
1158 | : yield_ev (this, &event_handler::yield_cb) |
1113 | { |
1159 | { |
1114 | } |
1160 | } |
1115 | } event_handler; |
1161 | } event_handler; |
1116 | #endif |
1162 | #endif |
1117 | |
1163 | |
… | |
… | |
1137 | cmdbuf_endp += r; |
1183 | cmdbuf_endp += r; |
1138 | return true; |
1184 | return true; |
1139 | } |
1185 | } |
1140 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
1186 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
1141 | { |
1187 | { |
1142 | #if HAVE_SCHED_YIELD |
1188 | #if LINUX_YIELD_HACK |
1143 | if (display->is_local) |
1189 | if (display->is_local) |
1144 | event_handler.cw_yield.start (); |
1190 | event_handler.yield_ev.start (); |
1145 | #endif |
1191 | #endif |
1146 | } |
1192 | } |
1147 | else |
1193 | else |
1148 | { |
1194 | { |
1149 | pty_ev.stop (); |
1195 | pty_ev.stop (); |
1150 | |
1196 | |
1151 | if (!OPTION (Opt_hold)) |
1197 | if (!option (Opt_hold)) |
1152 | destroy (); |
1198 | destroy (); |
1153 | } |
1199 | } |
1154 | |
1200 | |
1155 | return false; |
1201 | return false; |
1156 | } |
1202 | } |
1157 | |
1203 | |
1158 | void |
1204 | void |
1159 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1205 | rxvt_term::pty_cb (ev::io &w, int revents) |
1160 | { |
1206 | { |
1161 | make_current (); |
1207 | make_current (); |
1162 | |
1208 | |
1163 | if (revents & EVENT_READ) |
1209 | if (revents & ev::READ) |
1164 | // loop, but don't allow a single term to monopolize us |
1210 | // loop, but don't allow a single term to monopolize us |
1165 | while (pty_fill ()) |
1211 | while (pty_fill ()) |
1166 | if (cmd_parse ()) |
1212 | if (cmd_parse ()) |
1167 | break; |
1213 | break; |
1168 | |
1214 | |
1169 | if (revents & EVENT_WRITE) |
1215 | if (revents & ev::WRITE) |
1170 | pty_write (); |
1216 | pty_write (); |
|
|
1217 | |
|
|
1218 | refresh_check (); |
1171 | } |
1219 | } |
1172 | |
1220 | |
1173 | void |
1221 | void |
1174 | rxvt_term::pointer_unblank () |
1222 | rxvt_term::pointer_unblank () |
1175 | { |
1223 | { |
1176 | XDefineCursor (xdisp, vt, TermWin_cursor); |
1224 | XDefineCursor (dpy, vt, TermWin_cursor); |
1177 | recolour_cursor (); |
1225 | recolour_cursor (); |
1178 | |
1226 | |
1179 | #ifdef POINTER_BLANK |
1227 | #ifdef POINTER_BLANK |
1180 | hidden_pointer = 0; |
1228 | hidden_pointer = 0; |
1181 | |
1229 | |
1182 | if (OPTION (Opt_pointerBlank)) |
1230 | if (option (Opt_pointerBlank)) |
1183 | pointer_ev.start (NOW + pointerBlankDelay); |
1231 | pointer_ev.start (pointerBlankDelay); |
1184 | #endif |
1232 | #endif |
1185 | } |
1233 | } |
1186 | |
1234 | |
1187 | #ifdef POINTER_BLANK |
1235 | #ifdef POINTER_BLANK |
1188 | void |
1236 | void |
1189 | rxvt_term::pointer_blank () |
1237 | rxvt_term::pointer_blank () |
1190 | { |
1238 | { |
1191 | if (!OPTION (Opt_pointerBlank)) |
1239 | if (!option (Opt_pointerBlank)) |
1192 | return; |
1240 | return; |
1193 | |
1241 | |
1194 | XDefineCursor (xdisp, vt, display->blank_cursor); |
1242 | XDefineCursor (dpy, vt, display->blank_cursor); |
1195 | XFlush (xdisp); |
1243 | XFlush (dpy); |
1196 | |
1244 | |
1197 | hidden_pointer = 1; |
1245 | hidden_pointer = 1; |
1198 | } |
1246 | } |
1199 | |
1247 | |
1200 | void |
1248 | void |
1201 | rxvt_term::pointer_cb (time_watcher &w) |
1249 | rxvt_term::pointer_cb (ev::timer &w, int revents) |
1202 | { |
1250 | { |
1203 | make_current (); |
1251 | make_current (); |
1204 | |
1252 | |
1205 | pointer_blank (); |
1253 | pointer_blank (); |
1206 | } |
1254 | } |
… | |
… | |
1209 | void |
1257 | void |
1210 | rxvt_term::mouse_report (XButtonEvent &ev) |
1258 | rxvt_term::mouse_report (XButtonEvent &ev) |
1211 | { |
1259 | { |
1212 | int button_number, key_state = 0; |
1260 | int button_number, key_state = 0; |
1213 | int x, y; |
1261 | int x, y; |
|
|
1262 | int code = 32; |
1214 | |
1263 | |
1215 | x = ev.x; |
1264 | x = Pixel2Col (ev.x); |
1216 | y = ev.y; |
1265 | y = Pixel2Row (ev.y); |
1217 | 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 | } |
1218 | |
1274 | |
1219 | if (MEvent.button == AnyButton) |
1275 | if (MEvent.button == AnyButton) |
1220 | button_number = 3; |
1276 | button_number = 3; |
1221 | else |
1277 | else |
1222 | { |
1278 | { |
… | |
… | |
1268 | x + 1, |
1324 | x + 1, |
1269 | y + 1); |
1325 | y + 1); |
1270 | #endif |
1326 | #endif |
1271 | |
1327 | |
1272 | tt_printf ("\033[M%c%c%c", |
1328 | tt_printf ("\033[M%c%c%c", |
1273 | (32 + button_number + key_state), |
1329 | (code + button_number + key_state), |
1274 | (32 + x + 1), |
1330 | (32 + x + 1), |
1275 | (32 + y + 1)); |
1331 | (32 + y + 1)); |
1276 | } |
1332 | } |
1277 | |
1333 | |
1278 | /*{{{ process an X event */ |
1334 | /*{{{ process an X event */ |
1279 | void |
1335 | void |
1280 | rxvt_term::x_cb (XEvent &ev) |
1336 | rxvt_term::x_cb (XEvent &ev) |
1281 | { |
1337 | { |
1282 | make_current (); |
1338 | make_current (); |
1283 | |
1339 | |
1284 | dLocal (Display *, xdisp); |
1340 | dLocal (Display *, dpy); |
1285 | |
1341 | |
1286 | if (ev.xany.window == vt |
1342 | if (ev.xany.window == vt |
1287 | && SHOULD_INVOKE (HOOK_X_EVENT) |
1343 | && SHOULD_INVOKE (HOOK_X_EVENT) |
1288 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
1344 | && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) |
1289 | return; |
1345 | return; |
… | |
… | |
1294 | unsigned int unused_mask; |
1350 | unsigned int unused_mask; |
1295 | |
1351 | |
1296 | switch (ev.type) |
1352 | switch (ev.type) |
1297 | { |
1353 | { |
1298 | case KeyPress: |
1354 | case KeyPress: |
1299 | #if ISO_14755 |
1355 | key_press (ev.xkey); |
1300 | if (!(iso14755buf & ISO_14755_52)) |
|
|
1301 | #endif |
|
|
1302 | lookup_key (ev.xkey); |
|
|
1303 | |
|
|
1304 | break; |
1356 | break; |
1305 | |
1357 | |
1306 | case KeyRelease: |
1358 | case KeyRelease: |
1307 | { |
1359 | key_release (ev.xkey); |
1308 | #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 || ENABLE_PERL |
|
|
1309 | KeySym keysym; |
|
|
1310 | |
|
|
1311 | keysym = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/ |
|
|
1312 | #endif |
|
|
1313 | |
|
|
1314 | #if ENABLE_FRILLS || ISO_14755 |
|
|
1315 | // ISO 14755 support |
|
|
1316 | if (iso14755buf) |
|
|
1317 | if (iso14755buf & ISO_14755_52) |
|
|
1318 | { |
|
|
1319 | # if ENABLE_OVERLAY |
|
|
1320 | scr_overlay_off (); |
|
|
1321 | # endif |
|
|
1322 | # if ISO_14755 |
|
|
1323 | // iso14755 part 5.2 handling: release time |
|
|
1324 | // first: controls |
|
|
1325 | if ((ev.xkey.state & ControlMask) |
|
|
1326 | && ((keysym >= 0x40 && keysym <= 0x5f) |
|
|
1327 | || (keysym >= 0x61 && keysym <= 0x7f))) |
|
|
1328 | { |
|
|
1329 | iso14755buf = ISO_14755_51 | 0x2400 | (keysym & 0x1f); |
|
|
1330 | commit_iso14755 (); |
|
|
1331 | goto skip_switch; |
|
|
1332 | } |
|
|
1333 | |
|
|
1334 | for (unsigned short *i = iso14755_symtab; i[0]; i+= 2) |
|
|
1335 | if (i[0] == keysym) |
|
|
1336 | { |
|
|
1337 | iso14755buf = ISO_14755_51 | i[1]; |
|
|
1338 | commit_iso14755 (); |
|
|
1339 | goto skip_switch; |
|
|
1340 | } |
|
|
1341 | |
|
|
1342 | scr_bell (); |
|
|
1343 | # endif |
|
|
1344 | iso14755buf = 0; |
|
|
1345 | break; |
|
|
1346 | } |
|
|
1347 | else if ((ev.xkey.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) |
|
|
1348 | { |
|
|
1349 | # if ENABLE_OVERLAY |
|
|
1350 | scr_overlay_off (); |
|
|
1351 | # endif |
|
|
1352 | if (iso14755buf & ISO_14755_51) |
|
|
1353 | commit_iso14755 (); |
|
|
1354 | #if ISO_14755 |
|
|
1355 | else if (iso14755buf & ISO_14755_STARTED) |
|
|
1356 | { |
|
|
1357 | iso14755buf = ISO_14755_52; // iso14755 part 5.2: remember empty begin/end pair |
|
|
1358 | |
|
|
1359 | scr_overlay_new (0, -1, sizeof ("KEYCAP PICTURE INSERT MODE") - 1, 1); |
|
|
1360 | scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE"); |
|
|
1361 | } |
|
|
1362 | # endif |
|
|
1363 | else |
|
|
1364 | iso14755buf = 0; |
|
|
1365 | } |
|
|
1366 | #endif |
|
|
1367 | |
|
|
1368 | if (ev.xany.window == vt |
|
|
1369 | && HOOK_INVOKE ((this, HOOK_KEY_RELEASE, DT_XEVENT, &ev, DT_INT, keysym, DT_END))) |
|
|
1370 | break; |
|
|
1371 | |
|
|
1372 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
|
|
1373 | if (!(ev.xkey.state & ControlMask)) |
|
|
1374 | slip_wheel_ev.stop (); |
|
|
1375 | else if (keysym == XK_Control_L || keysym == XK_Control_R) |
|
|
1376 | mouse_slip_wheel_speed = 0; |
|
|
1377 | #endif |
|
|
1378 | break; |
1360 | break; |
1379 | } |
|
|
1380 | |
1361 | |
1381 | case ButtonPress: |
1362 | case ButtonPress: |
1382 | button_press (ev.xbutton); |
1363 | button_press (ev.xbutton); |
1383 | break; |
1364 | break; |
1384 | |
1365 | |
… | |
… | |
1399 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) |
1380 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) |
1400 | destroy (); |
1381 | destroy (); |
1401 | } |
1382 | } |
1402 | #if ENABLE_EWMH |
1383 | #if ENABLE_EWMH |
1403 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1384 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1404 | XSendEvent (xdisp, ev.xclient.window = display->root, |
1385 | XSendEvent (dpy, ev.xclient.window = display->root, |
1405 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1386 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1406 | &ev); |
1387 | &ev); |
1407 | #endif |
1388 | #endif |
1408 | } |
1389 | } |
1409 | } |
1390 | } |
… | |
… | |
1415 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
1396 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
1416 | focus_out (); |
1397 | focus_out (); |
1417 | } |
1398 | } |
1418 | #endif |
1399 | #endif |
1419 | } |
1400 | } |
1420 | break; |
|
|
1421 | |
|
|
1422 | case MappingNotify: |
|
|
1423 | XRefreshKeyboardMapping (&ev.xmapping); |
|
|
1424 | break; |
1401 | break; |
1425 | |
1402 | |
1426 | /* |
1403 | /* |
1427 | * XXX: this is not the _current_ arrangement |
1404 | * XXX: this is not the _current_ arrangement |
1428 | * Here's my conclusion: |
1405 | * Here's my conclusion: |
… | |
… | |
1447 | break; |
1424 | break; |
1448 | } |
1425 | } |
1449 | break; |
1426 | break; |
1450 | |
1427 | |
1451 | case FocusIn: |
1428 | case FocusIn: |
|
|
1429 | if (ev.xfocus.detail != NotifyInferior |
|
|
1430 | && ev.xfocus.detail != NotifyPointer |
|
|
1431 | && ev.xfocus.mode != NotifyGrab) |
1452 | focus_in (); |
1432 | focus_in (); |
1453 | break; |
1433 | break; |
1454 | |
1434 | |
1455 | case FocusOut: |
1435 | case FocusOut: |
|
|
1436 | if (ev.xfocus.detail != NotifyInferior |
|
|
1437 | && ev.xfocus.detail != NotifyPointer |
|
|
1438 | && ev.xfocus.mode != NotifyGrab) |
1456 | focus_out (); |
1439 | focus_out (); |
1457 | break; |
1440 | break; |
1458 | |
1441 | |
1459 | 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); */ |
1460 | if (ev.xconfigure.window == parent[0]) |
1446 | if (ev.xconfigure.window == parent[0]) |
1461 | { |
1447 | { |
1462 | while (XCheckTypedWindowEvent (xdisp, ev.xconfigure.window, ConfigureNotify, &ev)) |
1448 | while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) |
1463 | ; |
1449 | ; |
1464 | |
1450 | |
1465 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1451 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1466 | { |
1452 | { |
1467 | seen_resize = 1; |
1453 | seen_resize = 1; |
1468 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1454 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1469 | } |
1455 | } |
|
|
1456 | else |
|
|
1457 | { |
|
|
1458 | #ifdef HAVE_BG_PIXMAP |
|
|
1459 | if (bgPixmap.window_position_sensitive ()) |
|
|
1460 | update_background (); |
|
|
1461 | #endif |
|
|
1462 | } |
1470 | |
1463 | |
1471 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1464 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1472 | |
|
|
1473 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
|
|
1474 | if (OPTION (Opt_transparent)) |
|
|
1475 | check_our_parents (); |
|
|
1476 | #endif |
|
|
1477 | } |
1465 | } |
1478 | break; |
1466 | break; |
1479 | |
1467 | |
1480 | case PropertyNotify: |
1468 | case PropertyNotify: |
1481 | 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))) |
… | |
… | |
1499 | break; |
1487 | break; |
1500 | |
1488 | |
1501 | case MapNotify: |
1489 | case MapNotify: |
1502 | mapped = 1; |
1490 | mapped = 1; |
1503 | #ifdef TEXT_BLINK |
1491 | #ifdef TEXT_BLINK |
1504 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
1492 | text_blink_ev.start (); |
1505 | #endif |
1493 | #endif |
1506 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1494 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1507 | break; |
1495 | break; |
1508 | |
1496 | |
1509 | case UnmapNotify: |
1497 | case UnmapNotify: |
… | |
… | |
1511 | #ifdef TEXT_BLINK |
1499 | #ifdef TEXT_BLINK |
1512 | text_blink_ev.stop (); |
1500 | text_blink_ev.stop (); |
1513 | #endif |
1501 | #endif |
1514 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1502 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1515 | break; |
1503 | break; |
1516 | |
|
|
1517 | #ifdef TRANSPARENT |
|
|
1518 | case ReparentNotify: |
|
|
1519 | rootwin_cb (ev); |
|
|
1520 | break; |
|
|
1521 | #endif /* TRANSPARENT */ |
|
|
1522 | |
1504 | |
1523 | case GraphicsExpose: |
1505 | case GraphicsExpose: |
1524 | case Expose: |
1506 | case Expose: |
1525 | if (ev.xany.window == vt) |
1507 | if (ev.xany.window == vt) |
1526 | { |
1508 | { |
1527 | do |
1509 | do |
|
|
1510 | { |
1528 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1511 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1529 | ev.xexpose.width, ev.xexpose.height, False); |
1512 | ev.xexpose.width, ev.xexpose.height, False); |
|
|
1513 | } |
1530 | while (XCheckTypedWindowEvent (xdisp, vt, ev.xany.type, &ev)); |
1514 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); |
1531 | |
1515 | |
1532 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1516 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1533 | |
1517 | |
1534 | while (XCheckTypedWindowEvent (xdisp, vt, ev.xany.type, &ev)) |
1518 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) |
|
|
1519 | { |
1535 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1520 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1536 | ev.xexpose.width, ev.xexpose.height, False); |
1521 | ev.xexpose.width, ev.xexpose.height, False); |
|
|
1522 | } |
1537 | |
1523 | |
1538 | want_refresh = 1; |
1524 | want_refresh = 1; |
1539 | } |
1525 | } |
1540 | else |
1526 | else |
1541 | { |
1527 | { |
1542 | XEvent unused_event; |
1528 | XEvent unused_event; |
1543 | |
1529 | |
1544 | while (XCheckTypedWindowEvent (xdisp, ev.xany.window, Expose, &unused_event)) |
1530 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event)) |
1545 | ; |
1531 | ; |
1546 | while (XCheckTypedWindowEvent (xdisp, ev.xany.window, GraphicsExpose, &unused_event)) |
1532 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) |
1547 | ; |
1533 | ; |
1548 | |
1534 | |
1549 | if (isScrollbarWindow (ev.xany.window)) |
1535 | if (scrollBar.state && ev.xany.window == scrollBar.win) |
1550 | { |
1536 | { |
1551 | scrollBar.setIdle (); |
1537 | scrollBar.setIdle (); |
1552 | scrollbar_show (0); |
1538 | scrollbar_show (0); |
1553 | } |
1539 | } |
1554 | |
|
|
1555 | #ifdef TRANSPARENT |
|
|
1556 | if (am_transparent && ev.xany.window == parent[0]) |
|
|
1557 | XClearWindow (xdisp, ev.xany.window); |
|
|
1558 | #endif |
|
|
1559 | } |
1540 | } |
1560 | break; |
1541 | break; |
1561 | |
1542 | |
1562 | case MotionNotify: |
1543 | case MotionNotify: |
1563 | #ifdef POINTER_BLANK |
1544 | #ifdef POINTER_BLANK |
1564 | if (hidden_pointer) |
1545 | if (hidden_pointer) |
1565 | pointer_unblank (); |
1546 | pointer_unblank (); |
1566 | #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); |
1567 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1551 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1568 | break; |
1552 | break; |
1569 | |
1553 | |
1570 | if (ev.xany.window == vt) |
1554 | if (ev.xany.window == vt) |
1571 | { |
1555 | { |
1572 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
1556 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
1573 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1557 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1574 | ; // nop |
1558 | ; // nop |
1575 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1559 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1576 | { |
1560 | { |
1577 | while (XCheckTypedWindowEvent (xdisp, vt, MotionNotify, &ev)) |
1561 | while (XCheckTypedWindowEvent (dpy, vt, MotionNotify, &ev)) |
1578 | ; |
1562 | ; |
1579 | |
1563 | |
1580 | XQueryPointer (xdisp, vt, |
1564 | XQueryPointer (dpy, vt, |
1581 | &unused_root, &unused_child, |
1565 | &unused_root, &unused_child, |
1582 | &unused_root_x, &unused_root_y, |
1566 | &unused_root_x, &unused_root_y, |
1583 | &ev.xbutton.x, &ev.xbutton.y, |
1567 | &ev.xbutton.x, &ev.xbutton.y, |
1584 | &ev.xbutton.state); |
1568 | &ev.xbutton.state); |
1585 | #ifdef MOUSE_THRESHOLD |
1569 | #ifdef MOUSE_THRESHOLD |
… | |
… | |
1605 | int dist; |
1589 | int dist; |
1606 | |
1590 | |
1607 | /* don't clobber the current delay if we are |
1591 | /* don't clobber the current delay if we are |
1608 | * already in the middle of scrolling. |
1592 | * already in the middle of scrolling. |
1609 | */ |
1593 | */ |
1610 | if (!sel_scroll_ev.active) |
1594 | if (!sel_scroll_ev.is_active ()) |
1611 | sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); |
1595 | sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
1612 | |
1596 | |
1613 | /* save the event params so we can highlight |
1597 | /* save the event params so we can highlight |
1614 | * the selection in the pending-scroll loop |
1598 | * the selection in the pending-scroll loop |
1615 | */ |
1599 | */ |
1616 | selection_save_x = ev.xbutton.x; |
1600 | selection_save_x = ev.xbutton.x; |
… | |
… | |
1638 | else |
1622 | else |
1639 | { |
1623 | { |
1640 | /* we are within the text window, so we |
1624 | /* we are within the text window, so we |
1641 | * shouldn't be scrolling |
1625 | * shouldn't be scrolling |
1642 | */ |
1626 | */ |
1643 | if (sel_scroll_ev.active) |
|
|
1644 | sel_scroll_ev.stop(); |
1627 | sel_scroll_ev.stop(); |
1645 | } |
1628 | } |
1646 | #endif |
1629 | #endif |
1647 | #ifdef MOUSE_THRESHOLD |
1630 | #ifdef MOUSE_THRESHOLD |
1648 | } |
1631 | } |
1649 | #endif |
1632 | #endif |
1650 | } |
1633 | } |
1651 | } |
1634 | } |
1652 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1635 | else if (scrollbar_isMotion () && ev.xany.window == scrollBar.win) |
1653 | { |
1636 | { |
1654 | while (XCheckTypedWindowEvent (xdisp, scrollBar.win, |
1637 | while (XCheckTypedWindowEvent (dpy, scrollBar.win, |
1655 | MotionNotify, &ev)) |
1638 | MotionNotify, &ev)) |
1656 | ; |
1639 | ; |
1657 | |
1640 | |
1658 | XQueryPointer (xdisp, scrollBar.win, |
1641 | XQueryPointer (dpy, scrollBar.win, |
1659 | &unused_root, &unused_child, |
1642 | &unused_root, &unused_child, |
1660 | &unused_root_x, &unused_root_y, |
1643 | &unused_root_x, &unused_root_y, |
1661 | &ev.xbutton.x, &ev.xbutton.y, |
1644 | &ev.xbutton.x, &ev.xbutton.y, |
1662 | &unused_mask); |
1645 | &unused_mask); |
1663 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1646 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1664 | scrollbar_size ()); |
1647 | scrollbar_size ()); |
1665 | want_refresh = 1; |
1648 | want_refresh = 1; |
1666 | refresh_limit = 0; |
|
|
1667 | scrollbar_show (1); |
1649 | scrollbar_show (1); |
1668 | } |
1650 | } |
1669 | break; |
1651 | break; |
1670 | } |
1652 | } |
1671 | |
1653 | |
1672 | skip_switch: ; |
|
|
1673 | |
|
|
1674 | #if defined(CURSOR_BLINK) |
1654 | #if defined(CURSOR_BLINK) |
1675 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
1655 | if (option (Opt_cursorBlink) && ev.type == KeyPress) |
1676 | { |
1656 | { |
1677 | if (hidden_cursor) |
1657 | if (hidden_cursor) |
1678 | { |
1658 | { |
1679 | hidden_cursor = 0; |
1659 | hidden_cursor = 0; |
1680 | want_refresh = 1; |
1660 | want_refresh = 1; |
1681 | } |
1661 | } |
1682 | |
1662 | |
1683 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1663 | cursor_blink_ev.again (); |
1684 | } |
1664 | } |
1685 | #endif |
1665 | #endif |
1686 | |
1666 | |
1687 | #if defined(POINTER_BLANK) |
1667 | #if defined(POINTER_BLANK) |
1688 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
1668 | if (option (Opt_pointerBlank) && pointerBlankDelay > 0) |
1689 | { |
1669 | { |
1690 | if (ev.type == MotionNotify |
1670 | if (ev.type == MotionNotify |
1691 | || ev.type == ButtonPress |
1671 | || ev.type == ButtonPress |
1692 | || ev.type == ButtonRelease) |
1672 | || ev.type == ButtonRelease) |
1693 | if (hidden_pointer) |
1673 | if (hidden_pointer) |
… | |
… | |
1695 | |
1675 | |
1696 | if (ev.type == KeyPress && hidden_pointer == 0) |
1676 | if (ev.type == KeyPress && hidden_pointer == 0) |
1697 | pointer_blank (); |
1677 | pointer_blank (); |
1698 | } |
1678 | } |
1699 | #endif |
1679 | #endif |
|
|
1680 | |
|
|
1681 | refresh_check (); |
1700 | } |
1682 | } |
1701 | |
1683 | |
1702 | void |
1684 | void |
1703 | rxvt_term::focus_in () |
1685 | rxvt_term::focus_in () |
1704 | { |
1686 | { |
1705 | if (!focus) |
1687 | if (!focus) |
1706 | { |
1688 | { |
1707 | focus = 1; |
1689 | focus = 1; |
1708 | want_refresh = 1; |
1690 | want_refresh = 1; |
1709 | |
1691 | |
1710 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1692 | HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END)); |
1711 | |
1693 | |
1712 | #if USE_XIM |
1694 | #if USE_XIM |
1713 | if (Input_Context != NULL) |
1695 | if (Input_Context != NULL) |
1714 | { |
1696 | { |
1715 | IMSetStatusPosition (); |
1697 | IMSetPosition (); |
1716 | XSetICFocus (Input_Context); |
1698 | XSetICFocus (Input_Context); |
1717 | } |
1699 | } |
1718 | #endif |
1700 | #endif |
1719 | #if CURSOR_BLINK |
1701 | #if CURSOR_BLINK |
1720 | if (OPTION (Opt_cursorBlink)) |
1702 | if (option (Opt_cursorBlink)) |
1721 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1703 | cursor_blink_ev.again (); |
1722 | #endif |
1704 | #endif |
1723 | #if OFF_FOCUS_FADING |
1705 | #if OFF_FOCUS_FADING |
1724 | if (rs[Rs_fade]) |
1706 | if (rs[Rs_fade]) |
1725 | { |
1707 | { |
1726 | pix_colors = pix_colors_focused; |
1708 | pix_colors = pix_colors_focused; |
1727 | scr_recolour (); |
1709 | scr_recolour (); |
1728 | } |
1710 | } |
1729 | #endif |
1711 | #endif |
|
|
1712 | #if ENABLE_FRILLS |
|
|
1713 | if (option (Opt_urgentOnBell)) |
|
|
1714 | { |
|
|
1715 | if (XWMHints *h = XGetWMHints(dpy, parent[0])) |
|
|
1716 | { |
|
|
1717 | h->flags &= ~XUrgencyHint; |
|
|
1718 | XSetWMHints (dpy, parent[0], h); |
|
|
1719 | } |
|
|
1720 | } |
|
|
1721 | #endif |
1730 | } |
1722 | } |
1731 | } |
1723 | } |
1732 | |
1724 | |
1733 | void |
1725 | void |
1734 | rxvt_term::focus_out () |
1726 | rxvt_term::focus_out () |
… | |
… | |
1742 | |
1734 | |
1743 | #if ENABLE_FRILLS || ISO_14755 |
1735 | #if ENABLE_FRILLS || ISO_14755 |
1744 | if (iso14755buf) |
1736 | if (iso14755buf) |
1745 | { |
1737 | { |
1746 | iso14755buf = 0; |
1738 | iso14755buf = 0; |
1747 | # if ENABLE_OVERLAY |
1739 | # if ISO_14755 |
1748 | scr_overlay_off (); |
1740 | scr_overlay_off (); |
1749 | # endif |
1741 | # endif |
1750 | } |
1742 | } |
1751 | #endif |
1743 | #endif |
1752 | #if USE_XIM |
1744 | #if USE_XIM |
1753 | if (Input_Context != NULL) |
1745 | if (Input_Context != NULL) |
1754 | XUnsetICFocus (Input_Context); |
1746 | XUnsetICFocus (Input_Context); |
1755 | #endif |
1747 | #endif |
1756 | #if CURSOR_BLINK |
1748 | #if CURSOR_BLINK |
1757 | if (OPTION (Opt_cursorBlink)) |
1749 | if (option (Opt_cursorBlink)) |
1758 | cursor_blink_ev.stop (); |
1750 | cursor_blink_ev.stop (); |
|
|
1751 | |
1759 | hidden_cursor = 0; |
1752 | hidden_cursor = 0; |
1760 | #endif |
1753 | #endif |
1761 | #if OFF_FOCUS_FADING |
1754 | #if OFF_FOCUS_FADING |
1762 | if (rs[Rs_fade]) |
1755 | if (rs[Rs_fade]) |
1763 | { |
1756 | { |
… | |
… | |
1766 | } |
1759 | } |
1767 | #endif |
1760 | #endif |
1768 | } |
1761 | } |
1769 | } |
1762 | } |
1770 | |
1763 | |
1771 | #if TRANSPARENT |
1764 | void |
|
|
1765 | rxvt_term::update_fade_color (unsigned int idx) |
|
|
1766 | { |
|
|
1767 | #if OFF_FOCUS_FADING |
|
|
1768 | if (rs[Rs_fade]) |
|
|
1769 | { |
|
|
1770 | rgba c; |
|
|
1771 | pix_colors [Color_fade].get (c); |
|
|
1772 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
|
|
1773 | } |
|
|
1774 | #endif |
|
|
1775 | } |
|
|
1776 | |
|
|
1777 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1772 | void |
1778 | void |
1773 | rxvt_term::rootwin_cb (XEvent &ev) |
1779 | rxvt_term::rootwin_cb (XEvent &ev) |
1774 | { |
1780 | { |
1775 | make_current (); |
1781 | make_current (); |
1776 | |
1782 | |
|
|
1783 | if (SHOULD_INVOKE (HOOK_ROOT_EVENT) |
|
|
1784 | && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) |
|
|
1785 | return; |
|
|
1786 | |
|
|
1787 | # if ENABLE_TRANSPARENCY |
1777 | switch (ev.type) |
1788 | switch (ev.type) |
1778 | { |
1789 | { |
1779 | case PropertyNotify: |
1790 | case PropertyNotify: |
1780 | /* |
1791 | /* |
1781 | * 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, |
1782 | * 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. |
1783 | */ |
1794 | */ |
1784 | if (ev.xproperty.atom != xa[XA_XROOTPMAP_ID] |
1795 | if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] |
1785 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1796 | || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) |
1786 | return; |
1797 | { |
|
|
1798 | bgPixmap.set_root_pixmap (); |
|
|
1799 | update_background (); |
|
|
1800 | } |
1787 | |
1801 | |
1788 | /* FALLTHROUGH */ |
|
|
1789 | case ReparentNotify: |
|
|
1790 | if (OPTION (Opt_transparent) && check_our_parents () && am_transparent) |
|
|
1791 | want_refresh = want_full_refresh = 1; |
|
|
1792 | break; |
1802 | break; |
1793 | } |
1803 | } |
|
|
1804 | # endif |
|
|
1805 | |
|
|
1806 | refresh_check (); |
1794 | } |
1807 | } |
1795 | #endif |
1808 | #endif |
1796 | |
1809 | |
1797 | void |
1810 | void |
1798 | rxvt_term::button_press (XButtonEvent &ev) |
1811 | rxvt_term::button_press (XButtonEvent &ev) |
… | |
… | |
1853 | mouse_report (ev); |
1866 | mouse_report (ev); |
1854 | } |
1867 | } |
1855 | #else |
1868 | #else |
1856 | MEvent.button = ev.button; |
1869 | MEvent.button = ev.button; |
1857 | mouse_report (ev); |
1870 | mouse_report (ev); |
1858 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
1871 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
1859 | |
1872 | |
1860 | } |
1873 | } |
1861 | else |
1874 | else |
1862 | { |
1875 | { |
1863 | if (ev.button != MEvent.button) |
1876 | if (ev.button != MEvent.button) |
… | |
… | |
1911 | } |
1924 | } |
1912 | |
1925 | |
1913 | /* |
1926 | /* |
1914 | * Scrollbar window processing of button press |
1927 | * Scrollbar window processing of button press |
1915 | */ |
1928 | */ |
1916 | if (isScrollbarWindow (ev.window)) |
1929 | if (scrollBar.state && ev.window == scrollBar.win) |
1917 | { |
1930 | { |
1918 | scrollBar.setIdle (); |
1931 | scrollBar.setIdle (); |
1919 | /* |
1932 | /* |
1920 | * Rxvt-style scrollbar: |
1933 | * Rxvt-style scrollbar: |
1921 | * move up if mouse is above slider |
1934 | * move up if mouse is above slider |
… | |
… | |
1957 | tt_printf ("\033[5~"); |
1970 | tt_printf ("\033[5~"); |
1958 | break; |
1971 | break; |
1959 | } |
1972 | } |
1960 | } |
1973 | } |
1961 | else |
1974 | else |
1962 | #endif /* NO_SCROLLBAR_REPORT */ |
1975 | #endif /* NO_SCROLLBAR_REPORT */ |
1963 | |
1976 | |
1964 | { |
1977 | { |
1965 | char upordown = 0; |
1978 | char upordown = 0; |
1966 | |
1979 | |
1967 | if (scrollBar.style == R_SB_NEXT) |
1980 | if (scrollBar.style == R_SB_NEXT) |
1968 | { |
1981 | { |
1969 | if (scrollbarnext_upButton (ev.y)) |
1982 | if (scrollbarnext_upButton (ev.y)) |
1970 | upordown = -1; /* up */ |
1983 | upordown = -1; /* up */ |
… | |
… | |
1976 | if (scrollbarrxvt_upButton (ev.y)) |
1989 | if (scrollbarrxvt_upButton (ev.y)) |
1977 | upordown = -1; /* up */ |
1990 | upordown = -1; /* up */ |
1978 | else if (scrollbarrxvt_dnButton (ev.y)) |
1991 | else if (scrollbarrxvt_dnButton (ev.y)) |
1979 | upordown = 1; /* down */ |
1992 | upordown = 1; /* down */ |
1980 | } |
1993 | } |
|
|
1994 | |
1981 | if (upordown) |
1995 | if (upordown) |
1982 | { |
1996 | { |
1983 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
1997 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
1998 | if (!cont_scroll_ev.is_active ()) |
1984 | cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); |
1999 | cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
1985 | #endif |
2000 | #endif |
1986 | if (scr_page (upordown < 0 ? UP : DN, 1)) |
2001 | if (scr_page (upordown < 0 ? UP : DN, 1)) |
1987 | { |
2002 | { |
1988 | if (upordown < 0) |
2003 | if (upordown < 0) |
1989 | scrollBar.setUp (); |
2004 | scrollBar.setUp (); |
… | |
… | |
1993 | } |
2008 | } |
1994 | else |
2009 | else |
1995 | switch (ev.button) |
2010 | switch (ev.button) |
1996 | { |
2011 | { |
1997 | case Button2: |
2012 | case Button2: |
1998 | switch (scrollbar_align) |
2013 | switch (scrollBar.align) |
1999 | { |
2014 | { |
2000 | case R_SB_ALIGN_TOP: |
2015 | case R_SB_ALIGN_TOP: |
2001 | csrO = 0; |
2016 | csrO = 0; |
2002 | break; |
2017 | break; |
2003 | case R_SB_ALIGN_CENTRE: |
2018 | case R_SB_ALIGN_CENTRE: |
… | |
… | |
2015 | |
2030 | |
2016 | scrollBar.setMotion (); |
2031 | scrollBar.setMotion (); |
2017 | break; |
2032 | break; |
2018 | |
2033 | |
2019 | case Button1: |
2034 | case Button1: |
2020 | if (scrollbar_align == R_SB_ALIGN_CENTRE) |
2035 | if (scrollBar.align == R_SB_ALIGN_CENTRE) |
2021 | csrO = ev.y - scrollBar.top; |
2036 | csrO = ev.y - scrollBar.top; |
2022 | /* FALLTHROUGH */ |
2037 | /* FALLTHROUGH */ |
2023 | |
2038 | |
2024 | case Button3: |
2039 | case Button3: |
2025 | if (scrollBar.style != R_SB_XTERM) |
2040 | if (scrollBar.style != R_SB_XTERM) |
… | |
… | |
2069 | scrollBar.setIdle (); |
2084 | scrollBar.setIdle (); |
2070 | scrollbar_show (0); |
2085 | scrollbar_show (0); |
2071 | } |
2086 | } |
2072 | |
2087 | |
2073 | #ifdef SELECTION_SCROLLING |
2088 | #ifdef SELECTION_SCROLLING |
2074 | if (sel_scroll_ev.active) |
|
|
2075 | sel_scroll_ev.stop(); |
2089 | sel_scroll_ev.stop(); |
2076 | #endif |
2090 | #endif |
2077 | |
2091 | |
2078 | if (ev.window == vt) |
2092 | if (ev.window == vt) |
2079 | { |
2093 | { |
2080 | 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))) |
… | |
… | |
2104 | mouse_report (ev); |
2118 | mouse_report (ev); |
2105 | } |
2119 | } |
2106 | #else /* MOUSE_REPORT_DOUBLECLICK */ |
2120 | #else /* MOUSE_REPORT_DOUBLECLICK */ |
2107 | MEvent.button = AnyButton; |
2121 | MEvent.button = AnyButton; |
2108 | mouse_report (ev); |
2122 | mouse_report (ev); |
2109 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
2123 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
2110 | return; |
2124 | return; |
2111 | } |
2125 | } |
2112 | |
2126 | |
2113 | /* |
2127 | /* |
2114 | * dumb hack to compensate for the failure of click-and-drag |
2128 | * dumb hack to compensate for the failure of click-and-drag |
… | |
… | |
2126 | selection_make (ev.time); |
2140 | selection_make (ev.time); |
2127 | break; |
2141 | break; |
2128 | |
2142 | |
2129 | case Button2: |
2143 | case Button2: |
2130 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
2144 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
2131 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary); |
2145 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Clipboard : Sel_Primary); |
2132 | break; |
2146 | break; |
2133 | |
2147 | |
2134 | #ifdef MOUSE_WHEEL |
2148 | #ifdef MOUSE_WHEEL |
2135 | case Button4: |
2149 | case Button4: |
2136 | case Button5: |
2150 | case Button5: |
… | |
… | |
2140 | |
2154 | |
2141 | v = ev.button == Button4 ? UP : DN; |
2155 | v = ev.button == Button4 ? UP : DN; |
2142 | |
2156 | |
2143 | if (ev.state & ShiftMask) |
2157 | if (ev.state & ShiftMask) |
2144 | i = 1; |
2158 | i = 1; |
2145 | else if (OPTION (Opt_mouseWheelScrollPage)) |
2159 | else if (option (Opt_mouseWheelScrollPage)) |
2146 | i = nrow - 1; |
2160 | i = nrow - 1; |
2147 | else |
2161 | else |
2148 | i = 5; |
2162 | i = 5; |
2149 | |
2163 | |
2150 | # ifdef MOUSE_SLIP_WHEELING |
2164 | # ifdef MOUSE_SLIP_WHEELING |
… | |
… | |
2152 | { |
2166 | { |
2153 | mouse_slip_wheel_speed += v ? -1 : 1; |
2167 | mouse_slip_wheel_speed += v ? -1 : 1; |
2154 | if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; |
2168 | if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; |
2155 | if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; |
2169 | if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; |
2156 | |
2170 | |
2157 | if (slip_wheel_ev.at < NOW) |
2171 | if (!slip_wheel_ev.is_active ()) |
2158 | slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY; |
2172 | slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
2159 | |
|
|
2160 | slip_wheel_ev.start (); |
|
|
2161 | } |
2173 | } |
2162 | else |
2174 | else |
|
|
2175 | # endif |
2163 | { |
2176 | { |
2164 | # endif |
|
|
2165 | scr_page (v, i); |
2177 | scr_page (v, i); |
2166 | scrollbar_show (1); |
2178 | scrollbar_show (1); |
2167 | # ifdef MOUSE_SLIP_WHEELING |
|
|
2168 | } |
2179 | } |
2169 | # endif |
|
|
2170 | } |
2180 | } |
2171 | break; |
2181 | break; |
2172 | #endif |
2182 | #endif |
2173 | } |
2183 | } |
2174 | } |
2184 | } |
2175 | } |
2185 | } |
2176 | |
|
|
2177 | #ifdef TRANSPARENT |
|
|
2178 | #if TINTING |
|
|
2179 | /* taken from aterm-0.4.2 */ |
|
|
2180 | |
|
|
2181 | typedef uint32_t RUINT32T; |
|
|
2182 | |
|
|
2183 | void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm) |
|
|
2184 | { |
|
|
2185 | int sh_r, sh_g, sh_b; |
|
|
2186 | RUINT32T mask_r, mask_g, mask_b; |
|
|
2187 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
|
|
2188 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
|
|
2189 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
|
|
2190 | int i; |
|
|
2191 | |
|
|
2192 | Visual *visual = term->visual; |
|
|
2193 | |
|
|
2194 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
|
|
2195 | |
|
|
2196 | /* for convenience */ |
|
|
2197 | mask_r = visual->red_mask; |
|
|
2198 | mask_g = visual->green_mask; |
|
|
2199 | mask_b = visual->blue_mask; |
|
|
2200 | |
|
|
2201 | /* boring lookup table pre-initialization */ |
|
|
2202 | switch (srcImage->bits_per_pixel) { |
|
|
2203 | case 15: |
|
|
2204 | if ((mask_r != 0x7c00) || |
|
|
2205 | (mask_g != 0x03e0) || |
|
|
2206 | (mask_b != 0x001f)) |
|
|
2207 | return; |
|
|
2208 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+32+32)); |
|
|
2209 | lookup_r = lookup; |
|
|
2210 | lookup_g = lookup+32; |
|
|
2211 | lookup_b = lookup+32+32; |
|
|
2212 | sh_r = 10; |
|
|
2213 | sh_g = 5; |
|
|
2214 | sh_b = 0; |
|
|
2215 | break; |
|
|
2216 | case 16: |
|
|
2217 | if ((mask_r != 0xf800) || |
|
|
2218 | (mask_g != 0x07e0) || |
|
|
2219 | (mask_b != 0x001f)) |
|
|
2220 | return; |
|
|
2221 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+64+32)); |
|
|
2222 | lookup_r = lookup; |
|
|
2223 | lookup_g = lookup+32; |
|
|
2224 | lookup_b = lookup+32+64; |
|
|
2225 | sh_r = 11; |
|
|
2226 | sh_g = 5; |
|
|
2227 | sh_b = 0; |
|
|
2228 | break; |
|
|
2229 | case 24: |
|
|
2230 | if ((mask_r != 0xff0000) || |
|
|
2231 | (mask_g != 0x00ff00) || |
|
|
2232 | (mask_b != 0x0000ff)) |
|
|
2233 | return; |
|
|
2234 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
|
|
2235 | lookup_r = lookup; |
|
|
2236 | lookup_g = lookup+256; |
|
|
2237 | lookup_b = lookup+256+256; |
|
|
2238 | sh_r = 16; |
|
|
2239 | sh_g = 8; |
|
|
2240 | sh_b = 0; |
|
|
2241 | break; |
|
|
2242 | case 32: |
|
|
2243 | if ((mask_r != 0xff0000) || |
|
|
2244 | (mask_g != 0x00ff00) || |
|
|
2245 | (mask_b != 0x0000ff)) |
|
|
2246 | return; |
|
|
2247 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
|
|
2248 | lookup_r = lookup; |
|
|
2249 | lookup_g = lookup+256; |
|
|
2250 | lookup_b = lookup+256+256; |
|
|
2251 | sh_r = 16; |
|
|
2252 | sh_g = 8; |
|
|
2253 | sh_b = 0; |
|
|
2254 | break; |
|
|
2255 | default: |
|
|
2256 | return; /* we do not support this color depth */ |
|
|
2257 | } |
|
|
2258 | |
|
|
2259 | /* prepare limits for color transformation (each channel is handled separately) */ |
|
|
2260 | if (shade < 0) { |
|
|
2261 | shade = -shade; |
|
|
2262 | if (shade < 0) shade = 0; |
|
|
2263 | if (shade > 100) shade = 100; |
|
|
2264 | |
|
|
2265 | lower_lim_r = 65535-rm; |
|
|
2266 | lower_lim_g = 65535-gm; |
|
|
2267 | lower_lim_b = 65535-bm; |
|
|
2268 | |
|
|
2269 | lower_lim_r = 65535-(unsigned int)(((RUINT32T)lower_lim_r)*((RUINT32T)shade)/100); |
|
|
2270 | lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100); |
|
|
2271 | lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100); |
|
|
2272 | |
|
|
2273 | upper_lim_r = upper_lim_g = upper_lim_b = 65535; |
|
|
2274 | } else { |
|
|
2275 | if (shade < 0) shade = 0; |
|
|
2276 | if (shade > 100) shade = 100; |
|
|
2277 | |
|
|
2278 | lower_lim_r = lower_lim_g = lower_lim_b = 0; |
|
|
2279 | |
|
|
2280 | upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100); |
|
|
2281 | upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100); |
|
|
2282 | upper_lim_b = (unsigned int)((((RUINT32T)bm)*((RUINT32T)shade))/100); |
|
|
2283 | } |
|
|
2284 | |
|
|
2285 | /* switch red and blue bytes if necessary, we need it for some weird XServers like XFree86 3.3.3.1 */ |
|
|
2286 | if ((srcImage->bits_per_pixel == 24) && (mask_r >= 0xFF0000 )) |
|
|
2287 | { |
|
|
2288 | unsigned int tmp; |
|
|
2289 | |
|
|
2290 | tmp = lower_lim_r; |
|
|
2291 | lower_lim_r = lower_lim_b; |
|
|
2292 | lower_lim_b = tmp; |
|
|
2293 | |
|
|
2294 | tmp = upper_lim_r; |
|
|
2295 | upper_lim_r = upper_lim_b; |
|
|
2296 | upper_lim_b = tmp; |
|
|
2297 | } |
|
|
2298 | |
|
|
2299 | /* fill our lookup tables */ |
|
|
2300 | for (i = 0; i <= mask_r>>sh_r; i++) |
|
|
2301 | { |
|
|
2302 | RUINT32T tmp; |
|
|
2303 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_r-lower_lim_r)); |
|
|
2304 | tmp += ((RUINT32T)(mask_r>>sh_r))*((RUINT32T)lower_lim_r); |
|
|
2305 | lookup_r[i] = (tmp/65535)<<sh_r; |
|
|
2306 | } |
|
|
2307 | for (i = 0; i <= mask_g>>sh_g; i++) |
|
|
2308 | { |
|
|
2309 | RUINT32T tmp; |
|
|
2310 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_g-lower_lim_g)); |
|
|
2311 | tmp += ((RUINT32T)(mask_g>>sh_g))*((RUINT32T)lower_lim_g); |
|
|
2312 | lookup_g[i] = (tmp/65535)<<sh_g; |
|
|
2313 | } |
|
|
2314 | for (i = 0; i <= mask_b>>sh_b; i++) |
|
|
2315 | { |
|
|
2316 | RUINT32T tmp; |
|
|
2317 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_b-lower_lim_b)); |
|
|
2318 | tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b); |
|
|
2319 | lookup_b[i] = (tmp/65535)<<sh_b; |
|
|
2320 | } |
|
|
2321 | |
|
|
2322 | /* apply table to input image (replacing colors by newly calculated ones) */ |
|
|
2323 | switch (srcImage->bits_per_pixel) |
|
|
2324 | { |
|
|
2325 | case 15: |
|
|
2326 | { |
|
|
2327 | unsigned short *p1, *pf, *p, *pl; |
|
|
2328 | p1 = (unsigned short *) srcImage->data; |
|
|
2329 | pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2330 | while (p1 < pf) |
|
|
2331 | { |
|
|
2332 | p = p1; |
|
|
2333 | pl = p1 + srcImage->width; |
|
|
2334 | for (; p < pl; p++) |
|
|
2335 | { |
|
|
2336 | *p = lookup_r[(*p & 0x7c00)>>10] | |
|
|
2337 | lookup_g[(*p & 0x03e0)>> 5] | |
|
|
2338 | lookup_b[(*p & 0x001f)]; |
|
|
2339 | } |
|
|
2340 | p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2341 | } |
|
|
2342 | break; |
|
|
2343 | } |
|
|
2344 | case 16: |
|
|
2345 | { |
|
|
2346 | unsigned short *p1, *pf, *p, *pl; |
|
|
2347 | p1 = (unsigned short *) srcImage->data; |
|
|
2348 | pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2349 | while (p1 < pf) |
|
|
2350 | { |
|
|
2351 | p = p1; |
|
|
2352 | pl = p1 + srcImage->width; |
|
|
2353 | for (; p < pl; p++) |
|
|
2354 | { |
|
|
2355 | *p = lookup_r[(*p & 0xf800)>>11] | |
|
|
2356 | lookup_g[(*p & 0x07e0)>> 5] | |
|
|
2357 | lookup_b[(*p & 0x001f)]; |
|
|
2358 | } |
|
|
2359 | p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2360 | } |
|
|
2361 | break; |
|
|
2362 | } |
|
|
2363 | case 24: |
|
|
2364 | { |
|
|
2365 | unsigned char *p1, *pf, *p, *pl; |
|
|
2366 | p1 = (unsigned char *) srcImage->data; |
|
|
2367 | pf = (unsigned char *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2368 | while (p1 < pf) |
|
|
2369 | { |
|
|
2370 | p = p1; |
|
|
2371 | pl = p1 + srcImage->width * 3; |
|
|
2372 | for (; p < pl; p += 3) |
|
|
2373 | { |
|
|
2374 | p[0] = lookup_r[(p[0] & 0xff0000)>>16]; |
|
|
2375 | p[1] = lookup_r[(p[1] & 0x00ff00)>> 8]; |
|
|
2376 | p[2] = lookup_r[(p[2] & 0x0000ff)]; |
|
|
2377 | } |
|
|
2378 | p1 = (unsigned char *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2379 | } |
|
|
2380 | break; |
|
|
2381 | } |
|
|
2382 | case 32: |
|
|
2383 | { |
|
|
2384 | RUINT32T *p1, *pf, *p, *pl; |
|
|
2385 | p1 = (RUINT32T *) srcImage->data; |
|
|
2386 | pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2387 | |
|
|
2388 | while (p1 < pf) |
|
|
2389 | { |
|
|
2390 | p = p1; |
|
|
2391 | pl = p1 + srcImage->width; |
|
|
2392 | for (; p < pl; p++) |
|
|
2393 | { |
|
|
2394 | *p = lookup_r[(*p & 0xff0000)>>16] | |
|
|
2395 | lookup_g[(*p & 0x00ff00)>> 8] | |
|
|
2396 | lookup_b[(*p & 0x0000ff)] | |
|
|
2397 | (*p & ~0xffffff); |
|
|
2398 | } |
|
|
2399 | p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2400 | } |
|
|
2401 | break; |
|
|
2402 | } |
|
|
2403 | } |
|
|
2404 | |
|
|
2405 | free (lookup); |
|
|
2406 | } |
|
|
2407 | #endif |
|
|
2408 | |
|
|
2409 | /* |
|
|
2410 | * Check our parents are still who we think they are. |
|
|
2411 | * Do transparency updates if required |
|
|
2412 | */ |
|
|
2413 | int |
|
|
2414 | rxvt_term::check_our_parents () |
|
|
2415 | { |
|
|
2416 | int i, pchanged, aformat, have_pixmap, rootdepth; |
|
|
2417 | unsigned long nitems, bytes_after; |
|
|
2418 | Atom atype; |
|
|
2419 | unsigned char *prop = NULL; |
|
|
2420 | Window root, oldp, *list; |
|
|
2421 | Pixmap rootpixmap = None; |
|
|
2422 | XWindowAttributes wattr, wrootattr; |
|
|
2423 | |
|
|
2424 | pchanged = 0; |
|
|
2425 | |
|
|
2426 | if (!OPTION (Opt_transparent)) |
|
|
2427 | return pchanged; /* Don't try any more */ |
|
|
2428 | |
|
|
2429 | XGetWindowAttributes (xdisp, display->root, &wrootattr); |
|
|
2430 | rootdepth = wrootattr.depth; |
|
|
2431 | |
|
|
2432 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
|
|
2433 | |
|
|
2434 | if (rootdepth != wattr.depth) |
|
|
2435 | { |
|
|
2436 | if (am_transparent) |
|
|
2437 | { |
|
|
2438 | pchanged = 1; |
|
|
2439 | XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]); |
|
|
2440 | am_transparent = am_pixmap_trans = 0; |
|
|
2441 | } |
|
|
2442 | |
|
|
2443 | return pchanged; /* Don't try any more */ |
|
|
2444 | } |
|
|
2445 | |
|
|
2446 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
|
|
2447 | XSync (xdisp, False); |
|
|
2448 | |
|
|
2449 | /* |
|
|
2450 | * Make the frame window set by the window manager have |
|
|
2451 | * the root background. Some window managers put multiple nested frame |
|
|
2452 | * windows for each client, so we have to take care about that. |
|
|
2453 | */ |
|
|
2454 | i = (xa[XA_XROOTPMAP_ID] |
|
|
2455 | && XGetWindowProperty (xdisp, display->root, xa[XA_XROOTPMAP_ID], |
|
|
2456 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
2457 | &nitems, &bytes_after, &prop) == Success); |
|
|
2458 | |
|
|
2459 | if (!i || prop == NULL) |
|
|
2460 | i = (xa[XA_ESETROOT_PMAP_ID] |
|
|
2461 | && XGetWindowProperty (xdisp, display->root, xa[XA_ESETROOT_PMAP_ID], |
|
|
2462 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
2463 | &nitems, &bytes_after, &prop) == Success); |
|
|
2464 | |
|
|
2465 | if (!i || prop == NULL |
|
|
2466 | #if TINTING |
|
|
2467 | || !ISSET_PIXCOLOR (Color_tint) |
|
|
2468 | #endif |
|
|
2469 | ) |
|
|
2470 | have_pixmap = 0; |
|
|
2471 | else |
|
|
2472 | { |
|
|
2473 | have_pixmap = 1; |
|
|
2474 | rootpixmap = *(Pixmap *)prop; |
|
|
2475 | XFree (prop); |
|
|
2476 | } |
|
|
2477 | |
|
|
2478 | if (have_pixmap) |
|
|
2479 | { |
|
|
2480 | /* |
|
|
2481 | * Copy display->root pixmap transparency |
|
|
2482 | */ |
|
|
2483 | int sx, sy, nx, ny; |
|
|
2484 | unsigned int nw, nh; |
|
|
2485 | Window cr; |
|
|
2486 | XImage *image; |
|
|
2487 | GC gc; |
|
|
2488 | XGCValues gcvalue; |
|
|
2489 | |
|
|
2490 | XTranslateCoordinates (xdisp, parent[0], display->root, |
|
|
2491 | 0, 0, &sx, &sy, &cr); |
|
|
2492 | nw = (unsigned int)szHint.width; |
|
|
2493 | nh = (unsigned int)szHint.height; |
|
|
2494 | nx = ny = 0; |
|
|
2495 | |
|
|
2496 | if (sx < 0) |
|
|
2497 | { |
|
|
2498 | nw += sx; |
|
|
2499 | nx = -sx; |
|
|
2500 | sx = 0; |
|
|
2501 | } |
|
|
2502 | |
|
|
2503 | if (sy < 0) |
|
|
2504 | { |
|
|
2505 | nh += sy; |
|
|
2506 | ny = -sy; |
|
|
2507 | sy = 0; |
|
|
2508 | } |
|
|
2509 | |
|
|
2510 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
|
|
2511 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
|
|
2512 | |
|
|
2513 | XSync (xdisp, False); |
|
|
2514 | allowedxerror = -1; |
|
|
2515 | image = XGetImage (xdisp, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
|
|
2516 | |
|
|
2517 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
|
|
2518 | /* XXX: may need a delay here? */ |
|
|
2519 | allowedxerror = 0; |
|
|
2520 | |
|
|
2521 | if (image == NULL) |
|
|
2522 | { |
|
|
2523 | if (am_transparent && am_pixmap_trans) |
|
|
2524 | { |
|
|
2525 | pchanged = 1; |
|
|
2526 | if (pixmap != None) |
|
|
2527 | { |
|
|
2528 | XFreePixmap (xdisp, pixmap); |
|
|
2529 | pixmap = None; |
|
|
2530 | } |
|
|
2531 | } |
|
|
2532 | |
|
|
2533 | am_pixmap_trans = 0; |
|
|
2534 | } |
|
|
2535 | else |
|
|
2536 | { |
|
|
2537 | if (pixmap != None) |
|
|
2538 | XFreePixmap (xdisp, pixmap); |
|
|
2539 | |
|
|
2540 | #if TINTING |
|
|
2541 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
2542 | { |
|
|
2543 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
|
|
2544 | |
|
|
2545 | rgba c; |
|
|
2546 | pix_colors_focused [Color_tint].get (c); |
|
|
2547 | |
|
|
2548 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
|
|
2549 | } |
|
|
2550 | #endif |
|
|
2551 | |
|
|
2552 | pixmap = XCreatePixmap (xdisp, vt, szHint.width, szHint.height, image->depth); |
|
|
2553 | gc = XCreateGC (xdisp, vt, 0UL, &gcvalue); |
|
|
2554 | XPutImage (xdisp, pixmap, gc, image, 0, 0, |
|
|
2555 | nx, ny, image->width, image->height); |
|
|
2556 | XFreeGC (xdisp, gc); |
|
|
2557 | XDestroyImage (image); |
|
|
2558 | XSetWindowBackgroundPixmap (xdisp, parent[0], pixmap); |
|
|
2559 | XClearWindow (xdisp, parent[0]); |
|
|
2560 | |
|
|
2561 | if (!am_transparent || !am_pixmap_trans) |
|
|
2562 | pchanged = 1; |
|
|
2563 | |
|
|
2564 | am_transparent = am_pixmap_trans = 1; |
|
|
2565 | } |
|
|
2566 | } |
|
|
2567 | |
|
|
2568 | if (am_pixmap_trans) |
|
|
2569 | XSetWindowBackgroundPixmap (xdisp, vt, ParentRelative); |
|
|
2570 | else |
|
|
2571 | { |
|
|
2572 | unsigned int n; |
|
|
2573 | /* |
|
|
2574 | * InheritPixmap transparency |
|
|
2575 | */ |
|
|
2576 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
|
|
2577 | { |
|
|
2578 | oldp = parent[i]; |
|
|
2579 | XQueryTree (xdisp, parent[i - 1], &root, &parent[i], &list, &n); |
|
|
2580 | XFree (list); |
|
|
2581 | |
|
|
2582 | if (parent[i] == display->root) |
|
|
2583 | { |
|
|
2584 | if (oldp != None) |
|
|
2585 | pchanged = 1; |
|
|
2586 | |
|
|
2587 | break; |
|
|
2588 | } |
|
|
2589 | |
|
|
2590 | if (oldp != parent[i]) |
|
|
2591 | pchanged = 1; |
|
|
2592 | } |
|
|
2593 | |
|
|
2594 | n = 0; |
|
|
2595 | |
|
|
2596 | if (pchanged) |
|
|
2597 | for (; n < (unsigned int)i; n++) |
|
|
2598 | { |
|
|
2599 | XGetWindowAttributes (xdisp, parent[n], &wattr); |
|
|
2600 | |
|
|
2601 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
|
|
2602 | { |
|
|
2603 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
|
|
2604 | break; |
|
|
2605 | } |
|
|
2606 | } |
|
|
2607 | |
|
|
2608 | if (n > (sizeof (parent) / sizeof (parent[0]))) |
|
|
2609 | { |
|
|
2610 | XSetWindowBackground (xdisp, parent[0], pix_colors_focused[Color_border]); |
|
|
2611 | XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]); |
|
|
2612 | am_transparent = 0; |
|
|
2613 | /* XXX: also turn off Opt_transparent? */ |
|
|
2614 | } |
|
|
2615 | else |
|
|
2616 | { |
|
|
2617 | for (n = 0; n < (unsigned int)i; n++) |
|
|
2618 | { |
|
|
2619 | XSetWindowBackgroundPixmap (xdisp, parent[n], ParentRelative); |
|
|
2620 | XClearWindow (xdisp, parent[n]); |
|
|
2621 | } |
|
|
2622 | |
|
|
2623 | XSetWindowBackgroundPixmap (xdisp, vt, ParentRelative); |
|
|
2624 | am_transparent = 1; |
|
|
2625 | } |
|
|
2626 | |
|
|
2627 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
|
|
2628 | parent[i] = None; |
|
|
2629 | } |
|
|
2630 | |
|
|
2631 | if (scrollBar.win) |
|
|
2632 | { |
|
|
2633 | XSetWindowBackgroundPixmap (xdisp, scrollBar.win, ParentRelative); |
|
|
2634 | scrollBar.setIdle (); |
|
|
2635 | scrollbar_show (0); |
|
|
2636 | } |
|
|
2637 | |
|
|
2638 | if (am_transparent) |
|
|
2639 | { |
|
|
2640 | want_refresh = want_full_refresh = 1; |
|
|
2641 | if (am_pixmap_trans) |
|
|
2642 | flush (); |
|
|
2643 | } |
|
|
2644 | |
|
|
2645 | return pchanged; |
|
|
2646 | } |
|
|
2647 | #endif |
|
|
2648 | |
2186 | |
2649 | /*}}} */ |
2187 | /*}}} */ |
2650 | |
2188 | |
2651 | bool |
2189 | bool |
2652 | rxvt_term::cmd_parse () |
2190 | rxvt_term::cmd_parse () |
… | |
… | |
2701 | if (ch == C0_LF) |
2239 | if (ch == C0_LF) |
2702 | nlines++; |
2240 | nlines++; |
2703 | |
2241 | |
2704 | refresh_count++; |
2242 | refresh_count++; |
2705 | |
2243 | |
2706 | if (!OPTION (Opt_jumpScroll) |
2244 | if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) |
2707 | || (refresh_count >= refresh_limit * (nrow - 1))) |
|
|
2708 | { |
2245 | { |
2709 | refreshnow = true; |
|
|
2710 | refresh_count = 0; |
2246 | refresh_count = 0; |
|
|
2247 | |
|
|
2248 | if (!option (Opt_skipScroll) || ev_time () > ev::now () + 1. / 60.) |
|
|
2249 | { |
|
|
2250 | refreshnow = true; |
2711 | ch = NOCHAR; |
2251 | ch = NOCHAR; |
2712 | break; |
2252 | break; |
|
|
2253 | } |
2713 | } |
2254 | } |
2714 | |
2255 | |
2715 | // scr_add_lines only works for nlines <= nrow - 1. |
2256 | // scr_add_lines only works for nlines <= nrow - 1. |
2716 | if (nlines >= nrow - 1) |
2257 | if (nlines >= nrow - 1) |
2717 | { |
2258 | { |
… | |
… | |
2745 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2286 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2746 | scr_add_lines (buf, str - buf, nlines); |
2287 | scr_add_lines (buf, str - buf, nlines); |
2747 | |
2288 | |
2748 | /* |
2289 | /* |
2749 | * If there have been a lot of new lines, then update the screen |
2290 | * If there have been a lot of new lines, then update the screen |
2750 | * What the heck I'll cheat and only refresh less than every page-full. |
2291 | * What the heck we'll cheat and only refresh less than every page-full. |
2751 | * the number of pages between refreshes is refresh_limit, which |
2292 | * if skipScroll is enabled. |
2752 | * is incremented here because we must be doing flat-out scrolling. |
|
|
2753 | */ |
2293 | */ |
2754 | if (refreshnow) |
2294 | if (refreshnow) |
2755 | { |
2295 | { |
2756 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
|
|
2757 | refresh_limit++; |
|
|
2758 | else |
|
|
2759 | { |
|
|
2760 | flag = true; |
2296 | flag = true; |
2761 | scr_refresh (); |
2297 | scr_refresh (); |
2762 | want_refresh = 1; |
2298 | want_refresh = 1; |
2763 | } |
|
|
2764 | } |
2299 | } |
2765 | |
2300 | |
2766 | } |
2301 | } |
2767 | else |
2302 | else |
2768 | { |
2303 | { |
… | |
… | |
2917 | { |
2452 | { |
2918 | if ((buf[len++] = cmd_getc ()) == 'i') |
2453 | if ((buf[len++] = cmd_getc ()) == 'i') |
2919 | break; /* done = 1 */ |
2454 | break; /* done = 1 */ |
2920 | } |
2455 | } |
2921 | } |
2456 | } |
2922 | |
2457 | |
2923 | for (i = 0; i < len; i++) |
2458 | for (i = 0; i < len; i++) |
2924 | if (putc (buf[i], fd) == EOF) |
2459 | if (putc (buf[i], fd) == EOF) |
2925 | { |
2460 | { |
2926 | done = 1; |
2461 | done = 1; |
2927 | break; |
2462 | break; |
… | |
… | |
2929 | } |
2464 | } |
2930 | } |
2465 | } |
2931 | |
2466 | |
2932 | pclose_printer (fd); |
2467 | pclose_printer (fd); |
2933 | } |
2468 | } |
2934 | #endif /* PRINTPIPE */ |
2469 | #endif /* PRINTPIPE */ |
2935 | /*}}} */ |
2470 | /*}}} */ |
2936 | |
2471 | |
2937 | /* *INDENT-OFF* */ |
2472 | /* *INDENT-OFF* */ |
2938 | enum { |
2473 | enum { |
2939 | C1_40 = 0x40, |
2474 | C1_40 = 0x40, |
… | |
… | |
2989 | process_dcs_seq (); |
2524 | process_dcs_seq (); |
2990 | break; |
2525 | break; |
2991 | case 0x9b: /* CSI */ |
2526 | case 0x9b: /* CSI */ |
2992 | process_csi_seq (); |
2527 | process_csi_seq (); |
2993 | break; |
2528 | break; |
2994 | case 0x9d: /* CSI */ |
2529 | case 0x9d: /* OSC */ |
2995 | process_osc_seq (); |
2530 | process_osc_seq (); |
2996 | break; |
2531 | break; |
2997 | #endif |
2532 | #endif |
2998 | } |
2533 | } |
2999 | } |
2534 | } |
… | |
… | |
3225 | rxvt_term::process_csi_seq () |
2760 | rxvt_term::process_csi_seq () |
3226 | { |
2761 | { |
3227 | unicode_t ch, priv, i; |
2762 | unicode_t ch, priv, i; |
3228 | unsigned int nargs, p; |
2763 | unsigned int nargs, p; |
3229 | int n, ndef; |
2764 | int n, ndef; |
3230 | int arg[ESC_ARGS]; |
2765 | int arg[ESC_ARGS] = { }; |
3231 | |
2766 | |
3232 | for (nargs = ESC_ARGS; nargs > 0;) |
2767 | nargs = 0; |
3233 | arg[--nargs] = 0; |
|
|
3234 | |
2768 | |
3235 | priv = 0; |
2769 | priv = 0; |
3236 | ch = cmd_getc (); |
2770 | ch = cmd_getc (); |
3237 | if (ch >= '<' && ch <= '?') |
2771 | if (ch >= '<' && ch <= '?') |
|
|
2772 | { |
3238 | { /* '<' '=' '>' '?' */ |
2773 | /* '<' '=' '>' '?' */ |
3239 | priv = ch; |
2774 | priv = ch; |
3240 | ch = cmd_getc (); |
2775 | ch = cmd_getc (); |
3241 | } |
2776 | } |
3242 | |
2777 | |
3243 | /* read any numerical arguments */ |
2778 | /* read any numerical arguments */ |
… | |
… | |
3282 | switch (priv) |
2817 | switch (priv) |
3283 | { |
2818 | { |
3284 | case '>': |
2819 | case '>': |
3285 | if (ch == CSI_DA) /* secondary device attributes */ |
2820 | if (ch == CSI_DA) /* secondary device attributes */ |
3286 | { |
2821 | { |
3287 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
2822 | // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, |
3288 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
2823 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
3289 | // |
2824 | // |
3290 | // 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 |
3291 | // 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 |
3292 | // that we do not support xterm mouse reporting (should be 95 when we do). |
2827 | // versions. |
3293 | // |
2828 | // |
3294 | tt_printf ("\033[>%d;94;0c", 'U'); |
2829 | tt_printf ("\033[>%d;95;0c", 'U'); |
3295 | } |
2830 | } |
3296 | break; |
2831 | break; |
3297 | case '?': |
2832 | case '?': |
3298 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
2833 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3299 | process_terminal_mode (ch, priv, nargs, arg); |
2834 | process_terminal_mode (ch, priv, nargs, arg); |
… | |
… | |
3426 | break; |
2961 | break; |
3427 | case 6: /* CPR requested */ |
2962 | case 6: /* CPR requested */ |
3428 | scr_report_position (); |
2963 | scr_report_position (); |
3429 | break; |
2964 | break; |
3430 | case 7: /* unofficial extension */ |
2965 | case 7: /* unofficial extension */ |
3431 | if (OPTION (Opt_insecure)) |
2966 | if (option (Opt_insecure)) |
3432 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
2967 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
3433 | break; |
2968 | break; |
3434 | case 8: /* unofficial extension */ |
2969 | case 8: /* unofficial extension */ |
3435 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
2970 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
3436 | break; |
2971 | break; |
… | |
… | |
3529 | { |
3064 | { |
3530 | int x, y; |
3065 | int x, y; |
3531 | XWindowAttributes wattr; |
3066 | XWindowAttributes wattr; |
3532 | Window wdummy; |
3067 | Window wdummy; |
3533 | |
3068 | |
3534 | dLocal (Display *, xdisp); |
3069 | dLocal (Display *, dpy); |
3535 | |
3070 | |
3536 | if (nargs == 0) |
3071 | if (nargs == 0) |
3537 | return; |
3072 | return; |
3538 | |
3073 | |
3539 | switch (args[0]) |
3074 | switch (args[0]) |
3540 | { |
3075 | { |
3541 | /* |
3076 | /* |
3542 | * commands |
3077 | * commands |
3543 | */ |
3078 | */ |
3544 | case 1: /* deiconify window */ |
3079 | case 1: /* deiconify window */ |
3545 | XMapWindow (xdisp, parent[0]); |
3080 | XMapWindow (dpy, parent[0]); |
3546 | break; |
3081 | break; |
3547 | case 2: /* iconify window */ |
3082 | case 2: /* iconify window */ |
3548 | XIconifyWindow (xdisp, parent[0], display->screen); |
3083 | XIconifyWindow (dpy, parent[0], display->screen); |
3549 | break; |
3084 | break; |
3550 | case 3: /* set position (pixels) */ |
3085 | case 3: /* set position (pixels) */ |
3551 | XMoveWindow (xdisp, parent[0], args[1], args[2]); |
3086 | XMoveWindow (dpy, parent[0], args[1], args[2]); |
3552 | break; |
3087 | break; |
3553 | case 4: /* set size (pixels) */ |
3088 | case 4: /* set size (pixels) */ |
3554 | set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); |
3089 | set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); |
3555 | break; |
3090 | break; |
3556 | case 5: /* raise window */ |
3091 | case 5: /* raise window */ |
3557 | XRaiseWindow (xdisp, parent[0]); |
3092 | XRaiseWindow (dpy, parent[0]); |
3558 | break; |
3093 | break; |
3559 | case 6: /* lower window */ |
3094 | case 6: /* lower window */ |
3560 | XLowerWindow (xdisp, parent[0]); |
3095 | XLowerWindow (dpy, parent[0]); |
3561 | break; |
3096 | break; |
3562 | case 7: /* refresh window */ |
3097 | case 7: /* refresh window */ |
3563 | scr_touch (true); |
3098 | scr_touch (true); |
3564 | break; |
3099 | break; |
3565 | case 8: /* set size (chars) */ |
3100 | case 8: /* set size (chars) */ |
… | |
… | |
3576 | |
3111 | |
3577 | /* |
3112 | /* |
3578 | * reports - some output format copied from XTerm |
3113 | * reports - some output format copied from XTerm |
3579 | */ |
3114 | */ |
3580 | case 11: /* report window state */ |
3115 | case 11: /* report window state */ |
3581 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3116 | XGetWindowAttributes (dpy, parent[0], &wattr); |
3582 | tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); |
3117 | tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); |
3583 | break; |
3118 | break; |
3584 | case 13: /* report window position */ |
3119 | case 13: /* report window position */ |
3585 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3120 | XGetWindowAttributes (dpy, parent[0], &wattr); |
3586 | XTranslateCoordinates (xdisp, parent[0], wattr.root, |
3121 | XTranslateCoordinates (dpy, parent[0], wattr.root, |
3587 | -wattr.border_width, -wattr.border_width, |
3122 | -wattr.border_width, -wattr.border_width, |
3588 | &x, &y, &wdummy); |
3123 | &x, &y, &wdummy); |
3589 | tt_printf ("\033[3;%d;%dt", x, y); |
3124 | tt_printf ("\033[3;%d;%dt", x, y); |
3590 | break; |
3125 | break; |
3591 | case 14: /* report window size (pixels) */ |
3126 | case 14: /* report window size (pixels) */ |
3592 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3127 | XGetWindowAttributes (dpy, parent[0], &wattr); |
3593 | tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); |
3128 | tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); |
3594 | break; |
3129 | break; |
3595 | case 18: /* report text area size (chars) */ |
3130 | case 18: /* report text area size (chars) */ |
3596 | tt_printf ("\033[8;%d;%dt", nrow, ncol); |
3131 | tt_printf ("\033[8;%d;%dt", nrow, ncol); |
3597 | break; |
3132 | break; |
… | |
… | |
3599 | tt_printf ("\033[9;%d;%dt", nrow, ncol); |
3134 | tt_printf ("\033[9;%d;%dt", nrow, ncol); |
3600 | break; |
3135 | break; |
3601 | case 20: /* report icon label */ |
3136 | case 20: /* report icon label */ |
3602 | { |
3137 | { |
3603 | char *s; |
3138 | char *s; |
3604 | XGetIconName (xdisp, parent[0], &s); |
3139 | XGetIconName (dpy, parent[0], &s); |
3605 | tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3140 | tt_printf ("\033]L%-.250s\234", option (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3606 | XFree (s); |
3141 | XFree (s); |
3607 | } |
3142 | } |
3608 | break; |
3143 | break; |
3609 | case 21: /* report window title */ |
3144 | case 21: /* report window title */ |
3610 | { |
3145 | { |
3611 | char *s; |
3146 | char *s; |
3612 | XFetchName (xdisp, parent[0], &s); |
3147 | XFetchName (dpy, parent[0], &s); |
3613 | tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3148 | tt_printf ("\033]l%-.250s\234", option (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3614 | XFree (s); |
3149 | XFree (s); |
3615 | } |
3150 | } |
3616 | break; |
3151 | break; |
3617 | } |
3152 | } |
3618 | } |
3153 | } |
… | |
… | |
3645 | seen_esc = true; |
3180 | seen_esc = true; |
3646 | continue; |
3181 | continue; |
3647 | } |
3182 | } |
3648 | else if (ch == C0_BEL || ch == CHAR_ST) |
3183 | else if (ch == C0_BEL || ch == CHAR_ST) |
3649 | break; |
3184 | break; |
|
|
3185 | else if (ch == C0_SYN) |
|
|
3186 | ch = cmd_get8 (); |
3650 | else if (ch < 0x20) |
3187 | else if (ch < 0x20) |
3651 | return NULL; /* other control character - exit */ |
3188 | return NULL; /* other control character - exit */ |
3652 | |
3189 | |
3653 | seen_esc = false; |
3190 | seen_esc = false; |
3654 | |
3191 | |
3655 | if (n >= STRING_MAX - 1) |
3192 | if (n >= STRING_MAX - 1) |
3656 | // stop at some sane length |
3193 | // stop at some sane length |
3657 | return NULL; |
3194 | return NULL; |
3658 | |
3195 | |
3659 | if (ch == C0_SYN) |
|
|
3660 | string[n++] = cmd_get8 (); |
|
|
3661 | else |
|
|
3662 | string[n++] = ch; |
3196 | string[n++] = ch; |
3663 | } |
3197 | } |
3664 | |
3198 | |
3665 | string[n++] = '\0'; |
3199 | string[n++] = '\0'; |
3666 | |
3200 | |
3667 | ends_how = (ch == 0x5c ? C0_ESC : ch); |
3201 | ends_how = (ch == 0x5c ? C0_ESC : ch); |
… | |
… | |
3743 | int color; |
3277 | int color; |
3744 | char *buf, *name; |
3278 | char *buf, *name; |
3745 | bool query = str[0] == '?' && !str[1]; |
3279 | bool query = str[0] == '?' && !str[1]; |
3746 | int saveop = op; |
3280 | int saveop = op; |
3747 | |
3281 | |
3748 | dLocal (Display *, xdisp); |
3282 | dLocal (Display *, dpy); |
3749 | |
3283 | |
3750 | assert (str != NULL); |
3284 | assert (str != NULL); |
|
|
3285 | |
|
|
3286 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
|
|
3287 | return; |
|
|
3288 | |
3751 | switch (op) |
3289 | switch (op) |
3752 | { |
3290 | { |
3753 | case XTerm_name: |
3291 | case XTerm_name: |
3754 | set_title (str); |
3292 | set_title (str); |
3755 | /* FALLTHROUGH */ |
3293 | /* FALLTHROUGH */ |
… | |
… | |
3769 | unsigned long bytes_after; |
3307 | unsigned long bytes_after; |
3770 | unsigned char *value = 0; |
3308 | unsigned char *value = 0; |
3771 | const char *str = ""; |
3309 | const char *str = ""; |
3772 | |
3310 | |
3773 | if (prop |
3311 | if (prop |
3774 | && XGetWindowProperty (xdisp, parent[0], |
3312 | && XGetWindowProperty (dpy, parent[0], |
3775 | prop, 0, 1<<16, 0, AnyPropertyType, |
3313 | prop, 0, 1<<16, 0, AnyPropertyType, |
3776 | &actual_type, &actual_format, |
3314 | &actual_type, &actual_format, |
3777 | &nitems, &bytes_after, &value) == Success |
3315 | &nitems, &bytes_after, &value) == Success |
3778 | && actual_type != None |
3316 | && actual_type != None |
3779 | && actual_format == 8) |
3317 | && actual_format == 8) |
… | |
… | |
3791 | { |
3329 | { |
3792 | *eq = 0; |
3330 | *eq = 0; |
3793 | set_utf8_property (display->atom (str), eq + 1); |
3331 | set_utf8_property (display->atom (str), eq + 1); |
3794 | } |
3332 | } |
3795 | else |
3333 | else |
3796 | XDeleteProperty (xdisp, parent[0], |
3334 | XDeleteProperty (dpy, parent[0], |
3797 | display->atom (str)); |
3335 | display->atom (str)); |
3798 | } |
3336 | } |
3799 | break; |
3337 | break; |
3800 | |
3338 | |
3801 | case XTerm_Color: |
3339 | case XTerm_Color: |
… | |
… | |
3847 | break; |
3385 | break; |
3848 | case URxvt_Color_IT: |
3386 | case URxvt_Color_IT: |
3849 | process_color_seq (op, Color_IT, str, resp); |
3387 | process_color_seq (op, Color_IT, str, resp); |
3850 | break; |
3388 | break; |
3851 | #endif |
3389 | #endif |
3852 | #if TRANSPARENT && TINTING |
3390 | #if ENABLE_TRANSPARENCY |
3853 | case URxvt_Color_tint: |
3391 | case URxvt_Color_tint: |
3854 | process_color_seq (op, Color_tint, str, resp); |
3392 | process_color_seq (op, Color_tint, str, resp); |
|
|
3393 | { |
|
|
3394 | bool changed = false; |
3855 | |
3395 | |
3856 | 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 (); |
3857 | |
3400 | |
3858 | if (am_transparent) |
3401 | if (changed) |
3859 | want_full_refresh = want_refresh = 1; |
3402 | update_background (); |
|
|
3403 | } |
3860 | |
3404 | |
3861 | break; |
3405 | break; |
3862 | #endif |
3406 | #endif |
3863 | |
3407 | |
|
|
3408 | #if BG_IMAGE_FROM_FILE |
3864 | case Rxvt_Pixmap: |
3409 | case Rxvt_Pixmap: |
3865 | { |
3410 | if (!strcmp (str, "?")) |
3866 | if (*str != ';') |
|
|
3867 | { |
3411 | { |
3868 | #if XPM_BACKGROUND |
3412 | char str[256]; |
3869 | scale_pixmap (""); /* reset to default scaling */ |
3413 | |
3870 | set_bgPixmap (str); /* change pixmap */ |
3414 | sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ |
3871 | scr_touch (true); |
3415 | min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767), |
3872 | #endif |
3416 | min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767)); |
|
|
3417 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
3873 | } |
3418 | } |
3874 | |
3419 | else |
|
|
3420 | { |
3875 | int changed = 0; |
3421 | int changed = 0; |
3876 | |
3422 | |
3877 | while ((str = strchr (str, ';')) != NULL) |
3423 | if (*str != ';') |
3878 | { |
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 | { |
3879 | str++; |
3436 | str++; |
3880 | #if XPM_BACKGROUND |
3437 | if (bgPixmap.set_geometry (str)) |
3881 | changed += scale_pixmap (str); |
3438 | changed++; |
3882 | #endif |
3439 | str = strchr (str, ';'); |
3883 | } |
3440 | } |
3884 | |
3441 | |
3885 | if (changed) |
3442 | if (changed) |
3886 | { |
3443 | update_background (); |
3887 | #ifdef XPM_BACKGROUND |
|
|
3888 | resize_pixmap (); |
|
|
3889 | scr_touch (true); |
|
|
3890 | #endif |
|
|
3891 | } |
3444 | } |
3892 | } |
|
|
3893 | break; |
3445 | break; |
|
|
3446 | #endif |
3894 | |
3447 | |
3895 | case Rxvt_restoreFG: |
3448 | case Rxvt_restoreFG: |
3896 | set_window_color (Color_fg, str); |
3449 | set_window_color (Color_fg, str); |
3897 | break; |
3450 | break; |
3898 | case Rxvt_restoreBG: |
3451 | case Rxvt_restoreBG: |
… | |
… | |
3923 | case URxvt_italicFont: |
3476 | case URxvt_italicFont: |
3924 | case URxvt_boldItalicFont: |
3477 | case URxvt_boldItalicFont: |
3925 | #endif |
3478 | #endif |
3926 | if (query) |
3479 | if (query) |
3927 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3480 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3928 | OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3481 | option (Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3929 | ? fontset[op - URxvt_font]->fontdesc : "", |
3482 | ? fontset[op - URxvt_font]->fontdesc : "", |
3930 | resp); |
3483 | resp); |
3931 | else |
3484 | else |
3932 | { |
3485 | { |
3933 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
3486 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
… | |
… | |
3947 | break; |
3500 | break; |
3948 | |
3501 | |
3949 | #if !ENABLE_MINIMAL |
3502 | #if !ENABLE_MINIMAL |
3950 | case URxvt_locale: |
3503 | case URxvt_locale: |
3951 | if (query) |
3504 | if (query) |
3952 | tt_printf ("\33]%d;%-.250s%c", op, OPTION (Opt_insecure) ? locale : "", resp); |
3505 | tt_printf ("\33]%d;%-.250s%c", op, option (Opt_insecure) ? locale : "", resp); |
3953 | else |
3506 | else |
3954 | { |
3507 | { |
3955 | set_locale (str); |
3508 | set_locale (str); |
3956 | pty->set_utf8_mode (enc_utf8); |
3509 | pty->set_utf8_mode (enc_utf8); |
3957 | init_xlocale (); |
3510 | init_xlocale (); |
… | |
… | |
3972 | break; |
3525 | break; |
3973 | #endif |
3526 | #endif |
3974 | |
3527 | |
3975 | #if ENABLE_PERL |
3528 | #if ENABLE_PERL |
3976 | case URxvt_perl: |
3529 | case URxvt_perl: |
3977 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_STR, str, DT_END))) |
3530 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ_PERL, DT_STR, str, DT_END))) |
3978 | ; // no responses yet |
3531 | ; // no responses yet |
3979 | break; |
3532 | break; |
3980 | #endif |
3533 | #endif |
3981 | } |
3534 | } |
3982 | } |
3535 | } |
… | |
… | |
4020 | { |
3573 | { |
4021 | unsigned int i, j; |
3574 | unsigned int i, j; |
4022 | int state; |
3575 | int state; |
4023 | |
3576 | |
4024 | static const struct |
3577 | static const struct |
4025 | { |
3578 | { |
4026 | const int argval; |
3579 | const int argval; |
4027 | const unsigned long bit; |
3580 | const unsigned long bit; |
4028 | } |
|
|
4029 | |
|
|
4030 | argtopriv[] = { |
3581 | } argtopriv[] = { |
4031 | { 1, PrivMode_aplCUR }, |
3582 | { 1, PrivMode_aplCUR }, |
4032 | { 2, PrivMode_vt52 }, |
3583 | { 2, PrivMode_vt52 }, |
4033 | { 3, PrivMode_132 }, |
3584 | { 3, PrivMode_132 }, |
4034 | { 4, PrivMode_smoothScroll }, |
3585 | { 4, PrivMode_smoothScroll }, |
4035 | { 5, PrivMode_rVideo }, |
3586 | { 5, PrivMode_rVideo }, |
… | |
… | |
4051 | { 66, PrivMode_aplKP }, |
3602 | { 66, PrivMode_aplKP }, |
4052 | #ifndef NO_BACKSPACE_KEY |
3603 | #ifndef NO_BACKSPACE_KEY |
4053 | { 67, PrivMode_BackSpace }, |
3604 | { 67, PrivMode_BackSpace }, |
4054 | #endif |
3605 | #endif |
4055 | { 1000, PrivMode_MouseX11 }, |
3606 | { 1000, PrivMode_MouseX11 }, |
4056 | // 1001 Use Hilite Mouse Tracking. NYI, TODO |
3607 | { 1002, PrivMode_MouseBtnEvent }, |
4057 | // 1002 Use Cell Motion Mouse Tracking. NYI, TODO |
3608 | { 1003, PrivMode_MouseAnyEvent }, |
4058 | // 1003 Use All Motion Mouse Tracking. NYI, TODO |
|
|
4059 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3609 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
4060 | { 1011, PrivMode_Keypress }, // rxvt extension |
3610 | { 1011, PrivMode_Keypress }, // rxvt extension |
4061 | // 1035 enable modifiers for alt, numlock NYI |
3611 | // 1035 enable modifiers for alt, numlock NYI |
4062 | // 1036 send ESC for meta keys NYI |
3612 | // 1036 send ESC for meta keys NYI |
4063 | // 1037 send DEL for keypad delete NYI |
3613 | // 1037 send DEL for keypad delete NYI |
… | |
… | |
4098 | scr_touch (true); |
3648 | scr_touch (true); |
4099 | break; |
3649 | break; |
4100 | #endif |
3650 | #endif |
4101 | case 1048: /* alternative cursor save */ |
3651 | case 1048: /* alternative cursor save */ |
4102 | case 1049: |
3652 | case 1049: |
4103 | if (OPTION (Opt_secondaryScreen)) |
3653 | if (option (Opt_secondaryScreen)) |
4104 | if (mode == 0) |
3654 | if (mode == 0) |
4105 | scr_cursor (RESTORE); |
3655 | scr_cursor (RESTORE); |
4106 | else if (mode == 1) |
3656 | else if (mode == 1) |
4107 | scr_cursor (SAVE); |
3657 | scr_cursor (SAVE); |
4108 | break; |
3658 | break; |
… | |
… | |
4120 | */ |
3670 | */ |
4121 | PrivMode (1, PrivMode_vt52); |
3671 | PrivMode (1, PrivMode_vt52); |
4122 | break; |
3672 | break; |
4123 | case 3: /* 80/132 */ |
3673 | case 3: /* 80/132 */ |
4124 | if (priv_modes & PrivMode_132OK) |
3674 | if (priv_modes & PrivMode_132OK) |
|
|
3675 | { |
|
|
3676 | scr_poweron (); |
4125 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
3677 | set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight); |
|
|
3678 | } |
4126 | break; |
3679 | break; |
4127 | case 4: /* smooth scrolling */ |
3680 | case 4: /* smooth scrolling */ |
4128 | set_option (Opt_jumpScroll, !state); |
3681 | set_option (Opt_jumpScroll, !state); |
4129 | break; |
3682 | break; |
4130 | case 5: /* reverse video */ |
3683 | case 5: /* reverse video */ |
… | |
… | |
4137 | scr_autowrap (state); |
3690 | scr_autowrap (state); |
4138 | break; |
3691 | break; |
4139 | /* 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 */ |
4140 | case 9: /* X10 mouse reporting */ |
3693 | case 9: /* X10 mouse reporting */ |
4141 | if (state) /* orthogonal */ |
3694 | if (state) /* orthogonal */ |
4142 | priv_modes &= ~PrivMode_MouseX11; |
3695 | priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
4143 | break; |
3696 | break; |
4144 | #ifdef scrollBar_esc |
3697 | #ifdef scrollBar_esc |
4145 | case scrollBar_esc: |
3698 | case scrollBar_esc: |
4146 | if (scrollbar_mapping (state)) |
3699 | if (scrollbar_mapping (state)) |
4147 | { |
3700 | { |
… | |
… | |
4160 | break; |
3713 | break; |
4161 | /* case 66: - application key pad */ |
3714 | /* case 66: - application key pad */ |
4162 | /* case 67: - backspace key */ |
3715 | /* case 67: - backspace key */ |
4163 | case 1000: /* X11 mouse reporting */ |
3716 | case 1000: /* X11 mouse reporting */ |
4164 | if (state) /* orthogonal */ |
3717 | if (state) /* orthogonal */ |
4165 | priv_modes &= ~PrivMode_MouseX10; |
3718 | priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
4166 | break; |
3719 | break; |
4167 | #if 0 |
|
|
4168 | case 1001: |
3720 | case 1002: |
4169 | break; /* X11 mouse highlighting */ |
3721 | case 1003: |
4170 | #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; |
4171 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3732 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4172 | set_option (Opt_scrollTtyOutput, !state); |
3733 | set_option (Opt_scrollTtyOutput, !state); |
4173 | break; |
3734 | break; |
4174 | case 1011: /* scroll to bottom on key press */ |
3735 | case 1011: /* scroll to bottom on key press */ |
4175 | set_option (Opt_scrollTtyKeypress, state); |
3736 | set_option (Opt_scrollTtyKeypress, state); |
4176 | break; |
3737 | break; |
4177 | case 1047: /* secondary screen w/ clearing last */ |
3738 | case 1047: /* secondary screen w/ clearing last */ |
4178 | if (OPTION (Opt_secondaryScreen)) |
3739 | if (option (Opt_secondaryScreen)) |
4179 | if (current_screen != PRIMARY) |
3740 | if (current_screen != PRIMARY) |
4180 | scr_erase_screen (2); |
3741 | scr_erase_screen (2); |
4181 | scr_change_screen (state); |
3742 | scr_change_screen (state); |
4182 | break; |
3743 | break; |
4183 | case 1049: /* secondary screen w/ clearing first */ |
3744 | case 1049: /* secondary screen w/ clearing first */ |
4184 | scr_change_screen (state); |
3745 | scr_change_screen (state); |
4185 | if (OPTION (Opt_secondaryScreen)) |
3746 | if (option (Opt_secondaryScreen)) |
4186 | if (current_screen != PRIMARY) |
3747 | if (current_screen != PRIMARY) |
4187 | scr_erase_screen (2); |
3748 | scr_erase_screen (2); |
4188 | break; |
3749 | break; |
4189 | default: |
3750 | default: |
4190 | break; |
3751 | break; |
… | |
… | |
4352 | rxvt_term::process_graphics () |
3913 | rxvt_term::process_graphics () |
4353 | { |
3914 | { |
4354 | unicode_t ch, cmd = cmd_getc (); |
3915 | unicode_t ch, cmd = cmd_getc (); |
4355 | |
3916 | |
4356 | if (cmd == 'Q') |
3917 | if (cmd == 'Q') |
|
|
3918 | { |
4357 | { /* query graphics */ |
3919 | /* query graphics */ |
4358 | tt_printf ("\033G0\012"); /* no graphics */ |
3920 | tt_printf ("\033G0\012"); /* no graphics */ |
4359 | return; |
3921 | return; |
4360 | } |
3922 | } |
4361 | /* swallow other graphics sequences until terminating ':' */ |
3923 | /* swallow other graphics sequences until terminating ':' */ |
4362 | do |
3924 | do |
… | |
… | |
4412 | v_buffer = (char *)realloc (v_buffer, v_buflen + len); |
3974 | v_buffer = (char *)realloc (v_buffer, v_buflen + len); |
4413 | |
3975 | |
4414 | memcpy (v_buffer + v_buflen, data, len); |
3976 | memcpy (v_buffer + v_buflen, data, len); |
4415 | v_buflen += len; |
3977 | v_buflen += len; |
4416 | |
3978 | |
4417 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
3979 | pty_ev.set (ev::READ | ev::WRITE); |
4418 | } |
3980 | } |
4419 | |
3981 | |
4420 | void rxvt_term::pty_write () |
3982 | void rxvt_term::pty_write () |
4421 | { |
3983 | { |
4422 | 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)); |
… | |
… | |
4427 | |
3989 | |
4428 | if (v_buflen == 0) |
3990 | if (v_buflen == 0) |
4429 | { |
3991 | { |
4430 | free (v_buffer); |
3992 | free (v_buffer); |
4431 | v_buffer = 0; |
3993 | v_buffer = 0; |
4432 | v_buflen = 0; |
|
|
4433 | |
3994 | |
4434 | pty_ev.set (EVENT_READ); |
3995 | pty_ev.set (ev::READ); |
4435 | return; |
3996 | return; |
4436 | } |
3997 | } |
4437 | |
3998 | |
4438 | memmove (v_buffer, v_buffer + written, v_buflen); |
3999 | memmove (v_buffer, v_buffer + written, v_buflen); |
4439 | } |
4000 | } |
4440 | else if (written != -1 || (errno != EAGAIN && errno != EINTR)) |
4001 | else if (written != -1 || (errno != EAGAIN && errno != EINTR)) |
4441 | pty_ev.set (EVENT_READ); |
4002 | pty_ev.set (ev::READ); |
4442 | } |
4003 | } |
4443 | |
4004 | |
4444 | /*----------------------- end-of-file (C source) -----------------------*/ |
4005 | /*----------------------- end-of-file (C source) -----------------------*/ |
4445 | |
4006 | |