Rationalised OnIdle
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21948 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -381,16 +381,13 @@ public:
|
||||
// it should return TRUE if more idle events are needed, FALSE if not
|
||||
virtual bool ProcessIdle() ;
|
||||
|
||||
#if 0
|
||||
// Send idle event to all top-level windows.
|
||||
// Returns TRUE if more idle time is requested.
|
||||
virtual bool SendIdleEvents();
|
||||
#endif
|
||||
|
||||
// Send idle event to window and all subwindows
|
||||
// Returns TRUE if more idle time is requested.
|
||||
virtual bool SendIdleEvents(wxWindow* win, wxIdleEvent& event);
|
||||
|
||||
// Perform standard OnIdle behaviour: call from port's OnIdle
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
|
||||
|
||||
// top level window functions
|
||||
// --------------------------
|
||||
|
@@ -53,9 +53,6 @@ public:
|
||||
virtual bool Yield(bool onlyIfNeeded = FALSE);
|
||||
virtual void WakeUpIdle() { CocoaRequestIdle(); }
|
||||
|
||||
/* Idle Processing */
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
|
||||
virtual bool Initialize(int& argc, wxChar **argv);
|
||||
virtual void CleanUp();
|
||||
virtual bool CallOnInit();
|
||||
|
@@ -52,9 +52,6 @@ public:
|
||||
virtual bool Yield(bool onlyIfNeeded = FALSE);
|
||||
virtual void WakeUpIdle();
|
||||
|
||||
// implementation only from now on
|
||||
void OnIdle( wxIdleEvent &event );
|
||||
|
||||
virtual bool Initialize(int& argc, wxChar **argv);
|
||||
virtual void CleanUp();
|
||||
|
||||
|
@@ -52,9 +52,6 @@ public:
|
||||
virtual bool Yield(bool onlyIfNeeded = FALSE);
|
||||
virtual void WakeUpIdle();
|
||||
|
||||
// implementation only from now on
|
||||
void OnIdle( wxIdleEvent &event );
|
||||
|
||||
virtual bool Initialize(int& argc, wxChar **argv);
|
||||
virtual void CleanUp();
|
||||
|
||||
|
@@ -48,9 +48,6 @@ public:
|
||||
virtual bool Pending();
|
||||
virtual void Dispatch();
|
||||
|
||||
// implementation only from now on
|
||||
void OnIdle(wxIdleEvent &event);
|
||||
|
||||
virtual bool Initialize(int& argc, wxChar **argv);
|
||||
virtual void CleanUp();
|
||||
|
||||
|
@@ -66,8 +66,6 @@ public:
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
|
||||
protected:
|
||||
bool m_showOnInit;
|
||||
|
||||
|
@@ -66,8 +66,6 @@ public:
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
|
||||
// Processes an X event.
|
||||
virtual bool ProcessXEvent(WXEvent* event);
|
||||
|
||||
|
@@ -134,7 +134,7 @@ void wxApp::Exit()
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
|
||||
BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
|
||||
EVT_IDLE(wxApp::OnIdle)
|
||||
EVT_IDLE(wxAppBase::OnIdle)
|
||||
// EVT_END_SESSION(wxApp::OnEndSession)
|
||||
// EVT_QUERY_END_SESSION(wxApp::OnQueryEndSession)
|
||||
END_EVENT_TABLE()
|
||||
@@ -278,37 +278,6 @@ void wxApp::Dispatch()
|
||||
{
|
||||
}
|
||||
|
||||
void wxApp::OnIdle(wxIdleEvent& event)
|
||||
{
|
||||
wxLogDebug("wxApp::OnIdle");
|
||||
#if 0
|
||||
static bool s_inOnIdle = FALSE;
|
||||
|
||||
// Avoid recursion (via ProcessEvent default case)
|
||||
if ( s_inOnIdle )
|
||||
return;
|
||||
s_inOnIdle = TRUE;
|
||||
#endif
|
||||
|
||||
|
||||
DeletePendingObjects();
|
||||
|
||||
// flush the logged messages if any
|
||||
wxLog *pLog = wxLog::GetActiveTarget();
|
||||
if ( pLog != NULL && pLog->HasPendingMessages() )
|
||||
pLog->Flush();
|
||||
|
||||
#if 0
|
||||
// Send OnIdle events to all windows
|
||||
bool needMore = SendIdleEvents();
|
||||
|
||||
if (needMore)
|
||||
event.RequestMore(TRUE);
|
||||
|
||||
s_inOnIdle = FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Yield to other processes
|
||||
|
||||
bool wxApp::Yield(bool onlyIfNeeded)
|
||||
|
@@ -232,25 +232,6 @@ bool wxAppBase::ProcessIdle()
|
||||
return needMore;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Send idle event to all top-level windows
|
||||
bool wxAppBase::SendIdleEvents()
|
||||
{
|
||||
bool needMore = FALSE;
|
||||
|
||||
wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
|
||||
while (node)
|
||||
{
|
||||
wxWindow* win = node->GetData();
|
||||
if (SendIdleEvents(win))
|
||||
needMore = TRUE;
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
return needMore;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Send idle event to window and all subwindows
|
||||
bool wxAppBase::SendIdleEvents(wxWindow* win, wxIdleEvent& event)
|
||||
{
|
||||
@@ -279,6 +260,26 @@ bool wxAppBase::SendIdleEvents(wxWindow* win, wxIdleEvent& event)
|
||||
return needMore;
|
||||
}
|
||||
|
||||
void wxAppBase::OnIdle(wxIdleEvent& 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
|
||||
|
@@ -390,7 +390,7 @@ GtkWidget* wxGetRootWindow()
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
|
||||
EVT_IDLE(wxApp::OnIdle)
|
||||
EVT_IDLE(wxAppBase::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxApp::wxApp()
|
||||
@@ -534,35 +534,6 @@ GdkVisual *wxApp::GetGdkVisual()
|
||||
return visual;
|
||||
}
|
||||
|
||||
void wxApp::OnIdle( wxIdleEvent &event )
|
||||
{
|
||||
static bool s_inOnIdle = FALSE;
|
||||
|
||||
// Avoid recursion (via ProcessEvent default case)
|
||||
if (s_inOnIdle)
|
||||
return;
|
||||
|
||||
s_inOnIdle = TRUE;
|
||||
|
||||
// Resend in the main thread events which have been prepared in other
|
||||
// threads
|
||||
ProcessPendingEvents();
|
||||
|
||||
// 'Garbage' collection of windows deleted with Close()
|
||||
DeletePendingObjects();
|
||||
|
||||
// Now done in ProcessIdle()
|
||||
#if 0
|
||||
// Send OnIdle events to all windows
|
||||
bool needMore = SendIdleEvents();
|
||||
|
||||
if (needMore)
|
||||
event.RequestMore(TRUE);
|
||||
#endif
|
||||
|
||||
s_inOnIdle = FALSE;
|
||||
}
|
||||
|
||||
int wxApp::MainLoop()
|
||||
{
|
||||
gtk_main();
|
||||
|
@@ -390,7 +390,7 @@ GtkWidget* wxGetRootWindow()
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
|
||||
EVT_IDLE(wxApp::OnIdle)
|
||||
EVT_IDLE(wxAppBase::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxApp::wxApp()
|
||||
@@ -534,35 +534,6 @@ GdkVisual *wxApp::GetGdkVisual()
|
||||
return visual;
|
||||
}
|
||||
|
||||
void wxApp::OnIdle( wxIdleEvent &event )
|
||||
{
|
||||
static bool s_inOnIdle = FALSE;
|
||||
|
||||
// Avoid recursion (via ProcessEvent default case)
|
||||
if (s_inOnIdle)
|
||||
return;
|
||||
|
||||
s_inOnIdle = TRUE;
|
||||
|
||||
// Resend in the main thread events which have been prepared in other
|
||||
// threads
|
||||
ProcessPendingEvents();
|
||||
|
||||
// 'Garbage' collection of windows deleted with Close()
|
||||
DeletePendingObjects();
|
||||
|
||||
// Now done in ProcessIdle()
|
||||
#if 0
|
||||
// Send OnIdle events to all windows
|
||||
bool needMore = SendIdleEvents();
|
||||
|
||||
if (needMore)
|
||||
event.RequestMore(TRUE);
|
||||
#endif
|
||||
|
||||
s_inOnIdle = FALSE;
|
||||
}
|
||||
|
||||
int wxApp::MainLoop()
|
||||
{
|
||||
gtk_main();
|
||||
|
@@ -1025,35 +1025,13 @@ void wxApp::Dispatch()
|
||||
|
||||
void wxApp::OnIdle(wxIdleEvent& event)
|
||||
{
|
||||
// Avoid recursion (via ProcessEvent default case)
|
||||
if ( s_inOnIdle )
|
||||
return;
|
||||
|
||||
s_inOnIdle = TRUE;
|
||||
|
||||
// 'Garbage' collection of windows deleted with Close().
|
||||
DeletePendingObjects();
|
||||
|
||||
// flush the logged messages if any
|
||||
wxLog *pLog = wxLog::GetActiveTarget();
|
||||
if ( pLog != NULL && pLog->HasPendingMessages() )
|
||||
pLog->Flush();
|
||||
|
||||
// Now done in ProcessIdle()
|
||||
#if 0
|
||||
// Send OnIdle events to all windows
|
||||
bool needMore = SendIdleEvents();
|
||||
|
||||
if (needMore)
|
||||
event.RequestMore(TRUE);
|
||||
#endif
|
||||
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();
|
||||
|
||||
s_inOnIdle = FALSE;
|
||||
if(!wxMenuBar::MacGetInstalledMenuBar() && wxMenuBar::MacGetCommonMenuBar())
|
||||
wxMenuBar::MacGetCommonMenuBar()->MacInstallMenuBar();
|
||||
}
|
||||
|
@@ -1025,35 +1025,13 @@ void wxApp::Dispatch()
|
||||
|
||||
void wxApp::OnIdle(wxIdleEvent& event)
|
||||
{
|
||||
// Avoid recursion (via ProcessEvent default case)
|
||||
if ( s_inOnIdle )
|
||||
return;
|
||||
|
||||
s_inOnIdle = TRUE;
|
||||
|
||||
// 'Garbage' collection of windows deleted with Close().
|
||||
DeletePendingObjects();
|
||||
|
||||
// flush the logged messages if any
|
||||
wxLog *pLog = wxLog::GetActiveTarget();
|
||||
if ( pLog != NULL && pLog->HasPendingMessages() )
|
||||
pLog->Flush();
|
||||
|
||||
// Now done in ProcessIdle()
|
||||
#if 0
|
||||
// Send OnIdle events to all windows
|
||||
bool needMore = SendIdleEvents();
|
||||
|
||||
if (needMore)
|
||||
event.RequestMore(TRUE);
|
||||
#endif
|
||||
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();
|
||||
|
||||
s_inOnIdle = FALSE;
|
||||
if(!wxMenuBar::MacGetInstalledMenuBar() && wxMenuBar::MacGetCommonMenuBar())
|
||||
wxMenuBar::MacGetCommonMenuBar()->MacInstallMenuBar();
|
||||
}
|
||||
|
@@ -204,7 +204,7 @@ static void wxDestroyMGL_WM()
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
|
||||
EVT_IDLE(wxApp::OnIdle)
|
||||
EVT_IDLE(wxAppBase::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
@@ -272,38 +272,6 @@ bool wxApp::OnInitGui()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxApp::OnIdle(wxIdleEvent &event)
|
||||
{
|
||||
static bool s_inOnIdle = FALSE;
|
||||
|
||||
/* Avoid recursion (via ProcessEvent default case) */
|
||||
if (s_inOnIdle)
|
||||
return;
|
||||
|
||||
s_inOnIdle = TRUE;
|
||||
|
||||
/* Resend in the main thread events which have been prepared in other
|
||||
threads */
|
||||
ProcessPendingEvents();
|
||||
|
||||
// 'Garbage' collection of windows deleted with Close().
|
||||
DeletePendingObjects();
|
||||
|
||||
#if wxUSE_LOG
|
||||
// flush the logged messages if any
|
||||
wxLog::FlushActive();
|
||||
#endif // wxUSE_LOG
|
||||
|
||||
// Now done in ProcessIdle()
|
||||
#if 0
|
||||
// Send OnIdle events to all windows
|
||||
if ( SendIdleEvents() )
|
||||
event.RequestMore(TRUE);
|
||||
#endif
|
||||
|
||||
s_inOnIdle = FALSE;
|
||||
}
|
||||
|
||||
int wxApp::MainLoop()
|
||||
{
|
||||
int rt;
|
||||
|
@@ -71,7 +71,7 @@ wxHashTable *wxWidgetHashTable = NULL;
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
|
||||
EVT_IDLE(wxApp::OnIdle)
|
||||
EVT_IDLE(wxAppBase::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
@@ -203,48 +203,6 @@ void wxApp::HandlePropertyChange(WXEvent *event)
|
||||
XtDispatchEvent((XEvent*) event); /* let Motif do the work */
|
||||
}
|
||||
|
||||
void wxApp::OnIdle(wxIdleEvent& event)
|
||||
{
|
||||
static bool inOnIdle = FALSE;
|
||||
|
||||
// Avoid recursion (via ProcessEvent default case)
|
||||
if (inOnIdle)
|
||||
return;
|
||||
|
||||
inOnIdle = TRUE;
|
||||
|
||||
// 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. Also removed the '#if wxUSE_THREADS' around it.
|
||||
// Changed Mar/2000 before 2.1.14
|
||||
|
||||
// Flush pending events.
|
||||
ProcessPendingEvents();
|
||||
|
||||
// 'Garbage' collection of windows deleted with Close().
|
||||
DeletePendingObjects();
|
||||
|
||||
// flush the logged messages if any
|
||||
wxLog *pLog = wxLog::GetActiveTarget();
|
||||
if ( pLog != NULL && pLog->HasPendingMessages() )
|
||||
pLog->Flush();
|
||||
|
||||
// Now done in ProcessIdle()
|
||||
#if 0
|
||||
// Send OnIdle events to all windows
|
||||
bool needMore = SendIdleEvents();
|
||||
|
||||
if (needMore)
|
||||
event.RequestMore(TRUE);
|
||||
#endif
|
||||
|
||||
inOnIdle = FALSE;
|
||||
}
|
||||
|
||||
static char *fallbackResources[] = {
|
||||
"*menuBar.marginHeight: 0",
|
||||
"*menuBar.shadowThickness: 1",
|
||||
|
@@ -803,22 +803,7 @@ void wxApp::OnIdle(wxIdleEvent& event)
|
||||
|
||||
wxIsInOnIdleFlag = TRUE;
|
||||
|
||||
// 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
|
||||
wxAppBase::OnIdle(event);
|
||||
|
||||
#if wxUSE_DC_CACHEING
|
||||
// automated DC cache management: clear the cached DCs and bitmap
|
||||
@@ -828,17 +813,6 @@ void wxApp::OnIdle(wxIdleEvent& event)
|
||||
wxDC::ClearCache();
|
||||
#endif // wxUSE_DC_CACHEING
|
||||
|
||||
// Now done in ProcessIdle()
|
||||
#if 0
|
||||
// Send OnIdle events to all windows
|
||||
if ( SendIdleEvents() )
|
||||
{
|
||||
// SendIdleEvents() returns TRUE if at least one window requested more
|
||||
// idle events
|
||||
event.RequestMore(TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
wxIsInOnIdleFlag = FALSE;
|
||||
}
|
||||
|
||||
|
@@ -778,24 +778,7 @@ void wxApp::OnIdle(
|
||||
|
||||
gbInOnIdle = TRUE;
|
||||
|
||||
//
|
||||
// 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
|
||||
//
|
||||
ProcessPendingEvents();
|
||||
|
||||
//
|
||||
// 'Garbage' collection of windows deleted with Close().
|
||||
//
|
||||
DeletePendingObjects();
|
||||
|
||||
#if wxUSE_LOG
|
||||
//
|
||||
// Flush the logged messages if any
|
||||
//
|
||||
wxLog::FlushActive();
|
||||
#endif // wxUSE_LOG
|
||||
wxAppBase::OnIdle(event);
|
||||
|
||||
#if wxUSE_DC_CACHEING
|
||||
// automated DC cache management: clear the cached DCs and bitmap
|
||||
@@ -807,21 +790,6 @@ void wxApp::OnIdle(
|
||||
wxDC::ClearCache();
|
||||
#endif // wxUSE_DC_CACHEING
|
||||
|
||||
// Now done in ProcessIdle()
|
||||
#if 0
|
||||
//
|
||||
// Send OnIdle events to all windows
|
||||
//
|
||||
if (SendIdleEvents())
|
||||
{
|
||||
//
|
||||
// SendIdleEvents() returns TRUE if at least one window requested more
|
||||
// idle events
|
||||
//
|
||||
rEvent.RequestMore(TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
gbInOnIdle = FALSE;
|
||||
} // end of wxApp::OnIdle
|
||||
|
||||
|
@@ -88,7 +88,7 @@ WXDisplay *wxApp::ms_display = NULL;
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
|
||||
EVT_IDLE(wxApp::OnIdle)
|
||||
EVT_IDLE(wxAppBase::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
bool wxApp::Initialize(int& argc, wxChar **argv)
|
||||
@@ -700,35 +700,6 @@ bool wxApp::HandlePropertyChange(WXEvent *event)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxApp::OnIdle(wxIdleEvent& event)
|
||||
{
|
||||
static bool s_inOnIdle = FALSE;
|
||||
|
||||
// Avoid recursion (via ProcessEvent default case)
|
||||
if (s_inOnIdle)
|
||||
return;
|
||||
|
||||
s_inOnIdle = TRUE;
|
||||
|
||||
// Resend in the main thread events which have been prepared in other
|
||||
// threads
|
||||
ProcessPendingEvents();
|
||||
|
||||
// 'Garbage' collection of windows deleted with Close()
|
||||
DeletePendingObjects();
|
||||
|
||||
// Now done in ProcessIdle()
|
||||
#if 0
|
||||
// Send OnIdle events to all windows
|
||||
bool needMore = SendIdleEvents();
|
||||
|
||||
if (needMore)
|
||||
event.RequestMore(TRUE);
|
||||
#endif
|
||||
|
||||
s_inOnIdle = FALSE;
|
||||
}
|
||||
|
||||
void wxApp::WakeUpIdle()
|
||||
{
|
||||
// TODO: use wxMotif implementation?
|
||||
|
Reference in New Issue
Block a user