Commit 1e2f2a28 authored by David Edmundson's avatar David Edmundson Committed by Vlad Zahorodnii
Browse files

Port to kwayland-server socket changes

parent 9799456f
......@@ -29,8 +29,7 @@ void NoXdgRuntimeDirTest::initTestCase()
void NoXdgRuntimeDirTest::testInitFails()
{
// this test verifies that without an XDG_RUNTIME_DIR the WaylandServer fails to start
QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit()));
QVERIFY(!waylandServer()->start());
QVERIFY(!waylandServer()->init(s_socketName.toLocal8Bit()));
}
WAYLANDTEST_MAIN(NoXdgRuntimeDirTest)
......
......@@ -696,7 +696,7 @@ int main(int argc, char * argv[])
a.platform()->setInitialOutputCount(outputCount);
QObject::connect(&a, &KWin::Application::workspaceCreated, server, &KWin::WaylandServer::initWorkspace);
environment.insert(QStringLiteral("WAYLAND_DISPLAY"), server->display()->socketName());
environment.insert(QStringLiteral("WAYLAND_DISPLAY"), server->socketName());
a.setProcessStartupEnvironment(environment);
a.setStartXwayland(parser.isSet(xwaylandOption));
a.setApplicationsToStart(parser.positionalArguments());
......
......@@ -121,7 +121,7 @@ void XdgShellOutput::updateWindowTitle()
grab = i18n("Press right control key to grab pointer");
}
const QString title = i18nc("Title of nested KWin Wayland with Wayland socket identifier as argument",
"KDE Wayland Compositor #%1 (%2)", m_number, waylandServer()->display()->socketName());
"KDE Wayland Compositor #%1 (%2)", m_number, waylandServer()->socketName());
if (grab.isEmpty()) {
m_xdgShellSurface->setTitle(title);
......
......@@ -348,7 +348,7 @@ void X11WindowedBackend::updateWindowTitle()
{
const QString grab = m_keyboardGrabbed ? i18n("Press right control to ungrab input") : i18n("Press right control key to grab input");
const QString title = QStringLiteral("%1 (%2) - %3").arg(i18n("KDE Wayland Compositor"))
.arg(waylandServer()->display()->socketName())
.arg(waylandServer()->socketName())
.arg(grab);
for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) {
(*it)->setWindowTitle(title);
......
......@@ -331,10 +331,8 @@ bool WaylandServer::init(const QByteArray &socketName, InitializationFlags flags
{
m_initFlags = flags;
m_display = new KWinDisplay(this);
if (!socketName.isNull() && !socketName.isEmpty()) {
m_display->setSocketName(QString::fromUtf8(socketName));
} else {
m_display->setAutomaticSocketNaming(true);
if (!m_display->addSocketName(QString::fromUtf8(socketName))) {
return false;
}
m_compositor = m_display->createCompositor(m_display);
connect(m_compositor, &CompositorInterface::surfaceCreated, this,
......@@ -744,7 +742,7 @@ void WaylandServer::dispatch()
if (m_internalConnection.server) {
m_internalConnection.server->flush();
}
m_display->dispatchEvents(0);
m_display->dispatchEvents();
}
static AbstractClient *findClientInList(const QList<AbstractClient *> &clients, KWaylandServer::SurfaceInterface *surface)
......@@ -827,4 +825,13 @@ bool WaylandServer::isKeyboardShortcutsInhibited() const
return false;
}
QString WaylandServer::socketName() const
{
const QStringList socketNames = display()->socketNames();
if (!socketNames.isEmpty()) {
return socketNames.first();
}
return QString();
}
}
......@@ -241,6 +241,12 @@ public:
AbstractWaylandOutput *findOutput(KWaylandServer::OutputInterface *output) const;
/**
* Returns the first socket name that can be used to connect to this server.
* For a full list, use display()->socketNames()
*/
QString socketName() const;
Q_SIGNALS:
void shellClientAdded(KWin::AbstractClient *);
void shellClientRemoved(KWin::AbstractClient *);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment