fix flicker with fullscreen effects

BUG: 304375
FIXED-IN: 4.9.1
REVIEW: 106142
This commit is contained in:
Thomas Lübking 2012-08-23 16:51:40 +02:00
parent a84cfb3a49
commit ad2059bdbe
3 changed files with 14 additions and 3 deletions

View file

@ -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()) {

View file

@ -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

View file

@ -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*);