Merge pull request #70612 from floppyhammer/fix-dark-title-bar
Fix dark title bar on Windows 11
This commit is contained in:
commit
a140d469d7
2 changed files with 2 additions and 6 deletions
|
@ -3709,7 +3709,6 @@ WTEnablePtr DisplayServerWindows::wintab_WTEnable = nullptr;
|
||||||
// UXTheme API.
|
// UXTheme API.
|
||||||
bool DisplayServerWindows::dark_title_available = false;
|
bool DisplayServerWindows::dark_title_available = false;
|
||||||
bool DisplayServerWindows::ux_theme_available = false;
|
bool DisplayServerWindows::ux_theme_available = false;
|
||||||
IsDarkModeAllowedForAppPtr DisplayServerWindows::IsDarkModeAllowedForApp = nullptr;
|
|
||||||
ShouldAppsUseDarkModePtr DisplayServerWindows::ShouldAppsUseDarkMode = nullptr;
|
ShouldAppsUseDarkModePtr DisplayServerWindows::ShouldAppsUseDarkMode = nullptr;
|
||||||
GetImmersiveColorFromColorSetExPtr DisplayServerWindows::GetImmersiveColorFromColorSetEx = nullptr;
|
GetImmersiveColorFromColorSetExPtr DisplayServerWindows::GetImmersiveColorFromColorSetEx = nullptr;
|
||||||
GetImmersiveColorTypeFromNamePtr DisplayServerWindows::GetImmersiveColorTypeFromName = nullptr;
|
GetImmersiveColorTypeFromNamePtr DisplayServerWindows::GetImmersiveColorTypeFromName = nullptr;
|
||||||
|
@ -3727,7 +3726,7 @@ typedef enum _SHC_PROCESS_DPI_AWARENESS {
|
||||||
} SHC_PROCESS_DPI_AWARENESS;
|
} SHC_PROCESS_DPI_AWARENESS;
|
||||||
|
|
||||||
bool DisplayServerWindows::is_dark_mode_supported() const {
|
bool DisplayServerWindows::is_dark_mode_supported() const {
|
||||||
return ux_theme_available && IsDarkModeAllowedForApp();
|
return ux_theme_available;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DisplayServerWindows::is_dark_mode() const {
|
bool DisplayServerWindows::is_dark_mode() const {
|
||||||
|
@ -3817,13 +3816,12 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
|
||||||
// Load UXTheme.
|
// Load UXTheme.
|
||||||
HMODULE ux_theme_lib = LoadLibraryW(L"uxtheme.dll");
|
HMODULE ux_theme_lib = LoadLibraryW(L"uxtheme.dll");
|
||||||
if (ux_theme_lib) {
|
if (ux_theme_lib) {
|
||||||
IsDarkModeAllowedForApp = (IsDarkModeAllowedForAppPtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(136));
|
|
||||||
ShouldAppsUseDarkMode = (ShouldAppsUseDarkModePtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(132));
|
ShouldAppsUseDarkMode = (ShouldAppsUseDarkModePtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(132));
|
||||||
GetImmersiveColorFromColorSetEx = (GetImmersiveColorFromColorSetExPtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(95));
|
GetImmersiveColorFromColorSetEx = (GetImmersiveColorFromColorSetExPtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(95));
|
||||||
GetImmersiveColorTypeFromName = (GetImmersiveColorTypeFromNamePtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(96));
|
GetImmersiveColorTypeFromName = (GetImmersiveColorTypeFromNamePtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(96));
|
||||||
GetImmersiveUserColorSetPreference = (GetImmersiveUserColorSetPreferencePtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(98));
|
GetImmersiveUserColorSetPreference = (GetImmersiveUserColorSetPreferencePtr)GetProcAddress(ux_theme_lib, MAKEINTRESOURCEA(98));
|
||||||
|
|
||||||
ux_theme_available = IsDarkModeAllowedForApp && ShouldAppsUseDarkMode && GetImmersiveColorFromColorSetEx && GetImmersiveColorTypeFromName && GetImmersiveUserColorSetPreference;
|
ux_theme_available = ShouldAppsUseDarkMode && GetImmersiveColorFromColorSetEx && GetImmersiveColorTypeFromName && GetImmersiveUserColorSetPreference;
|
||||||
if (os_ver.dwBuildNumber >= 22000) {
|
if (os_ver.dwBuildNumber >= 22000) {
|
||||||
dark_title_available = true;
|
dark_title_available = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,6 @@ typedef UINT(WINAPI *WTInfoPtr)(UINT p_category, UINT p_index, LPVOID p_output);
|
||||||
typedef BOOL(WINAPI *WTPacketPtr)(HANDLE p_ctx, UINT p_param, LPVOID p_packets);
|
typedef BOOL(WINAPI *WTPacketPtr)(HANDLE p_ctx, UINT p_param, LPVOID p_packets);
|
||||||
typedef BOOL(WINAPI *WTEnablePtr)(HANDLE p_ctx, BOOL p_enable);
|
typedef BOOL(WINAPI *WTEnablePtr)(HANDLE p_ctx, BOOL p_enable);
|
||||||
|
|
||||||
typedef bool(WINAPI *IsDarkModeAllowedForAppPtr)();
|
|
||||||
typedef bool(WINAPI *ShouldAppsUseDarkModePtr)();
|
typedef bool(WINAPI *ShouldAppsUseDarkModePtr)();
|
||||||
typedef DWORD(WINAPI *GetImmersiveColorFromColorSetExPtr)(UINT dwImmersiveColorSet, UINT dwImmersiveColorType, bool bIgnoreHighContrast, UINT dwHighContrastCacheMode);
|
typedef DWORD(WINAPI *GetImmersiveColorFromColorSetExPtr)(UINT dwImmersiveColorSet, UINT dwImmersiveColorType, bool bIgnoreHighContrast, UINT dwHighContrastCacheMode);
|
||||||
typedef int(WINAPI *GetImmersiveColorTypeFromNamePtr)(const WCHAR *name);
|
typedef int(WINAPI *GetImmersiveColorTypeFromNamePtr)(const WCHAR *name);
|
||||||
|
@ -288,7 +287,6 @@ class DisplayServerWindows : public DisplayServer {
|
||||||
// UXTheme API
|
// UXTheme API
|
||||||
static bool dark_title_available;
|
static bool dark_title_available;
|
||||||
static bool ux_theme_available;
|
static bool ux_theme_available;
|
||||||
static IsDarkModeAllowedForAppPtr IsDarkModeAllowedForApp;
|
|
||||||
static ShouldAppsUseDarkModePtr ShouldAppsUseDarkMode;
|
static ShouldAppsUseDarkModePtr ShouldAppsUseDarkMode;
|
||||||
static GetImmersiveColorFromColorSetExPtr GetImmersiveColorFromColorSetEx;
|
static GetImmersiveColorFromColorSetExPtr GetImmersiveColorFromColorSetEx;
|
||||||
static GetImmersiveColorTypeFromNamePtr GetImmersiveColorTypeFromName;
|
static GetImmersiveColorTypeFromNamePtr GetImmersiveColorTypeFromName;
|
||||||
|
|
Loading…
Reference in a new issue