From e5fb03b6e915b176ae8804ae7317ff1977848487 Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Mon, 7 Dec 2020 12:26:11 -0700 Subject: Fix window sizing and positioning on Windows The feature to make windows remember their sizes and positions across screen layouts relied on calling QScreen::name() to identify screens. Unfortunately this function returns garbage on Windows; see https://bugreports.qt.io/browse/QTBUG-74317 So on Windows, let's identify displays by serial number as a workaround. BUG: 429943 FIXED-IN: 5.78 --- src/gui/kwindowconfig.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gui/kwindowconfig.cpp') diff --git a/src/gui/kwindowconfig.cpp b/src/gui/kwindowconfig.cpp index bb541b8e..4181651f 100644 --- a/src/gui/kwindowconfig.cpp +++ b/src/gui/kwindowconfig.cpp @@ -21,7 +21,13 @@ static QString allConnectedScreens() const auto screens = QGuiApplication::screens(); names.reserve(screens.length()); for (auto screen : screens) { +#ifdef Q_OS_WIN + // QScreen::name() returns garbage on Windows; see https://bugreports.qt.io/browse/QTBUG-74317 + // So we use the screens' serial numbers to identify them instead + names << screen->serialNumber(); +#else names << screen->name(); +#endif } return names.join(QLatin1Char(' ')); } -- cgit v1.2.1