- /* re-add idle handler */
- wxTheApp->m_idleTag = gtk_idle_add( wxapp_idle_callback, (gpointer) NULL );
+// One-shot signal emission hook, to install idle handler.
+extern "C" {
+static gboolean
+wx_emission_hook(GSignalInvocationHint*, guint, const GValue*, gpointer data)
+{
+ wxApp* app = wxTheApp;
+ if (app != NULL)
+ app->WakeUpIdle();
+ gulong* hook_id = (gulong*)data;
+ // record that hook is not installed
+ *hook_id = 0;
+ // remove hook
+ return false;
+}
+}
+
+// Add signal emission hooks, to re-install idle handler when needed.
+static void wx_add_idle_hooks()
+{
+ // "event" hook
+ {
+ static gulong hook_id = 0;
+ if (hook_id == 0)
+ {
+ 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);
+ }