summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2022-08-23 15:30:13 +0300
committerIvan Komissarov <ABBAPOH@gmail.com>2022-08-24 09:02:14 +0000
commit539ba0ae6f13785661948417e4f69ba222ecd351 (patch)
treee4ecec9ae1eeadb7ec96f473d8568ff0b5b6fd9f
parentbbd699f2601a5f04d5f83effb5775a9543ea0ea7 (diff)
downloadqbs-539ba0ae6f13785661948417e4f69ba222ecd351.tar.gz
Darwin: Set NSSupportsAutomaticGraphicsSwitching to true by default
User can set it to false using the bundle.infoPlist property if needed. Fixes: QBS-1670 Change-Id: Ie009bd7f366c09ae6a77134ba0290dea62ae6e35 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--share/qbs/modules/cpp/DarwinGCC.qbs3
-rw-r--r--tests/auto/blackbox/tst_blackboxapple.cpp1
2 files changed, 4 insertions, 0 deletions
diff --git a/share/qbs/modules/cpp/DarwinGCC.qbs b/share/qbs/modules/cpp/DarwinGCC.qbs
index 81d8bded2..c42d25362 100644
--- a/share/qbs/modules/cpp/DarwinGCC.qbs
+++ b/share/qbs/modules/cpp/DarwinGCC.qbs
@@ -110,6 +110,9 @@ UnixGCC {
if (qbs.targetOS.contains("macos")) {
dict["NSPrincipalClass"] = "NSApplication"; // needed for Retina display support
+ // QBS-1670: set this flag by default to avoid extensive GPU usage
+ dict["NSSupportsAutomaticGraphicsSwitching"] = true;
+
if (minimumMacosVersion)
dict["LSMinimumSystemVersion"] = minimumMacosVersion;
}
diff --git a/tests/auto/blackbox/tst_blackboxapple.cpp b/tests/auto/blackbox/tst_blackboxapple.cpp
index 2744f907e..0a6a763ee 100644
--- a/tests/auto/blackbox/tst_blackboxapple.cpp
+++ b/tests/auto/blackbox/tst_blackboxapple.cpp
@@ -1023,6 +1023,7 @@ void TestBlackboxApple::infoPlist()
if (!content.contains(QStringLiteral("SDKROOT"))) { // macOS-specific values
QCOMPARE(content.value("LSMinimumSystemVersion"), QStringLiteral("10.7"));
QCOMPARE(content.value("NSPrincipalClass"), QStringLiteral("NSApplication"));
+ QCOMPARE(content.value(QStringLiteral("NSSupportsAutomaticGraphicsSwitching")), true);
} else {
// QBS-1447: UIDeviceFamily was set to a string instead of an array
const auto family = content.value(QStringLiteral("UIDeviceFamily"));