// return currently active (running) event loop, may be NULL
     static wxEventLoop *GetActive() { return ms_activeLoop; }
 
+    // set currently active (running) event loop
+    static void SetActive(wxEventLoop* loop) { ms_activeLoop = loop; }
+
 protected:
     // the pointer to the port specific implementation class
     class WXDLLEXPORT wxEventLoopImpl *m_impl;
 
 
     s_inYield = TRUE;
 
+    // Make sure we have an event loop object,
+    // or Pending/Dispatch will fail
+    wxEventLoop* eventLoop = wxEventLoop::GetActive();
+    wxEventLoop* newEventLoop = NULL;
+    if (!eventLoop)
+    {
+        newEventLoop = new wxEventLoop;
+        wxEventLoop::SetActive(newEventLoop);
+    }
+
     while (wxTheApp && wxTheApp->Pending())
         wxTheApp->Dispatch();
 
 #endif
     ProcessIdle();
 
+    if (newEventLoop)
+    {
+        wxEventLoop::SetActive(NULL);
+        delete newEventLoop;
+    }
+
     s_inYield = FALSE;
 
     return TRUE;
 
         
         m_needResizeInIdle = FALSE;
     }
-
     if (show)
     {
         // This does the layout _before_ the
             Layout();
         }
     }
+    wxYield();
 
-    return wxWindowX11::Show(show);
+    bool ret = wxWindowX11::Show(show);
+    return ret;
 }
 
 // ----------------------------------------------------------------------------
 
 void wxTopLevelWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 {
+    //    wxLogDebug("DoSetSize: %s (%ld) %d, %d %dx%d", GetClassInfo()->GetClassName(), GetId(), x, y, width, height);
+
 #if 0
-    // wxLogDebug( "Setting pos: %d, %d", x, y );
     wxWindowX11::DoSetSize(x, y, width, height, sizeFlags);
 #endif
     XSync(wxGlobalDisplay(), False);
     XSync(wxGlobalDisplay(), False);
     XSync(wxGlobalDisplay(), False);
 #endif
+#if 1
+    wxSizeEvent event(wxSize(width, height), GetId());
+    event.SetEventObject(this);
+    GetEventHandler()->ProcessEvent(event);
+#endif
 }
 
 void wxTopLevelWindowX11::DoGetPosition(int *x, int *y) const
 
 
 void wxWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 {
+    //    wxLogDebug("DoSetSize: %s (%ld) %d, %d %dx%d", GetClassInfo()->GetClassName(), GetId(), x, y, width, height);
+
     Window xwindow = (Window) GetMainWindow();
 
     wxCHECK_RET( xwindow, wxT("invalid window") );
     }
     
     DoMoveWindow( new_x, new_y, new_w, new_h );
+
+#if 0
+    wxSizeEvent event(wxSize(new_w, new_h), GetId());
+    event.SetEventObject(this);
+    GetEventHandler()->ProcessEvent(event);
+#endif
 }
 
 void wxWindowX11::DoSetClientSize(int width, int height)
 {
+    //    wxLogDebug("DoSetClientSize: %s (%ld) %dx%d", GetClassInfo()->GetClassName(), GetId(), width, height);
+
     Window xwindow = (Window) GetMainWindow();
 
     wxCHECK_RET( xwindow, wxT("invalid window") );
 
     XResizeWindow( wxGlobalDisplay(), xwindow, width, height );
 
+#if 0
+    wxSizeEvent event(wxSize(width, height), GetId());
+    event.SetEventObject(this);
+    GetEventHandler()->ProcessEvent(event);
+#endif
+    
 #else
 
     XWindowAttributes attr;
 
 void wxWindowX11::SendPaintEvents()
 {
+    //    wxLogDebug("SendPaintEvents: %s (%ld)", GetClassInfo()->GetClassName(), GetId());
+
     m_clipPaintRegion = TRUE;
     
     wxNcPaintEvent nc_paint_event( GetId() );