Commit 589e339d authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Rework OutputInterface following new design principles

parent 29e8cb43
......@@ -81,7 +81,6 @@ void TestWaylandOutput::init()
m_serverOutput->setCurrentMode(QSize(1024, 768));
QCOMPARE(m_serverOutput->pixelSize(), QSize(1024, 768));
QCOMPARE(m_serverOutput->refreshRate(), 60000);
m_serverOutput->create();
QCOMPARE(m_serverOutput->isDpmsSupported(), false);
QCOMPARE(m_serverOutput->dpmsMode(), OutputInterface::DpmsMode::Off);
......
......@@ -1051,7 +1051,6 @@ void TestWaylandSurface::testOutput()
QVERIFY(outputAnnouncedSpy.isValid());
auto serverOutput = new OutputInterface(m_display, m_display);
serverOutput->create();
QVERIFY(outputAnnouncedSpy.wait());
QScopedPointer<Output> clientOutput(registry.createOutput(outputAnnouncedSpy.first().first().value<quint32>(), outputAnnouncedSpy.first().last().value<quint32>()));
QVERIFY(clientOutput->isValid());
......
......@@ -61,7 +61,6 @@ void TestXdgOutput::init()
m_serverOutput = new OutputInterface(m_display, this);
m_serverOutput->addMode(QSize(1920, 1080), OutputInterface::ModeFlags(OutputInterface::ModeFlag::Preferred));
m_serverOutput->setCurrentMode(QSize(1920, 1080));
m_serverOutput->create();
m_serverXdgOutputManager = new XdgOutputManagerV1Interface(m_display, this);
m_serverXdgOutput = m_serverXdgOutputManager->createXdgOutput(m_serverOutput, this);
......
......@@ -95,10 +95,8 @@ void XdgShellTest::init()
m_display->createShm();
m_o1Interface = new OutputInterface(m_display, m_display);
m_o1Interface->addMode(QSize(1024, 768));
m_o1Interface->create();
m_o2Interface = new OutputInterface(m_display, m_display);
m_o2Interface->addMode(QSize(1024, 768));
m_o2Interface->create();
m_seatInterface = new SeatInterface(m_display, m_display);
m_seatInterface->setHasKeyboard(true);
m_seatInterface->setHasPointer(true);
......
......@@ -180,8 +180,7 @@ void TestInputMethodInterface::initTestCase()
m_serverCompositor = new CompositorInterface(&m_display, this);
m_inputMethodIface = new InputMethodV1Interface(&m_display, this);
m_inputPanelIface = new InputPanelV1Interface(&m_display, this);
auto outputIface = new OutputInterface(&m_display, this);
outputIface->create();
new OutputInterface(&m_display, this);
connect(m_serverCompositor, &CompositorInterface::surfaceCreated, this, [this](SurfaceInterface *surface) {
m_surfaces += surface;
......
This diff is collapsed.
/*
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#pragma once
#include <KWaylandServer/kwaylandserver_export.h>
#include <QObject>
#include <QPoint>
#include <QSize>
#include <KWaylandServer/kwaylandserver_export.h>
#include "global.h"
struct wl_global;
struct wl_client;
struct wl_resource;
namespace KWaylandServer
......@@ -21,12 +19,13 @@ namespace KWaylandServer
class ClientConnection;
class Display;
class OutputInterfacePrivate;
/**
* @brief Global for the wl_output interface.
*
* The OutputInterface class represents a screen. This class corresponds to the Wayland
* interface @c wl_output.
*/
class KWAYLANDSERVER_EXPORT OutputInterface : public Global
class KWAYLANDSERVER_EXPORT OutputInterface : public QObject
{
Q_OBJECT
Q_PROPERTY(QSize physicalSize READ physicalSize WRITE setPhysicalSize NOTIFY physicalSizeChanged)
......@@ -73,7 +72,7 @@ public:
};
explicit OutputInterface(Display *display, QObject *parent = nullptr);
virtual ~OutputInterface();
~OutputInterface() override;
QSize physicalSize() const;
QPoint globalPosition() const;
......@@ -127,6 +126,7 @@ public:
static OutputInterface *get(wl_resource *native);
Q_SIGNALS:
void aboutToBeDestroyed();
void physicalSizeChanged(const QSize&);
void globalPositionChanged(const QPoint&);
void manufacturerChanged(const QString&);
......@@ -154,11 +154,10 @@ Q_SIGNALS:
void bound(ClientConnection *client, wl_resource *boundResource);
private:
class Private;
Private *d_func() const;
QScopedPointer<OutputInterfacePrivate> d;
};
}
} // namespace KWaylandServer
Q_DECLARE_OPERATORS_FOR_FLAGS(KWaylandServer::OutputInterface::ModeFlags)
Q_DECLARE_METATYPE(KWaylandServer::OutputInterface::SubPixel)
......
......@@ -835,7 +835,7 @@ void SurfaceInterface::setOutputs(const QVector<OutputInterface *> &outputs)
for (wl_resource *outputResource : resources) {
d->send_enter(outputResource);
}
d->outputDestroyedConnections[o] = connect(o, &Global::aboutToDestroyGlobal, this, [this, o] {
d->outputDestroyedConnections[o] = connect(o, &OutputInterface::aboutToBeDestroyed, this, [this, o] {
auto outputs = d->outputs;
if (outputs.removeOne(o)) {
setOutputs(outputs);
......
......@@ -251,7 +251,6 @@ int main(int argc, char **argv)
output->setPhysicalSize(QSize(269, 202));
const QSize windowSize(1024, 768);
output->addMode(windowSize);
output->create();
SeatInterface *seat = new SeatInterface(&display);
seat->setHasKeyboard(true);
seat->setHasPointer(true);
......
......@@ -80,7 +80,6 @@ int main(int argc, char **argv)
OutputInterface *output = new OutputInterface(&display, &display);
output->setPhysicalSize(QSize(10, 10));
output->addMode(QSize(1024, 768));
output->create();
// starts XWayland by forking and opening a pipe
const int pipe = startXServer();
......
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