From: sasha Date: Tue, 18 Sep 2007 22:01:36 +0000 (+0000) Subject: improved flickering on move/resize with transparent background X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=d9d818a9df4ab21bc3722e983a7d5abd51935d7e;p=dana%2Furxvt.git improved flickering on move/resize with transparent background --- diff --git a/src/background.C b/src/background.C index 81bae2f1..26c80843 100644 --- a/src/background.C +++ b/src/background.C @@ -1219,11 +1219,9 @@ bgPixmap_t::apply() XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]); # endif } - - /* don't want Expose on the parent */ - XClearArea (target->dpy, target->parent[0], 0, 0, 0, 0, False); - /* do want Expose on the vt, so we get refreshed properly */ - XClearArea (target->dpy, target->vt, 0, 0, 0, 0, True); + /* don't want Expose on the parent or vt. It is better to use + scr_touch or we get a great deal of flicker otherwise: */ + XClearWindow (target->dpy, target->parent[0]); # if HAVE_SCROLLBARS if (target->scrollBar.win) @@ -1232,6 +1230,9 @@ bgPixmap_t::apply() target->scrollbar_show (0); } # endif + + target->want_refresh = 1; + flags |= hasChanged; } } diff --git a/src/background.h b/src/background.h index 698bae66..1e12606f 100644 --- a/src/background.h +++ b/src/background.h @@ -30,8 +30,9 @@ struct bgPixmap_t { isTransparent = (1UL<<16), isInvalid = (1UL<<17), - isVtOrigin = (1UL<<18) /* if set pixmap has origin at corner of + isVtOrigin = (1UL<<18), /* if set pixmap has origin at corner of vt window instead of parent[0]! */ + hasChanged = (1UL<<19) }; unsigned long flags; @@ -43,6 +44,8 @@ struct bgPixmap_t { transpTransformations = (tintNeeded|blurNeeded) }; /* this flags are returned by make_transparency_pixmap if called */ + bool check_clearChanged () { bool r = flags & hasChanged; flags &= ~hasChanged; return r; }; + # ifdef BG_IMAGE_FROM_FILE # ifdef HAVE_AFTERIMAGE ASImage *original_asim; diff --git a/src/command.C b/src/command.C index 22fb4c41..326d02fd 100644 --- a/src/command.C +++ b/src/command.C @@ -1036,6 +1036,14 @@ void rxvt_term::flush () { flush_ev.stop (); + +#ifdef HAVE_BG_PIXMAP + if (bgPixmap.check_clearChanged ()) + { + scr_clear (true); + scr_touch (false); + } +#endif if (want_refresh) { @@ -1468,9 +1476,9 @@ rxvt_term::x_cb (XEvent &ev) 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);*/ + szHint.width, szHint.height); */ if (ev.xconfigure.window == parent[0]) { while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) @@ -1534,16 +1542,19 @@ rxvt_term::x_cb (XEvent &ev) if (ev.xany.window == vt) { do - scr_expose (ev.xexpose.x, ev.xexpose.y, - ev.xexpose.width, ev.xexpose.height, False); + { + scr_expose (ev.xexpose.x, ev.xexpose.y, + ev.xexpose.width, ev.xexpose.height, False); + } while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) - scr_expose (ev.xexpose.x, ev.xexpose.y, - ev.xexpose.width, ev.xexpose.height, False); - + { + scr_expose (ev.xexpose.x, ev.xexpose.y, + ev.xexpose.width, ev.xexpose.height, False); + } want_refresh = 1; } else diff --git a/src/main.C b/src/main.C index 6b6d4257..3956f132 100644 --- a/src/main.C +++ b/src/main.C @@ -1735,11 +1735,11 @@ rxvt_term::get_pixmap_property (int prop_id) int rxvt_term::update_background () { - bgPixmap.invalidate(); + bgPixmap.invalidate (); /* no chance of real time refresh if we are blurring ! */ if (bgPixmap.invalid_since + 0.5 < NOW && !(bgPixmap.flags & bgPixmap_t::blurNeeded)) - bgPixmap.render(); + bgPixmap.render (); else { update_background_ev.stop (); diff --git a/src/screen.C b/src/screen.C index 24a1d9ee..c8e9dfa6 100644 --- a/src/screen.C +++ b/src/screen.C @@ -2486,11 +2486,11 @@ rxvt_term::scr_recolour () NOTHROW scrollbar_show (0); } # endif -#endif - scr_clear (); scr_touch (true); want_refresh = 1; +#endif + } /* ------------------------------------------------------------------------- */