windows: Simplify the logic of handle_get_min_max_info_msg (#33102)

Release Notes:

- N/A
This commit is contained in:
张小白 2025-06-20 20:52:37 +08:00 committed by GitHub
parent a7bbbc0552
commit c02e249ecb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -148,22 +148,18 @@ fn handle_get_min_max_info_msg(
state_ptr: Rc<WindowsWindowStatePtr>,
) -> Option<isize> {
let lock = state_ptr.state.borrow();
if let Some(min_size) = lock.min_size {
let scale_factor = lock.scale_factor;
let boarder_offset = lock.border_offset;
drop(lock);
unsafe {
let minmax_info = &mut *(lparam.0 as *mut MINMAXINFO);
minmax_info.ptMinTrackSize.x =
min_size.width.scale(scale_factor).0 as i32 + boarder_offset.width_offset;
minmax_info.ptMinTrackSize.y =
min_size.height.scale(scale_factor).0 as i32 + boarder_offset.height_offset;
}
Some(0)
} else {
None
let min_size = lock.min_size?;
let scale_factor = lock.scale_factor;
let boarder_offset = lock.border_offset;
drop(lock);
unsafe {
let minmax_info = &mut *(lparam.0 as *mut MINMAXINFO);
minmax_info.ptMinTrackSize.x =
min_size.width.scale(scale_factor).0 as i32 + boarder_offset.width_offset;
minmax_info.ptMinTrackSize.y =
min_size.height.scale(scale_factor).0 as i32 + boarder_offset.height_offset;
}
Some(0)
}
fn handle_size_msg(