mirror of
https://github.com/tauri-apps/tao.git
synced 2026-01-31 00:35:16 +01:00
fix(windows): Multi-monitor different scaling window size issue (#858)
* Fix the issue where the window size is abnormal when dragging between monitors with different scaling settings with the "Show window contents while dragging" option turned off in Windows. * clean code * fix code fmt; * Optimize code * delete not used mut keyword * add change file
This commit is contained in:
5
.changes/windows-drag-window-size-change.md
Normal file
5
.changes/windows-drag-window-size-change.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tao": "patch"
|
||||
---
|
||||
|
||||
On Windows, fix when the `Show window contents while dragging` setting is turned off in Windows, there is a window size issue when dragging between multi-monitors with different scaling.
|
||||
@@ -1919,6 +1919,11 @@ unsafe fn public_window_callback_inner<T: 'static>(
|
||||
false => old_physical_inner_size,
|
||||
};
|
||||
|
||||
// When the "Show window contents while dragging" is turned off, there is no need to adjust the window size.
|
||||
if !is_show_window_contents_while_dragging_enabled() {
|
||||
new_physical_inner_size = old_physical_inner_size;
|
||||
}
|
||||
|
||||
subclass_input.send_event(Event::WindowEvent {
|
||||
window_id: RootWindowId(WindowId(window.0)),
|
||||
event: ScaleFactorChanged {
|
||||
@@ -2191,6 +2196,19 @@ unsafe fn public_window_callback_inner<T: 'static>(
|
||||
}
|
||||
}
|
||||
|
||||
fn is_show_window_contents_while_dragging_enabled() -> bool {
|
||||
let mut is_enabled: BOOL = BOOL(0);
|
||||
let result = unsafe {
|
||||
SystemParametersInfoW(
|
||||
SPI_GETDRAGFULLWINDOWS,
|
||||
0,
|
||||
Option::from(&mut is_enabled as *mut _ as *mut std::ffi::c_void),
|
||||
SYSTEM_PARAMETERS_INFO_UPDATE_FLAGS(0),
|
||||
)
|
||||
};
|
||||
result.is_ok() && is_enabled.0 != 0
|
||||
}
|
||||
|
||||
unsafe extern "system" fn thread_event_target_callback<T: 'static>(
|
||||
window: HWND,
|
||||
msg: u32,
|
||||
|
||||
Reference in New Issue
Block a user