Bug 463752

Summary: Build failure on macOS 10.15
Product: [Frameworks and Libraries] frameworks-kguiaddons Reporter: Stefan Gerlach <stefan.gerlach>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: nicolas.fella, nilsding, p.r.worrall
Priority: NOR    
Version: 5.101.0   
Target Milestone: ---   
Platform: Other   
OS: macOS   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Stefan Gerlach 2023-01-02 21:58:58 UTC
SUMMARY
***
Building on macOS 10.15 fails in line 37 because the macOS 11.0+ currentDrawingAppearance feature is used.

https://developer.apple.com/documentation/appkit/nsappearance/3674524-currentdrawingappearance

KF5 requires Qt 5.15.2 and should support macOS 10.13 or newer. This problem also leads to crashes of nightly builds on macOS 10.15 and older.

Possible solution: Use currentAppearance instead on macOS older than 11.0
Comment 1 Nicolas Fella 2023-01-05 18:07:19 UTC
Georg, could you please have a look at this?
Comment 2 Jyrki Gadinger 2023-01-05 18:43:03 UTC
(In reply to Nicolas Fella from comment #1)
> Georg, could you please have a look at this?

Sure, I will take a look at this this weekend. Need to set up a machine with 10.15 first though.
Comment 3 Bug Janitor Service 2023-01-06 08:31:58 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kguiaddons/-/merge_requests/87
Comment 4 Nicolas Fella 2023-01-11 15:19:01 UTC
Git commit c28c8b7442cc798d09239c0cf72b741d3e01fee6 by Nicolas Fella, on behalf of Georg Gadinger.
Committed on 11/01/2023 at 14:35.
Pushed by nicolasfella into branch 'master'.

KColorSchemeWatcherMac: do not use new NSAppearance API on older macOS versions

On macOS versions older than Big Sur (11.0) the
`NSAppearance.currentDrawingAppearance` property does not exist, and
trying to use it will crash the app at runtime.

This commit makes sure the new property is used on Big Sur or newer
macOS releases, and uses the deprecated `NSAppearance.currentAppearance`
property on Mojave (10.14) or newer.  As the light/dark mode switch was
introduced in Mojave, running the app on older releases will always
prefer the light mode.

Tested on macOS 10.15.5 (x86_64) and 13.1 (arm64)

M  +12   -1    src/colors/kcolorschemewatcher_mac.mm

https://invent.kde.org/frameworks/kguiaddons/commit/c28c8b7442cc798d09239c0cf72b741d3e01fee6
Comment 5 Nicolas Fella 2023-01-11 15:19:48 UTC
Git commit a0a118111c5d1ef913e630780b64bfa39cf214e2 by Nicolas Fella, on behalf of Georg Gadinger.
Committed on 11/01/2023 at 15:19.
Pushed by nicolasfella into branch 'kf5'.

KColorSchemeWatcherMac: do not use new NSAppearance API on older macOS versions

On macOS versions older than Big Sur (11.0) the
`NSAppearance.currentDrawingAppearance` property does not exist, and
trying to use it will crash the app at runtime.

This commit makes sure the new property is used on Big Sur or newer
macOS releases, and uses the deprecated `NSAppearance.currentAppearance`
property on Mojave (10.14) or newer.  As the light/dark mode switch was
introduced in Mojave, running the app on older releases will always
prefer the light mode.

Tested on macOS 10.15.5 (x86_64) and 13.1 (arm64)
(cherry picked from commit c28c8b7442cc798d09239c0cf72b741d3e01fee6)

M  +12   -1    src/colors/kcolorschemewatcher_mac.mm

https://invent.kde.org/frameworks/kguiaddons/commit/a0a118111c5d1ef913e630780b64bfa39cf214e2
Comment 6 Waqar Ahmed 2023-01-12 07:37:06 UTC
*** Bug 462674 has been marked as a duplicate of this bug. ***