XCB: Readd support for -name command line argument.

Task-number: QTBUG-27349

Change-Id: I85390942927cd1c54f76fd7ddc0f3487c7205b57
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
Friedemann Kleint 2013-07-25 08:49:39 +02:00 committed by The Qt Project
parent d7e37537d4
commit 15b45c608f
2 changed files with 7 additions and 0 deletions

View File

@ -122,6 +122,7 @@ static bool runningUnderDebugger()
QXcbIntegration::QXcbIntegration(const QStringList &parameters, int &argc, char **argv) QXcbIntegration::QXcbIntegration(const QStringList &parameters, int &argc, char **argv)
: m_eventDispatcher(createUnixEventDispatcher()) : m_eventDispatcher(createUnixEventDispatcher())
, m_services(new QGenericUnixServices) , m_services(new QGenericUnixServices)
, m_instanceName(0)
{ {
QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher); QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
@ -148,6 +149,9 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters, int &argc, char
if (!strcmp(arg, "-display") && i < argc - 1) { if (!strcmp(arg, "-display") && i < argc - 1) {
displayName = argv[++i]; displayName = argv[++i];
arg = 0; arg = 0;
} else if (!strcmp(arg, "-name") && i < argc - 1) {
m_instanceName = argv[++i];
arg = 0;
} }
} }
if (arg) if (arg)
@ -409,6 +413,8 @@ QByteArray QXcbIntegration::wmClass() const
if (m_wmClass.isEmpty()) { if (m_wmClass.isEmpty()) {
// Instance name according to ICCCM 4.1.2.5 // Instance name according to ICCCM 4.1.2.5
QString name; QString name;
if (m_instanceName)
name = QString::fromLocal8Bit(m_instanceName);
if (name.isEmpty() && qEnvironmentVariableIsSet(resourceNameVar)) if (name.isEmpty() && qEnvironmentVariableIsSet(resourceNameVar))
name = QString::fromLocal8Bit(qgetenv(resourceNameVar)); name = QString::fromLocal8Bit(qgetenv(resourceNameVar));
if (name.isEmpty()) if (name.isEmpty())

View File

@ -119,6 +119,7 @@ private:
friend class QXcbConnection; // access QPlatformIntegration::screenAdded() friend class QXcbConnection; // access QPlatformIntegration::screenAdded()
mutable QByteArray m_wmClass; mutable QByteArray m_wmClass;
const char *m_instanceName;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE