From 6d8b4bbadb728e4d03dcfa274193ad7c610b5aff Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sun, 26 Jul 2020 17:56:25 +0100 Subject: [PATCH] Client: Send subsurface expose event when toplevel is configured If a subsurface is set to be visible on the cilent side before the top level is configured it will do not create an exposeEvent and map a buffer as we fail the check in isExposed() where we check the parent. This is correct behavior. However, when the toplevel receives an applyConfigure from the shell client we need subsurfaces to update accordingly. This fixes a race where subsurfaces are not shown with slow compositors. Change-Id: Icd156e7655d5b25535acc4d2fe77c31e19ebfa32 Pick-to: 5.15 Fixes: QTBUG-86176 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 14 +++++++++++++- src/plugins/platforms/wayland/qwaylandwindow_p.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index f74cacf8cd7..f2655160820 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -516,10 +516,22 @@ void QWaylandWindow::applyConfigure() doApplyConfigure(); lock.unlock(); - sendExposeEvent(QRect(QPoint(), geometry().size())); + sendRecursiveExposeEvent(); QWindowSystemInterface::flushWindowSystemEvents(); } +void QWaylandWindow::sendRecursiveExposeEvent() +{ + if (!window()->isVisible()) + return; + sendExposeEvent(QRect(QPoint(), geometry().size())); + + for (QWaylandSubSurface *subSurface : qAsConst(mChildren)) { + auto subWindow = subSurface->window(); + subWindow->sendRecursiveExposeEvent(); + } +} + void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { Q_ASSERT(!buffer->committed()); diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index 93015dece6e..9272d368019 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -271,6 +271,7 @@ private: void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); void handleScreensChanged(); + void sendRecursiveExposeEvent(); bool mInResizeFromApplyConfigure = false; bool lastVisible = false;