windows
This commit is contained in:
parent
b4ef6ec60b
commit
bf577383a5
2 changed files with 44 additions and 47 deletions
|
@ -701,29 +701,28 @@ impl WindowsWindowInner {
|
||||||
// Fix auto hide taskbar not showing. This solution is based on the approach
|
// 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
|
// 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."
|
// in our client area. But as Chrome says, "there seems to be no better solution."
|
||||||
if is_maximized {
|
if is_maximized
|
||||||
if let Some(ref taskbar_position) = self
|
&& let Some(ref taskbar_position) = self
|
||||||
.state
|
.state
|
||||||
.borrow()
|
.borrow()
|
||||||
.system_settings
|
.system_settings
|
||||||
.auto_hide_taskbar_position
|
.auto_hide_taskbar_position
|
||||||
{
|
{
|
||||||
// Fot the auto-hide taskbar, adjust in by 1 pixel on taskbar edge,
|
// Fot the auto-hide taskbar, adjust in by 1 pixel on taskbar edge,
|
||||||
// so the window isn't treated as a "fullscreen app", which would cause
|
// so the window isn't treated as a "fullscreen app", which would cause
|
||||||
// the taskbar to disappear.
|
// the taskbar to disappear.
|
||||||
match taskbar_position {
|
match taskbar_position {
|
||||||
AutoHideTaskbarPosition::Left => {
|
AutoHideTaskbarPosition::Left => {
|
||||||
requested_client_rect[0].left += AUTO_HIDE_TASKBAR_THICKNESS_PX
|
requested_client_rect[0].left += AUTO_HIDE_TASKBAR_THICKNESS_PX
|
||||||
}
|
}
|
||||||
AutoHideTaskbarPosition::Top => {
|
AutoHideTaskbarPosition::Top => {
|
||||||
requested_client_rect[0].top += AUTO_HIDE_TASKBAR_THICKNESS_PX
|
requested_client_rect[0].top += AUTO_HIDE_TASKBAR_THICKNESS_PX
|
||||||
}
|
}
|
||||||
AutoHideTaskbarPosition::Right => {
|
AutoHideTaskbarPosition::Right => {
|
||||||
requested_client_rect[0].right -= AUTO_HIDE_TASKBAR_THICKNESS_PX
|
requested_client_rect[0].right -= AUTO_HIDE_TASKBAR_THICKNESS_PX
|
||||||
}
|
}
|
||||||
AutoHideTaskbarPosition::Bottom => {
|
AutoHideTaskbarPosition::Bottom => {
|
||||||
requested_client_rect[0].bottom -= AUTO_HIDE_TASKBAR_THICKNESS_PX
|
requested_client_rect[0].bottom -= AUTO_HIDE_TASKBAR_THICKNESS_PX
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1125,28 +1124,26 @@ impl WindowsWindowInner {
|
||||||
// lParam is a pointer to a string that indicates the area containing the system parameter
|
// lParam is a pointer to a string that indicates the area containing the system parameter
|
||||||
// that was changed.
|
// that was changed.
|
||||||
let parameter = PCWSTR::from_raw(lparam.0 as _);
|
let parameter = PCWSTR::from_raw(lparam.0 as _);
|
||||||
if unsafe { !parameter.is_null() && !parameter.is_empty() } {
|
if unsafe { !parameter.is_null() && !parameter.is_empty() }
|
||||||
if let Some(parameter_string) = unsafe { parameter.to_string() }.log_err() {
|
&& let Some(parameter_string) = unsafe { parameter.to_string() }.log_err()
|
||||||
log::info!("System settings changed: {}", parameter_string);
|
{
|
||||||
match parameter_string.as_str() {
|
log::info!("System settings changed: {}", parameter_string);
|
||||||
"ImmersiveColorSet" => {
|
match parameter_string.as_str() {
|
||||||
let new_appearance = system_appearance()
|
"ImmersiveColorSet" => {
|
||||||
.context(
|
let new_appearance = system_appearance()
|
||||||
"unable to get system appearance when handling ImmersiveColorSet",
|
.context("unable to get system appearance when handling ImmersiveColorSet")
|
||||||
)
|
.log_err()?;
|
||||||
.log_err()?;
|
let mut lock = self.state.borrow_mut();
|
||||||
let mut lock = self.state.borrow_mut();
|
if new_appearance != lock.appearance {
|
||||||
if new_appearance != lock.appearance {
|
lock.appearance = new_appearance;
|
||||||
lock.appearance = new_appearance;
|
let mut callback = lock.callbacks.appearance_changed.take()?;
|
||||||
let mut callback = lock.callbacks.appearance_changed.take()?;
|
drop(lock);
|
||||||
drop(lock);
|
callback();
|
||||||
callback();
|
self.state.borrow_mut().callbacks.appearance_changed = Some(callback);
|
||||||
self.state.borrow_mut().callbacks.appearance_changed = Some(callback);
|
configure_dwm_dark_mode(handle, new_appearance);
|
||||||
configure_dwm_dark_mode(handle, new_appearance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(0)
|
Some(0)
|
||||||
|
|
|
@ -821,14 +821,14 @@ fn file_save_dialog(
|
||||||
window: Option<HWND>,
|
window: Option<HWND>,
|
||||||
) -> Result<Option<PathBuf>> {
|
) -> Result<Option<PathBuf>> {
|
||||||
let dialog: IFileSaveDialog = unsafe { CoCreateInstance(&FileSaveDialog, None, CLSCTX_ALL)? };
|
let dialog: IFileSaveDialog = unsafe { CoCreateInstance(&FileSaveDialog, None, CLSCTX_ALL)? };
|
||||||
if !directory.to_string_lossy().is_empty() {
|
if !directory.to_string_lossy().is_empty()
|
||||||
if let Some(full_path) = directory.canonicalize().log_err() {
|
&& let Some(full_path) = directory.canonicalize().log_err()
|
||||||
let full_path = SanitizedPath::from(full_path);
|
{
|
||||||
let full_path_string = full_path.to_string();
|
let full_path = SanitizedPath::from(full_path);
|
||||||
let path_item: IShellItem =
|
let full_path_string = full_path.to_string();
|
||||||
unsafe { SHCreateItemFromParsingName(&HSTRING::from(full_path_string), None)? };
|
let path_item: IShellItem =
|
||||||
unsafe { dialog.SetFolder(&path_item).log_err() };
|
unsafe { SHCreateItemFromParsingName(&HSTRING::from(full_path_string), None)? };
|
||||||
}
|
unsafe { dialog.SetFolder(&path_item).log_err() };
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(suggested_name) = suggested_name {
|
if let Some(suggested_name) = suggested_name {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue