File 0001-Export-consistent-hostname-as-XAUTHLOCALHOSTNAME.patch of Package deepin-kwin
diff -Nur deepin-kwin-5.27.2.203/src/helpers/wayland_wrapper/kwin_wrapper.cpp deepin-kwin-5.27.2.203-new/src/helpers/wayland_wrapper/kwin_wrapper.cpp
--- deepin-kwin-5.27.2.203/src/helpers/wayland_wrapper/kwin_wrapper.cpp 2024-07-18 10:23:34.000000000 +0800
+++ deepin-kwin-5.27.2.203-new/src/helpers/wayland_wrapper/kwin_wrapper.cpp 2024-08-12 22:37:40.981548545 +0800
@@ -23,6 +23,7 @@
#include <QCoreApplication>
#include <QDBusConnection>
#include <QDebug>
+#include <QHostInfo>
#include <QProcess>
#include <QTemporaryFile>
@@ -71,8 +72,11 @@
}
if (m_xwlSocket) {
if (!qEnvironmentVariableIsSet("KWIN_WAYLAND_NO_XAUTHORITY")) {
- if (!generateXauthorityFile(m_xwlSocket->display(), &m_xauthorityFile)) {
+ const QByteArray hostname = QHostInfo::localHostName().toUtf8();
+ if (!generateXauthorityFile(m_xwlSocket->display(), &m_xauthorityFile, hostname)) {
qCWarning(KWIN_WRAPPER) << "Failed to create an Xauthority file";
+ } else {
+ qputenv("XAUTHLOCALHOSTNAME", hostname);
}
}
}
diff -Nur deepin-kwin-5.27.2.203/src/xwayland/lib/xauthority.cpp deepin-kwin-5.27.2.203-new/src/xwayland/lib/xauthority.cpp
--- deepin-kwin-5.27.2.203/src/xwayland/lib/xauthority.cpp 2024-07-18 10:23:34.000000000 +0800
+++ deepin-kwin-5.27.2.203-new/src/xwayland/lib/xauthority.cpp 2024-08-12 22:38:40.688024726 +0800
@@ -45,7 +45,7 @@
return cookie;
}
-bool generateXauthorityFile(int display, QTemporaryFile *authorityFile)
+bool generateXauthorityFile(int display, QTemporaryFile *authorityFile, const QByteArray &hostname)
{
const QString runtimeDirectory = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
@@ -54,7 +54,6 @@
return false;
}
- const QByteArray hostname = QHostInfo::localHostName().toUtf8();
const QByteArray displayName = QByteArray::number(display);
const QByteArray name = QByteArrayLiteral("MIT-MAGIC-COOKIE-1");
const QByteArray cookie = generateXauthorityCookie();
diff -Nur deepin-kwin-5.27.2.203/src/xwayland/lib/xauthority.h deepin-kwin-5.27.2.203-new/src/xwayland/lib/xauthority.h
--- deepin-kwin-5.27.2.203/src/xwayland/lib/xauthority.h 2024-07-18 10:23:34.000000000 +0800
+++ deepin-kwin-5.27.2.203-new/src/xwayland/lib/xauthority.h 2024-08-12 22:39:10.957928158 +0800
@@ -9,6 +9,7 @@
#pragma once
+class QByteArray;
class QTemporaryFile;
-bool generateXauthorityFile(int display, QTemporaryFile *authorityFile);
+bool generateXauthorityFile(int display, QTemporaryFile *authorityFile, const QByteArray &hostname);