… | |
… | |
54 | |
54 | |
55 | #ifdef KEYSYM_RESOURCE |
55 | #ifdef KEYSYM_RESOURCE |
56 | # include "keyboard.h" |
56 | # include "keyboard.h" |
57 | #endif |
57 | #endif |
58 | |
58 | |
59 | #include <csignal> |
59 | #include <signal.h> |
60 | |
60 | |
61 | #if LINUX_YIELD_HACK |
61 | #if LINUX_YIELD_HACK |
62 | # include <ctime> |
62 | # include <time.h> |
63 | #endif |
63 | #endif |
64 | |
64 | |
65 | /*----------------------------------------------------------------------*/ |
65 | /*----------------------------------------------------------------------*/ |
66 | |
66 | |
67 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
67 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
… | |
… | |
776 | } |
776 | } |
777 | |
777 | |
778 | if (newlen) |
778 | if (newlen) |
779 | len = strlen (kbuf); |
779 | len = strlen (kbuf); |
780 | |
780 | |
|
|
781 | if (len > 0) |
|
|
782 | { |
781 | /* |
783 | /* |
|
|
784 | * pass Shift/Control indicators for function keys ending with `~' |
|
|
785 | * |
|
|
786 | * eg, |
|
|
787 | * Prior = "ESC[5~" |
|
|
788 | * Shift+Prior = "ESC[5$" |
|
|
789 | * Ctrl+Prior = "ESC[5^" |
|
|
790 | * Ctrl+Shift+Prior = "ESC[5@" |
|
|
791 | */ |
|
|
792 | if (kbuf[0] == C0_ESC && kbuf[1] == '[' && kbuf[len - 1] == '~') |
|
|
793 | kbuf[len - 1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~')); |
|
|
794 | |
|
|
795 | /* |
782 | * Pass meta for all function keys, if 'meta' option set |
796 | * Pass meta for all function keys, if 'meta' option set |
783 | */ |
797 | */ |
784 | #ifdef META8_OPTION |
798 | #ifdef META8_OPTION |
785 | if (meta && (meta_char == 0x80) && len > 0) |
799 | if (meta && (meta_char == 0x80)) |
786 | kbuf[len - 1] |= 0x80; |
800 | kbuf[len - 1] |= 0x80; |
787 | #endif |
801 | #endif |
|
|
802 | } |
788 | |
803 | |
789 | } |
804 | } |
790 | else if (ctrl && keysym == XK_minus) |
805 | else if (ctrl && keysym == XK_minus) |
791 | { |
806 | { |
792 | len = 1; |
807 | len = 1; |
… | |
… | |
825 | if (view_start) |
840 | if (view_start) |
826 | { |
841 | { |
827 | view_start = 0; |
842 | view_start = 0; |
828 | want_refresh = 1; |
843 | want_refresh = 1; |
829 | } |
844 | } |
830 | |
|
|
831 | /* |
|
|
832 | * these modifications only affect the static keybuffer |
|
|
833 | * pass Shift/Control indicators for function keys ending with `~' |
|
|
834 | * |
|
|
835 | * eg, |
|
|
836 | * Prior = "ESC[5~" |
|
|
837 | * Shift+Prior = "ESC[5$" |
|
|
838 | * Ctrl+Prior = "ESC[5^" |
|
|
839 | * Ctrl+Shift+Prior = "ESC[5@" |
|
|
840 | * Meta adds an Escape prefix (with META8_OPTION, if meta == <escape>). |
|
|
841 | */ |
|
|
842 | if (kbuf[0] == C0_ESC && kbuf[1] == '[' && kbuf[len - 1] == '~') |
|
|
843 | kbuf[len - 1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~')); |
|
|
844 | |
845 | |
845 | /* escape prefix */ |
846 | /* escape prefix */ |
846 | if (meta |
847 | if (meta |
847 | #ifdef META8_OPTION |
848 | #ifdef META8_OPTION |
848 | && meta_char == C0_ESC |
849 | && meta_char == C0_ESC |
… | |
… | |
1014 | refresh_count = 0; |
1015 | refresh_count = 0; |
1015 | flush (); |
1016 | flush (); |
1016 | } |
1017 | } |
1017 | |
1018 | |
1018 | #ifdef CURSOR_BLINK |
1019 | #ifdef CURSOR_BLINK |
|
|
1020 | void |
|
|
1021 | rxvt_term::cursor_blink_reset () |
|
|
1022 | { |
|
|
1023 | if (hidden_cursor) |
|
|
1024 | { |
|
|
1025 | hidden_cursor = 0; |
|
|
1026 | want_refresh = 1; |
|
|
1027 | } |
|
|
1028 | |
|
|
1029 | if (option (Opt_cursorBlink)) |
|
|
1030 | cursor_blink_ev.again (); |
|
|
1031 | else |
|
|
1032 | cursor_blink_ev.stop (); |
|
|
1033 | } |
|
|
1034 | |
1019 | void |
1035 | void |
1020 | rxvt_term::cursor_blink_cb (ev::timer &w, int revents) |
1036 | rxvt_term::cursor_blink_cb (ev::timer &w, int revents) |
1021 | { |
1037 | { |
1022 | hidden_cursor = !hidden_cursor; |
1038 | hidden_cursor = !hidden_cursor; |
1023 | want_refresh = 1; |
1039 | want_refresh = 1; |
… | |
… | |
1633 | dist = int_bwidth - ev.xbutton.y; |
1649 | dist = int_bwidth - ev.xbutton.y; |
1634 | } |
1650 | } |
1635 | else |
1651 | else |
1636 | { |
1652 | { |
1637 | scroll_selection_dir = DN; |
1653 | scroll_selection_dir = DN; |
1638 | dist = ev.xbutton.y - (int_bwidth + height); |
1654 | dist = ev.xbutton.y - (int_bwidth + vt_height); |
1639 | } |
1655 | } |
1640 | |
1656 | |
1641 | scroll_selection_lines = Pixel2Height (dist) |
1657 | scroll_selection_lines = Pixel2Height (dist) |
1642 | / SELECTION_SCROLL_LINE_SPEEDUP |
1658 | / SELECTION_SCROLL_LINE_SPEEDUP |
1643 | + 1; |
1659 | + 1; |
… | |
… | |
1675 | } |
1691 | } |
1676 | break; |
1692 | break; |
1677 | } |
1693 | } |
1678 | |
1694 | |
1679 | #if defined(CURSOR_BLINK) |
1695 | #if defined(CURSOR_BLINK) |
1680 | if (option (Opt_cursorBlink) && ev.type == KeyPress) |
1696 | if (ev.type == KeyPress) |
1681 | { |
|
|
1682 | if (hidden_cursor) |
|
|
1683 | { |
|
|
1684 | hidden_cursor = 0; |
|
|
1685 | want_refresh = 1; |
|
|
1686 | } |
|
|
1687 | |
|
|
1688 | cursor_blink_ev.again (); |
1697 | cursor_blink_reset (); |
1689 | } |
|
|
1690 | #endif |
1698 | #endif |
1691 | |
1699 | |
1692 | #if defined(POINTER_BLANK) |
1700 | #if defined(POINTER_BLANK) |
1693 | if (option (Opt_pointerBlank) && pointerBlankDelay > 0) |
1701 | if (option (Opt_pointerBlank) && pointerBlankDelay > 0) |
1694 | { |
1702 | { |
… | |
… | |
1716 | if (XWMHints *h = XGetWMHints (dpy, parent)) |
1724 | if (XWMHints *h = XGetWMHints (dpy, parent)) |
1717 | { |
1725 | { |
1718 | h->flags = h->flags & ~XUrgencyHint | (enable ? XUrgencyHint : 0); |
1726 | h->flags = h->flags & ~XUrgencyHint | (enable ? XUrgencyHint : 0); |
1719 | XSetWMHints (dpy, parent, h); |
1727 | XSetWMHints (dpy, parent, h); |
1720 | urgency_hint = enable; |
1728 | urgency_hint = enable; |
|
|
1729 | XFree (h); |
1721 | } |
1730 | } |
1722 | } |
1731 | } |
1723 | #endif |
1732 | #endif |
1724 | |
1733 | |
1725 | void |
1734 | void |
… | |
… | |
2161 | case Button3: |
2170 | case Button3: |
2162 | selection_make (ev.time); |
2171 | selection_make (ev.time); |
2163 | break; |
2172 | break; |
2164 | |
2173 | |
2165 | case Button2: |
2174 | case Button2: |
2166 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
2175 | if (IN_RANGE_EXC (ev.x, 0, vt_width) && IN_RANGE_EXC (ev.y, 0, vt_height)) // inside window? |
2167 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Clipboard : Sel_Primary); |
2176 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Clipboard : Sel_Primary); |
2168 | break; |
2177 | break; |
2169 | |
2178 | |
2170 | #ifdef MOUSE_WHEEL |
2179 | #ifdef MOUSE_WHEEL |
2171 | case Button4: |
2180 | case Button4: |
… | |
… | |
2885 | } |
2894 | } |
2886 | break; |
2895 | break; |
2887 | #endif |
2896 | #endif |
2888 | |
2897 | |
2889 | case CSI_CUU: /* 8.3.22: (1) CURSOR UP */ |
2898 | case CSI_CUU: /* 8.3.22: (1) CURSOR UP */ |
2890 | case CSI_VPR: /* 8.3.161: (1) LINE POSITION FORWARD */ |
2899 | case CSI_VPB: /* 8.3.160: (1) LINE POSITION BACKWARD */ |
2891 | arg[0] = -arg[0]; |
2900 | arg[0] = -arg[0]; |
2892 | /* FALLTHROUGH */ |
2901 | /* FALLTHROUGH */ |
2893 | case CSI_CUD: /* 8.3.19: (1) CURSOR DOWN */ |
2902 | case CSI_CUD: /* 8.3.19: (1) CURSOR DOWN */ |
2894 | case CSI_VPB: /* 8.3.160: (1) LINE POSITION BACKWARD */ |
2903 | case CSI_VPR: /* 8.3.161: (1) LINE POSITION FORWARD */ |
2895 | scr_gotorc (arg[0], 0, RELATIVE); |
2904 | scr_gotorc (arg[0], 0, RELATIVE); |
2896 | break; |
2905 | break; |
2897 | |
2906 | |
2898 | case CSI_CUB: /* 8.3.18: (1) CURSOR LEFT */ |
2907 | case CSI_CUB: /* 8.3.18: (1) CURSOR LEFT */ |
2899 | case CSI_HPB: /* 8.3.59: (1) CHARACTER POSITION BACKWARD */ |
2908 | case CSI_HPB: /* 8.3.59: (1) CHARACTER POSITION BACKWARD */ |
… | |
… | |
3132 | break; |
3141 | break; |
3133 | |
3142 | |
3134 | //case 9: NYI, TODO, restore maximized window or maximize window |
3143 | //case 9: NYI, TODO, restore maximized window or maximize window |
3135 | default: |
3144 | default: |
3136 | if (args[0] >= 24) /* set height (chars) */ |
3145 | if (args[0] >= 24) /* set height (chars) */ |
3137 | set_widthheight ((unsigned int)width, |
3146 | set_widthheight ((unsigned int)vt_width, |
3138 | (unsigned int) (args[1] * fheight)); |
3147 | (unsigned int) (args[1] * fheight)); |
3139 | break; |
3148 | break; |
3140 | |
3149 | |
3141 | /* |
3150 | /* |
3142 | * reports - some output format copied from XTerm |
3151 | * reports - some output format copied from XTerm |
… | |
… | |
3444 | if (!strcmp (str, "?")) |
3453 | if (!strcmp (str, "?")) |
3445 | { |
3454 | { |
3446 | char str[256]; |
3455 | char str[256]; |
3447 | |
3456 | |
3448 | sprintf (str, "[%dx%d+%d+%d]", |
3457 | sprintf (str, "[%dx%d+%d+%d]", |
3449 | min (h_scale, 32767), min (v_scale, 32767), |
3458 | min (bg_image.h_scale, 32767), min (bg_image.v_scale, 32767), |
3450 | min (h_align, 32767), min (v_align, 32767)); |
3459 | min (bg_image.h_align, 32767), min (bg_image.v_align, 32767)); |
3451 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
3460 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
3452 | } |
3461 | } |
3453 | else |
3462 | else |
3454 | { |
3463 | { |
3455 | bool changed = false; |
3464 | bool changed = false; |
3456 | |
3465 | |
3457 | if (*str != ';') |
3466 | if (*str != ';') |
3458 | { |
3467 | { |
3459 | if (bg_set_file (str)) /* change pixmap */ |
3468 | if (bg_image.set_file (str)) /* change pixmap */ |
3460 | changed = true; |
3469 | changed = true; |
3461 | } |
3470 | } |
3462 | else |
3471 | else |
3463 | { |
3472 | { |
3464 | str++; |
3473 | str++; |
3465 | if (bg_set_geometry (str, true)) |
3474 | if (bg_image.set_geometry (str, true)) |
3466 | changed = true; |
3475 | changed = true; |
3467 | } |
3476 | } |
3468 | |
3477 | |
3469 | if (changed) |
3478 | if (changed) |
3470 | { |
3479 | { |
… | |
… | |
3577 | { |
3586 | { |
3578 | int state; |
3587 | int state; |
3579 | |
3588 | |
3580 | if (mode == 's') |
3589 | if (mode == 's') |
3581 | { |
3590 | { |
3582 | SavedModes |= (priv_modes & bit); |
3591 | if (priv_modes & bit) |
|
|
3592 | SavedModes |= bit; |
|
|
3593 | else |
|
|
3594 | SavedModes &= ~bit; |
3583 | return -1; |
3595 | return -1; |
3584 | } |
3596 | } |
3585 | else |
3597 | else |
3586 | { |
3598 | { |
3587 | if (mode == 'r') |
3599 | if (mode == 'r') |