--- rxvt-unicode/src/command.C 2007/12/14 02:22:24 1.377 +++ rxvt-unicode/src/command.C 2008/01/15 23:21:17 1.393 @@ -28,6 +28,7 @@ * - Ctrl/Mod4+Tab works like Meta+Tab (options) * Copyright (c) 2003 Rob McMullen * Copyright (c) 2003-2007 Marc Lehmann + * Copyright (c) 2007 Emanuele Giaquinta * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -200,7 +201,7 @@ int width = wcswidth (fname, wcslen (fname)); - max_it (width, 8+5); // for char + hey + max_it (width, 8+5); // for char + hex max_it (width, strlen (attr)); if (y >= 0) @@ -222,7 +223,7 @@ sprintf (buf, "%8x", ch); scr_overlay_set (0, y, buf); scr_overlay_set (9, y, '='); -# if !UNICODE3 +# if !UNICODE_3 if (ch >= 0x10000) ch = 0xfffd; # endif @@ -1043,15 +1044,14 @@ display->flush (); } +/* checks wether a refresh is requested and starts the refresh timer */ void -rxvt_term::prepare_cb (ev::prepare &w, int revents) +rxvt_term::refresh_check () { - make_current (); - - display->flush (); - if (want_refresh && !flush_ev.is_active ()) flush_ev.start (1. / 60.); // refresh at max. 60 Hz normally + + display->flush (); } void @@ -1069,6 +1069,7 @@ { hidden_cursor = !hidden_cursor; want_refresh = 1; + refresh_check (); } #endif @@ -1080,6 +1081,7 @@ { hidden_text = !hidden_text; want_refresh = 1; + refresh_check (); } else w.stop (); @@ -1090,9 +1092,12 @@ void rxvt_term::cont_scroll_cb (ev::timer &w, int revents) { - if ((scrollbar_isUp() || scrollbar_isDn()) && - scr_page (scrollbar_isUp() ? UP : DN, 1)) - want_refresh = 1; + if ((scrollbar_isUp () || scrollbar_isDn ()) + && scr_page (scrollbar_isUp () ? UP : DN, 1)) + { + want_refresh = 1; + refresh_check (); + } else w.stop (); } @@ -1106,6 +1111,7 @@ { selection_extend (selection_save_x, selection_save_y, selection_save_state); want_refresh = 1; + refresh_check (); } else w.stop (); @@ -1116,17 +1122,17 @@ void rxvt_term::slip_wheel_cb (ev::timer &w, int revents) { - if (mouse_slip_wheel_speed == 0 - || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) - : scr_page (UP, mouse_slip_wheel_speed)) + if (scr_changeview (view_start - mouse_slip_wheel_speed)) { - if (view_start == top_row || view_start == 0) - mouse_slip_wheel_speed = 0; - want_refresh = 1; + refresh_check (); + } + + if (view_start == top_row || view_start == 0 || mouse_slip_wheel_speed == 0) + { + mouse_slip_wheel_speed = 0; + w.stop (); } - else - w.stop (); } #endif @@ -1208,6 +1214,8 @@ if (revents & ev::WRITE) pty_write (); + + refresh_check (); } void @@ -1432,7 +1440,7 @@ break; case ConfigureNotify: - /* fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n", + /*fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n", ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y, szHint.width, szHint.height); */ if (ev.xconfigure.window == parent[0]) @@ -1449,9 +1457,15 @@ { #ifdef HAVE_BG_PIXMAP if (bgPixmap.window_position_sensitive ()) - update_background (); + { + if (mapped) + update_background (); + else + bgPixmap.invalidate (); + } #endif } + HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); } break; @@ -1478,6 +1492,22 @@ break; case MapNotify: +#ifdef HAVE_BG_PIXMAP + /* This is needed spcifically to fix the case of no window manager or a + * non-reparenting window manager. In those cases we never get first + * ConfigureNotify. Also that speeds startup under normal WM, by taking + * care of multiplicity of ConfigureNotify events arriwing while WM does + * reparenting. + * We should not render background immidiately, as there could be several + * ConfigureNotify's to follow. Lets take care of all of them in one scoop + * by scheduling background redraw as soon as we can, but giving a short + * bit of time for ConfigureNotifies to arrive. + * We should render background PRIOR to drawing any text, but AFTER all + * of ConfigureNotifys for the best results. + */ + if (bgPixmap.flags & bgPixmap_t::isInvalid) + update_background_ev.start (0.025); +#endif mapped = 1; #ifdef TEXT_BLINK text_blink_ev.start (); @@ -1511,6 +1541,7 @@ scr_expose (ev.xexpose.x, ev.xexpose.y, ev.xexpose.width, ev.xexpose.height, False); } + want_refresh = 1; } else @@ -1522,7 +1553,7 @@ while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) ; - if (isScrollbarWindow (ev.xany.window)) + if (scrollBar.state && ev.xany.window == scrollBar.win) { scrollBar.setIdle (); scrollbar_show (0); @@ -1622,7 +1653,7 @@ #endif } } - else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) + else if (scrollbar_isMotion () && ev.xany.window == scrollBar.win) { while (XCheckTypedWindowEvent (dpy, scrollBar.win, MotionNotify, &ev)) @@ -1667,6 +1698,8 @@ pointer_blank (); } #endif + + refresh_check (); } void @@ -1786,9 +1819,12 @@ bgPixmap.set_root_pixmap (); update_background (); } + break; } # endif + + refresh_check (); } #endif @@ -1911,7 +1947,7 @@ /* * Scrollbar window processing of button press */ - if (isScrollbarWindow (ev.window)) + if (scrollBar.state && ev.window == scrollBar.win) { scrollBar.setIdle (); /* @@ -1995,7 +2031,7 @@ switch (ev.button) { case Button2: - switch (scrollbar_align) + switch (scrollBar.align) { case R_SB_ALIGN_TOP: csrO = 0; @@ -2017,7 +2053,7 @@ break; case Button1: - if (scrollbar_align == R_SB_ALIGN_CENTRE) + if (scrollBar.align == R_SB_ALIGN_CENTRE) csrO = ev.y - scrollBar.top; /* FALLTHROUGH */ @@ -2157,13 +2193,11 @@ slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); } else - { # endif + { scr_page (v, i); scrollbar_show (1); -# ifdef MOUSE_SLIP_WHEELING } -# endif } break; #endif @@ -3379,10 +3413,12 @@ process_color_seq (op, Color_tint, str, resp); { bool changed = false; + if (ISSET_PIXCOLOR (Color_tint)) changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); else changed = bgPixmap.unset_tint (); + if (changed) update_background (); } @@ -3415,6 +3451,7 @@ if (str == NULL) bgPixmap.set_defaultGeometry (); } + while (str) { str++; @@ -3422,8 +3459,9 @@ changed++; str = strchr (str, ';'); } + if (changed) - update_background (); + update_background (); } break; #endif @@ -3655,7 +3693,10 @@ break; case 3: /* 80/132 */ if (priv_modes & PrivMode_132OK) - set_widthheight (((state ? 132 : 80) * fwidth), height); + { + scr_poweron (); + set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight); + } break; case 4: /* smooth scrolling */ set_option (Opt_jumpScroll, !state);