This commit is contained in:
Piotr Osiewicz 2025-08-18 19:45:48 +02:00
parent b4ef6ec60b
commit bf577383a5
2 changed files with 44 additions and 47 deletions

View file

@ -701,8 +701,8 @@ impl WindowsWindowInner {
// Fix auto hide taskbar not showing. This solution is based on the approach
// used by Chrome. However, it may result in one row of pixels being obscured
// in our client area. But as Chrome says, "there seems to be no better solution."
if is_maximized {
if let Some(ref taskbar_position) = self
if is_maximized
&& let Some(ref taskbar_position) = self
.state
.borrow()
.system_settings
@ -726,7 +726,6 @@ impl WindowsWindowInner {
}
}
}
}
Some(0)
}
@ -1125,15 +1124,14 @@ impl WindowsWindowInner {
// lParam is a pointer to a string that indicates the area containing the system parameter
// that was changed.
let parameter = PCWSTR::from_raw(lparam.0 as _);
if unsafe { !parameter.is_null() && !parameter.is_empty() } {
if let Some(parameter_string) = unsafe { parameter.to_string() }.log_err() {
if unsafe { !parameter.is_null() && !parameter.is_empty() }
&& let Some(parameter_string) = unsafe { parameter.to_string() }.log_err()
{
log::info!("System settings changed: {}", parameter_string);
match parameter_string.as_str() {
"ImmersiveColorSet" => {
let new_appearance = system_appearance()
.context(
"unable to get system appearance when handling ImmersiveColorSet",
)
.context("unable to get system appearance when handling ImmersiveColorSet")
.log_err()?;
let mut lock = self.state.borrow_mut();
if new_appearance != lock.appearance {
@ -1148,7 +1146,6 @@ impl WindowsWindowInner {
_ => {}
}
}
}
Some(0)
}

View file

@ -821,15 +821,15 @@ fn file_save_dialog(
window: Option<HWND>,
) -> Result<Option<PathBuf>> {
let dialog: IFileSaveDialog = unsafe { CoCreateInstance(&FileSaveDialog, None, CLSCTX_ALL)? };
if !directory.to_string_lossy().is_empty() {
if let Some(full_path) = directory.canonicalize().log_err() {
if !directory.to_string_lossy().is_empty()
&& let Some(full_path) = directory.canonicalize().log_err()
{
let full_path = SanitizedPath::from(full_path);
let full_path_string = full_path.to_string();
let path_item: IShellItem =
unsafe { SHCreateItemFromParsingName(&HSTRING::from(full_path_string), None)? };
unsafe { dialog.SetFolder(&path_item).log_err() };
}
}
if let Some(suggested_name) = suggested_name {
unsafe { dialog.SetFileName(&HSTRING::from(suggested_name)).log_err() };