diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 46077e2c3f..68ad93143b 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -122,6 +122,7 @@ static bool runningUnderDebugger() QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char **argv) : m_eventDispatcher(createUnixEventDispatcher()) , m_services(new QGenericUnixServices) + , m_instanceName(0) { QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher); @@ -148,6 +149,9 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char if (!strcmp(arg, "-display") && i < argc - 1) { displayName = argv[++i]; arg = 0; + } else if (!strcmp(arg, "-name") && i < argc - 1) { + m_instanceName = argv[++i]; + arg = 0; } } if (arg) @@ -409,6 +413,8 @@ QByteArray QXcbIntegration::wmClass() const if (m_wmClass.isEmpty()) { // Instance name according to ICCCM 4.1.2.5 QString name; + if (m_instanceName) + name = QString::fromLocal8Bit(m_instanceName); if (name.isEmpty() && qEnvironmentVariableIsSet(resourceNameVar)) name = QString::fromLocal8Bit(qgetenv(resourceNameVar)); if (name.isEmpty()) diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index b884b3b7f2..09fc0d32b5 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -119,6 +119,7 @@ private: friend class QXcbConnection; // access QPlatformIntegration::screenAdded() mutable QByteArray m_wmClass; + const char *m_instanceName; }; QT_END_NAMESPACE