… | |
… | |
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) |
… | |
… | |
779 | len = strlen (kbuf); |
779 | len = strlen (kbuf); |
780 | |
780 | |
781 | if (len > 0) |
781 | if (len > 0) |
782 | { |
782 | { |
783 | /* |
783 | /* |
784 | * Pass meta for all function keys, if 'meta' option set |
|
|
785 | */ |
|
|
786 | #ifdef META8_OPTION |
|
|
787 | if (meta && (meta_char == 0x80)) |
|
|
788 | kbuf[len - 1] |= 0x80; |
|
|
789 | #endif |
|
|
790 | |
|
|
791 | /* |
|
|
792 | * pass Shift/Control indicators for function keys ending with `~' |
784 | * pass Shift/Control indicators for function keys ending with `~' |
793 | * |
785 | * |
794 | * eg, |
786 | * eg, |
795 | * Prior = "ESC[5~" |
787 | * Prior = "ESC[5~" |
796 | * Shift+Prior = "ESC[5$" |
788 | * Shift+Prior = "ESC[5$" |
797 | * Ctrl+Prior = "ESC[5^" |
789 | * Ctrl+Prior = "ESC[5^" |
798 | * Ctrl+Shift+Prior = "ESC[5@" |
790 | * Ctrl+Shift+Prior = "ESC[5@" |
799 | */ |
791 | */ |
800 | if (kbuf[0] == C0_ESC && kbuf[1] == '[' && kbuf[len - 1] == '~') |
792 | if (kbuf[0] == C0_ESC && kbuf[1] == '[' && kbuf[len - 1] == '~') |
801 | kbuf[len - 1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~')); |
793 | kbuf[len - 1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~')); |
|
|
794 | |
|
|
795 | /* |
|
|
796 | * Pass meta for all function keys, if 'meta' option set |
|
|
797 | */ |
|
|
798 | #ifdef META8_OPTION |
|
|
799 | if (meta && (meta_char == 0x80)) |
|
|
800 | kbuf[len - 1] |= 0x80; |
|
|
801 | #endif |
802 | } |
802 | } |
803 | |
803 | |
804 | } |
804 | } |
805 | else if (ctrl && keysym == XK_minus) |
805 | else if (ctrl && keysym == XK_minus) |
806 | { |
806 | { |
… | |
… | |
1015 | refresh_count = 0; |
1015 | refresh_count = 0; |
1016 | flush (); |
1016 | flush (); |
1017 | } |
1017 | } |
1018 | |
1018 | |
1019 | #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 | |
1020 | void |
1035 | void |
1021 | rxvt_term::cursor_blink_cb (ev::timer &w, int revents) |
1036 | rxvt_term::cursor_blink_cb (ev::timer &w, int revents) |
1022 | { |
1037 | { |
1023 | hidden_cursor = !hidden_cursor; |
1038 | hidden_cursor = !hidden_cursor; |
1024 | want_refresh = 1; |
1039 | want_refresh = 1; |
… | |
… | |
1634 | dist = int_bwidth - ev.xbutton.y; |
1649 | dist = int_bwidth - ev.xbutton.y; |
1635 | } |
1650 | } |
1636 | else |
1651 | else |
1637 | { |
1652 | { |
1638 | scroll_selection_dir = DN; |
1653 | scroll_selection_dir = DN; |
1639 | dist = ev.xbutton.y - (int_bwidth + height); |
1654 | dist = ev.xbutton.y - (int_bwidth + vt_height); |
1640 | } |
1655 | } |
1641 | |
1656 | |
1642 | scroll_selection_lines = Pixel2Height (dist) |
1657 | scroll_selection_lines = Pixel2Height (dist) |
1643 | / SELECTION_SCROLL_LINE_SPEEDUP |
1658 | / SELECTION_SCROLL_LINE_SPEEDUP |
1644 | + 1; |
1659 | + 1; |
… | |
… | |
1676 | } |
1691 | } |
1677 | break; |
1692 | break; |
1678 | } |
1693 | } |
1679 | |
1694 | |
1680 | #if defined(CURSOR_BLINK) |
1695 | #if defined(CURSOR_BLINK) |
1681 | if (option (Opt_cursorBlink) && ev.type == KeyPress) |
1696 | if (ev.type == KeyPress) |
1682 | { |
|
|
1683 | if (hidden_cursor) |
|
|
1684 | { |
|
|
1685 | hidden_cursor = 0; |
|
|
1686 | want_refresh = 1; |
|
|
1687 | } |
|
|
1688 | |
|
|
1689 | cursor_blink_ev.again (); |
1697 | cursor_blink_reset (); |
1690 | } |
|
|
1691 | #endif |
1698 | #endif |
1692 | |
1699 | |
1693 | #if defined(POINTER_BLANK) |
1700 | #if defined(POINTER_BLANK) |
1694 | if (option (Opt_pointerBlank) && pointerBlankDelay > 0) |
1701 | if (option (Opt_pointerBlank) && pointerBlankDelay > 0) |
1695 | { |
1702 | { |
… | |
… | |
2163 | case Button3: |
2170 | case Button3: |
2164 | selection_make (ev.time); |
2171 | selection_make (ev.time); |
2165 | break; |
2172 | break; |
2166 | |
2173 | |
2167 | case Button2: |
2174 | case Button2: |
2168 | 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? |
2169 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Clipboard : Sel_Primary); |
2176 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Clipboard : Sel_Primary); |
2170 | break; |
2177 | break; |
2171 | |
2178 | |
2172 | #ifdef MOUSE_WHEEL |
2179 | #ifdef MOUSE_WHEEL |
2173 | case Button4: |
2180 | case Button4: |
… | |
… | |
3134 | break; |
3141 | break; |
3135 | |
3142 | |
3136 | //case 9: NYI, TODO, restore maximized window or maximize window |
3143 | //case 9: NYI, TODO, restore maximized window or maximize window |
3137 | default: |
3144 | default: |
3138 | if (args[0] >= 24) /* set height (chars) */ |
3145 | if (args[0] >= 24) /* set height (chars) */ |
3139 | set_widthheight ((unsigned int)width, |
3146 | set_widthheight ((unsigned int)vt_width, |
3140 | (unsigned int) (args[1] * fheight)); |
3147 | (unsigned int) (args[1] * fheight)); |
3141 | break; |
3148 | break; |
3142 | |
3149 | |
3143 | /* |
3150 | /* |
3144 | * reports - some output format copied from XTerm |
3151 | * reports - some output format copied from XTerm |
… | |
… | |
3444 | #if BG_IMAGE_FROM_FILE |
3451 | #if BG_IMAGE_FROM_FILE |
3445 | case Rxvt_Pixmap: |
3452 | case Rxvt_Pixmap: |
3446 | if (!strcmp (str, "?")) |
3453 | if (!strcmp (str, "?")) |
3447 | { |
3454 | { |
3448 | char str[256]; |
3455 | char str[256]; |
|
|
3456 | int h_scale = 0, v_scale = 0; |
|
|
3457 | int h_align = 0, v_align = 0; |
|
|
3458 | if (image_vec.size () > 0) |
|
|
3459 | { |
|
|
3460 | h_scale = image_vec[0].h_scale; |
|
|
3461 | v_scale = image_vec[0].v_scale; |
|
|
3462 | h_align = image_vec[0].h_align; |
|
|
3463 | v_align = image_vec[0].v_align; |
|
|
3464 | } |
3449 | |
3465 | |
3450 | sprintf (str, "[%dx%d+%d+%d]", |
3466 | sprintf (str, "[%dx%d+%d+%d]", |
3451 | min (h_scale, 32767), min (v_scale, 32767), |
3467 | h_scale, v_scale, |
3452 | min (h_align, 32767), min (v_align, 32767)); |
3468 | h_align, v_align); |
3453 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
3469 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
3454 | } |
3470 | } |
3455 | else |
3471 | else |
3456 | { |
3472 | { |
3457 | bool changed = false; |
3473 | bool changed = false; |
3458 | |
3474 | |
3459 | if (*str != ';') |
3475 | if (*str != ';') |
3460 | { |
3476 | { |
3461 | if (bg_set_file (str)) /* change pixmap */ |
3477 | if (image_vec.size () > 0) |
|
|
3478 | changed = image_vec[0].set_file_geometry (str); |
|
|
3479 | else |
|
|
3480 | { |
|
|
3481 | rxvt_image *image = new_image (); |
|
|
3482 | if (!image->set_file_geometry (str)) |
|
|
3483 | image_vec.pop_back (); |
|
|
3484 | else |
3462 | changed = true; |
3485 | changed = true; |
|
|
3486 | } |
3463 | } |
3487 | } |
3464 | else |
3488 | else |
3465 | { |
3489 | { |
3466 | str++; |
3490 | str++; |
|
|
3491 | if (image_vec.size () > 0) |
3467 | if (bg_set_geometry (str, true)) |
3492 | changed = image_vec[0].set_geometry (str, true); |
3468 | changed = true; |
|
|
3469 | } |
3493 | } |
3470 | |
3494 | |
3471 | if (changed) |
3495 | if (changed) |
3472 | { |
3496 | { |
3473 | if (bg_window_position_sensitive ()) |
3497 | if (bg_window_position_sensitive ()) |
… | |
… | |
3579 | { |
3603 | { |
3580 | int state; |
3604 | int state; |
3581 | |
3605 | |
3582 | if (mode == 's') |
3606 | if (mode == 's') |
3583 | { |
3607 | { |
3584 | SavedModes |= (priv_modes & bit); |
3608 | if (priv_modes & bit) |
|
|
3609 | SavedModes |= bit; |
|
|
3610 | else |
|
|
3611 | SavedModes &= ~bit; |
3585 | return -1; |
3612 | return -1; |
3586 | } |
3613 | } |
3587 | else |
3614 | else |
3588 | { |
3615 | { |
3589 | if (mode == 'r') |
3616 | if (mode == 'r') |