ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.243 by root, Fri Jan 6 05:43:36 2006 UTC vs.
Revision 1.247 by root, Sat Jan 7 20:23:52 2006 UTC

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);
2167 if (priv_modes & PrivMode_mouse_report 2170 if (priv_modes & PrivMode_mouse_report
2168 && bypass_keystate 2171 && bypass_keystate
2169 && ev.button == Button1 && MEvent.clicks <= 1) 2172 && ev.button == Button1 && MEvent.clicks <= 1)
2170 selection_extend (ev.x, ev.y, 0); 2173 selection_extend (ev.x, ev.y, 0);
2171 2174
2172 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)))
2173 return; 2176 return;
2174 2177
2175 switch (ev.button) 2178 switch (ev.button)
2176 { 2179 {
2177 case Button1: 2180 case Button1:
2723 2726
2724bool 2727bool
2725rxvt_term::cmd_parse () 2728rxvt_term::cmd_parse ()
2726{ 2729{
2727 bool flag = false; 2730 bool flag = false;
2728 unicode_t ch = NOCHAR; 2731 wchar_t ch = NOCHAR;
2729 char *seq_begin; // remember start of esc-sequence here 2732 char *seq_begin; // remember start of esc-sequence here
2730 2733
2731 for (;;) 2734 for (;;)
2732 { 2735 {
2733 if (ch == NOCHAR) 2736 if (ch == NOCHAR)
2754 if (seen_resize && cmd_pid) 2757 if (seen_resize && cmd_pid)
2755 kill (-cmd_pid, SIGWINCH); 2758 kill (-cmd_pid, SIGWINCH);
2756 } 2759 }
2757 2760
2758 /* Read a text string from the input buffer */ 2761 /* Read a text string from the input buffer */
2759 unicode_t buf[UBUFSIZ]; 2762 wchar_t buf[UBUFSIZ];
2760 bool refreshnow = false; 2763 bool refreshnow = false;
2761 int nlines = 0; 2764 int nlines = 0;
2762 unicode_t *str = buf; 2765 wchar_t *str = buf;
2763 unicode_t *eol = str + min (ncol, UBUFSIZ); 2766 wchar_t *eol = str + min (ncol, UBUFSIZ);
2764 2767
2765 for (;;) 2768 for (;;)
2766 { 2769 {
2767 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))
2768 break; 2771 break;
2786 } 2789 }
2787 2790
2788 // scr_add_lines only works for nlines <= nrow - 1. 2791 // scr_add_lines only works for nlines <= nrow - 1.
2789 if (nlines >= nrow - 1) 2792 if (nlines >= nrow - 1)
2790 { 2793 {
2791 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)))
2792 scr_add_lines (buf, nlines, str - buf); 2795 scr_add_lines (buf, str - buf, nlines);
2793 2796
2794 nlines = 0; 2797 nlines = 0;
2795 str = buf; 2798 str = buf;
2796 eol = str + min (ncol, UBUFSIZ); 2799 eol = str + min (ncol, UBUFSIZ);
2797 } 2800 }
2811 2814
2812 seq_begin = cmdbuf_ptr; 2815 seq_begin = cmdbuf_ptr;
2813 ch = next_char (); 2816 ch = next_char ();
2814 } 2817 }
2815 2818
2816 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)))
2817 scr_add_lines (buf, nlines, str - buf); 2820 scr_add_lines (buf, str - buf, nlines);
2818 2821
2819 /* 2822 /*
2820 * 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
2821 * 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.
2822 * the number of pages between refreshes is refresh_limit, which 2825 * the number of pages between refreshes is refresh_limit, which
2853 } 2856 }
2854 2857
2855 return flag; 2858 return flag;
2856} 2859}
2857 2860
2858// read the next octet
2859unicode_t
2860rxvt_term::next_octet ()
2861{
2862 return cmdbuf_ptr < cmdbuf_endp
2863 ? *cmdbuf_ptr++
2864 : NOCHAR;
2865}
2866
2867// read the next character 2861// read the next character
2868unicode_t 2862wchar_t
2869rxvt_term::next_char () 2863rxvt_term::next_char ()
2870{ 2864{
2871 while (cmdbuf_ptr < cmdbuf_endp) 2865 while (cmdbuf_ptr < cmdbuf_endp)
2872 { 2866 {
2873 // assume 7-bit to be ascii ALWAYS 2867 // assume 7-bit to be ascii ALWAYS
2883 cmdbuf_ptr = cmdbuf_endp; 2877 cmdbuf_ptr = cmdbuf_endp;
2884 break; 2878 break;
2885 } 2879 }
2886 2880
2887 if (len == (size_t)-1) 2881 if (len == (size_t)-1)
2888 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
2889 2883
2890 // assume wchar == unicode 2884 // assume wchar == unicode
2891 cmdbuf_ptr += len; 2885 cmdbuf_ptr += len;
2892 return wc & UNICODE_MASK; 2886 return wc & UNICODE_MASK;
2893 } 2887 }
2894 2888
2895 return NOCHAR; 2889 return NOCHAR;
2890}
2891
2892// read the next octet
2893uint32_t
2894rxvt_term::next_octet ()
2895{
2896 return cmdbuf_ptr < cmdbuf_endp
2897 ? (unsigned char)*cmdbuf_ptr++
2898 : NOCHAR;
2896} 2899}
2897 2900
2898/* rxvt_cmd_getc () - Return next input character */ 2901/* rxvt_cmd_getc () - Return next input character */
2899/* 2902/*
2900 * Return the next input character after first passing any keyboard input 2903 * Return the next input character after first passing any keyboard input
2901 * to the command. 2904 * to the command.
2902 */ 2905 */
2903unicode_t 2906wchar_t
2904rxvt_term::cmd_getc () 2907rxvt_term::cmd_getc ()
2905{ 2908{
2906 unicode_t c = next_char (); 2909 wchar_t c = next_char ();
2907 2910
2908 if (c == NOCHAR) 2911 if (c == NOCHAR)
2909 throw out_of_input; 2912 throw out_of_input;
2910 2913
2911 return c; 2914 return c;
2912} 2915}
2913 2916
2914unicode_t 2917uint32_t
2915rxvt_term::cmd_get8 () 2918rxvt_term::cmd_get8 ()
2916{ 2919{
2917 unicode_t c = next_octet (); 2920 uint32_t c = next_octet ();
2918 2921
2919 if (c == NOCHAR) 2922 if (c == NOCHAR)
2920 throw out_of_input; 2923 throw out_of_input;
2921 2924
2922 return c; 2925 return c;
3189 break; 3192 break;
3190 3193
3191 /* 8.3.87: NEXT LINE */ 3194 /* 8.3.87: NEXT LINE */
3192 case C1_NEL: /* ESC E */ 3195 case C1_NEL: /* ESC E */
3193 { 3196 {
3194 unicode_t nlcr[] = { C0_LF, C0_CR }; 3197 wchar_t nlcr[] = { C0_LF, C0_CR };
3195 scr_add_lines (nlcr, 1, 2); 3198 scr_add_lines (nlcr, sizeof (nlcr) / sizeof (nlcr [0]), 1);
3196 } 3199 }
3197 break; 3200 break;
3198 3201
3199 /* kidnapped escape sequence: Should be 8.3.48 */ 3202 /* kidnapped escape sequence: Should be 8.3.48 */
3200 case C1_ESA: /* ESC G */ 3203 case C1_ESA: /* ESC G */
4028 break; 4031 break;
4029#endif 4032#endif
4030 4033
4031#if ENABLE_PERL 4034#if ENABLE_PERL
4032 case URxvt_perl: 4035 case URxvt_perl:
4033 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)))
4034 ; // no responses yet 4037 ; // no responses yet
4035 break; 4038 break;
4036#endif 4039#endif
4037 } 4040 }
4038} 4041}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines