diff --git a/abstract_output.cpp b/abstract_output.cpp index ae8c58502e..c514d731fd 100644 --- a/abstract_output.cpp +++ b/abstract_output.cpp @@ -24,7 +24,6 @@ along with this program. If not, see . #include #include #include -#include #include // KF5 #include @@ -105,9 +104,32 @@ void AbstractOutput::setScale(qreal scale) void AbstractOutput::setChanges(KWayland::Server::OutputChangeSet *changes) { - m_changeset = changes; - qCDebug(KWIN_CORE) << "set changes in AbstractOutput"; - commitChanges(); + qCDebug(KWIN_CORE) << "Set changes in AbstractOutput."; + Q_ASSERT(!m_waylandOutputDevice.isNull()); + + if (!changes) { + qCDebug(KWIN_CORE) << "No changes."; + // No changes to an output is an entirely valid thing + } + //enabledChanged is handled by plugin code + if (changes->modeChanged()) { + qCDebug(KWIN_CORE) << "Setting new mode:" << changes->mode(); + m_waylandOutputDevice->setCurrentMode(changes->mode()); + updateMode(changes->mode()); + } + if (changes->transformChanged()) { + qCDebug(KWIN_CORE) << "Server setting transform: " << (int)(changes->transform()); + transform(changes->transform()); + } + if (changes->positionChanged()) { + qCDebug(KWIN_CORE) << "Server setting position: " << changes->position(); + setGlobalPos(changes->position()); + // may just work already! + } + if (changes->scaleChanged()) { + qCDebug(KWIN_CORE) << "Setting scale:" << changes->scale(); + setScale(changes->scaleF()); + } } void AbstractOutput::createXdgOutput() diff --git a/abstract_output.h b/abstract_output.h index b6ee71a46f..49a1812db1 100644 --- a/abstract_output.h +++ b/abstract_output.h @@ -30,6 +30,8 @@ along with this program. If not, see . #include #include +#include + namespace KWayland { namespace Server @@ -88,7 +90,6 @@ public: * This sets the changes and tests them against the specific output */ void setChanges(KWayland::Server::OutputChangeSet *changeset); - virtual bool commitChanges() { return false; } QPointer waylandOutput() const { return m_waylandOutput; @@ -103,9 +104,7 @@ public: } protected: - QPointer changes() const { - return m_changeset; - } + void initWaylandOutput(); QPointer xdgOutput() const { return m_xdgOutput; @@ -137,10 +136,14 @@ protected: void setInternal(bool set) { m_internal = set; } - void initWaylandOutput(); + virtual void updateMode(int modeIndex) { + Q_UNUSED(modeIndex); + } + virtual void transform(KWayland::Server::OutputDeviceInterface::Transform transform) { + Q_UNUSED(transform); + } private: - QPointer m_changeset; QPointer m_waylandOutput; QPointer m_xdgOutput; QPointer m_waylandOutputDevice; diff --git a/plugins/platforms/drm/drm_output.cpp b/plugins/platforms/drm/drm_output.cpp index 829fe6ddb4..115a520f7d 100644 --- a/plugins/platforms/drm/drm_output.cpp +++ b/plugins/platforms/drm/drm_output.cpp @@ -752,40 +752,6 @@ int DrmOutput::currentRefreshRate() const return wlOutput->refreshRate(); } -bool DrmOutput::commitChanges() -{ - auto wlOutputDevice = waylandOutputDevice(); - Q_ASSERT(!wlOutputDevice.isNull()); - - auto changeset = changes(); - - if (changeset.isNull()) { - qCDebug(KWIN_DRM) << "no changes"; - // No changes to an output is an entirely valid thing - return true; - } - //enabledChanged is handled by drmbackend - if (changeset->modeChanged()) { - qCDebug(KWIN_DRM) << "Setting new mode:" << changeset->mode(); - wlOutputDevice->setCurrentMode(changeset->mode()); - updateMode(changeset->mode()); - } - if (changeset->transformChanged()) { - qCDebug(KWIN_DRM) << "Server setting transform: " << (int)(changeset->transform()); - transform(changeset->transform()); - } - if (changeset->positionChanged()) { - qCDebug(KWIN_DRM) << "Server setting position: " << changeset->position(); - setGlobalPos(changeset->position()); - // may just work already! - } - if (changeset->scaleChanged()) { - qCDebug(KWIN_DRM) << "Setting scale:" << changeset->scale(); - setScale(changeset->scaleF()); - } - return true; -} - void DrmOutput::transform(KWayland::Server::OutputDeviceInterface::Transform transform) { waylandOutputDevice()->setTransform(transform); diff --git a/plugins/platforms/drm/drm_output.h b/plugins/platforms/drm/drm_output.h index b6bb256dba..873b084a1f 100644 --- a/plugins/platforms/drm/drm_output.h +++ b/plugins/platforms/drm/drm_output.h @@ -31,8 +31,6 @@ along with this program. If not, see . #include #include -#include - namespace KWin { @@ -75,8 +73,6 @@ public: */ void setEnabled(bool enabled); - bool commitChanges() override; - QSize pixelSize() const override; int currentRefreshRate() const; @@ -135,9 +131,9 @@ private: void dpmsOffHandler(); bool dpmsAtomicOff(); bool atomicReqModesetPopulate(drmModeAtomicReq *req, bool enable); - void updateMode(int modeIndex); + void updateMode(int modeIndex) override; - void transform(KWayland::Server::OutputDeviceInterface::Transform transform); + void transform(KWayland::Server::OutputDeviceInterface::Transform transform) override; void automaticRotation(); int getGammaRampSize() const override;