… | |
… | |
64 | |
64 | |
65 | /*----------------------------------------------------------------------*/ |
65 | /*----------------------------------------------------------------------*/ |
66 | |
66 | |
67 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
67 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
68 | |
68 | |
69 | // exception thrown when the command parser runs out of input data |
|
|
70 | class out_of_input { } out_of_input; |
|
|
71 | |
|
|
72 | #if ENABLE_FRILLS || ISO_14755 |
69 | #if ENABLE_FRILLS || ISO_14755 |
73 | |
70 | |
74 | #define ISO_14755_STARTED 0x80000000UL |
71 | #define ISO_14755_STARTED 0x80000000UL |
75 | #define ISO_14755_51 0x40000000UL // basic (section 5.1) |
72 | #define ISO_14755_51 0x40000000UL // basic (section 5.1) |
76 | #define ISO_14755_52 0x20000000UL // keycap (section 5.2) |
73 | #define ISO_14755_52 0x20000000UL // keycap (section 5.2) |
… | |
… | |
464 | { |
461 | { |
465 | switch (keysym) |
462 | switch (keysym) |
466 | { |
463 | { |
467 | /* normal XTerm key bindings */ |
464 | /* normal XTerm key bindings */ |
468 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
465 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
469 | selection_request (ev.time, 0, 0); |
466 | selection_request (ev.time, Sel_Primary); |
470 | return; |
467 | return; |
471 | #if TODO |
468 | #if TODO |
472 | /* rxvt extras */ |
469 | /* rxvt extras */ |
473 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
470 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
474 | change_font (FONT_UP); |
471 | change_font (FONT_UP); |
… | |
… | |
1044 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1041 | rxvt_term::cursor_blink_cb (time_watcher &w) |
1045 | { |
1042 | { |
1046 | hidden_cursor = !hidden_cursor; |
1043 | hidden_cursor = !hidden_cursor; |
1047 | want_refresh = 1; |
1044 | want_refresh = 1; |
1048 | |
1045 | |
1049 | w.start (w.at + BLINK_INTERVAL); |
1046 | w.start (w.at + CURSOR_BLINK_INTERVAL); |
1050 | } |
1047 | } |
1051 | #endif |
1048 | #endif |
1052 | |
1049 | |
1053 | #ifdef TEXT_BLINK |
1050 | #ifdef TEXT_BLINK |
1054 | void |
1051 | void |
… | |
… | |
1502 | { |
1499 | { |
1503 | seen_resize = 1; |
1500 | seen_resize = 1; |
1504 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1501 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1505 | } |
1502 | } |
1506 | |
1503 | |
|
|
1504 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
|
|
1505 | |
1507 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1506 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1508 | if (OPTION (Opt_transparent)) |
1507 | if (OPTION (Opt_transparent)) |
1509 | check_our_parents (); |
1508 | check_our_parents (); |
1510 | #endif |
1509 | #endif |
1511 | } |
1510 | } |
… | |
… | |
1711 | { |
1710 | { |
1712 | hidden_cursor = 0; |
1711 | hidden_cursor = 0; |
1713 | want_refresh = 1; |
1712 | want_refresh = 1; |
1714 | } |
1713 | } |
1715 | |
1714 | |
1716 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1715 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1717 | } |
1716 | } |
1718 | #endif |
1717 | #endif |
1719 | |
1718 | |
1720 | #if defined(POINTER_BLANK) |
1719 | #if defined(POINTER_BLANK) |
1721 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
1720 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
… | |
… | |
1749 | XSetICFocus (Input_Context); |
1748 | XSetICFocus (Input_Context); |
1750 | } |
1749 | } |
1751 | #endif |
1750 | #endif |
1752 | #if CURSOR_BLINK |
1751 | #if CURSOR_BLINK |
1753 | if (OPTION (Opt_cursorBlink)) |
1752 | if (OPTION (Opt_cursorBlink)) |
1754 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1753 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1755 | #endif |
1754 | #endif |
1756 | #if OFF_FOCUS_FADING |
1755 | #if OFF_FOCUS_FADING |
1757 | if (rs[Rs_fade]) |
1756 | if (rs[Rs_fade]) |
1758 | { |
1757 | { |
1759 | pix_colors = pix_colors_focused; |
1758 | pix_colors = pix_colors_focused; |
… | |
… | |
2153 | { |
2152 | { |
2154 | case Button1: |
2153 | case Button1: |
2155 | case Button3: |
2154 | case Button3: |
2156 | selection_make (ev.time); |
2155 | selection_make (ev.time); |
2157 | break; |
2156 | break; |
|
|
2157 | |
2158 | case Button2: |
2158 | case Button2: |
2159 | selection_request (ev.time, ev.x, ev.y); |
2159 | if (IN_RANGE_EXC (ev.x, 0, width) |
|
|
2160 | && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
|
|
2161 | { |
|
|
2162 | if (ev.state & ShiftMask) |
|
|
2163 | selection_request (ev.time, Sel_Clipboard); |
|
|
2164 | else |
|
|
2165 | selection_request (ev.time, Sel_Primary); |
|
|
2166 | } |
2160 | break; |
2167 | break; |
|
|
2168 | |
2161 | #ifdef MOUSE_WHEEL |
2169 | #ifdef MOUSE_WHEEL |
2162 | case Button4: |
2170 | case Button4: |
2163 | case Button5: |
2171 | case Button5: |
2164 | { |
2172 | { |
2165 | int i; |
2173 | int i; |
… | |
… | |
2820 | return flag; |
2828 | return flag; |
2821 | } |
2829 | } |
2822 | |
2830 | |
2823 | // read the next character |
2831 | // read the next character |
2824 | wchar_t |
2832 | wchar_t |
2825 | rxvt_term::next_char () |
2833 | rxvt_term::next_char () NOTHROW |
2826 | { |
2834 | { |
2827 | while (cmdbuf_ptr < cmdbuf_endp) |
2835 | while (cmdbuf_ptr < cmdbuf_endp) |
2828 | { |
2836 | { |
2829 | // assume 7-bit to be ascii ALWAYS |
2837 | // assume 7-bit to be ascii ALWAYS |
2830 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2838 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
… | |
… | |
2851 | return NOCHAR; |
2859 | return NOCHAR; |
2852 | } |
2860 | } |
2853 | |
2861 | |
2854 | // read the next octet |
2862 | // read the next octet |
2855 | uint32_t |
2863 | uint32_t |
2856 | rxvt_term::next_octet () |
2864 | rxvt_term::next_octet () NOTHROW |
2857 | { |
2865 | { |
2858 | return cmdbuf_ptr < cmdbuf_endp |
2866 | return cmdbuf_ptr < cmdbuf_endp |
2859 | ? (unsigned char)*cmdbuf_ptr++ |
2867 | ? (unsigned char)*cmdbuf_ptr++ |
2860 | : NOCHAR; |
2868 | : NOCHAR; |
2861 | } |
2869 | } |
|
|
2870 | |
|
|
2871 | static class out_of_input out_of_input; |
2862 | |
2872 | |
2863 | /* rxvt_cmd_getc () - Return next input character */ |
2873 | /* rxvt_cmd_getc () - Return next input character */ |
2864 | /* |
2874 | /* |
2865 | * Return the next input character after first passing any keyboard input |
2875 | * Return the next input character after first passing any keyboard input |
2866 | * to the command. |
2876 | * to the command. |
2867 | */ |
2877 | */ |
2868 | wchar_t |
2878 | wchar_t |
2869 | rxvt_term::cmd_getc () |
2879 | rxvt_term::cmd_getc () THROW ((class out_of_input)) |
2870 | { |
2880 | { |
2871 | wchar_t c = next_char (); |
2881 | wchar_t c = next_char (); |
2872 | |
2882 | |
2873 | if (c == NOCHAR) |
2883 | if (c == NOCHAR) |
2874 | throw out_of_input; |
2884 | throw out_of_input; |
2875 | |
2885 | |
2876 | return c; |
2886 | return c; |
2877 | } |
2887 | } |
2878 | |
2888 | |
2879 | uint32_t |
2889 | uint32_t |
2880 | rxvt_term::cmd_get8 () |
2890 | rxvt_term::cmd_get8 () THROW ((class out_of_input)) |
2881 | { |
2891 | { |
2882 | uint32_t c = next_octet (); |
2892 | uint32_t c = next_octet (); |
2883 | |
2893 | |
2884 | if (c == NOCHAR) |
2894 | if (c == NOCHAR) |
2885 | throw out_of_input; |
2895 | throw out_of_input; |
… | |
… | |
3764 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3774 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3765 | */ |
3775 | */ |
3766 | void |
3776 | void |
3767 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3777 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3768 | { |
3778 | { |
3769 | int changed = 0; |
|
|
3770 | int color; |
3779 | int color; |
3771 | char *buf, *name; |
3780 | char *buf, *name; |
3772 | bool query = str[0] == '?' && !str[1]; |
3781 | bool query = str[0] == '?' && !str[1]; |
3773 | int saveop = op; |
3782 | int saveop = op; |
3774 | dDisp; |
3783 | dDisp; |
… | |
… | |
3890 | want_full_refresh = want_refresh = 1; |
3899 | want_full_refresh = want_refresh = 1; |
3891 | break; |
3900 | break; |
3892 | #endif |
3901 | #endif |
3893 | |
3902 | |
3894 | case Rxvt_Pixmap: |
3903 | case Rxvt_Pixmap: |
|
|
3904 | { |
3895 | if (*str != ';') |
3905 | if (*str != ';') |
3896 | { |
3906 | { |
3897 | #if XPM_BACKGROUND |
3907 | #if XPM_BACKGROUND |
3898 | scale_pixmap (""); /* reset to default scaling */ |
3908 | scale_pixmap (""); /* reset to default scaling */ |
3899 | set_bgPixmap (str); /* change pixmap */ |
3909 | set_bgPixmap (str); /* change pixmap */ |
3900 | scr_touch (true); |
3910 | scr_touch (true); |
3901 | #endif |
3911 | #endif |
3902 | } |
3912 | } |
3903 | |
3913 | |
|
|
3914 | int changed = 0; |
|
|
3915 | |
3904 | while ((str = strchr (str, ';')) != NULL) |
3916 | while ((str = strchr (str, ';')) != NULL) |
3905 | { |
3917 | { |
3906 | str++; |
3918 | str++; |
3907 | #if XPM_BACKGROUND |
3919 | #if XPM_BACKGROUND |
3908 | changed += scale_pixmap (str); |
3920 | changed += scale_pixmap (str); |
3909 | #endif |
3921 | #endif |
3910 | } |
3922 | } |
3911 | |
3923 | |
3912 | if (changed) |
3924 | if (changed) |
3913 | { |
3925 | { |
3914 | #ifdef XPM_BACKGROUND |
3926 | #ifdef XPM_BACKGROUND |
3915 | resize_pixmap (); |
3927 | resize_pixmap (); |
3916 | scr_touch (true); |
3928 | scr_touch (true); |
3917 | #endif |
3929 | #endif |
3918 | } |
3930 | } |
|
|
3931 | } |
3919 | break; |
3932 | break; |
3920 | |
3933 | |
3921 | case Rxvt_restoreFG: |
3934 | case Rxvt_restoreFG: |
3922 | set_window_color (Color_fg, str); |
3935 | set_window_color (Color_fg, str); |
3923 | break; |
3936 | break; |
… | |
… | |
4032 | return state; |
4045 | return state; |
4033 | } |
4046 | } |
4034 | |
4047 | |
4035 | /* we're not using priv _yet_ */ |
4048 | /* we're not using priv _yet_ */ |
4036 | void |
4049 | void |
4037 | rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) |
4050 | rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg) |
4038 | { |
4051 | { |
4039 | unsigned int i, j; |
4052 | unsigned int i, j; |
4040 | int state; |
4053 | int state; |
4041 | |
4054 | |
4042 | static const struct |
4055 | static const struct |