fix: ensure that the "top" coordinate of the inner frame is correct (#20051)

On multi-monitor setups where the monitors are not all origined at 0 on
the Y coordinate (E.g. vertical stacked monitors) the maximize
calculation was incorrect as it assumed top was "0".  This instead
adjusts the math to calculate the correct top value.
This commit is contained in:
Samuel Attard 2019-08-30 15:45:59 -07:00 committed by GitHub
parent e37ad09330
commit c621a36320
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -389,8 +389,21 @@ bool NativeWindowViews::PreHandleMSG(UINT message,
// https://blogs.msdn.microsoft.com/wpfsdk/2008/09/08/custom-window-chrome-in-wpf/
DefWindowProcW(GetAcceleratedWidget(), WM_NCCALCSIZE, w_param, l_param);
// When fullscreen the window has no border
int border = 0;
if (!IsFullscreen()) {
// When not fullscreen calculate the border size
border = GetSystemMetrics(SM_CXFRAME) +
GetSystemMetrics(SM_CXPADDEDBORDER);
if (!thick_frame_) {
border -= GetSystemMetrics(SM_CXBORDER);
}
}
if (last_window_state_ == ui::SHOW_STATE_MAXIMIZED) {
params->rgrc[0].top = 0;
// Position the top of the frame offset from where windows thinks by
// exactly the border amount. When fullscreen this is 0.
params->rgrc[0].top = PROPOSED.top + border;
} else {
params->rgrc[0] = PROPOSED;
params->rgrc[1] = BEFORE;