Mercurial > minori
comparison src/sys/osx/dark_theme.cc @ 273:f31305b9f60a
*: various code safety changes
this also makes the code build on Qt 5.7. I can't test it though
because I don't have it working... FAIL!
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Thu, 18 Apr 2024 16:53:17 -0400 |
parents | 862d0d8619f6 |
children | 22f9aacf6ac1 |
comparison
equal
deleted
inserted
replaced
272:5437009cb10e | 273:f31305b9f60a |
---|---|
2 | 2 |
3 #include <objc/message.h> | 3 #include <objc/message.h> |
4 #include <objc/runtime.h> | 4 #include <objc/runtime.h> |
5 | 5 |
6 #include <CoreFoundation/CoreFoundation.h> | 6 #include <CoreFoundation/CoreFoundation.h> |
7 | |
8 #include <QOperatingSystemVersion> | |
9 | 7 |
10 namespace osx { | 8 namespace osx { |
11 | 9 |
12 typedef id (*object_message_send)(id, SEL, ...); | 10 typedef id (*object_message_send)(id, SEL, ...); |
13 typedef id (*class_message_send)(Class, SEL, ...); | 11 typedef id (*class_message_send)(Class, SEL, ...); |
37 | 35 |
38 return true; | 36 return true; |
39 } | 37 } |
40 | 38 |
41 bool DarkThemeAvailable() { | 39 bool DarkThemeAvailable() { |
42 return (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave); | 40 return (__builtin_available(macOS 10.14, *)); |
43 } | 41 } |
44 | 42 |
45 bool IsInDarkTheme() { | 43 bool IsInDarkTheme() { |
46 if (!DarkThemeAvailable()) | 44 if (!DarkThemeAvailable()) |
47 return false; | 45 return false; |