Handle Wayland change sets in AbstractOutput
Summary: Move Wayland change set handling to AbstractOutput and create virtual functions to call into the hardware implementation Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: kwin Tags: #kwin Maniphest Tasks: T10016 Differential Revision: https://phabricator.kde.org/D16785
This commit is contained in:
parent
f521d4bbe1
commit
254a807374
4 changed files with 37 additions and 50 deletions
|
@ -24,7 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <KWayland/Server/display.h>
|
||||
#include <KWayland/Server/output_interface.h>
|
||||
#include <KWayland/Server/outputchangeset.h>
|
||||
#include <KWayland/Server/outputdevice_interface.h>
|
||||
#include <KWayland/Server/xdgoutput_interface.h>
|
||||
// KF5
|
||||
#include <KLocalizedString>
|
||||
|
@ -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()
|
||||
|
|
|
@ -30,6 +30,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <QSize>
|
||||
#include <QVector>
|
||||
|
||||
#include <KWayland/Server/outputdevice_interface.h>
|
||||
|
||||
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<KWayland::Server::OutputInterface> waylandOutput() const {
|
||||
return m_waylandOutput;
|
||||
|
@ -103,9 +104,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
QPointer<KWayland::Server::OutputChangeSet> changes() const {
|
||||
return m_changeset;
|
||||
}
|
||||
void initWaylandOutput();
|
||||
|
||||
QPointer<KWayland::Server::XdgOutputInterface> 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<KWayland::Server::OutputChangeSet> m_changeset;
|
||||
QPointer<KWayland::Server::OutputInterface> m_waylandOutput;
|
||||
QPointer<KWayland::Server::XdgOutputInterface> m_xdgOutput;
|
||||
QPointer<KWayland::Server::OutputDeviceInterface> m_waylandOutputDevice;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -31,8 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <QVector>
|
||||
#include <xf86drmMode.h>
|
||||
|
||||
#include <KWayland/Server/outputdevice_interface.h>
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue