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 | { |
|
|
1461 | if (mapped) |
|
|
1462 | update_background (); |
|
|
1463 | else |
|
|
1464 | bgPixmap.invalidate (); |
|
|
1465 | } |
|
|
1466 | #endif |
|
|
1467 | } |
1470 | |
1468 | |
1471 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1469 | 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 | } |
1470 | } |
1478 | break; |
1471 | break; |
1479 | |
1472 | |
1480 | case PropertyNotify: |
1473 | case PropertyNotify: |
1481 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1474 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
… | |
… | |
1497 | case SelectionRequest: |
1490 | case SelectionRequest: |
1498 | selection_send (ev.xselectionrequest); |
1491 | selection_send (ev.xselectionrequest); |
1499 | break; |
1492 | break; |
1500 | |
1493 | |
1501 | case MapNotify: |
1494 | case MapNotify: |
|
|
1495 | #ifdef HAVE_BG_PIXMAP |
|
|
1496 | /* This is needed spcifically to fix the case of no window manager or a |
|
|
1497 | * non-reparenting window manager. In those cases we never get first |
|
|
1498 | * ConfigureNotify. Also that speeds startup under normal WM, by taking |
|
|
1499 | * care of multiplicity of ConfigureNotify events arriwing while WM does |
|
|
1500 | * reparenting. |
|
|
1501 | * We should not render background immidiately, as there could be several |
|
|
1502 | * ConfigureNotify's to follow. Lets take care of all of them in one scoop |
|
|
1503 | * by scheduling background redraw as soon as we can, but giving a short |
|
|
1504 | * bit of time for ConfigureNotifies to arrive. |
|
|
1505 | * We should render background PRIOR to drawing any text, but AFTER all |
|
|
1506 | * of ConfigureNotifys for the best results. |
|
|
1507 | */ |
|
|
1508 | if (bgPixmap.flags & bgPixmap_t::isInvalid) |
|
|
1509 | update_background_ev.start (0.025); |
|
|
1510 | #endif |
1502 | mapped = 1; |
1511 | mapped = 1; |
1503 | #ifdef TEXT_BLINK |
1512 | #ifdef TEXT_BLINK |
1504 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
1513 | text_blink_ev.start (); |
1505 | #endif |
1514 | #endif |
1506 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1515 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1507 | break; |
1516 | break; |
1508 | |
1517 | |
1509 | case UnmapNotify: |
1518 | case UnmapNotify: |
… | |
… | |
1511 | #ifdef TEXT_BLINK |
1520 | #ifdef TEXT_BLINK |
1512 | text_blink_ev.stop (); |
1521 | text_blink_ev.stop (); |
1513 | #endif |
1522 | #endif |
1514 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1523 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1515 | break; |
1524 | break; |
1516 | |
|
|
1517 | #ifdef TRANSPARENT |
|
|
1518 | case ReparentNotify: |
|
|
1519 | rootwin_cb (ev); |
|
|
1520 | break; |
|
|
1521 | #endif /* TRANSPARENT */ |
|
|
1522 | |
1525 | |
1523 | case GraphicsExpose: |
1526 | case GraphicsExpose: |
1524 | case Expose: |
1527 | case Expose: |
1525 | if (ev.xany.window == vt) |
1528 | if (ev.xany.window == vt) |
1526 | { |
1529 | { |
1527 | do |
1530 | do |
|
|
1531 | { |
1528 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1532 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1529 | ev.xexpose.width, ev.xexpose.height, False); |
1533 | ev.xexpose.width, ev.xexpose.height, False); |
|
|
1534 | } |
1530 | while (XCheckTypedWindowEvent (xdisp, vt, ev.xany.type, &ev)); |
1535 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); |
1531 | |
1536 | |
1532 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1537 | ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; |
1533 | |
1538 | |
1534 | while (XCheckTypedWindowEvent (xdisp, vt, ev.xany.type, &ev)) |
1539 | while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) |
|
|
1540 | { |
1535 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1541 | scr_expose (ev.xexpose.x, ev.xexpose.y, |
1536 | ev.xexpose.width, ev.xexpose.height, False); |
1542 | ev.xexpose.width, ev.xexpose.height, False); |
|
|
1543 | } |
1537 | |
1544 | |
1538 | want_refresh = 1; |
1545 | want_refresh = 1; |
1539 | } |
1546 | } |
1540 | else |
1547 | else |
1541 | { |
1548 | { |
1542 | XEvent unused_event; |
1549 | XEvent unused_event; |
1543 | |
1550 | |
1544 | while (XCheckTypedWindowEvent (xdisp, ev.xany.window, Expose, &unused_event)) |
1551 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event)) |
1545 | ; |
1552 | ; |
1546 | while (XCheckTypedWindowEvent (xdisp, ev.xany.window, GraphicsExpose, &unused_event)) |
1553 | while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) |
1547 | ; |
1554 | ; |
1548 | |
1555 | |
1549 | if (isScrollbarWindow (ev.xany.window)) |
1556 | if (scrollBar.state && ev.xany.window == scrollBar.win) |
1550 | { |
1557 | { |
1551 | scrollBar.setIdle (); |
1558 | scrollBar.setIdle (); |
1552 | scrollbar_show (0); |
1559 | scrollbar_show (0); |
1553 | } |
1560 | } |
1554 | |
|
|
1555 | #ifdef TRANSPARENT |
|
|
1556 | if (am_transparent && ev.xany.window == parent[0]) |
|
|
1557 | XClearWindow (xdisp, ev.xany.window); |
|
|
1558 | #endif |
|
|
1559 | } |
1561 | } |
1560 | break; |
1562 | break; |
1561 | |
1563 | |
1562 | case MotionNotify: |
1564 | case MotionNotify: |
1563 | #ifdef POINTER_BLANK |
1565 | #ifdef POINTER_BLANK |
1564 | if (hidden_pointer) |
1566 | if (hidden_pointer) |
1565 | pointer_unblank (); |
1567 | pointer_unblank (); |
1566 | #endif |
1568 | #endif |
|
|
1569 | if ((priv_modes & PrivMode_MouseBtnEvent && ev.xbutton.state & (Button1Mask|Button2Mask|Button3Mask)) |
|
|
1570 | || priv_modes & PrivMode_MouseAnyEvent) |
|
|
1571 | mouse_report (ev.xbutton); |
1567 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1572 | if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) |
1568 | break; |
1573 | break; |
1569 | |
1574 | |
1570 | if (ev.xany.window == vt) |
1575 | if (ev.xany.window == vt) |
1571 | { |
1576 | { |
1572 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
1577 | if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) |
1573 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1578 | && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1574 | ; // nop |
1579 | ; // nop |
1575 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1580 | else if (ev.xbutton.state & (Button1Mask | Button3Mask)) |
1576 | { |
1581 | { |
1577 | while (XCheckTypedWindowEvent (xdisp, vt, MotionNotify, &ev)) |
1582 | while (XCheckTypedWindowEvent (dpy, vt, MotionNotify, &ev)) |
1578 | ; |
1583 | ; |
1579 | |
1584 | |
1580 | XQueryPointer (xdisp, vt, |
1585 | XQueryPointer (dpy, vt, |
1581 | &unused_root, &unused_child, |
1586 | &unused_root, &unused_child, |
1582 | &unused_root_x, &unused_root_y, |
1587 | &unused_root_x, &unused_root_y, |
1583 | &ev.xbutton.x, &ev.xbutton.y, |
1588 | &ev.xbutton.x, &ev.xbutton.y, |
1584 | &ev.xbutton.state); |
1589 | &ev.xbutton.state); |
1585 | #ifdef MOUSE_THRESHOLD |
1590 | #ifdef MOUSE_THRESHOLD |
… | |
… | |
1605 | int dist; |
1610 | int dist; |
1606 | |
1611 | |
1607 | /* don't clobber the current delay if we are |
1612 | /* don't clobber the current delay if we are |
1608 | * already in the middle of scrolling. |
1613 | * already in the middle of scrolling. |
1609 | */ |
1614 | */ |
1610 | if (!sel_scroll_ev.active) |
1615 | if (!sel_scroll_ev.is_active ()) |
1611 | sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); |
1616 | sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
1612 | |
1617 | |
1613 | /* save the event params so we can highlight |
1618 | /* save the event params so we can highlight |
1614 | * the selection in the pending-scroll loop |
1619 | * the selection in the pending-scroll loop |
1615 | */ |
1620 | */ |
1616 | selection_save_x = ev.xbutton.x; |
1621 | selection_save_x = ev.xbutton.x; |
… | |
… | |
1638 | else |
1643 | else |
1639 | { |
1644 | { |
1640 | /* we are within the text window, so we |
1645 | /* we are within the text window, so we |
1641 | * shouldn't be scrolling |
1646 | * shouldn't be scrolling |
1642 | */ |
1647 | */ |
1643 | if (sel_scroll_ev.active) |
|
|
1644 | sel_scroll_ev.stop(); |
1648 | sel_scroll_ev.stop(); |
1645 | } |
1649 | } |
1646 | #endif |
1650 | #endif |
1647 | #ifdef MOUSE_THRESHOLD |
1651 | #ifdef MOUSE_THRESHOLD |
1648 | } |
1652 | } |
1649 | #endif |
1653 | #endif |
1650 | } |
1654 | } |
1651 | } |
1655 | } |
1652 | else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) |
1656 | else if (scrollbar_isMotion () && ev.xany.window == scrollBar.win) |
1653 | { |
1657 | { |
1654 | while (XCheckTypedWindowEvent (xdisp, scrollBar.win, |
1658 | while (XCheckTypedWindowEvent (dpy, scrollBar.win, |
1655 | MotionNotify, &ev)) |
1659 | MotionNotify, &ev)) |
1656 | ; |
1660 | ; |
1657 | |
1661 | |
1658 | XQueryPointer (xdisp, scrollBar.win, |
1662 | XQueryPointer (dpy, scrollBar.win, |
1659 | &unused_root, &unused_child, |
1663 | &unused_root, &unused_child, |
1660 | &unused_root_x, &unused_root_y, |
1664 | &unused_root_x, &unused_root_y, |
1661 | &ev.xbutton.x, &ev.xbutton.y, |
1665 | &ev.xbutton.x, &ev.xbutton.y, |
1662 | &unused_mask); |
1666 | &unused_mask); |
1663 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1667 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1664 | scrollbar_size ()); |
1668 | scrollbar_size ()); |
1665 | want_refresh = 1; |
1669 | want_refresh = 1; |
1666 | refresh_limit = 0; |
|
|
1667 | scrollbar_show (1); |
1670 | scrollbar_show (1); |
1668 | } |
1671 | } |
1669 | break; |
1672 | break; |
1670 | } |
1673 | } |
1671 | |
1674 | |
1672 | skip_switch: ; |
|
|
1673 | |
|
|
1674 | #if defined(CURSOR_BLINK) |
1675 | #if defined(CURSOR_BLINK) |
1675 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
1676 | if (option (Opt_cursorBlink) && ev.type == KeyPress) |
1676 | { |
1677 | { |
1677 | if (hidden_cursor) |
1678 | if (hidden_cursor) |
1678 | { |
1679 | { |
1679 | hidden_cursor = 0; |
1680 | hidden_cursor = 0; |
1680 | want_refresh = 1; |
1681 | want_refresh = 1; |
1681 | } |
1682 | } |
1682 | |
1683 | |
1683 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1684 | cursor_blink_ev.again (); |
1684 | } |
1685 | } |
1685 | #endif |
1686 | #endif |
1686 | |
1687 | |
1687 | #if defined(POINTER_BLANK) |
1688 | #if defined(POINTER_BLANK) |
1688 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
1689 | if (option (Opt_pointerBlank) && pointerBlankDelay > 0) |
1689 | { |
1690 | { |
1690 | if (ev.type == MotionNotify |
1691 | if (ev.type == MotionNotify |
1691 | || ev.type == ButtonPress |
1692 | || ev.type == ButtonPress |
1692 | || ev.type == ButtonRelease) |
1693 | || ev.type == ButtonRelease) |
1693 | if (hidden_pointer) |
1694 | if (hidden_pointer) |
… | |
… | |
1695 | |
1696 | |
1696 | if (ev.type == KeyPress && hidden_pointer == 0) |
1697 | if (ev.type == KeyPress && hidden_pointer == 0) |
1697 | pointer_blank (); |
1698 | pointer_blank (); |
1698 | } |
1699 | } |
1699 | #endif |
1700 | #endif |
|
|
1701 | |
|
|
1702 | refresh_check (); |
1700 | } |
1703 | } |
1701 | |
1704 | |
1702 | void |
1705 | void |
1703 | rxvt_term::focus_in () |
1706 | rxvt_term::focus_in () |
1704 | { |
1707 | { |
1705 | if (!focus) |
1708 | if (!focus) |
1706 | { |
1709 | { |
1707 | focus = 1; |
1710 | focus = 1; |
1708 | want_refresh = 1; |
1711 | want_refresh = 1; |
1709 | |
1712 | |
1710 | HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); |
1713 | HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END)); |
1711 | |
1714 | |
1712 | #if USE_XIM |
1715 | #if USE_XIM |
1713 | if (Input_Context != NULL) |
1716 | if (Input_Context != NULL) |
1714 | { |
1717 | { |
1715 | IMSetStatusPosition (); |
1718 | IMSetPosition (); |
1716 | XSetICFocus (Input_Context); |
1719 | XSetICFocus (Input_Context); |
1717 | } |
1720 | } |
1718 | #endif |
1721 | #endif |
1719 | #if CURSOR_BLINK |
1722 | #if CURSOR_BLINK |
1720 | if (OPTION (Opt_cursorBlink)) |
1723 | if (option (Opt_cursorBlink)) |
1721 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1724 | cursor_blink_ev.again (); |
1722 | #endif |
1725 | #endif |
1723 | #if OFF_FOCUS_FADING |
1726 | #if OFF_FOCUS_FADING |
1724 | if (rs[Rs_fade]) |
1727 | if (rs[Rs_fade]) |
1725 | { |
1728 | { |
1726 | pix_colors = pix_colors_focused; |
1729 | pix_colors = pix_colors_focused; |
1727 | scr_recolour (); |
1730 | scr_recolour (); |
1728 | } |
1731 | } |
1729 | #endif |
1732 | #endif |
|
|
1733 | #if ENABLE_FRILLS |
|
|
1734 | if (option (Opt_urgentOnBell)) |
|
|
1735 | { |
|
|
1736 | if (XWMHints *h = XGetWMHints(dpy, parent[0])) |
|
|
1737 | { |
|
|
1738 | h->flags &= ~XUrgencyHint; |
|
|
1739 | XSetWMHints (dpy, parent[0], h); |
|
|
1740 | } |
|
|
1741 | } |
|
|
1742 | #endif |
1730 | } |
1743 | } |
1731 | } |
1744 | } |
1732 | |
1745 | |
1733 | void |
1746 | void |
1734 | rxvt_term::focus_out () |
1747 | rxvt_term::focus_out () |
… | |
… | |
1742 | |
1755 | |
1743 | #if ENABLE_FRILLS || ISO_14755 |
1756 | #if ENABLE_FRILLS || ISO_14755 |
1744 | if (iso14755buf) |
1757 | if (iso14755buf) |
1745 | { |
1758 | { |
1746 | iso14755buf = 0; |
1759 | iso14755buf = 0; |
1747 | # if ENABLE_OVERLAY |
1760 | # if ISO_14755 |
1748 | scr_overlay_off (); |
1761 | scr_overlay_off (); |
1749 | # endif |
1762 | # endif |
1750 | } |
1763 | } |
1751 | #endif |
1764 | #endif |
1752 | #if USE_XIM |
1765 | #if USE_XIM |
1753 | if (Input_Context != NULL) |
1766 | if (Input_Context != NULL) |
1754 | XUnsetICFocus (Input_Context); |
1767 | XUnsetICFocus (Input_Context); |
1755 | #endif |
1768 | #endif |
1756 | #if CURSOR_BLINK |
1769 | #if CURSOR_BLINK |
1757 | if (OPTION (Opt_cursorBlink)) |
1770 | if (option (Opt_cursorBlink)) |
1758 | cursor_blink_ev.stop (); |
1771 | cursor_blink_ev.stop (); |
|
|
1772 | |
1759 | hidden_cursor = 0; |
1773 | hidden_cursor = 0; |
1760 | #endif |
1774 | #endif |
1761 | #if OFF_FOCUS_FADING |
1775 | #if OFF_FOCUS_FADING |
1762 | if (rs[Rs_fade]) |
1776 | if (rs[Rs_fade]) |
1763 | { |
1777 | { |
… | |
… | |
1766 | } |
1780 | } |
1767 | #endif |
1781 | #endif |
1768 | } |
1782 | } |
1769 | } |
1783 | } |
1770 | |
1784 | |
1771 | #if TRANSPARENT |
1785 | void |
|
|
1786 | rxvt_term::update_fade_color (unsigned int idx) |
|
|
1787 | { |
|
|
1788 | #if OFF_FOCUS_FADING |
|
|
1789 | if (rs[Rs_fade]) |
|
|
1790 | { |
|
|
1791 | rgba c; |
|
|
1792 | pix_colors [Color_fade].get (c); |
|
|
1793 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
|
|
1794 | } |
|
|
1795 | #endif |
|
|
1796 | } |
|
|
1797 | |
|
|
1798 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1772 | void |
1799 | void |
1773 | rxvt_term::rootwin_cb (XEvent &ev) |
1800 | rxvt_term::rootwin_cb (XEvent &ev) |
1774 | { |
1801 | { |
1775 | make_current (); |
1802 | make_current (); |
1776 | |
1803 | |
|
|
1804 | if (SHOULD_INVOKE (HOOK_ROOT_EVENT) |
|
|
1805 | && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) |
|
|
1806 | return; |
|
|
1807 | |
|
|
1808 | # if ENABLE_TRANSPARENCY |
1777 | switch (ev.type) |
1809 | switch (ev.type) |
1778 | { |
1810 | { |
1779 | case PropertyNotify: |
1811 | case PropertyNotify: |
1780 | /* |
1812 | /* |
1781 | * if user used some Esetroot compatible prog to set the root bg, |
1813 | * if user used some Esetroot compatible prog to set the root bg, |
1782 | * use the property to determine the pixmap. We use it later on. |
1814 | * use the property to determine the pixmap. We use it later on. |
1783 | */ |
1815 | */ |
1784 | if (ev.xproperty.atom != xa[XA_XROOTPMAP_ID] |
1816 | if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] |
1785 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1817 | || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) |
1786 | return; |
1818 | { |
|
|
1819 | bgPixmap.set_root_pixmap (); |
|
|
1820 | update_background (); |
|
|
1821 | } |
1787 | |
1822 | |
1788 | /* FALLTHROUGH */ |
|
|
1789 | case ReparentNotify: |
|
|
1790 | if (OPTION (Opt_transparent) && check_our_parents () && am_transparent) |
|
|
1791 | want_refresh = want_full_refresh = 1; |
|
|
1792 | break; |
1823 | break; |
1793 | } |
1824 | } |
|
|
1825 | # endif |
|
|
1826 | |
|
|
1827 | refresh_check (); |
1794 | } |
1828 | } |
1795 | #endif |
1829 | #endif |
1796 | |
1830 | |
1797 | void |
1831 | void |
1798 | rxvt_term::button_press (XButtonEvent &ev) |
1832 | rxvt_term::button_press (XButtonEvent &ev) |
… | |
… | |
1853 | mouse_report (ev); |
1887 | mouse_report (ev); |
1854 | } |
1888 | } |
1855 | #else |
1889 | #else |
1856 | MEvent.button = ev.button; |
1890 | MEvent.button = ev.button; |
1857 | mouse_report (ev); |
1891 | mouse_report (ev); |
1858 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
1892 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
1859 | |
1893 | |
1860 | } |
1894 | } |
1861 | else |
1895 | else |
1862 | { |
1896 | { |
1863 | if (ev.button != MEvent.button) |
1897 | if (ev.button != MEvent.button) |
… | |
… | |
1911 | } |
1945 | } |
1912 | |
1946 | |
1913 | /* |
1947 | /* |
1914 | * Scrollbar window processing of button press |
1948 | * Scrollbar window processing of button press |
1915 | */ |
1949 | */ |
1916 | if (isScrollbarWindow (ev.window)) |
1950 | if (scrollBar.state && ev.window == scrollBar.win) |
1917 | { |
1951 | { |
1918 | scrollBar.setIdle (); |
1952 | scrollBar.setIdle (); |
1919 | /* |
1953 | /* |
1920 | * Rxvt-style scrollbar: |
1954 | * Rxvt-style scrollbar: |
1921 | * move up if mouse is above slider |
1955 | * move up if mouse is above slider |
… | |
… | |
1957 | tt_printf ("\033[5~"); |
1991 | tt_printf ("\033[5~"); |
1958 | break; |
1992 | break; |
1959 | } |
1993 | } |
1960 | } |
1994 | } |
1961 | else |
1995 | else |
1962 | #endif /* NO_SCROLLBAR_REPORT */ |
1996 | #endif /* NO_SCROLLBAR_REPORT */ |
1963 | |
1997 | |
1964 | { |
1998 | { |
1965 | char upordown = 0; |
1999 | char upordown = 0; |
1966 | |
2000 | |
1967 | if (scrollBar.style == R_SB_NEXT) |
2001 | if (scrollBar.style == R_SB_NEXT) |
1968 | { |
2002 | { |
1969 | if (scrollbarnext_upButton (ev.y)) |
2003 | if (scrollbarnext_upButton (ev.y)) |
1970 | upordown = -1; /* up */ |
2004 | upordown = -1; /* up */ |
… | |
… | |
1976 | if (scrollbarrxvt_upButton (ev.y)) |
2010 | if (scrollbarrxvt_upButton (ev.y)) |
1977 | upordown = -1; /* up */ |
2011 | upordown = -1; /* up */ |
1978 | else if (scrollbarrxvt_dnButton (ev.y)) |
2012 | else if (scrollbarrxvt_dnButton (ev.y)) |
1979 | upordown = 1; /* down */ |
2013 | upordown = 1; /* down */ |
1980 | } |
2014 | } |
|
|
2015 | |
1981 | if (upordown) |
2016 | if (upordown) |
1982 | { |
2017 | { |
1983 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
2018 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
2019 | if (!cont_scroll_ev.is_active ()) |
1984 | cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); |
2020 | cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
1985 | #endif |
2021 | #endif |
1986 | if (scr_page (upordown < 0 ? UP : DN, 1)) |
2022 | if (scr_page (upordown < 0 ? UP : DN, 1)) |
1987 | { |
2023 | { |
1988 | if (upordown < 0) |
2024 | if (upordown < 0) |
1989 | scrollBar.setUp (); |
2025 | scrollBar.setUp (); |
… | |
… | |
1993 | } |
2029 | } |
1994 | else |
2030 | else |
1995 | switch (ev.button) |
2031 | switch (ev.button) |
1996 | { |
2032 | { |
1997 | case Button2: |
2033 | case Button2: |
1998 | switch (scrollbar_align) |
2034 | switch (scrollBar.align) |
1999 | { |
2035 | { |
2000 | case R_SB_ALIGN_TOP: |
2036 | case R_SB_ALIGN_TOP: |
2001 | csrO = 0; |
2037 | csrO = 0; |
2002 | break; |
2038 | break; |
2003 | case R_SB_ALIGN_CENTRE: |
2039 | case R_SB_ALIGN_CENTRE: |
… | |
… | |
2015 | |
2051 | |
2016 | scrollBar.setMotion (); |
2052 | scrollBar.setMotion (); |
2017 | break; |
2053 | break; |
2018 | |
2054 | |
2019 | case Button1: |
2055 | case Button1: |
2020 | if (scrollbar_align == R_SB_ALIGN_CENTRE) |
2056 | if (scrollBar.align == R_SB_ALIGN_CENTRE) |
2021 | csrO = ev.y - scrollBar.top; |
2057 | csrO = ev.y - scrollBar.top; |
2022 | /* FALLTHROUGH */ |
2058 | /* FALLTHROUGH */ |
2023 | |
2059 | |
2024 | case Button3: |
2060 | case Button3: |
2025 | if (scrollBar.style != R_SB_XTERM) |
2061 | if (scrollBar.style != R_SB_XTERM) |
… | |
… | |
2069 | scrollBar.setIdle (); |
2105 | scrollBar.setIdle (); |
2070 | scrollbar_show (0); |
2106 | scrollbar_show (0); |
2071 | } |
2107 | } |
2072 | |
2108 | |
2073 | #ifdef SELECTION_SCROLLING |
2109 | #ifdef SELECTION_SCROLLING |
2074 | if (sel_scroll_ev.active) |
|
|
2075 | sel_scroll_ev.stop(); |
2110 | sel_scroll_ev.stop(); |
2076 | #endif |
2111 | #endif |
2077 | |
2112 | |
2078 | if (ev.window == vt) |
2113 | if (ev.window == vt) |
2079 | { |
2114 | { |
2080 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
2115 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
… | |
… | |
2104 | mouse_report (ev); |
2139 | mouse_report (ev); |
2105 | } |
2140 | } |
2106 | #else /* MOUSE_REPORT_DOUBLECLICK */ |
2141 | #else /* MOUSE_REPORT_DOUBLECLICK */ |
2107 | MEvent.button = AnyButton; |
2142 | MEvent.button = AnyButton; |
2108 | mouse_report (ev); |
2143 | mouse_report (ev); |
2109 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
2144 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
2110 | return; |
2145 | return; |
2111 | } |
2146 | } |
2112 | |
2147 | |
2113 | /* |
2148 | /* |
2114 | * dumb hack to compensate for the failure of click-and-drag |
2149 | * dumb hack to compensate for the failure of click-and-drag |
… | |
… | |
2126 | selection_make (ev.time); |
2161 | selection_make (ev.time); |
2127 | break; |
2162 | break; |
2128 | |
2163 | |
2129 | case Button2: |
2164 | case Button2: |
2130 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
2165 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
2131 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary); |
2166 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Clipboard : Sel_Primary); |
2132 | break; |
2167 | break; |
2133 | |
2168 | |
2134 | #ifdef MOUSE_WHEEL |
2169 | #ifdef MOUSE_WHEEL |
2135 | case Button4: |
2170 | case Button4: |
2136 | case Button5: |
2171 | case Button5: |
… | |
… | |
2140 | |
2175 | |
2141 | v = ev.button == Button4 ? UP : DN; |
2176 | v = ev.button == Button4 ? UP : DN; |
2142 | |
2177 | |
2143 | if (ev.state & ShiftMask) |
2178 | if (ev.state & ShiftMask) |
2144 | i = 1; |
2179 | i = 1; |
2145 | else if (OPTION (Opt_mouseWheelScrollPage)) |
2180 | else if (option (Opt_mouseWheelScrollPage)) |
2146 | i = nrow - 1; |
2181 | i = nrow - 1; |
2147 | else |
2182 | else |
2148 | i = 5; |
2183 | i = 5; |
2149 | |
2184 | |
2150 | # ifdef MOUSE_SLIP_WHEELING |
2185 | # ifdef MOUSE_SLIP_WHEELING |
… | |
… | |
2152 | { |
2187 | { |
2153 | mouse_slip_wheel_speed += v ? -1 : 1; |
2188 | mouse_slip_wheel_speed += v ? -1 : 1; |
2154 | if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; |
2189 | if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; |
2155 | if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; |
2190 | if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; |
2156 | |
2191 | |
2157 | if (slip_wheel_ev.at < NOW) |
2192 | if (!slip_wheel_ev.is_active ()) |
2158 | slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY; |
2193 | slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); |
2159 | |
|
|
2160 | slip_wheel_ev.start (); |
|
|
2161 | } |
2194 | } |
2162 | else |
2195 | else |
|
|
2196 | # endif |
2163 | { |
2197 | { |
2164 | # endif |
|
|
2165 | scr_page (v, i); |
2198 | scr_page (v, i); |
2166 | scrollbar_show (1); |
2199 | scrollbar_show (1); |
2167 | # ifdef MOUSE_SLIP_WHEELING |
|
|
2168 | } |
2200 | } |
2169 | # endif |
|
|
2170 | } |
2201 | } |
2171 | break; |
2202 | break; |
2172 | #endif |
2203 | #endif |
2173 | } |
2204 | } |
2174 | } |
2205 | } |
2175 | } |
2206 | } |
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 (this, 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 | |
2207 | |
2649 | /*}}} */ |
2208 | /*}}} */ |
2650 | |
2209 | |
2651 | bool |
2210 | bool |
2652 | rxvt_term::cmd_parse () |
2211 | rxvt_term::cmd_parse () |
… | |
… | |
2701 | if (ch == C0_LF) |
2260 | if (ch == C0_LF) |
2702 | nlines++; |
2261 | nlines++; |
2703 | |
2262 | |
2704 | refresh_count++; |
2263 | refresh_count++; |
2705 | |
2264 | |
2706 | if (!OPTION (Opt_jumpScroll) |
2265 | if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) |
2707 | || (refresh_count >= refresh_limit * (nrow - 1))) |
|
|
2708 | { |
2266 | { |
2709 | refreshnow = true; |
|
|
2710 | refresh_count = 0; |
2267 | refresh_count = 0; |
|
|
2268 | |
|
|
2269 | if (!option (Opt_skipScroll) || ev_time () > ev::now () + 1. / 60.) |
|
|
2270 | { |
|
|
2271 | refreshnow = true; |
2711 | ch = NOCHAR; |
2272 | ch = NOCHAR; |
2712 | break; |
2273 | break; |
|
|
2274 | } |
2713 | } |
2275 | } |
2714 | |
2276 | |
2715 | // scr_add_lines only works for nlines <= nrow - 1. |
2277 | // scr_add_lines only works for nlines <= nrow - 1. |
2716 | if (nlines >= nrow - 1) |
2278 | if (nlines >= nrow - 1) |
2717 | { |
2279 | { |
… | |
… | |
2745 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2307 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2746 | scr_add_lines (buf, str - buf, nlines); |
2308 | scr_add_lines (buf, str - buf, nlines); |
2747 | |
2309 | |
2748 | /* |
2310 | /* |
2749 | * If there have been a lot of new lines, then update the screen |
2311 | * If there have been a lot of new lines, then update the screen |
2750 | * What the heck I'll cheat and only refresh less than every page-full. |
2312 | * What the heck we'll cheat and only refresh less than every page-full. |
2751 | * the number of pages between refreshes is refresh_limit, which |
2313 | * if skipScroll is enabled. |
2752 | * is incremented here because we must be doing flat-out scrolling. |
|
|
2753 | */ |
2314 | */ |
2754 | if (refreshnow) |
2315 | if (refreshnow) |
2755 | { |
2316 | { |
2756 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
|
|
2757 | refresh_limit++; |
|
|
2758 | else |
|
|
2759 | { |
|
|
2760 | flag = true; |
2317 | flag = true; |
2761 | scr_refresh (); |
2318 | scr_refresh (); |
2762 | want_refresh = 1; |
2319 | want_refresh = 1; |
2763 | } |
|
|
2764 | } |
2320 | } |
2765 | |
2321 | |
2766 | } |
2322 | } |
2767 | else |
2323 | else |
2768 | { |
2324 | { |
… | |
… | |
2917 | { |
2473 | { |
2918 | if ((buf[len++] = cmd_getc ()) == 'i') |
2474 | if ((buf[len++] = cmd_getc ()) == 'i') |
2919 | break; /* done = 1 */ |
2475 | break; /* done = 1 */ |
2920 | } |
2476 | } |
2921 | } |
2477 | } |
2922 | |
2478 | |
2923 | for (i = 0; i < len; i++) |
2479 | for (i = 0; i < len; i++) |
2924 | if (putc (buf[i], fd) == EOF) |
2480 | if (putc (buf[i], fd) == EOF) |
2925 | { |
2481 | { |
2926 | done = 1; |
2482 | done = 1; |
2927 | break; |
2483 | break; |
… | |
… | |
2929 | } |
2485 | } |
2930 | } |
2486 | } |
2931 | |
2487 | |
2932 | pclose_printer (fd); |
2488 | pclose_printer (fd); |
2933 | } |
2489 | } |
2934 | #endif /* PRINTPIPE */ |
2490 | #endif /* PRINTPIPE */ |
2935 | /*}}} */ |
2491 | /*}}} */ |
2936 | |
2492 | |
2937 | /* *INDENT-OFF* */ |
2493 | /* *INDENT-OFF* */ |
2938 | enum { |
2494 | enum { |
2939 | C1_40 = 0x40, |
2495 | C1_40 = 0x40, |
… | |
… | |
2989 | process_dcs_seq (); |
2545 | process_dcs_seq (); |
2990 | break; |
2546 | break; |
2991 | case 0x9b: /* CSI */ |
2547 | case 0x9b: /* CSI */ |
2992 | process_csi_seq (); |
2548 | process_csi_seq (); |
2993 | break; |
2549 | break; |
2994 | case 0x9d: /* CSI */ |
2550 | case 0x9d: /* OSC */ |
2995 | process_osc_seq (); |
2551 | process_osc_seq (); |
2996 | break; |
2552 | break; |
2997 | #endif |
2553 | #endif |
2998 | } |
2554 | } |
2999 | } |
2555 | } |
… | |
… | |
3225 | rxvt_term::process_csi_seq () |
2781 | rxvt_term::process_csi_seq () |
3226 | { |
2782 | { |
3227 | unicode_t ch, priv, i; |
2783 | unicode_t ch, priv, i; |
3228 | unsigned int nargs, p; |
2784 | unsigned int nargs, p; |
3229 | int n, ndef; |
2785 | int n, ndef; |
3230 | int arg[ESC_ARGS]; |
2786 | int arg[ESC_ARGS] = { }; |
3231 | |
2787 | |
3232 | for (nargs = ESC_ARGS; nargs > 0;) |
2788 | nargs = 0; |
3233 | arg[--nargs] = 0; |
|
|
3234 | |
2789 | |
3235 | priv = 0; |
2790 | priv = 0; |
3236 | ch = cmd_getc (); |
2791 | ch = cmd_getc (); |
3237 | if (ch >= '<' && ch <= '?') |
2792 | if (ch >= '<' && ch <= '?') |
|
|
2793 | { |
3238 | { /* '<' '=' '>' '?' */ |
2794 | /* '<' '=' '>' '?' */ |
3239 | priv = ch; |
2795 | priv = ch; |
3240 | ch = cmd_getc (); |
2796 | ch = cmd_getc (); |
3241 | } |
2797 | } |
3242 | |
2798 | |
3243 | /* read any numerical arguments */ |
2799 | /* read any numerical arguments */ |
… | |
… | |
3282 | switch (priv) |
2838 | switch (priv) |
3283 | { |
2839 | { |
3284 | case '>': |
2840 | case '>': |
3285 | if (ch == CSI_DA) /* secondary device attributes */ |
2841 | if (ch == CSI_DA) /* secondary device attributes */ |
3286 | { |
2842 | { |
3287 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
2843 | // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, |
3288 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
2844 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
3289 | // |
2845 | // |
3290 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
2846 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
3291 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
2847 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, 94 for urxvt <= 8.3, and 95 for later |
3292 | // that we do not support xterm mouse reporting (should be 95 when we do). |
2848 | // versions. |
3293 | // |
2849 | // |
3294 | tt_printf ("\033[>%d;94;0c", 'U'); |
2850 | tt_printf ("\033[>%d;95;0c", 'U'); |
3295 | } |
2851 | } |
3296 | break; |
2852 | break; |
3297 | case '?': |
2853 | case '?': |
3298 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
2854 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3299 | process_terminal_mode (ch, priv, nargs, arg); |
2855 | process_terminal_mode (ch, priv, nargs, arg); |
… | |
… | |
3426 | break; |
2982 | break; |
3427 | case 6: /* CPR requested */ |
2983 | case 6: /* CPR requested */ |
3428 | scr_report_position (); |
2984 | scr_report_position (); |
3429 | break; |
2985 | break; |
3430 | case 7: /* unofficial extension */ |
2986 | case 7: /* unofficial extension */ |
3431 | if (OPTION (Opt_insecure)) |
2987 | if (option (Opt_insecure)) |
3432 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
2988 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
3433 | break; |
2989 | break; |
3434 | case 8: /* unofficial extension */ |
2990 | case 8: /* unofficial extension */ |
3435 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
2991 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
3436 | break; |
2992 | break; |
… | |
… | |
3529 | { |
3085 | { |
3530 | int x, y; |
3086 | int x, y; |
3531 | XWindowAttributes wattr; |
3087 | XWindowAttributes wattr; |
3532 | Window wdummy; |
3088 | Window wdummy; |
3533 | |
3089 | |
3534 | dLocal (Display *, xdisp); |
3090 | dLocal (Display *, dpy); |
3535 | |
3091 | |
3536 | if (nargs == 0) |
3092 | if (nargs == 0) |
3537 | return; |
3093 | return; |
3538 | |
3094 | |
3539 | switch (args[0]) |
3095 | switch (args[0]) |
3540 | { |
3096 | { |
3541 | /* |
3097 | /* |
3542 | * commands |
3098 | * commands |
3543 | */ |
3099 | */ |
3544 | case 1: /* deiconify window */ |
3100 | case 1: /* deiconify window */ |
3545 | XMapWindow (xdisp, parent[0]); |
3101 | XMapWindow (dpy, parent[0]); |
3546 | break; |
3102 | break; |
3547 | case 2: /* iconify window */ |
3103 | case 2: /* iconify window */ |
3548 | XIconifyWindow (xdisp, parent[0], display->screen); |
3104 | XIconifyWindow (dpy, parent[0], display->screen); |
3549 | break; |
3105 | break; |
3550 | case 3: /* set position (pixels) */ |
3106 | case 3: /* set position (pixels) */ |
3551 | XMoveWindow (xdisp, parent[0], args[1], args[2]); |
3107 | XMoveWindow (dpy, parent[0], args[1], args[2]); |
3552 | break; |
3108 | break; |
3553 | case 4: /* set size (pixels) */ |
3109 | case 4: /* set size (pixels) */ |
3554 | set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); |
3110 | set_widthheight ((unsigned int)args[2], (unsigned int)args[1]); |
3555 | break; |
3111 | break; |
3556 | case 5: /* raise window */ |
3112 | case 5: /* raise window */ |
3557 | XRaiseWindow (xdisp, parent[0]); |
3113 | XRaiseWindow (dpy, parent[0]); |
3558 | break; |
3114 | break; |
3559 | case 6: /* lower window */ |
3115 | case 6: /* lower window */ |
3560 | XLowerWindow (xdisp, parent[0]); |
3116 | XLowerWindow (dpy, parent[0]); |
3561 | break; |
3117 | break; |
3562 | case 7: /* refresh window */ |
3118 | case 7: /* refresh window */ |
3563 | scr_touch (true); |
3119 | scr_touch (true); |
3564 | break; |
3120 | break; |
3565 | case 8: /* set size (chars) */ |
3121 | case 8: /* set size (chars) */ |
… | |
… | |
3576 | |
3132 | |
3577 | /* |
3133 | /* |
3578 | * reports - some output format copied from XTerm |
3134 | * reports - some output format copied from XTerm |
3579 | */ |
3135 | */ |
3580 | case 11: /* report window state */ |
3136 | case 11: /* report window state */ |
3581 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3137 | XGetWindowAttributes (dpy, parent[0], &wattr); |
3582 | tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); |
3138 | tt_printf ("\033[%dt", wattr.map_state == IsViewable ? 1 : 2); |
3583 | break; |
3139 | break; |
3584 | case 13: /* report window position */ |
3140 | case 13: /* report window position */ |
3585 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3141 | XGetWindowAttributes (dpy, parent[0], &wattr); |
3586 | XTranslateCoordinates (xdisp, parent[0], wattr.root, |
3142 | XTranslateCoordinates (dpy, parent[0], wattr.root, |
3587 | -wattr.border_width, -wattr.border_width, |
3143 | -wattr.border_width, -wattr.border_width, |
3588 | &x, &y, &wdummy); |
3144 | &x, &y, &wdummy); |
3589 | tt_printf ("\033[3;%d;%dt", x, y); |
3145 | tt_printf ("\033[3;%d;%dt", x, y); |
3590 | break; |
3146 | break; |
3591 | case 14: /* report window size (pixels) */ |
3147 | case 14: /* report window size (pixels) */ |
3592 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3148 | XGetWindowAttributes (dpy, parent[0], &wattr); |
3593 | tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); |
3149 | tt_printf ("\033[4;%d;%dt", wattr.height, wattr.width); |
3594 | break; |
3150 | break; |
3595 | case 18: /* report text area size (chars) */ |
3151 | case 18: /* report text area size (chars) */ |
3596 | tt_printf ("\033[8;%d;%dt", nrow, ncol); |
3152 | tt_printf ("\033[8;%d;%dt", nrow, ncol); |
3597 | break; |
3153 | break; |
… | |
… | |
3599 | tt_printf ("\033[9;%d;%dt", nrow, ncol); |
3155 | tt_printf ("\033[9;%d;%dt", nrow, ncol); |
3600 | break; |
3156 | break; |
3601 | case 20: /* report icon label */ |
3157 | case 20: /* report icon label */ |
3602 | { |
3158 | { |
3603 | char *s; |
3159 | char *s; |
3604 | XGetIconName (xdisp, parent[0], &s); |
3160 | XGetIconName (dpy, parent[0], &s); |
3605 | tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3161 | tt_printf ("\033]L%-.250s\234", option (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3606 | XFree (s); |
3162 | XFree (s); |
3607 | } |
3163 | } |
3608 | break; |
3164 | break; |
3609 | case 21: /* report window title */ |
3165 | case 21: /* report window title */ |
3610 | { |
3166 | { |
3611 | char *s; |
3167 | char *s; |
3612 | XFetchName (xdisp, parent[0], &s); |
3168 | XFetchName (dpy, parent[0], &s); |
3613 | tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3169 | tt_printf ("\033]l%-.250s\234", option (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3614 | XFree (s); |
3170 | XFree (s); |
3615 | } |
3171 | } |
3616 | break; |
3172 | break; |
3617 | } |
3173 | } |
3618 | } |
3174 | } |
… | |
… | |
3645 | seen_esc = true; |
3201 | seen_esc = true; |
3646 | continue; |
3202 | continue; |
3647 | } |
3203 | } |
3648 | else if (ch == C0_BEL || ch == CHAR_ST) |
3204 | else if (ch == C0_BEL || ch == CHAR_ST) |
3649 | break; |
3205 | break; |
|
|
3206 | else if (ch == C0_SYN) |
|
|
3207 | ch = cmd_get8 (); |
3650 | else if (ch < 0x20) |
3208 | else if (ch < 0x20) |
3651 | return NULL; /* other control character - exit */ |
3209 | return NULL; /* other control character - exit */ |
3652 | |
3210 | |
3653 | seen_esc = false; |
3211 | seen_esc = false; |
3654 | |
3212 | |
3655 | if (n >= STRING_MAX - 1) |
3213 | if (n >= STRING_MAX - 1) |
3656 | // stop at some sane length |
3214 | // stop at some sane length |
3657 | return NULL; |
3215 | return NULL; |
3658 | |
3216 | |
3659 | if (ch == C0_SYN) |
|
|
3660 | string[n++] = cmd_get8 (); |
|
|
3661 | else |
|
|
3662 | string[n++] = ch; |
3217 | string[n++] = ch; |
3663 | } |
3218 | } |
3664 | |
3219 | |
3665 | string[n++] = '\0'; |
3220 | string[n++] = '\0'; |
3666 | |
3221 | |
3667 | ends_how = (ch == 0x5c ? C0_ESC : ch); |
3222 | ends_how = (ch == 0x5c ? C0_ESC : ch); |
… | |
… | |
3719 | rxvt_term::process_color_seq (int report, int color, const char *str, char resp) |
3274 | rxvt_term::process_color_seq (int report, int color, const char *str, char resp) |
3720 | { |
3275 | { |
3721 | if (str[0] == '?' && !str[1]) |
3276 | if (str[0] == '?' && !str[1]) |
3722 | { |
3277 | { |
3723 | rgba c; |
3278 | rgba c; |
3724 | pix_colors_focused[color].get (this, c); |
3279 | pix_colors_focused[color].get (c); |
3725 | |
3280 | |
3726 | #if XFT |
3281 | #if XFT |
3727 | if (c.a != rgba::MAX_CC) |
3282 | if (c.a != rgba::MAX_CC) |
3728 | tt_printf ("\033]%d;rgba:%04x/%04x/%04x/%04x%c", report, c.a, c.r, c.g, c.b, resp); |
3283 | tt_printf ("\033]%d;rgba:%04x/%04x/%04x/%04x%c", report, c.a, c.r, c.g, c.b, resp); |
3729 | else |
3284 | else |
… | |
… | |
3743 | int color; |
3298 | int color; |
3744 | char *buf, *name; |
3299 | char *buf, *name; |
3745 | bool query = str[0] == '?' && !str[1]; |
3300 | bool query = str[0] == '?' && !str[1]; |
3746 | int saveop = op; |
3301 | int saveop = op; |
3747 | |
3302 | |
3748 | dLocal (Display *, xdisp); |
3303 | dLocal (Display *, dpy); |
3749 | |
3304 | |
3750 | assert (str != NULL); |
3305 | assert (str != NULL); |
|
|
3306 | |
|
|
3307 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
|
|
3308 | return; |
|
|
3309 | |
3751 | switch (op) |
3310 | switch (op) |
3752 | { |
3311 | { |
3753 | case XTerm_name: |
3312 | case XTerm_name: |
3754 | set_title (str); |
3313 | set_title (str); |
3755 | /* FALLTHROUGH */ |
3314 | /* FALLTHROUGH */ |
… | |
… | |
3769 | unsigned long bytes_after; |
3328 | unsigned long bytes_after; |
3770 | unsigned char *value = 0; |
3329 | unsigned char *value = 0; |
3771 | const char *str = ""; |
3330 | const char *str = ""; |
3772 | |
3331 | |
3773 | if (prop |
3332 | if (prop |
3774 | && XGetWindowProperty (xdisp, parent[0], |
3333 | && XGetWindowProperty (dpy, parent[0], |
3775 | prop, 0, 1<<16, 0, AnyPropertyType, |
3334 | prop, 0, 1<<16, 0, AnyPropertyType, |
3776 | &actual_type, &actual_format, |
3335 | &actual_type, &actual_format, |
3777 | &nitems, &bytes_after, &value) == Success |
3336 | &nitems, &bytes_after, &value) == Success |
3778 | && actual_type != None |
3337 | && actual_type != None |
3779 | && actual_format == 8) |
3338 | && actual_format == 8) |
… | |
… | |
3791 | { |
3350 | { |
3792 | *eq = 0; |
3351 | *eq = 0; |
3793 | set_utf8_property (display->atom (str), eq + 1); |
3352 | set_utf8_property (display->atom (str), eq + 1); |
3794 | } |
3353 | } |
3795 | else |
3354 | else |
3796 | XDeleteProperty (xdisp, parent[0], |
3355 | XDeleteProperty (dpy, parent[0], |
3797 | display->atom (str)); |
3356 | display->atom (str)); |
3798 | } |
3357 | } |
3799 | break; |
3358 | break; |
3800 | |
3359 | |
3801 | case XTerm_Color: |
3360 | case XTerm_Color: |
… | |
… | |
3814 | *buf++ = '\0'; |
3373 | *buf++ = '\0'; |
3815 | |
3374 | |
3816 | process_color_seq (op, color, name, resp); |
3375 | process_color_seq (op, color, name, resp); |
3817 | } |
3376 | } |
3818 | break; |
3377 | break; |
|
|
3378 | case Rxvt_restoreFG: |
3819 | case XTerm_Color00: |
3379 | case XTerm_Color00: |
3820 | process_color_seq (op, Color_fg, str, resp); |
3380 | process_color_seq (op, Color_fg, str, resp); |
3821 | break; |
3381 | break; |
|
|
3382 | case Rxvt_restoreBG: |
3822 | case XTerm_Color01: |
3383 | case XTerm_Color01: |
3823 | process_color_seq (op, Color_bg, str, resp); |
3384 | process_color_seq (op, Color_bg, str, resp); |
3824 | break; |
3385 | break; |
3825 | #ifndef NO_CURSORCOLOR |
3386 | #ifndef NO_CURSORCOLOR |
3826 | case XTerm_Color_cursor: |
3387 | case XTerm_Color_cursor: |
… | |
… | |
3847 | break; |
3408 | break; |
3848 | case URxvt_Color_IT: |
3409 | case URxvt_Color_IT: |
3849 | process_color_seq (op, Color_IT, str, resp); |
3410 | process_color_seq (op, Color_IT, str, resp); |
3850 | break; |
3411 | break; |
3851 | #endif |
3412 | #endif |
3852 | #if TRANSPARENT && TINTING |
3413 | #if ENABLE_TRANSPARENCY |
3853 | case URxvt_Color_tint: |
3414 | case URxvt_Color_tint: |
3854 | process_color_seq (op, Color_tint, str, resp); |
3415 | process_color_seq (op, Color_tint, str, resp); |
|
|
3416 | { |
|
|
3417 | bool changed = false; |
3855 | |
3418 | |
3856 | check_our_parents (); |
3419 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
3420 | changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
|
|
3421 | else |
|
|
3422 | changed = bgPixmap.unset_tint (); |
3857 | |
3423 | |
3858 | if (am_transparent) |
3424 | if (changed) |
3859 | want_full_refresh = want_refresh = 1; |
3425 | update_background (); |
|
|
3426 | } |
3860 | |
3427 | |
3861 | break; |
3428 | break; |
3862 | #endif |
3429 | #endif |
3863 | |
3430 | |
|
|
3431 | #if BG_IMAGE_FROM_FILE |
3864 | case Rxvt_Pixmap: |
3432 | case Rxvt_Pixmap: |
3865 | { |
3433 | if (!strcmp (str, "?")) |
3866 | if (*str != ';') |
|
|
3867 | { |
3434 | { |
3868 | #if XPM_BACKGROUND |
3435 | char str[256]; |
3869 | scale_pixmap (""); /* reset to default scaling */ |
3436 | |
3870 | set_bgPixmap (str); /* change pixmap */ |
3437 | sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ |
3871 | scr_touch (true); |
3438 | min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767), |
3872 | #endif |
3439 | min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767)); |
|
|
3440 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
3873 | } |
3441 | } |
3874 | |
3442 | else |
|
|
3443 | { |
3875 | int changed = 0; |
3444 | int changed = 0; |
3876 | |
3445 | |
3877 | while ((str = strchr (str, ';')) != NULL) |
3446 | if (*str != ';') |
3878 | { |
3447 | { |
|
|
3448 | /* reset to default scaling :*/ |
|
|
3449 | bgPixmap.unset_geometry (); |
|
|
3450 | if (bgPixmap.set_file (str)) /* change pixmap */ |
|
|
3451 | changed++; |
|
|
3452 | str = strchr (str, ';'); |
|
|
3453 | if (str == NULL) |
|
|
3454 | bgPixmap.set_defaultGeometry (); |
|
|
3455 | } |
|
|
3456 | |
|
|
3457 | while (str) |
|
|
3458 | { |
3879 | str++; |
3459 | str++; |
3880 | #if XPM_BACKGROUND |
3460 | if (bgPixmap.set_geometry (str)) |
3881 | changed += scale_pixmap (str); |
3461 | changed++; |
3882 | #endif |
3462 | str = strchr (str, ';'); |
3883 | } |
3463 | } |
3884 | |
3464 | |
3885 | if (changed) |
3465 | if (changed) |
3886 | { |
3466 | update_background (); |
3887 | #ifdef XPM_BACKGROUND |
|
|
3888 | resize_pixmap (); |
|
|
3889 | scr_touch (true); |
|
|
3890 | #endif |
|
|
3891 | } |
3467 | } |
3892 | } |
|
|
3893 | break; |
3468 | break; |
3894 | |
3469 | #endif |
3895 | case Rxvt_restoreFG: |
|
|
3896 | set_window_color (Color_fg, str); |
|
|
3897 | break; |
|
|
3898 | case Rxvt_restoreBG: |
|
|
3899 | set_window_color (Color_bg, str); |
|
|
3900 | break; |
|
|
3901 | |
3470 | |
3902 | case XTerm_logfile: |
3471 | case XTerm_logfile: |
3903 | // TODO, when secure mode? |
3472 | // TODO, when secure mode? |
3904 | break; |
3473 | break; |
3905 | |
3474 | |
… | |
… | |
3923 | case URxvt_italicFont: |
3492 | case URxvt_italicFont: |
3924 | case URxvt_boldItalicFont: |
3493 | case URxvt_boldItalicFont: |
3925 | #endif |
3494 | #endif |
3926 | if (query) |
3495 | if (query) |
3927 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3496 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3928 | OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3497 | option (Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3929 | ? fontset[op - URxvt_font]->fontdesc : "", |
3498 | ? fontset[op - URxvt_font]->fontdesc : "", |
3930 | resp); |
3499 | resp); |
3931 | else |
3500 | else |
3932 | { |
3501 | { |
3933 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
3502 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
… | |
… | |
3947 | break; |
3516 | break; |
3948 | |
3517 | |
3949 | #if !ENABLE_MINIMAL |
3518 | #if !ENABLE_MINIMAL |
3950 | case URxvt_locale: |
3519 | case URxvt_locale: |
3951 | if (query) |
3520 | if (query) |
3952 | tt_printf ("\33]%d;%-.250s%c", op, OPTION (Opt_insecure) ? locale : "", resp); |
3521 | tt_printf ("\33]%d;%-.250s%c", op, option (Opt_insecure) ? locale : "", resp); |
3953 | else |
3522 | else |
3954 | { |
3523 | { |
3955 | set_locale (str); |
3524 | set_locale (str); |
3956 | pty->set_utf8_mode (enc_utf8); |
3525 | pty->set_utf8_mode (enc_utf8); |
3957 | init_xlocale (); |
3526 | init_xlocale (); |
… | |
… | |
3972 | break; |
3541 | break; |
3973 | #endif |
3542 | #endif |
3974 | |
3543 | |
3975 | #if ENABLE_PERL |
3544 | #if ENABLE_PERL |
3976 | case URxvt_perl: |
3545 | case URxvt_perl: |
3977 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_STR, str, DT_END))) |
3546 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ_PERL, DT_STR, str, DT_END))) |
3978 | ; // no responses yet |
3547 | ; // no responses yet |
3979 | break; |
3548 | break; |
3980 | #endif |
3549 | #endif |
3981 | } |
3550 | } |
3982 | } |
3551 | } |
… | |
… | |
4020 | { |
3589 | { |
4021 | unsigned int i, j; |
3590 | unsigned int i, j; |
4022 | int state; |
3591 | int state; |
4023 | |
3592 | |
4024 | static const struct |
3593 | static const struct |
4025 | { |
3594 | { |
4026 | const int argval; |
3595 | const int argval; |
4027 | const unsigned long bit; |
3596 | const unsigned long bit; |
4028 | } |
|
|
4029 | |
|
|
4030 | argtopriv[] = { |
3597 | } argtopriv[] = { |
4031 | { 1, PrivMode_aplCUR }, |
3598 | { 1, PrivMode_aplCUR }, |
4032 | { 2, PrivMode_vt52 }, |
3599 | { 2, PrivMode_vt52 }, |
4033 | { 3, PrivMode_132 }, |
3600 | { 3, PrivMode_132 }, |
4034 | { 4, PrivMode_smoothScroll }, |
3601 | { 4, PrivMode_smoothScroll }, |
4035 | { 5, PrivMode_rVideo }, |
3602 | { 5, PrivMode_rVideo }, |
… | |
… | |
4051 | { 66, PrivMode_aplKP }, |
3618 | { 66, PrivMode_aplKP }, |
4052 | #ifndef NO_BACKSPACE_KEY |
3619 | #ifndef NO_BACKSPACE_KEY |
4053 | { 67, PrivMode_BackSpace }, |
3620 | { 67, PrivMode_BackSpace }, |
4054 | #endif |
3621 | #endif |
4055 | { 1000, PrivMode_MouseX11 }, |
3622 | { 1000, PrivMode_MouseX11 }, |
4056 | // 1001 Use Hilite Mouse Tracking. NYI, TODO |
3623 | { 1002, PrivMode_MouseBtnEvent }, |
4057 | // 1002 Use Cell Motion Mouse Tracking. NYI, TODO |
3624 | { 1003, PrivMode_MouseAnyEvent }, |
4058 | // 1003 Use All Motion Mouse Tracking. NYI, TODO |
|
|
4059 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
3625 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension |
4060 | { 1011, PrivMode_Keypress }, // rxvt extension |
3626 | { 1011, PrivMode_Keypress }, // rxvt extension |
4061 | // 1035 enable modifiers for alt, numlock NYI |
3627 | // 1035 enable modifiers for alt, numlock NYI |
4062 | // 1036 send ESC for meta keys NYI |
3628 | // 1036 send ESC for meta keys NYI |
4063 | // 1037 send DEL for keypad delete NYI |
3629 | // 1037 send DEL for keypad delete NYI |
… | |
… | |
4098 | scr_touch (true); |
3664 | scr_touch (true); |
4099 | break; |
3665 | break; |
4100 | #endif |
3666 | #endif |
4101 | case 1048: /* alternative cursor save */ |
3667 | case 1048: /* alternative cursor save */ |
4102 | case 1049: |
3668 | case 1049: |
4103 | if (OPTION (Opt_secondaryScreen)) |
3669 | if (option (Opt_secondaryScreen)) |
4104 | if (mode == 0) |
3670 | if (mode == 0) |
4105 | scr_cursor (RESTORE); |
3671 | scr_cursor (RESTORE); |
4106 | else if (mode == 1) |
3672 | else if (mode == 1) |
4107 | scr_cursor (SAVE); |
3673 | scr_cursor (SAVE); |
4108 | break; |
3674 | break; |
… | |
… | |
4120 | */ |
3686 | */ |
4121 | PrivMode (1, PrivMode_vt52); |
3687 | PrivMode (1, PrivMode_vt52); |
4122 | break; |
3688 | break; |
4123 | case 3: /* 80/132 */ |
3689 | case 3: /* 80/132 */ |
4124 | if (priv_modes & PrivMode_132OK) |
3690 | if (priv_modes & PrivMode_132OK) |
|
|
3691 | { |
|
|
3692 | scr_poweron (); |
4125 | set_widthheight (((state ? 132 : 80) * fwidth), height); |
3693 | set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight); |
|
|
3694 | } |
4126 | break; |
3695 | break; |
4127 | case 4: /* smooth scrolling */ |
3696 | case 4: /* smooth scrolling */ |
4128 | set_option (Opt_jumpScroll, !state); |
3697 | set_option (Opt_jumpScroll, !state); |
4129 | break; |
3698 | break; |
4130 | case 5: /* reverse video */ |
3699 | case 5: /* reverse video */ |
… | |
… | |
4137 | scr_autowrap (state); |
3706 | scr_autowrap (state); |
4138 | break; |
3707 | break; |
4139 | /* case 8: - auto repeat, can't do on a per window basis */ |
3708 | /* case 8: - auto repeat, can't do on a per window basis */ |
4140 | case 9: /* X10 mouse reporting */ |
3709 | case 9: /* X10 mouse reporting */ |
4141 | if (state) /* orthogonal */ |
3710 | if (state) /* orthogonal */ |
4142 | priv_modes &= ~PrivMode_MouseX11; |
3711 | priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
4143 | break; |
3712 | break; |
4144 | #ifdef scrollBar_esc |
3713 | #ifdef scrollBar_esc |
4145 | case scrollBar_esc: |
3714 | case scrollBar_esc: |
4146 | if (scrollbar_mapping (state)) |
3715 | if (scrollbar_mapping (state)) |
4147 | { |
3716 | { |
… | |
… | |
4160 | break; |
3729 | break; |
4161 | /* case 66: - application key pad */ |
3730 | /* case 66: - application key pad */ |
4162 | /* case 67: - backspace key */ |
3731 | /* case 67: - backspace key */ |
4163 | case 1000: /* X11 mouse reporting */ |
3732 | case 1000: /* X11 mouse reporting */ |
4164 | if (state) /* orthogonal */ |
3733 | if (state) /* orthogonal */ |
4165 | priv_modes &= ~PrivMode_MouseX10; |
3734 | priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); |
4166 | break; |
3735 | break; |
4167 | #if 0 |
|
|
4168 | case 1001: |
3736 | case 1002: |
4169 | break; /* X11 mouse highlighting */ |
3737 | case 1003: |
4170 | #endif |
3738 | if (state) |
|
|
3739 | { |
|
|
3740 | priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11); |
|
|
3741 | priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; |
|
|
3742 | vt_emask_mouse = PointerMotionMask; |
|
|
3743 | } |
|
|
3744 | else |
|
|
3745 | vt_emask_mouse = NoEventMask; |
|
|
3746 | vt_select_input (); |
|
|
3747 | break; |
4171 | case 1010: /* scroll to bottom on TTY output inhibit */ |
3748 | case 1010: /* scroll to bottom on TTY output inhibit */ |
4172 | set_option (Opt_scrollTtyOutput, !state); |
3749 | set_option (Opt_scrollTtyOutput, !state); |
4173 | break; |
3750 | break; |
4174 | case 1011: /* scroll to bottom on key press */ |
3751 | case 1011: /* scroll to bottom on key press */ |
4175 | set_option (Opt_scrollTtyKeypress, state); |
3752 | set_option (Opt_scrollTtyKeypress, state); |
4176 | break; |
3753 | break; |
4177 | case 1047: /* secondary screen w/ clearing last */ |
3754 | case 1047: /* secondary screen w/ clearing last */ |
4178 | if (OPTION (Opt_secondaryScreen)) |
3755 | if (option (Opt_secondaryScreen)) |
4179 | if (current_screen != PRIMARY) |
3756 | if (current_screen != PRIMARY) |
4180 | scr_erase_screen (2); |
3757 | scr_erase_screen (2); |
4181 | scr_change_screen (state); |
3758 | scr_change_screen (state); |
4182 | break; |
3759 | break; |
4183 | case 1049: /* secondary screen w/ clearing first */ |
3760 | case 1049: /* secondary screen w/ clearing first */ |
4184 | scr_change_screen (state); |
3761 | scr_change_screen (state); |
4185 | if (OPTION (Opt_secondaryScreen)) |
3762 | if (option (Opt_secondaryScreen)) |
4186 | if (current_screen != PRIMARY) |
3763 | if (current_screen != PRIMARY) |
4187 | scr_erase_screen (2); |
3764 | scr_erase_screen (2); |
4188 | break; |
3765 | break; |
4189 | default: |
3766 | default: |
4190 | break; |
3767 | break; |
… | |
… | |
4352 | rxvt_term::process_graphics () |
3929 | rxvt_term::process_graphics () |
4353 | { |
3930 | { |
4354 | unicode_t ch, cmd = cmd_getc (); |
3931 | unicode_t ch, cmd = cmd_getc (); |
4355 | |
3932 | |
4356 | if (cmd == 'Q') |
3933 | if (cmd == 'Q') |
|
|
3934 | { |
4357 | { /* query graphics */ |
3935 | /* query graphics */ |
4358 | tt_printf ("\033G0\012"); /* no graphics */ |
3936 | tt_printf ("\033G0\012"); /* no graphics */ |
4359 | return; |
3937 | return; |
4360 | } |
3938 | } |
4361 | /* swallow other graphics sequences until terminating ':' */ |
3939 | /* swallow other graphics sequences until terminating ':' */ |
4362 | do |
3940 | do |
… | |
… | |
4412 | v_buffer = (char *)realloc (v_buffer, v_buflen + len); |
3990 | v_buffer = (char *)realloc (v_buffer, v_buflen + len); |
4413 | |
3991 | |
4414 | memcpy (v_buffer + v_buflen, data, len); |
3992 | memcpy (v_buffer + v_buflen, data, len); |
4415 | v_buflen += len; |
3993 | v_buflen += len; |
4416 | |
3994 | |
4417 | pty_ev.set (EVENT_READ | EVENT_WRITE); |
3995 | pty_ev.set (ev::READ | ev::WRITE); |
4418 | } |
3996 | } |
4419 | |
3997 | |
4420 | void rxvt_term::pty_write () |
3998 | void rxvt_term::pty_write () |
4421 | { |
3999 | { |
4422 | int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
4000 | int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); |
… | |
… | |
4427 | |
4005 | |
4428 | if (v_buflen == 0) |
4006 | if (v_buflen == 0) |
4429 | { |
4007 | { |
4430 | free (v_buffer); |
4008 | free (v_buffer); |
4431 | v_buffer = 0; |
4009 | v_buffer = 0; |
4432 | v_buflen = 0; |
|
|
4433 | |
4010 | |
4434 | pty_ev.set (EVENT_READ); |
4011 | pty_ev.set (ev::READ); |
4435 | return; |
4012 | return; |
4436 | } |
4013 | } |
4437 | |
4014 | |
4438 | memmove (v_buffer, v_buffer + written, v_buflen); |
4015 | memmove (v_buffer, v_buffer + written, v_buflen); |
4439 | } |
4016 | } |
4440 | else if (written != -1 || (errno != EAGAIN && errno != EINTR)) |
4017 | else if (written != -1 || (errno != EAGAIN && errno != EINTR)) |
4441 | pty_ev.set (EVENT_READ); |
4018 | pty_ev.set (ev::READ); |
4442 | } |
4019 | } |
4443 | |
4020 | |
4444 | /*----------------------- end-of-file (C source) -----------------------*/ |
4021 | /*----------------------- end-of-file (C source) -----------------------*/ |
4445 | |
4022 | |