Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(windows): fix appcrash on windows where darkmode is not supported #1022

Merged
merged 3 commits into from
Dec 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/platform_impl/windows/dark_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,14 @@ pub fn allow_dark_mode_for_app(is_dark_mode: bool) {
});

if let Some(ver) = *WIN10_BUILD_VERSION {
// in case Windows 10 Build version < 18362, we have to call a special command (_allow_dark_mode_for_app)
if ver < 18362 {
if let Some(_allow_dark_mode_for_app) = *ALLOW_DARK_MODE_FOR_APP {
unsafe { _allow_dark_mode_for_app(is_dark_mode) };
}
// but only call that command if the dark mode is supported...
if *DARK_MODE_SUPPORTED {
FabianLars marked this conversation as resolved.
Show resolved Hide resolved
if let Some(_allow_dark_mode_for_app) = *ALLOW_DARK_MODE_FOR_APP {
unsafe { _allow_dark_mode_for_app(is_dark_mode) };
}
}
} else if let Some(_set_preferred_app_mode) = *SET_PREFERRED_APP_MODE {
let mode = if is_dark_mode {
PreferredAppMode::AllowDark
Expand Down