From 09e079b78f2f47bbc301eee929b99162c1ffed78 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 9 Dec 2020 22:13:19 +0200 Subject: [PATCH] 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. --- src/wayland/CMakeLists.txt | 6 + src/wayland/appmenu_interface.h | 4 +- .../autotests/client/test_compositor.cpp | 2 +- .../autotests/client/test_datadevice.cpp | 6 +- .../autotests/client/test_datasource.cpp | 2 +- .../autotests/client/test_drag_drop.cpp | 6 +- src/wayland/autotests/client/test_error.cpp | 4 +- .../autotests/client/test_fake_input.cpp | 2 +- src/wayland/autotests/client/test_idle.cpp | 4 +- .../client/test_plasma_virtual_desktop.cpp | 6 +- .../client/test_plasma_window_model.cpp | 4 +- .../autotests/client/test_plasmashell.cpp | 4 +- .../client/test_pointer_constraints.cpp | 6 +- .../autotests/client/test_selection.cpp | 6 +- .../client/test_server_side_decoration.cpp | 4 +- .../test_server_side_decoration_palette.cpp | 4 +- src/wayland/autotests/client/test_shadow.cpp | 4 +- .../autotests/client/test_text_input_v2.cpp | 6 +- .../autotests/client/test_wayland_appmenu.cpp | 4 +- .../autotests/client/test_wayland_blur.cpp | 4 +- .../client/test_wayland_contrast.cpp | 4 +- .../autotests/client/test_wayland_filter.cpp | 4 +- .../autotests/client/test_wayland_output.cpp | 6 +- .../client/test_wayland_outputdevice.cpp | 2 +- .../client/test_wayland_outputmanagement.cpp | 6 +- .../autotests/client/test_wayland_region.cpp | 2 +- .../autotests/client/test_wayland_seat.cpp | 14 +- .../autotests/client/test_wayland_slide.cpp | 4 +- .../client/test_wayland_subcompositor.cpp | 2 +- .../client/test_wayland_subsurface.cpp | 4 +- .../autotests/client/test_wayland_surface.cpp | 6 +- .../client/test_wayland_windowmanagement.cpp | 4 +- .../autotests/client/test_xdg_decoration.cpp | 6 +- .../autotests/client/test_xdg_foreign.cpp | 4 +- .../autotests/client/test_xdg_output.cpp | 4 +- .../autotests/client/test_xdg_shell.cpp | 10 +- .../server/test_datacontrol_interface.cpp | 6 +- src/wayland/autotests/server/test_display.cpp | 17 +- .../server/test_inputmethod_interface.cpp | 10 +- ...keyboard_shortcuts_inhibitor_interface.cpp | 6 +- .../server/test_layershellv1_interface.cpp | 6 +- .../autotests/server/test_screencast.cpp | 2 +- src/wayland/autotests/server/test_seat.cpp | 16 +- .../server/test_tablet_interface.cpp | 6 +- .../server/test_textinputv3_interface.cpp | 6 +- .../server/test_viewporter_interface.cpp | 4 +- src/wayland/blur_interface.h | 3 +- src/wayland/contrast_interface.h | 4 +- .../datacontroldevicemanager_v1_interface.h | 3 +- src/wayland/datadevicemanager_interface.h | 4 +- src/wayland/display.cpp | 309 +----------------- src/wayland/display.h | 237 +------------- src/wayland/display_p.h | 49 +++ src/wayland/dpms_interface.h | 4 +- src/wayland/fakeinput_interface.h | 4 +- src/wayland/idle_interface.h | 4 +- src/wayland/idleinhibit_v1_interface.h | 6 +- .../keyboard_shortcuts_inhibit_v1_interface.h | 3 +- src/wayland/keystate_interface.h | 5 +- src/wayland/output_interface.cpp | 9 + src/wayland/output_interface.h | 4 +- src/wayland/plasmashell_interface.h | 4 +- src/wayland/plasmavirtualdesktop_interface.h | 4 +- .../plasmawindowmanagement_interface.h | 4 +- ...imaryselectiondevicemanager_v1_interface.h | 4 +- src/wayland/screencast_v1_interface.h | 4 +- src/wayland/seat_interface.cpp | 10 + src/wayland/seat_interface.h | 3 +- .../server/eglstream_controller_interface.h | 5 +- src/wayland/server/global_p.h | 7 +- src/wayland/server/linuxdmabuf_v1_interface.h | 8 +- src/wayland/server/outputdevice_interface.cpp | 9 + src/wayland/server/outputdevice_interface.h | 4 +- .../server/outputmanagement_interface.h | 4 +- src/wayland/server_decoration_interface.h | 4 +- .../server_decoration_palette_interface.h | 4 +- src/wayland/shadow_interface.h | 4 +- src/wayland/slide_interface.h | 4 +- src/wayland/tablet_v2_interface.h | 3 +- src/wayland/tests/renderingservertest.cpp | 10 +- src/wayland/tests/waylandservertest.cpp | 9 +- src/wayland/xdgforeign_v2_interface.h | 1 - src/wayland/xdgoutput_v1_interface.h | 4 +- 83 files changed, 277 insertions(+), 733 deletions(-) create mode 100644 src/wayland/display_p.h diff --git a/src/wayland/CMakeLists.txt b/src/wayland/CMakeLists.txt index 498c322f69..c439cbbfdb 100644 --- a/src/wayland/CMakeLists.txt +++ b/src/wayland/CMakeLists.txt @@ -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} ) diff --git a/src/wayland/appmenu_interface.h b/src/wayland/appmenu_interface.h index 9374486106..e8a5cbc6b2 100644 --- a/src/wayland/appmenu_interface.h +++ b/src/wayland/appmenu_interface.h @@ -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 d; }; diff --git a/src/wayland/autotests/client/test_compositor.cpp b/src/wayland/autotests/client/test_compositor.cpp index ce83972ef3..cdb49547ce 100644 --- a/src/wayland/autotests/client/test_compositor.cpp +++ b/src/wayland/autotests/client/test_compositor.cpp @@ -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(), compositorSpy.first().last().value(), this); } diff --git a/src/wayland/autotests/client/test_datadevice.cpp b/src/wayland/autotests/client/test_datadevice.cpp index 50c4ac133a..af6f9cf784 100644 --- a/src/wayland/autotests/client/test_datadevice.cpp +++ b/src/wayland/autotests/client/test_datadevice.cpp @@ -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(), dataDeviceManagerSpy.first().last().value(), 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(), compositorSpy.first().last().value(), this); diff --git a/src/wayland/autotests/client/test_datasource.cpp b/src/wayland/autotests/client/test_datasource.cpp index 7b58ec3466..335a6413f7 100644 --- a/src/wayland/autotests/client/test_datasource.cpp +++ b/src/wayland/autotests/client/test_datasource.cpp @@ -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(), diff --git a/src/wayland/autotests/client/test_drag_drop.cpp b/src/wayland/autotests/client/test_drag_drop.cpp index b627d9d4b0..27e3b7ff41 100644 --- a/src/wayland/autotests/client/test_drag_drop.cpp +++ b/src/wayland/autotests/client/test_drag_drop.cpp @@ -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); diff --git a/src/wayland/autotests/client/test_error.cpp b/src/wayland/autotests/client/test_error.cpp index 7482017406..0ab9968383 100644 --- a/src/wayland/autotests/client/test_error.cpp +++ b/src/wayland/autotests/client/test_error.cpp @@ -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; diff --git a/src/wayland/autotests/client/test_fake_input.cpp b/src/wayland/autotests/client/test_fake_input.cpp index a624851fe1..a110ad1f3f 100644 --- a/src/wayland/autotests/client/test_fake_input.cpp +++ b/src/wayland/autotests/client/test_fake_input.cpp @@ -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()); diff --git a/src/wayland/autotests/client/test_idle.cpp b/src/wayland/autotests/client/test_idle.cpp index 41b11c60b1..e08f444d7d 100644 --- a/src/wayland/autotests/client/test_idle.cpp +++ b/src/wayland/autotests/client/test_idle.cpp @@ -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; diff --git a/src/wayland/autotests/client/test_plasma_virtual_desktop.cpp b/src/wayland/autotests/client/test_plasma_virtual_desktop.cpp index 442028b0dc..fc1e90defd 100644 --- a/src/wayland/autotests/client/test_plasma_virtual_desktop.cpp +++ b/src/wayland/autotests/client/test_plasma_virtual_desktop.cpp @@ -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(), compositorSpy.first().last().value(), 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(), plasmaVirtualDesktopManagementSpy.first().last().value(), this); - m_windowManagementInterface = m_display->createPlasmaWindowManagement(m_display); + m_windowManagementInterface = new PlasmaWindowManagementInterface(m_display, m_display); m_windowManagementInterface->setPlasmaVirtualDesktopManagementInterface(m_plasmaVirtualDesktopManagementInterface); QVERIFY(windowManagementSpy.wait()); diff --git a/src/wayland/autotests/client/test_plasma_window_model.cpp b/src/wayland/autotests/client/test_plasma_window_model.cpp index 8e361e96ab..c7a9383e25 100644 --- a/src/wayland/autotests/client/test_plasma_window_model.cpp +++ b/src/wayland/autotests/client/test_plasma_window_model.cpp @@ -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); diff --git a/src/wayland/autotests/client/test_plasmashell.cpp b/src/wayland/autotests/client/test_plasmashell.cpp index 4fbc26eb32..994459aedc 100644 --- a/src/wayland/autotests/client/test_plasmashell.cpp +++ b/src/wayland/autotests/client/test_plasmashell.cpp @@ -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; diff --git a/src/wayland/autotests/client/test_pointer_constraints.cpp b/src/wayland/autotests/client/test_pointer_constraints.cpp index 8d44fd07b5..e27a80e2d3 100644 --- a/src/wayland/autotests/client/test_pointer_constraints.cpp +++ b/src/wayland/autotests/client/test_pointer_constraints.cpp @@ -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; diff --git a/src/wayland/autotests/client/test_selection.cpp b/src/wayland/autotests/client/test_selection.cpp index d87fbade12..38b2b24d9f 100644 --- a/src/wayland/autotests/client/test_selection.cpp +++ b/src/wayland/autotests/client/test_selection.cpp @@ -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); diff --git a/src/wayland/autotests/client/test_server_side_decoration.cpp b/src/wayland/autotests/client/test_server_side_decoration.cpp index eaab93172d..96e53d5e7e 100644 --- a/src/wayland/autotests/client/test_server_side_decoration.cpp +++ b/src/wayland/autotests/client/test_server_side_decoration.cpp @@ -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(), compositorSpy.first().last().value(), 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(), diff --git a/src/wayland/autotests/client/test_server_side_decoration_palette.cpp b/src/wayland/autotests/client/test_server_side_decoration_palette.cpp index 18694475fb..462246bc43 100644 --- a/src/wayland/autotests/client/test_server_side_decoration_palette.cpp +++ b/src/wayland/autotests/client/test_server_side_decoration_palette.cpp @@ -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(), compositorSpy.first().last().value(), 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(), registrySpy.first().last().value(), this); diff --git a/src/wayland/autotests/client/test_shadow.cpp b/src/wayland/autotests/client/test_shadow.cpp index 46e695d977..c06c946156 100644 --- a/src/wayland/autotests/client/test_shadow.cpp +++ b/src/wayland/autotests/client/test_shadow.cpp @@ -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; diff --git a/src/wayland/autotests/client/test_text_input_v2.cpp b/src/wayland/autotests/client/test_text_input_v2.cpp index 462a42a6e8..fc8a166ec0 100644 --- a/src/wayland/autotests/client/test_text_input_v2.cpp +++ b/src/wayland/autotests/client/test_text_input_v2.cpp @@ -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; diff --git a/src/wayland/autotests/client/test_wayland_appmenu.cpp b/src/wayland/autotests/client/test_wayland_appmenu.cpp index e1292f8d30..42e68065e3 100644 --- a/src/wayland/autotests/client/test_wayland_appmenu.cpp +++ b/src/wayland/autotests/client/test_wayland_appmenu.cpp @@ -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(), compositorSpy.first().last().value(), 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(), appmenuSpy.first().last().value(), this); diff --git a/src/wayland/autotests/client/test_wayland_blur.cpp b/src/wayland/autotests/client/test_wayland_blur.cpp index dc5308bf42..92c21150c9 100644 --- a/src/wayland/autotests/client/test_wayland_blur.cpp +++ b/src/wayland/autotests/client/test_wayland_blur.cpp @@ -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(), compositorSpy.first().last().value(), 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(), blurSpy.first().last().value(), this); } diff --git a/src/wayland/autotests/client/test_wayland_contrast.cpp b/src/wayland/autotests/client/test_wayland_contrast.cpp index 4c51b83197..0c14e8b7f4 100644 --- a/src/wayland/autotests/client/test_wayland_contrast.cpp +++ b/src/wayland/autotests/client/test_wayland_contrast.cpp @@ -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(), compositorSpy.first().last().value(), 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(), contrastSpy.first().last().value(), this); diff --git a/src/wayland/autotests/client/test_wayland_filter.cpp b/src/wayland/autotests/client/test_wayland_filter.cpp index 89f179d585..1697633bdb 100644 --- a/src/wayland/autotests/client/test_wayland_filter.cpp +++ b/src/wayland/autotests/client/test_wayland_filter.cpp @@ -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() diff --git a/src/wayland/autotests/client/test_wayland_output.cpp b/src/wayland/autotests/client/test_wayland_output.cpp index 66ec67c6ed..c0e884a04a 100644 --- a/src/wayland/autotests/client/test_wayland_output.cpp +++ b/src/wayland/autotests/client/test_wayland_output.cpp @@ -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); diff --git a/src/wayland/autotests/client/test_wayland_outputdevice.cpp b/src/wayland/autotests/client/test_wayland_outputdevice.cpp index 7766ad5cb7..82e859cffb 100644 --- a/src/wayland/autotests/client/test_wayland_outputdevice.cpp +++ b/src/wayland/autotests/client/test_wayland_outputdevice.cpp @@ -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"); diff --git a/src/wayland/autotests/client/test_wayland_outputmanagement.cpp b/src/wayland/autotests/client/test_wayland_outputmanagement.cpp index cca854e406..494d4a47a2 100644 --- a/src/wayland/autotests/client/test_wayland_outputmanagement.cpp +++ b/src/wayland/autotests/client/test_wayland_outputmanagement.cpp @@ -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()); diff --git a/src/wayland/autotests/client/test_wayland_region.cpp b/src/wayland/autotests/client/test_wayland_region.cpp index 973165ac4d..77d0618a21 100644 --- a/src/wayland/autotests/client/test_wayland_region.cpp +++ b/src/wayland/autotests/client/test_wayland_region.cpp @@ -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(), compositorSpy.first().last().value(), this); } diff --git a/src/wayland/autotests/client/test_wayland_seat.cpp b/src/wayland/autotests/client/test_wayland_seat.cpp index d569d0e186..00fdb4338a 100644 --- a/src/wayland/autotests/client/test_wayland_seat.cpp +++ b/src/wayland/autotests/client/test_wayland_seat.cpp @@ -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 ddmi(m_display->createDataDeviceManager()); + QScopedPointer ddmi(new DataDeviceManagerInterface(m_display)); Registry registry; QSignalSpy dataDeviceManagerSpy(®istry, 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 ddmi(m_display->createDataDeviceManager()); + QScopedPointer ddmi(new DataDeviceManagerInterface(m_display)); QSignalSpy ddiCreatedSpy(ddmi.data(), &DataDeviceManagerInterface::dataDeviceCreated); QVERIFY(ddiCreatedSpy.isValid()); m_seatInterface->setHasKeyboard(true); diff --git a/src/wayland/autotests/client/test_wayland_slide.cpp b/src/wayland/autotests/client/test_wayland_slide.cpp index 50a8223658..35b8d1399e 100644 --- a/src/wayland/autotests/client/test_wayland_slide.cpp +++ b/src/wayland/autotests/client/test_wayland_slide.cpp @@ -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(), compositorSpy.first().last().value(), 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(), slideSpy.first().last().value(), this); diff --git a/src/wayland/autotests/client/test_wayland_subcompositor.cpp b/src/wayland/autotests/client/test_wayland_subcompositor.cpp index 12b86a6d6d..29d28116cf 100644 --- a/src/wayland/autotests/client/test_wayland_subcompositor.cpp +++ b/src/wayland/autotests/client/test_wayland_subcompositor.cpp @@ -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()); diff --git a/src/wayland/autotests/client/test_wayland_subsurface.cpp b/src/wayland/autotests/client/test_wayland_subsurface.cpp index 28e95de2a6..19d5021109 100644 --- a/src/wayland/autotests/client/test_wayland_subsurface.cpp +++ b/src/wayland/autotests/client/test_wayland_subsurface.cpp @@ -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()); diff --git a/src/wayland/autotests/client/test_wayland_surface.cpp b/src/wayland/autotests/client/test_wayland_surface.cpp index 7e331f8f9f..a6c3698bfc 100644 --- a/src/wayland/autotests/client/test_wayland_surface.cpp +++ b/src/wayland/autotests/client/test_wayland_surface.cpp @@ -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(®istry, &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 clientOutput(registry.createOutput(outputAnnouncedSpy.first().first().value(), outputAnnouncedSpy.first().last().value())); diff --git a/src/wayland/autotests/client/test_wayland_windowmanagement.cpp b/src/wayland/autotests/client/test_wayland_windowmanagement.cpp index 8b3731cc71..e8f2d6e794 100644 --- a/src/wayland/autotests/client/test_wayland_windowmanagement.cpp +++ b/src/wayland/autotests/client/test_wayland_windowmanagement.cpp @@ -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(), compositorSpy.first().last().value(), 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(), windowManagementSpy.first().last().value(), this); diff --git a/src/wayland/autotests/client/test_xdg_decoration.cpp b/src/wayland/autotests/client/test_xdg_decoration.cpp index a00c31c7ba..19b2eca188 100644 --- a/src/wayland/autotests/client/test_xdg_decoration.cpp +++ b/src/wayland/autotests/client/test_xdg_decoration.cpp @@ -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(), compositorSpy.first().last().value(), 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(), xdgShellSpy.first().last().value(), 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(), diff --git a/src/wayland/autotests/client/test_xdg_foreign.cpp b/src/wayland/autotests/client/test_xdg_foreign.cpp index 7ad42a1707..d511ecbd21 100644 --- a/src/wayland/autotests/client/test_xdg_foreign.cpp +++ b/src/wayland/autotests/client/test_xdg_foreign.cpp @@ -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(), compositorSpy.first().last().value(), 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 diff --git a/src/wayland/autotests/client/test_xdg_output.cpp b/src/wayland/autotests/client/test_xdg_output.cpp index 3008b02e21..13c02c9f1c 100644 --- a/src/wayland/autotests/client/test_xdg_output.cpp +++ b/src/wayland/autotests/client/test_xdg_output.cpp @@ -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 diff --git a/src/wayland/autotests/client/test_xdg_shell.cpp b/src/wayland/autotests/client/test_xdg_shell.cpp index db88d2e69a..9411820918 100644 --- a/src/wayland/autotests/client/test_xdg_shell.cpp +++ b/src/wayland/autotests/client/test_xdg_shell.cpp @@ -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; diff --git a/src/wayland/autotests/server/test_datacontrol_interface.cpp b/src/wayland/autotests/server/test_datacontrol_interface.cpp index d6d7ef7a48..6d4740e528 100644 --- a/src/wayland/autotests/server/test_datacontrol_interface.cpp +++ b/src/wayland/autotests/server/test_datacontrol_interface.cpp @@ -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; diff --git a/src/wayland/autotests/server/test_display.cpp b/src/wayland/autotests/server/test_display.cpp index 945de6a092..eeef0aeaf1 100644 --- a/src/wayland/autotests/server/test_display.cpp +++ b/src/wayland/autotests/server/test_display.cpp @@ -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()); } diff --git a/src/wayland/autotests/server/test_inputmethod_interface.cpp b/src/wayland/autotests/server/test_inputmethod_interface.cpp index 051ce820f9..ff3e866bb5 100644 --- a/src/wayland/autotests/server/test_inputmethod_interface.cpp +++ b/src/wayland/autotests/server/test_inputmethod_interface.cpp @@ -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) { diff --git a/src/wayland/autotests/server/test_keyboard_shortcuts_inhibitor_interface.cpp b/src/wayland/autotests/server/test_keyboard_shortcuts_inhibitor_interface.cpp index 5d422bf8dd..3c440339dc 100644 --- a/src/wayland/autotests/server/test_keyboard_shortcuts_inhibitor_interface.cpp +++ b/src/wayland/autotests/server/test_keyboard_shortcuts_inhibitor_interface.cpp @@ -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; diff --git a/src/wayland/autotests/server/test_layershellv1_interface.cpp b/src/wayland/autotests/server/test_layershellv1_interface.cpp index 60abfca017..076283ca45 100644 --- a/src/wayland/autotests/server/test_layershellv1_interface.cpp +++ b/src/wayland/autotests/server/test_layershellv1_interface.cpp @@ -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); diff --git a/src/wayland/autotests/server/test_screencast.cpp b/src/wayland/autotests/server/test_screencast.cpp index 07f0246fd6..5b40bd941a 100644 --- a/src/wayland/autotests/server/test_screencast.cpp +++ b/src/wayland/autotests/server/test_screencast.cpp @@ -119,7 +119,7 @@ void TestScreencastV1Interface::initTestCase() QSignalSpy screencastSpy(®istry, &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); diff --git a/src/wayland/autotests/server/test_seat.cpp b/src/wayland/autotests/server/test_seat.cpp index 032db4bdd4..1734444255 100644 --- a/src/wayland/autotests/server/test_seat.cpp +++ b/src/wayland/autotests/server/test_seat.cpp @@ -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); diff --git a/src/wayland/autotests/server/test_tablet_interface.cpp b/src/wayland/autotests/server/test_tablet_interface.cpp index 6cc54699ef..0fe2aea0dc 100644 --- a/src/wayland/autotests/server/test_tablet_interface.cpp +++ b/src/wayland/autotests/server/test_tablet_interface.cpp @@ -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; diff --git a/src/wayland/autotests/server/test_textinputv3_interface.cpp b/src/wayland/autotests/server/test_textinputv3_interface.cpp index 2ec89f07f4..8c8d690de2 100644 --- a/src/wayland/autotests/server/test_textinputv3_interface.cpp +++ b/src/wayland/autotests/server/test_textinputv3_interface.cpp @@ -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); diff --git a/src/wayland/autotests/server/test_viewporter_interface.cpp b/src/wayland/autotests/server/test_viewporter_interface.cpp index 9f5fe24393..db93c16b29 100644 --- a/src/wayland/autotests/server/test_viewporter_interface.cpp +++ b/src/wayland/autotests/server/test_viewporter_interface.cpp @@ -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); diff --git a/src/wayland/blur_interface.h b/src/wayland/blur_interface.h index 4c15ec5ad1..e280523c18 100644 --- a/src/wayland/blur_interface.h +++ b/src/wayland/blur_interface.h @@ -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 d; }; diff --git a/src/wayland/contrast_interface.h b/src/wayland/contrast_interface.h index 4ca16a5f60..597bf6ceb1 100644 --- a/src/wayland/contrast_interface.h +++ b/src/wayland/contrast_interface.h @@ -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 d; }; diff --git a/src/wayland/datacontroldevicemanager_v1_interface.h b/src/wayland/datacontroldevicemanager_v1_interface.h index 593f549252..b3534d593e 100644 --- a/src/wayland/datacontroldevicemanager_v1_interface.h +++ b/src/wayland/datacontroldevicemanager_v1_interface.h @@ -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 d; }; diff --git a/src/wayland/datadevicemanager_interface.h b/src/wayland/datadevicemanager_interface.h index fb707994ea..af3fa115ee 100644 --- a/src/wayland/datadevicemanager_interface.h +++ b/src/wayland/datadevicemanager_interface.h @@ -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 d; }; diff --git a/src/wayland/display.cpp b/src/wayland/display.cpp index 7bf6e4b70e..c388c54a90 100644 --- a/src/wayland/display.cpp +++ b/src/wayland/display.cpp @@ -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 #include #include -#include -#include - -#include - -#include 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 outputs; - QList outputdevices; - QVector seats; - QVector 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); diff --git a/src/wayland/display.h b/src/wayland/display.h index 52d9a717c6..2bb0b0e022 100644 --- a/src/wayland/display.h +++ b/src/wayland/display.h @@ -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 outputs() const; - - OutputDeviceInterface *createOutputDevice(QObject *parent = nullptr); - void removeOutputDevice(OutputDeviceInterface *output); - QList 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 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 outputDevices() const; + QList outputs() const; /** * Gets the ClientConnection for the given @p client. @@ -377,8 +152,8 @@ Q_SIGNALS: void clientDisconnected(KWaylandServer::ClientConnection*); private: - class Private; - QScopedPointer d; + friend class DisplayPrivate; + QScopedPointer d; }; } diff --git a/src/wayland/display_p.h b/src/wayland/display_p.h new file mode 100644 index 0000000000..bb1734ecf7 --- /dev/null +++ b/src/wayland/display_p.h @@ -0,0 +1,49 @@ +/* + SPDX-FileCopyrightText: 2014 Martin Gräßlin + SPDX-FileCopyrightText: 2018 David Edmundson + + SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL +*/ + +#pragma once + +#include + +#include +#include +#include +#include + +#include + +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 outputs; + QList outputdevices; + QVector seats; + QVector clients; + QStringList socketNames; + EGLDisplay eglDisplay = EGL_NO_DISPLAY; +}; + +} // namespace KWaylandServer diff --git a/src/wayland/dpms_interface.h b/src/wayland/dpms_interface.h index 16c4af0b49..f39eb89caf 100644 --- a/src/wayland/dpms_interface.h +++ b/src/wayland/dpms_interface.h @@ -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 d; }; diff --git a/src/wayland/fakeinput_interface.h b/src/wayland/fakeinput_interface.h index 813473813c..083a342371 100644 --- a/src/wayland/fakeinput_interface.h +++ b/src/wayland/fakeinput_interface.h @@ -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 d; }; diff --git a/src/wayland/idle_interface.h b/src/wayland/idle_interface.h index 346c5b8d38..08db529144 100644 --- a/src/wayland/idle_interface.h +++ b/src/wayland/idle_interface.h @@ -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 d; }; diff --git a/src/wayland/idleinhibit_v1_interface.h b/src/wayland/idleinhibit_v1_interface.h index b13cb86083..f660ff4119 100644 --- a/src/wayland/idleinhibit_v1_interface.h +++ b/src/wayland/idleinhibit_v1_interface.h @@ -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 d; diff --git a/src/wayland/keyboard_shortcuts_inhibit_v1_interface.h b/src/wayland/keyboard_shortcuts_inhibit_v1_interface.h index d583d1dffb..bf31e1fe04 100644 --- a/src/wayland/keyboard_shortcuts_inhibit_v1_interface.h +++ b/src/wayland/keyboard_shortcuts_inhibit_v1_interface.h @@ -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 d; }; diff --git a/src/wayland/keystate_interface.h b/src/wayland/keystate_interface.h index 46a4edbe94..d04b068a37 100644 --- a/src/wayland/keystate_interface.h +++ b/src/wayland/keystate_interface.h @@ -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 d; }; diff --git a/src/wayland/output_interface.cpp b/src/wayland/output_interface.cpp index c3ef521a65..9f752f8f4d 100644 --- a/src/wayland/output_interface.cpp +++ b/src/wayland/output_interface.cpp @@ -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); } diff --git a/src/wayland/output_interface.h b/src/wayland/output_interface.h index 9f06afa883..13dbedce1c 100644 --- a/src/wayland/output_interface.h +++ b/src/wayland/output_interface.h @@ -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; }; diff --git a/src/wayland/plasmashell_interface.h b/src/wayland/plasmashell_interface.h index d6d538310d..0f4a1ece1e 100644 --- a/src/wayland/plasmashell_interface.h +++ b/src/wayland/plasmashell_interface.h @@ -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 d; }; diff --git a/src/wayland/plasmavirtualdesktop_interface.h b/src/wayland/plasmavirtualdesktop_interface.h index e7d8a0c11e..f979a4a36c 100644 --- a/src/wayland/plasmavirtualdesktop_interface.h +++ b/src/wayland/plasmavirtualdesktop_interface.h @@ -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 d; }; diff --git a/src/wayland/plasmawindowmanagement_interface.h b/src/wayland/plasmawindowmanagement_interface.h index 14bcd9291c..c2eb835cdf 100644 --- a/src/wayland/plasmawindowmanagement_interface.h +++ b/src/wayland/plasmawindowmanagement_interface.h @@ -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 d; }; diff --git a/src/wayland/primaryselectiondevicemanager_v1_interface.h b/src/wayland/primaryselectiondevicemanager_v1_interface.h index 685e44da33..8e7b52397b 100644 --- a/src/wayland/primaryselectiondevicemanager_v1_interface.h +++ b/src/wayland/primaryselectiondevicemanager_v1_interface.h @@ -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 d; }; diff --git a/src/wayland/screencast_v1_interface.h b/src/wayland/screencast_v1_interface.h index 925b83f6a6..f1ccd752b0 100644 --- a/src/wayland/screencast_v1_interface.h +++ b/src/wayland/screencast_v1_interface.h @@ -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 d; }; diff --git a/src/wayland/seat_interface.cpp b/src/wayland/seat_interface.cpp index da1621c732..98f73eb392 100644 --- a/src/wayland/seat_interface.cpp +++ b/src/wayland/seat_interface.cpp @@ -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()); } diff --git a/src/wayland/seat_interface.h b/src/wayland/seat_interface.h index d982d8b28f..365b3a78cf 100644 --- a/src/wayland/seat_interface.h +++ b/src/wayland/seat_interface.h @@ -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; diff --git a/src/wayland/server/eglstream_controller_interface.h b/src/wayland/server/eglstream_controller_interface.h index ec19186a22..a04aaec6db 100644 --- a/src/wayland/server/eglstream_controller_interface.h +++ b/src/wayland/server/eglstream_controller_interface.h @@ -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 d; - friend class Display; }; } diff --git a/src/wayland/server/global_p.h b/src/wayland/server/global_p.h index 15e8e4c0d8..9c4ca7f4d6 100644 --- a/src/wayland/server/global_p.h +++ b/src/wayland/server/global_p.h @@ -8,6 +8,8 @@ #include "global.h" +#include + #include 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; wl_global *global = nullptr; DisplayDestroyListener displayDestroyListener; diff --git a/src/wayland/server/linuxdmabuf_v1_interface.h b/src/wayland/server/linuxdmabuf_v1_interface.h index 66f13ad0c1..87089b96b2 100644 --- a/src/wayland/server/linuxdmabuf_v1_interface.h +++ b/src/wayland/server/linuxdmabuf_v1_interface.h @@ -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; diff --git a/src/wayland/server/outputdevice_interface.cpp b/src/wayland/server/outputdevice_interface.cpp index 44b8b9fdd7..2eab9dbfa5 100644 --- a/src/wayland/server/outputdevice_interface.cpp +++ b/src/wayland/server/outputdevice_interface.cpp @@ -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); } diff --git a/src/wayland/server/outputdevice_interface.h b/src/wayland/server/outputdevice_interface.h index 64f64721de..89c07be94c 100644 --- a/src/wayland/server/outputdevice_interface.h +++ b/src/wayland/server/outputdevice_interface.h @@ -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; }; diff --git a/src/wayland/server/outputmanagement_interface.h b/src/wayland/server/outputmanagement_interface.h index 53a21c7c0a..a3949d3445 100644 --- a/src/wayland/server/outputmanagement_interface.h +++ b/src/wayland/server/outputmanagement_interface.h @@ -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; }; diff --git a/src/wayland/server_decoration_interface.h b/src/wayland/server_decoration_interface.h index d4faba0f19..84d06718c9 100644 --- a/src/wayland/server_decoration_interface.h +++ b/src/wayland/server_decoration_interface.h @@ -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 d; }; diff --git a/src/wayland/server_decoration_palette_interface.h b/src/wayland/server_decoration_palette_interface.h index 2f5d3a1a18..9ecf687735 100644 --- a/src/wayland/server_decoration_palette_interface.h +++ b/src/wayland/server_decoration_palette_interface.h @@ -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 d; }; diff --git a/src/wayland/shadow_interface.h b/src/wayland/shadow_interface.h index ddeeb8b864..1f86b7db72 100644 --- a/src/wayland/shadow_interface.h +++ b/src/wayland/shadow_interface.h @@ -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 d; }; diff --git a/src/wayland/slide_interface.h b/src/wayland/slide_interface.h index cd9d0bc0c5..37534aef38 100644 --- a/src/wayland/slide_interface.h +++ b/src/wayland/slide_interface.h @@ -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 d; }; diff --git a/src/wayland/tablet_v2_interface.h b/src/wayland/tablet_v2_interface.h index 51bcca364b..9245eef850 100644 --- a/src/wayland/tablet_v2_interface.h +++ b/src/wayland/tablet_v2_interface.h @@ -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 d; }; diff --git a/src/wayland/tests/renderingservertest.cpp b/src/wayland/tests/renderingservertest.cpp index b41b52a7d0..f4687e97b2 100644 --- a/src/wayland/tests/renderingservertest.cpp +++ b/src/wayland/tests/renderingservertest.cpp @@ -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")); diff --git a/src/wayland/tests/waylandservertest.cpp b/src/wayland/tests/waylandservertest.cpp index b4f35d7279..e57e3cee96 100644 --- a/src/wayland/tests/waylandservertest.cpp +++ b/src/wayland/tests/waylandservertest.cpp @@ -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(); diff --git a/src/wayland/xdgforeign_v2_interface.h b/src/wayland/xdgforeign_v2_interface.h index f58c543f08..61832a7e69 100644 --- a/src/wayland/xdgforeign_v2_interface.h +++ b/src/wayland/xdgforeign_v2_interface.h @@ -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 d; diff --git a/src/wayland/xdgoutput_v1_interface.h b/src/wayland/xdgoutput_v1_interface.h index 2999eeb3fc..345fae056a 100644 --- a/src/wayland/xdgoutput_v1_interface.h +++ b/src/wayland/xdgoutput_v1_interface.h @@ -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 d; };