[effects/wobblywindows] Fix visual artifacts caused by maximize effect

Summary:
If one wants to drag a maximized window while he or she has enabled both
the Wobbly Windows and the Maximize effect, visual artifacts can be
shown.

When the Maximize effect animates transition from maximize to restore,
some parts of the window can overshoot repaint regions(because of
wobbliness), leaving us with the visual artifacts.

To fix that, we have to take into account current scale and translation
when calculating dirty region in the Wobbly Windows effect.

BUG: 370612
FIXED-IN: 5.14.1

Test Plan: When dragging maximized windows, there are no visual artifacts anymore.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: abetts, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D15961
This commit is contained in:
Vlad Zagorodniy 2018-10-05 10:19:57 +03:00
parent 5aeba9da59
commit c2ffcfdc21
2 changed files with 12 additions and 3 deletions

View file

@ -326,8 +326,14 @@ void WobblyWindowsEffect::paintWindow(EffectWindow* w, int mask, QRegion region,
right = qMax(right, data.quads[i].right()); right = qMax(right, data.quads[i].right());
bottom = qMax(bottom, data.quads[i].bottom()); bottom = qMax(bottom, data.quads[i].bottom());
} }
m_updateRegion = m_updateRegion.united(QRect(w->x() + left, w->y() + top, QRectF dirtyRect(
right - left + 2, bottom - top + 2)); left * data.xScale() + w->x() + data.xTranslation(),
top * data.yScale() + w->y() + data.yTranslation(),
(right - left + 1.0) * data.xScale(),
(bottom - top + 1.0) * data.yScale());
// Expand the dirty region by 1px to fix potential round/floor issues.
dirtyRect.adjust(-1.0, -1.0, 1.0, 1.0);
m_updateRegion = m_updateRegion.united(dirtyRect.toRect());
} }
// Call the next effect. // Call the next effect.

View file

@ -54,7 +54,10 @@ public:
virtual bool isActive() const; virtual bool isActive() const;
int requestedEffectChainPosition() const override { int requestedEffectChainPosition() const override {
return 45; // Please notice that the Wobbly Windows effect has to be placed
// after the Maximize effect in the effect chain, otherwise there
// can be visual artifacts when dragging maximized windows.:wq
return 70;
} }
// Wobbly model parameters // Wobbly model parameters