Commit 26e73360 authored by Fabian Vogt's avatar Fabian Vogt
Browse files

xwayland: Rename updateXauthorityFile and add error handling

This renames updateXauthorityFile to writeXauthorityEntries as it doesn't
actually update (i.e. change) anything, it just writes new ones.

Error handling is introduced, to avoid that it continues silently without
entries, which would cause all connections to fail.

(cherry picked from commit 06d2a31b)
parent 02bc1211
......@@ -317,14 +317,12 @@ void Xwayland::handleXwaylandReady()
m_watcher->deleteLater();
m_watcher = nullptr;
if (!createX11Connection()) {
if (!createX11Connection() || !writeXauthorityEntries()) {
emit errorOccurred();
return;
}
const QByteArray displayName = ':' + QByteArray::number(m_display);
updateXauthorityFile();
qCInfo(KWIN_XWL) << "Xwayland server started on display" << displayName;
qputenv("DISPLAY", displayName);
qputenv("XAUTHORITY", m_authorityFile.fileName().toUtf8());
......@@ -435,7 +433,7 @@ static QByteArray generateXauthorityCookie()
return cookie;
}
void Xwayland::updateXauthorityFile()
bool Xwayland::writeXauthorityEntries()
{
const quint16 family = 256; // FamilyLocal
......@@ -449,7 +447,7 @@ void Xwayland::updateXauthorityFile()
writeXauthorityEntry(stream, family, address, display, name, cookie);
m_authorityFile->flush();
return stream.status() == QDataStream::Ok && m_authorityFile.flush();
}
DragEventReply Xwayland::dragMoveFilter(Toplevel *target, const QPoint &pos)
......
......@@ -99,7 +99,7 @@ private:
void destroyX11Connection();
bool createXauthorityFile();
void updateXauthorityFile();
bool writeXauthorityEntries();
DragEventReply dragMoveFilter(Toplevel *target, const QPoint &pos) override;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment