Commit a262f2b2 authored by Xaver Hugl's avatar Xaver Hugl
Browse files

Revert "wayland/outputdevice: use OutputMode directly"

This reverts commits 67181d5d and
d03e352d.

BUG: 454014
parent bcbbbc56
Pipeline #178248 passed with stage
in 18 minutes and 25 seconds
......@@ -75,7 +75,7 @@ void TestWaylandOutput::init()
m_serverOutput = new OutputInterface(m_display, this);
QCOMPARE(m_serverOutput->pixelSize(), QSize());
QCOMPARE(m_serverOutput->refreshRate(), 60000);
m_serverOutput->setMode(QSharedPointer<KWin::OutputMode>::create(QSize(1024, 768), 60000));
m_serverOutput->setMode(QSize(1024, 768));
QCOMPARE(m_serverOutput->pixelSize(), QSize(1024, 768));
QCOMPARE(m_serverOutput->refreshRate(), 60000);
QCOMPARE(m_serverOutput->isDpmsSupported(), false);
......@@ -218,7 +218,7 @@ void TestWaylandOutput::testModeChange()
QCOMPARE(output.refreshRate(), 60000);
// change once more
m_serverOutput->setMode(QSharedPointer<KWin::OutputMode>::create(QSize(1280, 1024), 90000));
m_serverOutput->setMode(QSize(1280, 1024), 90000);
QCOMPARE(m_serverOutput->refreshRate(), 90000);
m_serverOutput->done();
QVERIFY(outputChanged.wait());
......
......@@ -59,7 +59,7 @@ void TestXdgOutput::init()
QVERIFY(m_display->isRunning());
m_serverOutput = new OutputInterface(m_display, this);
m_serverOutput->setMode(QSharedPointer<KWin::OutputMode>::create(QSize(1920, 1080), 60000));
m_serverOutput->setMode(QSize(1920, 1080));
m_serverXdgOutputManager = new XdgOutputManagerV1Interface(m_display, this);
m_serverXdgOutput = m_serverXdgOutputManager->createXdgOutput(m_serverOutput, this);
......
......@@ -94,9 +94,9 @@ void XdgShellTest::init()
QVERIFY(m_display->isRunning());
m_display->createShm();
m_o1Interface = new OutputInterface(m_display, m_display);
m_o1Interface->setMode(QSharedPointer<KWin::OutputMode>::create(QSize(1024, 768), 60000));
m_o1Interface->setMode(QSize(1024, 768));
m_o2Interface = new OutputInterface(m_display, m_display);
m_o2Interface->setMode(QSharedPointer<KWin::OutputMode>::create(QSize(1024, 768), 60000));
m_o2Interface->setMode(QSize(1024, 768));
m_seatInterface = new SeatInterface(m_display, m_display);
m_seatInterface->setHasKeyboard(true);
m_seatInterface->setHasPointer(true);
......
......@@ -39,7 +39,7 @@ public:
int scale = 1;
KWin::Output::SubPixel subPixel = KWin::Output::SubPixel::Unknown;
KWin::Output::Transform transform = KWin::Output::Transform::Normal;
QSharedPointer<KWin::OutputMode> mode;
OutputInterface::Mode mode;
struct
{
KWin::Output::DpmsMode mode = KWin::Output::DpmsMode::Off;
......@@ -61,7 +61,7 @@ OutputInterfacePrivate::OutputInterfacePrivate(Display *display, OutputInterface
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)
......@@ -197,22 +197,22 @@ void OutputInterface::remove()
QSize OutputInterface::pixelSize() const
{
return d->mode->size();
return d->mode.size;
}
int OutputInterface::refreshRate() const
{
return d->mode->refreshRate();
return d->mode.refreshRate;
}
QSharedPointer<KWin::OutputMode> OutputInterface::mode() const
OutputInterface::Mode OutputInterface::mode() const
{
return d->mode;
}
void OutputInterface::setMode(const QSharedPointer<KWin::OutputMode> &mode)
void OutputInterface::setMode(const Mode &mode)
{
if (d->mode == mode) {
if (d->mode.size == mode.size && d->mode.refreshRate == mode.refreshRate) {
return;
}
......@@ -224,8 +224,13 @@ void OutputInterface::setMode(const QSharedPointer<KWin::OutputMode> &mode)
}
Q_EMIT modeChanged();
Q_EMIT refreshRateChanged(mode->refreshRate());
Q_EMIT pixelSizeChanged(mode->size());
Q_EMIT refreshRateChanged(mode.refreshRate);
Q_EMIT pixelSizeChanged(mode.size);
}
void OutputInterface::setMode(const QSize &size, int refreshRate)
{
setMode({size, refreshRate});
}
QSize OutputInterface::physicalSize() const
......
......@@ -37,6 +37,12 @@ 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:
struct Mode
{
QSize size = QSize();
int refreshRate = 60000;
};
explicit OutputInterface(Display *display, QObject *parent = nullptr);
~OutputInterface() override;
......@@ -51,7 +57,7 @@ public:
int scale() const;
KWin::Output::SubPixel subPixel() const;
KWin::Output::Transform transform() const;
QSharedPointer<KWin::OutputMode> mode() const;
Mode mode() const;
bool isDpmsSupported() const;
KWin::Output::DpmsMode dpmsMode() const;
......@@ -62,7 +68,8 @@ public:
void setScale(int scale);
void setSubPixel(KWin::Output::SubPixel subPixel);
void setTransform(KWin::Output::Transform transform);
void setMode(const QSharedPointer<KWin::OutputMode> &mode);
void setMode(const Mode &mode);
void setMode(const QSize &size, int refreshRate = 60000);
/**
* Sets whether Dpms is supported for this output.
......
......@@ -245,7 +245,7 @@ int main(int argc, char **argv)
OutputInterface *output = new OutputInterface(&display, &display);
output->setPhysicalSize(QSize(269, 202));
const QSize windowSize(1024, 768);
output->setMode(QSharedPointer<KWin::OutputMode>::create(windowSize, 60000));
output->setMode(windowSize);
SeatInterface *seat = new SeatInterface(&display);
seat->setHasKeyboard(true);
seat->setHasPointer(true);
......
......@@ -77,7 +77,7 @@ int main(int argc, char **argv)
new XdgShellInterface(&display, &display);
OutputInterface *output = new OutputInterface(&display, &display);
output->setPhysicalSize(QSize(10, 10));
output->setMode(QSharedPointer<KWin::OutputMode>::create(QSize(1024, 768), 60000));
output->setMode(QSize(1024, 768));
// starts XWayland by forking and opening a pipe
const int pipe = startXServer();
......
......@@ -28,7 +28,7 @@ WaylandOutput::WaylandOutput(Output *output, QObject *parent)
m_waylandOutput->setDpmsSupported(output->capabilities() & Output::Capability::Dpms);
m_waylandOutput->setGlobalPosition(geometry.topLeft());
m_waylandOutput->setScale(std::ceil(output->scale()));
m_waylandOutput->setMode(output->currentMode());
m_waylandOutput->setMode(output->modeSize(), output->refreshRate());
m_waylandOutput->setSubPixel(output->subPixel());
m_xdgOutputV1->setName(output->name());
......@@ -72,7 +72,7 @@ void WaylandOutput::update()
m_waylandOutput->setGlobalPosition(geometry.topLeft());
m_waylandOutput->setScale(std::ceil(m_platformOutput->scale()));
m_waylandOutput->setTransform(m_platformOutput->transform());
m_waylandOutput->setMode(m_platformOutput->currentMode());
m_waylandOutput->setMode(m_platformOutput->modeSize(), m_platformOutput->refreshRate());
m_xdgOutputV1->setLogicalPosition(geometry.topLeft());
m_xdgOutputV1->setLogicalSize(geometry.size());
......
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