From 9d9eafd2e6dc92396ec989001aee61c6284d6972 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 11 Dec 2023 10:21:59 +0000 Subject: [PATCH] Synchronise client driven resizing Qt's resizing is inherently synchronous. When an application calls QWindow::setGeometry with a new size, we expect it to make that resize. An expose event of the requested size will be generated. Wayland is by default async, a client requests a size, and then will be configured to that size, or potentially another size. The simplest way to map the two APIs is to roundtrip when the client wants to resize. This way we can guarantee that a call to `setGeometry(); update()` will have the server configured size before the paint. In practice it's still not perfect due to other issues, but at least will sort itself out within a frame. --- src/qwaylandlayersurface.cpp | 2 ++ src/qwaylandlayersurface_p.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/qwaylandlayersurface.cpp b/src/qwaylandlayersurface.cpp index ed57f4a..35355d9 100644 --- a/src/qwaylandlayersurface.cpp +++ b/src/qwaylandlayersurface.cpp @@ -23,6 +23,7 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell, , QtWayland::zwlr_layer_surface_v1() , m_shell(shell) , m_interface(Window::get(window->window())) + , m_window(window) { wl_output *output = nullptr; if (m_interface->screenConfiguration() == Window::ScreenFromQWindow) { @@ -157,6 +158,7 @@ void QWaylandLayerSurface::setWindowGeometry(const QRect &geometry) size.setHeight(0); } set_size(size.width(), size.height()); + wl_display_roundtrip(m_window->display()->wl_display()); } bool QWaylandLayerSurface::requestActivate() diff --git a/src/qwaylandlayersurface_p.h b/src/qwaylandlayersurface_p.h index 4b5940c..1a0024c 100644 --- a/src/qwaylandlayersurface_p.h +++ b/src/qwaylandlayersurface_p.h @@ -55,6 +55,7 @@ private: QWaylandLayerShellIntegration *m_shell; LayerShellQt::Window *m_interface; + QtWaylandClient::QWaylandWindow *m_window; QSize m_pendingSize; QString m_activationToken; bool m_configured = false;