comparison src/sys/osx/dark_theme.cc @ 258:862d0d8619f6

*: HUUUGE changes animia has been renamed to animone, so instead of thinking of a health condition, you think of a beautiful flower :) I've also edited some of the code for animone, but I have no idea if it even works or not because I don't have a mac or windows machine lying around. whoops! ... anyway, all of the changes divergent from Anisthesia are now licensed under BSD. it's possible that I could even rewrite most of the code to where I don't even have to keep the MIT license, but that's thinking too far into the future I've been slacking off on implementing the anime seasons page, mostly out of laziness. I think I'd have to create another db file specifically for the seasons anyway, this code is being pushed *primarily* because the hard drive it's on is failing! yay :)
author Paper <paper@paper.us.eu.org>
date Mon, 01 Apr 2024 02:43:44 -0400
parents f0ff06a45c42
children f31305b9f60a
comparison
equal deleted inserted replaced
257:699a20c57dc8 258:862d0d8619f6
1 #include "sys/osx/dark_theme.h" 1 #include "sys/osx/dark_theme.h"
2 2
3 #include <objc/message.h>
3 #include <objc/runtime.h> 4 #include <objc/runtime.h>
4 #include <objc/message.h>
5 5
6 #include <CoreFoundation/CoreFoundation.h> 6 #include <CoreFoundation/CoreFoundation.h>
7 7
8 #include <QOperatingSystemVersion> 8 #include <QOperatingSystemVersion>
9 9
23 bool RetrieveAppearanceNames() { 23 bool RetrieveAppearanceNames() {
24 CFBundleRef appkit_bundle = CFBundleGetBundleWithIdentifier(kAppKitBundleID); 24 CFBundleRef appkit_bundle = CFBundleGetBundleWithIdentifier(kAppKitBundleID);
25 if (!appkit_bundle) 25 if (!appkit_bundle)
26 return false; 26 return false;
27 27
28 NSAppearanceNameAqua = *reinterpret_cast<CFStringRef*>(CFBundleGetDataPointerForName(appkit_bundle, CFSTR("NSAppearanceNameAqua"))); 28 NSAppearanceNameAqua =
29 *reinterpret_cast<CFStringRef*>(CFBundleGetDataPointerForName(appkit_bundle, CFSTR("NSAppearanceNameAqua")));
29 if (!NSAppearanceNameAqua) 30 if (!NSAppearanceNameAqua)
30 return false; 31 return false;
31 32
32 NSAppearanceNameDarkAqua = *reinterpret_cast<CFStringRef*>(CFBundleGetDataPointerForName(appkit_bundle, CFSTR("NSAppearanceNameDarkAqua"))); 33 NSAppearanceNameDarkAqua = *reinterpret_cast<CFStringRef*>(
34 CFBundleGetDataPointerForName(appkit_bundle, CFSTR("NSAppearanceNameDarkAqua")));
33 if (!NSAppearanceNameDarkAqua) 35 if (!NSAppearanceNameDarkAqua)
34 return false; 36 return false;
35 37
36 return true; 38 return true;
37 } 39 }
86 88
87 // NSApplication* app = [NSApplication sharedApplication]; 89 // NSApplication* app = [NSApplication sharedApplication];
88 const id app = cls_send(objc_getClass("NSApplication"), sel_getUid("sharedApplication")); 90 const id app = cls_send(objc_getClass("NSApplication"), sel_getUid("sharedApplication"));
89 91
90 // NSAppearance* appearance = [NSAppearance appearanceNamed: NSAppearanceNameDarkAqua]; 92 // NSAppearance* appearance = [NSAppearance appearanceNamed: NSAppearanceNameDarkAqua];
91 const id appearance = cls_send(objc_getClass("NSAppearance"), sel_getUid("appearanceNamed:"), NSAppearanceNameDarkAqua); 93 const id appearance =
94 cls_send(objc_getClass("NSAppearance"), sel_getUid("appearanceNamed:"), NSAppearanceNameDarkAqua);
92 if (!appearance) 95 if (!appearance)
93 return false; 96 return false;
94 97
95 // [app setAppearance: appearance]; 98 // [app setAppearance: appearance];
96 obj_send(app, sel_getUid("setAppearance:"), appearance); 99 obj_send(app, sel_getUid("setAppearance:"), appearance);