From 0728199b911be9095406cf05059a5a180e707778 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 8 Jul 2007 05:31:32 +0000 Subject: [PATCH] process pending wx events before sending idle events git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47229 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/app.h | 4 ---- include/wx/cocoa/app.h | 1 - include/wx/dfb/app.h | 1 - include/wx/gtk/app.h | 1 - include/wx/gtk1/app.h | 1 - include/wx/mgl/app.h | 1 - include/wx/motif/app.h | 2 -- include/wx/palmos/app.h | 1 - include/wx/x11/app.h | 1 - src/cocoa/app.mm | 5 ----- src/common/appcmn.cpp | 35 +++++++++++++---------------------- src/dfb/app.cpp | 4 ---- src/gtk/app.cpp | 4 ---- src/gtk1/app.cpp | 4 ---- src/mac/carbon/app.cpp | 7 +------ src/mgl/app.cpp | 5 ----- src/motif/app.cpp | 4 ---- src/msw/app.cpp | 2 -- src/os2/app.cpp | 2 -- src/palmos/app.cpp | 6 ------ src/x11/app.cpp | 4 ---- 21 files changed, 14 insertions(+), 81 deletions(-) diff --git a/include/wx/app.h b/include/wx/app.h index d12af8b3ae..b5542f913a 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -497,10 +497,6 @@ public: wxDEPRECATED( bool Initialized() ); #endif // WXWIN_COMPATIBILITY_2_6 - // perform standard OnIdle behaviour, ensure that this is always called - void OnIdle(wxIdleEvent& event); - - protected: // delete all objects in wxPendingDelete list void DeletePendingObjects(); diff --git a/include/wx/cocoa/app.h b/include/wx/cocoa/app.h index 326b317d02..50900b4f18 100644 --- a/include/wx/cocoa/app.h +++ b/include/wx/cocoa/app.h @@ -25,7 +25,6 @@ typedef const struct __CFString * CFStringRef; class WXDLLEXPORT wxApp: public wxAppBase { DECLARE_DYNAMIC_CLASS(wxApp) - DECLARE_EVENT_TABLE() // ------------------------------------------------------------------------ // initialization // ------------------------------------------------------------------------ diff --git a/include/wx/dfb/app.h b/include/wx/dfb/app.h index 2034b3c77d..80e7dfcb08 100644 --- a/include/wx/dfb/app.h +++ b/include/wx/dfb/app.h @@ -41,7 +41,6 @@ private: wxVideoMode m_videoMode; DECLARE_DYNAMIC_CLASS(wxApp) - DECLARE_EVENT_TABLE() }; #endif // _WX_DFB_APP_H_ diff --git a/include/wx/gtk/app.h b/include/wx/gtk/app.h index aa63278eeb..84580a1422 100644 --- a/include/wx/gtk/app.h +++ b/include/wx/gtk/app.h @@ -81,7 +81,6 @@ private: guint m_idleSourceId; DECLARE_DYNAMIC_CLASS(wxApp) - DECLARE_EVENT_TABLE() }; #endif // _WX_GTK_APP_H_ diff --git a/include/wx/gtk1/app.h b/include/wx/gtk1/app.h index 27c5e7faaf..b990781116 100644 --- a/include/wx/gtk1/app.h +++ b/include/wx/gtk1/app.h @@ -72,7 +72,6 @@ private: #endif // __WXDEBUG__ DECLARE_DYNAMIC_CLASS(wxApp) - DECLARE_EVENT_TABLE() }; #endif // __GTKAPPH__ diff --git a/include/wx/mgl/app.h b/include/wx/mgl/app.h index 7a5e0b0f1f..c92cab42e6 100644 --- a/include/wx/mgl/app.h +++ b/include/wx/mgl/app.h @@ -51,7 +51,6 @@ public: private: DECLARE_DYNAMIC_CLASS(wxApp) - DECLARE_EVENT_TABLE() wxVideoMode m_displayMode; }; diff --git a/include/wx/motif/app.h b/include/wx/motif/app.h index 985a7e22e1..8c1159b34c 100644 --- a/include/wx/motif/app.h +++ b/include/wx/motif/app.h @@ -91,8 +91,6 @@ private: WXColormap m_mainColormap; WXDisplay* m_initialDisplay; wxPerDisplayDataMap* m_perDisplayData; - - DECLARE_EVENT_TABLE() }; #endif diff --git a/include/wx/palmos/app.h b/include/wx/palmos/app.h index 65f4303b01..4211588f04 100644 --- a/include/wx/palmos/app.h +++ b/include/wx/palmos/app.h @@ -42,7 +42,6 @@ public: virtual int GetPrintMode() const { return m_printMode; } // implementation only - void OnIdle(wxIdleEvent& event); void OnEndSession(wxCloseEvent& event); void OnQueryEndSession(wxCloseEvent& event); diff --git a/include/wx/x11/app.h b/include/wx/x11/app.h index b78e4abae9..e6faab08e1 100644 --- a/include/wx/x11/app.h +++ b/include/wx/x11/app.h @@ -106,7 +106,6 @@ protected: long m_maxRequestSize; DECLARE_DYNAMIC_CLASS(wxApp) - DECLARE_EVENT_TABLE() }; #endif // _WX_X11_APP_H_ diff --git a/src/cocoa/app.mm b/src/cocoa/app.mm index e2f29aac35..0ac5bca28e 100644 --- a/src/cocoa/app.mm +++ b/src/cocoa/app.mm @@ -101,11 +101,6 @@ WX_IMPLEMENT_GET_OBJC_CLASS(wxNSApplicationObserver,NSObject) // wxApp Static member initialization // ---------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) -BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) - EVT_IDLE(wxAppBase::OnIdle) -// EVT_END_SESSION(wxApp::OnEndSession) -// EVT_QUERY_END_SESSION(wxApp::OnQueryEndSession) -END_EVENT_TABLE() // ---------------------------------------------------------------------------- // wxApp initialization/cleanup diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index dca75fefd9..8a33c3f31f 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -365,6 +365,9 @@ void wxAppBase::DeletePendingObjects() // Returns true if more time is needed. bool wxAppBase::ProcessIdle() { + // process pending wx events before sending idle events + ProcessPendingEvents(); + wxIdleEvent event; bool needMore = false; wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst(); @@ -376,7 +379,16 @@ bool wxAppBase::ProcessIdle() node = node->GetNext(); } - needMore = wxAppConsole::ProcessIdle(); + if (wxAppConsole::ProcessIdle()) + needMore = true; + + // 'Garbage' collection of windows deleted with Close(). + DeletePendingObjects(); + +#if wxUSE_LOG + // flush the logged messages if any + wxLog::FlushActive(); +#endif wxUpdateUIEvent::ResetUpdateTime(); @@ -413,27 +425,6 @@ bool wxAppBase::SendIdleEvents(wxWindow* win, wxIdleEvent& event) return needMore; } -void wxAppBase::OnIdle(wxIdleEvent& WXUNUSED(event)) -{ - // If there are pending events, we must process them: pending events - // are either events to the threads other than main or events posted - // with wxPostEvent() functions - // GRG: I have moved this here so that all pending events are processed - // before starting to delete any objects. This behaves better (in - // particular, wrt wxPostEvent) and is coherent with wxGTK's current - // behaviour. Changed Feb/2000 before 2.1.14 - ProcessPendingEvents(); - - // 'Garbage' collection of windows deleted with Close(). - DeletePendingObjects(); - -#if wxUSE_LOG - // flush the logged messages if any - wxLog::FlushActive(); -#endif // wxUSE_LOG - -} - // ---------------------------------------------------------------------------- // wxGUIAppTraitsBase // ---------------------------------------------------------------------------- diff --git a/src/dfb/app.cpp b/src/dfb/app.cpp index bfde03508e..8ae8339fe5 100644 --- a/src/dfb/app.cpp +++ b/src/dfb/app.cpp @@ -28,10 +28,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) -BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) - EVT_IDLE(wxAppBase::OnIdle) -END_EVENT_TABLE() - wxApp::wxApp() { } diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index ad027a0232..33cf2dc6a0 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -266,10 +266,6 @@ GtkWidget* wxGetRootWindow() IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler) -BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) - EVT_IDLE(wxAppBase::OnIdle) -END_EVENT_TABLE() - wxApp::wxApp() { #ifdef __WXDEBUG__ diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index c7d9c5b71f..84590d5759 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -425,10 +425,6 @@ GtkWidget* wxGetRootWindow() IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler) -BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) - EVT_IDLE(wxAppBase::OnIdle) -END_EVENT_TABLE() - wxApp::wxApp() { #ifdef __WXDEBUG__ diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index a48440d002..d833bb02d7 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -1136,12 +1136,7 @@ wxApp::wxApp() void wxApp::OnIdle(wxIdleEvent& event) { - wxAppBase::OnIdle(event); - - // If they are pending events, we must process them: pending events are - // either events to the threads other than main or events posted with - // wxPostEvent() functions - wxMacProcessNotifierAndPendingEvents(); + wxMacProcessNotifierEvents(); if (!wxMenuBar::MacGetInstalledMenuBar() && wxMenuBar::MacGetCommonMenuBar()) wxMenuBar::MacGetCommonMenuBar()->MacInstallMenuBar(); diff --git a/src/mgl/app.cpp b/src/mgl/app.cpp index f94600c41e..c0338c7834 100644 --- a/src/mgl/app.cpp +++ b/src/mgl/app.cpp @@ -201,11 +201,6 @@ static void wxDestroyMGL_WM() IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler) -BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) - EVT_IDLE(wxAppBase::OnIdle) -END_EVENT_TABLE() - - wxApp::wxApp() { } diff --git a/src/motif/app.cpp b/src/motif/app.cpp index e36d19b6e6..c635bb4a19 100644 --- a/src/motif/app.cpp +++ b/src/motif/app.cpp @@ -73,10 +73,6 @@ wxHashTable *wxWidgetHashTable = NULL; IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) -BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) - EVT_IDLE(wxAppBase::OnIdle) -END_EVENT_TABLE() - #ifdef __WXDEBUG__ extern "C" { diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 843b4d3c88..f1cdf6d385 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -550,8 +550,6 @@ wxApp::~wxApp() void wxApp::OnIdle(wxIdleEvent& event) { - wxAppBase::OnIdle(event); - #if wxUSE_DC_CACHEING // automated DC cache management: clear the cached DCs and bitmap // if it's likely that the app has finished with them, that is, we diff --git a/src/os2/app.cpp b/src/os2/app.cpp index 758e6c7c44..3620b182ac 100644 --- a/src/os2/app.cpp +++ b/src/os2/app.cpp @@ -484,8 +484,6 @@ void wxApp::OnIdle( wxIdleEvent& rEvent ) gbInOnIdle = true; - wxAppBase::OnIdle(rEvent); - #if wxUSE_DC_CACHEING // automated DC cache management: clear the cached DCs and bitmap // if it's likely that the app has finished with them, that is, we diff --git a/src/palmos/app.cpp b/src/palmos/app.cpp index cfc5e1e70a..888ab4bf8c 100644 --- a/src/palmos/app.cpp +++ b/src/palmos/app.cpp @@ -142,7 +142,6 @@ int wxApp::m_nCmdShow = 0; IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) - EVT_IDLE(wxApp::OnIdle) EVT_END_SESSION(wxApp::OnEndSession) EVT_QUERY_END_SESSION(wxApp::OnQueryEndSession) END_EVENT_TABLE() @@ -245,11 +244,6 @@ wxApp::~wxApp() // wxApp idle handling // ---------------------------------------------------------------------------- -void wxApp::OnIdle(wxIdleEvent& event) -{ - wxAppBase::OnIdle(event); -} - void wxApp::WakeUpIdle() { } diff --git a/src/x11/app.cpp b/src/x11/app.cpp index 9677cf46fc..17a553ffe9 100644 --- a/src/x11/app.cpp +++ b/src/x11/app.cpp @@ -86,10 +86,6 @@ long wxApp::sm_lastMessageTime = 0; IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) -BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) - EVT_IDLE(wxAppBase::OnIdle) -END_EVENT_TABLE() - bool wxApp::Initialize(int& argC, wxChar **argV) { #if defined(__WXDEBUG__) && !wxUSE_NANOX -- 2.47.2