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/display.h>
|
||||||
#include <KWayland/Server/output_interface.h>
|
#include <KWayland/Server/output_interface.h>
|
||||||
#include <KWayland/Server/outputchangeset.h>
|
#include <KWayland/Server/outputchangeset.h>
|
||||||
#include <KWayland/Server/outputdevice_interface.h>
|
|
||||||
#include <KWayland/Server/xdgoutput_interface.h>
|
#include <KWayland/Server/xdgoutput_interface.h>
|
||||||
// KF5
|
// KF5
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
|
@ -105,9 +104,32 @@ void AbstractOutput::setScale(qreal scale)
|
||||||
|
|
||||||
void AbstractOutput::setChanges(KWayland::Server::OutputChangeSet *changes)
|
void AbstractOutput::setChanges(KWayland::Server::OutputChangeSet *changes)
|
||||||
{
|
{
|
||||||
m_changeset = changes;
|
qCDebug(KWIN_CORE) << "Set changes in AbstractOutput.";
|
||||||
qCDebug(KWIN_CORE) << "set changes in AbstractOutput";
|
Q_ASSERT(!m_waylandOutputDevice.isNull());
|
||||||
commitChanges();
|
|
||||||
|
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()
|
void AbstractOutput::createXdgOutput()
|
||||||
|
|
|
@ -30,6 +30,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
|
#include <KWayland/Server/outputdevice_interface.h>
|
||||||
|
|
||||||
namespace KWayland
|
namespace KWayland
|
||||||
{
|
{
|
||||||
namespace Server
|
namespace Server
|
||||||
|
@ -88,7 +90,6 @@ public:
|
||||||
* This sets the changes and tests them against the specific output
|
* This sets the changes and tests them against the specific output
|
||||||
*/
|
*/
|
||||||
void setChanges(KWayland::Server::OutputChangeSet *changeset);
|
void setChanges(KWayland::Server::OutputChangeSet *changeset);
|
||||||
virtual bool commitChanges() { return false; }
|
|
||||||
|
|
||||||
QPointer<KWayland::Server::OutputInterface> waylandOutput() const {
|
QPointer<KWayland::Server::OutputInterface> waylandOutput() const {
|
||||||
return m_waylandOutput;
|
return m_waylandOutput;
|
||||||
|
@ -103,9 +104,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QPointer<KWayland::Server::OutputChangeSet> changes() const {
|
void initWaylandOutput();
|
||||||
return m_changeset;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPointer<KWayland::Server::XdgOutputInterface> xdgOutput() const {
|
QPointer<KWayland::Server::XdgOutputInterface> xdgOutput() const {
|
||||||
return m_xdgOutput;
|
return m_xdgOutput;
|
||||||
|
@ -137,10 +136,14 @@ protected:
|
||||||
void setInternal(bool set) {
|
void setInternal(bool set) {
|
||||||
m_internal = 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:
|
private:
|
||||||
QPointer<KWayland::Server::OutputChangeSet> m_changeset;
|
|
||||||
QPointer<KWayland::Server::OutputInterface> m_waylandOutput;
|
QPointer<KWayland::Server::OutputInterface> m_waylandOutput;
|
||||||
QPointer<KWayland::Server::XdgOutputInterface> m_xdgOutput;
|
QPointer<KWayland::Server::XdgOutputInterface> m_xdgOutput;
|
||||||
QPointer<KWayland::Server::OutputDeviceInterface> m_waylandOutputDevice;
|
QPointer<KWayland::Server::OutputDeviceInterface> m_waylandOutputDevice;
|
||||||
|
|
|
@ -752,40 +752,6 @@ int DrmOutput::currentRefreshRate() const
|
||||||
return wlOutput->refreshRate();
|
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)
|
void DrmOutput::transform(KWayland::Server::OutputDeviceInterface::Transform transform)
|
||||||
{
|
{
|
||||||
waylandOutputDevice()->setTransform(transform);
|
waylandOutputDevice()->setTransform(transform);
|
||||||
|
|
|
@ -31,8 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <xf86drmMode.h>
|
#include <xf86drmMode.h>
|
||||||
|
|
||||||
#include <KWayland/Server/outputdevice_interface.h>
|
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -75,8 +73,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void setEnabled(bool enabled);
|
void setEnabled(bool enabled);
|
||||||
|
|
||||||
bool commitChanges() override;
|
|
||||||
|
|
||||||
QSize pixelSize() const override;
|
QSize pixelSize() const override;
|
||||||
|
|
||||||
int currentRefreshRate() const;
|
int currentRefreshRate() const;
|
||||||
|
@ -135,9 +131,9 @@ private:
|
||||||
void dpmsOffHandler();
|
void dpmsOffHandler();
|
||||||
bool dpmsAtomicOff();
|
bool dpmsAtomicOff();
|
||||||
bool atomicReqModesetPopulate(drmModeAtomicReq *req, bool enable);
|
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();
|
void automaticRotation();
|
||||||
|
|
||||||
int getGammaRampSize() const override;
|
int getGammaRampSize() const override;
|
||||||
|
|
Loading…
Reference in a new issue