add emission hook from RemoveIdleSource (was RemoveIdleTag); minor cleanup
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41082 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -53,7 +53,7 @@ public:
|
|||||||
#endif // __WXDEBUG__
|
#endif // __WXDEBUG__
|
||||||
|
|
||||||
guint m_idleTag;
|
guint m_idleTag;
|
||||||
void RemoveIdleTag();
|
void RemoveIdleSource();
|
||||||
|
|
||||||
// Used by the the wxGLApp and wxGLCanvas class for GL-based X visual
|
// Used by the the wxGLApp and wxGLCanvas class for GL-based X visual
|
||||||
// selection.
|
// selection.
|
||||||
|
@@ -135,7 +135,7 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
|||||||
|
|
||||||
// We need to remove idle callbacks or the loop will
|
// We need to remove idle callbacks or the loop will
|
||||||
// never finish.
|
// never finish.
|
||||||
wxTheApp->RemoveIdleTag();
|
RemoveIdleSource();
|
||||||
|
|
||||||
#if wxUSE_LOG
|
#if wxUSE_LOG
|
||||||
// disable log flushing from here because a call to wxYield() shouldn't
|
// disable log flushing from here because a call to wxYield() shouldn't
|
||||||
@@ -194,6 +194,13 @@ event_emission_hook(GSignalInvocationHint*, guint, const GValue*, gpointer)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void wxAddEmissionHook()
|
||||||
|
{
|
||||||
|
// add emission hook for "event" signal, to re-install idle handler when needed
|
||||||
|
guint sig_id = g_signal_lookup("event", GTK_TYPE_WIDGET);
|
||||||
|
g_signal_add_emission_hook(sig_id, 0, event_emission_hook, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static gint wxapp_idle_callback( gpointer WXUNUSED(data) )
|
static gint wxapp_idle_callback( gpointer WXUNUSED(data) )
|
||||||
{
|
{
|
||||||
if (!wxTheApp)
|
if (!wxTheApp)
|
||||||
@@ -233,11 +240,7 @@ static gint wxapp_idle_callback( gpointer WXUNUSED(data) )
|
|||||||
gdk_threads_leave();
|
gdk_threads_leave();
|
||||||
|
|
||||||
if (!moreIdles)
|
if (!moreIdles)
|
||||||
{
|
wxAddEmissionHook();
|
||||||
// add emission hook for "event" signal, to re-install idle handler when needed
|
|
||||||
guint sig_id = g_signal_lookup("event", GTK_TYPE_WIDGET);
|
|
||||||
g_signal_add_emission_hook(sig_id, 0, event_emission_hook, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return FALSE if no more idle events are to be sent
|
// Return FALSE if no more idle events are to be sent
|
||||||
return moreIdles;
|
return moreIdles;
|
||||||
@@ -600,15 +603,16 @@ void wxApp::OnAssertFailure(const wxChar *file,
|
|||||||
|
|
||||||
#endif // __WXDEBUG__
|
#endif // __WXDEBUG__
|
||||||
|
|
||||||
void wxApp::RemoveIdleTag()
|
void wxApp::RemoveIdleSource()
|
||||||
{
|
{
|
||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
wxMutexLocker lock(gs_idleTagsMutex);
|
wxMutexLocker lock(gs_idleTagsMutex);
|
||||||
#endif
|
#endif
|
||||||
if (!g_isIdle)
|
if (m_idleTag != 0)
|
||||||
{
|
{
|
||||||
g_source_remove( wxTheApp->m_idleTag );
|
g_source_remove(m_idleTag);
|
||||||
wxTheApp->m_idleTag = 0;
|
m_idleTag = 0;
|
||||||
g_isIdle = true;
|
g_isIdle = true;
|
||||||
|
wxAddEmissionHook();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -101,7 +101,7 @@ bool wxEventLoop::Pending() const
|
|||||||
{
|
{
|
||||||
// We need to remove idle callbacks or gtk_events_pending will
|
// We need to remove idle callbacks or gtk_events_pending will
|
||||||
// never return false.
|
// never return false.
|
||||||
wxTheApp->RemoveIdleTag();
|
wxTheApp->RemoveIdleSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
return gtk_events_pending();
|
return gtk_events_pending();
|
||||||
|
Reference in New Issue
Block a user