diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-07-17 16:22:41 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-18 13:13:36 +0200 |
commit | c96a6ab627100452864eb4d8da973300401c1bfa (patch) | |
tree | 0ecd0f390685c976efcd1df2fadc09193f190bbf /src/plugins/platforms/xcb/qxcbintegration.cpp | |
parent | 066d32d7435ecda9e9fe0447ea06c9be672cfea3 (diff) |
Pass argc, argv to the platform plugins.
Allow for parsing of X11-specific arguments like -display,
-geometry. Introduce overload of
QPlatformIntegration::create() with argc and argv
and provide default implementation that calls the old version
(for platforms that do not have argc, argv). Provide default
implementation for the old version returning 0 so that platforms
using the new API compile.
Prototypically implement -display in XCB.
Task-number: QTBUG-29396
Change-Id: I6a0e9271fad6e2d10f11b80393025ae3a3e36623
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbintegration.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 0ff18d9c92..1c170d44e6 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -119,7 +119,7 @@ static bool runningUnderDebugger() } #endif -QXcbIntegration::QXcbIntegration(const QStringList ¶meters) +QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char **argv) : m_eventDispatcher(createUnixEventDispatcher()) , m_services(new QGenericUnixServices) { @@ -138,7 +138,25 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters) if (canNotGrabEnv) canGrab = false; - m_connections << new QXcbConnection(m_nativeInterface.data(), canGrab); + // Parse arguments + const char *displayName = 0; + if (argc) { + int j = 1; + for (int i = 1; i < argc; i++) { + char *arg = argv[i]; + if (arg) { + if (!strcmp(arg, "-display") && i < argc - 1) { + displayName = argv[++i]; + arg = 0; + } + } + if (arg) + argv[j++] = arg; + } + argc = j; + } // argc + + m_connections << new QXcbConnection(m_nativeInterface.data(), canGrab, displayName); for (int i = 0; i < parameters.size() - 1; i += 2) { #ifdef Q_XCB_DEBUG |