]> git.saurik.com Git - wxWidgets.git/commitdiff
fixes to focus handling in menus
authorVáclav Slavík <vslavik@fastmail.fm>
Tue, 9 Oct 2001 22:08:45 +0000 (22:08 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Tue, 9 Oct 2001 22:08:45 +0000 (22:08 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11909 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mgl/toplevel.cpp
src/mgl/window.cpp

index 1cf60d5e6f7469f68c4e6171f459de0b0a280cc1..595b1a828b7eec4cfeb62b9d258b3dcb9f912a27 100644 (file)
@@ -82,8 +82,6 @@ bool wxTopLevelWindowMGL::Create(wxWindow *parent,
     wxTopLevelWindows.Append(this);
 
     m_title = title;
     wxTopLevelWindows.Append(this);
 
     m_title = title;
-    
-    // FIXME_MGL -- should activate itself when shown!
 
     return TRUE;
 }
 
     return TRUE;
 }
@@ -139,8 +137,9 @@ bool wxTopLevelWindowMGL::ShowFullScreen(bool show, long style)
 bool wxTopLevelWindowMGL::Show(bool show)
 {
     bool ret = wxTopLevelWindowBase::Show(show);
 bool wxTopLevelWindowMGL::Show(bool show)
 {
     bool ret = wxTopLevelWindowBase::Show(show);
-    if ( ret && show )
+    if ( ret && show && AcceptsFocus() )
         SetFocus();
         SetFocus();
+        // FIXME_MGL -- don't do this for popup windows?
     return ret;
 }
 
     return ret;
 }
 
index a76020c4ecbfc67f4392d0d5c1065e8ddad088d1..09f69f1dd7bc31b08d558be9f5e6be191887122a 100644 (file)
@@ -117,6 +117,7 @@ bool wxCreateMGL_WM()
     
 #if wxUSE_SYSTEM_OPTIONS
     // FIXME_MGL -- so what is The Proper Way?
     
 #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") )
     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;
 static void wxWindowPainter(window_t *wnd, MGLDC *dc)
 {
     wxWindowMGL *w = (wxWindow*) wnd->userData;
+    
     if ( w && !(w->GetWindowStyle() & wxTRANSPARENT_WINDOW) )
     {
         MGLDevCtx ctx(dc);
     if ( w && !(w->GetWindowStyle() & wxTRANSPARENT_WINDOW) )
     {
         MGLDevCtx ctx(dc);
@@ -639,7 +641,7 @@ void wxWindowMGL::SetFocus()
 #endif // wxUSE_CARET
 
     wxWindowMGL *active = wxGetTopLevelParent(this);
 #endif // wxUSE_CARET
 
     wxWindowMGL *active = wxGetTopLevelParent(this);
-    if ( active != gs_activeFrame )
+    if ( !(m_windowStyle & wxPOPUP_WINDOW) && active != gs_activeFrame )
     {
         if ( gs_activeFrame )
         {
     {
         if ( gs_activeFrame )
         {
@@ -656,7 +658,7 @@ void wxWindowMGL::SetFocus()
     
     wxFocusEvent event(wxEVT_SET_FOCUS, GetId());
     event.SetEventObject(this);
     
     wxFocusEvent event(wxEVT_SET_FOCUS, GetId());
     event.SetEventObject(this);
-    GetEventHandler()->ProcessEvent(event);
+    AddPendingEvent(event);
 }
 
 void wxWindowMGL::KillFocus()
 }
 
 void wxWindowMGL::KillFocus()
@@ -675,17 +677,9 @@ void wxWindowMGL::KillFocus()
         caret->OnKillFocus();
 #endif // wxUSE_CARET
 
         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);
     wxFocusEvent event(wxEVT_KILL_FOCUS, GetId());
     event.SetEventObject(this);
-    GetEventHandler()->ProcessEvent(event);
+    AddPendingEvent(event);
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------
@@ -1055,6 +1049,7 @@ void wxWindowMGL::Clear()
     dc.Clear();
 }
 
     dc.Clear();
 }
 
+#include "wx/menu.h"
 void wxWindowMGL::Refresh(bool eraseBack, const wxRect *rect)
 {
     if ( m_eraseBackground == -1 )
 void wxWindowMGL::Refresh(bool eraseBack, const wxRect *rect)
 {
     if ( m_eraseBackground == -1 )