From 176b7648d47e02bc9bdd54f020a7f0d70db61560 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. (cherry picked from commit 697c747c586798a984068e954a40ac548c420c9e) --- 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 71354d9..a659375 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) { @@ -171,6 +172,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 c61e514..d426f6a 100644 --- a/src/qwaylandlayersurface_p.h +++ b/src/qwaylandlayersurface_p.h @@ -54,6 +54,7 @@ private: QWaylandLayerShellIntegration *m_shell; LayerShellQt::Window *m_interface; + QtWaylandClient::QWaylandWindow *m_window; QSize m_pendingSize; QString m_activationToken; bool m_configured = false;