From 2ac46d8d9d72b054f78c804c185fe90d30fe1e1e Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 11 Apr 2024 17:57:14 +0100 Subject: [PATCH] Drop now defunct code to sync resizes This code was designed to make sure we didn't commit new buffers whilst we were waiting for a configure. The way this worked failed in 6 after kwin does not reply to desired_size changes immediately. It is uneeded after kwin commit "wayland: Avoid rearranging layer surfaces when wl_surface size changes" which means if we do submit frames between size change requests, they'll be ignored. Meaning the client will eventually get a configure event at the right size. --- src/qwaylandlayersurface.cpp | 32 -------------------------------- src/qwaylandlayersurface_p.h | 7 +------ 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/src/qwaylandlayersurface.cpp b/src/qwaylandlayersurface.cpp index d7c9538..228195a 100644 --- a/src/qwaylandlayersurface.cpp +++ b/src/qwaylandlayersurface.cpp @@ -71,9 +71,6 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell, QWaylandLayerSurface::~QWaylandLayerSurface() { - if (m_waitForSyncCallback) { - wl_callback_destroy(m_waitForSyncCallback); - } destroy(); } @@ -173,7 +170,6 @@ void QWaylandLayerSurface::setWindowGeometry(const QRect &geometry) } setDesiredSize(geometry.size()); - requestWaylandSync(); } bool QWaylandLayerSurface::requestActivate() @@ -224,34 +220,6 @@ void QWaylandLayerSurface::requestXdgActivationToken(quint32 serial) connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater); } -const wl_callback_listener QWaylandLayerSurface::syncCallbackListener = { - .done = [](void *data, struct wl_callback *callback, uint32_t time){ - Q_UNUSED(time); - wl_callback_destroy(callback); - QWaylandLayerSurface *layerSurface = static_cast(data); - layerSurface->m_waitForSyncCallback = nullptr; - layerSurface->sendExpose(); - } -}; - -void QWaylandLayerSurface::requestWaylandSync() -{ - if (m_waitForSyncCallback) { - return; - } - - m_waitForSyncCallback = wl_display_sync(m_window->display()->wl_display()); - wl_callback_add_listener(m_waitForSyncCallback, &syncCallbackListener, this); -} - -void QWaylandLayerSurface::handleWaylandSyncDone() -{ - if (!window()->isExposed()) { - return; - } - sendExpose(); -} - void QWaylandLayerSurface::sendExpose() { #if QT_VERSION < QT_VERSION_CHECK(6, 7, 0) diff --git a/src/qwaylandlayersurface_p.h b/src/qwaylandlayersurface_p.h index dee81e1..a829acd 100644 --- a/src/qwaylandlayersurface_p.h +++ b/src/qwaylandlayersurface_p.h @@ -30,7 +30,7 @@ public: bool isExposed() const override { - return m_configured && !m_waitForSyncCallback; + return m_configured; } void attachPopup(QtWaylandClient::QWaylandShellSurface *popup) override; @@ -50,8 +50,6 @@ public: void requestXdgActivationToken(quint32 serial) override; private: - void requestWaylandSync(); - void handleWaylandSyncDone(); void sendExpose(); void zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height) override; void zwlr_layer_surface_v1_closed() override; @@ -64,9 +62,6 @@ private: bool m_configured = false; bool m_configuring = false; - - static const wl_callback_listener syncCallbackListener; - struct wl_callback *m_waitForSyncCallback = nullptr; }; }