- // Allow another idle source to be added while this one is busy.
- // Needed if an idle event handler runs a new event loop,
- // for example by showing a dialog.
-#if wxUSE_THREADS
- wxMutexLocker lock(gs_idleTagsMutex);
-#endif
- idleID_save = wxTheApp->m_idleTag;
- wxTheApp->m_idleTag = 0;
- g_isIdle = true;
- wxAddEmissionHook();
- }
-
- // When getting called from GDK's time-out handler
- // we are no longer within GDK's grab on the GUI
- // thread so we must lock it here ourselves.
- gdk_threads_enter();
-
- // Send idle event to all who request them as long as
- // no events have popped up in the event queue.
- do {
- moreIdles = wxTheApp->ProcessIdle();
- } while (moreIdles && gtk_events_pending() == 0);
-
- // Release lock again
- gdk_threads_leave();
-
- {
- // If another idle source was added, remove it
-#if wxUSE_THREADS
- wxMutexLocker lock(gs_idleTagsMutex);
-#endif
- if (wxTheApp->m_idleTag != 0)
- g_source_remove(wxTheApp->m_idleTag);
- wxTheApp->m_idleTag = idleID_save;
- g_isIdle = false;
+ static guint sig_id = 0;
+ if (sig_id == 0)
+ sig_id = g_signal_lookup("event", GTK_TYPE_WIDGET);
+ hook_id = g_signal_add_emission_hook(
+ sig_id, 0, wx_emission_hook, &hook_id, NULL);