From: Václav Slavík Date: Tue, 9 Oct 2001 22:08:45 +0000 (+0000) Subject: fixes to focus handling in menus X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/61bd618fe776bac0d54ef51b14d706da394a2635?ds=sidebyside fixes to focus handling in menus git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11909 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mgl/toplevel.cpp b/src/mgl/toplevel.cpp index 1cf60d5e6f..595b1a828b 100644 --- a/src/mgl/toplevel.cpp +++ b/src/mgl/toplevel.cpp @@ -82,8 +82,6 @@ bool wxTopLevelWindowMGL::Create(wxWindow *parent, wxTopLevelWindows.Append(this); m_title = title; - - // FIXME_MGL -- should activate itself when shown! return TRUE; } @@ -139,8 +137,9 @@ bool wxTopLevelWindowMGL::ShowFullScreen(bool show, long style) bool wxTopLevelWindowMGL::Show(bool show) { bool ret = wxTopLevelWindowBase::Show(show); - if ( ret && show ) + if ( ret && show && AcceptsFocus() ) SetFocus(); + // FIXME_MGL -- don't do this for popup windows? return ret; } diff --git a/src/mgl/window.cpp b/src/mgl/window.cpp index a76020c4ec..09f69f1dd7 100644 --- a/src/mgl/window.cpp +++ b/src/mgl/window.cpp @@ -117,6 +117,7 @@ bool wxCreateMGL_WM() #if wxUSE_SYSTEM_OPTIONS // FIXME_MGL -- so what is The Proper Way? + width=800, height=600; if ( wxSystemOptions::HasOption(wxT("mgl.screen-width") ) width = wxSystemOptions::GetOptionInt(wxT("mgl.screen-width")); if ( wxSystemOptions::HasOption(wxT("mgl.screen-height") ) @@ -180,6 +181,7 @@ static wxWindowMGL* wxGetTopLevelParent(wxWindowMGL *win) static void wxWindowPainter(window_t *wnd, MGLDC *dc) { wxWindowMGL *w = (wxWindow*) wnd->userData; + if ( w && !(w->GetWindowStyle() & wxTRANSPARENT_WINDOW) ) { MGLDevCtx ctx(dc); @@ -639,7 +641,7 @@ void wxWindowMGL::SetFocus() #endif // wxUSE_CARET wxWindowMGL *active = wxGetTopLevelParent(this); - if ( active != gs_activeFrame ) + if ( !(m_windowStyle & wxPOPUP_WINDOW) && active != gs_activeFrame ) { if ( gs_activeFrame ) { @@ -656,7 +658,7 @@ void wxWindowMGL::SetFocus() wxFocusEvent event(wxEVT_SET_FOCUS, GetId()); event.SetEventObject(this); - GetEventHandler()->ProcessEvent(event); + AddPendingEvent(event); } void wxWindowMGL::KillFocus() @@ -675,17 +677,9 @@ void wxWindowMGL::KillFocus() caret->OnKillFocus(); #endif // wxUSE_CARET - if ( IsTopLevel() ) - { - // FIXME_MGL - this is wrong, see wxGTK! - wxActivateEvent event(wxEVT_ACTIVATE, FALSE, GetId()); - event.SetEventObject(this); - GetEventHandler()->ProcessEvent(event); - } - wxFocusEvent event(wxEVT_KILL_FOCUS, GetId()); event.SetEventObject(this); - GetEventHandler()->ProcessEvent(event); + AddPendingEvent(event); } // ---------------------------------------------------------------------------- @@ -1055,6 +1049,7 @@ void wxWindowMGL::Clear() dc.Clear(); } +#include "wx/menu.h" void wxWindowMGL::Refresh(bool eraseBack, const wxRect *rect) { if ( m_eraseBackground == -1 )