comparison src/sys/win32/dark_theme.cc @ 106:c8c72278f6fd

*: #if -> #ifdef, remove outdated comments in sys/win32/dark_theme.cc
author Paper <mrpapersonic@gmail.com>
date Sun, 05 Nov 2023 04:01:58 -0500
parents 6d8da6e64d61
children bc8d2ccff09c
comparison
equal deleted inserted replaced
105:6d8da6e64d61 106:c8c72278f6fd
14 Library() {} 14 Library() {}
15 ~Library() { 15 ~Library() {
16 Unload(); 16 Unload();
17 } 17 }
18 void Unload() { 18 void Unload() {
19 if (hInstance) 19 if (hInstance) {
20 FreeLibrary(hInstance); 20 FreeLibrary(hInstance);
21 hInstance = nullptr;
22 }
21 loaded = false; 23 loaded = false;
22 } 24 }
23 void Load(LPCWSTR name) { 25 void Load(LPCWSTR name) {
24 if (loaded) 26 if (loaded)
25 Unload(); 27 Unload();
61 return false; 63 return false;
62 64
63 return set_wind_attrib(hWnd, key, data, sz_data); 65 return set_wind_attrib(hWnd, key, data, sz_data);
64 } 66 }
65 67
66 /* Ok, so this doesn't work. Woohoo! :) */
67 bool SetTitleBarToBlack(QWidget* win, bool enabled) { 68 bool SetTitleBarToBlack(QWidget* win, bool enabled) {
68 BOOL b = enabled; 69 BOOL b = enabled;
69 70
70 /* MAGIC NUMBERS: 19 and 20 are both DWMWA_USE_IMMERSIVE_DARK_MODE. 71 /* MAGIC NUMBERS: 19 and 20 are both DWMWA_USE_IMMERSIVE_DARK_MODE.
71 clarification: it's 20 on newer versions of windows (i.e. win11 and late win10), 72 clarification: it's 20 on newer versions of windows (i.e. win11 and late win10),
75 if (result == S_OK) 76 if (result == S_OK)
76 return b; 77 return b;
77 } 78 }
78 79
79 { 80 {
80 /* It's 19 in older Windows 10 versions. Yeah, stupid. */
81 HRESULT result = SetWindowAttribute(reinterpret_cast<HWND>(win->winId()), 19, &b, sizeof(b)); 81 HRESULT result = SetWindowAttribute(reinterpret_cast<HWND>(win->winId()), 19, &b, sizeof(b));
82 if (result == S_OK) 82 if (result == S_OK)
83 return b; 83 return b;
84 } 84 }
85 85