Fix signature of dark-mode related uxtheme.dll functions
They were wrongly declared as taking (which is not very important) and returning (which was very bad as it resulted to interpreting the return values incorrectly in optimized builds) Win32 4-byte BOOL instead of the C++ 1-byte bool that they actually use. Closes #23169. See #23186.
This commit is contained in:
parent
12e65399e4
commit
93c6551364
1 changed files with 6 additions and 4 deletions
|
|
@ -92,8 +92,10 @@ namespace wxMSWImpl
|
||||||
|
|
||||||
// Global pointers of the functions we use: they're not only undocumented, but
|
// Global pointers of the functions we use: they're not only undocumented, but
|
||||||
// don't appear in the SDK headers at all.
|
// don't appear in the SDK headers at all.
|
||||||
BOOL (WINAPI *ShouldAppsUseDarkMode)() = nullptr;
|
//
|
||||||
BOOL (WINAPI *AllowDarkModeForWindow)(HWND hwnd, BOOL allow) = nullptr;
|
// Note that, not being public, they use C++ bool type and not Win32 BOOL.
|
||||||
|
bool (WINAPI *ShouldAppsUseDarkMode)() = nullptr;
|
||||||
|
bool (WINAPI *AllowDarkModeForWindow)(HWND hwnd, bool allow) = nullptr;
|
||||||
DWORD (WINAPI *SetPreferredAppMode)(DWORD) = nullptr;
|
DWORD (WINAPI *SetPreferredAppMode)(DWORD) = nullptr;
|
||||||
|
|
||||||
bool InitDarkMode()
|
bool InitDarkMode()
|
||||||
|
|
@ -250,7 +252,7 @@ void EnableForTLW(HWND hwnd)
|
||||||
if ( FAILED(hr) )
|
if ( FAILED(hr) )
|
||||||
wxLogApiError("DwmSetWindowAttribute(USE_IMMERSIVE_DARK_MODE)", hr);
|
wxLogApiError("DwmSetWindowAttribute(USE_IMMERSIVE_DARK_MODE)", hr);
|
||||||
|
|
||||||
wxMSWImpl::AllowDarkModeForWindow(hwnd, TRUE);
|
wxMSWImpl::AllowDarkModeForWindow(hwnd, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AllowForWindow(HWND hwnd, const wchar_t* themeName, const wchar_t* themeId)
|
void AllowForWindow(HWND hwnd, const wchar_t* themeName, const wchar_t* themeId)
|
||||||
|
|
@ -258,7 +260,7 @@ void AllowForWindow(HWND hwnd, const wchar_t* themeName, const wchar_t* themeId)
|
||||||
if ( !wxMSWImpl::ShouldUseDarkMode() )
|
if ( !wxMSWImpl::ShouldUseDarkMode() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( wxMSWImpl::AllowDarkModeForWindow(hwnd, TRUE) )
|
if ( wxMSWImpl::AllowDarkModeForWindow(hwnd, true) )
|
||||||
wxLogTrace(TRACE_DARKMODE, "Allow dark mode for %p failed", hwnd);
|
wxLogTrace(TRACE_DARKMODE, "Allow dark mode for %p failed", hwnd);
|
||||||
|
|
||||||
if ( themeName || themeId )
|
if ( themeName || themeId )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue