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.234 by root, Wed Jan 4 04:42:45 2006 UTC vs.
Revision 1.243 by root, Fri Jan 6 05:43:36 2006 UTC

25 * - extensive modifications 25 * - extensive modifications
26 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> 26 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org>
27 * Copyright (c) 2001 Marius Gedminas 27 * Copyright (c) 2001 Marius Gedminas
28 * - Ctrl/Mod4+Tab works like Meta+Tab (options) 28 * - Ctrl/Mod4+Tab works like Meta+Tab (options)
29 * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> 29 * Copyright (c) 2003 Rob McMullen <robm@flipturn.org>
30 * Copyright (c) 2003-2005 Marc Lehmann <pcg@goof.com> 30 * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com>
31 * 31 *
32 * This program is free software; you can redistribute it and/or modify 32 * This program is free software; you can redistribute it and/or modify
33 * it under the terms of the GNU General Public License as published by 33 * it under the terms of the GNU General Public License as published by
34 * the Free Software Foundation; either version 2 of the License, or 34 * the Free Software Foundation; either version 2 of the License, or
35 * (at your option) any later version. 35 * (at your option) any later version.
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)))
873 return;
874
872 if (len <= 0) 875 if (len <= 0)
873 return; /* not mapped */ 876 return; /* not mapped */
874 877
875 if (OPTION (Opt_scrollTtyKeypress)) 878 if (OPTION (Opt_scrollTtyKeypress))
876 if (view_start) 879 if (view_start)
967 } 970 }
968#endif 971#endif
969 972
970 if (want_refresh) 973 if (want_refresh)
971 { 974 {
975 if (SHOULD_INVOKE (HOOK_LINE_UPDATE))
976 {
977 int row = -view_start;
978
979 while (row > -nsaved && ROW (row - 1).is_longer ())
980 --row;
981
982 while (row < -view_start + nrow)
983 {
984 int start_row = row;
985 line_t *l;
986
987 do
988 {
989 l = &ROW (row);
990
991 if (!(l->f & LINE_FILTERED))
992 {
993 // line not filtered, mark it as filtered
994 l->f |= LINE_FILTERED;
995 while (l->is_longer ())
996 {
997 l = &ROW (++row);
998 l->f |= LINE_FILTERED;
999 }
1000
1001 // and filter it
1002 HOOK_INVOKE ((this, HOOK_LINE_UPDATE, DT_INT, start_row, DT_END));
1003
1004 break;
1005 }
1006 }
1007 while (l->is_longer ());
1008
1009 row++;
1010 }
1011
1012 }
1013
972 scr_refresh (refresh_type); 1014 scr_refresh (refresh_type);
973 scrollbar_show (1); 1015 scrollbar_show (1);
974#ifdef USE_XIM 1016#ifdef USE_XIM
975 IMSendSpot (); 1017 IMSendSpot ();
976#endif 1018#endif
1163 1205
1164#ifdef POINTER_BLANK 1206#ifdef POINTER_BLANK
1165void 1207void
1166rxvt_term::pointer_blank () 1208rxvt_term::pointer_blank ()
1167{ 1209{
1168 if (! OPTION (Opt_pointerBlank)) 1210 if (!OPTION (Opt_pointerBlank))
1169 return; 1211 return;
1170 1212
1171 XDefineCursor (display->display, vt, display->blank_cursor); 1213 XDefineCursor (display->display, vt, display->blank_cursor);
1172 XFlush (display->display); 1214 XFlush (display->display);
1173 1215
1372# endif 1414# endif
1373 else 1415 else
1374 iso14755buf = 0; 1416 iso14755buf = 0;
1375 } 1417 }
1376#endif 1418#endif
1419
1420 if (ev.xany.window == vt && HOOK_INVOKE ((this, HOOK_KEY_RELEASE, DT_XEVENT, &ev, DT_END)))
1421 break;
1377 1422
1378#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1423#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
1379 if (!(ev.xkey.state & ControlMask)) 1424 if (!(ev.xkey.state & ControlMask))
1380 slip_wheel_ev.stop (); 1425 slip_wheel_ev.stop ();
1381 else if (ks == XK_Control_L || ks == XK_Control_R) 1426 else if (ks == XK_Control_L || ks == XK_Control_R)
1596 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) 1641 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate)
1597 break; 1642 break;
1598 1643
1599 if (ev.xany.window == vt) 1644 if (ev.xany.window == vt)
1600 { 1645 {
1646 if (HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END)))
1647 ; // nop
1601 if (ev.xbutton.state & (Button1Mask | Button3Mask)) 1648 else if (ev.xbutton.state & (Button1Mask | Button3Mask))
1602 { 1649 {
1603 while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev)) 1650 while (XCheckTypedWindowEvent (disp, vt, MotionNotify, &ev))
1604 ; 1651 ;
1605 1652
1606 XQueryPointer (disp, vt, 1653 XQueryPointer (disp, vt,
1702 if (!focus) 1749 if (!focus)
1703 { 1750 {
1704 focus = 1; 1751 focus = 1;
1705 want_refresh = 1; 1752 want_refresh = 1;
1706 1753
1707 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); 1754 HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1708 1755
1709#if USE_XIM 1756#if USE_XIM
1710 if (Input_Context != NULL) 1757 if (Input_Context != NULL)
1711 { 1758 {
1712 IMSetStatusPosition (); 1759 IMSetStatusPosition ();
1733 if (focus) 1780 if (focus)
1734 { 1781 {
1735 focus = 0; 1782 focus = 0;
1736 want_refresh = 1; 1783 want_refresh = 1;
1737 1784
1738 PERL_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); 1785 HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1739 1786
1740#if ENABLE_FRILLS || ISO_14755 1787#if ENABLE_FRILLS || ISO_14755
1741 if (iso14755buf) 1788 if (iso14755buf)
1742 { 1789 {
1743 iso14755buf = 0; 1790 iso14755buf = 0;
1826#ifdef MOUSE_REPORT_DOUBLECLICK 1873#ifdef MOUSE_REPORT_DOUBLECLICK
1827 if (ev.button == MEvent.button && clickintime) 1874 if (ev.button == MEvent.button && clickintime)
1828 { 1875 {
1829 /* same button, within alloted time */ 1876 /* same button, within alloted time */
1830 MEvent.clicks++; 1877 MEvent.clicks++;
1878
1831 if (MEvent.clicks > 1) 1879 if (MEvent.clicks > 1)
1832 { 1880 {
1833 /* only report double clicks */ 1881 /* only report double clicks */
1834 MEvent.clicks = 2; 1882 MEvent.clicks = 2;
1835 mouse_report (ev); 1883 mouse_report (ev);
1855 else 1903 else
1856 { 1904 {
1857 if (ev.button != MEvent.button) 1905 if (ev.button != MEvent.button)
1858 MEvent.clicks = 0; 1906 MEvent.clicks = 0;
1859 1907
1860 if (!PERL_INVOKE ((this, HOOK_MOUSE_CLICK, DT_XEVENT, &ev, DT_END))) 1908 if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END)))
1861 switch (ev.button) 1909 switch (ev.button)
1862 { 1910 {
1863 case Button1: 1911 case Button1:
1864 /* allow meta + click to select rectangular areas */ 1912 /* allow meta + click to select rectangular areas */
1865 /* should be done in screen.C */ 1913 /* should be done in screen.C */
2043 } 2091 }
2044 2092
2045 break; 2093 break;
2046 } 2094 }
2047 } 2095 }
2096
2048 return; 2097 return;
2049 } 2098 }
2099
2050#if MENUBAR 2100#if MENUBAR
2051 /* 2101 /*
2052 * Menubar window processing of button press 2102 * Menubar window processing of button press
2053 */ 2103 */
2054 if (isMenuBarWindow (ev.window)) 2104 if (isMenuBarWindow (ev.window))
2116 */ 2166 */
2117 if (priv_modes & PrivMode_mouse_report 2167 if (priv_modes & PrivMode_mouse_report
2118 && bypass_keystate 2168 && bypass_keystate
2119 && ev.button == Button1 && MEvent.clicks <= 1) 2169 && ev.button == Button1 && MEvent.clicks <= 1)
2120 selection_extend (ev.x, ev.y, 0); 2170 selection_extend (ev.x, ev.y, 0);
2171
2172 if (!HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2173 return;
2121 2174
2122 switch (ev.button) 2175 switch (ev.button)
2123 { 2176 {
2124 case Button1: 2177 case Button1:
2125 case Button3: 2178 case Button3:
2679 { 2732 {
2680 if (ch == NOCHAR) 2733 if (ch == NOCHAR)
2681 { 2734 {
2682 seq_begin = cmdbuf_ptr; 2735 seq_begin = cmdbuf_ptr;
2683 ch = next_char (); 2736 ch = next_char ();
2684 }
2685 2737
2686 if (ch == NOCHAR) // TODO: improve 2738 if (ch == NOCHAR)
2687 break; 2739 break;
2740 }
2688 2741
2689 if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT) 2742 if (!IS_CONTROL (ch) || ch == C0_LF || ch == C0_CR || ch == C0_HT)
2690 { 2743 {
2691 if (!seen_input) 2744 if (!seen_input)
2692 { 2745 {
2733 } 2786 }
2734 2787
2735 // scr_add_lines only works for nlines <= nrow - 1. 2788 // scr_add_lines only works for nlines <= nrow - 1.
2736 if (nlines >= nrow - 1) 2789 if (nlines >= nrow - 1)
2737 { 2790 {
2791 if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_USTRING_LEN, buf, str - buf, DT_END)))
2738 scr_add_lines (buf, nlines, str - buf); 2792 scr_add_lines (buf, nlines, str - buf);
2793
2739 nlines = 0; 2794 nlines = 0;
2740 str = buf; 2795 str = buf;
2741 eol = str + min (ncol, UBUFSIZ); 2796 eol = str + min (ncol, UBUFSIZ);
2742 } 2797 }
2743 2798
2756 2811
2757 seq_begin = cmdbuf_ptr; 2812 seq_begin = cmdbuf_ptr;
2758 ch = next_char (); 2813 ch = next_char ();
2759 } 2814 }
2760 2815
2816 if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_USTRING_LEN, buf, str - buf, DT_END)))
2761 scr_add_lines (buf, nlines, str - buf); 2817 scr_add_lines (buf, nlines, str - buf);
2762 2818
2763 /* 2819 /*
2764 * If there have been a lot of new lines, then update the screen 2820 * If there have been a lot of new lines, then update the screen
2765 * What the heck I'll cheat and only refresh less than every page-full. 2821 * What the heck I'll cheat and only refresh less than every page-full.
2766 * the number of pages between refreshes is refresh_limit, which 2822 * the number of pages between refreshes is refresh_limit, which
3972 break; 4028 break;
3973#endif 4029#endif
3974 4030
3975#if ENABLE_PERL 4031#if ENABLE_PERL
3976 case URxvt_perl: 4032 case URxvt_perl:
3977 if (PERL_INVOKE ((this, HOOK_OSC_SEQ, DT_STRING, str, DT_END))) 4033 if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_STRING, str, DT_END)))
3978 ; // no responses yet 4034 ; // no responses yet
3979 break; 4035 break;
3980#endif 4036#endif
3981 } 4037 }
3982} 4038}
4340 scr_color (Color_bg, Color_bg); 4396 scr_color (Color_bg, Color_bg);
4341 break; 4397 break;
4342 4398
4343 //case 50: // not variable spacing 4399 //case 50: // not variable spacing
4344 4400
4345#ifndef NO_BRIGHTCOLOR 4401#if ENABLE_FRILLS
4346 case 90: 4402 case 90:
4347 case 91: /* set bright fg color */ 4403 case 91: /* set bright fg color */
4348 case 92: 4404 case 92:
4349 case 93: 4405 case 93:
4350 case 94: 4406 case 94:
4412const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT 4468const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT
4413 4469
4414void 4470void
4415rxvt_term::tt_write (const char *data, unsigned int len) 4471rxvt_term::tt_write (const char *data, unsigned int len)
4416{ 4472{
4473 if (pty.pty < 0)
4474 return;
4475
4417 if (v_buflen == 0) 4476 if (v_buflen == 0)
4418 { 4477 {
4419 ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE)); 4478 ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE));
4420 4479
4421 if ((unsigned int)written == len) 4480 if ((unsigned int)written == len)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines