wayland/outputinterface: use the same enums as core KWin
This commit is contained in:
parent
4c05db3c30
commit
441266c427
11 changed files with 123 additions and 227 deletions
|
@ -79,7 +79,7 @@ void TestWaylandOutput::init()
|
|||
QCOMPARE(m_serverOutput->pixelSize(), QSize(1024, 768));
|
||||
QCOMPARE(m_serverOutput->refreshRate(), 60000);
|
||||
QCOMPARE(m_serverOutput->isDpmsSupported(), false);
|
||||
QCOMPARE(m_serverOutput->dpmsMode(), OutputInterface::DpmsMode::Off);
|
||||
QCOMPARE(m_serverOutput->dpmsMode(), KWin::Output::DpmsMode::Off);
|
||||
|
||||
// setup connection
|
||||
m_connection = new KWayland::Client::ConnectionThread;
|
||||
|
@ -278,22 +278,22 @@ void TestWaylandOutput::testSubPixel_data()
|
|||
using namespace KWayland::Client;
|
||||
using namespace KWaylandServer;
|
||||
QTest::addColumn<KWayland::Client::Output::SubPixel>("expected");
|
||||
QTest::addColumn<KWaylandServer::OutputInterface::SubPixel>("actual");
|
||||
QTest::addColumn<KWin::Output::SubPixel>("actual");
|
||||
|
||||
QTest::newRow("none") << Output::SubPixel::None << OutputInterface::SubPixel::None;
|
||||
QTest::newRow("horizontal/rgb") << Output::SubPixel::HorizontalRGB << OutputInterface::SubPixel::HorizontalRGB;
|
||||
QTest::newRow("horizontal/bgr") << Output::SubPixel::HorizontalBGR << OutputInterface::SubPixel::HorizontalBGR;
|
||||
QTest::newRow("vertical/rgb") << Output::SubPixel::VerticalRGB << OutputInterface::SubPixel::VerticalRGB;
|
||||
QTest::newRow("vertical/bgr") << Output::SubPixel::VerticalBGR << OutputInterface::SubPixel::VerticalBGR;
|
||||
QTest::newRow("none") << Output::SubPixel::None << KWin::Output::SubPixel::None;
|
||||
QTest::newRow("horizontal/rgb") << Output::SubPixel::HorizontalRGB << KWin::Output::SubPixel::Horizontal_RGB;
|
||||
QTest::newRow("horizontal/bgr") << Output::SubPixel::HorizontalBGR << KWin::Output::SubPixel::Horizontal_BGR;
|
||||
QTest::newRow("vertical/rgb") << Output::SubPixel::VerticalRGB << KWin::Output::SubPixel::Vertical_RGB;
|
||||
QTest::newRow("vertical/bgr") << Output::SubPixel::VerticalBGR << KWin::Output::SubPixel::Vertical_BGR;
|
||||
}
|
||||
|
||||
void TestWaylandOutput::testSubPixel()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
using namespace KWaylandServer;
|
||||
QFETCH(OutputInterface::SubPixel, actual);
|
||||
QCOMPARE(m_serverOutput->subPixel(), OutputInterface::SubPixel::Unknown);
|
||||
QSignalSpy serverSubPixelChangedSpy(m_serverOutput, &OutputInterface::subPixelChanged);
|
||||
QFETCH(KWin::Output::SubPixel, actual);
|
||||
QCOMPARE(m_serverOutput->subPixel(), KWin::Output::SubPixel::Unknown);
|
||||
QSignalSpy serverSubPixelChangedSpy(m_serverOutput, &KWaylandServer::OutputInterface::subPixelChanged);
|
||||
QVERIFY(serverSubPixelChangedSpy.isValid());
|
||||
m_serverOutput->setSubPixel(actual);
|
||||
QCOMPARE(m_serverOutput->subPixel(), actual);
|
||||
|
@ -323,8 +323,8 @@ void TestWaylandOutput::testSubPixel()
|
|||
|
||||
// change back to unknown
|
||||
outputChanged.clear();
|
||||
m_serverOutput->setSubPixel(OutputInterface::SubPixel::Unknown);
|
||||
QCOMPARE(m_serverOutput->subPixel(), OutputInterface::SubPixel::Unknown);
|
||||
m_serverOutput->setSubPixel(KWin::Output::SubPixel::Unknown);
|
||||
QCOMPARE(m_serverOutput->subPixel(), KWin::Output::SubPixel::Unknown);
|
||||
m_serverOutput->done();
|
||||
QCOMPARE(serverSubPixelChangedSpy.count(), 2);
|
||||
if (outputChanged.isEmpty()) {
|
||||
|
@ -338,24 +338,24 @@ void TestWaylandOutput::testTransform_data()
|
|||
using namespace KWayland::Client;
|
||||
using namespace KWaylandServer;
|
||||
QTest::addColumn<KWayland::Client::Output::Transform>("expected");
|
||||
QTest::addColumn<KWaylandServer::OutputInterface::Transform>("actual");
|
||||
QTest::addColumn<KWin::Output::Transform>("actual");
|
||||
|
||||
QTest::newRow("90") << Output::Transform::Rotated90 << OutputInterface::Transform::Rotated90;
|
||||
QTest::newRow("180") << Output::Transform::Rotated180 << OutputInterface::Transform::Rotated180;
|
||||
QTest::newRow("270") << Output::Transform::Rotated270 << OutputInterface::Transform::Rotated270;
|
||||
QTest::newRow("Flipped") << Output::Transform::Flipped << OutputInterface::Transform::Flipped;
|
||||
QTest::newRow("Flipped 90") << Output::Transform::Flipped90 << OutputInterface::Transform::Flipped90;
|
||||
QTest::newRow("Flipped 180") << Output::Transform::Flipped180 << OutputInterface::Transform::Flipped180;
|
||||
QTest::newRow("Flipped 280") << Output::Transform::Flipped270 << OutputInterface::Transform::Flipped270;
|
||||
QTest::newRow("90") << Output::Transform::Rotated90 << KWin::Output::Transform::Rotated90;
|
||||
QTest::newRow("180") << Output::Transform::Rotated180 << KWin::Output::Transform::Rotated180;
|
||||
QTest::newRow("270") << Output::Transform::Rotated270 << KWin::Output::Transform::Rotated270;
|
||||
QTest::newRow("Flipped") << Output::Transform::Flipped << KWin::Output::Transform::Flipped;
|
||||
QTest::newRow("Flipped 90") << Output::Transform::Flipped90 << KWin::Output::Transform::Flipped90;
|
||||
QTest::newRow("Flipped 180") << Output::Transform::Flipped180 << KWin::Output::Transform::Flipped180;
|
||||
QTest::newRow("Flipped 280") << Output::Transform::Flipped270 << KWin::Output::Transform::Flipped270;
|
||||
}
|
||||
|
||||
void TestWaylandOutput::testTransform()
|
||||
{
|
||||
using namespace KWayland::Client;
|
||||
using namespace KWaylandServer;
|
||||
QFETCH(OutputInterface::Transform, actual);
|
||||
QCOMPARE(m_serverOutput->transform(), OutputInterface::Transform::Normal);
|
||||
QSignalSpy serverTransformChangedSpy(m_serverOutput, &OutputInterface::transformChanged);
|
||||
QFETCH(KWin::Output::Transform, actual);
|
||||
QCOMPARE(m_serverOutput->transform(), KWin::Output::Transform::Normal);
|
||||
QSignalSpy serverTransformChangedSpy(m_serverOutput, &KWaylandServer::OutputInterface::transformChanged);
|
||||
QVERIFY(serverTransformChangedSpy.isValid());
|
||||
m_serverOutput->setTransform(actual);
|
||||
QCOMPARE(m_serverOutput->transform(), actual);
|
||||
|
@ -384,8 +384,8 @@ void TestWaylandOutput::testTransform()
|
|||
|
||||
// change back to normal
|
||||
outputChanged.clear();
|
||||
m_serverOutput->setTransform(OutputInterface::Transform::Normal);
|
||||
QCOMPARE(m_serverOutput->transform(), OutputInterface::Transform::Normal);
|
||||
m_serverOutput->setTransform(KWin::Output::Transform::Normal);
|
||||
QCOMPARE(m_serverOutput->transform(), KWin::Output::Transform::Normal);
|
||||
m_serverOutput->done();
|
||||
QCOMPARE(serverTransformChangedSpy.count(), 2);
|
||||
if (outputChanged.isEmpty()) {
|
||||
|
@ -400,11 +400,11 @@ void TestWaylandOutput::testDpms_data()
|
|||
using namespace KWaylandServer;
|
||||
|
||||
QTest::addColumn<KWayland::Client::Dpms::Mode>("client");
|
||||
QTest::addColumn<KWaylandServer::OutputInterface::DpmsMode>("server");
|
||||
QTest::addColumn<KWin::Output::DpmsMode>("server");
|
||||
|
||||
QTest::newRow("Standby") << Dpms::Mode::Standby << OutputInterface::DpmsMode::Standby;
|
||||
QTest::newRow("Suspend") << Dpms::Mode::Suspend << OutputInterface::DpmsMode::Suspend;
|
||||
QTest::newRow("On") << Dpms::Mode::On << OutputInterface::DpmsMode::On;
|
||||
QTest::newRow("Standby") << Dpms::Mode::Standby << KWin::Output::DpmsMode::Standby;
|
||||
QTest::newRow("Suspend") << Dpms::Mode::Suspend << KWin::Output::DpmsMode::Suspend;
|
||||
QTest::newRow("On") << Dpms::Mode::On << KWin::Output::DpmsMode::On;
|
||||
}
|
||||
|
||||
void TestWaylandOutput::testDpms()
|
||||
|
@ -454,13 +454,13 @@ void TestWaylandOutput::testDpms()
|
|||
QCOMPARE(dpms->isSupported(), true);
|
||||
|
||||
// and let's change to suspend
|
||||
QSignalSpy serverDpmsModeChangedSpy(m_serverOutput, &OutputInterface::dpmsModeChanged);
|
||||
QSignalSpy serverDpmsModeChangedSpy(m_serverOutput, &KWaylandServer::OutputInterface::dpmsModeChanged);
|
||||
QVERIFY(serverDpmsModeChangedSpy.isValid());
|
||||
QSignalSpy clientDpmsModeChangedSpy(dpms, &Dpms::modeChanged);
|
||||
QVERIFY(clientDpmsModeChangedSpy.isValid());
|
||||
|
||||
QCOMPARE(m_serverOutput->dpmsMode(), OutputInterface::DpmsMode::Off);
|
||||
QFETCH(OutputInterface::DpmsMode, server);
|
||||
QCOMPARE(m_serverOutput->dpmsMode(), KWin::Output::DpmsMode::Off);
|
||||
QFETCH(KWin::Output::DpmsMode, server);
|
||||
m_serverOutput->setDpmsMode(server);
|
||||
QCOMPARE(m_serverOutput->dpmsMode(), server);
|
||||
QCOMPARE(serverDpmsModeChangedSpy.count(), 1);
|
||||
|
@ -482,7 +482,7 @@ void TestWaylandOutput::testDpms()
|
|||
QVERIFY(dpms->isSupported());
|
||||
|
||||
// and switch back to off
|
||||
m_serverOutput->setDpmsMode(OutputInterface::DpmsMode::Off);
|
||||
m_serverOutput->setDpmsMode(KWin::Output::DpmsMode::Off);
|
||||
QVERIFY(clientDpmsModeChangedSpy.wait());
|
||||
QCOMPARE(clientDpmsModeChangedSpy.count(), 2);
|
||||
QCOMPARE(dpms->mode(), Dpms::Mode::Off);
|
||||
|
@ -494,12 +494,12 @@ void TestWaylandOutput::testDpmsRequestMode_data()
|
|||
using namespace KWaylandServer;
|
||||
|
||||
QTest::addColumn<KWayland::Client::Dpms::Mode>("client");
|
||||
QTest::addColumn<KWaylandServer::OutputInterface::DpmsMode>("server");
|
||||
QTest::addColumn<KWin::Output::DpmsMode>("server");
|
||||
|
||||
QTest::newRow("Standby") << Dpms::Mode::Standby << OutputInterface::DpmsMode::Standby;
|
||||
QTest::newRow("Suspend") << Dpms::Mode::Suspend << OutputInterface::DpmsMode::Suspend;
|
||||
QTest::newRow("Off") << Dpms::Mode::Off << OutputInterface::DpmsMode::Off;
|
||||
QTest::newRow("On") << Dpms::Mode::On << OutputInterface::DpmsMode::On;
|
||||
QTest::newRow("Standby") << Dpms::Mode::Standby << KWin::Output::DpmsMode::Standby;
|
||||
QTest::newRow("Suspend") << Dpms::Mode::Suspend << KWin::Output::DpmsMode::Suspend;
|
||||
QTest::newRow("Off") << Dpms::Mode::Off << KWin::Output::DpmsMode::Off;
|
||||
QTest::newRow("On") << Dpms::Mode::On << KWin::Output::DpmsMode::On;
|
||||
}
|
||||
|
||||
void TestWaylandOutput::testDpmsRequestMode()
|
||||
|
@ -541,13 +541,13 @@ void TestWaylandOutput::testDpmsRequestMode()
|
|||
|
||||
Dpms *dpms = dpmsManager->getDpms(output, ®istry);
|
||||
// and test request mode
|
||||
QSignalSpy modeRequestedSpy(m_serverOutput, &OutputInterface::dpmsModeRequested);
|
||||
QSignalSpy modeRequestedSpy(m_serverOutput, &KWaylandServer::OutputInterface::dpmsModeRequested);
|
||||
QVERIFY(modeRequestedSpy.isValid());
|
||||
|
||||
QFETCH(Dpms::Mode, client);
|
||||
dpms->requestMode(client);
|
||||
QVERIFY(modeRequestedSpy.wait());
|
||||
QTEST(modeRequestedSpy.last().first().value<OutputInterface::DpmsMode>(), "server");
|
||||
QTEST(modeRequestedSpy.last().first().value<KWin::Output::DpmsMode>(), "server");
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(TestWaylandOutput)
|
||||
|
|
|
@ -50,7 +50,7 @@ DpmsInterface::DpmsInterface(OutputInterface *output, wl_resource *resource)
|
|||
sendSupported();
|
||||
sendDone();
|
||||
});
|
||||
connect(output, &OutputInterface::dpmsModeChanged, this, [this] {
|
||||
connect(output, &KWaylandServer::OutputInterface::dpmsModeChanged, this, [this] {
|
||||
sendMode();
|
||||
sendDone();
|
||||
});
|
||||
|
@ -72,19 +72,19 @@ void DpmsInterface::org_kde_kwin_dpms_destroy_resource(Resource *resource)
|
|||
void DpmsInterface::org_kde_kwin_dpms_set(Resource *resource, uint32_t mode)
|
||||
{
|
||||
Q_UNUSED(resource)
|
||||
OutputInterface::DpmsMode dpmsMode;
|
||||
KWin::Output::DpmsMode dpmsMode;
|
||||
switch (mode) {
|
||||
case ORG_KDE_KWIN_DPMS_MODE_ON:
|
||||
dpmsMode = OutputInterface::DpmsMode::On;
|
||||
dpmsMode = KWin::Output::DpmsMode::On;
|
||||
break;
|
||||
case ORG_KDE_KWIN_DPMS_MODE_STANDBY:
|
||||
dpmsMode = OutputInterface::DpmsMode::Standby;
|
||||
dpmsMode = KWin::Output::DpmsMode::Standby;
|
||||
break;
|
||||
case ORG_KDE_KWIN_DPMS_MODE_SUSPEND:
|
||||
dpmsMode = OutputInterface::DpmsMode::Suspend;
|
||||
dpmsMode = KWin::Output::DpmsMode::Suspend;
|
||||
break;
|
||||
case ORG_KDE_KWIN_DPMS_MODE_OFF:
|
||||
dpmsMode = OutputInterface::DpmsMode::Off;
|
||||
dpmsMode = KWin::Output::DpmsMode::Off;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@ -102,16 +102,16 @@ void DpmsInterface::sendMode()
|
|||
const auto mode = output->dpmsMode();
|
||||
org_kde_kwin_dpms_mode wlMode;
|
||||
switch (mode) {
|
||||
case OutputInterface::DpmsMode::On:
|
||||
case KWin::Output::DpmsMode::On:
|
||||
wlMode = ORG_KDE_KWIN_DPMS_MODE_ON;
|
||||
break;
|
||||
case OutputInterface::DpmsMode::Standby:
|
||||
case KWin::Output::DpmsMode::Standby:
|
||||
wlMode = ORG_KDE_KWIN_DPMS_MODE_STANDBY;
|
||||
break;
|
||||
case OutputInterface::DpmsMode::Suspend:
|
||||
case KWin::Output::DpmsMode::Suspend:
|
||||
wlMode = ORG_KDE_KWIN_DPMS_MODE_SUSPEND;
|
||||
break;
|
||||
case OutputInterface::DpmsMode::Off:
|
||||
case KWin::Output::DpmsMode::Off:
|
||||
wlMode = ORG_KDE_KWIN_DPMS_MODE_OFF;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -34,13 +34,13 @@ class DpmsManagerInterfacePrivate;
|
|||
* @code
|
||||
* // We have our OutputInterface called output.
|
||||
* output->setDpmsSupported(true);
|
||||
* output->setDpmsMode(OutputInterface::DpmsMode::On);
|
||||
* output->setDpmsMode(KWin::Output::DpmsMode::On);
|
||||
* @endcode
|
||||
*
|
||||
* To connect to Dpms change requests use:
|
||||
* @code
|
||||
* connect(output, &OutputInterface::dpmsModeRequested,
|
||||
* [] (KWaylandServer::OutputInterface::DpmsMode requestedMode) { qDebug() << "Mode change requested"; });
|
||||
* connect(output, &KWin::Output::DpmsModeRequested,
|
||||
* [] (KWaylandServer::KWin::Output::DpmsMode requestedMode) { qDebug() << "Mode change requested"; });
|
||||
* @endcode
|
||||
*
|
||||
* @see Display
|
||||
|
|
|
@ -37,12 +37,12 @@ public:
|
|||
QString manufacturer = QStringLiteral("org.kde.kwin");
|
||||
QString model = QStringLiteral("none");
|
||||
int scale = 1;
|
||||
OutputInterface::SubPixel subPixel = OutputInterface::SubPixel::Unknown;
|
||||
OutputInterface::Transform transform = OutputInterface::Transform::Normal;
|
||||
KWin::Output::SubPixel subPixel = KWin::Output::SubPixel::Unknown;
|
||||
KWin::Output::Transform transform = KWin::Output::Transform::Normal;
|
||||
OutputInterface::Mode mode;
|
||||
struct
|
||||
{
|
||||
OutputInterface::DpmsMode mode = OutputInterface::DpmsMode::Off;
|
||||
KWin::Output::DpmsMode mode = KWin::Output::DpmsMode::Off;
|
||||
bool supported = false;
|
||||
} dpms;
|
||||
|
||||
|
@ -71,44 +71,44 @@ void OutputInterfacePrivate::sendScale(Resource *resource)
|
|||
}
|
||||
}
|
||||
|
||||
static quint32 kwaylandServerTransformToWaylandTransform(OutputInterface::Transform transform)
|
||||
static quint32 kwaylandServerTransformToWaylandTransform(KWin::Output::Transform transform)
|
||||
{
|
||||
switch (transform) {
|
||||
case OutputInterface::Transform::Normal:
|
||||
case KWin::Output::Transform::Normal:
|
||||
return OutputInterfacePrivate::transform_normal;
|
||||
case OutputInterface::Transform::Rotated90:
|
||||
case KWin::Output::Transform::Rotated90:
|
||||
return OutputInterfacePrivate::transform_90;
|
||||
case OutputInterface::Transform::Rotated180:
|
||||
case KWin::Output::Transform::Rotated180:
|
||||
return OutputInterfacePrivate::transform_180;
|
||||
case OutputInterface::Transform::Rotated270:
|
||||
case KWin::Output::Transform::Rotated270:
|
||||
return OutputInterfacePrivate::transform_270;
|
||||
case OutputInterface::Transform::Flipped:
|
||||
case KWin::Output::Transform::Flipped:
|
||||
return OutputInterfacePrivate::transform_flipped;
|
||||
case OutputInterface::Transform::Flipped90:
|
||||
case KWin::Output::Transform::Flipped90:
|
||||
return OutputInterfacePrivate::transform_flipped_90;
|
||||
case OutputInterface::Transform::Flipped180:
|
||||
case KWin::Output::Transform::Flipped180:
|
||||
return OutputInterfacePrivate::transform_flipped_180;
|
||||
case OutputInterface::Transform::Flipped270:
|
||||
case KWin::Output::Transform::Flipped270:
|
||||
return OutputInterfacePrivate::transform_flipped_270;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
static quint32 kwaylandServerSubPixelToWaylandSubPixel(OutputInterface::SubPixel subPixel)
|
||||
static quint32 kwaylandServerSubPixelToWaylandSubPixel(KWin::Output::SubPixel subPixel)
|
||||
{
|
||||
switch (subPixel) {
|
||||
case OutputInterface::SubPixel::Unknown:
|
||||
case KWin::Output::SubPixel::Unknown:
|
||||
return OutputInterfacePrivate::subpixel_unknown;
|
||||
case OutputInterface::SubPixel::None:
|
||||
case KWin::Output::SubPixel::None:
|
||||
return OutputInterfacePrivate::subpixel_none;
|
||||
case OutputInterface::SubPixel::HorizontalRGB:
|
||||
case KWin::Output::SubPixel::Horizontal_RGB:
|
||||
return OutputInterfacePrivate::subpixel_horizontal_rgb;
|
||||
case OutputInterface::SubPixel::HorizontalBGR:
|
||||
case KWin::Output::SubPixel::Horizontal_BGR:
|
||||
return OutputInterfacePrivate::subpixel_horizontal_bgr;
|
||||
case OutputInterface::SubPixel::VerticalRGB:
|
||||
case KWin::Output::SubPixel::Vertical_RGB:
|
||||
return OutputInterfacePrivate::subpixel_vertical_rgb;
|
||||
case OutputInterface::SubPixel::VerticalBGR:
|
||||
case KWin::Output::SubPixel::Vertical_BGR:
|
||||
return OutputInterfacePrivate::subpixel_vertical_bgr;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
|
@ -312,12 +312,12 @@ void OutputInterface::setScale(int scale)
|
|||
Q_EMIT scaleChanged(d->scale);
|
||||
}
|
||||
|
||||
OutputInterface::SubPixel OutputInterface::subPixel() const
|
||||
KWin::Output::SubPixel OutputInterface::subPixel() const
|
||||
{
|
||||
return d->subPixel;
|
||||
}
|
||||
|
||||
void OutputInterface::setSubPixel(SubPixel subPixel)
|
||||
void OutputInterface::setSubPixel(KWin::Output::SubPixel subPixel)
|
||||
{
|
||||
if (d->subPixel == subPixel) {
|
||||
return;
|
||||
|
@ -327,12 +327,12 @@ void OutputInterface::setSubPixel(SubPixel subPixel)
|
|||
Q_EMIT subPixelChanged(d->subPixel);
|
||||
}
|
||||
|
||||
OutputInterface::Transform OutputInterface::transform() const
|
||||
KWin::Output::Transform OutputInterface::transform() const
|
||||
{
|
||||
return d->transform;
|
||||
}
|
||||
|
||||
void OutputInterface::setTransform(Transform transform)
|
||||
void OutputInterface::setTransform(KWin::Output::Transform transform)
|
||||
{
|
||||
if (d->transform == transform) {
|
||||
return;
|
||||
|
@ -342,7 +342,7 @@ void OutputInterface::setTransform(Transform transform)
|
|||
Q_EMIT transformChanged(d->transform);
|
||||
}
|
||||
|
||||
void OutputInterface::setDpmsMode(OutputInterface::DpmsMode mode)
|
||||
void OutputInterface::setDpmsMode(KWin::Output::DpmsMode mode)
|
||||
{
|
||||
if (d->dpms.mode == mode) {
|
||||
return;
|
||||
|
@ -360,7 +360,7 @@ void OutputInterface::setDpmsSupported(bool supported)
|
|||
Q_EMIT dpmsSupportedChanged();
|
||||
}
|
||||
|
||||
OutputInterface::DpmsMode OutputInterface::dpmsMode() const
|
||||
KWin::Output::DpmsMode OutputInterface::dpmsMode() const
|
||||
{
|
||||
return d->dpms.mode;
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ bool OutputInterface::isEnabled() const
|
|||
if (!d->dpms.supported) {
|
||||
return true;
|
||||
}
|
||||
return d->dpms.mode == DpmsMode::On;
|
||||
return d->dpms.mode == KWin::Output::DpmsMode::On;
|
||||
}
|
||||
|
||||
void OutputInterface::done()
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "kwin_export.h"
|
||||
#include "output.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QPoint>
|
||||
|
@ -36,35 +37,11 @@ class KWIN_EXPORT OutputInterface : public QObject
|
|||
Q_PROPERTY(int refreshRate READ refreshRate NOTIFY refreshRateChanged)
|
||||
Q_PROPERTY(int scale READ scale WRITE setScale NOTIFY scaleChanged)
|
||||
public:
|
||||
enum class SubPixel {
|
||||
Unknown,
|
||||
None,
|
||||
HorizontalRGB,
|
||||
HorizontalBGR,
|
||||
VerticalRGB,
|
||||
VerticalBGR,
|
||||
};
|
||||
enum class Transform {
|
||||
Normal,
|
||||
Rotated90,
|
||||
Rotated180,
|
||||
Rotated270,
|
||||
Flipped,
|
||||
Flipped90,
|
||||
Flipped180,
|
||||
Flipped270,
|
||||
};
|
||||
struct Mode
|
||||
{
|
||||
QSize size = QSize();
|
||||
int refreshRate = 60000;
|
||||
};
|
||||
enum class DpmsMode {
|
||||
On,
|
||||
Standby,
|
||||
Suspend,
|
||||
Off,
|
||||
};
|
||||
|
||||
explicit OutputInterface(Display *display, QObject *parent = nullptr);
|
||||
~OutputInterface() override;
|
||||
|
@ -78,19 +55,19 @@ public:
|
|||
QSize pixelSize() const;
|
||||
int refreshRate() const;
|
||||
int scale() const;
|
||||
SubPixel subPixel() const;
|
||||
Transform transform() const;
|
||||
KWin::Output::SubPixel subPixel() const;
|
||||
KWin::Output::Transform transform() const;
|
||||
Mode mode() const;
|
||||
bool isDpmsSupported() const;
|
||||
DpmsMode dpmsMode() const;
|
||||
KWin::Output::DpmsMode dpmsMode() const;
|
||||
|
||||
void setPhysicalSize(const QSize &size);
|
||||
void setGlobalPosition(const QPoint &pos);
|
||||
void setManufacturer(const QString &manufacturer);
|
||||
void setModel(const QString &model);
|
||||
void setScale(int scale);
|
||||
void setSubPixel(SubPixel subPixel);
|
||||
void setTransform(Transform transform);
|
||||
void setSubPixel(KWin::Output::SubPixel subPixel);
|
||||
void setTransform(KWin::Output::Transform transform);
|
||||
void setMode(const Mode &mode);
|
||||
void setMode(const QSize &size, int refreshRate = 60000);
|
||||
|
||||
|
@ -103,7 +80,7 @@ public:
|
|||
* Sets the currently used dpms mode.
|
||||
* Default is @c DpmsMode::On.
|
||||
*/
|
||||
void setDpmsMode(DpmsMode mode);
|
||||
void setDpmsMode(KWin::Output::DpmsMode mode);
|
||||
|
||||
/**
|
||||
* @returns all wl_resources bound for the @p client
|
||||
|
@ -135,8 +112,8 @@ Q_SIGNALS:
|
|||
void pixelSizeChanged(const QSize &);
|
||||
void refreshRateChanged(int);
|
||||
void scaleChanged(int);
|
||||
void subPixelChanged(SubPixel);
|
||||
void transformChanged(Transform);
|
||||
void subPixelChanged(KWin::Output::SubPixel);
|
||||
void transformChanged(KWin::Output::Transform);
|
||||
void modeChanged();
|
||||
void dpmsModeChanged();
|
||||
void dpmsSupportedChanged();
|
||||
|
@ -146,7 +123,7 @@ Q_SIGNALS:
|
|||
* Change of dpms @p mode is requested.
|
||||
* A server is free to ignore this request.
|
||||
*/
|
||||
void dpmsModeRequested(KWaylandServer::OutputInterface::DpmsMode mode);
|
||||
void dpmsModeRequested(KWin::Output::DpmsMode mode);
|
||||
|
||||
/**
|
||||
* Emitted when a client binds to a given output
|
||||
|
@ -159,7 +136,3 @@ private:
|
|||
};
|
||||
|
||||
} // namespace KWaylandServer
|
||||
|
||||
Q_DECLARE_METATYPE(KWaylandServer::OutputInterface::SubPixel)
|
||||
Q_DECLARE_METATYPE(KWaylandServer::OutputInterface::Transform)
|
||||
Q_DECLARE_METATYPE(KWaylandServer::OutputInterface::DpmsMode)
|
||||
|
|
|
@ -313,7 +313,7 @@ void SurfaceInterfacePrivate::surface_set_buffer_transform(Resource *resource, i
|
|||
wl_resource_post_error(resource->handle, error_invalid_transform, "buffer transform must be a valid transform (%d specified)", transform);
|
||||
return;
|
||||
}
|
||||
pending.bufferTransform = OutputInterface::Transform(transform);
|
||||
pending.bufferTransform = KWin::Output::Transform(transform);
|
||||
pending.bufferTransformIsSet = true;
|
||||
}
|
||||
|
||||
|
@ -409,34 +409,34 @@ QMatrix4x4 SurfaceInterfacePrivate::buildSurfaceToBufferMatrix()
|
|||
surfaceToBufferMatrix.scale(current.bufferScale, current.bufferScale);
|
||||
|
||||
switch (current.bufferTransform) {
|
||||
case OutputInterface::Transform::Normal:
|
||||
case OutputInterface::Transform::Flipped:
|
||||
case KWin::Output::Transform::Normal:
|
||||
case KWin::Output::Transform::Flipped:
|
||||
break;
|
||||
case OutputInterface::Transform::Rotated90:
|
||||
case OutputInterface::Transform::Flipped90:
|
||||
case KWin::Output::Transform::Rotated90:
|
||||
case KWin::Output::Transform::Flipped90:
|
||||
surfaceToBufferMatrix.translate(0, bufferSize.height() / current.bufferScale);
|
||||
surfaceToBufferMatrix.rotate(-90, 0, 0, 1);
|
||||
break;
|
||||
case OutputInterface::Transform::Rotated180:
|
||||
case OutputInterface::Transform::Flipped180:
|
||||
case KWin::Output::Transform::Rotated180:
|
||||
case KWin::Output::Transform::Flipped180:
|
||||
surfaceToBufferMatrix.translate(bufferSize.width() / current.bufferScale, bufferSize.height() / current.bufferScale);
|
||||
surfaceToBufferMatrix.rotate(-180, 0, 0, 1);
|
||||
break;
|
||||
case OutputInterface::Transform::Rotated270:
|
||||
case OutputInterface::Transform::Flipped270:
|
||||
case KWin::Output::Transform::Rotated270:
|
||||
case KWin::Output::Transform::Flipped270:
|
||||
surfaceToBufferMatrix.translate(bufferSize.width() / current.bufferScale, 0);
|
||||
surfaceToBufferMatrix.rotate(-270, 0, 0, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (current.bufferTransform) {
|
||||
case OutputInterface::Transform::Flipped:
|
||||
case OutputInterface::Transform::Flipped180:
|
||||
case KWin::Output::Transform::Flipped:
|
||||
case KWin::Output::Transform::Flipped180:
|
||||
surfaceToBufferMatrix.translate(bufferSize.width() / current.bufferScale, 0);
|
||||
surfaceToBufferMatrix.scale(-1, 1);
|
||||
break;
|
||||
case OutputInterface::Transform::Flipped90:
|
||||
case OutputInterface::Transform::Flipped270:
|
||||
case KWin::Output::Transform::Flipped90:
|
||||
case KWin::Output::Transform::Flipped270:
|
||||
surfaceToBufferMatrix.translate(bufferSize.height() / current.bufferScale, 0);
|
||||
surfaceToBufferMatrix.scale(-1, 1);
|
||||
break;
|
||||
|
@ -570,16 +570,16 @@ void SurfaceInterfacePrivate::applyState(SurfaceState *next)
|
|||
|
||||
implicitSurfaceSize = current.buffer->size() / current.bufferScale;
|
||||
switch (current.bufferTransform) {
|
||||
case OutputInterface::Transform::Rotated90:
|
||||
case OutputInterface::Transform::Rotated270:
|
||||
case OutputInterface::Transform::Flipped90:
|
||||
case OutputInterface::Transform::Flipped270:
|
||||
case KWin::Output::Transform::Rotated90:
|
||||
case KWin::Output::Transform::Rotated270:
|
||||
case KWin::Output::Transform::Flipped90:
|
||||
case KWin::Output::Transform::Flipped270:
|
||||
implicitSurfaceSize.transpose();
|
||||
break;
|
||||
case OutputInterface::Transform::Normal:
|
||||
case OutputInterface::Transform::Rotated180:
|
||||
case OutputInterface::Transform::Flipped:
|
||||
case OutputInterface::Transform::Flipped180:
|
||||
case KWin::Output::Transform::Normal:
|
||||
case KWin::Output::Transform::Rotated180:
|
||||
case KWin::Output::Transform::Flipped:
|
||||
case KWin::Output::Transform::Flipped180:
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -753,7 +753,7 @@ qint32 SurfaceInterface::bufferScale() const
|
|||
return d->current.bufferScale;
|
||||
}
|
||||
|
||||
OutputInterface::Transform SurfaceInterface::bufferTransform() const
|
||||
KWin::Output::Transform SurfaceInterface::bufferTransform() const
|
||||
{
|
||||
return d->current.bufferTransform;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ class KWIN_EXPORT SurfaceInterface : public QObject
|
|||
*/
|
||||
Q_PROPERTY(QRegion input READ input NOTIFY inputChanged)
|
||||
Q_PROPERTY(qint32 bufferScale READ bufferScale NOTIFY bufferScaleChanged)
|
||||
Q_PROPERTY(KWaylandServer::OutputInterface::Transform bufferTransform READ bufferTransform NOTIFY bufferTransformChanged)
|
||||
Q_PROPERTY(KWin::Output::Transform bufferTransform READ bufferTransform NOTIFY bufferTransformChanged)
|
||||
Q_PROPERTY(QSize size READ size NOTIFY sizeChanged)
|
||||
public:
|
||||
explicit SurfaceInterface(CompositorInterface *compositor, wl_resource *resource);
|
||||
|
@ -169,7 +169,7 @@ public:
|
|||
* If the surface is on an output that is rotated 90 degrees clockwise, the buffer will
|
||||
* be rotated 90 degrees counter clockwise.
|
||||
*/
|
||||
OutputInterface::Transform bufferTransform() const;
|
||||
KWin::Output::Transform bufferTransform() const;
|
||||
/**
|
||||
* @returns the current ClientBuffer, might be @c nullptr.
|
||||
*/
|
||||
|
@ -352,7 +352,7 @@ Q_SIGNALS:
|
|||
/**
|
||||
* This signal is emitted when the buffer transform has changed.
|
||||
*/
|
||||
void bufferTransformChanged(KWaylandServer::OutputInterface::Transform);
|
||||
void bufferTransformChanged(KWin::Output::Transform);
|
||||
/**
|
||||
* This signal is emitted when the size of the attached buffer has changed.
|
||||
*/
|
||||
|
|
|
@ -39,7 +39,7 @@ struct SurfaceState
|
|||
bool bufferScaleIsSet = false;
|
||||
bool bufferTransformIsSet = false;
|
||||
qint32 bufferScale = 1;
|
||||
OutputInterface::Transform bufferTransform = OutputInterface::Transform::Normal;
|
||||
KWin::Output::Transform bufferTransform = KWin::Output::Transform::Normal;
|
||||
wl_list frameCallbacks;
|
||||
QPoint offset = QPoint();
|
||||
QPointer<ClientBuffer> buffer;
|
||||
|
|
|
@ -201,7 +201,6 @@ WaylandServer::WaylandServer(QObject *parent)
|
|||
: QObject(parent)
|
||||
, m_display(new KWinDisplay(this))
|
||||
{
|
||||
qRegisterMetaType<KWaylandServer::OutputInterface::DpmsMode>();
|
||||
}
|
||||
|
||||
WaylandServer::~WaylandServer()
|
||||
|
|
|
@ -12,82 +12,6 @@
|
|||
namespace KWin
|
||||
{
|
||||
|
||||
static KWaylandServer::OutputInterface::Transform kwinTransformToOutputTransform(Output::Transform transform)
|
||||
{
|
||||
switch (transform) {
|
||||
case Output::Transform::Normal:
|
||||
return KWaylandServer::OutputInterface::Transform::Normal;
|
||||
case Output::Transform::Rotated90:
|
||||
return KWaylandServer::OutputInterface::Transform::Rotated90;
|
||||
case Output::Transform::Rotated180:
|
||||
return KWaylandServer::OutputInterface::Transform::Rotated180;
|
||||
case Output::Transform::Rotated270:
|
||||
return KWaylandServer::OutputInterface::Transform::Rotated270;
|
||||
case Output::Transform::Flipped:
|
||||
return KWaylandServer::OutputInterface::Transform::Flipped;
|
||||
case Output::Transform::Flipped90:
|
||||
return KWaylandServer::OutputInterface::Transform::Flipped90;
|
||||
case Output::Transform::Flipped180:
|
||||
return KWaylandServer::OutputInterface::Transform::Flipped180;
|
||||
case Output::Transform::Flipped270:
|
||||
return KWaylandServer::OutputInterface::Transform::Flipped270;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
static KWaylandServer::OutputInterface::SubPixel kwinSubPixelToOutputSubPixel(Output::SubPixel subPixel)
|
||||
{
|
||||
switch (subPixel) {
|
||||
case Output::SubPixel::Unknown:
|
||||
return KWaylandServer::OutputInterface::SubPixel::Unknown;
|
||||
case Output::SubPixel::None:
|
||||
return KWaylandServer::OutputInterface::SubPixel::None;
|
||||
case Output::SubPixel::Horizontal_RGB:
|
||||
return KWaylandServer::OutputInterface::SubPixel::HorizontalRGB;
|
||||
case Output::SubPixel::Horizontal_BGR:
|
||||
return KWaylandServer::OutputInterface::SubPixel::HorizontalBGR;
|
||||
case Output::SubPixel::Vertical_RGB:
|
||||
return KWaylandServer::OutputInterface::SubPixel::VerticalRGB;
|
||||
case Output::SubPixel::Vertical_BGR:
|
||||
return KWaylandServer::OutputInterface::SubPixel::VerticalBGR;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
static KWaylandServer::OutputInterface::DpmsMode kwinDpmsModeToOutputDpmsMode(Output::DpmsMode dpmsMode)
|
||||
{
|
||||
switch (dpmsMode) {
|
||||
case Output::DpmsMode::Off:
|
||||
return KWaylandServer::OutputInterface::DpmsMode::Off;
|
||||
case Output::DpmsMode::On:
|
||||
return KWaylandServer::OutputInterface::DpmsMode::On;
|
||||
case Output::DpmsMode::Standby:
|
||||
return KWaylandServer::OutputInterface::DpmsMode::Standby;
|
||||
case Output::DpmsMode::Suspend:
|
||||
return KWaylandServer::OutputInterface::DpmsMode::Suspend;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
static Output::DpmsMode outputDpmsModeToKWinDpmsMode(KWaylandServer::OutputInterface::DpmsMode dpmsMode)
|
||||
{
|
||||
switch (dpmsMode) {
|
||||
case KWaylandServer::OutputInterface::DpmsMode::Off:
|
||||
return Output::DpmsMode::Off;
|
||||
case KWaylandServer::OutputInterface::DpmsMode::On:
|
||||
return Output::DpmsMode::On;
|
||||
case KWaylandServer::OutputInterface::DpmsMode::Standby:
|
||||
return Output::DpmsMode::Standby;
|
||||
case KWaylandServer::OutputInterface::DpmsMode::Suspend:
|
||||
return Output::DpmsMode::Suspend;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
WaylandOutput::WaylandOutput(Output *output, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_platformOutput(output)
|
||||
|
@ -96,16 +20,16 @@ WaylandOutput::WaylandOutput(Output *output, QObject *parent)
|
|||
{
|
||||
const QRect geometry = m_platformOutput->geometry();
|
||||
|
||||
m_waylandOutput->setTransform(kwinTransformToOutputTransform(output->transform()));
|
||||
m_waylandOutput->setTransform(output->transform());
|
||||
m_waylandOutput->setManufacturer(output->manufacturer());
|
||||
m_waylandOutput->setModel(output->model());
|
||||
m_waylandOutput->setPhysicalSize(output->physicalSize());
|
||||
m_waylandOutput->setDpmsMode(kwinDpmsModeToOutputDpmsMode(output->dpmsMode()));
|
||||
m_waylandOutput->setDpmsMode(output->dpmsMode());
|
||||
m_waylandOutput->setDpmsSupported(output->capabilities() & Output::Capability::Dpms);
|
||||
m_waylandOutput->setGlobalPosition(geometry.topLeft());
|
||||
m_waylandOutput->setScale(std::ceil(output->scale()));
|
||||
m_waylandOutput->setMode(output->modeSize(), output->refreshRate());
|
||||
m_waylandOutput->setSubPixel(kwinSubPixelToOutputSubPixel(output->subPixel()));
|
||||
m_waylandOutput->setSubPixel(output->subPixel());
|
||||
|
||||
m_xdgOutputV1->setName(output->name());
|
||||
m_xdgOutputV1->setDescription(output->description());
|
||||
|
@ -147,7 +71,7 @@ void WaylandOutput::update()
|
|||
|
||||
m_waylandOutput->setGlobalPosition(geometry.topLeft());
|
||||
m_waylandOutput->setScale(std::ceil(m_platformOutput->scale()));
|
||||
m_waylandOutput->setTransform(kwinTransformToOutputTransform(m_platformOutput->transform()));
|
||||
m_waylandOutput->setTransform(m_platformOutput->transform());
|
||||
m_waylandOutput->setMode(m_platformOutput->modeSize(), m_platformOutput->refreshRate());
|
||||
|
||||
m_xdgOutputV1->setLogicalPosition(geometry.topLeft());
|
||||
|
@ -159,12 +83,12 @@ void WaylandOutput::update()
|
|||
|
||||
void WaylandOutput::handleDpmsModeChanged()
|
||||
{
|
||||
m_waylandOutput->setDpmsMode(kwinDpmsModeToOutputDpmsMode(m_platformOutput->dpmsMode()));
|
||||
m_waylandOutput->setDpmsMode(m_platformOutput->dpmsMode());
|
||||
}
|
||||
|
||||
void WaylandOutput::handleDpmsModeRequested(KWaylandServer::OutputInterface::DpmsMode dpmsMode)
|
||||
void WaylandOutput::handleDpmsModeRequested(KWin::Output::DpmsMode dpmsMode)
|
||||
{
|
||||
m_platformOutput->setDpmsMode(outputDpmsModeToKWinDpmsMode(dpmsMode));
|
||||
m_platformOutput->setDpmsMode(dpmsMode);
|
||||
}
|
||||
|
||||
} // namespace KWin
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
private Q_SLOTS:
|
||||
void handleDpmsModeChanged();
|
||||
void handleDpmsModeRequested(KWaylandServer::OutputInterface::DpmsMode dpmsMode);
|
||||
void handleDpmsModeRequested(KWin::Output::DpmsMode dpmsMode);
|
||||
|
||||
void update();
|
||||
void scheduleUpdate();
|
||||
|
|
Loading…
Reference in a new issue