diff --git a/platform.h b/platform.h index c12a2a94ab..a2d110114f 100644 --- a/platform.h +++ b/platform.h @@ -498,6 +498,8 @@ Q_SIGNALS: * Emitted by backends using a one screen (nested window) approach and when the size of that changes. */ void screenSizeChanged(); + void outputAdded(AbstractOutput *output); + void outputRemoved(AbstractOutput *output); protected: explicit Platform(QObject *parent = nullptr); diff --git a/plugins/platforms/drm/drm_backend.cpp b/plugins/platforms/drm/drm_backend.cpp index 51d9725393..a73b0cb493 100644 --- a/plugins/platforms/drm/drm_backend.cpp +++ b/plugins/platforms/drm/drm_backend.cpp @@ -332,6 +332,7 @@ void DrmBackend::addOutput(DrmOutput *o) m_outputs.append(o); m_enabledOutputs.append(o); emit o->gpu()->outputEnabled(o); + emit outputAdded(o); } void DrmBackend::removeOutput(DrmOutput *o) @@ -339,6 +340,7 @@ void DrmBackend::removeOutput(DrmOutput *o) emit o->gpu()->outputDisabled(o); m_outputs.removeOne(o); m_enabledOutputs.removeOne(o); + emit outputRemoved(o); } bool DrmBackend::updateOutputs() diff --git a/plugins/platforms/wayland/egl_wayland_backend.cpp b/plugins/platforms/wayland/egl_wayland_backend.cpp index 5d9f3e56a9..fdcd338665 100644 --- a/plugins/platforms/wayland/egl_wayland_backend.cpp +++ b/plugins/platforms/wayland/egl_wayland_backend.cpp @@ -105,7 +105,7 @@ EglWaylandBackend::EglWaylandBackend(WaylandBackend *b) connect(m_backend, &WaylandBackend::outputAdded, this, &EglWaylandBackend::createEglWaylandOutput); connect(m_backend, &WaylandBackend::outputRemoved, this, - [this] (WaylandOutput *output) { + [this] (AbstractOutput *output) { auto it = std::find_if(m_outputs.begin(), m_outputs.end(), [output] (const EglWaylandOutput *o) { return o->m_waylandOutput == output; @@ -133,9 +133,9 @@ void EglWaylandBackend::cleanupSurfaces() m_outputs.clear(); } -bool EglWaylandBackend::createEglWaylandOutput(WaylandOutput *waylandOutput) +bool EglWaylandBackend::createEglWaylandOutput(AbstractOutput *waylandOutput) { - auto *output = new EglWaylandOutput(waylandOutput, this); + auto *output = new EglWaylandOutput(static_cast(waylandOutput), this); if (!output->init(this)) { return false; } diff --git a/plugins/platforms/wayland/egl_wayland_backend.h b/plugins/platforms/wayland/egl_wayland_backend.h index 1884ea6b44..8a418aaba9 100644 --- a/plugins/platforms/wayland/egl_wayland_backend.h +++ b/plugins/platforms/wayland/egl_wayland_backend.h @@ -87,7 +87,7 @@ private: bool initBufferConfigs(); bool initRenderingContext(); - bool createEglWaylandOutput(WaylandOutput *output); + bool createEglWaylandOutput(AbstractOutput *output); void cleanupSurfaces() override; void cleanupOutput(EglWaylandOutput *output); diff --git a/plugins/platforms/wayland/scene_qpainter_wayland_backend.cpp b/plugins/platforms/wayland/scene_qpainter_wayland_backend.cpp index 2bfdcb4e80..4f738b12ad 100644 --- a/plugins/platforms/wayland/scene_qpainter_wayland_backend.cpp +++ b/plugins/platforms/wayland/scene_qpainter_wayland_backend.cpp @@ -137,7 +137,7 @@ WaylandQPainterBackend::WaylandQPainterBackend(Wayland::WaylandBackend *b) } connect(m_backend, &WaylandBackend::outputAdded, this, &WaylandQPainterBackend::createOutput); connect(m_backend, &WaylandBackend::outputRemoved, this, - [this] (WaylandOutput *waylandOutput) { + [this] (AbstractOutput *waylandOutput) { auto it = std::find_if(m_outputs.begin(), m_outputs.end(), [waylandOutput] (WaylandQPainterOutput *output) { return output->m_waylandOutput == waylandOutput; @@ -161,9 +161,9 @@ bool WaylandQPainterBackend::perScreenRendering() const return true; } -void WaylandQPainterBackend::createOutput(WaylandOutput *waylandOutput) +void WaylandQPainterBackend::createOutput(AbstractOutput *waylandOutput) { - auto *output = new WaylandQPainterOutput(waylandOutput, this); + auto *output = new WaylandQPainterOutput(static_cast(waylandOutput), this); output->init(m_backend->shmPool()); m_outputs << output; } diff --git a/plugins/platforms/wayland/scene_qpainter_wayland_backend.h b/plugins/platforms/wayland/scene_qpainter_wayland_backend.h index 5128ae1ffc..e5bcc4531e 100644 --- a/plugins/platforms/wayland/scene_qpainter_wayland_backend.h +++ b/plugins/platforms/wayland/scene_qpainter_wayland_backend.h @@ -27,6 +27,7 @@ class Buffer; namespace KWin { +class AbstractOutput; namespace Wayland { class WaylandBackend; @@ -79,7 +80,7 @@ public: bool perScreenRendering() const override; private: - void createOutput(WaylandOutput *waylandOutput); + void createOutput(AbstractOutput *waylandOutput); void frameRendered(); WaylandBackend *m_backend; diff --git a/plugins/platforms/wayland/wayland_backend.h b/plugins/platforms/wayland/wayland_backend.h index c694084d98..643896ef0c 100644 --- a/plugins/platforms/wayland/wayland_backend.h +++ b/plugins/platforms/wayland/wayland_backend.h @@ -203,9 +203,6 @@ public: } Q_SIGNALS: - void outputAdded(WaylandOutput *output); - void outputRemoved(WaylandOutput *output); - void systemCompositorDied(); void connectionFailed();