From 2ce49877f7ec82cbdbf85a48186b598182d0bda6 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 10 Feb 2021 12:01:18 +0200 Subject: [PATCH] platforms/wayland: Emit outputEnabled() signal Otherwise the QPA won't create QPlatformScreens and the compositor may not work as expected. --- .../platforms/wayland/wayland_backend.cpp | 17 ++++++++++++++--- src/plugins/platforms/wayland/wayland_backend.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/wayland_backend.cpp b/src/plugins/platforms/wayland/wayland_backend.cpp index 38c2a4ad0c..1a451058af 100644 --- a/src/plugins/platforms/wayland/wayland_backend.cpp +++ b/src/plugins/platforms/wayland/wayland_backend.cpp @@ -474,7 +474,7 @@ WaylandBackend::~WaylandBackend() delete m_waylandCursor; m_eventQueue->release(); - qDeleteAll(m_outputs); + destroyOutputs(); if (m_xdgShell) { m_xdgShell->release(); @@ -625,8 +625,7 @@ void WaylandBackend::initConnection() delete m_seat; m_shm->destroy(); - qDeleteAll(m_outputs); - m_outputs.clear(); + destroyOutputs(); if (m_xdgShell) { m_xdgShell->destroy(); @@ -730,11 +729,23 @@ void WaylandBackend::createOutputs() logicalWidthSum += logicalWidth; m_outputs << waylandOutput; + emit outputAdded(waylandOutput); + emit outputEnabled(waylandOutput); } setReady(true); emit screensQueried(); } +void WaylandBackend::destroyOutputs() +{ + while (!m_outputs.isEmpty()) { + WaylandOutput *output = m_outputs.takeLast(); + emit outputDisabled(output); + emit outputRemoved(output); + delete output; + } +} + OpenGLBackend *WaylandBackend::createOpenGLBackend() { #if HAVE_WAYLAND_EGL diff --git a/src/plugins/platforms/wayland/wayland_backend.h b/src/plugins/platforms/wayland/wayland_backend.h index 74ba17f82b..2b8b7d71cf 100644 --- a/src/plugins/platforms/wayland/wayland_backend.h +++ b/src/plugins/platforms/wayland/wayland_backend.h @@ -209,6 +209,7 @@ Q_SIGNALS: private: void initConnection(); void createOutputs(); + void destroyOutputs(); void updateScreenSize(WaylandOutput *output); void relativeMotionHandler(const QSizeF &delta, const QSizeF &deltaNonAccelerated, quint64 timestamp);