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.
This commit is contained in:
David Edmundson 2023-12-11 10:21:59 +00:00
parent 5cf8ad46b1
commit 697c747c58
2 changed files with 3 additions and 0 deletions

View File

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

View File

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