diff --git a/src/qwaylandlayersurface.cpp b/src/qwaylandlayersurface.cpp index 89f47ef..2b7cb52 100644 --- a/src/qwaylandlayersurface.cpp +++ b/src/qwaylandlayersurface.cpp @@ -16,6 +16,31 @@ #include +namespace +{ +template +concept QWaylandWindowNewV6Type = requires(T t) { t.sendRecursiveExposeEvent(); }; + +template +concept QWaylandWindowOldV6Type = requires(T t) { t.handleExpose(QRect()); } && !requires(T t) { t.sendRecursiveExposeEvent(); }; + +class ExposeHelper +{ +public: + template + [[maybe_unused]] ExposeHelper(T *window, const QSize &pendingSize) + { + window->handleExpose(QRect(QPoint(), pendingSize)); + } + + template + [[maybe_unused]] ExposeHelper(T *window, [[maybe_unused]] const QSize &pendingSize) + { + window->sendRecursiveExposeEvent(); + } +}; +} + namespace LayerShellQt { QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell, QtWaylandClient::QWaylandWindow *window) @@ -92,7 +117,7 @@ void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial, uint if (!m_configured) { m_configured = true; window()->resizeFromApplyConfigure(m_pendingSize); - window()->handleExpose(QRect(QPoint(), m_pendingSize)); + ExposeHelper helper(window(), m_pendingSize); } else { // Later configures are resizes, so we have to queue them up for a time when we // are not painting to the window.