Commit 110f896a authored by Daniel Vrátil's avatar Daniel Vrátil 🤖 Committed by David Edmundson
Browse files

Add serial number and EISA ID to OutputDevice interface

Reviewers: graesslin, sebas, #kwin, dvratil, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kde-frameworks-devel, davidedmundson, plasma-devel

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D10040
parent 84a3330b
......@@ -63,6 +63,9 @@ private:
KWayland::Server::Display *m_display;
KWayland::Server::OutputDeviceInterface *m_serverOutputDevice;
QByteArray m_edid;
QString m_serialNumber;
QString m_eidaId;
KWayland::Server::OutputDeviceInterface::ColorCurves m_initColorCurves;
KWayland::Client::ConnectionThread *m_connection;
KWayland::Client::EventQueue *m_queue;
......@@ -117,6 +120,11 @@ void TestWaylandOutputDevice::init()
m_edid = QByteArray::fromBase64("AP///////wAQrBbwTExLQQ4WAQOANCB46h7Frk80sSYOUFSlSwCBgKlA0QBxTwEBAQEBAQEBKDyAoHCwI0AwIDYABkQhAAAaAAAA/wBGNTI1TTI0NUFLTEwKAAAA/ABERUxMIFUyNDEwCiAgAAAA/QA4TB5REQAKICAgICAgAToCAynxUJAFBAMCBxYBHxITFCAVEQYjCQcHZwMMABAAOC2DAQAA4wUDAQI6gBhxOC1AWCxFAAZEIQAAHgEdgBhxHBYgWCwlAAZEIQAAngEdAHJR0B4gbihVAAZEIQAAHowK0Iog4C0QED6WAAZEIQAAGAAAAAAAAAAAAAAAAAAAPg==");
m_serverOutputDevice->setEdid(m_edid);
m_serialNumber = "23498723948723";
m_serverOutputDevice->setSerialNumber(m_serialNumber);
m_eidaId = "asdffoo";
m_serverOutputDevice->setEisaId(m_eidaId);
m_initColorCurves.red.clear();
m_initColorCurves.green.clear();
m_initColorCurves.blue.clear();
......@@ -207,6 +215,9 @@ void TestWaylandOutputDevice::testRegistry()
QCOMPARE(output.transform(), KWayland::Client::OutputDevice::Transform::Normal);
QCOMPARE(output.enabled(), OutputDevice::Enablement::Enabled);
QCOMPARE(output.edid(), QByteArray());
QCOMPARE(output.eisaId(), QString());
QCOMPARE(output.serialNumber(), QString());
QSignalSpy outputChanged(&output, &KWayland::Client::OutputDevice::done);
QVERIFY(outputChanged.isValid());
......@@ -234,7 +245,8 @@ void TestWaylandOutputDevice::testRegistry()
QCOMPARE(output.edid(), m_edid);
QCOMPARE(output.enabled(), OutputDevice::Enablement::Enabled);
QCOMPARE(output.uuid(), QByteArray("1337"));
QCOMPARE(output.serialNumber(), m_serialNumber);
QCOMPARE(output.eisaId(), m_eidaId);
}
void TestWaylandOutputDevice::testModeChanges()
......
......@@ -46,6 +46,8 @@ public:
void updateGeometry();
void updateScale();
void updateColorCurves();
void updateSerialNumber();
void updateEisaId();
void sendUuid();
void sendEdid();
......@@ -56,6 +58,8 @@ public:
QString manufacturer = QStringLiteral("org.kde.kwin");
QString model = QStringLiteral("none");
qreal scale = 1.0;
QString serialNumber;
QString eisaId;
SubPixel subPixel = SubPixel::Unknown;
Transform transform = Transform::Normal;
ColorCurves colorCurves;
......@@ -77,6 +81,8 @@ private:
void sendGeometry(wl_resource *resource);
void sendScale(const ResourceData &data);
void sendColorCurves(const ResourceData &data);
void sendEisaId(const ResourceData &data);
void sendSerialNumber(const ResourceData &data);
static const quint32 s_version;
OutputDeviceInterface *q;
......@@ -339,6 +345,8 @@ void OutputDeviceInterface::Private::bind(wl_client *client, uint32_t version, u
sendGeometry(resource);
sendScale(r);
sendColorCurves(r);
sendEisaId(r);
sendSerialNumber(r);
auto currentModeIt = modes.constEnd();
for (auto it = modes.constBegin(); it != modes.constEnd(); ++it) {
......@@ -440,6 +448,23 @@ void OutputDeviceInterface::Private::sendColorCurves(const ResourceData &data)
wl_array_release(&wlBlue);
}
void KWayland::Server::OutputDeviceInterface::Private::sendSerialNumber(const ResourceData &data)
{
if (wl_resource_get_version(data.resource) >= ORG_KDE_KWIN_OUTPUTDEVICE_SERIAL_NUMBER_SINCE_VERSION) {
org_kde_kwin_outputdevice_send_serial_number(data.resource,
qPrintable(serialNumber));
}
}
void KWayland::Server::OutputDeviceInterface::Private::sendEisaId(const ResourceData &data)
{
if (wl_resource_get_version(data.resource) >= ORG_KDE_KWIN_OUTPUTDEVICE_EISA_ID_SINCE_VERSION) {
org_kde_kwin_outputdevice_send_eisa_id(data.resource,
qPrintable(eisaId));
}
}
void OutputDeviceInterface::Private::sendDone(const ResourceData &data)
{
org_kde_kwin_outputdevice_send_done(data.resource);
......@@ -492,6 +517,8 @@ SETTER(setPhysicalSize, const QSize&, physicalSize)
SETTER(setGlobalPosition, const QPoint&, globalPosition)
SETTER(setManufacturer, const QString&, manufacturer)
SETTER(setModel, const QString&, model)
SETTER(setSerialNumber, const QString&, serialNumber)
SETTER(setEisaId, const QString&, eisaId)
SETTER(setSubPixel, SubPixel, subPixel)
SETTER(setTransform, Transform, transform)
......@@ -543,6 +570,18 @@ QString OutputDeviceInterface::model() const
return d->model;
}
QString OutputDeviceInterface::serialNumber() const
{
Q_D();
return d->serialNumber;
}
QString OutputDeviceInterface::eisaId() const
{
Q_D();
return d->eisaId;
}
int OutputDeviceInterface::scale() const
{
Q_D();
......
......@@ -52,6 +52,8 @@ class KWAYLANDSERVER_EXPORT OutputDeviceInterface : public Global
Q_PROPERTY(QPoint globalPosition READ globalPosition WRITE setGlobalPosition NOTIFY globalPositionChanged)
Q_PROPERTY(QString manufacturer READ manufacturer WRITE setManufacturer NOTIFY manufacturerChanged)
Q_PROPERTY(QString model READ model WRITE setModel NOTIFY modelChanged)
Q_PROPERTY(QString serialNumber READ serialNumber WRITE setSerialNumber NOTIFY serialNumberChanged)
Q_PROPERTY(QString eisaId READ eisaId WRITE setEisaId NOTIFY eisaIdChanged)
Q_PROPERTY(QSize pixelSize READ pixelSize NOTIFY pixelSizeChanged)
Q_PROPERTY(int refreshRate READ refreshRate NOTIFY refreshRateChanged)
Q_PROPERTY(qreal scale READ scaleF WRITE setScaleF NOTIFY scaleFChanged)
......@@ -103,6 +105,8 @@ public:
QPoint globalPosition() const;
QString manufacturer() const;
QString model() const;
QString serialNumber() const;
QString eisaId() const;
QSize pixelSize() const;
int refreshRate() const;
int scale() const;
......@@ -121,6 +125,8 @@ public:
void setGlobalPosition(const QPoint &pos);
void setManufacturer(const QString &manufacturer);
void setModel(const QString &model);
void setSerialNumber(const QString &serialNumber);
void setEisaId(const QString &eisaId);
void setScale(int scale);
void setScaleF(qreal scale);
void setSubPixel(SubPixel subPixel);
......@@ -141,6 +147,8 @@ Q_SIGNALS:
void globalPositionChanged(const QPoint&);
void manufacturerChanged(const QString&);
void modelChanged(const QString&);
void serialNumberChanged(const QString&);
void eisaIdChanged(const QString &);
void pixelSizeChanged(const QSize&);
void refreshRateChanged(int);
//@deprecated see scaleChanged(real)
......
Supports Markdown
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