Skip to content

Commit

Permalink
Revert "macOS: Force light theme on macOS 10.14+"
Browse files Browse the repository at this point in the history
This does not really work: as soon as you build with
the 10.14 SDK you opt-in to having updated palette
management, which the Qt 5.11 series does not have.

This leaves app developers with two ways to opt-out
of dark mode:
 - Build with the 10.13 (or earlier) SDK.
 - Set NSRequiresAquaSystemAppearance in Info.plist

This reverts commit 04671a8.

Change-Id: I5c01b9965da45de914f699526ba0723837f36e1d
Reviewed-by: Tor Arne Vestbø <[email protected]>
Reviewed-by: Gabriel de Dietrich <[email protected]>
  • Loading branch information
Morten Johan Sørvig authored and jaheikk committed Sep 3, 2018
1 parent 4daa6bb commit 9da5b6f
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/plugins/platforms/cocoa/qcocoaintegration.mm
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@

#include <IOKit/graphics/IOGraphicsLib.h>

#if !QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
@interface NSApplication (MojaveForwardDeclarations)
@property (strong) NSAppearance *appearance NS_AVAILABLE_MAC(10_14);
@end
#endif

static void initResources()
{
Q_INIT_RESOURCE(qcocoaresources);
Expand Down Expand Up @@ -137,21 +131,6 @@ static void initResources()
NSApplication *cocoaApplication = [QNSApplication sharedApplication];
qt_redirectNSApplicationSendEvent();

if (__builtin_available(macOS 10.14, *)) {
// Disable dark appearance, unless the Info.plist or environment requests that it should be enabled
bool plistEnablesDarkAppearance = [[[NSBundle mainBundle] objectForInfoDictionaryKey:
@"NSRequiresAquaSystemAppearance"] boolValue];

bool hasEnvironmentRequiresAquaAppearance;
int environmentRequiresAquaAppearance = qEnvironmentVariableIntValue(
"QT_MAC_REQUIRES_AQUA_SYSTEM_APPEARANCE", &hasEnvironmentRequiresAquaAppearance);
bool environmentEnablesDarkAppearance = hasEnvironmentRequiresAquaAppearance
&& environmentRequiresAquaAppearance == 0;

if (!(plistEnablesDarkAppearance || environmentEnablesDarkAppearance))
NSApp.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
}

if (qEnvironmentVariableIsEmpty("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM")) {
// Applications launched from plain executables (without an app
// bundle) are "background" applications that does not take keybaord
Expand Down

0 comments on commit 9da5b6f

Please sign in to comment.