]> git.saurik.com Git - wxWidgets.git/commitdiff
Three more attempts to get metal look.
authorRobert Roebling <robert@roebling.de>
Sun, 14 Apr 2002 14:42:43 +0000 (14:42 +0000)
committerRobert Roebling <robert@roebling.de>
Sun, 14 Apr 2002 14:42:43 +0000 (14:42 +0000)
     - Added a few flags for inheriting background.
     - Added wxWindow param to wxR::DrawBackground()
     - Added wxR::DrawButtonSurface()
     - Removed wxR::DrawBackground() from wxR::DrawButtonBorder()
     - Adde DrawMetal to Metal theme
  Fixed minor bug in wxGTK scrollbar.
  Changed code in wxX11 wxTLW so that startup flicker no
    longer occurs in wxFrame.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15136 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

23 files changed:
include/wx/generic/panelg.h
include/wx/univ/button.h
include/wx/univ/checkbox.h
include/wx/univ/renderer.h
include/wx/univ/statbmp.h
include/wx/univ/statbox.h
include/wx/univ/stattext.h
include/wx/univ/toplevel.h
include/wx/univ/window.h
src/gtk/scrolbar.cpp
src/gtk1/scrolbar.cpp
src/univ/button.cpp
src/univ/checkbox.cpp
src/univ/renderer.cpp
src/univ/statbmp.cpp
src/univ/statbox.cpp
src/univ/stattext.cpp
src/univ/themes/gtk.cpp
src/univ/themes/metal.cpp
src/univ/themes/win32.cpp
src/univ/winuniv.cpp
src/x11/app.cpp
src/x11/toplevel.cpp

index 076011ac792eff8a6ccf36e350114cfa19d56eb4..cc40e39182aed2cddc88cc73e8019946ff7208ef 100644 (file)
@@ -81,6 +81,10 @@ public:
 
     virtual void InitDialog();
 
+#ifdef __WXUNIV__
+    virtual bool ProvidesBackground() { return TRUE; }
+#endif
+
     WX_DECLARE_CONTROL_CONTAINER();
 
 protected:
index 6d4b24ced08c3c18b4159cb11abfcf1e084b6613..524d873f09315642b2bc7c073539721feb645995 100644 (file)
@@ -109,6 +109,8 @@ protected:
                                long numArg = -1,
                                const wxString& strArg = wxEmptyString);
     virtual wxSize DoGetBestClientSize() const;
+    
+    virtual bool DoDrawBackground(wxDC& dc);
     virtual void DoDraw(wxControlRenderer *renderer);
 
     virtual bool CanBeHighlighted() const { return TRUE; }
index 7d419022272dc52640a4a65dfdb248f71e2c9c49..db3eadda07de66319c36883c800ff953ce230cf1 100644 (file)
@@ -101,6 +101,8 @@ public:
     // overridden base class virtuals
     virtual bool IsPressed() const { return m_isPressed; }
 
+    virtual bool HasTransparentBackground() { return TRUE; }
+    
 protected:
     virtual bool PerformAction(const wxControlAction& action,
                                long numArg = -1,
index f1c2f9c5b97cacc8e574122c25c3dd8350ae5cba..3aead220442b1d58891dc803b592b5e5e4b93687 100644 (file)
@@ -69,7 +69,16 @@ public:
     virtual void DrawBackground(wxDC& dc,
                                 const wxColour& col,
                                 const wxRect& rect,
-                                int flags) = 0;
+                                int flags,
+                                wxWindow *window = NULL ) = 0;
+
+    // draw the button surface
+    virtual void DrawButtonSurface(wxDC& dc,
+                                const wxColour& col,
+                                const wxRect& rect,
+                                int flags )
+        { DrawBackground( dc, col, rect, flags ); }
+                                
 
     // draw the label inside the given rectangle with the specified alignment
     // and optionally emphasize the character with the given index
@@ -497,8 +506,9 @@ public:
     virtual void DrawBackground(wxDC& dc,
                                 const wxColour& col,
                                 const wxRect& rect,
-                                int flags)
-        { m_renderer->DrawBackground(dc, col, rect, flags); }
+                                int flags,
+                                wxWindow *window = NULL )
+        { m_renderer->DrawBackground(dc, col, rect, flags, window ); }
     virtual void DrawLabel(wxDC& dc,
                            const wxString& label,
                            const wxRect& rect,
index 42fbf0b0ee5b93b9ff448e158848132ba1cade64..fcfdf802ae0eb3c03993b1025236d3688e1951a4 100644 (file)
@@ -63,6 +63,8 @@ public:
 
     wxIcon GetIcon() const;
 
+    virtual bool HasTransparentBackground() { return TRUE; }
+    
 private:
     virtual void DoDraw(wxControlRenderer *renderer);
 
index 382f2a9eb6410c5c38496819f305967408e4d939..646bd119029a53238156068cab94539e7c1617b5 100644 (file)
@@ -51,6 +51,8 @@ public:
     // take account of this
     virtual wxPoint GetBoxAreaOrigin() const;
 
+    virtual bool HasTransparentBackground() { return TRUE; }
+    
 protected:
     // draw the control
     virtual void DoDraw(wxControlRenderer *renderer);
index 371d197b3cb206ca7b2b1da020083a59384f077d..810aa35869399ed03bbd130108541a36f564c4f8 100644 (file)
@@ -55,6 +55,8 @@ public:
 
     virtual void SetLabel(const wxString& label);
 
+    virtual bool HasTransparentBackground() { return TRUE; }
+    
 protected:
     // calculate the optimal size for the label
     virtual wxSize DoGetBestClientSize() const;
index 4a15051a464f72b34ff42bccc163ef44e13e30d8..9edcf899f66953ec8170531faee4c4d381a18b2b 100644 (file)
@@ -143,6 +143,8 @@ public:
     virtual int GetMinWidth() const;
     virtual int GetMinHeight() const;
 
+    virtual bool ProvidesBackground() { return TRUE; }
+    
 protected:
     // handle titlebar button click event
     virtual void ClickTitleBarButton(long button);
index d3a845d84ad680d96788507aa330dd5b416cd8b1..673dddf1e3787036af716d183fa58331a2574e74 100644 (file)
@@ -171,6 +171,16 @@ public:
     // control (e.g. a button, checkbox, ...)
     virtual bool IsContainerWindow() const { return FALSE; }
 
+    // returns TRUE if the control has "transparent" areas such
+    // as a wxStaticText and wxCheckBox and the background should
+    // be adapted from a parent window
+    virtual bool HasTransparentBackground() { return FALSE; }
+    
+    // to be used with function above: transparent windows get
+    // their background from parents that return TRUE here,
+    // so this is mostly for wxPanel, wxTopLevelWindow etc.
+    virtual bool ProvidesBackground() { return FALSE; }
+
     // return TRUE if this control can be highlighted when the mouse is over
     // it (the theme decides itself whether it is really highlighted or not)
     virtual bool CanBeHighlighted() const { return FALSE; }
@@ -201,9 +211,6 @@ public:
     // erase part of the control
     virtual void EraseBackground(wxDC& dc, const wxRect& rect);
     
-    // see below
-    bool HasDialogBackground() { return m_hasDialogBackground; }
-
     // overridden base class methods
     // -----------------------------
 
@@ -270,10 +277,6 @@ protected:
     // the renderer we use
     wxRenderer *m_renderer;
     
-    // background like a dialog (e.g. wxStaticText,
-    // wxRadioButton), not with a surface (wxButton)
-    bool m_hasDialogBackground;
-
     // background bitmap info
     wxBitmap  m_bitmapBg;
     int       m_alignBgBitmap;
index b8fc5dbf9756318f883693a942c68b4bd8ea8537..0f65b4b34e2d6d530bbb4e0f15d1ef78ebe4b647 100644 (file)
@@ -114,9 +114,9 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget),
     {
         wxEventType command = wxEVT_SCROLL_THUMBRELEASE;
         int value = (int)ceil(win->m_adjust->value);
-        int dir = win->HasFlag(wxSB_VERTICAL) ? wxVERTICAL : wxHORIZONTAL;
+        int orient = win->HasFlag(wxSB_VERTICAL) ? wxVERTICAL : wxHORIZONTAL;
 
-        wxScrollEvent event( command, value, dir );
+        wxScrollEvent event( command, win->GetId(), value, orient );
         event.SetEventObject( win );
         win->GetEventHandler()->ProcessEvent( event );
     }
index b8fc5dbf9756318f883693a942c68b4bd8ea8537..0f65b4b34e2d6d530bbb4e0f15d1ef78ebe4b647 100644 (file)
@@ -114,9 +114,9 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget),
     {
         wxEventType command = wxEVT_SCROLL_THUMBRELEASE;
         int value = (int)ceil(win->m_adjust->value);
-        int dir = win->HasFlag(wxSB_VERTICAL) ? wxVERTICAL : wxHORIZONTAL;
+        int orient = win->HasFlag(wxSB_VERTICAL) ? wxVERTICAL : wxHORIZONTAL;
 
-        wxScrollEvent event( command, value, dir );
+        wxScrollEvent event( command, win->GetId(), value, orient );
         event.SetEventObject( win );
         win->GetEventHandler()->ProcessEvent( event );
     }
index 23a4d96eea253a9f9c59a5f11ae7fb147c729f7e..b06789a25d7ee39caad11d32bd2c52fe0e05a8c9 100644 (file)
@@ -39,6 +39,7 @@
 #include "wx/univ/renderer.h"
 #include "wx/univ/inphand.h"
 #include "wx/univ/theme.h"
+#include "wx/univ/colschem.h"
 
 // ----------------------------------------------------------------------------
 // constants
@@ -162,6 +163,30 @@ void wxButton::DoDraw(wxControlRenderer *renderer)
     renderer->DrawLabel(m_bitmap, m_marginBmpX, m_marginBmpY);
 }
 
+bool wxButton::DoDrawBackground(wxDC& dc)
+{
+    wxRect rect;
+    wxSize size = GetSize();
+    rect.width = size.x;
+    rect.height = size.y;
+    
+    if ( GetBackgroundBitmap().Ok() )
+    {
+        // get the bitmap and the flags
+        int alignment;
+        wxStretch stretch;
+        wxBitmap bmp = GetBackgroundBitmap(&alignment, &stretch);
+        wxControlRenderer::DrawBitmap(dc, bmp, rect, alignment, stretch);
+    }
+    else
+    {
+        m_renderer->DrawButtonSurface(dc, wxTHEME_BG_COLOUR(this),
+                                      rect, GetStateFlags());
+    }
+
+    return TRUE;
+}
+
 // ----------------------------------------------------------------------------
 // input processing
 // ----------------------------------------------------------------------------
index c15ebca4bab3c657d6dfbc55170643ca6310cf6e..c9a95a631868adeba3d47b40db4700e5ae5f7322 100644 (file)
@@ -70,8 +70,6 @@ bool wxCheckBox::Create(wxWindow *parent,
     if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
         return FALSE;
 
-    m_hasDialogBackground = TRUE;
-
     SetLabel(label);
     SetBestSize(size);
 
index 3d55a23cfba47ad6dc7a9c9720486d4cf7767a21..75539ac04cbc80eaa0b99d3b1be1dabc31d34c40 100644 (file)
@@ -468,7 +468,8 @@ void wxControlRenderer::DrawButtonBorder()
 
     m_renderer->DrawButtonBorder(m_dc, m_rect, flags, &m_rect);
 
-    m_renderer->DrawBackground(m_dc, wxTHEME_BG_COLOUR(m_window), m_rect, flags);
+    // Why do this here?
+    // m_renderer->DrawButtonSurface(m_dc, wxTHEME_BG_COLOUR(m_window), m_rect, flags );
 }
 
 void wxControlRenderer::DrawBitmap(const wxBitmap& bitmap)
index ee56f372a58cddcd0aba20e526d911e1d0890de3..39282b88d0cce49f2dc1cd593e641b161d202b24 100644 (file)
@@ -60,8 +60,6 @@ bool wxStaticBitmap::Create(wxWindow *parent,
     if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
         return FALSE;
 
-    m_hasDialogBackground = TRUE;
-
     // set bitmap first
     SetBitmap(label);
 
index 0f878f5685d33523d46f9b473bdfa4674ff4e3a5..3c8b948466647c4b701147dfb2ea70c9753cf27d 100644 (file)
@@ -58,8 +58,6 @@ bool wxStaticBox::Create(wxWindow *parent,
     if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
         return FALSE;
 
-    m_hasDialogBackground = TRUE;
-
     SetLabel(label);
 
     return TRUE;
index e09644b5b1224381b99eb631c7168ffbc2475d9a..5bb880a96ef641bafcca943e7eb62a530a21163d 100644 (file)
@@ -59,8 +59,6 @@ bool wxStaticText::Create(wxWindow *parent,
     if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
         return FALSE;
         
-    m_hasDialogBackground = TRUE;
-
     SetLabel(label);
     SetBestSize(size);
 
index 0fb2adda78faca0d8cf33afa426fa59afbf66168..87973d24cb6b43f6c296179c5993023c9dba133d 100644 (file)
@@ -77,7 +77,8 @@ public:
     virtual void DrawBackground(wxDC& dc,
                                 const wxColour& col,
                                 const wxRect& rect,
-                                int flags = 0);
+                                int flags = 0,
+                                wxWindow *window = NULL );
     virtual void DrawLabel(wxDC& dc,
                            const wxString& label,
                            const wxRect& rect,
@@ -336,7 +337,8 @@ protected:
     // draw the background with any colour, not only the default one(s)
     void DoDrawBackground(wxDC& dc,
                           const wxColour& col,
-                          const wxRect& rect);
+                          const wxRect& rect,
+                          wxWindow *window = NULL);
 
     // DrawBorder() helpers: all of them shift and clip the DC after drawing
     // the border
@@ -2280,7 +2282,8 @@ void wxGTKRenderer::GetComboBitmaps(wxBitmap *bmpNormal,
 
 void wxGTKRenderer::DoDrawBackground(wxDC& dc,
                                      const wxColour& col,
-                                     const wxRect& rect)
+                                     const wxRect& rect,
+                                     wxWindow *window )
 {
     wxBrush brush(col, wxSOLID);
     dc.SetBrush(brush);
@@ -2291,10 +2294,11 @@ void wxGTKRenderer::DoDrawBackground(wxDC& dc,
 void wxGTKRenderer::DrawBackground(wxDC& dc,
                                    const wxColour& col,
                                    const wxRect& rect,
-                                   int flags)
+                                   int flags,
+                                   wxWindow *window )
 {
     wxColour colBg = col.Ok() ? col : GetBackgroundColour(flags);
-    DoDrawBackground(dc, colBg, rect);
+    DoDrawBackground(dc, colBg, rect, window );
 }
 
 // ----------------------------------------------------------------------------
index 56f4bdd92b406352e737d71dcd3bd2a328a6929a..78db94c56fac624a9d1566fe05bb0c867b147dbd 100644 (file)
@@ -143,12 +143,20 @@ public:
 
     // ctor
     wxMetalRenderer(const wxColourScheme *scheme);
+    
+    // Metal gradient
+    void DrawMetal(wxDC &dc, const wxRect &rect );
 
     // implement the base class pure virtuals
     virtual void DrawBackground(wxDC& dc,
                                 const wxColour& col,
                                 const wxRect& rect,
-                                int flags = 0);
+                                int flags = 0,
+                                wxWindow *window = NULL );
+    virtual void DrawButtonSurface(wxDC& dc,
+                                const wxColour& col,
+                                const wxRect& rect,
+                                int flags );
     virtual void DrawLabel(wxDC& dc,
                            const wxString& label,
                            const wxRect& rect,
@@ -404,7 +412,8 @@ protected:
     // DrawButtonBorder() helper
     void DoDrawBackground(wxDC& dc,
                           const wxColour& col,
-                          const wxRect& rect);
+                          const wxRect& rect,
+                          wxWindow *window = NULL );
 
     // DrawBorder() helpers: all of them shift and clip the DC after drawing
     // the border
@@ -1331,12 +1340,6 @@ wxColour wxMetalColourScheme::GetBackground(wxWindow *win) const
     }
     else
     {
-        if ( win->HasDialogBackground() )
-        {
-            col = win->GetParent()->GetBackgroundColour();
-            return col;
-        }
-        
         int flags = win->GetStateFlags();
 
         // the colour set by the user should be used for the normal state
@@ -3203,40 +3206,53 @@ void wxMetalRenderer::GetComboBitmaps(wxBitmap *bmpNormal,
     }
 }
 
+// ----------------------------------------------------------------------------
+// metal gradient
+// ----------------------------------------------------------------------------
+
+void wxMetalRenderer::DrawMetal(wxDC &dc, const wxRect &rect )
+{
+    dc.SetPen(*wxTRANSPARENT_PEN);
+    for (int y = rect.y; y < rect.height+rect.y; y++)
+    {
+       int intens = 230 + 80 * (rect.y-y) / rect.height;
+       dc.SetBrush( wxBrush( wxColour(intens,intens,intens), wxSOLID ) );
+       dc.DrawRectangle( rect.x, y, rect.width, 1 );
+    }
+}
+   
 // ----------------------------------------------------------------------------
 // background
 // ----------------------------------------------------------------------------
 
+void wxMetalRenderer::DrawButtonSurface(wxDC& dc,
+                                        const wxColour& col,
+                                        const wxRect& rect,
+                                        int flags )
+{
+    DrawMetal( dc, rect );
+}
+
 void wxMetalRenderer::DoDrawBackground(wxDC& dc,
                                        const wxColour& col,
-                                       const wxRect& rect)
+                                       const wxRect& rect,
+                                       wxWindow *window )
 {
     dc.SetPen(*wxTRANSPARENT_PEN);
-    if (col == wxTheme::Get()->GetColourScheme()->Get( wxColourScheme::CONTROL ))
-    {
-        for (int y = rect.y; y < rect.height+rect.y; y++)
-        {
-           int intens = 230 + 80 * (rect.y-y) / rect.height;
-           dc.SetBrush( wxBrush( wxColour(intens,intens,intens), wxSOLID ) );
-           dc.DrawRectangle( rect.x, y, rect.width, 1 );
-        }
-    }
-    else
-    {
-        wxBrush brush(col, wxSOLID);
-        dc.SetBrush(brush);
-        dc.DrawRectangle(rect);
-    }
+    wxBrush brush(col, wxSOLID);
+    dc.SetBrush(brush);
+    dc.DrawRectangle(rect);
 }
 
 void wxMetalRenderer::DrawBackground(wxDC& dc,
                                      const wxColour& col,
                                      const wxRect& rect,
-                                     int flags)
+                                     int flags,
+                                     wxWindow *window )
 {
     // just fill it with the given or default bg colour
     wxColour colBg = col.Ok() ? col : wxSCHEME_COLOUR(m_scheme, CONTROL);
-    DoDrawBackground(dc, colBg, rect);
+    DoDrawBackground(dc, colBg, rect, window);
 }
 
 // ----------------------------------------------------------------------------
@@ -3302,7 +3318,7 @@ void wxMetalRenderer::DrawArrowButton(wxDC& dc,
                                       wxArrowStyle arrowStyle)
 {
     wxRect rect = rectAll;
-    DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
+    DrawMetal( dc, rect );
     DrawArrowBorder(dc, &rect, arrowStyle == Arrow_Pressed);
     DrawArrow(dc, rect, arrowDir, arrowStyle);
 }
@@ -3315,7 +3331,7 @@ void wxMetalRenderer::DrawScrollbarThumb(wxDC& dc,
     // we don't use the flags, the thumb never changes appearance
     wxRect rectThumb = rect;
     DrawArrowBorder(dc, &rectThumb);
-    DrawBackground(dc, wxNullColour, rectThumb);
+    DrawMetal( dc, rectThumb );
 }
 
 void wxMetalRenderer::DrawScrollbarShaft(wxDC& dc,
@@ -3323,10 +3339,7 @@ void wxMetalRenderer::DrawScrollbarShaft(wxDC& dc,
                                          const wxRect& rectBar,
                                          int flags)
 {
-    wxColourScheme::StdColour col = flags & wxCONTROL_PRESSED
-                                    ? wxColourScheme::SCROLLBAR_PRESSED
-                                    : wxColourScheme::SCROLLBAR;
-    DoDrawBackground(dc, m_scheme->Get(col), rectBar);
+    DrawMetal( dc, rectBar );
 }
 
 void wxMetalRenderer::DrawScrollCorner(wxDC& dc, const wxRect& rect)
index ab245bd069970be6a0cb2a518c6b0fba1f4359df..4f02fc9394e34d3a52c21ee3b8a3db8944054a91 100644 (file)
@@ -148,7 +148,8 @@ public:
     virtual void DrawBackground(wxDC& dc,
                                 const wxColour& col,
                                 const wxRect& rect,
-                                int flags = 0);
+                                int flags = 0,
+                                wxWindow *window = NULL);
     virtual void DrawLabel(wxDC& dc,
                            const wxString& label,
                            const wxRect& rect,
@@ -404,7 +405,8 @@ protected:
     // DrawButtonBorder() helper
     void DoDrawBackground(wxDC& dc,
                           const wxColour& col,
-                          const wxRect& rect);
+                          const wxRect& rect,
+                          wxWindow *window = NULL );
 
     // DrawBorder() helpers: all of them shift and clip the DC after drawing
     // the border
@@ -3203,7 +3205,8 @@ void wxWin32Renderer::GetComboBitmaps(wxBitmap *bmpNormal,
 
 void wxWin32Renderer::DoDrawBackground(wxDC& dc,
                                        const wxColour& col,
-                                       const wxRect& rect)
+                                       const wxRect& rect,
+                                       wxWindow *window )
 {
     wxBrush brush(col, wxSOLID);
     dc.SetBrush(brush);
@@ -3214,11 +3217,12 @@ void wxWin32Renderer::DoDrawBackground(wxDC& dc,
 void wxWin32Renderer::DrawBackground(wxDC& dc,
                                      const wxColour& col,
                                      const wxRect& rect,
-                                     int flags)
+                                     int flags,
+                                     wxWindow *window )
 {
     // just fill it with the given or default bg colour
     wxColour colBg = col.Ok() ? col : wxSCHEME_COLOUR(m_scheme, CONTROL);
-    DoDrawBackground(dc, colBg, rect);
+    DoDrawBackground(dc, colBg, rect, window );
 }
 
 // ----------------------------------------------------------------------------
index f3ab3b3f2308b35e8c1aa621328c77518e9fd8bd..966266581311918bea87bdb63b79e9e94639b561 100644 (file)
@@ -111,8 +111,6 @@ void wxWindow::Init()
     
     m_oldSize.x = -1;
     m_oldSize.y = -1;
-    
-    m_hasDialogBackground = FALSE;
 }
 
 bool wxWindow::Create(wxWindow *parent,
@@ -304,7 +302,7 @@ bool wxWindow::DoDrawBackground(wxDC& dc)
 void wxWindow::EraseBackground(wxDC& dc, const wxRect& rect)
 {
     // TODO: handle bg bitmaps here!
-
+    
     m_renderer->DrawBackground(dc, wxTHEME_BG_COLOUR(this), rect, GetStateFlags());
 }
 
index 3408003de49891d8276d3111fb6f02404fc04635..1ca16bb8e24da0060046a068fd46fee85aeb2aa8 100644 (file)
@@ -924,8 +924,6 @@ bool wxApp::SendIdleEvents(wxWindow* win)
 
     win->GetEventHandler()->ProcessEvent(event);
 
-    win->OnInternalIdle();
-
     if (event.MoreRequested())
         needMore = TRUE;
 
@@ -939,6 +937,8 @@ bool wxApp::SendIdleEvents(wxWindow* win)
         node = node->Next();
     }
 
+    win->OnInternalIdle();
+
     return needMore;
 }
 
@@ -1202,7 +1202,7 @@ void wxApp::OnAssert(const wxChar *file, int line, const wxChar *msg)
 {
     // While the GUI isn't working that well, just print out the
     // message.
-#if 0
+#if 1
     wxAppBase::OnAssert(file, line, msg);
 #else
     wxString msg2;
index eb297ec92d6b3d3f9cafbf3d163afcee535a5770..c9babe382597573abed672b42197116ed1b78dc5 100644 (file)
@@ -264,7 +264,10 @@ void wxTopLevelWindowX11::OnInternalIdle()
 {
     wxWindow::OnInternalIdle();
     
-    if (m_needResizeInIdle)
+    // Do this only after the last idle event so that
+    // all windows have been updated before a new
+    // round of size events is sent
+    if (m_needResizeInIdle && !wxTheApp->Pending())
     {
         wxSizeEvent event( GetClientSize(), GetId() );
         event.SetEventObject( this );
@@ -280,31 +283,15 @@ void wxTopLevelWindowX11::OnInternalIdle()
 
 bool wxTopLevelWindowX11::Show(bool show)
 {
-    // Nano-X has to force a size event,
-    // else there's no initial size.
-#if wxUSE_NANOX
     if (show)
-#else
-    if (show && m_needResizeInIdle)
-#endif
     {
         wxSizeEvent event(GetSize(), GetId());
+        
         event.SetEventObject(this);
         GetEventHandler()->ProcessEvent(event);
         
         m_needResizeInIdle = FALSE;
     }
-    if (show)
-    {
-        // This does the layout _before_ the
-        // window is shown, else the items are
-        // drawn first at the wrong positions,
-        // then at the correct positions.
-        if (GetAutoLayout())
-        {
-            Layout();
-        }
-    }
 
     bool ret = wxWindowX11::Show(show);