wayland/outputdevice: use OutputMode directly
This commit is contained in:
parent
4fb78a415c
commit
67181d5db7
8 changed files with 20 additions and 32 deletions
|
@ -75,7 +75,7 @@ void TestWaylandOutput::init()
|
||||||
m_serverOutput = new OutputInterface(m_display, this);
|
m_serverOutput = new OutputInterface(m_display, this);
|
||||||
QCOMPARE(m_serverOutput->pixelSize(), QSize());
|
QCOMPARE(m_serverOutput->pixelSize(), QSize());
|
||||||
QCOMPARE(m_serverOutput->refreshRate(), 60000);
|
QCOMPARE(m_serverOutput->refreshRate(), 60000);
|
||||||
m_serverOutput->setMode(QSize(1024, 768));
|
m_serverOutput->setMode(QSharedPointer<KWin::OutputMode>::create(QSize(1024, 768), 60000));
|
||||||
QCOMPARE(m_serverOutput->pixelSize(), QSize(1024, 768));
|
QCOMPARE(m_serverOutput->pixelSize(), QSize(1024, 768));
|
||||||
QCOMPARE(m_serverOutput->refreshRate(), 60000);
|
QCOMPARE(m_serverOutput->refreshRate(), 60000);
|
||||||
QCOMPARE(m_serverOutput->isDpmsSupported(), false);
|
QCOMPARE(m_serverOutput->isDpmsSupported(), false);
|
||||||
|
@ -218,7 +218,7 @@ void TestWaylandOutput::testModeChange()
|
||||||
QCOMPARE(output.refreshRate(), 60000);
|
QCOMPARE(output.refreshRate(), 60000);
|
||||||
|
|
||||||
// change once more
|
// change once more
|
||||||
m_serverOutput->setMode(QSize(1280, 1024), 90000);
|
m_serverOutput->setMode(QSharedPointer<KWin::OutputMode>::create(QSize(1280, 1024), 90000));
|
||||||
QCOMPARE(m_serverOutput->refreshRate(), 90000);
|
QCOMPARE(m_serverOutput->refreshRate(), 90000);
|
||||||
m_serverOutput->done();
|
m_serverOutput->done();
|
||||||
QVERIFY(outputChanged.wait());
|
QVERIFY(outputChanged.wait());
|
||||||
|
|
|
@ -59,7 +59,7 @@ void TestXdgOutput::init()
|
||||||
QVERIFY(m_display->isRunning());
|
QVERIFY(m_display->isRunning());
|
||||||
|
|
||||||
m_serverOutput = new OutputInterface(m_display, this);
|
m_serverOutput = new OutputInterface(m_display, this);
|
||||||
m_serverOutput->setMode(QSize(1920, 1080));
|
m_serverOutput->setMode(QSharedPointer<KWin::OutputMode>::create(QSize(1920, 1080), 60000));
|
||||||
|
|
||||||
m_serverXdgOutputManager = new XdgOutputManagerV1Interface(m_display, this);
|
m_serverXdgOutputManager = new XdgOutputManagerV1Interface(m_display, this);
|
||||||
m_serverXdgOutput = m_serverXdgOutputManager->createXdgOutput(m_serverOutput, this);
|
m_serverXdgOutput = m_serverXdgOutputManager->createXdgOutput(m_serverOutput, this);
|
||||||
|
|
|
@ -94,9 +94,9 @@ void XdgShellTest::init()
|
||||||
QVERIFY(m_display->isRunning());
|
QVERIFY(m_display->isRunning());
|
||||||
m_display->createShm();
|
m_display->createShm();
|
||||||
m_o1Interface = new OutputInterface(m_display, m_display);
|
m_o1Interface = new OutputInterface(m_display, m_display);
|
||||||
m_o1Interface->setMode(QSize(1024, 768));
|
m_o1Interface->setMode(QSharedPointer<KWin::OutputMode>::create(QSize(1024, 768), 60000));
|
||||||
m_o2Interface = new OutputInterface(m_display, m_display);
|
m_o2Interface = new OutputInterface(m_display, m_display);
|
||||||
m_o2Interface->setMode(QSize(1024, 768));
|
m_o2Interface->setMode(QSharedPointer<KWin::OutputMode>::create(QSize(1024, 768), 60000));
|
||||||
m_seatInterface = new SeatInterface(m_display, m_display);
|
m_seatInterface = new SeatInterface(m_display, m_display);
|
||||||
m_seatInterface->setHasKeyboard(true);
|
m_seatInterface->setHasKeyboard(true);
|
||||||
m_seatInterface->setHasPointer(true);
|
m_seatInterface->setHasPointer(true);
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
int scale = 1;
|
int scale = 1;
|
||||||
KWin::Output::SubPixel subPixel = KWin::Output::SubPixel::Unknown;
|
KWin::Output::SubPixel subPixel = KWin::Output::SubPixel::Unknown;
|
||||||
KWin::Output::Transform transform = KWin::Output::Transform::Normal;
|
KWin::Output::Transform transform = KWin::Output::Transform::Normal;
|
||||||
OutputInterface::Mode mode;
|
QSharedPointer<KWin::OutputMode> mode;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
KWin::Output::DpmsMode mode = KWin::Output::DpmsMode::Off;
|
KWin::Output::DpmsMode mode = KWin::Output::DpmsMode::Off;
|
||||||
|
@ -61,7 +61,7 @@ OutputInterfacePrivate::OutputInterfacePrivate(Display *display, OutputInterface
|
||||||
|
|
||||||
void OutputInterfacePrivate::sendMode(Resource *resource)
|
void OutputInterfacePrivate::sendMode(Resource *resource)
|
||||||
{
|
{
|
||||||
send_mode(resource->handle, mode_current, mode.size.width(), mode.size.height(), mode.refreshRate);
|
send_mode(resource->handle, mode_current, mode->size().width(), mode->size().height(), mode->refreshRate());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputInterfacePrivate::sendScale(Resource *resource)
|
void OutputInterfacePrivate::sendScale(Resource *resource)
|
||||||
|
@ -197,22 +197,22 @@ void OutputInterface::remove()
|
||||||
|
|
||||||
QSize OutputInterface::pixelSize() const
|
QSize OutputInterface::pixelSize() const
|
||||||
{
|
{
|
||||||
return d->mode.size;
|
return d->mode->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
int OutputInterface::refreshRate() const
|
int OutputInterface::refreshRate() const
|
||||||
{
|
{
|
||||||
return d->mode.refreshRate;
|
return d->mode->refreshRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputInterface::Mode OutputInterface::mode() const
|
QSharedPointer<KWin::OutputMode> OutputInterface::mode() const
|
||||||
{
|
{
|
||||||
return d->mode;
|
return d->mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputInterface::setMode(const Mode &mode)
|
void OutputInterface::setMode(const QSharedPointer<KWin::OutputMode> &mode)
|
||||||
{
|
{
|
||||||
if (d->mode.size == mode.size && d->mode.refreshRate == mode.refreshRate) {
|
if (d->mode->size() == mode->size() && d->mode->refreshRate() == mode->refreshRate()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,13 +224,8 @@ void OutputInterface::setMode(const Mode &mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT modeChanged();
|
Q_EMIT modeChanged();
|
||||||
Q_EMIT refreshRateChanged(mode.refreshRate);
|
Q_EMIT refreshRateChanged(mode->refreshRate());
|
||||||
Q_EMIT pixelSizeChanged(mode.size);
|
Q_EMIT pixelSizeChanged(mode->size());
|
||||||
}
|
|
||||||
|
|
||||||
void OutputInterface::setMode(const QSize &size, int refreshRate)
|
|
||||||
{
|
|
||||||
setMode({size, refreshRate});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize OutputInterface::physicalSize() const
|
QSize OutputInterface::physicalSize() const
|
||||||
|
|
|
@ -37,12 +37,6 @@ class KWIN_EXPORT OutputInterface : public QObject
|
||||||
Q_PROPERTY(int refreshRate READ refreshRate NOTIFY refreshRateChanged)
|
Q_PROPERTY(int refreshRate READ refreshRate NOTIFY refreshRateChanged)
|
||||||
Q_PROPERTY(int scale READ scale WRITE setScale NOTIFY scaleChanged)
|
Q_PROPERTY(int scale READ scale WRITE setScale NOTIFY scaleChanged)
|
||||||
public:
|
public:
|
||||||
struct Mode
|
|
||||||
{
|
|
||||||
QSize size = QSize();
|
|
||||||
int refreshRate = 60000;
|
|
||||||
};
|
|
||||||
|
|
||||||
explicit OutputInterface(Display *display, QObject *parent = nullptr);
|
explicit OutputInterface(Display *display, QObject *parent = nullptr);
|
||||||
~OutputInterface() override;
|
~OutputInterface() override;
|
||||||
|
|
||||||
|
@ -57,7 +51,7 @@ public:
|
||||||
int scale() const;
|
int scale() const;
|
||||||
KWin::Output::SubPixel subPixel() const;
|
KWin::Output::SubPixel subPixel() const;
|
||||||
KWin::Output::Transform transform() const;
|
KWin::Output::Transform transform() const;
|
||||||
Mode mode() const;
|
QSharedPointer<KWin::OutputMode> mode() const;
|
||||||
bool isDpmsSupported() const;
|
bool isDpmsSupported() const;
|
||||||
KWin::Output::DpmsMode dpmsMode() const;
|
KWin::Output::DpmsMode dpmsMode() const;
|
||||||
|
|
||||||
|
@ -68,8 +62,7 @@ public:
|
||||||
void setScale(int scale);
|
void setScale(int scale);
|
||||||
void setSubPixel(KWin::Output::SubPixel subPixel);
|
void setSubPixel(KWin::Output::SubPixel subPixel);
|
||||||
void setTransform(KWin::Output::Transform transform);
|
void setTransform(KWin::Output::Transform transform);
|
||||||
void setMode(const Mode &mode);
|
void setMode(const QSharedPointer<KWin::OutputMode> &mode);
|
||||||
void setMode(const QSize &size, int refreshRate = 60000);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether Dpms is supported for this output.
|
* Sets whether Dpms is supported for this output.
|
||||||
|
|
|
@ -245,7 +245,7 @@ int main(int argc, char **argv)
|
||||||
OutputInterface *output = new OutputInterface(&display, &display);
|
OutputInterface *output = new OutputInterface(&display, &display);
|
||||||
output->setPhysicalSize(QSize(269, 202));
|
output->setPhysicalSize(QSize(269, 202));
|
||||||
const QSize windowSize(1024, 768);
|
const QSize windowSize(1024, 768);
|
||||||
output->setMode(windowSize);
|
output->setMode(QSharedPointer<KWin::OutputMode>::create(windowSize, 60000));
|
||||||
SeatInterface *seat = new SeatInterface(&display);
|
SeatInterface *seat = new SeatInterface(&display);
|
||||||
seat->setHasKeyboard(true);
|
seat->setHasKeyboard(true);
|
||||||
seat->setHasPointer(true);
|
seat->setHasPointer(true);
|
||||||
|
|
|
@ -77,7 +77,7 @@ int main(int argc, char **argv)
|
||||||
new XdgShellInterface(&display, &display);
|
new XdgShellInterface(&display, &display);
|
||||||
OutputInterface *output = new OutputInterface(&display, &display);
|
OutputInterface *output = new OutputInterface(&display, &display);
|
||||||
output->setPhysicalSize(QSize(10, 10));
|
output->setPhysicalSize(QSize(10, 10));
|
||||||
output->setMode(QSize(1024, 768));
|
output->setMode(QSharedPointer<KWin::OutputMode>::create(QSize(1024, 768), 60000));
|
||||||
|
|
||||||
// starts XWayland by forking and opening a pipe
|
// starts XWayland by forking and opening a pipe
|
||||||
const int pipe = startXServer();
|
const int pipe = startXServer();
|
||||||
|
|
|
@ -28,7 +28,7 @@ WaylandOutput::WaylandOutput(Output *output, QObject *parent)
|
||||||
m_waylandOutput->setDpmsSupported(output->capabilities() & Output::Capability::Dpms);
|
m_waylandOutput->setDpmsSupported(output->capabilities() & Output::Capability::Dpms);
|
||||||
m_waylandOutput->setGlobalPosition(geometry.topLeft());
|
m_waylandOutput->setGlobalPosition(geometry.topLeft());
|
||||||
m_waylandOutput->setScale(std::ceil(output->scale()));
|
m_waylandOutput->setScale(std::ceil(output->scale()));
|
||||||
m_waylandOutput->setMode(output->modeSize(), output->refreshRate());
|
m_waylandOutput->setMode(output->currentMode());
|
||||||
m_waylandOutput->setSubPixel(output->subPixel());
|
m_waylandOutput->setSubPixel(output->subPixel());
|
||||||
|
|
||||||
m_xdgOutputV1->setName(output->name());
|
m_xdgOutputV1->setName(output->name());
|
||||||
|
@ -72,7 +72,7 @@ void WaylandOutput::update()
|
||||||
m_waylandOutput->setGlobalPosition(geometry.topLeft());
|
m_waylandOutput->setGlobalPosition(geometry.topLeft());
|
||||||
m_waylandOutput->setScale(std::ceil(m_platformOutput->scale()));
|
m_waylandOutput->setScale(std::ceil(m_platformOutput->scale()));
|
||||||
m_waylandOutput->setTransform(m_platformOutput->transform());
|
m_waylandOutput->setTransform(m_platformOutput->transform());
|
||||||
m_waylandOutput->setMode(m_platformOutput->modeSize(), m_platformOutput->refreshRate());
|
m_waylandOutput->setMode(m_platformOutput->currentMode());
|
||||||
|
|
||||||
m_xdgOutputV1->setLogicalPosition(geometry.topLeft());
|
m_xdgOutputV1->setLogicalPosition(geometry.topLeft());
|
||||||
m_xdgOutputV1->setLogicalSize(geometry.size());
|
m_xdgOutputV1->setLogicalSize(geometry.size());
|
||||||
|
|
Loading…
Reference in a new issue