Skip to content

Commit

Permalink
Fixed saving position when some panel is outside the screen area #1271 (
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg68 authored Jan 23, 2023
1 parent 378a56d commit cb14a0a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- Fixed saving position when some panel is outside the screen area https://github.com/GrandOrgue/grandorgue/issues/1271
- Fixed playing release samples for very short notes https://github.com/GrandOrgue/grandorgue/issues/1222
- Fixed help: the wrong panal positioning on wayland was documented https://github.com/GrandOrgue/grandorgue/issues/1271
- Fixed help: the wrong panel positioning on wayland was documented https://github.com/GrandOrgue/grandorgue/issues/1271
- Fixed typos and spelling errors in the Help
- Fixed continuing loading an organ after an exception in one loading thread
- Fixed size of text fields in the Organ Settings dialog on OsX https://github.com/GrandOrgue/grandorgue/issues/1315
Expand Down
28 changes: 16 additions & 12 deletions src/grandorgue/GOPanelView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,22 @@ GOPanelView::GOPanelView(
int nr = savedDisplayNum >= 0 && savedDisplayNum < (int)wxDisplay::GetCount()
? savedDisplayNum
: wxDisplay::GetFromWindow(frame);
wxDisplay display(nr != wxNOT_FOUND ? nr : 0);
wxRect max = display.GetClientArea();
// If our current window is within this area, all is fine
wxRect current = frame->GetRect();
if (!max.Contains(current)) {
// Otherwise, check and correct width and height,
// and place the frame at the center of the Client Area of the display
if (current.GetWidth() > max.GetWidth())
current.SetWidth(max.GetWidth());
if (current.GetHeight() > max.GetHeight())
current.SetHeight(max.GetHeight());
frame->SetSize(current.CenterIn(max, wxBOTH));

// Check if the window is visible. If not, center it at the first display
if (nr == wxNOT_FOUND) {
wxRect max = wxDisplay((unsigned)0).GetClientArea();
// If our current window is within this area, all is fine
wxRect current = frame->GetRect();

if (!max.Contains(current)) {
// Otherwise, check and correct width and height,
// and place the frame at the center of the Client Area of the display
if (current.GetWidth() > max.GetWidth())
current.SetWidth(max.GetWidth());
if (current.GetHeight() > max.GetHeight())
current.SetHeight(max.GetHeight());
frame->SetSize(current.CenterIn(max, wxBOTH));
}
}
if (m_TopWindow && panel->IsMaximized())
m_TopWindow->Maximize(true);
Expand Down

0 comments on commit cb14a0a

Please sign in to comment.