effects/glide: Adjust the effect to projection matrix changes

With per-screen rendering, the projection matrix is no longer created
with the workspace geometry, i.e. all screen geometries united, so the
center of the workspace geometry may not map to (0, 0) in the clip
coordinates.

GLRenderTarget::virtualScreenGeometry() can be used to query the rect
that was used to create the projection matrix.

BUG: 442770
This commit is contained in:
Vlad Zahorodnii 2021-09-21 14:32:35 +03:00
parent 6d79d855be
commit c29c437e58

View file

@ -12,6 +12,7 @@
// own // own
#include "glide.h" #include "glide.h"
#include "kwinglutils.h"
// KConfigSkeleton // KConfigSkeleton
#include "glideconfig.h" #include "glideconfig.h"
@ -120,7 +121,7 @@ void GlideEffect::paintWindow(EffectWindow *w, int mask, QRegion region, WindowP
data.setProjectionMatrix(invOffsetMatrix * oldProjMatrix); data.setProjectionMatrix(invOffsetMatrix * oldProjMatrix);
// Move the center of the window to the origin. // Move the center of the window to the origin.
const QRectF screenGeo = effects->virtualScreenGeometry(); const QRectF screenGeo = GLRenderTarget::virtualScreenGeometry();
const QPointF offset = screenGeo.center() - windowGeo.center(); const QPointF offset = screenGeo.center() - windowGeo.center();
data.translate(offset.x(), offset.y()); data.translate(offset.x(), offset.y());