From ddf6f57f212da5555d799d9f3ac9faff093891d0 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 19 Feb 2018 12:34:04 +0100 Subject: xcb: Fix -geometry argument for platformName with arguments or fallbacks -geometry, -title and -icon for xcb did not work if the platform string had arguments or there were fallback platforms. Only accept the arguments if xcb is the default platform. I.e. ignore the arguments if xcb is a fallback. This now works: ./application -platform "xcb:someArg=value" -title specialXcbTitle ./application -platform "xcb;wayland" -title specialXcbTitle ./application -platform "xcb:someArg=value;wayland" -title specialXcbTitle But this does not: ./application -platform "wayland;xcb:someArg=value" -title specialXcbTitle Change-Id: I4ee20b1ed722bc98417a5e75db7d8c98ffcdfcfe Reviewed-by: Gatis Paeglis --- src/gui/kernel/qguiapplication.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index fdc27b760c..12390928f0 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1304,7 +1304,7 @@ void QGuiApplicationPrivate::createPlatformIntegration() argv[j++] = argv[i]; continue; } - const bool isXcb = platformName == "xcb"; + const bool xcbIsDefault = platformName.startsWith("xcb"); const char *arg = argv[i]; if (arg[1] == '-') // startsWith("--") ++arg; @@ -1317,13 +1317,13 @@ void QGuiApplicationPrivate::createPlatformIntegration() } else if (strcmp(arg, "-platformtheme") == 0) { if (++i < argc) platformThemeName = QString::fromLocal8Bit(argv[i]); - } else if (strcmp(arg, "-qwindowgeometry") == 0 || (isXcb && strcmp(arg, "-geometry") == 0)) { + } else if (strcmp(arg, "-qwindowgeometry") == 0 || (xcbIsDefault && strcmp(arg, "-geometry") == 0)) { if (++i < argc) windowGeometrySpecification = QWindowGeometrySpecification::fromArgument(argv[i]); - } else if (strcmp(arg, "-qwindowtitle") == 0 || (isXcb && strcmp(arg, "-title") == 0)) { + } else if (strcmp(arg, "-qwindowtitle") == 0 || (xcbIsDefault && strcmp(arg, "-title") == 0)) { if (++i < argc) firstWindowTitle = QString::fromLocal8Bit(argv[i]); - } else if (strcmp(arg, "-qwindowicon") == 0 || (isXcb && strcmp(arg, "-icon") == 0)) { + } else if (strcmp(arg, "-qwindowicon") == 0 || (xcbIsDefault && strcmp(arg, "-icon") == 0)) { if (++i < argc) { icon = QString::fromLocal8Bit(argv[i]); } -- cgit v1.2.3