Change idle behvaiour with regard to wxIdleEvent::RequestMore().
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13881 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -125,12 +125,13 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
|||||||
while (gtk_events_pending())
|
while (gtk_events_pending())
|
||||||
gtk_main_iteration();
|
gtk_main_iteration();
|
||||||
|
|
||||||
/* it's necessary to call ProcessIdle() to update the frames sizes which
|
// It's necessary to call ProcessIdle() to update the frames sizes which
|
||||||
might have been changed (it also will update other things set from
|
// might have been changed (it also will update other things set from
|
||||||
OnUpdateUI() which is a nice (and desired) side effect) */
|
// OnUpdateUI() which is a nice (and desired) side effect). But we
|
||||||
while ( ProcessIdle() )
|
// call ProcessIdle() only once since this is not meant for longish
|
||||||
{
|
// background jobs (controlled by wxIdleEvent::RequestMore() and the
|
||||||
}
|
// return value of Processidle().
|
||||||
|
ProcessIdle();
|
||||||
|
|
||||||
// let the logs be flashed again
|
// let the logs be flashed again
|
||||||
wxLog::Resume();
|
wxLog::Resume();
|
||||||
@@ -190,17 +191,17 @@ gint wxapp_pending_callback( gpointer WXUNUSED(data) )
|
|||||||
{
|
{
|
||||||
if (!wxTheApp) return TRUE;
|
if (!wxTheApp) return TRUE;
|
||||||
|
|
||||||
// when getting called from GDK's time-out handler
|
// When getting called from GDK's time-out handler
|
||||||
// we are no longer within GDK's grab on the GUI
|
// we are no longer within GDK's grab on the GUI
|
||||||
// thread so we must lock it here ourselves
|
// thread so we must lock it here ourselves.
|
||||||
gdk_threads_enter();
|
gdk_threads_enter();
|
||||||
|
|
||||||
// Sent idle event to all who request them
|
// Sent idle event to all who request them.
|
||||||
wxTheApp->ProcessPendingEvents();
|
wxTheApp->ProcessPendingEvents();
|
||||||
|
|
||||||
g_pendingTag = 0;
|
g_pendingTag = 0;
|
||||||
|
|
||||||
/* flush the logged messages if any */
|
// Flush the logged messages if any.
|
||||||
#if wxUSE_LOG
|
#if wxUSE_LOG
|
||||||
wxLog::FlushActive();
|
wxLog::FlushActive();
|
||||||
#endif // wxUSE_LOG
|
#endif // wxUSE_LOG
|
||||||
@@ -228,28 +229,26 @@ gint wxapp_idle_callback( gpointer WXUNUSED(data) )
|
|||||||
}
|
}
|
||||||
#endif // __WXDEBUG__
|
#endif // __WXDEBUG__
|
||||||
|
|
||||||
// when getting called from GDK's time-out handler
|
// When getting called from GDK's time-out handler
|
||||||
// we are no longer within GDK's grab on the GUI
|
// we are no longer within GDK's grab on the GUI
|
||||||
// thread so we must lock it here ourselves
|
// thread so we must lock it here ourselves.
|
||||||
gdk_threads_enter();
|
gdk_threads_enter();
|
||||||
|
|
||||||
/* Indicate that we are now in idle mode - even so deeply
|
// Indicate that we are now in idle mode and event handlers
|
||||||
in idle mode that we don't get any idle events anymore.
|
// will have to reinstall the idle handler again.
|
||||||
this is like wxMSW where an idle event is sent only
|
|
||||||
once each time after the event queue has been completely
|
|
||||||
emptied */
|
|
||||||
g_isIdle = TRUE;
|
g_isIdle = TRUE;
|
||||||
wxTheApp->m_idleTag = 0;
|
wxTheApp->m_idleTag = 0;
|
||||||
|
|
||||||
// Sent idle event to all who request them as long as they do
|
// Sent idle event to all who request them as long as
|
||||||
while (wxTheApp->ProcessIdle())
|
// no events have popped up in the event queue.
|
||||||
|
while (wxTheApp->ProcessIdle() && (gtk_events_pending() == 0))
|
||||||
;
|
;
|
||||||
|
|
||||||
// Release lock again
|
// Release lock again
|
||||||
gdk_threads_leave();
|
gdk_threads_leave();
|
||||||
|
|
||||||
// Return FALSE to indicate that no more idle events are
|
// Return FALSE to indicate that no more idle events are
|
||||||
// to be sent (single shot instead of continuous stream)
|
// to be sent (single shot instead of continuous stream).
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -501,20 +500,20 @@ void wxApp::OnIdle( wxIdleEvent &event )
|
|||||||
{
|
{
|
||||||
static bool s_inOnIdle = FALSE;
|
static bool s_inOnIdle = FALSE;
|
||||||
|
|
||||||
/* Avoid recursion (via ProcessEvent default case) */
|
// Avoid recursion (via ProcessEvent default case)
|
||||||
if (s_inOnIdle)
|
if (s_inOnIdle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
s_inOnIdle = TRUE;
|
s_inOnIdle = TRUE;
|
||||||
|
|
||||||
/* Resend in the main thread events which have been prepared in other
|
// Resend in the main thread events which have been prepared in other
|
||||||
threads */
|
// threads
|
||||||
ProcessPendingEvents();
|
ProcessPendingEvents();
|
||||||
|
|
||||||
/* 'Garbage' collection of windows deleted with Close(). */
|
// 'Garbage' collection of windows deleted with Close()
|
||||||
DeletePendingObjects();
|
DeletePendingObjects();
|
||||||
|
|
||||||
/* Send OnIdle events to all windows */
|
// Send OnIdle events to all windows
|
||||||
bool needMore = SendIdleEvents();
|
bool needMore = SendIdleEvents();
|
||||||
|
|
||||||
if (needMore)
|
if (needMore)
|
||||||
|
@@ -125,12 +125,13 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
|||||||
while (gtk_events_pending())
|
while (gtk_events_pending())
|
||||||
gtk_main_iteration();
|
gtk_main_iteration();
|
||||||
|
|
||||||
/* it's necessary to call ProcessIdle() to update the frames sizes which
|
// It's necessary to call ProcessIdle() to update the frames sizes which
|
||||||
might have been changed (it also will update other things set from
|
// might have been changed (it also will update other things set from
|
||||||
OnUpdateUI() which is a nice (and desired) side effect) */
|
// OnUpdateUI() which is a nice (and desired) side effect). But we
|
||||||
while ( ProcessIdle() )
|
// call ProcessIdle() only once since this is not meant for longish
|
||||||
{
|
// background jobs (controlled by wxIdleEvent::RequestMore() and the
|
||||||
}
|
// return value of Processidle().
|
||||||
|
ProcessIdle();
|
||||||
|
|
||||||
// let the logs be flashed again
|
// let the logs be flashed again
|
||||||
wxLog::Resume();
|
wxLog::Resume();
|
||||||
@@ -190,17 +191,17 @@ gint wxapp_pending_callback( gpointer WXUNUSED(data) )
|
|||||||
{
|
{
|
||||||
if (!wxTheApp) return TRUE;
|
if (!wxTheApp) return TRUE;
|
||||||
|
|
||||||
// when getting called from GDK's time-out handler
|
// When getting called from GDK's time-out handler
|
||||||
// we are no longer within GDK's grab on the GUI
|
// we are no longer within GDK's grab on the GUI
|
||||||
// thread so we must lock it here ourselves
|
// thread so we must lock it here ourselves.
|
||||||
gdk_threads_enter();
|
gdk_threads_enter();
|
||||||
|
|
||||||
// Sent idle event to all who request them
|
// Sent idle event to all who request them.
|
||||||
wxTheApp->ProcessPendingEvents();
|
wxTheApp->ProcessPendingEvents();
|
||||||
|
|
||||||
g_pendingTag = 0;
|
g_pendingTag = 0;
|
||||||
|
|
||||||
/* flush the logged messages if any */
|
// Flush the logged messages if any.
|
||||||
#if wxUSE_LOG
|
#if wxUSE_LOG
|
||||||
wxLog::FlushActive();
|
wxLog::FlushActive();
|
||||||
#endif // wxUSE_LOG
|
#endif // wxUSE_LOG
|
||||||
@@ -228,28 +229,26 @@ gint wxapp_idle_callback( gpointer WXUNUSED(data) )
|
|||||||
}
|
}
|
||||||
#endif // __WXDEBUG__
|
#endif // __WXDEBUG__
|
||||||
|
|
||||||
// when getting called from GDK's time-out handler
|
// When getting called from GDK's time-out handler
|
||||||
// we are no longer within GDK's grab on the GUI
|
// we are no longer within GDK's grab on the GUI
|
||||||
// thread so we must lock it here ourselves
|
// thread so we must lock it here ourselves.
|
||||||
gdk_threads_enter();
|
gdk_threads_enter();
|
||||||
|
|
||||||
/* Indicate that we are now in idle mode - even so deeply
|
// Indicate that we are now in idle mode and event handlers
|
||||||
in idle mode that we don't get any idle events anymore.
|
// will have to reinstall the idle handler again.
|
||||||
this is like wxMSW where an idle event is sent only
|
|
||||||
once each time after the event queue has been completely
|
|
||||||
emptied */
|
|
||||||
g_isIdle = TRUE;
|
g_isIdle = TRUE;
|
||||||
wxTheApp->m_idleTag = 0;
|
wxTheApp->m_idleTag = 0;
|
||||||
|
|
||||||
// Sent idle event to all who request them as long as they do
|
// Sent idle event to all who request them as long as
|
||||||
while (wxTheApp->ProcessIdle())
|
// no events have popped up in the event queue.
|
||||||
|
while (wxTheApp->ProcessIdle() && (gtk_events_pending() == 0))
|
||||||
;
|
;
|
||||||
|
|
||||||
// Release lock again
|
// Release lock again
|
||||||
gdk_threads_leave();
|
gdk_threads_leave();
|
||||||
|
|
||||||
// Return FALSE to indicate that no more idle events are
|
// Return FALSE to indicate that no more idle events are
|
||||||
// to be sent (single shot instead of continuous stream)
|
// to be sent (single shot instead of continuous stream).
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -501,20 +500,20 @@ void wxApp::OnIdle( wxIdleEvent &event )
|
|||||||
{
|
{
|
||||||
static bool s_inOnIdle = FALSE;
|
static bool s_inOnIdle = FALSE;
|
||||||
|
|
||||||
/* Avoid recursion (via ProcessEvent default case) */
|
// Avoid recursion (via ProcessEvent default case)
|
||||||
if (s_inOnIdle)
|
if (s_inOnIdle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
s_inOnIdle = TRUE;
|
s_inOnIdle = TRUE;
|
||||||
|
|
||||||
/* Resend in the main thread events which have been prepared in other
|
// Resend in the main thread events which have been prepared in other
|
||||||
threads */
|
// threads
|
||||||
ProcessPendingEvents();
|
ProcessPendingEvents();
|
||||||
|
|
||||||
/* 'Garbage' collection of windows deleted with Close(). */
|
// 'Garbage' collection of windows deleted with Close()
|
||||||
DeletePendingObjects();
|
DeletePendingObjects();
|
||||||
|
|
||||||
/* Send OnIdle events to all windows */
|
// Send OnIdle events to all windows
|
||||||
bool needMore = SendIdleEvents();
|
bool needMore = SendIdleEvents();
|
||||||
|
|
||||||
if (needMore)
|
if (needMore)
|
||||||
|
Reference in New Issue
Block a user