From 95c983e6d858afb3ba69b30aaf36db0d32600475 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 24 Aug 2017 17:57:38 +0100 Subject: [PATCH] Handle buffer scales changing dynamically Summary: Currently when a client changes it's buffer size the result is corrupt until we move the window. When a client buffer scale changes we need to redraw the whole window, and most importantly flush the cached window quads, which reference the scale. This is not handled by the doSetGeometry() from the size changing as the normalised size of the client remains the same so it no-ops. Test Plan: Opened gtk3-demo and changed screen scale. It's now perfect. Patch for Qt to work correctly incoming. Reviewers: #plasma, graesslin Reviewed By: #plasma, graesslin Subscribers: graesslin, plasma-devel, kwin, #kwin Tags: #plasma Differential Revision: https://phabricator.kde.org/D7486 --- scene.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scene.cpp b/scene.cpp index 79147a53cd..a51bbe9be2 100644 --- a/scene.cpp +++ b/scene.cpp @@ -399,6 +399,10 @@ void Scene::windowAdded(Toplevel *c) m_windows[ c ] = w; connect(c, SIGNAL(geometryShapeChanged(KWin::Toplevel*,QRect)), SLOT(windowGeometryShapeChanged(KWin::Toplevel*))); connect(c, SIGNAL(windowClosed(KWin::Toplevel*,KWin::Deleted*)), SLOT(windowClosed(KWin::Toplevel*,KWin::Deleted*))); + //A change of scale won't affect the geometry in compositor co-ordinates, but will affect the window quads. + if (c->surface()) { + connect(c->surface(), &KWayland::Server::SurfaceInterface::scaleChanged, this, std::bind(&Scene::windowGeometryShapeChanged, this, c)); + } c->effectWindow()->setSceneWindow(w); c->getShadow(); w->updateShadow(c->shadow());