… | |
… | |
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); |
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 |
… | |
… | |
1713 | { |
1710 | { |
1714 | hidden_cursor = 0; |
1711 | hidden_cursor = 0; |
1715 | want_refresh = 1; |
1712 | want_refresh = 1; |
1716 | } |
1713 | } |
1717 | |
1714 | |
1718 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1715 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1719 | } |
1716 | } |
1720 | #endif |
1717 | #endif |
1721 | |
1718 | |
1722 | #if defined(POINTER_BLANK) |
1719 | #if defined(POINTER_BLANK) |
1723 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
1720 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
… | |
… | |
1751 | XSetICFocus (Input_Context); |
1748 | XSetICFocus (Input_Context); |
1752 | } |
1749 | } |
1753 | #endif |
1750 | #endif |
1754 | #if CURSOR_BLINK |
1751 | #if CURSOR_BLINK |
1755 | if (OPTION (Opt_cursorBlink)) |
1752 | if (OPTION (Opt_cursorBlink)) |
1756 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
1753 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1757 | #endif |
1754 | #endif |
1758 | #if OFF_FOCUS_FADING |
1755 | #if OFF_FOCUS_FADING |
1759 | if (rs[Rs_fade]) |
1756 | if (rs[Rs_fade]) |
1760 | { |
1757 | { |
1761 | pix_colors = pix_colors_focused; |
1758 | pix_colors = pix_colors_focused; |
… | |
… | |
2155 | { |
2152 | { |
2156 | case Button1: |
2153 | case Button1: |
2157 | case Button3: |
2154 | case Button3: |
2158 | selection_make (ev.time); |
2155 | selection_make (ev.time); |
2159 | break; |
2156 | break; |
|
|
2157 | |
2160 | case Button2: |
2158 | case Button2: |
2161 | selection_request (ev.time, ev.x, ev.y); |
2159 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
|
|
2160 | selection_request (ev.time, ev.state & ShiftMask ? Sel_Clipboard : Sel_Primary); |
2162 | break; |
2161 | break; |
|
|
2162 | |
2163 | #ifdef MOUSE_WHEEL |
2163 | #ifdef MOUSE_WHEEL |
2164 | case Button4: |
2164 | case Button4: |
2165 | case Button5: |
2165 | case Button5: |
2166 | { |
2166 | { |
2167 | int i; |
2167 | int i; |
… | |
… | |
2822 | return flag; |
2822 | return flag; |
2823 | } |
2823 | } |
2824 | |
2824 | |
2825 | // read the next character |
2825 | // read the next character |
2826 | wchar_t |
2826 | wchar_t |
2827 | rxvt_term::next_char () |
2827 | rxvt_term::next_char () NOTHROW |
2828 | { |
2828 | { |
2829 | while (cmdbuf_ptr < cmdbuf_endp) |
2829 | while (cmdbuf_ptr < cmdbuf_endp) |
2830 | { |
2830 | { |
2831 | // assume 7-bit to be ascii ALWAYS |
2831 | // assume 7-bit to be ascii ALWAYS |
2832 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
2832 | if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) |
… | |
… | |
2853 | return NOCHAR; |
2853 | return NOCHAR; |
2854 | } |
2854 | } |
2855 | |
2855 | |
2856 | // read the next octet |
2856 | // read the next octet |
2857 | uint32_t |
2857 | uint32_t |
2858 | rxvt_term::next_octet () |
2858 | rxvt_term::next_octet () NOTHROW |
2859 | { |
2859 | { |
2860 | return cmdbuf_ptr < cmdbuf_endp |
2860 | return cmdbuf_ptr < cmdbuf_endp |
2861 | ? (unsigned char)*cmdbuf_ptr++ |
2861 | ? (unsigned char)*cmdbuf_ptr++ |
2862 | : NOCHAR; |
2862 | : NOCHAR; |
2863 | } |
2863 | } |
|
|
2864 | |
|
|
2865 | static class out_of_input out_of_input; |
2864 | |
2866 | |
2865 | /* rxvt_cmd_getc () - Return next input character */ |
2867 | /* rxvt_cmd_getc () - Return next input character */ |
2866 | /* |
2868 | /* |
2867 | * Return the next input character after first passing any keyboard input |
2869 | * Return the next input character after first passing any keyboard input |
2868 | * to the command. |
2870 | * to the command. |
2869 | */ |
2871 | */ |
2870 | wchar_t |
2872 | wchar_t |
2871 | rxvt_term::cmd_getc () |
2873 | rxvt_term::cmd_getc () THROW ((class out_of_input)) |
2872 | { |
2874 | { |
2873 | wchar_t c = next_char (); |
2875 | wchar_t c = next_char (); |
2874 | |
2876 | |
2875 | if (c == NOCHAR) |
2877 | if (c == NOCHAR) |
2876 | throw out_of_input; |
2878 | throw out_of_input; |
2877 | |
2879 | |
2878 | return c; |
2880 | return c; |
2879 | } |
2881 | } |
2880 | |
2882 | |
2881 | uint32_t |
2883 | uint32_t |
2882 | rxvt_term::cmd_get8 () |
2884 | rxvt_term::cmd_get8 () THROW ((class out_of_input)) |
2883 | { |
2885 | { |
2884 | uint32_t c = next_octet (); |
2886 | uint32_t c = next_octet (); |
2885 | |
2887 | |
2886 | if (c == NOCHAR) |
2888 | if (c == NOCHAR) |
2887 | throw out_of_input; |
2889 | throw out_of_input; |
… | |
… | |
3766 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3768 | * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) |
3767 | */ |
3769 | */ |
3768 | void |
3770 | void |
3769 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3771 | rxvt_term::process_xterm_seq (int op, const char *str, char resp) |
3770 | { |
3772 | { |
3771 | int changed = 0; |
|
|
3772 | int color; |
3773 | int color; |
3773 | char *buf, *name; |
3774 | char *buf, *name; |
3774 | bool query = str[0] == '?' && !str[1]; |
3775 | bool query = str[0] == '?' && !str[1]; |
3775 | int saveop = op; |
3776 | int saveop = op; |
3776 | dDisp; |
3777 | dDisp; |
… | |
… | |
3892 | want_full_refresh = want_refresh = 1; |
3893 | want_full_refresh = want_refresh = 1; |
3893 | break; |
3894 | break; |
3894 | #endif |
3895 | #endif |
3895 | |
3896 | |
3896 | case Rxvt_Pixmap: |
3897 | case Rxvt_Pixmap: |
|
|
3898 | { |
3897 | if (*str != ';') |
3899 | if (*str != ';') |
3898 | { |
3900 | { |
3899 | #if XPM_BACKGROUND |
3901 | #if XPM_BACKGROUND |
3900 | scale_pixmap (""); /* reset to default scaling */ |
3902 | scale_pixmap (""); /* reset to default scaling */ |
3901 | set_bgPixmap (str); /* change pixmap */ |
3903 | set_bgPixmap (str); /* change pixmap */ |
3902 | scr_touch (true); |
3904 | scr_touch (true); |
3903 | #endif |
3905 | #endif |
3904 | } |
3906 | } |
3905 | |
3907 | |
|
|
3908 | int changed = 0; |
|
|
3909 | |
3906 | while ((str = strchr (str, ';')) != NULL) |
3910 | while ((str = strchr (str, ';')) != NULL) |
3907 | { |
3911 | { |
3908 | str++; |
3912 | str++; |
3909 | #if XPM_BACKGROUND |
3913 | #if XPM_BACKGROUND |
3910 | changed += scale_pixmap (str); |
3914 | changed += scale_pixmap (str); |
3911 | #endif |
3915 | #endif |
3912 | } |
3916 | } |
3913 | |
3917 | |
3914 | if (changed) |
3918 | if (changed) |
3915 | { |
3919 | { |
3916 | #ifdef XPM_BACKGROUND |
3920 | #ifdef XPM_BACKGROUND |
3917 | resize_pixmap (); |
3921 | resize_pixmap (); |
3918 | scr_touch (true); |
3922 | scr_touch (true); |
3919 | #endif |
3923 | #endif |
3920 | } |
3924 | } |
|
|
3925 | } |
3921 | break; |
3926 | break; |
3922 | |
3927 | |
3923 | case Rxvt_restoreFG: |
3928 | case Rxvt_restoreFG: |
3924 | set_window_color (Color_fg, str); |
3929 | set_window_color (Color_fg, str); |
3925 | break; |
3930 | break; |
… | |
… | |
4034 | return state; |
4039 | return state; |
4035 | } |
4040 | } |
4036 | |
4041 | |
4037 | /* we're not using priv _yet_ */ |
4042 | /* we're not using priv _yet_ */ |
4038 | void |
4043 | void |
4039 | rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) |
4044 | rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg) |
4040 | { |
4045 | { |
4041 | unsigned int i, j; |
4046 | unsigned int i, j; |
4042 | int state; |
4047 | int state; |
4043 | |
4048 | |
4044 | static const struct |
4049 | static const struct |