1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 08:09:32 +02:00

Fix for project windows opening larger than available display space on 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
This commit is contained in:
Leland Lucius 2015-09-12 01:34:27 -05:00
parent 63663bcd13
commit 1ccb7385c3

View File

@ -555,21 +555,32 @@ void GetDefaultWindowRect(wxRect *defRect)
{ {
*defRect = wxGetClientDisplayRect(); *defRect = wxGetClientDisplayRect();
defRect->width = 940; int width = 940;
defRect->height = 674; int height = 674;
//These conditional values assist in improving placement and size //These conditional values assist in improving placement and size
//of new windows on different platforms. //of new windows on different platforms.
#ifdef __WXGTK__ #ifdef __WXGTK__
defRect->height += 20; height += 20;
#endif #endif
#ifdef __WXMSW__ #ifdef __WXMSW__
defRect->height += 40; height += 40;
#endif #endif
#ifdef __WXMAC__ #ifdef __WXMAC__
defRect->height += 55; height += 55;
#endif #endif
if (width < defRect->width)
{
defRect->width = width;
}
if (height < defRect->height)
{
defRect->height = height;
}
} }
bool IsWindowAccessible(wxRect *requestedRect) bool IsWindowAccessible(wxRect *requestedRect)
@ -639,6 +650,20 @@ void GetNextWindowPlacement(wxRect *nextRect, bool *pMaximized, bool *pIconized)
} }
#endif #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 (gAudacityProjects.IsEmpty()) {
if (*pMaximized || *pIconized) { if (*pMaximized || *pIconized) {
*nextRect = normalRect; *nextRect = normalRect;