Commit 66b0f5b8 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Allow accepting client connections on multiple sockets

libwayland-server allows the wl_display accept client connections on
more than one socket. We currently don't listen on multiple sockets,
but it would be nice if Display supported such operation mode.
parent 96d562dc
Pipeline #43479 passed with stage
in 6 minutes and 9 seconds
...@@ -53,7 +53,7 @@ void TestCompositor::init() ...@@ -53,7 +53,7 @@ void TestCompositor::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -67,7 +67,7 @@ void TestDataDevice::init() ...@@ -67,7 +67,7 @@ void TestDataDevice::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -49,7 +49,7 @@ void TestDataSource::init() ...@@ -49,7 +49,7 @@ void TestDataSource::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -67,7 +67,7 @@ void TestDragAndDrop::init() ...@@ -67,7 +67,7 @@ void TestDragAndDrop::init()
using namespace KWayland::Client; using namespace KWayland::Client;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -50,7 +50,7 @@ void ErrorTest::init() ...@@ -50,7 +50,7 @@ void ErrorTest::init()
{ {
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
m_display->createShm(); m_display->createShm();
......
...@@ -57,7 +57,7 @@ void FakeInputTest::init() ...@@ -57,7 +57,7 @@ void FakeInputTest::init()
{ {
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
m_display->createShm(); m_display->createShm();
......
...@@ -49,7 +49,7 @@ void IdleTest::init() ...@@ -49,7 +49,7 @@ void IdleTest::init()
{ {
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
m_display->createShm(); m_display->createShm();
......
...@@ -77,7 +77,7 @@ void TestVirtualDesktop::init() ...@@ -77,7 +77,7 @@ void TestVirtualDesktop::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -96,7 +96,7 @@ void PlasmaWindowModelTest::init() ...@@ -96,7 +96,7 @@ void PlasmaWindowModelTest::init()
{ {
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
m_display->createShm(); m_display->createShm();
......
...@@ -60,7 +60,7 @@ void TestPlasmaShell::init() ...@@ -60,7 +60,7 @@ void TestPlasmaShell::init()
{ {
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -63,7 +63,7 @@ void TestPointerConstraints::init() ...@@ -63,7 +63,7 @@ void TestPointerConstraints::init()
{ {
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
m_display->createShm(); m_display->createShm();
......
...@@ -63,7 +63,7 @@ void SelectionTest::init() ...@@ -63,7 +63,7 @@ void SelectionTest::init()
{ {
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
m_display->createShm(); m_display->createShm();
......
...@@ -58,7 +58,7 @@ void TestServerSideDecoration::init() ...@@ -58,7 +58,7 @@ void TestServerSideDecoration::init()
using namespace KWayland::Client; using namespace KWayland::Client;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -61,7 +61,7 @@ void TestServerSideDecorationPalette::init() ...@@ -61,7 +61,7 @@ void TestServerSideDecorationPalette::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -52,7 +52,7 @@ void ShadowTest::init() ...@@ -52,7 +52,7 @@ void ShadowTest::init()
{ {
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
m_display->createShm(); m_display->createShm();
......
...@@ -60,7 +60,7 @@ void TestShmPool::init() ...@@ -60,7 +60,7 @@ void TestShmPool::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -71,7 +71,7 @@ void TextInputTest::init() ...@@ -71,7 +71,7 @@ void TextInputTest::init()
{ {
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
m_display->createShm(); m_display->createShm();
......
...@@ -64,7 +64,7 @@ void TestAppmenu::init() ...@@ -64,7 +64,7 @@ void TestAppmenu::init()
qRegisterMetaType<AppMenuInterface::InterfaceAddress>(); qRegisterMetaType<AppMenuInterface::InterfaceAddress>();
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -61,7 +61,7 @@ void TestBlur::init() ...@@ -61,7 +61,7 @@ void TestBlur::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -64,7 +64,7 @@ void TestContrast::init() ...@@ -64,7 +64,7 @@ void TestContrast::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -77,7 +77,7 @@ void TestFilter::init() ...@@ -77,7 +77,7 @@ void TestFilter::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new TestDisplay(this); m_display = new TestDisplay(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -66,7 +66,7 @@ void TestWaylandOutput::init() ...@@ -66,7 +66,7 @@ void TestWaylandOutput::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -78,7 +78,7 @@ void TestWaylandOutputDevice::init() ...@@ -78,7 +78,7 @@ void TestWaylandOutputDevice::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -91,7 +91,7 @@ void TestWaylandOutputManagement::init() ...@@ -91,7 +91,7 @@ void TestWaylandOutputManagement::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -59,7 +59,7 @@ void TestRegion::init() ...@@ -59,7 +59,7 @@ void TestRegion::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -123,7 +123,7 @@ void TestWaylandSeat::init() ...@@ -123,7 +123,7 @@ void TestWaylandSeat::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
m_display->createShm(); m_display->createShm();
......
...@@ -61,7 +61,7 @@ void TestSlide::init() ...@@ -61,7 +61,7 @@ void TestSlide::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -52,7 +52,7 @@ void TestSubCompositor::init() ...@@ -52,7 +52,7 @@ void TestSubCompositor::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -84,7 +84,7 @@ void TestSubSurface::init() ...@@ -84,7 +84,7 @@ void TestSubSurface::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
m_display->createShm(); m_display->createShm();
......
...@@ -83,7 +83,7 @@ void TestWaylandSurface::init() ...@@ -83,7 +83,7 @@ void TestWaylandSurface::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
m_display->createShm(); m_display->createShm();
......
...@@ -95,7 +95,7 @@ void TestWindowManagement::init() ...@@ -95,7 +95,7 @@ void TestWindowManagement::init()
qRegisterMetaType<KWaylandServer::PlasmaWindowManagementInterface::ShowingDesktopState>("ShowingDesktopState"); qRegisterMetaType<KWaylandServer::PlasmaWindowManagementInterface::ShowingDesktopState>("ShowingDesktopState");
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -63,7 +63,7 @@ void TestXdgDecoration::init() ...@@ -63,7 +63,7 @@ void TestXdgDecoration::init()
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -82,7 +82,7 @@ void TestForeign::init() ...@@ -82,7 +82,7 @@ void TestForeign::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -54,7 +54,7 @@ void TestXdgOutput::init() ...@@ -54,7 +54,7 @@ void TestXdgOutput::init()
using namespace KWaylandServer; using namespace KWaylandServer;
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -89,7 +89,7 @@ void XdgShellTest::init() ...@@ -89,7 +89,7 @@ void XdgShellTest::init()
{ {
delete m_display; delete m_display;
m_display = new Display(this); m_display = new Display(this);
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
m_display->createShm(); m_display->createShm();
......
...@@ -158,8 +158,8 @@ static const QString s_socketName = QStringLiteral("kwin-wayland-datacontrol-tes ...@@ -158,8 +158,8 @@ static const QString s_socketName = QStringLiteral("kwin-wayland-datacontrol-tes
void DataControlInterfaceTest::init() void DataControlInterfaceTest::init()
{ {
m_display = new Display; m_display = new Display();
m_display->setSocketName(s_socketName); m_display->addSocketName(s_socketName);
m_display->start(); m_display->start();
QVERIFY(m_display->isRunning()); QVERIFY(m_display->isRunning());
......
...@@ -35,17 +35,16 @@ private Q_SLOTS: ...@@ -35,17 +35,16 @@ private Q_SLOTS:
void TestWaylandServerDisplay::testSocketName() void TestWaylandServerDisplay::testSocketName()
{ {
Display display; Display display;
QSignalSpy changedSpy(&display, SIGNAL(socketNameChanged(QString))); QSignalSpy changedSpy(&display, &Display::socketNamesChanged);
QVERIFY(changedSpy.isValid()); QVERIFY(changedSpy.isValid());
QCOMPARE(display.socketName(), QStringLiteral("wayland-0")); QCOMPARE(display.socketNames(), QStringList());
const QString testSName = QStringLiteral("fooBar"); const QString testSName = QStringLiteral("fooBar");
display.setSocketName(testSName); display.addSocketName(testSName);
QCOMPARE(display.socketName(), testSName); QCOMPARE(display.socketNames(), QStringList { testSName });
QCOMPARE(changedSpy.count(), 1); QCOMPARE(changedSpy.count(), 1);
QCOMPARE(changedSpy.first().first().toString(), testSName);
// changing to same name again should not emit signal // changing to same name again should not emit signal
display.setSocketName(testSName); display.addSocketName(testSName);
QCOMPARE(changedSpy.count(), 1); QCOMPARE(changedSpy.count(), 1);
} }
...@@ -59,7 +58,7 @@ void TestWaylandServerDisplay::testStartStop() ...@@ -59,7 +58,7 @@ void TestWaylandServerDisplay::testStartStop()
QScopedPointer<Display> display(new Display); QScopedPointer<Display> display(new Display);
QSignalSpy runningSpy(display.data(), SIGNAL(runningChanged(bool))); QSignalSpy runningSpy(display.data(), SIGNAL(runningChanged(bool)));
QVERIFY(runningSpy.isValid()); QVERIFY(runningSpy.isValid());
display->setSocketName(testSocketName); display->addSocketName(testSocketName);
QVERIFY(!display->isRunning()); QVERIFY(!display->isRunning());
display->start(); display->start();
// QVERIFY(runningSpy.wait()); // QVERIFY(runningSpy.wait());
...@@ -75,7 +74,7 @@ void TestWaylandServerDisplay::testStartStop() ...@@ -75,7 +74,7 @@ void TestWaylandServerDisplay::testStartStop()