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.371 by ayin, Wed Dec 5 08:46:30 2007 UTC vs.
Revision 1.387 by ayin, Sun Dec 30 23:45:42 2007 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-2006 Marc Lehmann <pcg@goof.com> 30 * Copyright (c) 2003-2007 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.
198 r & RS_Uline ? " uline" : "", 198 r & RS_Uline ? " uline" : "",
199 r & RS_Careful ? " careful" : ""); 199 r & RS_Careful ? " careful" : "");
200 200
201 int width = wcswidth (fname, wcslen (fname)); 201 int width = wcswidth (fname, wcslen (fname));
202 202
203 max_it (width, 8+5); // for char + hey 203 max_it (width, 8+5); // for char + hex
204 max_it (width, strlen (attr)); 204 max_it (width, strlen (attr));
205 205
206 if (y >= 0) 206 if (y >= 0)
207 { 207 {
208 y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1; 208 y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1;
220 ch = *chr++; 220 ch = *chr++;
221 221
222 sprintf (buf, "%8x", ch); 222 sprintf (buf, "%8x", ch);
223 scr_overlay_set (0, y, buf); 223 scr_overlay_set (0, y, buf);
224 scr_overlay_set (9, y, '='); 224 scr_overlay_set (9, y, '=');
225# if !UNICODE3 225# if !UNICODE_3
226 if (ch >= 0x10000) 226 if (ch >= 0x10000)
227 ch = 0xfffd; 227 ch = 0xfffd;
228# endif 228# endif
229 scr_overlay_set (11, y, ch, r); 229 scr_overlay_set (11, y, ch, r);
230 230
1041 } 1041 }
1042 1042
1043 display->flush (); 1043 display->flush ();
1044} 1044}
1045 1045
1046/* checks wether a refresh is requested and starts the refresh timer */
1046void 1047void
1047rxvt_term::prepare_cb (ev::prepare &w, int revents) 1048rxvt_term::refresh_check ()
1048{ 1049{
1049 make_current (); 1050 if (want_refresh && !flush_ev.is_active ())
1051 flush_ev.start (1. / 60.); // refresh at max. 60 Hz normally
1050 1052
1051 display->flush (); 1053 display->flush ();
1052
1053 if (want_refresh && !flush_ev.active)
1054 flush_ev.start (1. / 60.); // refresh at max. 60 Hz normally
1055} 1054}
1056 1055
1057void 1056void
1058rxvt_term::flush_cb (ev::timer &w, int revents) 1057rxvt_term::flush_cb (ev::timer &w, int revents)
1059{ 1058{
1067void 1066void
1068rxvt_term::cursor_blink_cb (ev::timer &w, int revents) 1067rxvt_term::cursor_blink_cb (ev::timer &w, int revents)
1069{ 1068{
1070 hidden_cursor = !hidden_cursor; 1069 hidden_cursor = !hidden_cursor;
1071 want_refresh = 1; 1070 want_refresh = 1;
1071 refresh_check ();
1072} 1072}
1073#endif 1073#endif
1074 1074
1075#ifdef TEXT_BLINK 1075#ifdef TEXT_BLINK
1076void 1076void
1078{ 1078{
1079 if (scr_refresh_rend (RS_Blink, RS_Blink)) 1079 if (scr_refresh_rend (RS_Blink, RS_Blink))
1080 { 1080 {
1081 hidden_text = !hidden_text; 1081 hidden_text = !hidden_text;
1082 want_refresh = 1; 1082 want_refresh = 1;
1083 refresh_check ();
1083 } 1084 }
1085 else
1086 w.stop ();
1084} 1087}
1085#endif 1088#endif
1086 1089
1087#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1090#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1088void 1091void
1089rxvt_term::cont_scroll_cb (ev::timer &w, int revents) 1092rxvt_term::cont_scroll_cb (ev::timer &w, int revents)
1090{ 1093{
1091 if ((scrollbar_isUp() || scrollbar_isDn()) && 1094 if ((scrollbar_isUp () || scrollbar_isDn ())
1092 scr_page (scrollbar_isUp() ? UP : DN, 1)) 1095 && scr_page (scrollbar_isUp () ? UP : DN, 1))
1096 {
1093 want_refresh = 1; 1097 want_refresh = 1;
1098 refresh_check ();
1099 }
1094 else 1100 else
1095 w.stop (); 1101 w.stop ();
1096} 1102}
1097#endif 1103#endif
1098 1104
1102{ 1108{
1103 if (scr_page (scroll_selection_dir, scroll_selection_lines)) 1109 if (scr_page (scroll_selection_dir, scroll_selection_lines))
1104 { 1110 {
1105 selection_extend (selection_save_x, selection_save_y, selection_save_state); 1111 selection_extend (selection_save_x, selection_save_y, selection_save_state);
1106 want_refresh = 1; 1112 want_refresh = 1;
1113 refresh_check ();
1107 } 1114 }
1108 else 1115 else
1109 w.stop (); 1116 w.stop ();
1110} 1117}
1111#endif 1118#endif
1112 1119
1113#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1120#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
1114void 1121void
1115rxvt_term::slip_wheel_cb (ev::timer &w, int revents) 1122rxvt_term::slip_wheel_cb (ev::timer &w, int revents)
1116{ 1123{
1117 if (mouse_slip_wheel_speed == 0 1124 if (scr_changeview (view_start - mouse_slip_wheel_speed))
1118 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed)
1119 : scr_page (UP, mouse_slip_wheel_speed))
1120 { 1125 {
1121 if (view_start == top_row || view_start == 0)
1122 mouse_slip_wheel_speed = 0;
1123
1124 want_refresh = 1; 1126 want_refresh = 1;
1127 refresh_check ();
1128 }
1129
1130 if (view_start == top_row || view_start == 0 || mouse_slip_wheel_speed == 0)
1125 } 1131 {
1126 else 1132 mouse_slip_wheel_speed = 0;
1127 w.stop (); 1133 w.stop ();
1134 }
1128} 1135}
1129#endif 1136#endif
1130 1137
1131#if LINUX_YIELD_HACK 1138#if LINUX_YIELD_HACK
1132static struct event_handler 1139static struct event_handler
1204 if (cmd_parse ()) 1211 if (cmd_parse ())
1205 break; 1212 break;
1206 1213
1207 if (revents & ev::WRITE) 1214 if (revents & ev::WRITE)
1208 pty_write (); 1215 pty_write ();
1216
1217 refresh_check ();
1209} 1218}
1210 1219
1211void 1220void
1212rxvt_term::pointer_unblank () 1221rxvt_term::pointer_unblank ()
1213{ 1222{
1448#ifdef HAVE_BG_PIXMAP 1457#ifdef HAVE_BG_PIXMAP
1449 if (bgPixmap.window_position_sensitive ()) 1458 if (bgPixmap.window_position_sensitive ())
1450 update_background (); 1459 update_background ();
1451#endif 1460#endif
1452 } 1461 }
1462
1453 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1463 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1454 } 1464 }
1455 break; 1465 break;
1456 1466
1457 case PropertyNotify: 1467 case PropertyNotify:
1476 break; 1486 break;
1477 1487
1478 case MapNotify: 1488 case MapNotify:
1479 mapped = 1; 1489 mapped = 1;
1480#ifdef TEXT_BLINK 1490#ifdef TEXT_BLINK
1481 text_blink_ev.start (TEXT_BLINK_INTERVAL); 1491 text_blink_ev.start ();
1482#endif 1492#endif
1483 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1493 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1484 break; 1494 break;
1485 1495
1486 case UnmapNotify: 1496 case UnmapNotify:
1507 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) 1517 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1508 { 1518 {
1509 scr_expose (ev.xexpose.x, ev.xexpose.y, 1519 scr_expose (ev.xexpose.x, ev.xexpose.y,
1510 ev.xexpose.width, ev.xexpose.height, False); 1520 ev.xexpose.width, ev.xexpose.height, False);
1511 } 1521 }
1522
1512 want_refresh = 1; 1523 want_refresh = 1;
1513 } 1524 }
1514 else 1525 else
1515 { 1526 {
1516 XEvent unused_event; 1527 XEvent unused_event;
1577 int dist; 1588 int dist;
1578 1589
1579 /* don't clobber the current delay if we are 1590 /* don't clobber the current delay if we are
1580 * already in the middle of scrolling. 1591 * already in the middle of scrolling.
1581 */ 1592 */
1582 if (!sel_scroll_ev.active) 1593 if (!sel_scroll_ev.is_active ())
1583 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 1594 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1584 1595
1585 /* save the event params so we can highlight 1596 /* save the event params so we can highlight
1586 * the selection in the pending-scroll loop 1597 * the selection in the pending-scroll loop
1587 */ 1598 */
1610 else 1621 else
1611 { 1622 {
1612 /* we are within the text window, so we 1623 /* we are within the text window, so we
1613 * shouldn't be scrolling 1624 * shouldn't be scrolling
1614 */ 1625 */
1615 if (sel_scroll_ev.active)
1616 sel_scroll_ev.stop(); 1626 sel_scroll_ev.stop();
1617 } 1627 }
1618#endif 1628#endif
1619#ifdef MOUSE_THRESHOLD 1629#ifdef MOUSE_THRESHOLD
1620 } 1630 }
1621#endif 1631#endif
1664 1674
1665 if (ev.type == KeyPress && hidden_pointer == 0) 1675 if (ev.type == KeyPress && hidden_pointer == 0)
1666 pointer_blank (); 1676 pointer_blank ();
1667 } 1677 }
1668#endif 1678#endif
1679
1680 refresh_check ();
1669} 1681}
1670 1682
1671void 1683void
1672rxvt_term::focus_in () 1684rxvt_term::focus_in ()
1673{ 1685{
1685 XSetICFocus (Input_Context); 1697 XSetICFocus (Input_Context);
1686 } 1698 }
1687#endif 1699#endif
1688#if CURSOR_BLINK 1700#if CURSOR_BLINK
1689 if (option (Opt_cursorBlink)) 1701 if (option (Opt_cursorBlink))
1690 cursor_blink_ev.start (CURSOR_BLINK_INTERVAL, CURSOR_BLINK_INTERVAL); 1702 cursor_blink_ev.again ();
1691#endif 1703#endif
1692#if OFF_FOCUS_FADING 1704#if OFF_FOCUS_FADING
1693 if (rs[Rs_fade]) 1705 if (rs[Rs_fade])
1694 { 1706 {
1695 pix_colors = pix_colors_focused; 1707 pix_colors = pix_colors_focused;
1783 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) 1795 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
1784 { 1796 {
1785 bgPixmap.set_root_pixmap (); 1797 bgPixmap.set_root_pixmap ();
1786 update_background (); 1798 update_background ();
1787 } 1799 }
1800
1788 break; 1801 break;
1789 } 1802 }
1790# endif 1803# endif
1804
1805 refresh_check ();
1791} 1806}
1792#endif 1807#endif
1793 1808
1794void 1809void
1795rxvt_term::button_press (XButtonEvent &ev) 1810rxvt_term::button_press (XButtonEvent &ev)
1973 if (scrollbarrxvt_upButton (ev.y)) 1988 if (scrollbarrxvt_upButton (ev.y))
1974 upordown = -1; /* up */ 1989 upordown = -1; /* up */
1975 else if (scrollbarrxvt_dnButton (ev.y)) 1990 else if (scrollbarrxvt_dnButton (ev.y))
1976 upordown = 1; /* down */ 1991 upordown = 1; /* down */
1977 } 1992 }
1993
1978 if (upordown) 1994 if (upordown)
1979 { 1995 {
1980#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1996#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1997 if (!cont_scroll_ev.is_active ())
1981 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 1998 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1982#endif 1999#endif
1983 if (scr_page (upordown < 0 ? UP : DN, 1)) 2000 if (scr_page (upordown < 0 ? UP : DN, 1))
1984 { 2001 {
1985 if (upordown < 0) 2002 if (upordown < 0)
1986 scrollBar.setUp (); 2003 scrollBar.setUp ();
1990 } 2007 }
1991 else 2008 else
1992 switch (ev.button) 2009 switch (ev.button)
1993 { 2010 {
1994 case Button2: 2011 case Button2:
1995 switch (scrollbar_align) 2012 switch (scrollBar.align)
1996 { 2013 {
1997 case R_SB_ALIGN_TOP: 2014 case R_SB_ALIGN_TOP:
1998 csrO = 0; 2015 csrO = 0;
1999 break; 2016 break;
2000 case R_SB_ALIGN_CENTRE: 2017 case R_SB_ALIGN_CENTRE:
2012 2029
2013 scrollBar.setMotion (); 2030 scrollBar.setMotion ();
2014 break; 2031 break;
2015 2032
2016 case Button1: 2033 case Button1:
2017 if (scrollbar_align == R_SB_ALIGN_CENTRE) 2034 if (scrollBar.align == R_SB_ALIGN_CENTRE)
2018 csrO = ev.y - scrollBar.top; 2035 csrO = ev.y - scrollBar.top;
2019 /* FALLTHROUGH */ 2036 /* FALLTHROUGH */
2020 2037
2021 case Button3: 2038 case Button3:
2022 if (scrollBar.style != R_SB_XTERM) 2039 if (scrollBar.style != R_SB_XTERM)
2066 scrollBar.setIdle (); 2083 scrollBar.setIdle ();
2067 scrollbar_show (0); 2084 scrollbar_show (0);
2068 } 2085 }
2069 2086
2070#ifdef SELECTION_SCROLLING 2087#ifdef SELECTION_SCROLLING
2071 if (sel_scroll_ev.active)
2072 sel_scroll_ev.stop(); 2088 sel_scroll_ev.stop();
2073#endif 2089#endif
2074 2090
2075 if (ev.window == vt) 2091 if (ev.window == vt)
2076 { 2092 {
2077 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) 2093 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2149 { 2165 {
2150 mouse_slip_wheel_speed += v ? -1 : 1; 2166 mouse_slip_wheel_speed += v ? -1 : 1;
2151 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; 2167 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow;
2152 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; 2168 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2153 2169
2170 if (!slip_wheel_ev.is_active ())
2154 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 2171 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2155 } 2172 }
2156 else 2173 else
2157 { 2174 {
2158# endif 2175# endif
2159 scr_page (v, i); 2176 scr_page (v, i);
3374#if ENABLE_TRANSPARENCY 3391#if ENABLE_TRANSPARENCY
3375 case URxvt_Color_tint: 3392 case URxvt_Color_tint:
3376 process_color_seq (op, Color_tint, str, resp); 3393 process_color_seq (op, Color_tint, str, resp);
3377 { 3394 {
3378 bool changed = false; 3395 bool changed = false;
3396
3379 if (ISSET_PIXCOLOR (Color_tint)) 3397 if (ISSET_PIXCOLOR (Color_tint))
3380 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); 3398 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]);
3381 else 3399 else
3382 changed = bgPixmap.unset_tint (); 3400 changed = bgPixmap.unset_tint ();
3401
3383 if (changed) 3402 if (changed)
3384 update_background (); 3403 update_background ();
3385 } 3404 }
3386 3405
3387 break; 3406 break;
3410 changed++; 3429 changed++;
3411 str = strchr (str, ';'); 3430 str = strchr (str, ';');
3412 if (str == NULL) 3431 if (str == NULL)
3413 bgPixmap.set_defaultGeometry (); 3432 bgPixmap.set_defaultGeometry ();
3414 } 3433 }
3434
3415 while (str) 3435 while (str)
3416 { 3436 {
3417 str++; 3437 str++;
3418 if (bgPixmap.set_geometry (str)) 3438 if (bgPixmap.set_geometry (str))
3419 changed++; 3439 changed++;
3420 str = strchr (str, ';'); 3440 str = strchr (str, ';');
3421 } 3441 }
3442
3422 if (changed) 3443 if (changed)
3423 update_background (); 3444 update_background ();
3424 } 3445 }
3425 break; 3446 break;
3426#endif 3447#endif
3427 3448
3428 case Rxvt_restoreFG: 3449 case Rxvt_restoreFG:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines