Commit 93f78c2d authored by Roman Gilg's avatar Roman Gilg

Set outputs enabled in AbstractOutput

Summary:
Nothing hardware specific anymore in setEnabled method,
therefore put it in AbstractOutput.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T10016

Differential Revision: https://phabricator.kde.org/D16790
parent 32a9a618
......@@ -132,6 +132,22 @@ void AbstractOutput::setChanges(KWayland::Server::OutputChangeSet *changes)
}
}
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()) {
......
......@@ -96,6 +96,14 @@ public:
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 @@ protected:
virtual void transform(KWayland::Server::OutputDeviceInterface::Transform transform) {
Q_UNUSED(transform);
}
void setWaylandMode(const QSize &size, int refreshRate);
private:
......
......@@ -186,22 +186,6 @@ QSize DrmOutput::pixelSize() const
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;
......
......@@ -65,14 +65,6 @@ public:
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment