Commit 09e079b7 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

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.
parent b5434e51
......@@ -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}
)
......
......@@ -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;
};
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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>(),
......
......@@ -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);
......
......@@ -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;
......
......@@ -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());
......
......@@ -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;
......
......@@ -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());
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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>(),
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
}
......
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