… | |
… | |
867 | #endif |
867 | #endif |
868 | /* nil */ ; |
868 | /* nil */ ; |
869 | } |
869 | } |
870 | } |
870 | } |
871 | |
871 | |
872 | if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_STRING_LEN, kbuf, len, DT_END))) |
872 | if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_STR_LEN, kbuf, len, DT_END))) |
873 | return; |
873 | return; |
874 | |
874 | |
875 | if (len <= 0) |
875 | if (len <= 0) |
876 | return; /* not mapped */ |
876 | return; /* not mapped */ |
877 | |
877 | |
… | |
… | |
1415 | else |
1415 | else |
1416 | iso14755buf = 0; |
1416 | iso14755buf = 0; |
1417 | } |
1417 | } |
1418 | #endif |
1418 | #endif |
1419 | |
1419 | |
|
|
1420 | if (ev.xany.window == vt |
1420 | if (ev.xany.window == vt && HOOK_INVOKE ((this, HOOK_KEY_RELEASE, DT_XEVENT, &ev, DT_END))) |
1421 | && HOOK_INVOKE ((this, HOOK_KEY_RELEASE, DT_XEVENT, &ev, DT_END))) |
1421 | break; |
1422 | break; |
1422 | |
1423 | |
1423 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1424 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1424 | if (!(ev.xkey.state & ControlMask)) |
1425 | if (!(ev.xkey.state & ControlMask)) |
1425 | slip_wheel_ev.stop (); |
1426 | slip_wheel_ev.stop (); |
… | |
… | |
1561 | |
1562 | |
1562 | case SelectionRequest: |
1563 | case SelectionRequest: |
1563 | selection_send (ev.xselectionrequest); |
1564 | selection_send (ev.xselectionrequest); |
1564 | break; |
1565 | break; |
1565 | |
1566 | |
|
|
1567 | case MapNotify: |
|
|
1568 | mapped = 1; |
|
|
1569 | #ifdef TEXT_BLINK |
|
|
1570 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
|
|
1571 | #endif |
|
|
1572 | HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
|
|
1573 | break; |
|
|
1574 | |
1566 | case UnmapNotify: |
1575 | case UnmapNotify: |
1567 | mapped = 0; |
1576 | mapped = 0; |
1568 | #ifdef TEXT_BLINK |
1577 | #ifdef TEXT_BLINK |
1569 | text_blink_ev.stop (); |
1578 | text_blink_ev.stop (); |
1570 | #endif |
1579 | #endif |
1571 | break; |
1580 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1572 | |
|
|
1573 | case MapNotify: |
|
|
1574 | mapped = 1; |
|
|
1575 | #ifdef TEXT_BLINK |
|
|
1576 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
|
|
1577 | #endif |
|
|
1578 | break; |
1581 | break; |
1579 | |
1582 | |
1580 | #ifdef TRANSPARENT |
1583 | #ifdef TRANSPARENT |
1581 | case ReparentNotify: |
1584 | case ReparentNotify: |
1582 | rootwin_cb (ev); |
1585 | rootwin_cb (ev); |
… | |
… | |
1873 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1876 | #ifdef MOUSE_REPORT_DOUBLECLICK |
1874 | if (ev.button == MEvent.button && clickintime) |
1877 | if (ev.button == MEvent.button && clickintime) |
1875 | { |
1878 | { |
1876 | /* same button, within alloted time */ |
1879 | /* same button, within alloted time */ |
1877 | MEvent.clicks++; |
1880 | MEvent.clicks++; |
|
|
1881 | |
1878 | if (MEvent.clicks > 1) |
1882 | if (MEvent.clicks > 1) |
1879 | { |
1883 | { |
1880 | /* only report double clicks */ |
1884 | /* only report double clicks */ |
1881 | MEvent.clicks = 2; |
1885 | MEvent.clicks = 2; |
1882 | mouse_report (ev); |
1886 | mouse_report (ev); |
… | |
… | |
2090 | } |
2094 | } |
2091 | |
2095 | |
2092 | break; |
2096 | break; |
2093 | } |
2097 | } |
2094 | } |
2098 | } |
|
|
2099 | |
2095 | return; |
2100 | return; |
2096 | } |
2101 | } |
|
|
2102 | |
2097 | #if MENUBAR |
2103 | #if MENUBAR |
2098 | /* |
2104 | /* |
2099 | * Menubar window processing of button press |
2105 | * Menubar window processing of button press |
2100 | */ |
2106 | */ |
2101 | if (isMenuBarWindow (ev.window)) |
2107 | if (isMenuBarWindow (ev.window)) |
… | |
… | |
2164 | if (priv_modes & PrivMode_mouse_report |
2170 | if (priv_modes & PrivMode_mouse_report |
2165 | && bypass_keystate |
2171 | && bypass_keystate |
2166 | && ev.button == Button1 && MEvent.clicks <= 1) |
2172 | && ev.button == Button1 && MEvent.clicks <= 1) |
2167 | selection_extend (ev.x, ev.y, 0); |
2173 | selection_extend (ev.x, ev.y, 0); |
2168 | |
2174 | |
2169 | if (!HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
2175 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
2170 | return; |
2176 | return; |
2171 | |
2177 | |
2172 | switch (ev.button) |
2178 | switch (ev.button) |
2173 | { |
2179 | { |
2174 | case Button1: |
2180 | case Button1: |
… | |
… | |
2720 | |
2726 | |
2721 | bool |
2727 | bool |
2722 | rxvt_term::cmd_parse () |
2728 | rxvt_term::cmd_parse () |
2723 | { |
2729 | { |
2724 | bool flag = false; |
2730 | bool flag = false; |
2725 | unicode_t ch = NOCHAR; |
2731 | wchar_t ch = NOCHAR; |
2726 | char *seq_begin; // remember start of esc-sequence here |
2732 | char *seq_begin; // remember start of esc-sequence here |
2727 | |
2733 | |
2728 | for (;;) |
2734 | for (;;) |
2729 | { |
2735 | { |
2730 | if (ch == NOCHAR) |
2736 | if (ch == NOCHAR) |
… | |
… | |
2751 | if (seen_resize && cmd_pid) |
2757 | if (seen_resize && cmd_pid) |
2752 | kill (-cmd_pid, SIGWINCH); |
2758 | kill (-cmd_pid, SIGWINCH); |
2753 | } |
2759 | } |
2754 | |
2760 | |
2755 | /* Read a text string from the input buffer */ |
2761 | /* Read a text string from the input buffer */ |
2756 | unicode_t buf[UBUFSIZ]; |
2762 | wchar_t buf[UBUFSIZ]; |
2757 | bool refreshnow = false; |
2763 | bool refreshnow = false; |
2758 | int nlines = 0; |
2764 | int nlines = 0; |
2759 | unicode_t *str = buf; |
2765 | wchar_t *str = buf; |
2760 | unicode_t *eol = str + min (ncol, UBUFSIZ); |
2766 | wchar_t *eol = str + min (ncol, UBUFSIZ); |
2761 | |
2767 | |
2762 | for (;;) |
2768 | for (;;) |
2763 | { |
2769 | { |
2764 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2770 | if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) |
2765 | break; |
2771 | break; |
… | |
… | |
2783 | } |
2789 | } |
2784 | |
2790 | |
2785 | // scr_add_lines only works for nlines <= nrow - 1. |
2791 | // scr_add_lines only works for nlines <= nrow - 1. |
2786 | if (nlines >= nrow - 1) |
2792 | if (nlines >= nrow - 1) |
2787 | { |
2793 | { |
2788 | if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_USTRING_LEN, buf, str - buf, DT_END))) |
2794 | if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END))) |
2789 | scr_add_lines (buf, nlines, str - buf); |
2795 | scr_add_lines (buf, str - buf, nlines); |
2790 | |
2796 | |
2791 | nlines = 0; |
2797 | nlines = 0; |
2792 | str = buf; |
2798 | str = buf; |
2793 | eol = str + min (ncol, UBUFSIZ); |
2799 | eol = str + min (ncol, UBUFSIZ); |
2794 | } |
2800 | } |
… | |
… | |
2808 | |
2814 | |
2809 | seq_begin = cmdbuf_ptr; |
2815 | seq_begin = cmdbuf_ptr; |
2810 | ch = next_char (); |
2816 | ch = next_char (); |
2811 | } |
2817 | } |
2812 | |
2818 | |
2813 | if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_USTRING_LEN, buf, str - buf, DT_END))) |
2819 | if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END))) |
2814 | scr_add_lines (buf, nlines, str - buf); |
2820 | scr_add_lines (buf, str - buf, nlines); |
2815 | |
2821 | |
2816 | /* |
2822 | /* |
2817 | * If there have been a lot of new lines, then update the screen |
2823 | * If there have been a lot of new lines, then update the screen |
2818 | * What the heck I'll cheat and only refresh less than every page-full. |
2824 | * What the heck I'll cheat and only refresh less than every page-full. |
2819 | * the number of pages between refreshes is refresh_limit, which |
2825 | * the number of pages between refreshes is refresh_limit, which |
… | |
… | |
2850 | } |
2856 | } |
2851 | |
2857 | |
2852 | return flag; |
2858 | return flag; |
2853 | } |
2859 | } |
2854 | |
2860 | |
2855 | // read the next octet |
|
|
2856 | unicode_t |
|
|
2857 | rxvt_term::next_octet () |
|
|
2858 | { |
|
|
2859 | return cmdbuf_ptr < cmdbuf_endp |
|
|
2860 | ? *cmdbuf_ptr++ |
|
|
2861 | : NOCHAR; |
|
|
2862 | } |
|
|
2863 | |
|
|
2864 | // read the next character |
2861 | // read the next character |
2865 | unicode_t |
2862 | wchar_t |
2866 | rxvt_term::next_char () |
2863 | rxvt_term::next_char () |
2867 | { |
2864 | { |
2868 | while (cmdbuf_ptr < cmdbuf_endp) |
2865 | while (cmdbuf_ptr < cmdbuf_endp) |
2869 | { |
2866 | { |
2870 | // assume 7-bit to be ascii ALWAYS |
2867 | // assume 7-bit to be ascii ALWAYS |
… | |
… | |
2880 | cmdbuf_ptr = cmdbuf_endp; |
2877 | cmdbuf_ptr = cmdbuf_endp; |
2881 | break; |
2878 | break; |
2882 | } |
2879 | } |
2883 | |
2880 | |
2884 | if (len == (size_t)-1) |
2881 | if (len == (size_t)-1) |
2885 | return *cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2882 | return (unsigned char)*cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2886 | |
2883 | |
2887 | // assume wchar == unicode |
2884 | // assume wchar == unicode |
2888 | cmdbuf_ptr += len; |
2885 | cmdbuf_ptr += len; |
2889 | return wc & UNICODE_MASK; |
2886 | return wc & UNICODE_MASK; |
2890 | } |
2887 | } |
2891 | |
2888 | |
2892 | return NOCHAR; |
2889 | return NOCHAR; |
|
|
2890 | } |
|
|
2891 | |
|
|
2892 | // read the next octet |
|
|
2893 | uint32_t |
|
|
2894 | rxvt_term::next_octet () |
|
|
2895 | { |
|
|
2896 | return cmdbuf_ptr < cmdbuf_endp |
|
|
2897 | ? (unsigned char)*cmdbuf_ptr++ |
|
|
2898 | : NOCHAR; |
2893 | } |
2899 | } |
2894 | |
2900 | |
2895 | /* rxvt_cmd_getc () - Return next input character */ |
2901 | /* rxvt_cmd_getc () - Return next input character */ |
2896 | /* |
2902 | /* |
2897 | * Return the next input character after first passing any keyboard input |
2903 | * Return the next input character after first passing any keyboard input |
2898 | * to the command. |
2904 | * to the command. |
2899 | */ |
2905 | */ |
2900 | unicode_t |
2906 | wchar_t |
2901 | rxvt_term::cmd_getc () |
2907 | rxvt_term::cmd_getc () |
2902 | { |
2908 | { |
2903 | unicode_t c = next_char (); |
2909 | wchar_t c = next_char (); |
2904 | |
2910 | |
2905 | if (c == NOCHAR) |
2911 | if (c == NOCHAR) |
2906 | throw out_of_input; |
2912 | throw out_of_input; |
2907 | |
2913 | |
2908 | return c; |
2914 | return c; |
2909 | } |
2915 | } |
2910 | |
2916 | |
2911 | unicode_t |
2917 | uint32_t |
2912 | rxvt_term::cmd_get8 () |
2918 | rxvt_term::cmd_get8 () |
2913 | { |
2919 | { |
2914 | unicode_t c = next_octet (); |
2920 | uint32_t c = next_octet (); |
2915 | |
2921 | |
2916 | if (c == NOCHAR) |
2922 | if (c == NOCHAR) |
2917 | throw out_of_input; |
2923 | throw out_of_input; |
2918 | |
2924 | |
2919 | return c; |
2925 | return c; |
… | |
… | |
3186 | break; |
3192 | break; |
3187 | |
3193 | |
3188 | /* 8.3.87: NEXT LINE */ |
3194 | /* 8.3.87: NEXT LINE */ |
3189 | case C1_NEL: /* ESC E */ |
3195 | case C1_NEL: /* ESC E */ |
3190 | { |
3196 | { |
3191 | unicode_t nlcr[] = { C0_LF, C0_CR }; |
3197 | wchar_t nlcr[] = { C0_LF, C0_CR }; |
3192 | scr_add_lines (nlcr, 1, 2); |
3198 | scr_add_lines (nlcr, sizeof (nlcr) / sizeof (nlcr [0]), 1); |
3193 | } |
3199 | } |
3194 | break; |
3200 | break; |
3195 | |
3201 | |
3196 | /* kidnapped escape sequence: Should be 8.3.48 */ |
3202 | /* kidnapped escape sequence: Should be 8.3.48 */ |
3197 | case C1_ESA: /* ESC G */ |
3203 | case C1_ESA: /* ESC G */ |
… | |
… | |
4025 | break; |
4031 | break; |
4026 | #endif |
4032 | #endif |
4027 | |
4033 | |
4028 | #if ENABLE_PERL |
4034 | #if ENABLE_PERL |
4029 | case URxvt_perl: |
4035 | case URxvt_perl: |
4030 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_STRING, str, DT_END))) |
4036 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_STR, str, DT_END))) |
4031 | ; // no responses yet |
4037 | ; // no responses yet |
4032 | break; |
4038 | break; |
4033 | #endif |
4039 | #endif |
4034 | } |
4040 | } |
4035 | } |
4041 | } |