From 1358743441222f7d71d0fd1fbc64968dba2162ee Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 1 May 2023 14:38:36 +0000 Subject: [PATCH] Call LayerShell::set_size when the window geometry changes Without this when krunner expands, the frame after kwin will resize it back to the last size the layer shell requested to be resized to. To detect when we should not send an explicit size on window resize events we check the anchors; if we're constrained on opposing edges we want the compositor alone to set the size. --- src/qwaylandlayersurface.cpp | 16 ++++++++++++++++ src/qwaylandlayersurface_p.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/qwaylandlayersurface.cpp b/src/qwaylandlayersurface.cpp index 7707163..10bc3f5 100644 --- a/src/qwaylandlayersurface.cpp +++ b/src/qwaylandlayersurface.cpp @@ -140,4 +140,20 @@ void QWaylandLayerSurface::setLayer(uint32_t layer) set_layer(layer); } +void QWaylandLayerSurface::setWindowGeometry(const QRect &geometry) +{ + LayerShellQt::Window *interface = Window::get(window()->window()); + const bool horizontallyConstrained = interface->anchors() & (Window::AnchorLeft & Window::AnchorRight); + const bool verticallyConstrained = interface->anchors() & (Window::AnchorTop & Window::AnchorBottom); + + QSize size = geometry.size(); + if (horizontallyConstrained) { + size.setWidth(0); + } + if (verticallyConstrained) { + size.setHeight(0); + } + set_size(size.width(), size.height()); +} + } diff --git a/src/qwaylandlayersurface_p.h b/src/qwaylandlayersurface_p.h index 9e3e8ed..4d61d26 100644 --- a/src/qwaylandlayersurface_p.h +++ b/src/qwaylandlayersurface_p.h @@ -39,6 +39,7 @@ public: void setLayer(uint32_t layer); void applyConfigure() override; + void setWindowGeometry(const QRect &geometry) override; private: void zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height) override;