Send size events from top level windows in idle time,

this significantly improves the opaque resizing look
   and feel and seems to speed up dialog show up time.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14579 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2002-03-13 18:25:11 +00:00
parent d1eebf4054
commit 77df2fbce6
3 changed files with 37 additions and 17 deletions

View File

@@ -57,28 +57,29 @@ public:
virtual void SetIcon(const wxIcon& icon); virtual void SetIcon(const wxIcon& icon);
virtual void Restore(); virtual void Restore();
virtual bool Show(bool show = TRUE); virtual bool Show( bool show = TRUE );
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); virtual bool ShowFullScreen( bool show, long style = wxFULLSCREEN_ALL );
virtual bool IsFullScreen() const { return m_fsIsShowing; } virtual bool IsFullScreen() const { return m_fsIsShowing; }
virtual void SetTitle( const wxString& title); virtual void SetTitle( const wxString& title);
virtual wxString GetTitle() const; virtual wxString GetTitle() const;
// implementation from now on // implementation
// -------------------------- void SetNeedResizeInIdle( bool set = TRUE ) { m_needResizeInIdle = set; }
void SetFocusWidget( wxWindow *focus ) { m_focusWidget = focus; }
wxWindow *GetFocusWidget() const { return m_focusWidget; }
protected: protected:
// common part of all ctors // common part of all ctors
void Init(); void Init();
// For implementation purposes - sometimes decorations make the client area // For implementation purposes - sometimes decorations make the
// smaller // client area smaller
virtual wxPoint GetClientAreaOrigin() const; virtual wxPoint GetClientAreaOrigin() const;
// For implementation of delayed resize events
bool m_needResizeInIdle;
virtual void OnInternalIdle();
virtual void DoGetClientSize( int *width, int *height ) const; virtual void DoGetClientSize( int *width, int *height ) const;
virtual void DoSetClientSize(int width, int height); virtual void DoSetClientSize(int width, int height);
virtual void DoSetSize(int x, int y, virtual void DoSetSize(int x, int y,
@@ -99,9 +100,6 @@ protected:
bool m_fsIsMaximized; bool m_fsIsMaximized;
bool m_fsIsShowing; bool m_fsIsShowing;
wxString m_title; wxString m_title;
// This widget gets the key input
wxWindow* m_focusWidget;
}; };
// list of all frames and modeless dialogs // list of all frames and modeless dialogs

View File

@@ -526,10 +526,18 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
#endif #endif
{ {
//wxLogDebug("ConfigureNotify: %s", windowClass.c_str()); //wxLogDebug("ConfigureNotify: %s", windowClass.c_str());
wxSizeEvent sizeEvent( wxSize(XConfigureEventGetWidth(event), XConfigureEventGetHeight(event)), win->GetId() ); if (win->IsTopLevel())
sizeEvent.SetEventObject( win ); {
wxTopLevelWindowX11 *tlw = (wxTopLevelWindowX11 *) win;
tlw->SetNeedResizeInIdle();
}
else
{
wxSizeEvent sizeEvent( wxSize(XConfigureEventGetWidth(event), XConfigureEventGetHeight(event)), win->GetId() );
sizeEvent.SetEventObject( win );
return win->GetEventHandler()->ProcessEvent( sizeEvent ); return win->GetEventHandler()->ProcessEvent( sizeEvent );
}
} }
return FALSE; return FALSE;
break; break;

View File

@@ -62,7 +62,7 @@ void wxTopLevelWindowX11::Init()
m_fsIsMaximized = FALSE; m_fsIsMaximized = FALSE;
m_fsIsShowing = FALSE; m_fsIsShowing = FALSE;
m_focusWidget = NULL; m_needResizeInIdle = FALSE;
} }
bool wxTopLevelWindowX11::Create(wxWindow *parent, bool wxTopLevelWindowX11::Create(wxWindow *parent,
@@ -225,6 +225,18 @@ wxTopLevelWindowX11::~wxTopLevelWindowX11()
} }
} }
void wxTopLevelWindowX11::OnInternalIdle()
{
wxWindow::OnInternalIdle();
if (m_needResizeInIdle)
{
wxSizeEvent event( GetClientSize(), GetId() );
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
}
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxTopLevelWindowX11 showing // wxTopLevelWindowX11 showing
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -235,12 +247,14 @@ bool wxTopLevelWindowX11::Show(bool show)
// else there's no initial size. // else there's no initial size.
#if wxUSE_NANOX #if wxUSE_NANOX
if (show) if (show)
#else
if (show && m_needResizeInIdle)
#endif
{ {
wxSizeEvent event(GetSize(), GetId()); wxSizeEvent event(GetSize(), GetId());
event.SetEventObject(this); event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event); GetEventHandler()->ProcessEvent(event);
} }
#endif
return wxWindowX11::Show(show); return wxWindowX11::Show(show);
} }