diff --git a/src/post_modules/GTK2/source/global.pre b/src/post_modules/GTK2/source/global.pre
index 991a0a47e97db7da63f59f70857f1ebee0fc0977..e928354b7f1b940f6837849e2cc0f4b6b6ed3892 100644
--- a/src/post_modules/GTK2/source/global.pre
+++ b/src/post_modules/GTK2/source/global.pre
@@ -278,7 +278,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);
 }
@@ -335,7 +341,11 @@ int main_iteration_do(int block)
   INT_TYPE n;
   get_all_args( "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()