Fix window maximize when task bar is on the left. (#3148)

Partially revert fe80dc6
This commit is contained in:
Noisyfox 2023-12-17 02:31:10 +11:00 committed by GitHub
parent 183f8fb012
commit 0f87fdb98b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -395,6 +395,20 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_
update_layout(); update_layout();
sizer->SetSizeHints(this); sizer->SetSizeHints(this);
#ifdef WIN32
// SetMaximize already position window at left/top corner, even if Windows Task Bar is at left side.
// Not known why, but fix it here
this->Bind(wxEVT_MAXIMIZE, [this](auto &e) {
wxDisplay display(this);
auto pos = display.GetClientArea().GetPosition();
HWND hWnd = GetHandle();
RECT borderThickness;
SetRectEmpty(&borderThickness);
AdjustWindowRectEx(&borderThickness, GetWindowLongPtr(hWnd, GWL_STYLE), FALSE, 0);
Move(pos + wxPoint{borderThickness.left, borderThickness.top});
e.Skip();
});
#endif // WIN32
// BBS // BBS
Fit(); Fit();