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.
This commit is contained in:
David Edmundson 2023-05-01 14:38:36 +00:00
parent be63783888
commit 1358743441
2 changed files with 17 additions and 0 deletions

View File

@ -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());
}
}

View File

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