mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
FIX: [STUDIO-2702] fix maximize size offset, ad7bda2
Change-Id: I4f65ef25dc4241bf7c1c3d15c38198ea2b40b337
This commit is contained in:
parent
9352f34ad0
commit
c770926142
2 changed files with 21 additions and 14 deletions
|
@ -505,7 +505,13 @@ void BBLTopbar::OnFullScreen(wxAuiToolBarEvent& event)
|
||||||
else {
|
else {
|
||||||
wxDisplay display(this);
|
wxDisplay display(this);
|
||||||
auto size = display.GetClientArea().GetSize();
|
auto size = display.GetClientArea().GetSize();
|
||||||
m_frame->SetMaxSize(size + wxSize{16, 16});
|
#ifdef __WXMSW__
|
||||||
|
HWND hWnd = m_frame->GetHandle();
|
||||||
|
RECT borderThickness;
|
||||||
|
SetRectEmpty(&borderThickness);
|
||||||
|
AdjustWindowRectEx(&borderThickness, GetWindowLongPtr(hWnd, GWL_STYLE), FALSE, 0);
|
||||||
|
m_frame->SetMaxSize(size + wxSize{-borderThickness.left + borderThickness.right, -borderThickness.top + borderThickness.bottom});
|
||||||
|
#endif // __WXMSW__
|
||||||
m_normalRect = m_frame->GetRect();
|
m_normalRect = m_frame->GetRect();
|
||||||
m_frame->Maximize();
|
m_frame->Maximize();
|
||||||
}
|
}
|
||||||
|
@ -530,16 +536,8 @@ void BBLTopbar::OnMouseLeftDClock(wxMouseEvent& mouse)
|
||||||
return;
|
return;
|
||||||
#endif // __WXMSW__
|
#endif // __WXMSW__
|
||||||
|
|
||||||
if (m_frame->IsMaximized()) {
|
wxAuiToolBarEvent evt;
|
||||||
m_frame->Restore();
|
OnFullScreen(evt);
|
||||||
}
|
|
||||||
else {
|
|
||||||
wxDisplay display(this);
|
|
||||||
auto size = display.GetClientArea().GetSize();
|
|
||||||
m_frame->SetMaxSize(size + wxSize{16, 16});
|
|
||||||
m_normalRect = m_frame->GetRect();
|
|
||||||
m_frame->Maximize();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BBLTopbar::OnFileToolItem(wxAuiToolBarEvent& evt)
|
void BBLTopbar::OnFileToolItem(wxAuiToolBarEvent& evt)
|
||||||
|
|
|
@ -384,18 +384,27 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_
|
||||||
auto setMaxSize = [this]() {
|
auto setMaxSize = [this]() {
|
||||||
wxDisplay display(this);
|
wxDisplay display(this);
|
||||||
auto size = display.GetClientArea().GetSize();
|
auto size = display.GetClientArea().GetSize();
|
||||||
// 8 pixels shadow
|
HWND hWnd = GetHandle();
|
||||||
SetMaxSize(size + wxSize{16, 16});
|
RECT borderThickness;
|
||||||
|
SetRectEmpty(&borderThickness);
|
||||||
|
AdjustWindowRectEx(&borderThickness, GetWindowLongPtr(hWnd, GWL_STYLE), FALSE, 0);
|
||||||
|
SetMaxSize(size + wxSize{-borderThickness.left + borderThickness.right, -borderThickness.top + borderThickness.bottom});
|
||||||
};
|
};
|
||||||
this->Bind(wxEVT_DPI_CHANGED, [setMaxSize](auto & e) {
|
this->Bind(wxEVT_DPI_CHANGED, [setMaxSize](auto & e) {
|
||||||
setMaxSize();
|
setMaxSize();
|
||||||
e.Skip();
|
e.Skip();
|
||||||
});
|
});
|
||||||
setMaxSize();
|
setMaxSize();
|
||||||
|
// 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) {
|
this->Bind(wxEVT_MAXIMIZE, [this](auto &e) {
|
||||||
wxDisplay display(this);
|
wxDisplay display(this);
|
||||||
auto pos = display.GetClientArea().GetPosition();
|
auto pos = display.GetClientArea().GetPosition();
|
||||||
Move(pos - wxPoint{8, 8});
|
HWND hWnd = GetHandle();
|
||||||
|
RECT borderThickness;
|
||||||
|
SetRectEmpty(&borderThickness);
|
||||||
|
AdjustWindowRectEx(&borderThickness, GetWindowLongPtr(hWnd, GWL_STYLE), FALSE, 0);
|
||||||
|
Move(pos + wxPoint{borderThickness.left, borderThickness.top});
|
||||||
e.Skip();
|
e.Skip();
|
||||||
});
|
});
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue