diff --git a/abstract_output.h b/abstract_output.h --- a/abstract_output.h +++ b/abstract_output.h @@ -96,6 +96,14 @@ return m_waylandOutput; } + /** + * Enable or disable the output. + * This differs from updateDpms as it also + * removes the wl_output. + * The default is on. + */ + void setEnabled(bool enable); + virtual int getGammaRampSize() const { return 0; } @@ -155,6 +163,7 @@ virtual void transform(KWayland::Server::OutputDeviceInterface::Transform transform) { Q_UNUSED(transform); } + void setWaylandMode(const QSize &size, int refreshRate); private: diff --git a/abstract_output.cpp b/abstract_output.cpp --- a/abstract_output.cpp +++ b/abstract_output.cpp @@ -132,6 +132,22 @@ } } +void AbstractOutput::setEnabled(bool enable) +{ + if (enable == isEnabled()) { + return; + } + if (enable) { + updateDpms(KWayland::Server::OutputInterface::DpmsMode::On); + initWaylandOutput(); + } else { + updateDpms(KWayland::Server::OutputInterface::DpmsMode::Off); + delete waylandOutput().data(); + } + waylandOutputDevice()->setEnabled(enable ? KWayland::Server::OutputDeviceInterface::Enablement::Enabled : + KWayland::Server::OutputDeviceInterface::Enablement::Disabled); +} + void AbstractOutput::setWaylandMode(const QSize &size, int refreshRate) { if (m_waylandOutput.isNull()) { diff --git a/plugins/platforms/drm/drm_output.h b/plugins/platforms/drm/drm_output.h --- a/plugins/platforms/drm/drm_output.h +++ b/plugins/platforms/drm/drm_output.h @@ -65,14 +65,6 @@ bool present(DrmBuffer *buffer); void pageFlipped(); - /** - * Enable or disable the output. - * This differs from updateDpms as it also - * removes the wl_output - * The default is on - */ - void setEnabled(bool enabled); - QSize pixelSize() const override; int currentRefreshRate() const; diff --git a/plugins/platforms/drm/drm_output.cpp b/plugins/platforms/drm/drm_output.cpp --- a/plugins/platforms/drm/drm_output.cpp +++ b/plugins/platforms/drm/drm_output.cpp @@ -186,22 +186,6 @@ return QSize(m_mode.hdisplay, m_mode.vdisplay); } -void DrmOutput::setEnabled(bool enabled) -{ - if (enabled == isEnabled()) { - return; - } - if (enabled) { - updateDpms(KWayland::Server::OutputInterface::DpmsMode::On); - initWaylandOutput(); - } else { - updateDpms(KWayland::Server::OutputInterface::DpmsMode::Off); - delete waylandOutput().data(); - } - waylandOutputDevice()->setEnabled(enabled ? - KWayland::Server::OutputDeviceInterface::Enablement::Enabled : KWayland::Server::OutputDeviceInterface::Enablement::Disabled); -} - static KWayland::Server::OutputInterface::DpmsMode toWaylandDpmsMode(DrmOutput::DpmsMode mode) { using namespace KWayland::Server;