1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 13:21:38 +03:00

win32: fixup initial window pos after screens changes

Ensure that we correctly use CW_USEDEFAULT for the case where
`--position` was not used.
This commit is contained in:
Wez Furlong 2022-07-06 13:43:46 -07:00
parent 2b3e5119a4
commit 87b963981e

View File

@ -377,8 +377,11 @@ impl Window {
let (width, height) = let (width, height) =
adjust_client_to_window_dimensions(style, geometry.width, geometry.height); adjust_client_to_window_dimensions(style, geometry.width, geometry.height);
let (x, y) = if (style & WS_POPUP) == 0 { let (x, y) = match (geometry.x, geometry.y) {
(geometry.x, geometry.y) (Some(x), Some(y)) => (x, y),
_ => {
if (style & WS_POPUP) == 0 {
(CW_USEDEFAULT, CW_USEDEFAULT)
} else { } else {
// WS_POPUP windows need to specify the initial position. // WS_POPUP windows need to specify the initial position.
// We pick the middle of the primary monitor // We pick the middle of the primary monitor
@ -399,6 +402,8 @@ impl Window {
mi.rcMonitor.top + (mon_height - height) / 2, mi.rcMonitor.top + (mon_height - height) / 2,
) )
} }
}
}
}; };
let name = wide_string(name); let name = wide_string(name);