wxTopLevelWindows.Append(this);
 
     m_title = title;
-    
-    // FIXME_MGL -- should activate itself when shown!
 
     return TRUE;
 }
 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;
 }
 
 
     
 #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") )
 static void wxWindowPainter(window_t *wnd, MGLDC *dc)
 {
     wxWindowMGL *w = (wxWindow*) wnd->userData;
+    
     if ( w && !(w->GetWindowStyle() & wxTRANSPARENT_WINDOW) )
     {
         MGLDevCtx ctx(dc);
 #endif // wxUSE_CARET
 
     wxWindowMGL *active = wxGetTopLevelParent(this);
-    if ( active != gs_activeFrame )
+    if ( !(m_windowStyle & wxPOPUP_WINDOW) && active != gs_activeFrame )
     {
         if ( gs_activeFrame )
         {
     
     wxFocusEvent event(wxEVT_SET_FOCUS, GetId());
     event.SetEventObject(this);
-    GetEventHandler()->ProcessEvent(event);
+    AddPendingEvent(event);
 }
 
 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);
 }
 
 // ----------------------------------------------------------------------------
     dc.Clear();
 }
 
+#include "wx/menu.h"
 void wxWindowMGL::Refresh(bool eraseBack, const wxRect *rect)
 {
     if ( m_eraseBackground == -1 )