complete repair of minimization and root menu bar

svn: r418
This commit is contained in:
Matthew Flatt 2005-07-21 16:42:16 +00:00
parent 7c44f1efca
commit 9c2e63fa4c
2 changed files with 33 additions and 15 deletions

View File

@ -44,6 +44,8 @@ extern Bool doCallPreMouseEvent(wxWindow *in_win, wxWindow *win, wxMouseEvent *e
extern WindowPtr MrEdMouseWindow(Point where);
extern WindowPtr MrEdKeyWindow();
extern void wxCheckRootFrame(Bool frame_present);
int wxMenuBarHeight;
extern wxApp *wxTheApp;
@ -180,6 +182,11 @@ void wxApp::doMacPreEvent()
WindowPtr w;
w = FrontNonFloatingWindow();
wxCheckRootFrame(!!w);
if (!w) {
/* Maybe we just showed the root frame: */
w = FrontNonFloatingWindow();
}
wxCheckFinishedSounds();

View File

@ -460,7 +460,7 @@ void wxFrame::DesignateRootFrame(void)
wxRootFrame = this;
Show(TRUE);
if (!FrontWindow()) {
if (!FrontNonFloatingWindow()) {
::ShowWindow(win);
}
}
@ -1005,6 +1005,29 @@ void wxFrame::SetTitle(char* title)
}
}
void wxCheckRootFrame(Bool frame_present)
{
if (frame_present) {
/* Hide root frame, if any, in case it's shown */
if (wxRootFrame) {
wxMacDC *dc;
WindowPtr theMacWindow;
dc = wxRootFrame->MacDC();
theMacWindow = GetWindowFromPort(dc->macGrafPort());
::HideWindow(theMacWindow);
}
} else {
/* If all frames are closed/minimized, it's time for the root window (if any) */
if (wxRootFrame && !FrontNonFloatingWindow()) {
wxMacDC *dc;
WindowPtr theMacWindow;
dc = wxRootFrame->MacDC();
theMacWindow = GetWindowFromPort(dc->macGrafPort());
::ShowWindow(theMacWindow);
}
}
}
//-----------------------------------------------------------------------------
void wxFrame::Show(Bool show)
{
@ -1101,13 +1124,7 @@ void wxFrame::Show(Bool show)
/* b/c may be optimized for hidden: */
cMacDC->setCurrentUser(NULL);
/* Hide root frame, if any, in case it's shown */
if (wxRootFrame) {
wxMacDC *dc;
dc = wxRootFrame->MacDC();
theMacWindow = GetWindowFromPort(dc->macGrafPort());
::HideWindow(theMacWindow);
}
wxCheckRootFrame(TRUE);
} else {
if (cFocusWindow) {
ReleaseFocus();
@ -1132,13 +1149,7 @@ void wxFrame::Show(Bool show)
::HideWindow(theMacWindow);
}
/* If all frames are closed, it's time for the root window (if any) */
if (wxRootFrame && !FrontWindow()) {
wxMacDC *dc;
dc = wxRootFrame->MacDC();
theMacWindow = GetWindowFromPort(dc->macGrafPort());
::ShowWindow(theMacWindow);
}
wxCheckRootFrame(FALSE);
}
}