From 1a7dedc2d12dd6ae2eebc632b331b6cf3d9ae538 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sun, 23 Jun 2019 15:09:51 +0200 Subject: [PATCH] Client: Don't send fake SurfaceCreated/Destroyed events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QPlatformSurface relates to the platform window, not the wl_surface. The events are already emitted by QPlatformWindow on create/destroy. To preserve compatibility for a previous KDE version it was faked to emit the events when the wl_surface is created/hidden to keep behavior. This is no longer necessary, and it has caused multiple errors, the latest being a crash when switching between sub-menus with the Sway compositor. [ChangeLog][QPA plugin] QWaylandWindow no longer sends fake SurfaceCreated/Destroyed events. Use expose events to be notified when a Wayland surface appears. Task-number: QTBUG-76324 Fixes: QTBUG-81952 Pick-to: 5.15 Change-Id: I2f003bc9da85f032a0053677fd281152099fc9eb Reviewed-by: Paul Olav Tvete Reviewed-by: Tor Arne Vestbø Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 10 ++-------- src/plugins/platforms/wayland/qwaylandwindow_p.h | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 8cc26d71ca1..523bdc73294 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -91,7 +91,7 @@ QWaylandWindow::~QWaylandWindow() delete mWindowDecoration; if (mSurface) - reset(false); + reset(); const QWindow *parent = window(); const auto tlw = QGuiApplication::topLevelWindows(); @@ -118,8 +118,6 @@ void QWaylandWindow::initWindow() if (!mSurface) { initializeWlSurface(); - QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceCreated); - QGuiApplication::sendEvent(window(), &e); } if (shouldCreateSubSurface()) { @@ -234,12 +232,8 @@ bool QWaylandWindow::shouldCreateSubSurface() const return QPlatformWindow::parent() != nullptr; } -void QWaylandWindow::reset(bool sendDestroyEvent) +void QWaylandWindow::reset() { - if (mSurface && sendDestroyEvent) { - QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed); - QGuiApplication::sendEvent(window(), &e); - } delete mShellSurface; mShellSurface = nullptr; delete mSubSurfaceWindow; diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index c0328996d5d..6ad63d354a8 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -260,7 +260,7 @@ private: void initializeWlSurface(); bool shouldCreateShellSurface() const; bool shouldCreateSubSurface() const; - void reset(bool sendDestroyEvent = true); + void reset(); void sendExposeEvent(const QRect &rect); static void closePopups(QWaylandWindow *parent); QPlatformScreen *calculateScreenFromSurfaceEvents() const;