Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure that the "top" coordinate of the inner frame is correct #20053

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion shell/browser/native_window_views_win.cc
Expand Up @@ -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;
Expand Down