Skip to content
Permalink
Browse files
Fix for project windows opening larger than available display space o…
…n OSX

This should fix the nagging window under the menu bar problem and will
have to serve as a workaround for bug #1119 until the wxWidgets ticket
is addressed:

   http://trac.wxwidgets.org/ticket/14351
  • Loading branch information
lllucius committed Sep 12, 2015
1 parent 63663bc commit 1ccb7385c32eada98a2d895dc3c3589f2f476e84
Showing with 30 additions and 5 deletions.
  1. +30 −5 src/Project.cpp
@@ -555,21 +555,32 @@ void GetDefaultWindowRect(wxRect *defRect)
{
*defRect = wxGetClientDisplayRect();

defRect->width = 940;
defRect->height = 674;
int width = 940;
int height = 674;

//These conditional values assist in improving placement and size
//of new windows on different platforms.
#ifdef __WXGTK__
defRect->height += 20;
height += 20;
#endif

#ifdef __WXMSW__
defRect->height += 40;
height += 40;
#endif

#ifdef __WXMAC__
defRect->height += 55;
height += 55;
#endif

if (width < defRect->width)
{
defRect->width = width;
}

if (height < defRect->height)
{
defRect->height = height;
}
}

bool IsWindowAccessible(wxRect *requestedRect)
@@ -639,6 +650,20 @@ void GetNextWindowPlacement(wxRect *nextRect, bool *pMaximized, bool *pIconized)
}
#endif

// Make sure initial sizes fit within the display bounds
if (normalRect.GetRight() > defaultRect.GetRight()) {
normalRect.SetRight(defaultRect.GetRight());
}
if (normalRect.GetBottom() > defaultRect.GetBottom()) {
normalRect.SetBottom(defaultRect.GetBottom());
}
if (windowRect.GetRight() > defaultRect.GetRight()) {
windowRect.SetRight(defaultRect.GetRight());
}
if (windowRect.GetBottom() > defaultRect.GetBottom()) {
windowRect.SetBottom(defaultRect.GetBottom());
}

if (gAudacityProjects.IsEmpty()) {
if (*pMaximized || *pIconized) {
*nextRect = normalRect;

0 comments on commit 1ccb738

Please sign in to comment.