Remove factory methods in Display

The main reason why we have factory methods is that up to some point,
kwayland had its own signal to indicate when globals have to be removed.

Now that all globals add destroy listeners for the wl_display object,
we don't have that signal. Most factory methods are equivalent to doing
new T(display).

Besides adding unnecessary boilerplate code, another reason to get rid
of the factory methods is to reduce the amount of merge conflicts. If
several persons work on implementing wayland protocols at the same time,
sooner or later someone will have to resolve merge conflicts in Display.
This commit is contained in:
Vlad Zahorodnii 2020-12-09 22:13:19 +02:00
parent b5434e51e8
commit 09e079b78f
83 changed files with 277 additions and 733 deletions

View file

@ -296,6 +296,12 @@ target_link_libraries(KWaylandServer
Qt5::Concurrent
)
target_compile_definitions(KWaylandServer PRIVATE
MESA_EGL_NO_X11_HEADERS
EGL_NO_X11
EGL_NO_PLATFORM_SPECIFIC_TYPES
)
set_target_properties(KWaylandServer PROPERTIES VERSION ${KWAYLANDSERVER_VERSION_STRING}
SOVERSION ${KWAYLANDSERVER_SOVERSION}
)

View file

@ -31,7 +31,9 @@ class AppMenuInterfacePrivate;
class KWAYLANDSERVER_EXPORT AppMenuManagerInterface : public QObject
{
Q_OBJECT
public:
explicit AppMenuManagerInterface(Display *display, QObject *parent = nullptr);
~AppMenuManagerInterface() override;
/**
* Returns any existing appMenu for a given surface
@ -46,8 +48,6 @@ Q_SIGNALS:
void appMenuCreated(KWaylandServer::AppMenuInterface*);
private:
explicit AppMenuManagerInterface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<AppMenuManagerInterfacePrivate> d;
};

View file

@ -76,7 +76,7 @@ void TestCompositor::init()
registry.setup();
// here we need a shm pool
m_compositorInterface = m_display->createCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
QVERIFY(compositorSpy.wait());
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
}

View file

@ -102,13 +102,13 @@ void TestDataDevice::init()
QVERIFY(registry.isValid());
registry.setup();
m_dataDeviceManagerInterface = m_display->createDataDeviceManager(m_display);
m_dataDeviceManagerInterface = new DataDeviceManagerInterface(m_display, m_display);
QVERIFY(dataDeviceManagerSpy.wait());
m_dataDeviceManager = registry.createDataDeviceManager(dataDeviceManagerSpy.first().first().value<quint32>(),
dataDeviceManagerSpy.first().last().value<quint32>(), this);
m_seatInterface = m_display->createSeat(m_display);
m_seatInterface = new SeatInterface(m_display, m_display);
m_seatInterface->setHasPointer(true);
m_seatInterface->create();
QVERIFY(m_seatInterface->isValid());
@ -121,7 +121,7 @@ void TestDataDevice::init()
QVERIFY(pointerChangedSpy.isValid());
QVERIFY(pointerChangedSpy.wait());
m_compositorInterface = m_display->createCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
QVERIFY(compositorSpy.wait());
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(),
compositorSpy.first().last().value<quint32>(), this);

View file

@ -80,7 +80,7 @@ void TestDataSource::init()
QVERIFY(registry.isValid());
registry.setup();
m_dataDeviceManagerInterface = m_display->createDataDeviceManager(m_display);
m_dataDeviceManagerInterface = new DataDeviceManagerInterface(m_display, m_display);
QVERIFY(dataDeviceManagerSpy.wait());
m_dataDeviceManager = registry.createDataDeviceManager(dataDeviceManagerSpy.first().first().value<quint32>(),

View file

@ -77,13 +77,13 @@ void TestDragAndDrop::init()
QVERIFY(connectedSpy.isValid());
m_connection->setSocketName(s_socketName);
m_compositorInterface = m_display->createCompositor(m_display);
m_seatInterface = m_display->createSeat(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
m_seatInterface = new SeatInterface(m_display, m_display);
m_seatInterface->setHasPointer(true);
m_seatInterface->setHasTouch(true);
m_seatInterface->create();
QVERIFY(m_seatInterface->isValid());
m_dataDeviceManagerInterface = m_display->createDataDeviceManager(m_display);
m_dataDeviceManagerInterface = new DataDeviceManagerInterface(m_display, m_display);
m_display->createShm();
m_thread = new QThread(this);

View file

@ -54,8 +54,8 @@ void ErrorTest::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_display->createShm();
m_ci = m_display->createCompositor(m_display);
m_psi = m_display->createPlasmaShell(m_display);
m_ci = new CompositorInterface(m_display, m_display);
m_psi = new PlasmaShellInterface(m_display, m_display);
// setup connection
m_connection = new KWayland::Client::ConnectionThread;

View file

@ -61,7 +61,7 @@ void FakeInputTest::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_display->createShm();
m_fakeInputInterface = m_display->createFakeInput();
m_fakeInputInterface = new FakeInputInterface(m_display);
QSignalSpy deviceCreatedSpy(m_fakeInputInterface, &FakeInputInterface::deviceCreated);
QVERIFY(deviceCreatedSpy.isValid());

View file

@ -53,10 +53,10 @@ void IdleTest::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_display->createShm();
m_seatInterface = m_display->createSeat();
m_seatInterface = new SeatInterface(m_display);
m_seatInterface->setName(QStringLiteral("seat0"));
m_seatInterface->create();
m_idleInterface = m_display->createIdle();
m_idleInterface = new IdleInterface(m_display);
// setup connection
m_connection = new KWayland::Client::ConnectionThread;

View file

@ -116,16 +116,16 @@ void TestVirtualDesktop::init()
QVERIFY(registry.isValid());
registry.setup();
m_compositorInterface = m_display->createCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
QVERIFY(compositorSpy.wait());
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
m_plasmaVirtualDesktopManagementInterface = m_display->createPlasmaVirtualDesktopManagement(m_display);
m_plasmaVirtualDesktopManagementInterface = new PlasmaVirtualDesktopManagementInterface(m_display, m_display);
QVERIFY(plasmaVirtualDesktopManagementSpy.wait());
m_plasmaVirtualDesktopManagement = registry.createPlasmaVirtualDesktopManagement(plasmaVirtualDesktopManagementSpy.first().first().value<quint32>(), plasmaVirtualDesktopManagementSpy.first().last().value<quint32>(), this);
m_windowManagementInterface = m_display->createPlasmaWindowManagement(m_display);
m_windowManagementInterface = new PlasmaWindowManagementInterface(m_display, m_display);
m_windowManagementInterface->setPlasmaVirtualDesktopManagementInterface(m_plasmaVirtualDesktopManagementInterface);
QVERIFY(windowManagementSpy.wait());

View file

@ -100,8 +100,8 @@ void PlasmaWindowModelTest::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_display->createShm();
m_pwInterface = m_display->createPlasmaWindowManagement();
m_plasmaVirtualDesktopManagementInterface = m_display->createPlasmaVirtualDesktopManagement(m_display);
m_pwInterface = new PlasmaWindowManagementInterface(m_display, m_display);
m_plasmaVirtualDesktopManagementInterface = new PlasmaVirtualDesktopManagementInterface(m_display, m_display);
m_plasmaVirtualDesktopManagementInterface->createDesktop("desktop1");
m_plasmaVirtualDesktopManagementInterface->createDesktop("desktop2");
m_pwInterface->setPlasmaVirtualDesktopManagementInterface(m_plasmaVirtualDesktopManagementInterface);

View file

@ -64,10 +64,10 @@ void TestPlasmaShell::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_compositorInterface = m_display->createCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
m_display->createShm();
m_plasmaShellInterface = m_display->createPlasmaShell(m_display);
m_plasmaShellInterface = new PlasmaShellInterface(m_display, m_display);
// setup connection
m_connection = new KWayland::Client::ConnectionThread;

View file

@ -67,11 +67,11 @@ void TestPointerConstraints::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_display->createShm();
m_seatInterface = m_display->createSeat(m_display);
m_seatInterface = new SeatInterface(m_display, m_display);
m_seatInterface->setHasPointer(true);
m_seatInterface->create();
m_compositorInterface = m_display->createCompositor(m_display);
m_pointerConstraintsInterface = m_display->createPointerConstraintsV1(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
m_pointerConstraintsInterface = new PointerConstraintsV1Interface(m_display, m_display);
// setup connection
m_connection = new KWayland::Client::ConnectionThread;

View file

@ -67,11 +67,11 @@ void SelectionTest::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_display->createShm();
m_compositorInterface = m_display->createCompositor(m_display);
m_seatInterface = m_display->createSeat(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
m_seatInterface = new SeatInterface(m_display, m_display);
m_seatInterface->setHasKeyboard(true);
m_seatInterface->create();
m_ddmInterface = m_display->createDataDeviceManager(m_display);
m_ddmInterface = new DataDeviceManagerInterface(m_display, m_display);
// setup connection
setupConnection(&m_client1);

View file

@ -93,11 +93,11 @@ void TestServerSideDecoration::init()
QVERIFY(m_registry->isValid());
m_registry->setup();
m_compositorInterface = m_display->createCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
QVERIFY(compositorSpy.wait());
m_compositor = m_registry->createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
m_serverSideDecorationManagerInterface = m_display->createServerSideDecorationManager(m_display);
m_serverSideDecorationManagerInterface = new ServerSideDecorationManagerInterface(m_display, m_display);
QVERIFY(serverSideDecoManagerSpy.wait());
m_serverSideDecorationManager = m_registry->createServerSideDecorationManager(serverSideDecoManagerSpy.first().first().value<quint32>(),

View file

@ -97,11 +97,11 @@ void TestServerSideDecorationPalette::init()
QVERIFY(registry.isValid());
registry.setup();
m_compositorInterface = m_display->createCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
QVERIFY(compositorSpy.wait());
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
m_paletteManagerInterface = m_display->createServerSideDecorationPaletteManager(m_display);
m_paletteManagerInterface = new ServerSideDecorationPaletteManagerInterface(m_display, m_display);
QVERIFY(registrySpy.wait());
m_paletteManager = registry.createServerSideDecorationPaletteManager(registrySpy.first().first().value<quint32>(), registrySpy.first().last().value<quint32>(), this);

View file

@ -56,8 +56,8 @@ void ShadowTest::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_display->createShm();
m_compositorInterface = m_display->createCompositor(m_display);
m_shadowInterface = m_display->createShadowManager(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
m_shadowInterface = new ShadowManagerInterface(m_display, m_display);
// setup connection
m_connection = new KWayland::Client::ConnectionThread;

View file

@ -75,12 +75,12 @@ void TextInputTest::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_display->createShm();
m_seatInterface = m_display->createSeat();
m_seatInterface = new SeatInterface(m_display, m_display);
m_seatInterface->setHasKeyboard(true);
m_seatInterface->setHasTouch(true);
m_seatInterface->create();
m_compositorInterface = m_display->createCompositor();
m_textInputManagerV2Interface = m_display->createTextInputManagerV2();
m_compositorInterface = new CompositorInterface(m_display, m_display);
m_textInputManagerV2Interface = new TextInputManagerV2Interface(m_display, m_display);
// setup connection
m_connection = new KWayland::Client::ConnectionThread;

View file

@ -100,11 +100,11 @@ void TestAppmenu::init()
QVERIFY(registry.isValid());
registry.setup();
m_compositorInterface = m_display->createCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
QVERIFY(compositorSpy.wait());
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
m_appmenuManagerInterface = m_display->createAppMenuManagerInterface(m_display);
m_appmenuManagerInterface = new AppMenuManagerInterface(m_display, m_display);
QVERIFY(appmenuSpy.wait());
m_appmenuManager = registry.createAppMenuManager(appmenuSpy.first().first().value<quint32>(), appmenuSpy.first().last().value<quint32>(), this);

View file

@ -97,11 +97,11 @@ void TestBlur::init()
QVERIFY(registry.isValid());
registry.setup();
m_compositorInterface = m_display->createCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
QVERIFY(compositorSpy.wait());
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
m_blurManagerInterface = m_display->createBlurManager(m_display);
m_blurManagerInterface = new BlurManagerInterface(m_display, m_display);
QVERIFY(blurSpy.wait());
m_blurManager = registry.createBlurManager(blurSpy.first().first().value<quint32>(), blurSpy.first().last().value<quint32>(), this);
}

View file

@ -99,11 +99,11 @@ void TestContrast::init()
QVERIFY(registry.isValid());
registry.setup();
m_compositorInterface = m_display->createCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
QVERIFY(compositorSpy.wait());
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
m_contrastManagerInterface = m_display->createContrastManager(m_display);
m_contrastManagerInterface = new ContrastManagerInterface(m_display, m_display);
QVERIFY(contrastSpy.wait());
m_contrastManager = registry.createContrastManager(contrastSpy.first().first().value<quint32>(), contrastSpy.first().last().value<quint32>(), this);

View file

@ -81,8 +81,8 @@ void TestFilter::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_compositorInterface = m_display->createCompositor(m_display);
m_blurManagerInterface = m_display->createBlurManager(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
m_blurManagerInterface = new BlurManagerInterface(m_display, m_display);
}
void TestFilter::cleanup()

View file

@ -70,7 +70,7 @@ void TestWaylandOutput::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_serverOutput = m_display->createOutput(this);
m_serverOutput = new OutputInterface(m_display, this);
QCOMPARE(m_serverOutput->pixelSize(), QSize());
QCOMPARE(m_serverOutput->refreshRate(), 60000);
m_serverOutput->addMode(QSize(800, 600), OutputInterface::ModeFlags(OutputInterface::ModeFlag::Preferred));
@ -477,7 +477,7 @@ void TestWaylandOutput::testDpms()
using namespace KWayland::Client;
using namespace KWaylandServer;
m_display->createDpmsManager();
new DpmsManagerInterface(m_display);
// set Dpms on the Output
QSignalSpy serverDpmsSupportedChangedSpy(m_serverOutput, &OutputInterface::dpmsSupportedChanged);
@ -572,7 +572,7 @@ void TestWaylandOutput::testDpmsRequestMode()
using namespace KWaylandServer;
// setup code
m_display->createDpmsManager();
new DpmsManagerInterface(m_display);
// set Dpms on the Output
QSignalSpy serverDpmsSupportedChangedSpy(m_serverOutput, &OutputInterface::dpmsSupportedChanged);

View file

@ -82,7 +82,7 @@ void TestWaylandOutputDevice::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_serverOutputDevice = m_display->createOutputDevice(this);
m_serverOutputDevice = new OutputDeviceInterface(m_display, this);
m_serverOutputDevice->setUuid("1337");

View file

@ -95,8 +95,8 @@ void TestWaylandOutputManagement::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_display->createCompositor(this);
auto outputDeviceInterface = m_display->createOutputDevice(this);
new CompositorInterface(m_display, this);
auto outputDeviceInterface = new OutputDeviceInterface(m_display, this);
OutputDeviceInterface::Mode m0;
m0.id = 0;
@ -129,7 +129,7 @@ void TestWaylandOutputManagement::init()
outputDeviceInterface->create();
m_serverOutputs << outputDeviceInterface;
m_outputManagementInterface = m_display->createOutputManagement(this);
m_outputManagementInterface = new OutputManagementInterface(m_display, this);
m_outputManagementInterface->create();
QVERIFY(m_outputManagementInterface->isValid());

View file

@ -90,7 +90,7 @@ void TestRegion::init()
QVERIFY(registry.isValid());
registry.setup();
m_compositorInterface = m_display->createCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
QVERIFY(compositorSpy.wait());
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
}

View file

@ -128,12 +128,12 @@ void TestWaylandSeat::init()
QVERIFY(m_display->isRunning());
m_display->createShm();
m_compositorInterface = m_display->createCompositor(m_display);
m_subCompositorInterface = m_display->createSubCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
m_subCompositorInterface = new SubCompositorInterface(m_display, m_display);
QVERIFY(m_subCompositorInterface);
m_relativePointerManagerV1Interface = m_display->createRelativePointerManagerV1(m_display);
m_pointerGesturesV1Interface = m_display->createPointerGesturesV1(m_display);
m_relativePointerManagerV1Interface = new RelativePointerManagerV1Interface(m_display, m_display);
m_pointerGesturesV1Interface = new PointerGesturesV1Interface(m_display, m_display);
// setup connection
m_connection = new KWayland::Client::ConnectionThread;
@ -160,7 +160,7 @@ void TestWaylandSeat::init()
registry.setup();
QVERIFY(compositorSpy.wait());
m_seatInterface = m_display->createSeat();
m_seatInterface = new SeatInterface(m_display);
QVERIFY(m_seatInterface);
m_seatInterface->setName(QStringLiteral("seat0"));
m_seatInterface->create();
@ -1746,7 +1746,7 @@ void TestWaylandSeat::testSelection()
{
using namespace KWayland::Client;
using namespace KWaylandServer;
QScopedPointer<DataDeviceManagerInterface> ddmi(m_display->createDataDeviceManager());
QScopedPointer<DataDeviceManagerInterface> ddmi(new DataDeviceManagerInterface(m_display));
Registry registry;
QSignalSpy dataDeviceManagerSpy(&registry, SIGNAL(dataDeviceManagerAnnounced(quint32,quint32)));
QVERIFY(dataDeviceManagerSpy.isValid());
@ -1857,7 +1857,7 @@ void TestWaylandSeat::testDataDeviceForKeyboardSurface()
using namespace KWayland::Client;
using namespace KWaylandServer;
// create the DataDeviceManager
QScopedPointer<DataDeviceManagerInterface> ddmi(m_display->createDataDeviceManager());
QScopedPointer<DataDeviceManagerInterface> ddmi(new DataDeviceManagerInterface(m_display));
QSignalSpy ddiCreatedSpy(ddmi.data(), &DataDeviceManagerInterface::dataDeviceCreated);
QVERIFY(ddiCreatedSpy.isValid());
m_seatInterface->setHasKeyboard(true);

View file

@ -96,11 +96,11 @@ void TestSlide::init()
QVERIFY(registry.isValid());
registry.setup();
m_compositorInterface = m_display->createCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
QVERIFY(compositorSpy.wait());
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
m_slideManagerInterface = m_display->createSlideManager(m_display);
m_slideManagerInterface = new SlideManagerInterface(m_display, m_display);
QVERIFY(slideSpy.wait());
m_slideManager = registry.createSlideManager(slideSpy.first().first().value<quint32>(), slideSpy.first().last().value<quint32>(), this);

View file

@ -83,7 +83,7 @@ void TestSubCompositor::init()
QVERIFY(registry.isValid());
registry.setup();
m_subcompositorInterface = m_display->createSubCompositor(m_display);
m_subcompositorInterface = new SubCompositorInterface(m_display, m_display);
QVERIFY(m_subcompositorInterface);
QVERIFY(subCompositorSpy.wait());

View file

@ -118,8 +118,8 @@ void TestSubSurface::init()
QVERIFY(registry.isValid());
registry.setup();
m_compositorInterface = m_display->createCompositor(m_display);
m_subcompositorInterface = m_display->createSubCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
m_subcompositorInterface = new SubCompositorInterface(m_display, m_display);
QVERIFY(m_subcompositorInterface);
QVERIFY(subCompositorSpy.wait());

View file

@ -88,10 +88,10 @@ void TestWaylandSurface::init()
QVERIFY(m_display->isRunning());
m_display->createShm();
m_compositorInterface = m_display->createCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
QVERIFY(m_compositorInterface);
m_idleInhibitInterface = m_display->createIdleInhibitManagerV1(m_display);
m_idleInhibitInterface = new IdleInhibitManagerV1Interface(m_display, m_display);
QVERIFY(m_idleInhibitInterface);
// setup connection
@ -1114,7 +1114,7 @@ void TestWaylandSurface::testOutput()
QSignalSpy outputAnnouncedSpy(&registry, &Registry::outputAnnounced);
QVERIFY(outputAnnouncedSpy.isValid());
auto serverOutput = m_display->createOutput(m_display);
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>()));

View file

@ -131,12 +131,12 @@ void TestWindowManagement::init()
QVERIFY(m_registry->isValid());
m_registry->setup();
m_compositorInterface = m_display->createCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
QVERIFY(compositorSpy.wait());
m_compositor = m_registry->createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
m_windowManagementInterface = m_display->createPlasmaWindowManagement(m_display);
m_windowManagementInterface = new PlasmaWindowManagementInterface(m_display, m_display);
QVERIFY(windowManagementSpy.wait());
m_windowManagement = m_registry->createPlasmaWindowManagement(windowManagementSpy.first().first().value<quint32>(), windowManagementSpy.first().last().value<quint32>(), this);

View file

@ -97,16 +97,16 @@ void TestXdgDecoration::init()
QVERIFY(m_registry->isValid());
m_registry->setup();
m_compositorInterface = m_display->createCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
QVERIFY(compositorSpy.wait());
m_compositor = m_registry->createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
m_xdgShellInterface = m_display->createXdgShell(m_display);
m_xdgShellInterface = new XdgShellInterface(m_display, m_display);
QVERIFY(xdgShellSpy.wait());
m_xdgShell = m_registry->createXdgShell(xdgShellSpy.first().first().value<quint32>(),
xdgShellSpy.first().last().value<quint32>(), this);
m_xdgDecorationManagerInterface = m_display->createXdgDecorationManagerV1(m_display);
m_xdgDecorationManagerInterface = new XdgDecorationManagerV1Interface(m_display, m_display);
QVERIFY(xdgDecorationManagerSpy.wait());
m_xdgDecorationManager = m_registry->createXdgDecorationManager(xdgDecorationManagerSpy.first().first().value<quint32>(),

View file

@ -122,11 +122,11 @@ void TestForeign::init()
QVERIFY(registry.isValid());
registry.setup();
m_compositorInterface = m_display->createCompositor(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
QVERIFY(compositorSpy.wait());
m_compositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
m_foreignInterface = m_display->createXdgForeignV2Interface(m_display);
m_foreignInterface = new XdgForeignV2Interface(m_display, m_display);
QVERIFY(exporterSpy.wait());
//Both importer and exporter should have been triggered by now

View file

@ -58,12 +58,12 @@ void TestXdgOutput::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_serverOutput = m_display->createOutput(this);
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 = m_display->createXdgOutputManagerV1(this);
m_serverXdgOutputManager = new XdgOutputManagerV1Interface(m_display, this);
m_serverXdgOutput = m_serverXdgOutputManager->createXdgOutput(m_serverOutput, this);
m_serverXdgOutput->setLogicalSize(QSize(1280, 720)); //a 1.5 scale factor
m_serverXdgOutput->setLogicalPosition(QPoint(11,12)); //not a sensible value for one monitor, but works for this test

View file

@ -93,19 +93,19 @@ void XdgShellTest::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_display->createShm();
m_o1Interface = m_display->createOutput(m_display);
m_o1Interface = new OutputInterface(m_display, m_display);
m_o1Interface->addMode(QSize(1024, 768));
m_o1Interface->create();
m_o2Interface = m_display->createOutput(m_display);
m_o2Interface = new OutputInterface(m_display, m_display);
m_o2Interface->addMode(QSize(1024, 768));
m_o2Interface->create();
m_seatInterface = m_display->createSeat(m_display);
m_seatInterface = new SeatInterface(m_display, m_display);
m_seatInterface->setHasKeyboard(true);
m_seatInterface->setHasPointer(true);
m_seatInterface->setHasTouch(true);
m_seatInterface->create();
m_compositorInterface = m_display->createCompositor(m_display);
m_xdgShellInterface = m_display->createXdgShell(m_display);
m_compositorInterface = new CompositorInterface(m_display, m_display);
m_xdgShellInterface = new XdgShellInterface(m_display, m_display);
// setup connection
m_connection = new KWayland::Client::ConnectionThread;

View file

@ -149,10 +149,10 @@ void DataControlInterfaceTest::init()
m_display->start();
QVERIFY(m_display->isRunning());
m_seat = m_display->createSeat(this);
m_seat = new SeatInterface(m_display, this);
m_seat->create();
m_serverCompositor = m_display->createCompositor(this);
m_dataControlDeviceManagerInterface = m_display->createDataControlDeviceManagerV1(this);
m_serverCompositor = new CompositorInterface(m_display, this);
m_dataControlDeviceManagerInterface = new DataControlDeviceManagerV1Interface(m_display, this);
// setup connection
m_connection = new KWayland::Client::ConnectionThread;

View file

@ -77,20 +77,11 @@ void TestWaylandServerDisplay::testAddRemoveOutput()
display.addSocketName(QStringLiteral("kwin-wayland-server-display-test-output-0"));
display.start();
OutputInterface *output = display.createOutput();
OutputInterface *output = new OutputInterface(&display);
QCOMPARE(display.outputs().size(), 1);
QCOMPARE(display.outputs().first(), output);
// create a second output
OutputInterface *output2 = display.createOutput();
QCOMPARE(display.outputs().size(), 2);
QCOMPARE(display.outputs().first(), output);
QCOMPARE(display.outputs().last(), output2);
// remove the first output
display.removeOutput(output);
QCOMPARE(display.outputs().size(), 1);
QCOMPARE(display.outputs().first(), output2);
// and delete the second
delete output2;
delete output;
QVERIFY(display.outputs().isEmpty());
}
@ -192,7 +183,7 @@ void TestWaylandServerDisplay::testOutputManagement()
Display display;
display.addSocketName("kwayland-test-0");
display.start();
auto kwin = display.createOutputManagement(this);
auto kwin = new OutputManagementInterface(&display, this);
kwin->create();
QVERIFY(kwin->isValid());
}

View file

@ -176,12 +176,12 @@ void TestInputMethodInterface::initTestCase()
m_display.start();
QVERIFY(m_display.isRunning());
m_seat = m_display.createSeat(this);
m_seat = new SeatInterface(&m_display, this);
m_seat->create();
m_serverCompositor = m_display.createCompositor(this);
m_inputMethodIface = m_display.createInputMethodInterface(this);
m_inputPanelIface = m_display.createInputPanelInterface(this);
auto outputIface = m_display.createOutput(this);
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();
connect(m_serverCompositor, &CompositorInterface::surfaceCreated, this, [this](SurfaceInterface *surface) {

View file

@ -99,10 +99,10 @@ void TestKeyboardShortcutsInhibitorInterface::initTestCase()
m_display.start();
QVERIFY(m_display.isRunning());
m_seat = m_display.createSeat(this);
m_seat = new SeatInterface(&m_display, this);
m_seat->create();
m_serverCompositor = m_display.createCompositor(this);
m_manager = m_display.createKeyboardShortcutsInhibitManagerV1(this);
m_serverCompositor = new CompositorInterface(&m_display, this);
m_manager = new KeyboardShortcutsInhibitManagerV1Interface(&m_display, this);
connect(m_serverCompositor, &CompositorInterface::surfaceCreated, this, [this](SurfaceInterface *surface) {
m_surfaces += surface;

View file

@ -106,9 +106,9 @@ void TestLayerShellV1Interface::initTestCase()
m_display.start();
QVERIFY(m_display.isRunning());
m_serverLayerShell = m_display.createLayerShellV1(this);
m_serverXdgShell = m_display.createXdgShell(this);
m_serverCompositor = m_display.createCompositor(this);
m_serverLayerShell = new LayerShellV1Interface(&m_display, this);
m_serverXdgShell = new XdgShellInterface(&m_display, this);
m_serverCompositor = new CompositorInterface(&m_display, this);
m_connection = new KWayland::Client::ConnectionThread;
QSignalSpy connectedSpy(m_connection, &KWayland::Client::ConnectionThread::connected);

View file

@ -119,7 +119,7 @@ void TestScreencastV1Interface::initTestCase()
QSignalSpy screencastSpy(&registry, &KWayland::Client::Registry::interfacesAnnounced);
QVERIFY(screencastSpy.isValid());
m_screencastInterface = m_display->createScreencastV1Interface(this);
m_screencastInterface = new KWaylandServer::ScreencastV1Interface(m_display, this);
connect(m_screencastInterface, &KWaylandServer::ScreencastV1Interface::windowScreencastRequested, this, [this] (KWaylandServer::ScreencastStreamV1Interface *stream, const QString &winid) {
Q_UNUSED(winid);
stream->sendCreated(123);

View file

@ -32,7 +32,7 @@ void TestWaylandServerSeat::testCapabilities()
Display display;
display.addSocketName(s_socketName);
display.start();
SeatInterface *seat = display.createSeat();
SeatInterface *seat = new SeatInterface(&display);
QVERIFY(!seat->hasKeyboard());
QVERIFY(!seat->hasPointer());
QVERIFY(!seat->hasTouch());
@ -82,7 +82,7 @@ void TestWaylandServerSeat::testName()
Display display;
display.addSocketName(s_socketName);
display.start();
SeatInterface *seat = display.createSeat();
SeatInterface *seat = new SeatInterface(&display);
QCOMPARE(seat->name(), QString());
QSignalSpy nameSpy(seat, SIGNAL(nameChanged(QString)));
@ -101,7 +101,7 @@ void TestWaylandServerSeat::testPointerButton()
Display display;
display.addSocketName(s_socketName);
display.start();
SeatInterface *seat = display.createSeat();
SeatInterface *seat = new SeatInterface(&display);
PointerInterface *pointer = seat->focusedPointer();
QVERIFY(!pointer);
@ -131,7 +131,7 @@ void TestWaylandServerSeat::testPointerPos()
Display display;
display.addSocketName(s_socketName);
display.start();
SeatInterface *seat = display.createSeat();
SeatInterface *seat = new SeatInterface(&display);
QSignalSpy seatPosSpy(seat, SIGNAL(pointerPosChanged(QPointF)));
QVERIFY(seatPosSpy.isValid());
PointerInterface *pointer = seat->focusedPointer();
@ -159,7 +159,7 @@ void TestWaylandServerSeat::testRepeatInfo()
Display display;
display.addSocketName(s_socketName);
display.start();
SeatInterface *seat = display.createSeat();
SeatInterface *seat = new SeatInterface(&display);
seat->setHasKeyboard(true);
QCOMPARE(seat->keyboard()->keyRepeatRate(), 0);
QCOMPARE(seat->keyboard()->keyRepeatDelay(), 0);
@ -178,14 +178,14 @@ void TestWaylandServerSeat::testMultiple()
display.addSocketName(s_socketName);
display.start();
QVERIFY(display.seats().isEmpty());
SeatInterface *seat1 = display.createSeat();
SeatInterface *seat1 = new SeatInterface(&display);
QCOMPARE(display.seats().count(), 1);
QCOMPARE(display.seats().at(0), seat1);
SeatInterface *seat2 = display.createSeat();
SeatInterface *seat2 = new SeatInterface(&display);
QCOMPARE(display.seats().count(), 2);
QCOMPARE(display.seats().at(0), seat1);
QCOMPARE(display.seats().at(1), seat2);
SeatInterface *seat3 = display.createSeat();
SeatInterface *seat3 = new SeatInterface(&display);
QCOMPARE(display.seats().count(), 3);
QCOMPARE(display.seats().at(0), seat1);
QCOMPARE(display.seats().at(1), seat2);

View file

@ -127,10 +127,10 @@ void TestTabletInterface::initTestCase()
m_display.start();
QVERIFY(m_display.isRunning());
m_seat = m_display.createSeat(this);
m_seat = new SeatInterface(&m_display, this);
m_seat->create();
m_serverCompositor = m_display.createCompositor(this);
m_tabletManager = m_display.createTabletManagerV2(this);
m_serverCompositor = new CompositorInterface(&m_display, this);
m_tabletManager = new TabletManagerV2Interface(&m_display, this);
connect(m_serverCompositor, &CompositorInterface::surfaceCreated, this, [this](SurfaceInterface *surface) {
m_surfaces += surface;

View file

@ -119,12 +119,12 @@ void TestTextInputV3Interface::initTestCase()
m_display.start();
QVERIFY(m_display.isRunning());
m_seat = m_display.createSeat(this);
m_seat = new SeatInterface(&m_display, this);
m_seat->setHasKeyboard(true);
m_seat->create();
m_serverCompositor = m_display.createCompositor(this);
m_display.createTextInputManagerV3();
m_serverCompositor = new CompositorInterface(&m_display, this);
new TextInputManagerV3Interface(&m_display);
m_connection = new KWayland::Client::ConnectionThread;
QSignalSpy connectedSpy(m_connection, &KWayland::Client::ConnectionThread::connected);

View file

@ -63,9 +63,9 @@ void TestViewporterInterface::initTestCase()
QVERIFY(m_display.isRunning());
m_display.createShm();
m_display.createViewporter();
new ViewporterInterface(&m_display);
m_serverCompositor = m_display.createCompositor(this);
m_serverCompositor = new CompositorInterface(&m_display, this);
m_connection = new KWayland::Client::ConnectionThread;
QSignalSpy connectedSpy(m_connection, &KWayland::Client::ConnectionThread::connected);

View file

@ -32,11 +32,10 @@ class KWAYLANDSERVER_EXPORT BlurManagerInterface : public QObject
{
Q_OBJECT
public:
explicit BlurManagerInterface(Display *display, QObject *parent = nullptr);
~BlurManagerInterface() override;
private:
explicit BlurManagerInterface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<BlurManagerInterfacePrivate> d;
};

View file

@ -32,12 +32,12 @@ class ContrastInterfacePrivate;
class KWAYLANDSERVER_EXPORT ContrastManagerInterface : public QObject
{
Q_OBJECT
public:
explicit ContrastManagerInterface(Display *display, QObject *parent = nullptr);
~ContrastManagerInterface() override;
private:
explicit ContrastManagerInterface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<ContrastManagerInterfacePrivate> d;
};

View file

@ -29,6 +29,7 @@ class KWAYLANDSERVER_EXPORT DataControlDeviceManagerV1Interface : public QObject
Q_OBJECT
public:
explicit DataControlDeviceManagerV1Interface(Display *display, QObject *parent = nullptr);
~DataControlDeviceManagerV1Interface() override;
Q_SIGNALS:
@ -36,8 +37,6 @@ Q_SIGNALS:
void dataDeviceCreated(KWaylandServer::DataControlDeviceV1Interface *dataDevice);
private:
explicit DataControlDeviceManagerV1Interface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<DataControlDeviceManagerV1InterfacePrivate> d;
};

View file

@ -26,7 +26,9 @@ class DataDeviceManagerInterfacePrivate;
class KWAYLANDSERVER_EXPORT DataDeviceManagerInterface : public QObject
{
Q_OBJECT
public:
explicit DataDeviceManagerInterface(Display *display, QObject *parent = nullptr);
~DataDeviceManagerInterface() override;
/**
@ -45,8 +47,6 @@ Q_SIGNALS:
void dataDeviceCreated(KWaylandServer::DataDeviceInterface*);
private:
explicit DataDeviceManagerInterface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<DataDeviceManagerInterfacePrivate> d;
};

View file

@ -5,91 +5,27 @@
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include "display.h"
#include "appmenu_interface.h"
#include "blur_interface.h"
#include "compositor_interface.h"
#include "contrast_interface.h"
#include "datacontroldevicemanager_v1_interface.h"
#include "datadevicemanager_interface.h"
#include "dpms_interface.h"
#include "eglstream_controller_interface.h"
#include "fakeinput_interface.h"
#include "idle_interface.h"
#include "idleinhibit_v1_interface_p.h"
#include "keyboard_shortcuts_inhibit_v1_interface.h"
#include "keystate_interface.h"
#include "layershell_v1_interface.h"
#include "linuxdmabuf_v1_interface.h"
#include "display_p.h"
#include "logging.h"
#include "output_interface.h"
#include "outputconfiguration_interface.h"
#include "outputdevice_interface.h"
#include "outputmanagement_interface.h"
#include "plasmashell_interface.h"
#include "plasmavirtualdesktop_interface.h"
#include "plasmawindowmanagement_interface.h"
#include "pointerconstraints_v1_interface_p.h"
#include "pointergestures_v1_interface.h"
#include "primaryselectiondevicemanager_v1_interface.h"
#include "relativepointer_v1_interface.h"
#include "seat_interface.h"
#include "screencast_v1_interface.h"
#include "server_decoration_interface.h"
#include "server_decoration_palette_interface.h"
#include "shadow_interface.h"
#include "slide_interface.h"
#include "subcompositor_interface.h"
#include "tablet_v2_interface.h"
#include "textinput_v2_interface_p.h"
#include "textinput_v3_interface_p.h"
#include "viewporter_interface.h"
#include "xdgdecoration_v1_interface.h"
#include "xdgforeign_v2_interface.h"
#include "xdgoutput_v1_interface.h"
#include "xdgshell_interface.h"
#include "inputmethod_v1_interface.h"
#include <QCoreApplication>
#include <QDebug>
#include <QAbstractEventDispatcher>
#include <QSocketNotifier>
#include <QThread>
#include <wayland-server.h>
#include <EGL/egl.h>
namespace KWaylandServer
{
class Display::Private
DisplayPrivate *DisplayPrivate::get(Display *display)
{
public:
Private(Display *q);
return display->d.data();
}
void registerSocketName(const QString &socketName);
QSocketNotifier *socketNotifier = nullptr;
wl_display *display = nullptr;
wl_event_loop *loop = nullptr;
bool running = false;
QList<OutputInterface*> outputs;
QList<OutputDeviceInterface*> outputdevices;
QVector<SeatInterface*> seats;
QVector<ClientConnection*> clients;
QStringList socketNames;
EGLDisplay eglDisplay = EGL_NO_DISPLAY;
private:
Display *q;
};
Display::Private::Private(Display *q)
DisplayPrivate::DisplayPrivate(Display *q)
: q(q)
{
}
void Display::Private::registerSocketName(const QString &socketName)
void DisplayPrivate::registerSocketName(const QString &socketName)
{
socketNames.append(socketName);
emit q->socketNamesChanged();
@ -97,7 +33,7 @@ void Display::Private::registerSocketName(const QString &socketName)
Display::Display(QObject *parent)
: QObject(parent)
, d(new Private(this))
, d(new DisplayPrivate(this))
{
d->display = wl_display_create();
d->loop = wl_display_get_event_loop(d->display);
@ -178,243 +114,12 @@ void Display::flush()
wl_display_flush_clients(d->display);
}
OutputInterface *Display::createOutput(QObject *parent)
{
OutputInterface *output = new OutputInterface(this, parent);
connect(output, &QObject::destroyed, this, [this,output] { d->outputs.removeAll(output); });
d->outputs << output;
return output;
}
CompositorInterface *Display::createCompositor(QObject *parent)
{
return new CompositorInterface(this, parent);
}
OutputDeviceInterface *Display::createOutputDevice(QObject *parent)
{
OutputDeviceInterface *output = new OutputDeviceInterface(this, parent);
connect(output, &QObject::destroyed, this, [this,output] { d->outputdevices.removeAll(output); });
d->outputdevices << output;
return output;
}
OutputManagementInterface *Display::createOutputManagement(QObject *parent)
{
return new OutputManagementInterface(this, parent);
}
SeatInterface *Display::createSeat(QObject *parent)
{
SeatInterface *seat = new SeatInterface(this, parent);
connect(seat, &QObject::destroyed, this, [this, seat] { d->seats.removeAll(seat); });
d->seats << seat;
return seat;
}
SubCompositorInterface *Display::createSubCompositor(QObject *parent)
{
return new SubCompositorInterface(this, parent);
}
DataDeviceManagerInterface *Display::createDataDeviceManager(QObject *parent)
{
return new DataDeviceManagerInterface(this, parent);
}
PlasmaShellInterface *Display::createPlasmaShell(QObject* parent)
{
return new PlasmaShellInterface(this, parent);
}
PlasmaWindowManagementInterface *Display::createPlasmaWindowManagement(QObject *parent)
{
return new PlasmaWindowManagementInterface(this, parent);
}
IdleInterface *Display::createIdle(QObject *parent)
{
return new IdleInterface(this, parent);
}
FakeInputInterface *Display::createFakeInput(QObject *parent)
{
return new FakeInputInterface(this, parent);
}
ShadowManagerInterface *Display::createShadowManager(QObject *parent)
{
return new ShadowManagerInterface(this, parent);
}
BlurManagerInterface *Display::createBlurManager(QObject *parent)
{
return new BlurManagerInterface(this, parent);
}
ContrastManagerInterface *Display::createContrastManager(QObject *parent)
{
return new ContrastManagerInterface(this, parent);
}
SlideManagerInterface *Display::createSlideManager(QObject *parent)
{
return new SlideManagerInterface(this, parent);
}
DpmsManagerInterface *Display::createDpmsManager(QObject *parent)
{
return new DpmsManagerInterface(this, parent);
}
ServerSideDecorationManagerInterface *Display::createServerSideDecorationManager(QObject *parent)
{
return new ServerSideDecorationManagerInterface(this, parent);
}
ScreencastV1Interface *Display::createScreencastV1Interface(QObject *parent)
{
return new ScreencastV1Interface(this, parent);
}
TextInputManagerV2Interface *Display::createTextInputManagerV2(QObject *parent)
{
return new TextInputManagerV2Interface(this, parent);
}
TextInputManagerV3Interface *Display::createTextInputManagerV3(QObject *parent)
{
return new TextInputManagerV3Interface(this, parent);
}
XdgShellInterface *Display::createXdgShell(QObject *parent)
{
return new XdgShellInterface(this, parent);
}
RelativePointerManagerV1Interface *Display::createRelativePointerManagerV1(QObject *parent)
{
return new RelativePointerManagerV1Interface(this, parent);
}
PointerGesturesV1Interface *Display::createPointerGesturesV1(QObject *parent)
{
return new PointerGesturesV1Interface(this, parent);
}
PointerConstraintsV1Interface *Display::createPointerConstraintsV1(QObject *parent)
{
return new PointerConstraintsV1Interface(this, parent);
}
XdgForeignV2Interface *Display::createXdgForeignV2Interface(QObject *parent)
{
return new XdgForeignV2Interface(this, parent);
}
IdleInhibitManagerV1Interface *Display::createIdleInhibitManagerV1(QObject *parent)
{
return new IdleInhibitManagerV1Interface(this, parent);
}
AppMenuManagerInterface *Display::createAppMenuManagerInterface(QObject *parent)
{
return new AppMenuManagerInterface(this, parent);
}
ServerSideDecorationPaletteManagerInterface *Display::createServerSideDecorationPaletteManager(QObject *parent)
{
return new ServerSideDecorationPaletteManagerInterface(this, parent);
}
LinuxDmabufUnstableV1Interface *Display::createLinuxDmabufInterface(QObject *parent)
{
return new LinuxDmabufUnstableV1Interface(this, parent);
}
PlasmaVirtualDesktopManagementInterface *Display::createPlasmaVirtualDesktopManagement(QObject *parent)
{
return new PlasmaVirtualDesktopManagementInterface(this, parent);
}
XdgOutputManagerV1Interface *Display::createXdgOutputManagerV1(QObject *parent)
{
return new XdgOutputManagerV1Interface(this, parent);
}
XdgDecorationManagerV1Interface *Display::createXdgDecorationManagerV1(QObject *parent)
{
return new XdgDecorationManagerV1Interface(this, parent);
}
EglStreamControllerInterface *Display::createEglStreamControllerInterface(QObject *parent)
{
return new EglStreamControllerInterface(this, parent);
}
KeyStateInterface *Display::createKeyStateInterface(QObject *parent)
{
return new KeyStateInterface(this, parent);
}
TabletManagerV2Interface *Display::createTabletManagerV2(QObject *parent)
{
return new TabletManagerV2Interface(this, parent);
}
DataControlDeviceManagerV1Interface *Display::createDataControlDeviceManagerV1(QObject *parent)
{
return new DataControlDeviceManagerV1Interface(this, parent);
}
KeyboardShortcutsInhibitManagerV1Interface *Display::createKeyboardShortcutsInhibitManagerV1(QObject *parent)
{
return new KeyboardShortcutsInhibitManagerV1Interface(this, parent);
}
InputMethodV1Interface *Display::createInputMethodInterface(QObject *parent)
{
return new InputMethodV1Interface(this, parent);
}
ViewporterInterface *Display::createViewporter(QObject *parent)
{
return new ViewporterInterface(this, parent);
}
PrimarySelectionDeviceManagerV1Interface *Display::createPrimarySelectionDeviceManagerV1(QObject *parent)
{
return new PrimarySelectionDeviceManagerV1Interface(this, parent);
}
InputPanelV1Interface *Display::createInputPanelInterface(QObject *parent)
{
return new InputPanelV1Interface(this, parent);
}
LayerShellV1Interface *Display::createLayerShellV1(QObject *parent)
{
return new LayerShellV1Interface(this, parent);
}
void Display::createShm()
{
Q_ASSERT(d->display);
wl_display_init_shm(d->display);
}
void Display::removeOutput(OutputInterface *output)
{
d->outputs.removeAll(output);
delete output;
}
void Display::removeOutputDevice(OutputDeviceInterface *output)
{
d->outputdevices.removeAll(output);
delete output;
}
quint32 Display::nextSerial()
{
return wl_display_next_serial(d->display);

View file

@ -34,50 +34,11 @@ namespace KWaylandServer
* @see Display
**/
class CompositorInterface;
class DataDeviceManagerInterface;
class DpmsManagerInterface;
class IdleInterface;
class IdleInhibitManagerV1Interface;
class FakeInputInterface;
class ClientConnection;
class DisplayPrivate;
class OutputInterface;
class OutputDeviceInterface;
class OutputConfigurationInterface;
class OutputManagementInterface;
class PlasmaShellInterface;
class PlasmaWindowManagementInterface;
class QtSurfaceExtensionInterface;
class SeatInterface;
class ShadowManagerInterface;
class BlurManagerInterface;
class ContrastManagerInterface;
class ServerSideDecorationManagerInterface;
class SlideManagerInterface;
class SubCompositorInterface;
class TextInputManagerV2Interface;
class TextInputManagerV3Interface;
class XdgShellInterface;
class RelativePointerManagerV1Interface;
class PointerGesturesV1Interface;
class PointerConstraintsV1Interface;
class XdgForeignV2Interface;
class AppMenuManagerInterface;
class ServerSideDecorationPaletteManagerInterface;
class PlasmaVirtualDesktopManagementInterface;
class XdgOutputManagerV1Interface;
class XdgDecorationManagerV1Interface;
class EglStreamControllerInterface;
class KeyStateInterface;
class LinuxDmabufUnstableV1Interface;
class TabletManagerV2Interface;
class DataControlDeviceManagerV1Interface;
class PrimarySelectionDeviceManagerV1Interface;
class KeyboardShortcutsInhibitManagerV1Interface;
class ViewporterInterface;
class ScreencastV1Interface;
class InputMethodV1Interface;
class InputPanelV1Interface;
class LayerShellV1Interface;
/**
* @brief Class holding the Wayland server display loop.
@ -146,200 +107,14 @@ public:
operator wl_display*() const;
bool isRunning() const;
OutputInterface *createOutput(QObject *parent = nullptr);
void removeOutput(OutputInterface *output);
QList<OutputInterface*> outputs() const;
OutputDeviceInterface *createOutputDevice(QObject *parent = nullptr);
void removeOutputDevice(OutputDeviceInterface *output);
QList<OutputDeviceInterface*> outputDevices() const;
CompositorInterface *createCompositor(QObject *parent = nullptr);
void createShm();
SeatInterface *createSeat(QObject *parent = nullptr);
/**
* @returns All SeatInterface currently managed on the Display.
* @since 5.6
**/
QVector<SeatInterface*> seats() const;
SubCompositorInterface *createSubCompositor(QObject *parent = nullptr);
DataDeviceManagerInterface *createDataDeviceManager(QObject *parent = nullptr);
OutputManagementInterface *createOutputManagement(QObject *parent = nullptr);
PlasmaShellInterface *createPlasmaShell(QObject *parent = nullptr);
PlasmaWindowManagementInterface *createPlasmaWindowManagement(QObject *parent = nullptr);
IdleInterface *createIdle(QObject *parent = nullptr);
FakeInputInterface *createFakeInput(QObject *parent = nullptr);
ShadowManagerInterface *createShadowManager(QObject *parent = nullptr);
BlurManagerInterface *createBlurManager(QObject *parent = nullptr);
ContrastManagerInterface *createContrastManager(QObject *parent = nullptr);
SlideManagerInterface *createSlideManager(QObject *parent = nullptr);
DpmsManagerInterface *createDpmsManager(QObject *parent = nullptr);
/** @since 5.60 */
KeyStateInterface *createKeyStateInterface(QObject *parent = nullptr);
/**
* @since 5.6
**/
ServerSideDecorationManagerInterface *createServerSideDecorationManager(QObject *parent = nullptr);
/**
* Create the text input manager in interface @p version.
* @returns The created manager object
* @since 5.23
**/
TextInputManagerV2Interface *createTextInputManagerV2(QObject *parent = nullptr);
/**
* Create a text input manager v3
* @returns The created manager object
* @since 5.21
*/
TextInputManagerV3Interface *createTextInputManagerV3(QObject *parent = nullptr);
/**
* Creates the XdgShell in interface @p version.
*
* @since 5.25
**/
XdgShellInterface *createXdgShell(QObject *parent = nullptr);
/**
* Creates the RelativePointerManagerV1Interface
*
* @returns The created manager object
* @since 5.28
**/
RelativePointerManagerV1Interface *createRelativePointerManagerV1(QObject *parent = nullptr);
/**
* Creates the PointerGesturesV1Interface
*
* @returns The created manager object
* @since 5.29
**/
PointerGesturesV1Interface *createPointerGesturesV1(QObject *parent = nullptr);
/**
* Creates the PointerConstraintsV1Interface
*
* @returns The created manager object
* @since 5.29
**/
PointerConstraintsV1Interface *createPointerConstraintsV1(QObject *parent = nullptr);
/**
* Creates the XdgForeignV2Interface in interface @p version
*
* @returns The created manager object
* @since 5.40
**/
XdgForeignV2Interface *createXdgForeignV2Interface(QObject *parent = nullptr);
/**
* Creates the IdleInhibitManagerInterface in interface @p version.
*
* @returns The created manager object
* @since 5.41
**/
IdleInhibitManagerV1Interface *createIdleInhibitManagerV1(QObject *parent = nullptr);
/**
* Creates the AppMenuManagerInterface in interface @p version.
*
* @returns The created manager object
* @since 5.42
**/
AppMenuManagerInterface *createAppMenuManagerInterface(QObject *parent = nullptr);
/**
* Creates the ServerSideDecorationPaletteManagerInterface in interface @p version.
*
* @returns The created manager object
* @since 5.42
**/
ServerSideDecorationPaletteManagerInterface *createServerSideDecorationPaletteManager(QObject *parent = nullptr);
/**
* Creates the LinuxDmabufUnstableV1Interface in interface @p version.
*
* @returns A pointer to the created interface
**/
LinuxDmabufUnstableV1Interface *createLinuxDmabufInterface(QObject *parent = nullptr);
/**
* Creates the XdgOutputManagerInterface
*
* @return the created manager
* @since 5.47
*/
XdgOutputManagerV1Interface *createXdgOutputManagerV1(QObject *parent = nullptr);
/**
* Creates the PlasmaVirtualDesktopManagementInterface in interface @p version.
*
* @returns The created manager object
* @since 5.52
**/
PlasmaVirtualDesktopManagementInterface *createPlasmaVirtualDesktopManagement(QObject *parent = nullptr);
/**
* Creates the XdgDecorationManagerInterface
* @arg shellInterface A created XdgShellInterface based on XDG_WM_BASE
*
* @return the created manager
* @since 5.54
*/
XdgDecorationManagerV1Interface *createXdgDecorationManagerV1(QObject *parent = nullptr);
/**
* Creates the EglStreamControllerInterface
*
* @return the created EGL Stream controller
* @since 5.58
*/
EglStreamControllerInterface *createEglStreamControllerInterface(QObject *parent = nullptr);
InputMethodV1Interface *createInputMethodInterface(QObject *parent = nullptr);
InputPanelV1Interface *createInputPanelInterface(QObject *parent = nullptr);
/**
* Creates the DataControlDeviceManagerV1
*
*/
DataControlDeviceManagerV1Interface *createDataControlDeviceManagerV1(QObject *parent = nullptr);
/**
* Creates the entry point to support wacom-like tablets and pens.
*
* @since 5.67
*/
TabletManagerV2Interface *createTabletManagerV2(QObject *parent = nullptr);
/**
* Creates the KeyboardShortcutsInhibitorV1Interface
*/
KeyboardShortcutsInhibitManagerV1Interface *createKeyboardShortcutsInhibitManagerV1(QObject *parent = nullptr);
/**
* Creates the viewporter compositor extension.
*/
ViewporterInterface *createViewporter(QObject *parent = nullptr);
/**
* Creates the PrimarySelectionDeviceManagerV1Interface
*/
PrimarySelectionDeviceManagerV1Interface *createPrimarySelectionDeviceManagerV1(QObject *parent = nullptr);
/**
* Creates an interface to request video feeds of different compositor resources
*/
ScreencastV1Interface *createScreencastV1Interface(QObject *parent = nullptr);
/**
* Creates the layer shell compositor extension.
*/
LayerShellV1Interface *createLayerShellV1(QObject *parent = nullptr);
QList<OutputDeviceInterface *> outputDevices() const;
QList<OutputInterface *> outputs() const;
/**
* Gets the ClientConnection for the given @p client.
@ -377,8 +152,8 @@ Q_SIGNALS:
void clientDisconnected(KWaylandServer::ClientConnection*);
private:
class Private;
QScopedPointer<Private> d;
friend class DisplayPrivate;
QScopedPointer<DisplayPrivate> d;
};
}

49
src/wayland/display_p.h Normal file
View file

@ -0,0 +1,49 @@
/*
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2018 David Edmundson <davidedmundson@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#pragma once
#include <wayland-server-core.h>
#include <QList>
#include <QSocketNotifier>
#include <QString>
#include <QVector>
#include <EGL/egl.h>
namespace KWaylandServer
{
class ClientConnection;
class Display;
class OutputInterface;
class OutputDeviceInterface;
class SeatInterface;
class DisplayPrivate
{
public:
static DisplayPrivate *get(Display *display);
DisplayPrivate(Display *q);
void registerSocketName(const QString &socketName);
Display *q;
QSocketNotifier *socketNotifier = nullptr;
wl_display *display = nullptr;
wl_event_loop *loop = nullptr;
bool running = false;
QList<OutputInterface *> outputs;
QList<OutputDeviceInterface *> outputdevices;
QVector<SeatInterface *> seats;
QVector<ClientConnection *> clients;
QStringList socketNames;
EGLDisplay eglDisplay = EGL_NO_DISPLAY;
};
} // namespace KWaylandServer

View file

@ -52,12 +52,12 @@ class DpmsManagerInterfacePrivate;
class KWAYLANDSERVER_EXPORT DpmsManagerInterface : public QObject
{
Q_OBJECT
public:
explicit DpmsManagerInterface(Display *display, QObject *parent = nullptr);
~DpmsManagerInterface() override;
private:
explicit DpmsManagerInterface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<DpmsManagerInterfacePrivate> d;
};

View file

@ -42,7 +42,9 @@ class FakeInputInterfacePrivate;
class KWAYLANDSERVER_EXPORT FakeInputInterface : public QObject
{
Q_OBJECT
public:
explicit FakeInputInterface(Display *display, QObject *parent = nullptr);
~FakeInputInterface() override;
Q_SIGNALS:
@ -53,8 +55,6 @@ Q_SIGNALS:
void deviceCreated(KWaylandServer::FakeInputDevice *device);
private:
explicit FakeInputInterface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<FakeInputInterfacePrivate> d;
};

View file

@ -41,7 +41,9 @@ class IdleInterfacePrivate;
class KWAYLANDSERVER_EXPORT IdleInterface : public QObject
{
Q_OBJECT
public:
explicit IdleInterface(Display *display, QObject *parent = nullptr);
~IdleInterface() override;
/**
@ -100,8 +102,6 @@ Q_SIGNALS:
void inhibitedChanged();
private:
explicit IdleInterface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<IdleInterfacePrivate> d;
};

View file

@ -28,12 +28,10 @@ class IdleInhibitManagerV1InterfacePrivate;
class KWAYLANDSERVER_EXPORT IdleInhibitManagerV1Interface : public QObject
{
Q_OBJECT
public:
~IdleInhibitManagerV1Interface() override;
protected:
friend class Display;
public:
explicit IdleInhibitManagerV1Interface(Display *display, QObject *parent = nullptr);
~IdleInhibitManagerV1Interface() override;
private:
QScopedPointer<IdleInhibitManagerV1InterfacePrivate> d;

View file

@ -55,6 +55,7 @@ class KWAYLANDSERVER_EXPORT KeyboardShortcutsInhibitManagerV1Interface : public
Q_OBJECT
public:
explicit KeyboardShortcutsInhibitManagerV1Interface(Display *d, QObject *parent = nullptr);
~KeyboardShortcutsInhibitManagerV1Interface() override;
/**
@ -69,9 +70,7 @@ Q_SIGNALS:
void inhibitorCreated(KeyboardShortcutsInhibitorV1Interface *inhibitor);
private:
friend class Display;
friend class KeyboardShortcutsInhibitorV1InterfacePrivate;
explicit KeyboardShortcutsInhibitManagerV1Interface(Display *d, QObject *parent = nullptr);
void removeInhibitor(SurfaceInterface *const surface, SeatInterface *const seat);
QScopedPointer<KeyboardShortcutsInhibitManagerV1InterfacePrivate> d;
};

View file

@ -24,7 +24,9 @@ class KeyStateInterfacePrivate;
class KWAYLANDSERVER_EXPORT KeyStateInterface : public QObject
{
Q_OBJECT
public:
explicit KeyStateInterface(Display *display, QObject *parent = nullptr);
virtual ~KeyStateInterface();
enum class Key {
@ -43,9 +45,6 @@ public:
void setState(Key k, State s);
private:
explicit KeyStateInterface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<KeyStateInterfacePrivate> d;
};

View file

@ -4,6 +4,7 @@
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include "output_interface.h"
#include "display_p.h"
#include "global_p.h"
#include "display.h"
@ -67,11 +68,19 @@ OutputInterface::Private::Private(OutputInterface *q, Display *d)
: Global::Private(d, &wl_output_interface, s_version)
, q(q)
{
DisplayPrivate *displayPrivate = DisplayPrivate::get(display);
displayPrivate->outputs.append(q);
s_privates << this;
}
OutputInterface::Private::~Private()
{
if (display) {
DisplayPrivate *displayPrivate = DisplayPrivate::get(display);
displayPrivate->outputs.removeOne(q);
}
s_privates.removeAll(this);
}

View file

@ -72,6 +72,8 @@ public:
Suspend,
Off
};
explicit OutputInterface(Display *display, QObject *parent = nullptr);
virtual ~OutputInterface();
QSize physicalSize() const;
@ -147,8 +149,6 @@ Q_SIGNALS:
void dpmsModeRequested(KWaylandServer::OutputInterface::DpmsMode mode);
private:
friend class Display;
explicit OutputInterface(Display *display, QObject *parent = nullptr);
class Private;
Private *d_func() const;
};

View file

@ -39,7 +39,9 @@ class PlasmaShellSurfaceInterfacePrivate;
class KWAYLANDSERVER_EXPORT PlasmaShellInterface : public QObject
{
Q_OBJECT
public:
explicit PlasmaShellInterface(Display *display, QObject *parent);
virtual ~PlasmaShellInterface();
Q_SIGNALS:
@ -49,8 +51,6 @@ Q_SIGNALS:
void surfaceCreated(KWaylandServer::PlasmaShellSurfaceInterface*);
private:
friend class Display;
explicit PlasmaShellInterface(Display *display, QObject *parent);
QScopedPointer<PlasmaShellInterfacePrivate> d;
};

View file

@ -27,7 +27,9 @@ class PlasmaVirtualDesktopManagementInterfacePrivate;
class KWAYLANDSERVER_EXPORT PlasmaVirtualDesktopManagementInterface : public QObject
{
Q_OBJECT
public:
explicit PlasmaVirtualDesktopManagementInterface(Display *display, QObject *parent = nullptr);
~PlasmaVirtualDesktopManagementInterface() override;
/**
@ -90,8 +92,6 @@ Q_SIGNALS:
void desktopCreateRequested(const QString &name, quint32 position);
private:
explicit PlasmaVirtualDesktopManagementInterface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<PlasmaVirtualDesktopManagementInterfacePrivate> d;
};

View file

@ -28,7 +28,9 @@ class PlasmaWindowInterfacePrivate;
class KWAYLANDSERVER_EXPORT PlasmaWindowManagementInterface : public QObject
{
Q_OBJECT
public:
explicit PlasmaWindowManagementInterface(Display *display, QObject *parent = nullptr);
~PlasmaWindowManagementInterface() override;
enum class ShowingDesktopState {
Disabled,
@ -81,8 +83,6 @@ Q_SIGNALS:
void requestChangeShowingDesktop(ShowingDesktopState requestedState);
private:
friend class Display;
explicit PlasmaWindowManagementInterface(Display *display, QObject *parent);
QScopedPointer<PlasmaWindowManagementInterfacePrivate> d;
};

View file

@ -25,7 +25,9 @@ class PrimarySelectionDeviceV1Interface;
class KWAYLANDSERVER_EXPORT PrimarySelectionDeviceManagerV1Interface : public QObject
{
Q_OBJECT
public:
explicit PrimarySelectionDeviceManagerV1Interface(Display *display, QObject *parent = nullptr);
~PrimarySelectionDeviceManagerV1Interface();
Q_SIGNALS:
@ -33,8 +35,6 @@ Q_SIGNALS:
void dataDeviceCreated(KWaylandServer::PrimarySelectionDeviceV1Interface *dataDevice);
private:
explicit PrimarySelectionDeviceManagerV1Interface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<PrimarySelectionDeviceManagerV1InterfacePrivate> d;
};

View file

@ -43,7 +43,9 @@ private:
class KWAYLANDSERVER_EXPORT ScreencastV1Interface : public QObject
{
Q_OBJECT
public:
explicit ScreencastV1Interface(Display *display, QObject *parent = nullptr);
virtual ~ScreencastV1Interface();
enum CursorMode {
@ -58,8 +60,6 @@ Q_SIGNALS:
void windowScreencastRequested(ScreencastStreamV1Interface *stream, const QString &winid, CursorMode mode);
private:
explicit ScreencastV1Interface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<ScreencastV1InterfacePrivate> d;
};

View file

@ -5,6 +5,7 @@
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include "abstract_data_source.h"
#include "display_p.h"
#include "seat_interface.h"
#include "seat_interface_p.h"
#include "display.h"
@ -81,11 +82,20 @@ SeatInterface::SeatInterface(Display *display, QObject *parent)
connect(this, &SeatInterface::hasPointerChanged, this, sendCapabilitiesAll);
connect(this, &SeatInterface::hasKeyboardChanged, this, sendCapabilitiesAll);
connect(this, &SeatInterface::hasTouchChanged, this, sendCapabilitiesAll);
DisplayPrivate *displayPrivate = DisplayPrivate::get(d->display);
displayPrivate->seats.append(this);
}
SeatInterface::~SeatInterface()
{
Q_D();
if (d->display) {
DisplayPrivate *displayPrivate = DisplayPrivate::get(d->display);
displayPrivate->seats.removeOne(this);
}
while (!d->resources.isEmpty()) {
wl_resource_destroy(d->resources.takeLast());
}

View file

@ -134,6 +134,7 @@ class KWAYLANDSERVER_EXPORT SeatInterface : public Global
**/
Q_PROPERTY(quint32 timestamp READ timestamp WRITE setTimestamp NOTIFY timestampChanged)
public:
explicit SeatInterface(Display *display, QObject *parent = nullptr);
virtual ~SeatInterface();
QString name() const;
@ -713,13 +714,11 @@ Q_SIGNALS:
void focusedTextInputSurfaceChanged();
private:
friend class Display;
friend class DataControlDeviceV1Interface;
friend class DataDeviceInterface;
friend class PrimarySelectionDeviceV1Interface;
friend class TextInputManagerV2InterfacePrivate;
friend class KeyboardInterface;
explicit SeatInterface(Display *display, QObject *parent);
class Private;
Private *d_func() const;

View file

@ -29,7 +29,9 @@ class EglStreamControllerInterfacePrivate;
class KWAYLANDSERVER_EXPORT EglStreamControllerInterface : public QObject
{
Q_OBJECT
public:
explicit EglStreamControllerInterface(Display *display, QObject *parent = nullptr);
~EglStreamControllerInterface() override;
Q_SIGNALS:
@ -39,10 +41,7 @@ Q_SIGNALS:
void streamConsumerAttached(SurfaceInterface *surface, void *eglStream, wl_array *attribs);
private:
explicit EglStreamControllerInterface(Display *display, QObject *parent = nullptr);
QScopedPointer<EglStreamControllerInterfacePrivate> d;
friend class Display;
};
}

View file

@ -8,6 +8,8 @@
#include "global.h"
#include <QPointer>
#include <wayland-server-core.h>
namespace KWaylandServer
@ -25,7 +27,10 @@ public:
virtual ~Private();
void create();
Display *display = nullptr;
// We need to reset display from the destroy listener, but due to the private class
// being nested, this is not easy to do so. Either way, we are moving away from the
// old approach, so it's not worth wasting our time.
QPointer<Display> display;
wl_global *global = nullptr;
DisplayDestroyListener displayDestroyListener;

View file

@ -77,6 +77,8 @@ class KWAYLANDSERVER_EXPORT LinuxDmabufUnstableV1Interface : public Global
{
Q_OBJECT
public:
explicit LinuxDmabufUnstableV1Interface(Display *display, QObject *parent = nullptr);
enum Flag {
YInverted = (1 << 0), /// Contents are y-inverted
Interlaced = (1 << 1), /// Content is interlaced
@ -143,17 +145,11 @@ public:
static LinuxDmabufUnstableV1Interface *get(wl_resource *native);
private:
/**
* @internal
*/
explicit LinuxDmabufUnstableV1Interface(Display *display, QObject *parent = nullptr);
/**
* Returns a pointer to the wl_buffer implementation for imported dmabufs.
*/
static const struct wl_buffer_interface *bufferImplementation();
friend class Display;
friend class BufferInterface;
class Private;

View file

@ -4,6 +4,7 @@
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include "outputdevice_interface.h"
#include "display_p.h"
#include "global_p.h"
#include "display.h"
#include "logging.h"
@ -86,11 +87,19 @@ OutputDeviceInterface::Private::Private(OutputDeviceInterface *q, Display *d)
: Global::Private(d, &org_kde_kwin_outputdevice_interface, s_version)
, q(q)
{
DisplayPrivate *displayPrivate = DisplayPrivate::get(display);
displayPrivate->outputdevices.append(q);
s_privates << this;
}
OutputDeviceInterface::Private::~Private()
{
if (display) {
DisplayPrivate *displayPrivate = DisplayPrivate::get(display);
displayPrivate->outputdevices.removeOne(q);
}
s_privates.removeAll(this);
}

View file

@ -83,6 +83,8 @@ public:
bool operator==(const ColorCurves &cc) const;
bool operator!=(const ColorCurves &cc) const;
};
explicit OutputDeviceInterface(Display *display, QObject *parent = nullptr);
virtual ~OutputDeviceInterface();
QSize physicalSize() const;
@ -175,8 +177,6 @@ Q_SIGNALS:
void uuidChanged();
private:
friend class Display;
explicit OutputDeviceInterface(Display *display, QObject *parent = nullptr);
class Private;
Private *d_func() const;
};

View file

@ -31,7 +31,9 @@ class OutputConfigurationInterface;
class KWAYLANDSERVER_EXPORT OutputManagementInterface : public Global
{
Q_OBJECT
public:
explicit OutputManagementInterface(Display *display, QObject *parent = nullptr);
virtual ~OutputManagementInterface();
Q_SIGNALS:
@ -51,8 +53,6 @@ Q_SIGNALS:
void configurationChangeRequested(KWaylandServer::OutputConfigurationInterface *configurationInterface);
private:
explicit OutputManagementInterface(Display *display, QObject *parent = nullptr);
friend class Display;
class Private;
};

View file

@ -29,7 +29,9 @@ class ServerSideDecorationInterfacePrivate;
class KWAYLANDSERVER_EXPORT ServerSideDecorationManagerInterface : public QObject
{
Q_OBJECT
public:
explicit ServerSideDecorationManagerInterface(Display *display, QObject *parent = nullptr);
~ServerSideDecorationManagerInterface() override;
/**
@ -69,8 +71,6 @@ Q_SIGNALS:
void decorationCreated(KWaylandServer::ServerSideDecorationInterface*);
private:
explicit ServerSideDecorationManagerInterface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<ServerSideDecorationManagerInterfacePrivate> d;
};

View file

@ -30,7 +30,9 @@ class ServerSideDecorationPaletteInterfacePrivate;
class KWAYLANDSERVER_EXPORT ServerSideDecorationPaletteManagerInterface : public QObject
{
Q_OBJECT
public:
explicit ServerSideDecorationPaletteManagerInterface(Display *display, QObject *parent = nullptr);
~ServerSideDecorationPaletteManagerInterface() override;
/**
* Returns any existing palette for a given surface
@ -45,8 +47,6 @@ Q_SIGNALS:
void paletteCreated(KWaylandServer::ServerSideDecorationPaletteInterface*);
private:
explicit ServerSideDecorationPaletteManagerInterface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<ServerSideDecorationPaletteManagerInterfacePrivate> d;
};

View file

@ -24,14 +24,14 @@ class ShadowInterfacePrivate;
class KWAYLANDSERVER_EXPORT ShadowManagerInterface : public QObject
{
Q_OBJECT
public:
explicit ShadowManagerInterface(Display *display, QObject *parent = nullptr);
~ShadowManagerInterface() override;
Display *display() const;
private:
explicit ShadowManagerInterface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<ShadowManagerInterfacePrivate> d;
};

View file

@ -22,12 +22,12 @@ class SlideInterfacePrivate;
class KWAYLANDSERVER_EXPORT SlideManagerInterface : public QObject
{
Q_OBJECT
public:
explicit SlideManagerInterface(Display *display, QObject *parent = nullptr);
~SlideManagerInterface() override;
private:
explicit SlideManagerInterface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<SlideManagerInterfacePrivate> d;
};

View file

@ -39,13 +39,12 @@ class KWAYLANDSERVER_EXPORT TabletManagerV2Interface : public QObject
{
Q_OBJECT
public:
explicit TabletManagerV2Interface(Display *d, QObject *parent);
virtual ~TabletManagerV2Interface();
TabletSeatV2Interface *seat(SeatInterface *seat) const;
private:
friend class Display;
explicit TabletManagerV2Interface(Display *d, QObject *parent);
QScopedPointer<TabletManagerV2InterfacePrivate> d;
};

View file

@ -239,16 +239,16 @@ int main(int argc, char **argv)
Display display;
display.start();
DataDeviceManagerInterface *ddm = display.createDataDeviceManager();
display.createCompositor(&display);
XdgShellInterface *shell = display.createXdgShell();
new DataDeviceManagerInterface(&display);
new CompositorInterface(&display, &display);
XdgShellInterface *shell = new XdgShellInterface(&display);
display.createShm();
OutputInterface *output = display.createOutput(&display);
OutputInterface *output = new OutputInterface(&display, &display);
output->setPhysicalSize(QSize(269, 202));
const QSize windowSize(1024, 768);
output->addMode(windowSize);
output->create();
SeatInterface *seat = display.createSeat();
SeatInterface *seat = new SeatInterface(&display);
seat->setHasKeyboard(true);
seat->setHasPointer(true);
seat->setName(QStringLiteral("testSeat0"));

View file

@ -75,10 +75,9 @@ int main(int argc, char **argv)
Display display;
display.start();
display.createShm();
display.createCompositor(&display);
XdgShellInterface *shell = display.createXdgShell();
Q_UNUSED(shell)
OutputInterface *output = display.createOutput(&display);
new CompositorInterface(&display, &display);
new XdgShellInterface(&display, &display);
OutputInterface *output = new OutputInterface(&display, &display);
output->setPhysicalSize(QSize(10, 10));
output->addMode(QSize(1024, 768));
output->create();
@ -104,7 +103,7 @@ int main(int argc, char **argv)
QGuiApplication app(argc, argv);
SeatInterface *seat = display.createSeat();
SeatInterface *seat = new SeatInterface(&display);
seat->setName(QStringLiteral("testSeat0"));
seat->create();

View file

@ -57,7 +57,6 @@ Q_SIGNALS:
void transientChanged(KWaylandServer::SurfaceInterface *child, KWaylandServer::SurfaceInterface *parent);
private:
friend class Display;
friend class XdgExporterV2InterfacePrivate;
friend class XdgImporterV2InterfacePrivate;
QScopedPointer<XdgForeignV2InterfacePrivate> d;

View file

@ -34,7 +34,9 @@ class XdgOutputV1InterfacePrivate;
class KWAYLANDSERVER_EXPORT XdgOutputManagerV1Interface : public QObject
{
Q_OBJECT
public:
explicit XdgOutputManagerV1Interface(Display *display, QObject *parent = nullptr);
~XdgOutputManagerV1Interface() override;
/**
* Creates an XdgOutputInterface object for an existing Output
@ -45,8 +47,6 @@ public:
*/
XdgOutputV1Interface* createXdgOutput(OutputInterface *output, QObject *parent);
private:
explicit XdgOutputManagerV1Interface(Display *display, QObject *parent = nullptr);
friend class Display;
QScopedPointer<XdgOutputManagerV1InterfacePrivate> d;
};