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 <gatis.paeglis@qt.io>
bb10
Johan Klokkhammer Helsing 2018-02-19 12:34:04 +01:00 committed by Johan Helsing
parent 093d85393f
commit ddf6f57f21
1 changed files with 4 additions and 4 deletions

View File

@ -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]);
}