From ad2059bdbea462ee9e7d4f7d11c16a218418c30e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Thu, 23 Aug 2012 16:51:40 +0200 Subject: [PATCH] fix flicker with fullscreen effects BUG: 304375 FIXED-IN: 4.9.1 REVIEW: 106142 --- composite.cpp | 13 ++++++++++--- scene.h | 3 +++ scene_opengl.h | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/composite.cpp b/composite.cpp index 61d5ca4344..74aed13f18 100644 --- a/composite.cpp +++ b/composite.cpp @@ -463,14 +463,21 @@ void Compositor::timerEvent(QTimerEvent *te) QObject::timerEvent(te); } -static bool s_pending = false; +static int s_pendingFlushes = 0; void Compositor::performCompositing() { if (!isOverlayWindowVisible()) return; // nothing is visible anyway bool pending = !repaints_region.isEmpty() || windowRepaintsPending(); - if (!(pending || s_pending)) { + if (pending) + s_pendingFlushes = 3; + else if (m_scene->hasPendingFlush()) + --s_pendingFlushes; + else + s_pendingFlushes = 0; + if (s_pendingFlushes < 1) { + s_pendingFlushes = 0; m_scene->idle(); // Note: It would seem here we should undo suspended unredirect, but when scenes need // it for some reason, e.g. transformations or translucency, the next pass that does not @@ -478,7 +485,7 @@ void Compositor::performCompositing() // Otherwise the window would not be painted normally anyway. return; } - s_pending = pending; + // create a list of all windows in the stacking order ToplevelList windows = Workspace::self()->xStackingOrder(); foreach (EffectWindow * c, static_cast< EffectsHandlerImpl* >(effects)->elevatedWindows()) { diff --git a/scene.h b/scene.h index 1614ca4863..70f9f67091 100644 --- a/scene.h +++ b/scene.h @@ -49,6 +49,9 @@ public: // Returns true if the ctor failed to properly initialize. virtual bool initFailed() const = 0; virtual CompositingType compositingType() const = 0; + + virtual bool hasPendingFlush() const { return false; } + // Repaints the given screen areas, windows provides the stacking order. // The entry point for the main part of the painting pass. // returns the time since the last vblank signal - if there's one diff --git a/scene_opengl.h b/scene_opengl.h index 3e40a49234..df65920e1d 100644 --- a/scene_opengl.h +++ b/scene_opengl.h @@ -46,6 +46,7 @@ public: virtual CompositingType compositingType() const { return OpenGLCompositing; } + virtual bool hasPendingFlush() const { return !m_lastDamage.isEmpty(); } virtual int paint(QRegion damage, ToplevelList windows); virtual void windowAdded(Toplevel*); virtual void windowDeleted(Deleted*);