diff --git a/src/post_modules/GTK/source/gdkatom.pre b/src/post_modules/GTK/source/gdkatom.pre
index 8b5fbc4c54ee35cf8a4a36ff5ffae5e2d4f3554c..7da1ef000f9eef8173a6777af3cef0b456bacb12 100644
--- a/src/post_modules/GTK/source/gdkatom.pre
+++ b/src/post_modules/GTK/source/gdkatom.pre
@@ -17,6 +17,6 @@ NAME_ARGS(atom_name, only_if_exists);
 FUNCTION(get_name, "function(void:string)");
 // Returns the name of the atom.
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_text( gdk_atom_name( (GdkAtom)THIS->obj ) );
 }
diff --git a/src/post_modules/GTK/source/gdkbitmap.pre b/src/post_modules/GTK/source/gdkbitmap.pre
index 1622d82b32c6aa2f13782d9319781f658ffeaeef..690140fa9e00b55d8793d3a7ceffd2309134fec5 100644
--- a/src/post_modules/GTK/source/gdkbitmap.pre
+++ b/src/post_modules/GTK/source/gdkbitmap.pre
@@ -32,7 +32,7 @@ NAME_ARGS(image|xsize, void|ysize, void|xbitmapdata);
   THIS->obj = (void *)gdk_bitmap_create_from_data(0, d, x, y);
   if(!THIS->obj)
     error("Failed to create bitmap\n");
-  pop_n_elems(args);
+  my_pop_n_elems(args);
 }
 
 FUNCTION(destroy, "function(void:void)");
diff --git a/src/post_modules/GTK/source/gdkcolor.pre b/src/post_modules/GTK/source/gdkcolor.pre
index 3f755134359fe521f146857e0cbf7b99cbab319f..3bff682c861e2125dc78863ead07300a2f6aed45 100644
--- a/src/post_modules/GTK/source/gdkcolor.pre
+++ b/src/post_modules/GTK/source/gdkcolor.pre
@@ -85,7 +85,7 @@ FUNCTION(image_color_object, "function(void:object)");
            ((GdkColor *)THIS->obj)->green,
            ((GdkColor *)THIS->obj)->blue );
 
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   pgtk_get_image_module();
   pgtk_index_stack( "Color" );
   pgtk_index_stack(colorname);
diff --git a/src/post_modules/GTK/source/gdkdragcontext.pre b/src/post_modules/GTK/source/gdkdragcontext.pre
index 212943a3104fec14e456d4767185c24f99f209b8..37fd79ae057f203eb6a2f40ccfb2fc57b6c70bb7 100644
--- a/src/post_modules/GTK/source/gdkdragcontext.pre
+++ b/src/post_modules/GTK/source/gdkdragcontext.pre
@@ -9,7 +9,7 @@ FUNCTION(get_source_widget, "function(void:object)");
 // Return the drag source widget.
 RETURNS(GTK.Widget);
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_gtkobjectclass(gtk_drag_get_source_widget(((GdkDragContext *)THIS->obj)),
                       pgtk_widget_program);
 }
diff --git a/src/post_modules/GTK/source/gdkimage.pre b/src/post_modules/GTK/source/gdkimage.pre
index 3ecf4fbd63e722c383717bee077a85544b5846dd..63b096387e7903c0126e3d33b3acb32eb3a02418 100644
--- a/src/post_modules/GTK/source/gdkimage.pre
+++ b/src/post_modules/GTK/source/gdkimage.pre
@@ -133,7 +133,7 @@ NAME_ARGS(x,y);
   int x, y;
   get_all_args("get_pixel", args, "%d%d", &x, &y);
   if(!THIS->obj) error("No image.\n");
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int( gdk_image_get_pixel( (void *)THIS->obj, x, y ) );
 }
 FUNCTION(set_pixel, "function(int,int,int:object)")
diff --git a/src/post_modules/GTK/source/gdkrectangle.pre b/src/post_modules/GTK/source/gdkrectangle.pre
index 251ae39cb09bd318289786b82adfed168d71972c..01b38ab3a2ebe5d08c134ad5f636986473acee6a 100644
--- a/src/post_modules/GTK/source/gdkrectangle.pre
+++ b/src/post_modules/GTK/source/gdkrectangle.pre
@@ -32,7 +32,7 @@ NAME_ARGS(type);
 
   if(!strcmp(type, "mapping"))
   {
-    pop_n_elems(args);
+    my_pop_n_elems(args);
     push_text( "x" );
     push_int( r->x );
     push_text( "y" );
@@ -43,7 +43,7 @@ NAME_ARGS(type);
     push_int( r->height );
     f_aggregate_mapping( 8 );
   } else if(!strcmp(type, "array")) {
-    pop_n_elems(args);
+    my_pop_n_elems(args);
     push_int( r->x );
     push_int( r->y );
     push_int( r->width );
diff --git a/src/post_modules/GTK/source/gdkregion.pre b/src/post_modules/GTK/source/gdkregion.pre
index 12b614e1dc33a3742cadfcd8a495592e8a1f521c..ff0402c4a62cc3f41f1c72e0192c13ce50cf6522 100644
--- a/src/post_modules/GTK/source/gdkregion.pre
+++ b/src/post_modules/GTK/source/gdkregion.pre
@@ -1,4 +1,16 @@
 PROGRAM(GdkRegion);
+
+static void return_gdkregion( int n, void *r )
+{
+  struct object *o;
+  my_pop_n_elems( n );
+  o = low_clone( pgtk_GdkRegion_program );
+  call_c_initializers( o );
+  ((struct object_wrapper *)o->storage)->obj = r;
+  push_object( o );
+}
+
+
 FUNCTION(create, "function(void:void)");
 // Create a new (empty) region
 // 
@@ -23,12 +35,12 @@ NAME_ARGS(victim);
   r = get_gdkobject( o, Region );
   if(!r)
   {
-    pop_n_elems(args);
+    my_pop_n_elems(args);
     push_int(0);
     return;
   } else {
     int eq = gdk_region_equal( (GdkRegion *)THIS->obj, r );
-    pop_n_elems(args);
+    my_pop_n_elems(args);
     push_int(eq);
   }
 }
@@ -39,7 +51,7 @@ NAME_ARGS(x,y);
 {
   int x, y;
   get_all_args( "point_in", args, "%d%d", &x, &y );
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int( gdk_region_point_in( (GdkRegion *)THIS->obj, x, y ) );
 }
 
@@ -56,7 +68,7 @@ NAME_ARGS(rectangle);
     error("Bad argument 1 to GDK.rect_in( GDK.Rectangle r )\n");
   } else {
     int b = gdk_region_rect_in((GdkRegion *)THIS->obj,  r);
-    pop_n_elems(args);
+    my_pop_n_elems(args);
     push_int( b );
   }
 }
@@ -106,11 +118,7 @@ NAME_ARGS(with);
     r = gdk_regions_union( (GdkRegion *)THIS->obj, v);
   else
     error("Bad argument to union: Not Region or Rectangle\n");
-  pop_n_elems(args);
-  o = low_clone( pgtk_GdkRegion_program );
-  call_c_initializers( o );
-  ((struct object_wrapper *)o->storage)->obj = (void *)r;
-  push_object( o );
+  return_gdkregion( args, r );
   return;
 }
 
@@ -130,11 +138,7 @@ NAME_ARGS(with);
   } else {
     error("Bad argument to intersect: Not a GDK.Region object\n");
   }
-  pop_n_elems(args);
-  o = low_clone( pgtk_GdkRegion_program );
-  call_c_initializers( o );
-  ((struct object_wrapper *)o->storage)->obj = (void *)r;
-  push_object( o );
+  return_gdkregion( args, r );
   return;
 }
 
@@ -154,11 +158,7 @@ NAME_ARGS(with);
   } else {
     error("Bad argument to subtract: Not a GDK.Region object\n");
   }
-  pop_n_elems(args);
-  o = low_clone( pgtk_GdkRegion_program );
-  call_c_initializers( o );
-  ((struct object_wrapper *)o->storage)->obj = (void *)r;
-  push_object( o );
+  return_gdkregion( args, r );
   return;
 }
 
@@ -178,10 +178,6 @@ NAME_ARGS(with);
   } else {
     error("Bad argument to xor: Not a GDK.Region object\n");
   }
-  pop_n_elems(args);
-  o = low_clone( pgtk_GdkRegion_program );
-  call_c_initializers( o );
-  ((struct object_wrapper *)o->storage)->obj = (void *)r;
-  push_object( o );
+  return_gdkregion( args, r );
   return;
 }
diff --git a/src/post_modules/GTK/source/gdkwindow.pre b/src/post_modules/GTK/source/gdkwindow.pre
index 856446e9e80457b8baf3cee8a3277b5e11bfb402..2609ab489819bf251bda5819edcc2b14e08915d9 100644
--- a/src/post_modules/GTK/source/gdkwindow.pre
+++ b/src/post_modules/GTK/source/gdkwindow.pre
@@ -42,14 +42,14 @@ NAME_ARGS(XWindowID|parent,void|atrributes);
 FUNCTION(is_viewable, "function(void:int)");
 // Return 1 if the window is mapped.
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int(gdk_window_is_viewable( (GdkWindow *)THIS->obj ));
 }
 
 FUNCTION(is_visible, "function(void:int)");
 // Return 1 if the window, or a part of the window, is visible right now.
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int(gdk_window_is_visible( (GdkWindow *)THIS->obj ));
 }
 
@@ -245,7 +245,7 @@ RETURNS(array(GDK.Window));
     n++;
     l = l->next;
   }
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   f_aggregate(n);
 }
 
@@ -476,7 +476,7 @@ NAME_ARGS( property, offset, delete_when_done );
                        &retdata ))
   {
     struct object *o;
-    pop_n_elems(args);
+    my_pop_n_elems(args);
     push_text( "type" );
     push_text( gdk_atom_name( actual_property_type ) );
     push_text( "width" );
@@ -500,7 +500,7 @@ NAME_ARGS( property, offset, delete_when_done );
     f_aggregate_mapping( 6 );
     return;
   }
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int( 0 );
 }
 
diff --git a/src/post_modules/GTK/source/global.pre b/src/post_modules/GTK/source/global.pre
index df2425f96003a914f6aed7ee8bffa5ef3eb64075..6127edd034d0f9e27d2c65bbe27e686273334d35 100644
--- a/src/post_modules/GTK/source/global.pre
+++ b/src/post_modules/GTK/source/global.pre
@@ -33,7 +33,7 @@ NAME_ARGS(rc);
   char *s;
   get_all_args("parse_rc", args, "%s", &s );
   gtk_rc_parse_string( s );
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int( 0 );
 /*   gtk_widget_propagate_default_style(); */
 }
@@ -46,7 +46,7 @@ FUNCTION(root_window, "function(void:object)");
 RETURNS(GDK.Window);
 // Returns the root window of the current display (as a GDK.Window)
 {
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   if(pgtk_root_window) 
   {
     ref_push_object( pgtk_root_window );
@@ -151,6 +151,7 @@ NAME_ARGS(argv, do_not_parse_rc);
   g_log_set_handler("Glib",G_LOG_LEVEL_ERROR,  (void *)do_error, NULL );
   g_log_set_handler("Glib",G_LOG_LEVEL_WARNING,(void *)do_error, NULL );
   g_log_set_handler("Glib",G_LOG_LEVEL_MESSAGE,(void *)do_error, NULL );
+  gtk_set_locale();
   gtk_init( &argc, &data );
   g_log_set_handler("Gdk",G_LOG_LEVEL_CRITICAL,(void *)do_error, NULL );
   g_log_set_handler("Gdk",G_LOG_LEVEL_ERROR,   (void *)do_error, NULL );
@@ -195,7 +196,7 @@ NAME_ARGS(argv, do_not_parse_rc);
 # error Fixme. This needs some work.
 #endif  
 
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   /*
    * Now it's time to return the leftovers.
    */
@@ -210,7 +211,7 @@ FUNCTION(flush, "function(void:void)")
 {
   gdk_flush();
   while(g_main_iteration( 0 ) );
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int(0);
 }
 
@@ -218,7 +219,7 @@ FUNCTION(low_flush, "function(void:void)")
 // Flush X. Not normally needed.
 {
   XFlush( GDK_DISPLAY() );
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   push_int( 0 );
 }
 
@@ -232,3 +233,68 @@ NAME_ARGS(argc,no_pgtkrc);
 }
 
 
+FUNCTION(main, "function(void:void)");
+// Start GTK in blocking mode.<br>
+// Doing this disables asynchronous I/O in pike.<br>
+// You can return -1 from main in pike to run GTK (and the rest of
+// pike) in asynchrounous mode.
+{
+  gtk_main();
+}
+
+FUNCTION(main_quit, "function(void:void)");
+// Exit from the gtk_main function on the next iteration.
+{
+  gtk_main_quit();
+}
+
+FUNCTION(main_level, "function(void:int)");
+// Return the current recursion depth.
+{
+  push_int( gtk_main_level() );
+}
+
+FUNCTION(main_iteration_do, "function(int:void)");
+NAME_ARGS(block);
+// Run one iteration in the mainloop. If block is true, wait for an
+// event before returning.
+{
+  int n;
+  get_all_args( "gtk_main_iteration_do", args, "%d", &n );
+  gtk_main_iteration_do( n );
+}
+
+FUNCTION(true, "function(void:int)");
+// Always returns true.
+// To be used as a signal function.
+{
+  push_int( 1 );
+}
+
+FUNCTION(false, "function(void:int)");
+// Always returns false.
+// To be used as a signal function.
+{
+  push_int( 0 );
+}
+
+FUNCTION(grab_add, "function(object:void)");
+ARGS(GTK.Widget);
+NAME_ARGS(widget);
+{
+  struct object *o;
+  get_all_args( "gtk_grab_add", args, "%o", &o );
+  gtk_grab_add( GTK_WIDGET( get_gtkobject( o ) ) );
+  my_pop_n_elems( args );
+}
+
+FUNCTION(grab_remove, "function(object:void)");
+ARGS(GTK.Widget);
+NAME_ARGS(widget);
+{
+  struct object *o;
+  get_all_args( "gtk_grab_remove", args, "%o", &o );
+  gtk_grab_remove( GTK_WIDGET( get_gtkobject( o ) ) );
+  my_pop_n_elems( args );
+}
+
diff --git a/src/post_modules/GTK/source/gtkaccelgroup.pre b/src/post_modules/GTK/source/gtkaccelgroup.pre
index b2acf4f9061834730fb05aa9ce56d9875a36583d..804f01714988a692ede2021001c1cbe0d4df8307 100644
--- a/src/post_modules/GTK/source/gtkaccelgroup.pre
+++ b/src/post_modules/GTK/source/gtkaccelgroup.pre
@@ -50,7 +50,7 @@ RETURNS(GTK.AccelGroup);
 /* { */
 /*   int k, mod; */
 /*   get_all_args("check", args, "%d%d", &k, &mod ); */
-/*   pop_n_elems(args); */
+/*   my_pop_n_elems(args); */
 /*   push_int( gtk_accelerator_table_check( (void *)THIS->obj, k, mod ) ); */
 /* } */
 /* FUNCTION(set_mod_mask, "function(int:object)") */
diff --git a/src/post_modules/GTK/source/gtkadjustment.pre b/src/post_modules/GTK/source/gtkadjustment.pre
index 506058ce005ab0198700603936966f1760379379..d2487d2c1fb05ef917637e89ff3253c17373936d 100644
--- a/src/post_modules/GTK/source/gtkadjustment.pre
+++ b/src/post_modules/GTK/source/gtkadjustment.pre
@@ -40,7 +40,7 @@ NAME_ARGS(value,lower,upper,step_increment,page_increment,page_size);
   if(!THIS->obj) 
     error("Failed to initiate adjustment\n");
   pgtk__init_this_object();
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int( 0 );
 }
 COMPLEX_FUNCTION(set_value, float);
diff --git a/src/post_modules/GTK/source/gtkbox.pre b/src/post_modules/GTK/source/gtkbox.pre
index 5337e0a5e22c2ef7de2520fe00821c136d703bc2..0cae677d5e1d3bc6faee2c013fb94a8f1bbc46c0 100644
--- a/src/post_modules/GTK/source/gtkbox.pre
+++ b/src/post_modules/GTK/source/gtkbox.pre
@@ -56,7 +56,7 @@ RETURNS("mapping(string:int)");
   gtk_box_query_child_packing( GTK_BOX( THIS->obj ), 
                                GTK_WIDGET( get_gtkobject( o ) ),
                                &ex, &fi, &pa, &ty );
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   push_constant_text( "expand" );
   push_int( ex );
   push_constant_text( "fill" );
diff --git a/src/post_modules/GTK/source/gtkbuttonbox.pre b/src/post_modules/GTK/source/gtkbuttonbox.pre
index 0bb77fd258cac26cc92387696b59230dd54ad436..7d549ac81540bc46f7d38a456be07da1c4056e87 100644
--- a/src/post_modules/GTK/source/gtkbuttonbox.pre
+++ b/src/post_modules/GTK/source/gtkbuttonbox.pre
@@ -27,7 +27,7 @@ FUNCTION(get_child_size, "function(void:mapping)");
 // Return the child size as ([ "x":xsize, "y":ysize ]) 
 {
   int x, y;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   gtk_button_box_get_child_size( GTK_BUTTON_BOX( THIS->obj ), &x, &y );
   push_constant_text( "x" );
   push_int( x );
@@ -39,7 +39,7 @@ FUNCTION(get_child_ipadding, "function(void:mapping)");
 // Return the default inter-child padding ([ "x":xpadding, "y":ypadding ]) 
 {
   int x, y;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   gtk_button_box_get_child_ipadding( GTK_BUTTON_BOX( THIS->obj ), &x, &y );
   push_constant_text( "x" );
   push_int( x );
diff --git a/src/post_modules/GTK/source/gtkclist.pre b/src/post_modules/GTK/source/gtkclist.pre
index 25e0b2460e905daae1131ccf85c51b0a7f60aebf..176ef682ad4750f8558e78f55a00c14bc47b11be 100644
--- a/src/post_modules/GTK/source/gtkclist.pre
+++ b/src/post_modules/GTK/source/gtkclist.pre
@@ -168,7 +168,7 @@ NAME_ARGS( row, column );
   gchar *p = NULL;
   get_all_args( "get_*", args, "%d%d", &x, &y );
 
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   gtk_clist_get_text( GTK_CLIST( THIS->obj ), x, y, &p );
   if(p)
     push_text(p);
@@ -210,7 +210,7 @@ NAME_ARGS( row, column );
   GdkBitmap *b = NULL;
   get_all_args( "get_*", args, "%d%d", &x, &y );
 
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   gtk_clist_get_pixmap( GTK_CLIST( THIS->obj ), x, y, &p, &b );
   push_text( "pixmap" );
   if(p)
@@ -273,7 +273,7 @@ NAME_ARGS( row, column );
   get_all_args( "get_*", args, "%d%d", &x, &y );
 
   gtk_clist_get_pixtext( GTK_CLIST( THIS->obj ), x, y, &t, &s, &p, &b );
-  pop_n_elems( args );
+  my_pop_n_elems( args );
 
   push_text( "spacing" );
   push_int( s );
@@ -424,7 +424,7 @@ NAME_ARGS(row);
   get_all_args( "get_row_data", args, "%d", &row );
 
   o = gtk_clist_get_row_data( GTK_CLIST( THIS->obj ), row );
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   if(o)
     ref_push_object( o );
   else
@@ -440,7 +440,7 @@ NAME_ARGS(data);
   struct object *o;
   get_all_args( "find_row_from_data", args, "%o", &o );
   row = gtk_clist_find_row_from_data( GTK_CLIST( THIS->obj ), o );
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int( row );
 }
 
@@ -471,7 +471,7 @@ RETURNS(mapping(string:int));
   get_all_args( "get_selection_info", args, "%d%d", &x, &y );
   gtk_clist_get_selection_info( GTK_CLIST( THIS->obj ), x, y, &r, &c );
 
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   push_text( "row" );
   push_int( r );
   push_text( "column" );
@@ -499,7 +499,7 @@ NAME_ARGS(row);
   GtkStyle *style;
   int row;
   get_all_args("get_foreground", args, "%d", &row );
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   if (row < 0 || row >= clist->rows)
     error("Invalid row.\n");
   clist_row = (g_list_nth (clist->row_list, row))->data;
@@ -529,7 +529,7 @@ NAME_ARGS(row);
   GtkStyle *style;
   int row;
   get_all_args("get_background", args, "%d", &row );
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   if (row < 0 || row >= clist->rows)
     error("Invalid row.\n");
   clist_row = (g_list_nth (clist->row_list, row))->data;
diff --git a/src/post_modules/GTK/source/gtkcontainer.pre b/src/post_modules/GTK/source/gtkcontainer.pre
index b5c2f034746ea71ec350673733f862b070c39e82..05fe29018de1a4b71ed201624dc25482608d44f1 100644
--- a/src/post_modules/GTK/source/gtkcontainer.pre
+++ b/src/post_modules/GTK/source/gtkcontainer.pre
@@ -46,7 +46,7 @@ RETURNS(array(GTK.Widget));
 {
   GList *g;
   int n = 0;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   g = gtk_container_children( GTK_CONTAINER( THIS->obj ) );
   while(g)
   {
diff --git a/src/post_modules/GTK/source/gtkctree.pre b/src/post_modules/GTK/source/gtkctree.pre
index 2ae3ccadd6b2623212eb4068d10a0ac152de4467..c33316f160dad9a4366f6c702631f20f7bbe018d 100644
--- a/src/post_modules/GTK/source/gtkctree.pre
+++ b/src/post_modules/GTK/source/gtkctree.pre
@@ -103,7 +103,7 @@ RETURNS(GTK.CTreeNode);
                                    is_leaf,
                                    expanded);
 
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_pgdkobject( sibling, pgtk_CTreeNode_program );
 }
 
@@ -201,7 +201,7 @@ NAME_ARGS(data,root);
   if(root)
     root_node = get_pgdkobject( root, pgtk_CTreeNode_program );
   row = gtk_ctree_find_by_row_data( GTK_CTREE( THIS->obj ), root_node, o );
-  pop_n_elems(args);
+  my_pop_n_elems(args);
 
   if(row == NULL)
     push_int( 0 );
@@ -293,7 +293,7 @@ NAME_ARGS( node, column );
   gchar *p = NULL;
   get_all_args( "get_*", args, "%o%d", &x, &y );
 
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   gtk_ctree_node_get_text( GTK_CTREE( THIS->obj ), 
                            get_pgdkobject(x,pgtk_CTreeNode_program), 
                            y, &p );
@@ -314,7 +314,7 @@ NAME_ARGS( row, column );
   GdkBitmap *b = NULL;
   get_all_args( "get_*", args, "%d%d", &x, &y );
 
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   gtk_ctree_node_get_pixmap( GTK_CTREE( THIS->obj ), 
                              get_pgdkobject(x,pgtk_CTreeNode_program),
                              y, &p, &b );
@@ -355,7 +355,7 @@ NAME_ARGS( row, column );
   gtk_ctree_node_get_pixtext( GTK_CTREE( THIS->obj ), 
                               get_pgdkobject(x,pgtk_CTreeNode_program),
                               y, &t, &s, &p, &b );
-  pop_n_elems( args );
+  my_pop_n_elems( args );
 
   push_text( "spacing" );
   push_int( s );
@@ -455,7 +455,7 @@ NAME_ARGS(node);
 
   o = gtk_ctree_node_get_row_data( GTK_CTREE( THIS->obj ),  
                                    get_pgdkobject(row,pgtk_CTreeNode_program));
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   if(o)
     ref_push_object( o );
   else
@@ -513,7 +513,7 @@ RETURNS(GTK.CTreeRow);
 // <b>DEPRECATED</b>, all CTreeRow functions are also available
 // directly in this object.
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_pgdkobject( GTK_CTREE_ROW( THIS->obj ), pgtk_CTreeRow_program );
 }
 
@@ -521,7 +521,7 @@ FUNCTION(parent, "function(void:object)");
 RETURNS(GTK.CTreeNode);
 // Returns the parent node
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_pgdkobject( GTK_CTREE_NODE(GTK_CTREE_ROW( THIS->obj )->parent), 
                    pgtk_CTreeNode_program );
 }
@@ -530,7 +530,7 @@ FUNCTION(child, "function(void:object)");
 RETURNS(GTK.CTreeNode);
 // Returns the first child node
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_pgdkobject( GTK_CTREE_NODE(GTK_CTREE_ROW( THIS->obj )->children), 
                    pgtk_CTreeNode_program );
 }
@@ -540,7 +540,7 @@ FUNCTION(next, "function(void:object)");
 RETURNS(GTK.CTreeNode);
 // Returns the next sibling (the next on the same  level)
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_pgdkobject( GTK_CTREE_NODE_NEXT( THIS->obj ), pgtk_CTreeNode_program );
 }
 
@@ -548,7 +548,7 @@ FUNCTION(prev, "function(void:object)");
 RETURNS(GTK.CTreeNode);
 // Returns the previous sibling (the next on the same level)
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_pgdkobject( GTK_CTREE_NODE_PREV( THIS->obj ), pgtk_CTreeNode_program );
 }
 
diff --git a/src/post_modules/GTK/source/gtkcurve.pre b/src/post_modules/GTK/source/gtkcurve.pre
index cfb1e7944990c2ec2be2582a422fbe36d26a2648..14069f49675b512a392708e88ff5b02be0c6f91c 100644
--- a/src/post_modules/GTK/source/gtkcurve.pre
+++ b/src/post_modules/GTK/source/gtkcurve.pre
@@ -13,7 +13,7 @@ NAME_ARGS(num_points);
   int num_points, q=0;
   gfloat *vector;
   get_all_args("get_vector", args, "%d", &num_points);
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   vector = malloc(sizeof(gfloat) * num_points);
   gtk_curve_get_vector( GTK_CURVE(THIS->obj), num_points, vector );
   while(q < num_points)
diff --git a/src/post_modules/GTK/source/gtkimage.pre b/src/post_modules/GTK/source/gtkimage.pre
index 8538b51e98cc3f1c44e40cba752f682a863d7edd..92d56387781dae5c74e029a4ff2bd7e99923c708 100644
--- a/src/post_modules/GTK/source/gtkimage.pre
+++ b/src/post_modules/GTK/source/gtkimage.pre
@@ -32,7 +32,7 @@ NAME_ARGS(image,mask);
   }
   THIS->obj = GTK_OBJECT( gtk_image_new( img, mask ) );
   pgtk__init_this_object();
-  pop_n_elems(args);
+  my_pop_n_elems(args);
 }
 
 FUNCTION(set, "function(object,object|void:object)")
@@ -72,7 +72,7 @@ FUNCTION(get, "function(void:mapping)");
 {
   GdkImage *v;
   GdkBitmap *m;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   gtk_image_get( GTK_IMAGE( THIS->obj ), &v, &m );
   push_text( "image" );
   if(v)
diff --git a/src/post_modules/GTK/source/gtklist.pre b/src/post_modules/GTK/source/gtklist.pre
index 37bce8affb6066a518b76c9eab3962404016acdc..997d284a06a0dcb42043e5bb8c4960531188caa9 100644
--- a/src/post_modules/GTK/source/gtklist.pre
+++ b/src/post_modules/GTK/source/gtklist.pre
@@ -10,7 +10,7 @@ RETURNS(array(GTK.Widget));
 {
   GList *s = GTK_LIST( THIS->obj )->selection;
   int j = 0;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   while( s )
   {
     push_gtkobjectclass( (void *)s->data, pgtk_list_item_program );
diff --git a/src/post_modules/GTK/source/gtkmenushell.pre b/src/post_modules/GTK/source/gtkmenushell.pre
index 14eba8f93fd2c3e85b1609c47a301b6c9dfe7ef0..8765083917ac60f4379178752d0a3cd213588354 100644
--- a/src/post_modules/GTK/source/gtkmenushell.pre
+++ b/src/post_modules/GTK/source/gtkmenushell.pre
@@ -49,7 +49,7 @@ RETURNS(array(GTK.MenuItem));
 {
   GList *g;
   int n = 0;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   g = GTK_MENU_SHELL( THIS->obj )->children;
   while(g)
   {
diff --git a/src/post_modules/GTK/source/gtknotebook.pre b/src/post_modules/GTK/source/gtknotebook.pre
index ea036a350d68c4179b3559f6d10df21a4e2dd705..29fd3a9ce28a1bed7d266d8801fb4f65201500ae 100644
--- a/src/post_modules/GTK/source/gtknotebook.pre
+++ b/src/post_modules/GTK/source/gtknotebook.pre
@@ -118,7 +118,7 @@ NAME_ARGS(page);
                                         &expand,
                                         &fill,
                                         &pack_type );
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_text( "expand" );
   push_int( expand );
   push_text( "fill" );
diff --git a/src/post_modules/GTK/source/gtkobject.pre b/src/post_modules/GTK/source/gtkobject.pre
index 18d7f90fe893439ba77780b7b543e9a19a7e1b72..c8fa919262fa4186d42e4e41e61d323bb9310b5f 100644
--- a/src/post_modules/GTK/source/gtkobject.pre
+++ b/src/post_modules/GTK/source/gtkobject.pre
@@ -14,7 +14,7 @@ FUNCTION(destroy, "function(void:void)");
     gtk_object_destroy( THIS->obj );
     THIS->obj = NULL;
   }
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int(0);
 }
 
@@ -104,7 +104,7 @@ NAME_ARGS(signal_name,callback_function,callback_arg);
   id = gtk_signal_connect_full(THIS->obj, a, 0, 
                                (void *)pgtk_signal_func_wrapper, b,
 			       (void *)pgtk_free_signal_data, FALSE, FALSE);
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int( id );
 }
 
diff --git a/src/post_modules/GTK/source/gtkpixmap.pre b/src/post_modules/GTK/source/gtkpixmap.pre
index 722ea43faa048aeac957205a76ea30857b9ed43d..e1185c112e94b30f0cb947c9301e9a6da6d419c6 100644
--- a/src/post_modules/GTK/source/gtkpixmap.pre
+++ b/src/post_modules/GTK/source/gtkpixmap.pre
@@ -40,7 +40,7 @@ NAME_ARGS(pixmap,mask);
     mask = get_gdkobject( b, Bitmap );
   THIS->obj = GTK_OBJECT( gtk_pixmap_new( img, mask ) );
   pgtk__init_this_object();
-  pop_n_elems(args);
+  my_pop_n_elems(args);
 }
 
 FUNCTION(set, "function(object,object|void:object)")
@@ -76,7 +76,7 @@ FUNCTION(get, "function(void:mapping)");
 //            "pixmap_insensitive":insensitive version of the pixmap <br>
 //          ]) <br>
 {
-  pop_n_elems( args );
+  my_pop_n_elems( args );
 
 
   push_text( "pixmap" );
diff --git a/src/post_modules/GTK/source/gtkradiomenuitem.pre b/src/post_modules/GTK/source/gtkradiomenuitem.pre
index 4ccca62a8d92bcefc072065839089f9c002cff78..8a914082f96309ae7ace9013692b8c55eaec77d2 100644
--- a/src/post_modules/GTK/source/gtkradiomenuitem.pre
+++ b/src/post_modules/GTK/source/gtkradiomenuitem.pre
@@ -27,7 +27,7 @@ NAME_ARGS(title,groupmember);
     THIS->obj=GTK_OBJECT(gtk_radio_menu_item_new_with_label(mylist,label));
   else
     THIS->obj=GTK_OBJECT(gtk_radio_menu_item_new(mylist));
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   pgtk__init_this_object();
 }
 
diff --git a/src/post_modules/GTK/source/gtkselectiondata.pre b/src/post_modules/GTK/source/gtkselectiondata.pre
index aa85dfe91e9f9acc42fca5db15ab83a1c85beaef..5f7401a2839944d93e0324ae08f1c75cfdff0cf6 100644
--- a/src/post_modules/GTK/source/gtkselectiondata.pre
+++ b/src/post_modules/GTK/source/gtkselectiondata.pre
@@ -8,7 +8,7 @@ FUNCTION(data, "function(void:string)");
 // or 32 bits per character).
 {
   int length = ((GtkSelectionData *)THIS->obj)->length;
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   if(length < 0)
   {
     push_int(0);
@@ -37,7 +37,7 @@ FUNCTION(format, "function(void:int)");
 // Returns the selction format.<br>
 // The format is the number of bits per character.
 {
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   push_int( ((GtkSelectionData *)THIS->obj)->format );
 }
 
@@ -47,7 +47,7 @@ FUNCTION(length, "function(void:int)");
 // The size of the data in characters (as returned by data()) is not
 // nessasarily the same.
 {
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   push_int( ((GtkSelectionData *)THIS->obj)->length );
 }
 
@@ -68,7 +68,7 @@ NAME_ARGS(data);
 }
 
 
-#define RETURN_GDKATOM(X) pop_n_elems(args); push_pgdkobject( ((void *)((GtkSelectionData *)THIS->obj)->X), pgtk_Gdk_Atom_program );
+#define RETURN_GDKATOM(X) my_pop_n_elems(args); push_pgdkobject( ((void *)((GtkSelectionData *)THIS->obj)->X), pgtk_Gdk_Atom_program );
 
 
 FUNCTION(target, "function(void:object)");
diff --git a/src/post_modules/GTK/source/gtksheet.pre b/src/post_modules/GTK/source/gtksheet.pre
index e8c377e7d4cfec9c74da82116ef21051b100dc23..1aaf40d80d8346ad18dd9ea6a4f16a0563ab170e 100644
--- a/src/post_modules/GTK/source/gtksheet.pre
+++ b/src/post_modules/GTK/source/gtksheet.pre
@@ -126,7 +126,7 @@ FUNCTION(get_attributes, "function(int,int:mapping)");
   int x, y;
   GtkSheetCellAttr attr;
   get_all_args( "get_attributes", args, "%d%d", &x, &y );
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   if( gtk_sheet_get_attributes( GTK_SHEET(THIS->obj),x,y, &attr ) )
   {
     push_text("justification"); 
@@ -203,7 +203,7 @@ FUNCTION(select_range, "function(void:mapping)");
 NAME_ARGS(x0,y0,x1,y1);
 {
   GtkSheetRange r;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   gtk_sheet_select_range( GTK_SHEET( THIS->obj ), &r );
   push_text( "x0" ); push_int( r.col0 );
   push_text( "y0" ); push_int( r.row0 );
@@ -215,7 +215,7 @@ FUNCTION(unselect_range, "function(void:mapping)");
 NAME_ARGS(x0,y0,x1,y1);
 {
   GtkSheetRange r;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   gtk_sheet_unselect_range( GTK_SHEET( THIS->obj ), &r );
   push_text( "x0" ); push_int( r.col0 );
   push_text( "y0" ); push_int( r.row0 );
@@ -227,7 +227,7 @@ int COMPLEX_FUNCTION(set_active_cell, int, int);
 FUNCTION(get_active_cell, "function(void:mapping)");
 {
   int x, y;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   gtk_sheet_get_active_cell( GTK_SHEET(THIS->obj), &x, &y );
   push_text( "row" ); push_int( x );
   push_text( "col" ); push_int( y );
@@ -239,7 +239,7 @@ string COMPLEX_FUNCTION(cell_get_text, int, int);
 COMPLEX_FUNCTION(cell_clear, int, int);
 FUNCTION(clear, "function(void:object)");
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   gtk_sheet_range_clear(GTK_SHEET(THIS->obj), NULL);
   RETURN_THIS();
 }
@@ -258,7 +258,7 @@ FUNCTION(get_pixel_info, "function(int,int:mapping)");
   int x, y, r, c;
   get_all_args( "get_pixel_info", args, "%d%d", &x, &y );
   
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   gtk_sheet_get_pixel_info( GTK_SHEET(THIS->obj),x,y, &r, &c );
   push_text( "row" ); push_int( r );
   push_text( "col" ); push_int( c );
diff --git a/src/post_modules/GTK/source/gtksocket.pre b/src/post_modules/GTK/source/gtksocket.pre
index 582a8c74a04372b9502a914ef866494968b9da01..6e2346e57190105dda2f0c33fdbaf9b9874c9406 100644
--- a/src/post_modules/GTK/source/gtksocket.pre
+++ b/src/post_modules/GTK/source/gtksocket.pre
@@ -30,14 +30,14 @@ FUNCTION(id, "function(void:int)");
 {
   if( !GTK_WIDGET( THIS->obj )->window )
     error("You must realize this widget before calling this function.\n");
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   push_int(GDK_WINDOW_XWINDOW( GTK_WIDGET( THIS->obj )->window ));
 }
 
 FUNCTION(has_plug, "function(void:int)");
 // Returns true if this socket is occupied
 {
-  pop_n_elems( args );
+  my_pop_n_elems( args );
   if( GTK_SOCKET( THIS->obj )->plug_window 
       || gtk_container_children( GTK_CONTAINER( THIS->obj )) )
     push_int( 1 );
diff --git a/src/post_modules/GTK/source/gtktext.pre b/src/post_modules/GTK/source/gtktext.pre
index c5daf850b7138d18021ef20357480b4205bf437e..19ccea873f8aea67b8b9345bb64c1318ea43ff7b 100644
--- a/src/post_modules/GTK/source/gtktext.pre
+++ b/src/post_modules/GTK/source/gtktext.pre
@@ -118,7 +118,7 @@ FUNCTION(get_text, "function(void:string)")
 {
   struct pike_string *res;
   unsigned int i;
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   res = begin_shared_string( gtk_text_get_length( GTK_TEXT( THIS->obj ) ) );
   for(i=0; i<(unsigned int)res->len; i++)
     res->str[i] = GTK_TEXT_INDEX( GTK_TEXT( THIS->obj ), i );
diff --git a/src/post_modules/GTK/source/gtkwidget.pre b/src/post_modules/GTK/source/gtkwidget.pre
index bc5a273f35961d744955cc74724f75512d460a0c..4055ea8eba034643f01244762e5a289494c1a338 100644
--- a/src/post_modules/GTK/source/gtkwidget.pre
+++ b/src/post_modules/GTK/source/gtkwidget.pre
@@ -136,7 +136,7 @@ FUNCTION(get_gdkwindow, "function(void:object)");
 RETURNS(GDK.Window);
 // Return the GDK.Window associated with this widget, if any.
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   if(GTK_WIDGET(THIS->obj)->window)
   {
     struct object *o;
@@ -613,7 +613,7 @@ NAME_ARGS(mask);
 // GTK.Visible.
 RETURNS(GTK.Widget);
 {
-  pop_n_elems(args);
+  my_pop_n_elems(args);
   push_int( GTK_WIDGET_FLAGS(GTK_WIDGET(THIS->obj)) | sp[-1].u.integer );
 }