From c7293d95e0202033e32bf814b09ee18be2f238de Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 30 Jul 2022 15:23:51 +0300 Subject: [PATCH] backends/{x11,virtual}: Allocate render data for all available outputs This makes the behavior of virtual and x11 backend consistent with the drm and the wayland backend and reduces the number of users of the Platform::outputEnabled signal. --- src/backends/virtual/virtual_egl_backend.cpp | 8 +++----- src/backends/virtual/virtual_qpainter_backend.cpp | 8 +++----- .../x11/windowed/x11_windowed_qpainter_backend.cpp | 8 +++----- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/backends/virtual/virtual_egl_backend.cpp b/src/backends/virtual/virtual_egl_backend.cpp index ba0239c352..1129b56982 100644 --- a/src/backends/virtual/virtual_egl_backend.cpp +++ b/src/backends/virtual/virtual_egl_backend.cpp @@ -122,13 +122,11 @@ void VirtualEglBackend::init() const auto outputs = m_backend->outputs(); for (Output *output : outputs) { - if (output->isEnabled()) { - addOutput(output); - } + addOutput(output); } - connect(m_backend, &VirtualBackend::outputEnabled, this, &VirtualEglBackend::addOutput); - connect(m_backend, &VirtualBackend::outputDisabled, this, &VirtualEglBackend::removeOutput); + connect(m_backend, &VirtualBackend::outputAdded, this, &VirtualEglBackend::addOutput); + connect(m_backend, &VirtualBackend::outputRemoved, this, &VirtualEglBackend::removeOutput); } bool VirtualEglBackend::initRenderingContext() diff --git a/src/backends/virtual/virtual_qpainter_backend.cpp b/src/backends/virtual/virtual_qpainter_backend.cpp index 5f24b949b3..9145d0a4d6 100644 --- a/src/backends/virtual/virtual_qpainter_backend.cpp +++ b/src/backends/virtual/virtual_qpainter_backend.cpp @@ -47,14 +47,12 @@ VirtualQPainterBackend::VirtualQPainterBackend(VirtualBackend *backend) : QPainterBackend() , m_backend(backend) { - connect(backend, &VirtualBackend::outputEnabled, this, &VirtualQPainterBackend::addOutput); - connect(backend, &VirtualBackend::outputDisabled, this, &VirtualQPainterBackend::removeOutput); + connect(backend, &VirtualBackend::outputAdded, this, &VirtualQPainterBackend::addOutput); + connect(backend, &VirtualBackend::outputRemoved, this, &VirtualQPainterBackend::removeOutput); const auto outputs = backend->outputs(); for (Output *output : outputs) { - if (output->isEnabled()) { - addOutput(output); - } + addOutput(output); } } diff --git a/src/backends/x11/windowed/x11_windowed_qpainter_backend.cpp b/src/backends/x11/windowed/x11_windowed_qpainter_backend.cpp index 6e468928ec..3de6047b20 100644 --- a/src/backends/x11/windowed/x11_windowed_qpainter_backend.cpp +++ b/src/backends/x11/windowed/x11_windowed_qpainter_backend.cpp @@ -52,13 +52,11 @@ X11WindowedQPainterBackend::X11WindowedQPainterBackend(X11WindowedBackend *backe { const auto outputs = m_backend->outputs(); for (Output *output : outputs) { - if (output->isEnabled()) { - addOutput(output); - } + addOutput(output); } - connect(backend, &X11WindowedBackend::outputEnabled, this, &X11WindowedQPainterBackend::addOutput); - connect(backend, &X11WindowedBackend::outputDisabled, this, &X11WindowedQPainterBackend::removeOutput); + connect(backend, &X11WindowedBackend::outputAdded, this, &X11WindowedQPainterBackend::addOutput); + connect(backend, &X11WindowedBackend::outputRemoved, this, &X11WindowedQPainterBackend::removeOutput); } X11WindowedQPainterBackend::~X11WindowedQPainterBackend()