X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8014db4142fbb9a9d802f5e0295ea99234eb69d0..90d0ab3443af62c1055cb7151be753aca89a20ee:/src/mgl/window.cpp diff --git a/src/mgl/window.cpp b/src/mgl/window.cpp index f7423ea103..36baf4f2cb 100644 --- a/src/mgl/window.cpp +++ b/src/mgl/window.cpp @@ -569,12 +569,17 @@ wxWindowMGL::~wxWindowMGL() if (gs_activeFrame == this) { - gs_activeFrame = NULL; - // activate next frame in Z-order: - if ( m_wnd->prev ) - { - wxWindowMGL *win = (wxWindowMGL*)m_wnd->prev->userData; - win->SetFocus(); + gs_activeFrame = NULL; + // activate next frame in Z-order: + if ( m_wnd->prev ) + { + wxWindowMGL *win = (wxWindowMGL*)m_wnd->prev->userData; + win->SetFocus(); + } + else if ( m_wnd->next ) + { + wxWindowMGL *win = (wxWindowMGL*)m_wnd->next->userData; + win->SetFocus(); } } @@ -760,11 +765,20 @@ bool wxWindowMGL::Show(bool show) if (!show && gs_activeFrame == this) { - // activate next frame in Z-order: - if ( m_wnd->prev ) - { - wxWindowMGL *win = (wxWindowMGL*)m_wnd->prev->userData; - win->SetFocus(); + // activate next frame in Z-order: + if ( m_wnd->prev ) + { + wxWindowMGL *win = (wxWindowMGL*)m_wnd->prev->userData; + win->SetFocus(); + } + else if ( m_wnd->next ) + { + wxWindowMGL *win = (wxWindowMGL*)m_wnd->next->userData; + win->SetFocus(); + } + else + { + gs_activeFrame = NULL; } }