File 0001-Fix-platform-detection-for-EnableHiDPI.patch of Package sddm
From 70b1059cebd0bc98d1545a7a702c1c1779286c42 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Thu, 8 Mar 2018 10:47:03 +0100
Subject: [PATCH] Fix platform detection for EnableHiDPI
We can't use QGuiApplication before it's constructed, so find out which
platform is requested ourselves.
Fixes #894
---
src/greeter/GreeterApp.cpp | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/greeter/GreeterApp.cpp b/src/greeter/GreeterApp.cpp
index 1230efa..5181e4e 100644
--- a/src/greeter/GreeterApp.cpp
+++ b/src/greeter/GreeterApp.cpp
@@ -278,11 +278,27 @@ int main(int argc, char **argv)
// Install message handler
qInstallMessageHandler(SDDM::GreeterMessageHandler);
+ // We set an attribute based on the platform we run on.
+ // We only know the platform after we constructed QGuiApplication
+ // though, so we need to find it out ourselves.
+ QLatin1String platform;
+ for (int i = 1; i < argc - 1; ++i) {
+ if(qstrcmp(argv[i], "-platform") == 0) {
+ platform = QLatin1String(argv[i + 1]);
+ }
+ }
+ if (platform.isEmpty()) {
+ platform = QLatin1String(qgetenv("QT_QPA_PLATFORM"));
+ }
+ if (platform.isEmpty()) {
+ platform = QLatin1String("xcb");
+ }
+
// HiDPI
bool hiDpiEnabled = false;
- if (QGuiApplication::platformName() == QLatin1String("xcb"))
+ if (platform == QLatin1String("xcb"))
hiDpiEnabled = SDDM::mainConfig.X11.EnableHiDPI.get();
- else if (QGuiApplication::platformName().startsWith(QLatin1String("wayland")))
+ else if (platform.startsWith(QLatin1String("wayland")))
hiDpiEnabled = SDDM::mainConfig.Wayland.EnableHiDPI.get();
if (hiDpiEnabled) {
qDebug() << "High-DPI autoscaling Enabled";
--
2.16.1