CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/Windows/W32Util/DarkMode.h
Views: 1401
1
#pragma once
2
3
#include "Common/CommonWindows.h"
4
#include <commctrl.h>
5
#include <Uxtheme.h>
6
#include <WindowsX.h>
7
#include <Vssym32.h>
8
9
#include "IatHook.h"
10
11
enum IMMERSIVE_HC_CACHE_MODE
12
{
13
IHCM_USE_CACHED_VALUE,
14
IHCM_REFRESH
15
};
16
17
// 1903 18362
18
enum PreferredAppMode
19
{
20
Default,
21
AllowDark,
22
ForceDark,
23
ForceLight,
24
Max
25
};
26
27
enum WINDOWCOMPOSITIONATTRIB
28
{
29
WCA_UNDEFINED = 0,
30
WCA_NCRENDERING_ENABLED = 1,
31
WCA_NCRENDERING_POLICY = 2,
32
WCA_TRANSITIONS_FORCEDISABLED = 3,
33
WCA_ALLOW_NCPAINT = 4,
34
WCA_CAPTION_BUTTON_BOUNDS = 5,
35
WCA_NONCLIENT_RTL_LAYOUT = 6,
36
WCA_FORCE_ICONIC_REPRESENTATION = 7,
37
WCA_EXTENDED_FRAME_BOUNDS = 8,
38
WCA_HAS_ICONIC_BITMAP = 9,
39
WCA_THEME_ATTRIBUTES = 10,
40
WCA_NCRENDERING_EXILED = 11,
41
WCA_NCADORNMENTINFO = 12,
42
WCA_EXCLUDED_FROM_LIVEPREVIEW = 13,
43
WCA_VIDEO_OVERLAY_ACTIVE = 14,
44
WCA_FORCE_ACTIVEWINDOW_APPEARANCE = 15,
45
WCA_DISALLOW_PEEK = 16,
46
WCA_CLOAK = 17,
47
WCA_CLOAKED = 18,
48
WCA_ACCENT_POLICY = 19,
49
WCA_FREEZE_REPRESENTATION = 20,
50
WCA_EVER_UNCLOAKED = 21,
51
WCA_VISUAL_OWNER = 22,
52
WCA_HOLOGRAPHIC = 23,
53
WCA_EXCLUDED_FROM_DDA = 24,
54
WCA_PASSIVEUPDATEMODE = 25,
55
WCA_USEDARKMODECOLORS = 26,
56
WCA_LAST = 27
57
};
58
59
struct WINDOWCOMPOSITIONATTRIBDATA
60
{
61
WINDOWCOMPOSITIONATTRIB Attrib;
62
PVOID pvData;
63
SIZE_T cbData;
64
};
65
66
using fnRtlGetNtVersionNumbers = void (WINAPI *)(LPDWORD major, LPDWORD minor, LPDWORD build);
67
using fnSetWindowCompositionAttribute = BOOL (WINAPI *)(HWND hWnd, WINDOWCOMPOSITIONATTRIBDATA*);
68
// 1809 17763
69
using fnShouldAppsUseDarkMode = bool (WINAPI *)(); // ordinal 132
70
using fnAllowDarkModeForWindow = bool (WINAPI *)(HWND hWnd, bool allow); // ordinal 133
71
using fnAllowDarkModeForApp = bool (WINAPI *)(bool allow); // ordinal 135, in 1809
72
using fnFlushMenuThemes = void (WINAPI *)(); // ordinal 136
73
using fnRefreshImmersiveColorPolicyState = void (WINAPI *)(); // ordinal 104
74
using fnIsDarkModeAllowedForWindow = bool (WINAPI *)(HWND hWnd); // ordinal 137
75
using fnGetIsImmersiveColorUsingHighContrast = bool (WINAPI *)(IMMERSIVE_HC_CACHE_MODE mode); // ordinal 106
76
using fnOpenNcThemeData = HTHEME(WINAPI *)(HWND hWnd, LPCWSTR pszClassList); // ordinal 49
77
// 1903 18362
78
using fnShouldSystemUseDarkMode = bool (WINAPI *)(); // ordinal 138
79
using fnSetPreferredAppMode = PreferredAppMode (WINAPI *)(PreferredAppMode appMode); // ordinal 135, in 1903
80
using fnIsDarkModeAllowedForApp = bool (WINAPI *)(); // ordinal 139
81
using fnSetWindowTheme = void (WINAPI*)(HWND, LPCWSTR, LPCWSTR);
82
//---------------------------------------------------------------------------
83
84
extern fnSetWindowCompositionAttribute _SetWindowCompositionAttribute;
85
extern fnShouldAppsUseDarkMode _ShouldAppsUseDarkMode;
86
extern fnAllowDarkModeForWindow _AllowDarkModeForWindow;
87
extern fnAllowDarkModeForApp _AllowDarkModeForApp;
88
extern fnFlushMenuThemes _FlushMenuThemes;
89
extern fnRefreshImmersiveColorPolicyState _RefreshImmersiveColorPolicyState;
90
extern fnIsDarkModeAllowedForWindow _IsDarkModeAllowedForWindow;
91
extern fnGetIsImmersiveColorUsingHighContrast _GetIsImmersiveColorUsingHighContrast;
92
extern fnOpenNcThemeData _OpenNcThemeData;
93
// 1903 18362
94
extern fnShouldSystemUseDarkMode _ShouldSystemUseDarkMode;
95
extern fnSetPreferredAppMode _SetPreferredAppMode;
96
extern fnSetWindowTheme _SetWindowTheme;
97
98
extern bool g_darkModeSupported;
99
extern bool g_darkModeEnabled;
100
101
void InitDarkMode();
102
bool AllowDarkModeForWindow(HWND hWnd, bool allow);
103
void RefreshTitleBarThemeColor(HWND hWnd);
104
bool IsColorSchemeChangeMessage(LPARAM lParam);
105
bool IsDarkModeEnabled();
106
107
void DarkModeInitDialog(HWND hDlg);
108
LRESULT DarkModeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
109
110