diff --git a/src/post_modules/GTK2/source/global.pre b/src/post_modules/GTK2/source/global.pre
index 7ffb326f0a4b9ac0d8aa4d23fe51d7743ce23c92..bbf0f4cac5d604ec6cb38bf45f8b163368519a06 100644
--- a/src/post_modules/GTK2/source/global.pre
+++ b/src/post_modules/GTK2/source/global.pre
@@ -272,7 +272,13 @@ void flush()
 //! Flush GDK. Not normally needed, can be useful while doing calculations.
 {
   gdk_flush();
+
+#ifdef HAVE_GTK22
+  while(g_main_context_iteration(NULL,0));
+#else
   while(g_main_iteration( 0 ) );
+#endif
+
   pgtk2_pop_n_elems(args);
   push_int(0);
 }
@@ -329,7 +335,11 @@ int main_iteration_do(int block)
   INT_TYPE n;
   get_all_args( "gtk_main_iteration_do", args, "%i", &n );
   pgtk2_pop_n_elems(args);
+#ifdef HAVE_GTK22
+  push_int(g_main_context_iteration(NULL, n));
+#else
   push_int( g_main_iteration( n ) );
+#endif
 }
 
 int true()