[gtk+/gtk-2-22] Revert "Deprecate the GdkRegion API"



commit fd20ac0751cd4e536106654bd161244269e48755
Author: Benjamin Otte <otte redhat com>
Date:   Wed May 26 09:25:35 2010 +0200

    Revert "Deprecate the GdkRegion API"
    
    This reverts commit 821dd33918d80a28a7e47a2aaa2aaaf100b51c1b.

 docs/reference/gdk/tmpl/windows.sgml |    4 +-
 gdk/directfb/gdkdrawable-directfb.c  |   26 +-
 gdk/directfb/gdkgeometry-directfb.c  |   52 ++--
 gdk/directfb/gdkwindow-directfb.c    |    6 +-
 gdk/gdk.symbols                      |   10 -
 gdk/gdkdraw.c                        |   16 +-
 gdk/gdkevents.c                      |    4 +-
 gdk/gdkgc.c                          |   38 +-
 gdk/gdkoffscreenwindow.c             |    4 +-
 gdk/gdkpango.c                       |   10 +-
 gdk/gdkpolyreg-generic.c             |    2 +-
 gdk/gdkregion-generic.c              |   37 --
 gdk/gdkregion.h                      |    9 -
 gdk/gdkwindow.c                      |  600 +++++++++++++++++-----------------
 gdk/quartz/GdkQuartzView.c           |   10 +-
 gdk/quartz/gdkgc-quartz.c            |   17 +-
 gdk/quartz/gdkgeometry-quartz.c      |   17 +-
 gdk/quartz/gdkprivate-quartz.h       |    4 +-
 gdk/quartz/gdkwindow-quartz.c        |  113 ++++---
 gdk/win32/gdkdrawable-win32.c        |   12 +-
 gdk/win32/gdkevents-win32.c          |   10 +-
 gdk/win32/gdkgeometry-win32.c        |   16 +-
 gdk/x11/gdkdnd-x11.c                 |   10 +-
 gdk/x11/gdkevents-x11.c              |    2 +-
 gdk/x11/gdkgeometry-x11.c            |   28 +-
 gdk/x11/gdkwindow-x11.c              |   25 +-
 gtk/gtkcontainer.c                   |    4 +-
 gtk/gtkiconview.c                    |   27 +-
 gtk/gtklabel.c                       |   10 +-
 gtk/gtktextdisplay.c                 |   12 +-
 gtk/gtktreeitem.c                    |    4 +-
 gtk/gtktreeview.c                    |   41 ++--
 gtk/gtkwidget.c                      |   30 +-
 tests/testgtk.c                      |    8 +-
 34 files changed, 589 insertions(+), 629 deletions(-)
---
diff --git a/docs/reference/gdk/tmpl/windows.sgml b/docs/reference/gdk/tmpl/windows.sgml
index 25f451e..9f62167 100644
--- a/docs/reference/gdk/tmpl/windows.sgml
+++ b/docs/reference/gdk/tmpl/windows.sgml
@@ -85,8 +85,8 @@ window_expose_event (GtkWidget      *widget,
                                child->allocation.y);
 
   /* draw no more than our expose event intersects our child */
-  region = cairo_region_create_rectangle (&child->allocation);
-  cairo_region_intersect (region, event->region);
+  region = gdk_region_rectangle (&child->allocation);
+  gdk_region_intersect (region, event->region);
   gdk_cairo_region (cr, region);
   cairo_clip (cr);
 
diff --git a/gdk/directfb/gdkdrawable-directfb.c b/gdk/directfb/gdkdrawable-directfb.c
index b37c3fd..3406f08 100644
--- a/gdk/directfb/gdkdrawable-directfb.c
+++ b/gdk/directfb/gdkdrawable-directfb.c
@@ -258,7 +258,7 @@ gdk_directfb_clip_region (GdkDrawable  *drawable,
                    GDKDFB_RECTANGLE_VALS_FROM_BOX( &private->paint_region.extents ),
                    private->paint_region.numRects );
 
-    cairo_region_intersect (ret_clip, &private->paint_region);
+    gdk_region_intersect (ret_clip, &private->paint_region);
   }
 
   if (gc)
@@ -273,13 +273,13 @@ gdk_directfb_clip_region (GdkDrawable  *drawable,
 
           if (gc->clip_x_origin || gc->clip_y_origin)
             {
-              cairo_region_translate (ret_clip, -gc->clip_x_origin, -gc->clip_y_origin);
-              cairo_region_intersect (ret_clip, region);
-              cairo_region_translate (ret_clip, gc->clip_x_origin, gc->clip_y_origin);
+              gdk_region_offset (ret_clip, -gc->clip_x_origin, -gc->clip_y_origin);
+              gdk_region_intersect (ret_clip, region);
+              gdk_region_offset (ret_clip, gc->clip_x_origin, gc->clip_y_origin);
             }
           else
             {
-              cairo_region_intersect (ret_clip, region);
+              gdk_region_intersect (ret_clip, region);
             }
         }
 
@@ -327,7 +327,7 @@ gdk_directfb_clip_region (GdkDrawable  *drawable,
           D_DEBUG_AT( GDKDFB_DrawClip, "  -> clipping child    [ %4d,%4d - %4dx%4d ]  (%ld boxes)\n",
                       GDKDFB_RECTANGLE_VALS_FROM_BOX( &temp.extents ), temp.numRects );
 
-          cairo_region_subtract (ret_clip, &temp);
+          gdk_region_subtract (ret_clip, &temp);
         }
     }
 
@@ -763,7 +763,7 @@ gdk_directfb_draw_points (GdkDrawable *drawable,
 
   while (npoints > 0)
     {
-      if (cairo_region_contains_point (&clip, points->x, points->y))
+      if (gdk_region_point_in (&clip, points->x, points->y))
         {
           impl->surface->FillRectangle (impl->surface,
                                         points->x, points->y, 1, 1);
@@ -964,7 +964,7 @@ gdk_directfb_draw_image (GdkDrawable *drawable,
 
   gdk_directfb_clip_region (drawable, gc, &dest_rect, &clip);
 
-  if (!cairo_region_is_empty (&clip))
+  if (!gdk_region_empty (&clip))
     {
       DFBRectangle  src_rect = { xsrc, ysrc, width, height };
 
@@ -1242,15 +1242,15 @@ gdk_directfb_draw_pixbuf (GdkDrawable  *drawable,
   tmp_rect.width = width;
   tmp_rect.height = height;
 
-  drect = cairo_region_create_rectangle (&tmp_rect);
+  drect = gdk_region_rectangle (&tmp_rect);
   clip = gdk_drawable_get_clip_region (drawable);
 
-  cairo_region_intersect (drect, clip);
+  gdk_region_intersect (drect, clip);
 
-  cairo_region_get_extents (drect, &tmp_rect);
+  gdk_region_get_clipbox (drect, &tmp_rect);
   
-  cairo_region_destroy (drect);
-  cairo_region_destroy (clip);
+  gdk_region_destroy (drect);
+  gdk_region_destroy (clip);
 
   if (tmp_rect.width == 0 ||
       tmp_rect.height == 0)
diff --git a/gdk/directfb/gdkgeometry-directfb.c b/gdk/directfb/gdkgeometry-directfb.c
index bddc2dd..f848956 100644
--- a/gdk/directfb/gdkgeometry-directfb.c
+++ b/gdk/directfb/gdkgeometry-directfb.c
@@ -91,24 +91,24 @@ _gdk_directfb_window_scroll (GdkWindow *window,
 
   /* Move the current invalid region */
   if (private->update_area)
-    cairo_region_translate (private->update_area, dx, dy);
+    gdk_region_offset (private->update_area, dx, dy);
 
   if (GDK_WINDOW_IS_MAPPED (window))
     {
       GdkRectangle  clip_rect = {  0,  0, impl->width, impl->height };
       GdkRectangle  rect      = { dx, dy, impl->width, impl->height };
 
-      invalidate_region = cairo_region_create_rectangle (&clip_rect);
+      invalidate_region = gdk_region_rectangle (&clip_rect);
 
       if (gdk_rectangle_intersect (&rect, &clip_rect, &rect) &&
           (!private->update_area ||
-           !cairo_region_contains_rectangle (private->update_area, &rect)))
+           !gdk_region_rect_in (private->update_area, &rect)))
         {
           GdkRegion *region;
 
-          region = cairo_region_create_rectangle (&rect);
-          cairo_region_subtract (invalidate_region, region);
-          cairo_region_destroy (region);
+          region = gdk_region_rectangle (&rect);
+          gdk_region_subtract (invalidate_region, region);
+          gdk_region_destroy (region);
 
           if (impl->surface)
             {
@@ -141,7 +141,7 @@ _gdk_directfb_window_scroll (GdkWindow *window,
   if (invalidate_region)
     {
       gdk_window_invalidate_region (window, invalidate_region, TRUE);
-      cairo_region_destroy (invalidate_region);
+      gdk_region_destroy (invalidate_region);
     }
 }
 
@@ -188,31 +188,31 @@ _gdk_directfb_window_move_region (GdkWindow       *window,
     return;
 
   GdkRectangle  clip_rect = {  0,  0, impl->width, impl->height };
-  window_clip = cairo_region_create_rectangle (&clip_rect);
+  window_clip = gdk_region_rectangle (&clip_rect);
 
   /* compute source regions */
-  src_region = cairo_region_copy (region);
-  brought_in = cairo_region_copy (region);
-  cairo_region_intersect (src_region, window_clip);
+  src_region = gdk_region_copy (region);
+  brought_in = gdk_region_copy (region);
+  gdk_region_intersect (src_region, window_clip);
 
-  cairo_region_subtract (brought_in, src_region);
-  cairo_region_translate (brought_in, dx, dy);
+  gdk_region_subtract (brought_in, src_region);
+  gdk_region_offset (brought_in, dx, dy);
 
   /* compute destination regions */
-  dest_region = cairo_region_copy (src_region);
-  cairo_region_translate (dest_region, dx, dy);
-  cairo_region_intersect (dest_region, window_clip);
-  cairo_region_get_extents (dest_region, &dest_extents);
+  dest_region = gdk_region_copy (src_region);
+  gdk_region_offset (dest_region, dx, dy);
+  gdk_region_intersect (dest_region, window_clip);
+  gdk_region_get_clipbox (dest_region, &dest_extents);
 
-  cairo_region_destroy (window_clip);
+  gdk_region_destroy (window_clip);
 
   /* calculating moving part of current invalid area */
   moving_invalid_region = NULL;
   if (private->update_area)
     {
-      moving_invalid_region = cairo_region_copy (private->update_area);
-      cairo_region_intersect (moving_invalid_region, src_region);
-      cairo_region_translate (moving_invalid_region, dx, dy);
+      moving_invalid_region = gdk_region_copy (private->update_area);
+      gdk_region_intersect (moving_invalid_region, src_region);
+      gdk_region_offset (moving_invalid_region, dx, dy);
     }
   
   /* invalidate all of the src region */
@@ -220,18 +220,18 @@ _gdk_directfb_window_move_region (GdkWindow       *window,
 
   /* un-invalidate destination region */
   if (private->update_area)
-    cairo_region_subtract (private->update_area, dest_region);
+    gdk_region_subtract (private->update_area, dest_region);
   
   /* invalidate moving parts of existing update area */
   if (moving_invalid_region)
     {
       gdk_window_invalidate_region (window, moving_invalid_region, FALSE);
-      cairo_region_destroy (moving_invalid_region);
+      gdk_region_destroy (moving_invalid_region);
     }
 
   /* invalidate area brought in from off-screen */
   gdk_window_invalidate_region (window, brought_in, FALSE);
-  cairo_region_destroy (brought_in);
+  gdk_region_destroy (brought_in);
 
   /* Actually do the moving */
 	if (impl->surface)
@@ -250,8 +250,8 @@ _gdk_directfb_window_move_region (GdkWindow       *window,
               impl->surface->SetClip (impl->surface, NULL);
               impl->surface->Flip(impl->surface,&destination,0);
 	}
-  cairo_region_destroy (src_region);
-  cairo_region_destroy (dest_region);
+  gdk_region_destroy (src_region);
+  gdk_region_destroy (dest_region);
 }
 
 #define __GDK_GEOMETRY_X11_C__
diff --git a/gdk/directfb/gdkwindow-directfb.c b/gdk/directfb/gdkwindow-directfb.c
index a8da98d..8e67680 100644
--- a/gdk/directfb/gdkwindow-directfb.c
+++ b/gdk/directfb/gdkwindow-directfb.c
@@ -227,7 +227,7 @@ gdk_window_impl_directfb_get_visible_region (GdkDrawable *drawable)
 
   D_DEBUG_AT( GDKDFB_Window, "  -> returning %4d,%4d-%4dx%4d\n", drect.x, drect.y, drect.w, drect.h );
 
-  return cairo_region_create_rectangle (&rect);
+  return gdk_region_rectangle (&rect);
 }
 
 static void
@@ -2876,7 +2876,7 @@ gdk_window_impl_directfb_begin_paint_region (GdkPaintable    *paintable,
                   DFB_RECTANGLE_VALS_FROM_REGION( &impl->paint_region.extents ), impl->paint_region.numRects );
 
       /* Add the new region to the paint region... */
-      cairo_region_union (&impl->paint_region, region);
+      gdk_region_union (&impl->paint_region, region);
     }
   else
     {
@@ -2896,7 +2896,7 @@ gdk_window_impl_directfb_begin_paint_region (GdkPaintable    *paintable,
               DFB_RECTANGLE_VALS_FROM_REGION( &impl->paint_region.extents ), impl->paint_region.numRects );
 
   /* ...but clip the initial/compound result against the clip region. */
-  cairo_region_intersect (&impl->paint_region, &impl->clip_region);
+  gdk_region_intersect (&impl->paint_region, &impl->clip_region);
 
   D_DEBUG_AT( GDKDFB_Window, "  -> clipped  %4d,%4d-%4dx%4d (%ld boxes)\n",
               DFB_RECTANGLE_VALS_FROM_REGION( &impl->paint_region.extents ), impl->paint_region.numRects );
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index 5504840..bb6e2b2 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -974,31 +974,21 @@ gdk_pixmap_lookup_for_display
 
 #if IN_HEADER(__GDK_REGION_H__)
 #if IN_FILE(__GDK_REGION_GENERIC_C__)
-#ifndef GDK_DISABLE_DEPRECATED
 gdk_region_copy
 gdk_region_destroy
-#endif
 gdk_region_empty
 gdk_region_equal
 gdk_region_rect_equal
-#ifndef GDK_DISABLE_DEPRECATED
 gdk_region_get_clipbox
-#endif
 gdk_region_get_rectangles
 gdk_region_intersect
-#ifndef GDK_DISABLE_DEPRECATED
 gdk_region_new
-#endif
 gdk_region_offset
 gdk_region_point_in
-#ifndef GDK_DISABLE_DEPRECATED
 gdk_region_rectangle
-#endif
 gdk_region_rect_in
 gdk_region_shrink
-#ifndef GDK_DISABLE_DEPRECATED
 gdk_region_spans_intersect_foreach
-#endif
 gdk_region_subtract
 gdk_region_union
 gdk_region_union_with_rect
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
index cc3ad18..0e6ccc5 100644
--- a/gdk/gdkdraw.c
+++ b/gdk/gdkdraw.c
@@ -1237,7 +1237,7 @@ gdk_drawable_real_get_composite_drawable (GdkDrawable *drawable,
  * but no area outside of this region will be affected by drawing
  * primitives.
  * 
- * Returns: a #GdkRegion. This must be freed with cairo_region_destroy()
+ * Returns: a #GdkRegion. This must be freed with gdk_region_destroy()
  *          when you are done.
  **/
 GdkRegion *
@@ -1257,7 +1257,7 @@ gdk_drawable_get_clip_region (GdkDrawable *drawable)
  * obscured by other windows, but no area outside of this region
  * is visible.
  * 
- * Returns: a #GdkRegion. This must be freed with cairo_region_destroy()
+ * Returns: a #GdkRegion. This must be freed with gdk_region_destroy()
  *          when you are done.
  **/
 GdkRegion *
@@ -1278,7 +1278,7 @@ gdk_drawable_real_get_visible_region (GdkDrawable *drawable)
 
   gdk_drawable_get_size (drawable, &rect.width, &rect.height);
 
-  return cairo_region_create_rectangle (&rect);
+  return gdk_region_rectangle (&rect);
 }
 
 /**
@@ -1608,15 +1608,15 @@ gdk_drawable_real_draw_pixbuf (GdkDrawable  *drawable,
   tmp_rect.width = width;
   tmp_rect.height = height;
 
-  drect = cairo_region_create_rectangle (&tmp_rect);
+  drect = gdk_region_rectangle (&tmp_rect);
   clip = gdk_drawable_get_clip_region (drawable);
 
-  cairo_region_intersect (drect, clip);
+  gdk_region_intersect (drect, clip);
 
-  cairo_region_get_extents (drect, &tmp_rect);
+  gdk_region_get_clipbox (drect, &tmp_rect);
   
-  cairo_region_destroy (drect);
-  cairo_region_destroy (clip);
+  gdk_region_destroy (drect);
+  gdk_region_destroy (clip);
 
   if (tmp_rect.width == 0 ||
       tmp_rect.height == 0)
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 6bf9dae..089b4e7 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -473,7 +473,7 @@ gdk_event_copy (const GdkEvent *event)
     case GDK_EXPOSE:
     case GDK_DAMAGE:
       if (event->expose.region)
-	new_event->expose.region = cairo_region_copy (event->expose.region);
+	new_event->expose.region = gdk_region_copy (event->expose.region);
       break;
       
     case GDK_SETTING:
@@ -551,7 +551,7 @@ gdk_event_free (GdkEvent *event)
     case GDK_EXPOSE:
     case GDK_DAMAGE:
       if (event->expose.region)
-	cairo_region_destroy (event->expose.region);
+	gdk_region_destroy (event->expose.region);
       break;
       
     case GDK_MOTION_NOTIFY:
diff --git a/gdk/gdkgc.c b/gdk/gdkgc.c
index 437f483..42dc712 100644
--- a/gdk/gdkgc.c
+++ b/gdk/gdkgc.c
@@ -205,9 +205,9 @@ gdk_gc_finalize (GObject *object)
   GdkGCPrivate *priv = GDK_GC_GET_PRIVATE (gc);
 
   if (priv->clip_region)
-    cairo_region_destroy (priv->clip_region);
+    gdk_region_destroy (priv->clip_region);
   if (priv->old_clip_region)
-    cairo_region_destroy (priv->old_clip_region);
+    gdk_region_destroy (priv->old_clip_region);
   if (priv->clip_mask)
     g_object_unref (priv->clip_mask);
   if (priv->old_clip_mask)
@@ -323,7 +323,7 @@ gdk_gc_set_values (GdkGC           *gc,
       
       if (priv->clip_region)
 	{
-	  cairo_region_destroy (priv->clip_region);
+	  gdk_region_destroy (priv->clip_region);
 	  priv->clip_region = NULL;
 	}
     }
@@ -603,7 +603,7 @@ _gdk_gc_set_clip_region_real (GdkGC     *gc,
     }
   
   if (priv->clip_region)
-    cairo_region_destroy (priv->clip_region);
+    gdk_region_destroy (priv->clip_region);
 
   priv->clip_region = region;
 
@@ -638,9 +638,9 @@ _gdk_gc_add_drawable_clip (GdkGC     *gc,
   if (priv->region_tag_applied)
     _gdk_gc_remove_drawable_clip (gc);
 
-  region = cairo_region_copy (region);
+  region = gdk_region_copy (region);
   if (offset_x != 0 || offset_y != 0)
-    cairo_region_translate (region, offset_x, offset_y);
+    gdk_region_offset (region, offset_x, offset_y);
 
   if (priv->clip_mask)
     {
@@ -662,8 +662,8 @@ _gdk_gc_add_drawable_clip (GdkGC     *gc,
        * the region, so we try to avoid allocating bitmaps that are just fully
        * set or completely unset.
        */
-      overlap = cairo_region_contains_rectangle (region, &r);
-      if (overlap == CAIRO_REGION_OVERLAP_PART)
+      overlap = gdk_region_rect_in (region, &r);
+      if (overlap == GDK_OVERLAP_RECTANGLE_PART)
 	{
 	   /* The region and the mask intersect, create a new clip mask that
 	      includes both areas */
@@ -684,12 +684,12 @@ _gdk_gc_add_drawable_clip (GdkGC     *gc,
 	  gdk_gc_set_clip_mask (gc, new_mask);
 	  g_object_unref (new_mask);
 	}
-      else if (overlap == CAIRO_REGION_OVERLAP_OUT)
+      else if (overlap == GDK_OVERLAP_RECTANGLE_OUT)
 	{
 	  /* No intersection, set empty clip region */
-	  GdkRegion *empty = cairo_region_create ();
+	  GdkRegion *empty = gdk_region_new ();
 
-	  cairo_region_destroy (region);
+	  gdk_region_destroy (region);
 	  priv->old_clip_mask = g_object_ref (priv->clip_mask);
 	  priv->clip_region = empty;
 	  _gdk_windowing_gc_set_clip_region (gc, empty, FALSE);
@@ -697,7 +697,7 @@ _gdk_gc_add_drawable_clip (GdkGC     *gc,
       else
 	{
 	  /* Completely inside region, don't set unnecessary clip */
-	  cairo_region_destroy (region);
+	  gdk_region_destroy (region);
 	  return;
 	}
     }
@@ -706,7 +706,7 @@ _gdk_gc_add_drawable_clip (GdkGC     *gc,
       priv->old_clip_region = priv->clip_region;
       priv->clip_region = region;
       if (priv->old_clip_region)
-	cairo_region_intersect (region, priv->old_clip_region);
+	gdk_region_intersect (region, priv->old_clip_region);
 
       _gdk_windowing_gc_set_clip_region (gc, priv->clip_region, FALSE);
     }
@@ -764,7 +764,7 @@ gdk_gc_set_clip_rectangle (GdkGC              *gc,
   _gdk_gc_remove_drawable_clip (gc);
   
   if (rectangle)
-    region = cairo_region_create_rectangle (rectangle);
+    region = gdk_region_rectangle (rectangle);
   else
     region = NULL;
 
@@ -791,7 +791,7 @@ gdk_gc_set_clip_region (GdkGC           *gc,
   _gdk_gc_remove_drawable_clip (gc);
   
   if (region)
-    copy = cairo_region_copy (region);
+    copy = gdk_region_copy (region);
   else
     copy = NULL;
 
@@ -1116,20 +1116,20 @@ gdk_gc_copy (GdkGC *dst_gc,
   dst_gc->colormap = src_gc->colormap;
 
   if (dst_priv->clip_region)
-    cairo_region_destroy (dst_priv->clip_region);
+    gdk_region_destroy (dst_priv->clip_region);
 
   if (src_priv->clip_region)
-    dst_priv->clip_region = cairo_region_copy (src_priv->clip_region);
+    dst_priv->clip_region = gdk_region_copy (src_priv->clip_region);
   else
     dst_priv->clip_region = NULL;
 
   dst_priv->region_tag_applied = src_priv->region_tag_applied;
   
   if (dst_priv->old_clip_region)
-    cairo_region_destroy (dst_priv->old_clip_region);
+    gdk_region_destroy (dst_priv->old_clip_region);
 
   if (src_priv->old_clip_region)
-    dst_priv->old_clip_region = cairo_region_copy (src_priv->old_clip_region);
+    dst_priv->old_clip_region = gdk_region_copy (src_priv->old_clip_region);
   else
     dst_priv->old_clip_region = NULL;
 
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index f70d95a..23d92af 100644
--- a/gdk/gdkoffscreenwindow.c
+++ b/gdk/gdkoffscreenwindow.c
@@ -288,9 +288,9 @@ add_damage (GdkOffscreenWindow *offscreen,
       rect.height += 7;
     }
 
-  damage = cairo_region_create_rectangle (&rect);
+  damage = gdk_region_rectangle (&rect);
   _gdk_window_add_damage (offscreen->wrapper, damage);
-  cairo_region_destroy (damage);
+  gdk_region_destroy (damage);
 }
 
 static GdkDrawable *
diff --git a/gdk/gdkpango.c b/gdk/gdkpango.c
index 14e4b86..825b238 100644
--- a/gdk/gdkpango.c
+++ b/gdk/gdkpango.c
@@ -1273,7 +1273,7 @@ layout_iter_get_line_clip_region (PangoLayoutIter *iter,
 
   line = pango_layout_iter_get_line_readonly (iter);
 
-  clip_region = cairo_region_create ();
+  clip_region = gdk_region_new ();
 
   pango_layout_iter_get_line_extents (iter, NULL, &logical_rect);
   baseline = pango_layout_iter_get_baseline (iter);
@@ -1307,7 +1307,7 @@ layout_iter_get_line_clip_region (PangoLayoutIter *iter,
           rect.width = PANGO_PIXELS (pixel_ranges[2*j + 1] - logical_rect.x) - x_off;
           rect.height = PANGO_PIXELS (baseline - logical_rect.y + logical_rect.height) - y_off;
 
-          cairo_region_union_rectangle (clip_region, &rect);
+          gdk_region_union_with_rect (clip_region, &rect);
         }
 
       g_free (pixel_ranges);
@@ -1398,7 +1398,7 @@ gdk_pango_layout_get_clip_region (PangoLayout *layout,
   g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL);
   g_return_val_if_fail (index_ranges != NULL, NULL);
   
-  clip_region = cairo_region_create ();
+  clip_region = gdk_region_new ();
   
   iter = pango_layout_get_iter (layout);
   
@@ -1417,8 +1417,8 @@ gdk_pango_layout_get_clip_region (PangoLayout *layout,
 						     index_ranges,
 						     n_ranges);
 
-      cairo_region_union (clip_region, line_region);
-      cairo_region_destroy (line_region);
+      gdk_region_union (clip_region, line_region);
+      gdk_region_destroy (line_region);
     }
   while (pango_layout_iter_next_line (iter));
 
diff --git a/gdk/gdkpolyreg-generic.c b/gdk/gdkpolyreg-generic.c
index 59a76e6..9658b15 100644
--- a/gdk/gdkpolyreg-generic.c
+++ b/gdk/gdkpolyreg-generic.c
@@ -481,7 +481,7 @@ gdk_region_polygon (const GdkPoint *points,
 	extents.y = MIN(points[0].y, points[2].y);
 	extents.width = MAX(points[0].x, points[2].x) - extents.x;
 	extents.height = MAX(points[0].y, points[2].y) - extents.y;
-	return cairo_region_create_rectangle (&extents);
+	return gdk_region_rectangle (&extents);
     }
 
     pETEs = g_new (EdgeTableEntry, n_points);
diff --git a/gdk/gdkregion-generic.c b/gdk/gdkregion-generic.c
index 73acab2..d0224f5 100644
--- a/gdk/gdkregion-generic.c
+++ b/gdk/gdkregion-generic.c
@@ -10,8 +10,6 @@
  * Creates a new empty #GdkRegion.
  *
  * Returns: a new empty #GdkRegion
- *
- * Deprecated: 2.22: Use cairo_region_create() instead.
  */
 GdkRegion *
 gdk_region_new (void)
@@ -26,8 +24,6 @@ gdk_region_new (void)
  * Creates a new region containing the area @rectangle.
  * 
  * Return value: a new region
- *
- * Deprecated: 2.22: Use cairo_region_create_rectangle()
  **/
 GdkRegion *
 gdk_region_rectangle (const GdkRectangle *rectangle)
@@ -47,8 +43,6 @@ gdk_region_rectangle (const GdkRectangle *rectangle)
  * Copies @region, creating an identical new region.
  * 
  * Return value: a new region identical to @region
- *
- * Deprecated: 2.22: Use cairo_region_copy()
  **/
 GdkRegion *
 gdk_region_copy (const GdkRegion *region)
@@ -63,7 +57,6 @@ gdk_region_copy (const GdkRegion *region)
  *
  * Obtains the smallest rectangle which includes the entire #GdkRegion.
  *
- * Deprecated: 2.22: Use cairo_region_get_extents()
  */
 void
 gdk_region_get_clipbox (const GdkRegion *region,
@@ -84,8 +77,6 @@ gdk_region_get_clipbox (const GdkRegion *region,
  *
  * Obtains the area covered by the region as a list of rectangles.
  * The array returned in @rectangles must be freed with g_free().
- *
- * Deprecated: 2.22: Use cairo_region_num_rectangles() and cairo_region_get_rectangle() instead.
  **/
 void
 gdk_region_get_rectangles (const GdkRegion  *region,
@@ -119,8 +110,6 @@ gdk_region_get_rectangles (const GdkRegion  *region,
  * Sets the area of @region to the union of the areas of @region and
  * @rect. The resulting area is the set of pixels contained in
  * either @region or @rect.
- *
- * Deprecated: 2.22: Use cairo_region_union_rectangle() instead.
  **/
 void
 gdk_region_union_with_rect (GdkRegion          *region,
@@ -140,8 +129,6 @@ gdk_region_union_with_rect (GdkRegion          *region,
  * @region: a #GdkRegion
  *
  * Destroys a #GdkRegion.
- *
- * Deprecated: 2.22: Use cairo_region_destroy() instead.
  */
 void
 gdk_region_destroy (GdkRegion *region)
@@ -159,8 +146,6 @@ gdk_region_destroy (GdkRegion *region)
  * @dy: the distance to move the region vertically
  *
  * Moves a region the specified distance.
- *
- * Deprecated: 2.22: Use cairo_region_translate() instead.
  */
 void
 gdk_region_offset (GdkRegion *region,
@@ -178,8 +163,6 @@ gdk_region_offset (GdkRegion *region,
  *
  * Resizes a region by the specified amount.
  * Positive values shrink the region. Negative values expand it.
- *
- * Deprecated: 2.22: There is no replacement for this function.
  */
 void
 gdk_region_shrink (GdkRegion *region,
@@ -215,8 +198,6 @@ gdk_region_shrink (GdkRegion *region,
  * Sets the area of @source1 to the intersection of the areas of @source1
  * and @source2. The resulting area is the set of pixels contained in
  * both @source1 and @source2.
- *
- * Deprecated: 2.22: Use cairo_region_intersect() instead.
  **/
 void
 gdk_region_intersect (GdkRegion       *source1,
@@ -236,8 +217,6 @@ gdk_region_intersect (GdkRegion       *source1,
  * Sets the area of @source1 to the union of the areas of @source1 and
  * @source2. The resulting area is the set of pixels contained in
  * either @source1 or @source2.
- *
- * Deprecated: 2.22: Use cairo_region_union() instead.
  **/
 void
 gdk_region_union (GdkRegion       *source1,
@@ -256,8 +235,6 @@ gdk_region_union (GdkRegion       *source1,
  *
  * Subtracts the area of @source2 from the area @source1. The resulting
  * area is the set of pixels contained in @source1 but not in @source2.
- *
- * Deprecated: 2.22: Use cairo_region_subtract() instead.
  **/
 void
 gdk_region_subtract (GdkRegion       *source1,
@@ -277,10 +254,6 @@ gdk_region_subtract (GdkRegion       *source1,
  * Sets the area of @source1 to the exclusive-OR of the areas of @source1
  * and @source2. The resulting area is the set of pixels contained in one
  * or the other of the two sources but not in both.
- *
- * Deprecated: 2.22: There is no replacement, but the function can be
- *                   reimplemented using cairo_region_intersect() and
- *                   cairo_region_subract() easily.
  **/
 void
 gdk_region_xor (GdkRegion       *source1,
@@ -308,8 +281,6 @@ gdk_region_xor (GdkRegion       *source1,
  * Finds out if the #GdkRegion is empty.
  *
  * Returns: %TRUE if @region is empty.
- *
- * Deprecated: 2.22: Use cairo_region_is_empty() instead.
  */
 gboolean
 gdk_region_empty (const GdkRegion *region)
@@ -327,8 +298,6 @@ gdk_region_empty (const GdkRegion *region)
  * Finds out if the two regions are the same.
  *
  * Returns: %TRUE if @region1 and @region2 are equal.
- *
- * Deprecated: 2.22: Use cairo_region_equal() instead.
  */
 gboolean
 gdk_region_equal (const GdkRegion *region1,
@@ -378,8 +347,6 @@ gdk_region_rect_equal (const GdkRegion    *region,
  * Finds out if a point is in a region.
  *
  * Returns: %TRUE if the point is in @region.
- *
- * Deprecated: 2.22: Use cairo_region_contains_point() instead.
  */
 gboolean
 gdk_region_point_in (const GdkRegion *region,
@@ -401,8 +368,6 @@ gdk_region_point_in (const GdkRegion *region,
  * Returns: %GDK_OVERLAP_RECTANGLE_IN, %GDK_OVERLAP_RECTANGLE_OUT, or
  *   %GDK_OVERLAP_RECTANGLE_PART, depending on whether the rectangle is inside,
  *   outside, or partly inside the #GdkRegion, respectively.
- *
- * Deprecated: 2.22: Use cairo_region_contains_rectangle() instead.
  */
 GdkOverlapType
 gdk_region_rect_in (const GdkRegion    *region,
@@ -480,8 +445,6 @@ gdk_region_unsorted_spans_intersect_foreach (GdkRegion     *region,
  * @data: data to pass to @function
  *
  * Calls a function on each span in the intersection of @region and @spans.
- *
- * Deprecated: 2.22: There is no replacement.
  */
 void
 gdk_region_spans_intersect_foreach (GdkRegion     *region,
diff --git a/gdk/gdkregion.h b/gdk/gdkregion.h
index fabb3c8..0adffa1 100644
--- a/gdk/gdkregion.h
+++ b/gdk/gdkregion.h
@@ -45,14 +45,10 @@ typedef enum
   GDK_WINDING_RULE
 } GdkFillRule;
 
-#ifndef GDK_DISABLE_DEPRECATED
 /* Types of overlapping between a rectangle and a region
  * GDK_OVERLAP_RECTANGLE_IN: rectangle is in region
  * GDK_OVERLAP_RECTANGLE_OUT: rectangle in not in region
  * GDK_OVERLAP_RECTANGLE_PART: rectangle in partially in region
- *
- * Deprecated: 2.22: Superceded by #cairo_region_overlap_t and
- *                   cairo_region_contains_rectangle().
  */
 typedef enum
 {
@@ -65,11 +61,9 @@ typedef void (* GdkSpanFunc) (GdkSpan *span,
                               gpointer data);
 
 GdkRegion    * gdk_region_new             (void);
-#endif
 GdkRegion    * gdk_region_polygon         (const GdkPoint     *points,
                                            gint                n_points,
                                            GdkFillRule         fill_rule);
-#ifndef GDK_DISABLE_DEPRECATED
 GdkRegion    * gdk_region_copy            (const GdkRegion    *region);
 GdkRegion    * gdk_region_rectangle       (const GdkRectangle *rectangle);
 void           gdk_region_destroy         (GdkRegion          *region);
@@ -83,10 +77,8 @@ void           gdk_region_get_rectangles  (const GdkRegion    *region,
 gboolean       gdk_region_empty           (const GdkRegion    *region);
 gboolean       gdk_region_equal           (const GdkRegion    *region1,
                                            const GdkRegion    *region2);
-#endif
 gboolean       gdk_region_rect_equal      (const GdkRegion    *region,
                                            const GdkRectangle *rectangle);
-#ifndef GDK_DISABLE_DEPRECATED
 gboolean       gdk_region_point_in        (const GdkRegion    *region,
                                            int                 x,
                                            int                 y);
@@ -116,7 +108,6 @@ void   gdk_region_spans_intersect_foreach (GdkRegion          *region,
                                            gboolean            sorted,
                                            GdkSpanFunc         function,
                                            gpointer            data);
-#endif
 
 G_END_DECLS
 
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index d57fecc..e264feb 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -615,10 +615,10 @@ gdk_window_finalize (GObject *object)
     }
 
   if (obj->shape)
-    cairo_region_destroy (obj->shape);
+    gdk_region_destroy (obj->shape);
 
   if (obj->input_shape)
-    cairo_region_destroy (obj->input_shape);
+    gdk_region_destroy (obj->input_shape);
 
   if (obj->cursor)
     gdk_cursor_unref (obj->cursor);
@@ -731,7 +731,7 @@ remove_child_area (GdkWindowObject *private,
 
       /* If region is empty already, no need to do
 	 anything potentially costly */
-      if (cairo_region_is_empty (region))
+      if (gdk_region_empty (region))
 	break;
 
       if (!GDK_WINDOW_IS_MAPPED (child) || child->input_only || child->composited)
@@ -748,45 +748,45 @@ remove_child_area (GdkWindowObject *private,
       r.height = child->height;
 
       /* Bail early if child totally outside region */
-      if (cairo_region_contains_rectangle (region, &r) == CAIRO_REGION_OVERLAP_OUT)
+      if (gdk_region_rect_in (region, &r) == GDK_OVERLAP_RECTANGLE_OUT)
 	continue;
 
-      child_region = cairo_region_create_rectangle (&r);
+      child_region = gdk_region_rectangle (&r);
 
       if (child->shape)
 	{
 	  /* Adjust shape region to parent window coords */
-	  cairo_region_translate (child->shape, child->x, child->y);
-	  cairo_region_intersect (child_region, child->shape);
-	  cairo_region_translate (child->shape, -child->x, -child->y);
+	  gdk_region_offset (child->shape, child->x, child->y);
+	  gdk_region_intersect (child_region, child->shape);
+	  gdk_region_offset (child->shape, -child->x, -child->y);
 	}
       else if (private->window_type == GDK_WINDOW_FOREIGN)
 	{
 	  shape = _gdk_windowing_window_get_shape ((GdkWindow *)child);
 	  if (shape)
 	    {
-	      cairo_region_intersect (child_region, shape);
-	      cairo_region_destroy (shape);
+	      gdk_region_intersect (child_region, shape);
+	      gdk_region_destroy (shape);
 	    }
 	}
 
       if (for_input)
 	{
 	  if (child->input_shape)
-	    cairo_region_intersect (child_region, child->input_shape);
+	    gdk_region_intersect (child_region, child->input_shape);
 	  else if (private->window_type == GDK_WINDOW_FOREIGN)
 	    {
 	      shape = _gdk_windowing_window_get_input_shape ((GdkWindow *)child);
 	      if (shape)
 		{
-		  cairo_region_intersect (child_region, shape);
-		  cairo_region_destroy (shape);
+		  gdk_region_intersect (child_region, shape);
+		  gdk_region_destroy (shape);
 		}
 	    }
 	}
 
-      cairo_region_subtract (region, child_region);
-      cairo_region_destroy (child_region);
+      gdk_region_subtract (region, child_region);
+      gdk_region_destroy (child_region);
 
     }
 }
@@ -953,11 +953,11 @@ recompute_visible_regions_internal (GdkWindowObject *private,
 	  r.y = private->y;
 	  r.width = private->width;
 	  r.height = private->height;
-	  new_clip = cairo_region_create_rectangle (&r);
+	  new_clip = gdk_region_rectangle (&r);
 
 	  if (!gdk_window_is_toplevel (private))
 	    {
-	      cairo_region_intersect (new_clip, private->parent->clip_region);
+	      gdk_region_intersect (new_clip, private->parent->clip_region);
 
 	      /* Remove all overlapping children from parent.
 	       * Unless we're all native, because then we don't need to take
@@ -970,33 +970,33 @@ recompute_visible_regions_internal (GdkWindowObject *private,
 	    }
 
 	  /* Convert from parent coords to window coords */
-	  cairo_region_translate (new_clip, -private->x, -private->y);
+	  gdk_region_offset (new_clip, -private->x, -private->y);
 
 	  if (private->shape)
-	    cairo_region_intersect (new_clip, private->shape);
+	    gdk_region_intersect (new_clip, private->shape);
 	}
       else
-	new_clip = cairo_region_create ();
+	new_clip = gdk_region_new ();
 
       if (private->clip_region == NULL ||
-	  !cairo_region_equal (private->clip_region, new_clip))
+	  !gdk_region_equal (private->clip_region, new_clip))
 	clip_region_changed = TRUE;
 
       if (private->clip_region)
-	cairo_region_destroy (private->clip_region);
+	gdk_region_destroy (private->clip_region);
       private->clip_region = new_clip;
 
       old_clip_region_with_children = private->clip_region_with_children;
-      private->clip_region_with_children = cairo_region_copy (private->clip_region);
+      private->clip_region_with_children = gdk_region_copy (private->clip_region);
       if (private->window_type != GDK_WINDOW_ROOT)
 	remove_child_area (private, NULL, FALSE, private->clip_region_with_children);
 
       if (clip_region_changed ||
-	  !cairo_region_equal (private->clip_region_with_children, old_clip_region_with_children))
+	  !gdk_region_equal (private->clip_region_with_children, old_clip_region_with_children))
 	  private->clip_tag = new_region_tag ();
 
       if (old_clip_region_with_children)
-	cairo_region_destroy (old_clip_region_with_children);
+	gdk_region_destroy (old_clip_region_with_children);
     }
 
   if (clip_region_changed)
@@ -1004,13 +1004,13 @@ recompute_visible_regions_internal (GdkWindowObject *private,
       GdkVisibilityState visibility;
       gboolean fully_visible;
 
-      if (cairo_region_is_empty (private->clip_region))
+      if (gdk_region_empty (private->clip_region))
 	visibility = GDK_VISIBILITY_FULLY_OBSCURED;
       else
         {
           if (private->shape)
             {
-	      fully_visible = cairo_region_equal (private->clip_region,
+	      fully_visible = gdk_region_equal (private->clip_region,
 	                                        private->shape);
             }
           else
@@ -2106,13 +2106,13 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
 
 	  if (private->clip_region)
 	    {
-	      cairo_region_destroy (private->clip_region);
+	      gdk_region_destroy (private->clip_region);
 	      private->clip_region = NULL;
 	    }
 
 	  if (private->clip_region_with_children)
 	    {
-	      cairo_region_destroy (private->clip_region_with_children);
+	      gdk_region_destroy (private->clip_region_with_children);
 	      private->clip_region_with_children = NULL;
 	    }
 
@@ -2725,7 +2725,7 @@ gdk_window_begin_implicit_paint (GdkWindow *window, GdkRectangle *rect)
     return FALSE;
 
   paint = g_new (GdkWindowPaint, 1);
-  paint->region = cairo_region_create (); /* Empty */
+  paint->region = gdk_region_new (); /* Empty */
   paint->x_offset = rect->x;
   paint->y_offset = rect->y;
   paint->uses_implicit = FALSE;
@@ -2759,7 +2759,7 @@ gdk_window_flush_implicit_paint (GdkWindow *window)
 
   paint = impl_window->implicit_paint;
   paint->flushed = TRUE;
-  region = cairo_region_copy (private->clip_region_with_children);
+  region = gdk_region_copy (private->clip_region_with_children);
 
   /* Don't flush active double buffers, as that may show partially done
    * rendering */
@@ -2767,16 +2767,16 @@ gdk_window_flush_implicit_paint (GdkWindow *window)
     {
       GdkWindowPaint *tmp_paint = list->data;
 
-      cairo_region_subtract (region, tmp_paint->region);
+      gdk_region_subtract (region, tmp_paint->region);
     }
 
-  cairo_region_translate (region, private->abs_x, private->abs_y);
-  cairo_region_intersect (region, paint->region);
+  gdk_region_offset (region, private->abs_x, private->abs_y);
+  gdk_region_intersect (region, paint->region);
 
-  if (!GDK_WINDOW_DESTROYED (window) && !cairo_region_is_empty (region))
+  if (!GDK_WINDOW_DESTROYED (window) && !gdk_region_empty (region))
     {
       /* Remove flushed region from the implicit paint */
-      cairo_region_subtract (paint->region, region);
+      gdk_region_subtract (paint->region, region);
 
       /* Some regions are valid, push these to window now */
       tmp_gc = _gdk_drawable_get_scratch_gc ((GdkDrawable *)window, FALSE);
@@ -2787,7 +2787,7 @@ gdk_window_flush_implicit_paint (GdkWindow *window)
       gdk_gc_set_clip_region (tmp_gc, NULL);
     }
   else
-    cairo_region_destroy (region);
+    gdk_region_destroy (region);
 }
 
 /* Ends an implicit paint, paired with gdk_window_begin_implicit_paint returning TRUE */
@@ -2806,7 +2806,7 @@ gdk_window_end_implicit_paint (GdkWindow *window)
 
   private->implicit_paint = NULL;
 
-  if (!GDK_WINDOW_DESTROYED (window) && !cairo_region_is_empty (paint->region))
+  if (!GDK_WINDOW_DESTROYED (window) && !gdk_region_empty (paint->region))
     {
       /* Some regions are valid, push these to window now */
       tmp_gc = _gdk_drawable_get_scratch_gc ((GdkDrawable *)window, FALSE);
@@ -2817,7 +2817,7 @@ gdk_window_end_implicit_paint (GdkWindow *window)
       gdk_gc_set_clip_region (tmp_gc, NULL);
     }
   else
-    cairo_region_destroy (paint->region);
+    gdk_region_destroy (paint->region);
 
   g_object_unref (paint->pixmap);
   g_free (paint);
@@ -2841,9 +2841,9 @@ gdk_window_begin_paint_rect (GdkWindow          *window,
 
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  region = cairo_region_create_rectangle (rectangle);
+  region = gdk_region_rectangle (rectangle);
   gdk_window_begin_paint_region (window, region);
-  cairo_region_destroy (region);
+  gdk_region_destroy (region);
 }
 
 /**
@@ -2921,22 +2921,22 @@ gdk_window_begin_paint_region (GdkWindow       *window,
   implicit_paint = impl_window->implicit_paint;
 
   paint = g_new (GdkWindowPaint, 1);
-  paint->region = cairo_region_copy (region);
+  paint->region = gdk_region_copy (region);
   paint->region_tag = new_region_tag ();
 
-  cairo_region_intersect (paint->region, private->clip_region_with_children);
-  cairo_region_get_extents (paint->region, &clip_box);
+  gdk_region_intersect (paint->region, private->clip_region_with_children);
+  gdk_region_get_clipbox (paint->region, &clip_box);
 
   /* Convert to impl coords */
-  cairo_region_translate (paint->region, private->abs_x, private->abs_y);
+  gdk_region_offset (paint->region, private->abs_x, private->abs_y);
 
   /* Mark the region as valid on the implicit paint */
 
   if (implicit_paint)
-    cairo_region_union (implicit_paint->region, paint->region);
+    gdk_region_union (implicit_paint->region, paint->region);
 
   /* Convert back to normal coords */
-  cairo_region_translate (paint->region, -private->abs_x, -private->abs_y);
+  gdk_region_offset (paint->region, -private->abs_x, -private->abs_y);
 
   if (implicit_paint)
     {
@@ -2969,12 +2969,12 @@ gdk_window_begin_paint_region (GdkWindow       *window,
     {
       GdkWindowPaint *tmp_paint = list->data;
 
-      cairo_region_subtract (tmp_paint->region, paint->region);
+      gdk_region_subtract (tmp_paint->region, paint->region);
     }
 
   private->paint_stack = g_slist_prepend (private->paint_stack, paint);
 
-  if (!cairo_region_is_empty (paint->region))
+  if (!gdk_region_empty (paint->region))
     {
       gdk_window_clear_backing_region (window,
 				       paint->region);
@@ -3013,9 +3013,9 @@ setup_redirect_clip (GdkWindow      *window,
   dest_rect.y = -y_offset;
   dest_rect.width = private->redirect->width;
   dest_rect.height = private->redirect->height;
-  tmpreg = cairo_region_create_rectangle (&dest_rect);
-  cairo_region_intersect (visible_region, tmpreg);
-  cairo_region_destroy (tmpreg);
+  tmpreg = gdk_region_rectangle (&dest_rect);
+  gdk_region_intersect (visible_region, tmpreg);
+  gdk_region_destroy (tmpreg);
 
   /* Compensate for the dest pos */
   x_offset += private->redirect->dest_x;
@@ -3026,7 +3026,7 @@ setup_redirect_clip (GdkWindow      *window,
   /* offset clip and tiles from window coords to pixmaps coords */
   gdk_gc_offset (gc, -x_offset, -y_offset);
 
-  cairo_region_destroy (visible_region);
+  gdk_region_destroy (visible_region);
 
   *x_offset_out = x_offset;
   *y_offset_out = y_offset;
@@ -3082,7 +3082,7 @@ gdk_window_end_paint (GdkWindow *window)
   private->paint_stack = g_slist_delete_link (private->paint_stack,
 					      private->paint_stack);
 
-  cairo_region_get_extents (paint->region, &clip_box);
+  gdk_region_get_clipbox (paint->region, &clip_box);
 
   tmp_gc = _gdk_drawable_get_scratch_gc (window, FALSE);
 
@@ -3093,8 +3093,8 @@ gdk_window_end_paint (GdkWindow *window)
     {
       gdk_window_flush_outstanding_moves (window);
 
-      full_clip = cairo_region_copy (private->clip_region_with_children);
-      cairo_region_intersect (full_clip, paint->region);
+      full_clip = gdk_region_copy (private->clip_region_with_children);
+      gdk_region_intersect (full_clip, paint->region);
       _gdk_gc_set_clip_region_internal (tmp_gc, full_clip, TRUE); /* Takes ownership of full_clip */
       gdk_gc_set_clip_origin (tmp_gc, - x_offset, - y_offset);
       gdk_draw_drawable (private->impl, tmp_gc, paint->pixmap,
@@ -3123,7 +3123,7 @@ gdk_window_end_paint (GdkWindow *window)
 
   cairo_surface_destroy (paint->surface);
   g_object_unref (paint->pixmap);
-  cairo_region_destroy (paint->region);
+  gdk_region_destroy (paint->region);
   g_free (paint);
 
   /* find a composited window in our hierarchy to signal its
@@ -3172,7 +3172,7 @@ gdk_window_free_paint_stack (GdkWindow *window)
 	  if (tmp_list == private->paint_stack)
 	    g_object_unref (paint->pixmap);
 
-	  cairo_region_destroy (paint->region);
+	  gdk_region_destroy (paint->region);
 	  g_free (paint);
 
 	  tmp_list = tmp_list->next;
@@ -3208,12 +3208,12 @@ do_move_region_bits_on_impl (GdkWindowObject *impl_window,
     }
   tmp_gc = _gdk_drawable_get_subwindow_scratch_gc ((GdkWindow *)private);
 
-  cairo_region_get_extents (dest_region, &copy_rect);
+  gdk_region_get_clipbox (dest_region, &copy_rect);
   gdk_gc_set_clip_region (tmp_gc, dest_region);
 
   /* The region area is moved and we queue translations for all expose events
      to the source area that were sent prior to the copy */
-  cairo_region_translate (dest_region, -dx, -dy); /* Move to source region */
+  gdk_region_offset (dest_region, -dx, -dy); /* Move to source region */
   impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
 
   impl_iface->queue_translation ((GdkWindow *)impl_window,
@@ -3236,7 +3236,7 @@ gdk_window_region_move_new (GdkRegion *region,
   GdkWindowRegionMove *move;
 
   move = g_slice_new (GdkWindowRegionMove);
-  move->dest_region  = cairo_region_copy (region);
+  move->dest_region  = gdk_region_copy (region);
   move->dx = dx;
   move->dy = dy;
 
@@ -3246,7 +3246,7 @@ gdk_window_region_move_new (GdkRegion *region,
 static void
 gdk_window_region_move_free (GdkWindowRegionMove *move)
 {
-  cairo_region_destroy (move->dest_region);
+  gdk_region_destroy (move->dest_region);
   g_slice_free (GdkWindowRegionMove, move);
 }
 
@@ -3262,7 +3262,7 @@ append_move_region (GdkWindowObject *impl_window,
   gboolean added_move;
   GList *l, *prev;
 
-  if (cairo_region_is_empty (new_dest_region))
+  if (gdk_region_empty (new_dest_region))
     return;
 
   /* In principle this could just append the move to the list of outstanding
@@ -3278,9 +3278,9 @@ append_move_region (GdkWindowObject *impl_window,
      move is in the source of the new move, or if the destination of the new
      move overlaps the destination of the old move. We simplify this by
      just comparing the total regions (src + dest) */
-  new_total_region = cairo_region_copy (new_dest_region);
-  cairo_region_translate (new_total_region, -dx, -dy);
-  cairo_region_union (new_total_region, new_dest_region);
+  new_total_region = gdk_region_copy (new_dest_region);
+  gdk_region_offset (new_total_region, -dx, -dy);
+  gdk_region_union (new_total_region, new_dest_region);
 
   added_move = FALSE;
   for (l = g_list_last (impl_window->outstanding_moves); l != NULL; l = prev)
@@ -3288,28 +3288,28 @@ append_move_region (GdkWindowObject *impl_window,
       prev = l->prev;
       old_move = l->data;
 
-      old_total_region = cairo_region_copy (old_move->dest_region);
-      cairo_region_translate (old_total_region, -old_move->dx, -old_move->dy);
-      cairo_region_union (old_total_region, old_move->dest_region);
+      old_total_region = gdk_region_copy (old_move->dest_region);
+      gdk_region_offset (old_total_region, -old_move->dx, -old_move->dy);
+      gdk_region_union (old_total_region, old_move->dest_region);
 
-      cairo_region_intersect (old_total_region, new_total_region);
+      gdk_region_intersect (old_total_region, new_total_region);
       /* If these regions intersect then its not safe to push the
 	 new region before the old one */
-      if (!cairo_region_is_empty (old_total_region))
+      if (!gdk_region_empty (old_total_region))
 	{
 	  /* The area where the new moves source overlaps the old ones
 	     destination */
-	  source_overlaps_destination = cairo_region_copy (new_dest_region);
-	  cairo_region_translate (source_overlaps_destination, -dx, -dy);
-	  cairo_region_intersect (source_overlaps_destination, old_move->dest_region);
-	  cairo_region_translate (source_overlaps_destination, dx, dy);
+	  source_overlaps_destination = gdk_region_copy (new_dest_region);
+	  gdk_region_offset (source_overlaps_destination, -dx, -dy);
+	  gdk_region_intersect (source_overlaps_destination, old_move->dest_region);
+	  gdk_region_offset (source_overlaps_destination, dx, dy);
 
 	  /* We can do all sort of optimizations here, but to do things safely it becomes
 	     quite complicated. However, a very common case is that you copy something first,
 	     then copy all that or a subset of it to a new location (i.e. if you scroll twice
 	     in the same direction). We'd like to detect this case and optimize it to one
 	     copy. */
-	  if (cairo_region_equal (source_overlaps_destination, new_dest_region))
+	  if (gdk_region_equal (source_overlaps_destination, new_dest_region))
 	    {
 	      /* This means we might be able to replace the old move and the new one
 		 with the new one read from the old ones source, and a second copy of
@@ -3318,13 +3318,13 @@ append_move_region (GdkWindowObject *impl_window,
 		 by the destination of the new one */
 
 	      /* the new destination of old move if split is ok: */
-	      non_overwritten = cairo_region_copy (old_move->dest_region);
-	      cairo_region_subtract (non_overwritten, new_dest_region);
+	      non_overwritten = gdk_region_copy (old_move->dest_region);
+	      gdk_region_subtract (non_overwritten, new_dest_region);
 	      /* move to source region */
-	      cairo_region_translate (non_overwritten, -old_move->dx, -old_move->dy);
+	      gdk_region_offset (non_overwritten, -old_move->dx, -old_move->dy);
 
-	      cairo_region_intersect (non_overwritten, new_dest_region);
-	      if (cairo_region_is_empty (non_overwritten))
+	      gdk_region_intersect (non_overwritten, new_dest_region);
+	      if (gdk_region_empty (non_overwritten))
 		{
 		  added_move = TRUE;
 		  move = gdk_window_region_move_new (new_dest_region,
@@ -3334,19 +3334,19 @@ append_move_region (GdkWindowObject *impl_window,
 		  impl_window->outstanding_moves =
 		    g_list_insert_before (impl_window->outstanding_moves,
 					  l, move);
-		  cairo_region_subtract (old_move->dest_region, new_dest_region);
+		  gdk_region_subtract (old_move->dest_region, new_dest_region);
 		}
-	      cairo_region_destroy (non_overwritten);
+	      gdk_region_destroy (non_overwritten);
 	    }
 
-	  cairo_region_destroy (source_overlaps_destination);
-	  cairo_region_destroy (old_total_region);
+	  gdk_region_destroy (source_overlaps_destination);
+	  gdk_region_destroy (old_total_region);
 	  break;
 	}
-      cairo_region_destroy (old_total_region);
+      gdk_region_destroy (old_total_region);
     }
 
-  cairo_region_destroy (new_total_region);
+  gdk_region_destroy (new_total_region);
 
   if (!added_move)
     {
@@ -3371,9 +3371,9 @@ move_region_on_impl (GdkWindowObject *impl_window,
 		     int dx, int dy)
 {
   if ((dx == 0 && dy == 0) ||
-      cairo_region_is_empty (region))
+      gdk_region_empty (region))
     {
-      cairo_region_destroy (region);
+      gdk_region_destroy (region);
       return;
     }
 
@@ -3384,25 +3384,25 @@ move_region_on_impl (GdkWindowObject *impl_window,
     {
       GdkRegion *update_area;
 
-      update_area = cairo_region_copy (region);
+      update_area = gdk_region_copy (region);
 
       /* Convert from target to source */
-      cairo_region_translate (update_area, -dx, -dy);
-      cairo_region_intersect (update_area, impl_window->update_area);
+      gdk_region_offset (update_area, -dx, -dy);
+      gdk_region_intersect (update_area, impl_window->update_area);
       /* We only copy the area, so keep the old update area invalid.
 	 It would be safe to remove it too, as code that uses
 	 move_region_on_impl generally also invalidate the source
 	 area. However, it would just use waste cycles. */
 
       /* Convert back */
-      cairo_region_translate (update_area, dx, dy);
-      cairo_region_union (impl_window->update_area, update_area);
+      gdk_region_offset (update_area, dx, dy);
+      gdk_region_union (impl_window->update_area, update_area);
 
       /* This area of the destination is now invalid,
 	 so no need to copy to it.  */
-      cairo_region_subtract (region, update_area);
+      gdk_region_subtract (region, update_area);
 
-      cairo_region_destroy (update_area);
+      gdk_region_destroy (update_area);
     }
 
   /* If we're currently exposing this window, don't copy to this
@@ -3413,12 +3413,12 @@ move_region_on_impl (GdkWindowObject *impl_window,
       GdkWindowPaint *implicit_paint = impl_window->implicit_paint;
       GdkRegion *exposing;
 
-      exposing = cairo_region_copy (implicit_paint->region);
-      cairo_region_intersect (exposing, region);
-      cairo_region_subtract (region, exposing);
+      exposing = gdk_region_copy (implicit_paint->region);
+      gdk_region_intersect (exposing, region);
+      gdk_region_subtract (region, exposing);
 
       impl_window_add_update_area (impl_window, exposing);
-      cairo_region_destroy (exposing);
+      gdk_region_destroy (exposing);
     }
 
   if (impl_window->outstanding_surfaces == 0) /* Enable flicker free handling of moves. */
@@ -3427,7 +3427,7 @@ move_region_on_impl (GdkWindowObject *impl_window,
     do_move_region_bits_on_impl (impl_window,
 				 region, dx, dy);
 
-  cairo_region_destroy (region);
+  gdk_region_destroy (region);
 }
 
 /* Flushes all outstanding changes to the window, call this
@@ -3906,16 +3906,16 @@ gdk_window_get_composite_drawable (GdkDrawable *drawable,
       GdkWindowPaint *paint = list->data;
       GdkOverlapType overlap;
 
-      overlap = cairo_region_contains_rectangle (paint->region, &rect);
+      overlap = gdk_region_rect_in (paint->region, &rect);
 
-      if (overlap == CAIRO_REGION_OVERLAP_IN)
+      if (overlap == GDK_OVERLAP_RECTANGLE_IN)
 	{
 	  *composite_x_offset = paint->x_offset;
 	  *composite_y_offset = paint->y_offset;
 
 	  return g_object_ref (paint->pixmap);
 	}
-      else if (overlap == CAIRO_REGION_OVERLAP_PART)
+      else if (overlap == GDK_OVERLAP_RECTANGLE_PART)
 	{
 	  overlap_buffer = TRUE;
 	  break;
@@ -3931,15 +3931,15 @@ gdk_window_get_composite_drawable (GdkDrawable *drawable,
       rect.x += private->abs_x;
       rect.y += private->abs_y;
 
-      overlap = cairo_region_contains_rectangle (implicit_paint->region, &rect);
-      if (overlap == CAIRO_REGION_OVERLAP_IN)
+      overlap = gdk_region_rect_in (implicit_paint->region, &rect);
+      if (overlap == GDK_OVERLAP_RECTANGLE_IN)
 	{
 	  *composite_x_offset = -private->abs_x + implicit_paint->x_offset;
 	  *composite_y_offset = -private->abs_y + implicit_paint->y_offset;
 
 	  return g_object_ref (implicit_paint->pixmap);
 	}
-      else if (overlap == CAIRO_REGION_OVERLAP_PART)
+      else if (overlap == GDK_OVERLAP_RECTANGLE_PART)
 	overlap_buffer = TRUE;
     }
 
@@ -4006,24 +4006,24 @@ gdk_window_get_clip_region (GdkDrawable *drawable)
   GdkWindowObject *private = (GdkWindowObject *)drawable;
   GdkRegion *result;
 
-  result = cairo_region_copy (private->clip_region);
+  result = gdk_region_copy (private->clip_region);
 
   if (private->paint_stack)
     {
-      GdkRegion *paint_region = cairo_region_create ();
+      GdkRegion *paint_region = gdk_region_new ();
       GSList *tmp_list = private->paint_stack;
 
       while (tmp_list)
 	{
 	  GdkWindowPaint *paint = tmp_list->data;
 
-	  cairo_region_union (paint_region, paint->region);
+	  gdk_region_union (paint_region, paint->region);
 
 	  tmp_list = tmp_list->next;
 	}
 
-      cairo_region_intersect (result, paint_region);
-      cairo_region_destroy (paint_region);
+      gdk_region_intersect (result, paint_region);
+      gdk_region_destroy (paint_region);
     }
 
   return result;
@@ -4034,7 +4034,7 @@ gdk_window_get_visible_region (GdkDrawable *drawable)
 {
   GdkWindowObject *private = (GdkWindowObject*) drawable;
 
-  return cairo_region_copy (private->clip_region);
+  return gdk_region_copy (private->clip_region);
 }
 
 static void
@@ -4080,23 +4080,23 @@ gdk_window_draw_drawable (GdkDrawable *drawable,
 	  r.y = ydest;
 	  r.width = width;
 	  r.height = height;
-	  exposure_region = cairo_region_create_rectangle (&r);
+	  exposure_region = gdk_region_rectangle (&r);
 
 	  if (_gdk_gc_get_subwindow (gc) == GDK_CLIP_BY_CHILDREN)
 	    clip = private->clip_region_with_children;
 	  else
 	    clip = private->clip_region;
-	  cairo_region_intersect (exposure_region, clip);
+	  gdk_region_intersect (exposure_region, clip);
 
 	  _gdk_gc_remove_drawable_clip (gc);
 	  clip = _gdk_gc_get_clip_region (gc);
 	  if (clip)
 	    {
-	      cairo_region_translate (exposure_region,
+	      gdk_region_offset (exposure_region,
 				 old_clip_x,
 				 old_clip_y);
-	      cairo_region_intersect (exposure_region, clip);
-	      cairo_region_translate (exposure_region,
+	      gdk_region_intersect (exposure_region, clip);
+	      gdk_region_offset (exposure_region,
 				 -old_clip_x,
 				 -old_clip_y);
 	    }
@@ -4108,18 +4108,18 @@ gdk_window_draw_drawable (GdkDrawable *drawable,
 	   * Note that xsrc/ysrc has been corrected for abs_x/y offsets already,
 	   * which need to be undone */
 	  clip = gdk_drawable_get_visible_region (original_src);
-	  cairo_region_translate (clip,
+	  gdk_region_offset (clip,
 			     xdest - (xsrc - GDK_WINDOW_OBJECT (original_src)->abs_x),
 			     ydest - (ysrc - GDK_WINDOW_OBJECT (original_src)->abs_y));
-	  cairo_region_subtract (exposure_region, clip);
-	  cairo_region_destroy (clip);
+	  gdk_region_subtract (exposure_region, clip);
+	  gdk_region_destroy (clip);
 
 	  gdk_window_invalidate_region_full (GDK_WINDOW (private),
 					      exposure_region,
 					      _gdk_gc_get_subwindow (gc) == GDK_INCLUDE_INFERIORS,
 					      CLEAR_BG_ALL);
 
-	  cairo_region_destroy (exposure_region);
+	  gdk_region_destroy (exposure_region);
 	}
     }
 
@@ -4404,9 +4404,9 @@ gdk_window_clear_backing_region (GdkWindow *window,
   method.gc = NULL;
   setup_backing_rect_method (&method, window, paint, 0, 0);
 
-  clip = cairo_region_copy (paint->region);
-  cairo_region_intersect (clip, region);
-  cairo_region_get_extents (clip, &clipbox);
+  clip = gdk_region_copy (paint->region);
+  gdk_region_intersect (clip, region);
+  gdk_region_get_clipbox (clip, &clipbox);
 
 
   if (method.cr)
@@ -4438,7 +4438,7 @@ gdk_window_clear_backing_region (GdkWindow *window,
 #endif
     }
 
-  cairo_region_destroy (clip);
+  gdk_region_destroy (clip);
 
 #if 0
   g_timer_destroy (timer);
@@ -4464,7 +4464,7 @@ gdk_window_clear_backing_region_redirect (GdkWindow *window,
 							GDK_WINDOW (redirect->redirected),
 							TRUE,
 							&x_offset, &y_offset);
-  cairo_region_intersect (clip_region, region);
+  gdk_region_intersect (clip_region, region);
 
   /* offset is from redirected window origin to window origin, convert to
      the offset from the redirected pixmap origin to the window origin */
@@ -4472,7 +4472,7 @@ gdk_window_clear_backing_region_redirect (GdkWindow *window,
   y_offset += redirect->dest_y - redirect->src_y;
 
   /* Convert region to pixmap coords */
-  cairo_region_translate (clip_region, x_offset, y_offset);
+  gdk_region_offset (clip_region, x_offset, y_offset);
 
   paint.x_offset = 0;
   paint.y_offset = 0;
@@ -4496,7 +4496,7 @@ gdk_window_clear_backing_region_redirect (GdkWindow *window,
     {
       g_assert (method.gc != NULL);
 
-      cairo_region_get_extents (clip_region, &clipbox);
+      gdk_region_get_clipbox (clip_region, &clipbox);
       gdk_gc_set_clip_region (method.gc, clip_region);
       gdk_draw_rectangle (redirect->pixmap, method.gc, TRUE,
 			  clipbox.x, clipbox.y,
@@ -4505,7 +4505,7 @@ gdk_window_clear_backing_region_redirect (GdkWindow *window,
 
     }
 
-  cairo_region_destroy (clip_region);
+  gdk_region_destroy (clip_region);
   cairo_surface_destroy (paint.surface);
 }
 
@@ -4531,9 +4531,9 @@ gdk_window_clear_backing_region_direct (GdkWindow *window,
   method.gc = NULL;
   setup_backing_rect_method (&method, window, &paint, 0, 0);
 
-  clip = cairo_region_copy (private->clip_region_with_children);
-  cairo_region_intersect (clip, region);
-  cairo_region_get_extents (clip, &clipbox);
+  clip = gdk_region_copy (private->clip_region_with_children);
+  gdk_region_intersect (clip, region);
+  gdk_region_get_clipbox (clip, &clipbox);
 
   if (method.cr)
     {
@@ -4556,7 +4556,7 @@ gdk_window_clear_backing_region_direct (GdkWindow *window,
 
     }
 
-  cairo_region_destroy (clip);
+  gdk_region_destroy (clip);
   cairo_surface_destroy (paint.surface);
 }
 
@@ -4622,8 +4622,8 @@ gdk_window_clear_region_internal (GdkWindow *window,
       if (impl_iface->clear_region && clears_as_native (private))
 	{
 	  GdkRegion *copy;
-	  copy = cairo_region_copy (region);
-	  cairo_region_intersect (copy,
+	  copy = gdk_region_copy (region);
+	  gdk_region_intersect (copy,
 				private->clip_region_with_children);
 
 
@@ -4632,7 +4632,7 @@ gdk_window_clear_region_internal (GdkWindow *window,
 	  gdk_window_flush (window);
 	  impl_iface->clear_region (window, copy, send_expose);
 
-	  cairo_region_destroy (copy);
+	  gdk_region_destroy (copy);
 	}
       else
 	{
@@ -4669,11 +4669,11 @@ gdk_window_clear_area_internal (GdkWindow *window,
   rect.width = width;
   rect.height = height;
 
-  region = cairo_region_create_rectangle (&rect);
+  region = gdk_region_rectangle (&rect);
   gdk_window_clear_region_internal (window,
 				    region,
 				    send_expose);
-  cairo_region_destroy (region);
+  gdk_region_destroy (region);
 
 }
 
@@ -5203,7 +5203,7 @@ _gdk_window_process_updates_recurse (GdkWindow *window,
   GdkRectangle r;
   GList *l, *children;
 
-  if (cairo_region_is_empty (expose_region))
+  if (gdk_region_empty (expose_region))
     return;
 
   /* Make this reentrancy safe for expose handlers freeing windows */
@@ -5228,35 +5228,35 @@ _gdk_window_process_updates_recurse (GdkWindow *window,
       r.width = child->width;
       r.height = child->height;
 
-      child_region = cairo_region_create_rectangle (&r);
+      child_region = gdk_region_rectangle (&r);
       if (child->shape)
 	{
 	  /* Adjust shape region to parent window coords */
-	  cairo_region_translate (child->shape, child->x, child->y);
-	  cairo_region_intersect (child_region, child->shape);
-	  cairo_region_translate (child->shape, -child->x, -child->y);
+	  gdk_region_offset (child->shape, child->x, child->y);
+	  gdk_region_intersect (child_region, child->shape);
+	  gdk_region_offset (child->shape, -child->x, -child->y);
 	}
 
       if (child->impl == private->impl)
 	{
 	  /* Client side child, expose */
-	  cairo_region_intersect (child_region, expose_region);
-	  cairo_region_subtract (expose_region, child_region);
-	  cairo_region_translate (child_region, -child->x, -child->y);
+	  gdk_region_intersect (child_region, expose_region);
+	  gdk_region_subtract (expose_region, child_region);
+	  gdk_region_offset (child_region, -child->x, -child->y);
 	  _gdk_window_process_updates_recurse ((GdkWindow *)child, child_region);
 	}
       else
 	{
 	  /* Native child, just remove area from expose region */
-	  cairo_region_subtract (expose_region, child_region);
+	  gdk_region_subtract (expose_region, child_region);
 	}
-      cairo_region_destroy (child_region);
+      gdk_region_destroy (child_region);
     }
 
   g_list_foreach (children, (GFunc)g_object_unref, NULL);
   g_list_free (children);
 
-  if (!cairo_region_is_empty (expose_region) &&
+  if (!gdk_region_empty (expose_region) &&
       !private->destroyed)
     {
       if (private->event_mask & GDK_EXPOSURE_MASK)
@@ -5268,7 +5268,7 @@ _gdk_window_process_updates_recurse (GdkWindow *window,
 	  event.expose.send_event = FALSE;
 	  event.expose.count = 0;
 	  event.expose.region = expose_region;
-	  cairo_region_get_extents (expose_region, &event.expose.area);
+	  gdk_region_get_clipbox (expose_region, &event.expose.area);
 
 	  (*_gdk_event_func) (&event, _gdk_event_data);
 
@@ -5328,7 +5328,7 @@ gdk_window_process_updates_internal (GdkWindow *window)
 	  gboolean end_implicit;
 
 	  /* Clip to part visible in toplevel */
-	  cairo_region_intersect (update_area, private->clip_region);
+	  gdk_region_intersect (update_area, private->clip_region);
 
 	  if (debug_updates)
 	    {
@@ -5349,7 +5349,7 @@ gdk_window_process_updates_internal (GdkWindow *window)
 	      GdkRegion *remove;
 	      GList *l, *prev;
 
-	      remove = cairo_region_copy (update_area);
+	      remove = gdk_region_copy (update_area);
 	      /* We iterate backwards, starting from the state that would be
 		 if we had applied all the moves. */
 	      for (l = g_list_last (private->outstanding_moves); l != NULL; l = prev)
@@ -5358,24 +5358,24 @@ gdk_window_process_updates_internal (GdkWindow *window)
 		  move = l->data;
 
 		  /* Don't need this area */
-		  cairo_region_subtract (move->dest_region, remove);
+		  gdk_region_subtract (move->dest_region, remove);
 
 		  /* However if any of the destination we do need has a source
 		     in the updated region we do need that as a destination for
 		     the earlier moves */
-		  cairo_region_translate (move->dest_region, -move->dx, -move->dy);
-		  cairo_region_subtract (remove, move->dest_region);
+		  gdk_region_offset (move->dest_region, -move->dx, -move->dy);
+		  gdk_region_subtract (remove, move->dest_region);
 
-		  if (cairo_region_is_empty (move->dest_region))
+		  if (gdk_region_empty (move->dest_region))
 		    {
 		      gdk_window_region_move_free (move);
 		      private->outstanding_moves =
 			g_list_delete_link (private->outstanding_moves, l);
 		    }
 		  else /* move back */
-		    cairo_region_translate (move->dest_region, move->dx, move->dy);
+		    gdk_region_offset (move->dest_region, move->dx, move->dy);
 		}
-	      cairo_region_destroy (remove);
+	      gdk_region_destroy (remove);
 	    }
 
 	  /* By now we a set of window moves that should be applied, and then
@@ -5414,9 +5414,9 @@ gdk_window_process_updates_internal (GdkWindow *window)
 	   * avoid doing the unnecessary repaint any outstanding expose events.
 	   */
 
-	  cairo_region_get_extents (update_area, &clip_box);
+	  gdk_region_get_clipbox (update_area, &clip_box);
 	  end_implicit = gdk_window_begin_implicit_paint (window, &clip_box);
-	  expose_region = cairo_region_copy (update_area);
+	  expose_region = gdk_region_copy (update_area);
 	  if (!end_implicit)
 	    {
 	      /* Rendering is not double buffered by gdk, do outstanding
@@ -5452,10 +5452,10 @@ gdk_window_process_updates_internal (GdkWindow *window)
 
 	      gdk_window_end_implicit_paint (window);
 	    }
-	  cairo_region_destroy (expose_region);
+	  gdk_region_destroy (expose_region);
 	}
       if (!save_region)
-	cairo_region_destroy (update_area);
+	gdk_region_destroy (update_area);
     }
 
   if (private->outstanding_moves)
@@ -5657,9 +5657,9 @@ gdk_window_invalidate_rect_full (GdkWindow          *window,
       rect = &window_rect;
     }
 
-  region = cairo_region_create_rectangle (rect);
+  region = gdk_region_rectangle (rect);
   gdk_window_invalidate_region_full (window, region, invalidate_children, clear_bg);
-  cairo_region_destroy (region);
+  gdk_region_destroy (region);
 }
 
 /**
@@ -5694,7 +5694,7 @@ draw_ugly_color (GdkWindow       *window,
   gdk_gc_set_rgb_fg_color (ugly_gc, &ugly_color);
   gdk_gc_set_clip_region (ugly_gc, region);
 
-  cairo_region_get_extents (region, &clipbox);
+  gdk_region_get_clipbox (region, &clipbox);
 
   gdk_draw_rectangle (window,
 		      ugly_gc,
@@ -5710,11 +5710,11 @@ impl_window_add_update_area (GdkWindowObject *impl_window,
 			     GdkRegion *region)
 {
   if (impl_window->update_area)
-    cairo_region_union (impl_window->update_area, region);
+    gdk_region_union (impl_window->update_area, region);
   else
     {
       gdk_window_add_update_window ((GdkWindow *)impl_window);
-      impl_window->update_area = cairo_region_copy (region);
+      impl_window->update_area = gdk_region_copy (region);
       gdk_window_schedule_update ((GdkWindow *)impl_window);
     }
 }
@@ -5749,12 +5749,12 @@ gdk_window_invalidate_maybe_recurse_full (GdkWindow       *window,
 
   if (private->input_only ||
       !private->viewable ||
-      cairo_region_is_empty (region) ||
+      gdk_region_empty (region) ||
       private->window_type == GDK_WINDOW_ROOT)
     return;
 
   visible_region = gdk_drawable_get_visible_region (window);
-  cairo_region_intersect (visible_region, region);
+  gdk_region_intersect (visible_region, region);
 
   tmp_list = private->children;
   while (tmp_list)
@@ -5770,29 +5770,29 @@ gdk_window_invalidate_maybe_recurse_full (GdkWindow       *window,
 	  child_rect.y = child->y;
 	  child_rect.width = child->width;
 	  child_rect.height = child->height;
-	  child_region = cairo_region_create_rectangle (&child_rect);
+	  child_region = gdk_region_rectangle (&child_rect);
 
 	  /* remove child area from the invalid area of the parent */
 	  if (GDK_WINDOW_IS_MAPPED (child) && !child->shaped &&
 	      !child->composited &&
 	      !gdk_window_is_offscreen (child))
-	    cairo_region_subtract (visible_region, child_region);
+	    gdk_region_subtract (visible_region, child_region);
 
 	  if (child_func && (*child_func) ((GdkWindow *)child, user_data))
 	    {
-	      GdkRegion *tmp = cairo_region_copy (region);
+	      GdkRegion *tmp = gdk_region_copy (region);
 
-	      cairo_region_translate (tmp, - child_rect.x, - child_rect.y);
-	      cairo_region_translate (child_region, - child_rect.x, - child_rect.y);
-	      cairo_region_intersect (child_region, tmp);
+	      gdk_region_offset (tmp, - child_rect.x, - child_rect.y);
+	      gdk_region_offset (child_region, - child_rect.x, - child_rect.y);
+	      gdk_region_intersect (child_region, tmp);
 
 	      gdk_window_invalidate_maybe_recurse_full ((GdkWindow *)child,
 							child_region, clear_bg, child_func, user_data);
 
-	      cairo_region_destroy (tmp);
+	      gdk_region_destroy (tmp);
 	    }
 
-	  cairo_region_destroy (child_region);
+	  gdk_region_destroy (child_region);
 	}
 
       tmp_list = tmp_list->next;
@@ -5800,7 +5800,7 @@ gdk_window_invalidate_maybe_recurse_full (GdkWindow       *window,
 
   impl_window = gdk_window_get_impl_window (private);
 
-  if (!cairo_region_is_empty (visible_region)  ||
+  if (!gdk_region_empty (visible_region)  ||
       /* Even if we're not exposing anything, make sure we process
 	 idles for windows with outstanding moves */
       (impl_window->outstanding_moves != NULL &&
@@ -5810,7 +5810,7 @@ gdk_window_invalidate_maybe_recurse_full (GdkWindow       *window,
 	draw_ugly_color (window, region);
 
       /* Convert to impl coords */
-      cairo_region_translate (visible_region, private->abs_x, private->abs_y);
+      gdk_region_offset (visible_region, private->abs_x, private->abs_y);
 
       /* Only invalidate area if app requested expose events or if
 	 we need to clear the area (by request or to emulate background
@@ -5824,7 +5824,7 @@ gdk_window_invalidate_maybe_recurse_full (GdkWindow       *window,
 	impl_window_add_update_area (impl_window, visible_region);
     }
 
-  cairo_region_destroy (visible_region);
+  gdk_region_destroy (visible_region);
 }
 
 /**
@@ -5959,17 +5959,17 @@ _gdk_window_invalidate_for_expose (GdkWindow       *window,
       move = l->data;
 
       /* covert to move source region */
-      move_region = cairo_region_copy (move->dest_region);
-      cairo_region_translate (move_region, -move->dx, -move->dy);
+      move_region = gdk_region_copy (move->dest_region);
+      gdk_region_offset (move_region, -move->dx, -move->dy);
 
       /* Move area of region that intersects with move source
 	 by dx, dy of the move*/
-      cairo_region_intersect (move_region, region);
-      cairo_region_subtract (region, move_region);
-      cairo_region_translate (move_region, move->dx, move->dy);
-      cairo_region_union (region, move_region);
+      gdk_region_intersect (move_region, region);
+      gdk_region_subtract (region, move_region);
+      gdk_region_offset (move_region, move->dx, move->dy);
+      gdk_region_union (region, move_region);
 
-      cairo_region_destroy (move_region);
+      gdk_region_destroy (move_region);
     }
 
   gdk_window_invalidate_maybe_recurse_full (window, region, CLEAR_BG_WINCLEARED,
@@ -5987,7 +5987,7 @@ _gdk_window_invalidate_for_expose (GdkWindow       *window,
  * no longer have an invalid/dirty region; the update area is removed
  * from @window and handed to you. If a window has no update area,
  * gdk_window_get_update_area() returns %NULL. You are responsible for
- * calling cairo_region_destroy() on the returned region if it's non-%NULL.
+ * calling gdk_region_destroy() on the returned region if it's non-%NULL.
  *
  * Return value: the update area for @window
  **/
@@ -6004,31 +6004,31 @@ gdk_window_get_update_area (GdkWindow *window)
 
   if (impl_window->update_area)
     {
-      tmp_region = cairo_region_copy (private->clip_region_with_children);
+      tmp_region = gdk_region_copy (private->clip_region_with_children);
       /* Convert to impl coords */
-      cairo_region_translate (tmp_region, private->abs_x, private->abs_y);
-      cairo_region_intersect (tmp_region, impl_window->update_area);
+      gdk_region_offset (tmp_region, private->abs_x, private->abs_y);
+      gdk_region_intersect (tmp_region, impl_window->update_area);
 
-      if (cairo_region_is_empty (tmp_region))
+      if (gdk_region_empty (tmp_region))
 	{
-	  cairo_region_destroy (tmp_region);
+	  gdk_region_destroy (tmp_region);
 	  return NULL;
 	}
       else
 	{
-	  cairo_region_subtract (impl_window->update_area, tmp_region);
+	  gdk_region_subtract (impl_window->update_area, tmp_region);
 
-	  if (cairo_region_is_empty (impl_window->update_area) &&
+	  if (gdk_region_empty (impl_window->update_area) &&
 	      impl_window->outstanding_moves == NULL)
 	    {
-	      cairo_region_destroy (impl_window->update_area);
+	      gdk_region_destroy (impl_window->update_area);
 	      impl_window->update_area = NULL;
 
 	      gdk_window_remove_update_window ((GdkWindow *)impl_window);
 	    }
 
 	  /* Convert from impl coords */
-	  cairo_region_translate (tmp_region, -private->abs_x, -private->abs_y);
+	  gdk_region_offset (tmp_region, -private->abs_x, -private->abs_y);
 	  return tmp_region;
 
 	}
@@ -6055,7 +6055,7 @@ _gdk_window_clear_update_area (GdkWindow *window)
     {
       gdk_window_remove_update_window (window);
 
-      cairo_region_destroy (private->update_area);
+      gdk_region_destroy (private->update_area);
       private->update_area = NULL;
     }
 }
@@ -6722,7 +6722,7 @@ gdk_window_raise (GdkWindow *window)
   old_region = NULL;
   if (gdk_window_is_viewable (window) &&
       !private->input_only)
-    old_region = cairo_region_copy (private->clip_region);
+    old_region = gdk_region_copy (private->clip_region);
 
   /* Keep children in (reverse) stacking order */
   gdk_window_raise_internal (window);
@@ -6731,13 +6731,13 @@ gdk_window_raise (GdkWindow *window)
 
   if (old_region)
     {
-      new_region = cairo_region_copy (private->clip_region);
+      new_region = gdk_region_copy (private->clip_region);
 
-      cairo_region_subtract (new_region, old_region);
+      gdk_region_subtract (new_region, old_region);
       gdk_window_invalidate_region_full (window, new_region, TRUE, CLEAR_BG_ALL);
 
-      cairo_region_destroy (old_region);
-      cairo_region_destroy (new_region);
+      gdk_region_destroy (old_region);
+      gdk_region_destroy (new_region);
     }
 }
 
@@ -7232,7 +7232,7 @@ gdk_window_move_resize_toplevel (GdkWindow *window,
       !private->input_only)
     {
       expose = TRUE;
-      old_region = cairo_region_copy (private->clip_region);
+      old_region = gdk_region_copy (private->clip_region);
     }
 
   impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
@@ -7250,17 +7250,17 @@ gdk_window_move_resize_toplevel (GdkWindow *window,
 
   if (expose)
     {
-      new_region = cairo_region_copy (private->clip_region);
+      new_region = gdk_region_copy (private->clip_region);
 
       /* This is the newly exposed area (due to any resize),
        * X will expose it, but lets do that without the
        * roundtrip
        */
-      cairo_region_subtract (new_region, old_region);
+      gdk_region_subtract (new_region, old_region);
       gdk_window_invalidate_region_full (window, new_region, TRUE, CLEAR_BG_WINCLEARED);
 
-      cairo_region_destroy (old_region);
-      cairo_region_destroy (new_region);
+      gdk_region_destroy (old_region);
+      gdk_region_destroy (new_region);
     }
 
   _gdk_synthesize_crossing_events_for_geometry_change (window);
@@ -7310,16 +7310,16 @@ collect_native_child_region_helper (GdkWindowObject *window,
 
       if (child->impl != impl)
 	{
-	  tmp = cairo_region_copy (child->clip_region);
-	  cairo_region_translate (tmp,
+	  tmp = gdk_region_copy (child->clip_region);
+	  gdk_region_offset (tmp,
 			     x_offset + child->x,
 			     y_offset + child->y);
 	  if (*region == NULL)
 	    *region = tmp;
 	  else
 	    {
-	      cairo_region_union (*region, tmp);
-	      cairo_region_destroy (tmp);
+	      gdk_region_union (*region, tmp);
+	      gdk_region_destroy (tmp);
 	    }
 	}
       else
@@ -7338,7 +7338,7 @@ collect_native_child_region (GdkWindowObject *window,
   GdkRegion *region;
 
   if (include_this && gdk_window_has_impl (window) && window->viewable)
-    return cairo_region_copy (window->clip_region);
+    return gdk_region_copy (window->clip_region);
 
   region = NULL;
 
@@ -7403,15 +7403,15 @@ gdk_window_move_resize_internal (GdkWindow *window,
     {
       expose = TRUE;
 
-      old_region = cairo_region_copy (private->clip_region);
+      old_region = gdk_region_copy (private->clip_region);
       /* Adjust region to parent window coords */
-      cairo_region_translate (old_region, private->x, private->y);
+      gdk_region_offset (old_region, private->x, private->y);
 
       old_native_child_region = collect_native_child_region (private, TRUE);
       if (old_native_child_region)
 	{
 	  /* Adjust region to parent window coords */
-	  cairo_region_translate (old_native_child_region, private->x, private->y);
+	  gdk_region_offset (old_native_child_region, private->x, private->y);
 
 	  /* Any native window move will immediately copy stuff to the destination, which may overwrite a
 	   * source or destination for a delayed GdkWindowRegionMove. So, we need
@@ -7452,7 +7452,7 @@ gdk_window_move_resize_internal (GdkWindow *window,
     {
       new_native_child_region = collect_native_child_region (private, TRUE);
       /* Adjust region to parent window coords */
-      cairo_region_translate (new_native_child_region, private->x, private->y);
+      gdk_region_offset (new_native_child_region, private->x, private->y);
     }
 
   if (gdk_window_has_impl (private))
@@ -7471,9 +7471,9 @@ gdk_window_move_resize_internal (GdkWindow *window,
 
   if (expose)
     {
-      new_region = cairo_region_copy (private->clip_region);
+      new_region = gdk_region_copy (private->clip_region);
       /* Adjust region to parent window coords */
-      cairo_region_translate (new_region, private->x, private->y);
+      gdk_region_offset (new_region, private->x, private->y);
 
       /* copy_area:
        * Part of the data at the new location can be copied from the
@@ -7485,37 +7485,37 @@ gdk_window_move_resize_internal (GdkWindow *window,
        * Everything in the old and new regions that is not copied must be
        * invalidated (including children) as this is newly exposed
        */
-      copy_area = cairo_region_copy (new_region);
+      copy_area = gdk_region_copy (new_region);
 
-      cairo_region_union (new_region, old_region);
+      gdk_region_union (new_region, old_region);
 
       if (old_native_child_region)
 	{
 	  /* Don't copy from inside native children, as this is copied by
 	   * the native window move.
 	   */
-	  cairo_region_subtract (old_region, old_native_child_region);
+	  gdk_region_subtract (old_region, old_native_child_region);
 	}
-      cairo_region_translate (old_region, dx, dy);
+      gdk_region_offset (old_region, dx, dy);
 
-      cairo_region_intersect (copy_area, old_region);
+      gdk_region_intersect (copy_area, old_region);
 
       if (new_native_child_region)
 	{
 	  /* Don't copy any bits that would cause a read from the moved
 	     native windows, as we can't read that data */
-	  cairo_region_translate (new_native_child_region, dx, dy);
-	  cairo_region_subtract (copy_area, new_native_child_region);
-	  cairo_region_translate (new_native_child_region, -dx, -dy);
+	  gdk_region_offset (new_native_child_region, dx, dy);
+	  gdk_region_subtract (copy_area, new_native_child_region);
+	  gdk_region_offset (new_native_child_region, -dx, -dy);
 	}
 
-      cairo_region_subtract (new_region, copy_area);
+      gdk_region_subtract (new_region, copy_area);
 
       /* Convert old region to impl coords */
-      cairo_region_translate (old_region, -dx + private->abs_x - private->x, -dy + private->abs_y - private->y);
+      gdk_region_offset (old_region, -dx + private->abs_x - private->x, -dy + private->abs_y - private->y);
 
       /* convert from parent coords to impl */
-      cairo_region_translate (copy_area, private->abs_x - private->x, private->abs_y - private->y);
+      gdk_region_offset (copy_area, private->abs_x - private->x, private->abs_y - private->y);
 
       move_region_on_impl (impl_window, copy_area, dx, dy); /* takes ownership of copy_area */
 
@@ -7527,20 +7527,20 @@ gdk_window_move_resize_internal (GdkWindow *window,
       if (old_native_child_region)
 	{
 	  /* No need to expose the region that the native window move copies */
-	  cairo_region_translate (old_native_child_region, dx, dy);
-	  cairo_region_intersect (old_native_child_region, new_native_child_region);
-	  cairo_region_subtract (new_region, old_native_child_region);
+	  gdk_region_offset (old_native_child_region, dx, dy);
+	  gdk_region_intersect (old_native_child_region, new_native_child_region);
+	  gdk_region_subtract (new_region, old_native_child_region);
 	}
       gdk_window_invalidate_region_full (GDK_WINDOW (private->parent), new_region, TRUE, CLEAR_BG_ALL);
 
-      cairo_region_destroy (old_region);
-      cairo_region_destroy (new_region);
+      gdk_region_destroy (old_region);
+      gdk_region_destroy (new_region);
     }
 
   if (old_native_child_region)
     {
-      cairo_region_destroy (old_native_child_region);
-      cairo_region_destroy (new_native_child_region);
+      gdk_region_destroy (old_native_child_region);
+      gdk_region_destroy (new_native_child_region);
     }
 
   _gdk_synthesize_crossing_events_for_geometry_change (window);
@@ -7699,27 +7699,27 @@ gdk_window_scroll (GdkWindow *window,
   impl_window = gdk_window_get_impl_window (private);
 
   /* Calculate the area that can be gotten by copying the old area */
-  copy_area = cairo_region_copy (private->clip_region);
+  copy_area = gdk_region_copy (private->clip_region);
   if (old_native_child_region)
     {
       /* Don't copy from inside native children, as this is copied by
        * the native window move.
        */
-      cairo_region_subtract (copy_area, old_native_child_region);
+      gdk_region_subtract (copy_area, old_native_child_region);
 
       /* Don't copy any bits that would cause a read from the moved
 	 native windows, as we can't read that data */
-      cairo_region_subtract (copy_area, new_native_child_region);
+      gdk_region_subtract (copy_area, new_native_child_region);
     }
-  cairo_region_translate (copy_area, dx, dy);
-  cairo_region_intersect (copy_area, private->clip_region);
+  gdk_region_offset (copy_area, dx, dy);
+  gdk_region_intersect (copy_area, private->clip_region);
 
   /* And the rest need to be invalidated */
-  noncopy_area = cairo_region_copy (private->clip_region);
-  cairo_region_subtract (noncopy_area, copy_area);
+  noncopy_area = gdk_region_copy (private->clip_region);
+  gdk_region_subtract (noncopy_area, copy_area);
 
   /* convert from window coords to impl */
-  cairo_region_translate (copy_area, private->abs_x, private->abs_y);
+  gdk_region_offset (copy_area, private->abs_x, private->abs_y);
 
   move_region_on_impl (impl_window, copy_area, dx, dy); /* takes ownership of copy_area */
 
@@ -7727,18 +7727,18 @@ gdk_window_scroll (GdkWindow *window,
   if (old_native_child_region)
     {
       /* No need to expose the region that the native window move copies */
-      cairo_region_translate (old_native_child_region, dx, dy);
-      cairo_region_intersect (old_native_child_region, new_native_child_region);
-      cairo_region_subtract (noncopy_area, old_native_child_region);
+      gdk_region_offset (old_native_child_region, dx, dy);
+      gdk_region_intersect (old_native_child_region, new_native_child_region);
+      gdk_region_subtract (noncopy_area, old_native_child_region);
     }
   gdk_window_invalidate_region_full (window, noncopy_area, TRUE, CLEAR_BG_ALL);
 
-  cairo_region_destroy (noncopy_area);
+  gdk_region_destroy (noncopy_area);
 
   if (old_native_child_region)
     {
-      cairo_region_destroy (old_native_child_region);
-      cairo_region_destroy (new_native_child_region);
+      gdk_region_destroy (old_native_child_region);
+      gdk_region_destroy (new_native_child_region);
     }
 
   _gdk_synthesize_crossing_events_for_geometry_change (window);
@@ -7782,26 +7782,26 @@ gdk_window_move_region (GdkWindow       *window,
   impl_window = gdk_window_get_impl_window (private);
 
   /* compute source regions */
-  copy_area = cairo_region_copy (region);
-  cairo_region_intersect (copy_area, private->clip_region_with_children);
+  copy_area = gdk_region_copy (region);
+  gdk_region_intersect (copy_area, private->clip_region_with_children);
 
   /* compute destination regions */
-  cairo_region_translate (copy_area, dx, dy);
-  cairo_region_intersect (copy_area, private->clip_region_with_children);
+  gdk_region_offset (copy_area, dx, dy);
+  gdk_region_intersect (copy_area, private->clip_region_with_children);
 
   /* Invalidate parts of the region (source and dest) not covered
      by the copy */
-  nocopy_area = cairo_region_copy (region);
-  cairo_region_translate (nocopy_area, dx, dy);
-  cairo_region_union (nocopy_area, region);
-  cairo_region_subtract (nocopy_area, copy_area);
+  nocopy_area = gdk_region_copy (region);
+  gdk_region_offset (nocopy_area, dx, dy);
+  gdk_region_union (nocopy_area, region);
+  gdk_region_subtract (nocopy_area, copy_area);
 
   /* convert from window coords to impl */
-  cairo_region_translate (copy_area, private->abs_x, private->abs_y);
+  gdk_region_offset (copy_area, private->abs_x, private->abs_y);
   move_region_on_impl (impl_window, copy_area, dx, dy); /* Takes ownership of copy_area */
 
   gdk_window_invalidate_region_full (window, nocopy_area, FALSE, CLEAR_BG_ALL);
-  cairo_region_destroy (nocopy_area);
+  gdk_region_destroy (nocopy_area);
 }
 
 /**
@@ -8385,7 +8385,7 @@ gdk_window_shape_combine_mask (GdkWindow *window,
 				   x, y);
 
   if (region)
-    cairo_region_destroy (region);
+    gdk_region_destroy (region);
 }
 
 /**
@@ -8430,16 +8430,16 @@ gdk_window_shape_combine_region (GdkWindow       *window,
   private->shaped = (shape_region != NULL);
 
   if (private->shape)
-    cairo_region_destroy (private->shape);
+    gdk_region_destroy (private->shape);
 
   old_region = NULL;
   if (GDK_WINDOW_IS_MAPPED (window))
-    old_region = cairo_region_copy (private->clip_region);
+    old_region = gdk_region_copy (private->clip_region);
 
   if (shape_region)
     {
-      private->shape = cairo_region_copy (shape_region);
-      cairo_region_translate (private->shape, offset_x, offset_y);
+      private->shape = gdk_region_copy (shape_region);
+      gdk_region_offset (private->shape, offset_x, offset_y);
     }
   else
     private->shape = NULL;
@@ -8452,32 +8452,32 @@ gdk_window_shape_combine_region (GdkWindow       *window,
 
   if (old_region)
     {
-      new_region = cairo_region_copy (private->clip_region);
+      new_region = gdk_region_copy (private->clip_region);
 
       /* New area in the window, needs invalidation */
-      diff = cairo_region_copy (new_region);
-      cairo_region_subtract (diff, old_region);
+      diff = gdk_region_copy (new_region);
+      gdk_region_subtract (diff, old_region);
 
       gdk_window_invalidate_region_full (window, diff, TRUE, CLEAR_BG_ALL);
 
-      cairo_region_destroy (diff);
+      gdk_region_destroy (diff);
 
       if (!gdk_window_is_toplevel (private))
 	{
 	  /* New area in the non-root parent window, needs invalidation */
-	  diff = cairo_region_copy (old_region);
-	  cairo_region_subtract (diff, new_region);
+	  diff = gdk_region_copy (old_region);
+	  gdk_region_subtract (diff, new_region);
 
 	  /* Adjust region to parent window coords */
-	  cairo_region_translate (diff, private->x, private->y);
+	  gdk_region_offset (diff, private->x, private->y);
 
 	  gdk_window_invalidate_region_full (GDK_WINDOW (private->parent), diff, TRUE, CLEAR_BG_ALL);
 
-	  cairo_region_destroy (diff);
+	  gdk_region_destroy (diff);
 	}
 
-      cairo_region_destroy (new_region);
-      cairo_region_destroy (old_region);
+      gdk_region_destroy (new_region);
+      gdk_region_destroy (old_region);
     }
 }
 
@@ -8496,11 +8496,11 @@ do_child_shapes (GdkWindow *window,
   r.width = private->width;
   r.height = private->height;
 
-  region = cairo_region_create_rectangle (&r);
+  region = gdk_region_rectangle (&r);
   remove_child_area (private, NULL, FALSE, region);
 
   if (merge && private->shape)
-    cairo_region_subtract (region, private->shape);
+    gdk_region_subtract (region, private->shape);
 
   gdk_window_shape_combine_region (window, region, 0, 0);
 }
@@ -8592,7 +8592,7 @@ gdk_window_input_shape_combine_mask (GdkWindow *window,
 					 x, y);
 
   if (region != NULL)
-    cairo_region_destroy (region);
+    gdk_region_destroy (region);
 }
 
 /**
@@ -8638,12 +8638,12 @@ gdk_window_input_shape_combine_region (GdkWindow       *window,
     return;
 
   if (private->input_shape)
-    cairo_region_destroy (private->input_shape);
+    gdk_region_destroy (private->input_shape);
 
   if (shape_region)
     {
-      private->input_shape = cairo_region_copy (shape_region);
-      cairo_region_translate (private->input_shape, offset_x, offset_y);
+      private->input_shape = gdk_region_copy (shape_region);
+      gdk_region_offset (private->input_shape, offset_x, offset_y);
     }
   else
     private->input_shape = NULL;
@@ -8673,13 +8673,13 @@ do_child_input_shapes (GdkWindow *window,
   r.width = private->width;
   r.height = private->height;
 
-  region = cairo_region_create_rectangle (&r);
+  region = gdk_region_rectangle (&r);
   remove_child_area (private, NULL, TRUE, region);
 
   if (merge && private->shape)
-    cairo_region_subtract (region, private->shape);
+    gdk_region_subtract (region, private->shape);
   if (merge && private->input_shape)
-    cairo_region_subtract (region, private->input_shape);
+    gdk_region_subtract (region, private->input_shape);
 
   gdk_window_input_shape_combine_region (window, region, 0, 0);
 }
@@ -8997,12 +8997,12 @@ _gdk_window_calculate_full_clip_region (GdkWindow *window,
     *base_y_offset = 0;
 
   if (!private->viewable || private->input_only)
-    return cairo_region_create ();
+    return gdk_region_new ();
 
   window_get_size_rectangle (window, &visible_rect);
 
   /* real_clip_region is in window coordinates */
-  real_clip_region = cairo_region_create_rectangle (&visible_rect);
+  real_clip_region = gdk_region_rectangle (&visible_rect);
 
   x_offset = y_offset = 0;
 
@@ -9049,16 +9049,16 @@ _gdk_window_calculate_full_clip_region (GdkWindow *window,
 	  visible_rect.y += child_private->y - y_offset;
 
 	  /* This shortcut is really necessary for performance when there are a lot of windows */
-	  cairo_region_get_extents (real_clip_region, &real_clip_rect);
+	  gdk_region_get_clipbox (real_clip_region, &real_clip_rect);
 	  if (visible_rect.x >= real_clip_rect.x + real_clip_rect.width ||
 	      visible_rect.x + visible_rect.width <= real_clip_rect.x ||
 	      visible_rect.y >= real_clip_rect.y + real_clip_rect.height ||
 	      visible_rect.y + visible_rect.height <= real_clip_rect.y)
 	    continue;
 
-	  tmpreg = cairo_region_create_rectangle (&visible_rect);
-	  cairo_region_subtract (real_clip_region, tmpreg);
-	  cairo_region_destroy (tmpreg);
+	  tmpreg = gdk_region_rectangle (&visible_rect);
+	  gdk_region_subtract (real_clip_region, tmpreg);
+	  gdk_region_destroy (tmpreg);
 	}
 
       /* Clip to the parent */
@@ -9067,9 +9067,9 @@ _gdk_window_calculate_full_clip_region (GdkWindow *window,
       visible_rect.x += - x_offset;
       visible_rect.y += - y_offset;
 
-      tmpreg = cairo_region_create_rectangle (&visible_rect);
-      cairo_region_intersect (real_clip_region, tmpreg);
-      cairo_region_destroy (tmpreg);
+      tmpreg = gdk_region_rectangle (&visible_rect);
+      gdk_region_intersect (real_clip_region, tmpreg);
+      gdk_region_destroy (tmpreg);
     }
 
   if (base_x_offset)
@@ -9090,7 +9090,7 @@ _gdk_window_add_damage (GdkWindow *toplevel,
   event.expose.window = toplevel;
   event.expose.send_event = FALSE;
   event.expose.region = damaged_region;
-  cairo_region_get_extents (event.expose.region, &event.expose.area);
+  gdk_region_get_clipbox (event.expose.region, &event.expose.area);
   display = gdk_drawable_get_display (event.expose.window);
   _gdk_event_queue_append (display, gdk_event_copy (&event));
 }
@@ -9193,10 +9193,10 @@ point_in_window (GdkWindowObject *window,
     x >= 0 && x < window->width &&
     y >= 0 && y < window->height &&
     (window->shape == NULL ||
-     cairo_region_contains_point (window->shape,
+     gdk_region_point_in (window->shape,
 			  x, y)) &&
     (window->input_shape == NULL ||
-     cairo_region_contains_point (window->input_shape,
+     gdk_region_point_in (window->input_shape,
 			  x, y));
 }
 
@@ -10485,8 +10485,8 @@ gdk_window_print (GdkWindowObject *window,
   g_print (" abs[%d,%d]",
 	   window->abs_x, window->abs_y);
 
-  cairo_region_get_extents (window->clip_region, &r);
-  if (cairo_region_is_empty (window->clip_region))
+  gdk_region_get_clipbox (window->clip_region, &r);
+  if (gdk_region_empty (window->clip_region))
     g_print (" clipbox[empty]");
   else
     g_print (" clipbox[%d,%d %dx%d]", r.x, r.y, r.width, r.height);
diff --git a/gdk/quartz/GdkQuartzView.c b/gdk/quartz/GdkQuartzView.c
index 5ecea10..02018ff 100644
--- a/gdk/quartz/GdkQuartzView.c
+++ b/gdk/quartz/GdkQuartzView.c
@@ -68,7 +68,7 @@
 
 -(void)drawRect:(NSRect)rect 
 {
-  cairo_rectangle_t gdk_rect;
+  GdkRectangle gdk_rect;
   GdkWindowObject *private = GDK_WINDOW_OBJECT (gdk_window);
   GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
   const NSRect *drawn_rects;
@@ -88,12 +88,12 @@
   /* Clear our own bookkeeping of regions that need display */
   if (impl->needs_display_region)
     {
-      cairo_region_destroy (impl->needs_display_region);
+      gdk_region_destroy (impl->needs_display_region);
       impl->needs_display_region = NULL;
     }
 
   [self getRectsBeingDrawn:&drawn_rects count:&count];
-  region = cairo_region_create ();
+  region = gdk_region_new ();
   
   for (i = 0; i < count; i++)
     {
@@ -102,14 +102,14 @@
       gdk_rect.width = drawn_rects[i].size.width;
       gdk_rect.height = drawn_rects[i].size.height;
       
-      cairo_region_union_rectangle (region, &gdk_rect);
+      gdk_region_union_with_rect (region, &gdk_rect);
     }
 
   impl->in_paint_rect_count++;
   _gdk_window_process_updates_recurse (gdk_window, region);
   impl->in_paint_rect_count--;
 
-  cairo_region_destroy (region);
+  gdk_region_destroy (region);
 
   if (needsInvalidateShadow)
     {
diff --git a/gdk/quartz/gdkgc-quartz.c b/gdk/quartz/gdkgc-quartz.c
index 513aff0..d0a2366 100644
--- a/gdk/quartz/gdkgc-quartz.c
+++ b/gdk/quartz/gdkgc-quartz.c
@@ -369,11 +369,11 @@ _gdk_quartz_gc_update_cg_context (GdkGC                      *gc,
     {
       CGRect rect;
       CGRect *cg_rects;
-      cairo_region_t *region;
+      GdkRectangle *rects;
       gint n_rects, i;
 
-      region = _gdk_gc_get_clip_region (gc);
-      n_rects = cairo_region_num_rectangles (region);
+      gdk_region_get_rectangles (_gdk_gc_get_clip_region (gc),
+				 &rects, &n_rects);
 
       if (n_rects == 1)
 	cg_rects = &rect;
@@ -382,16 +382,15 @@ _gdk_quartz_gc_update_cg_context (GdkGC                      *gc,
 
       for (i = 0; i < n_rects; i++)
 	{
-          cairo_rectangle_int_t cairo_rect;
-          cairo_region_get_rectangle (region, i, &cairo_rect);
-	  cg_rects[i].origin.x = cairo_rect.x + gc->clip_x_origin;
-	  cg_rects[i].origin.y = cairo_rect.y + gc->clip_y_origin;
-	  cg_rects[i].size.width = cairo_rect.width;
-	  cg_rects[i].size.height = cairo_rect.height;
+	  cg_rects[i].origin.x = rects[i].x + gc->clip_x_origin;
+	  cg_rects[i].origin.y = rects[i].y + gc->clip_y_origin;
+	  cg_rects[i].size.width = rects[i].width;
+	  cg_rects[i].size.height = rects[i].height;
 	}
 
       CGContextClipToRects (context, cg_rects, n_rects);
 
+      g_free (rects);
       if (cg_rects != &rect)
 	g_free (cg_rects);
     }
diff --git a/gdk/quartz/gdkgeometry-quartz.c b/gdk/quartz/gdkgeometry-quartz.c
index 12e8a0f..06a31f1 100644
--- a/gdk/quartz/gdkgeometry-quartz.c
+++ b/gdk/quartz/gdkgeometry-quartz.c
@@ -34,7 +34,7 @@ _gdk_quartz_window_queue_translation (GdkWindow *window,
 
   int i, n_rects;
   GdkRegion *intersection;
-  GdkRectangle rect;
+  GdkRectangle *rects;
 
   /* We will intersect the known region that needs display with the given
    * area.  This intersection will be translated by dx, dy.  For the end
@@ -44,12 +44,17 @@ _gdk_quartz_window_queue_translation (GdkWindow *window,
   if (!impl->needs_display_region)
     return;
 
-  intersection = cairo_region_copy (impl->needs_display_region);
-  cairo_region_intersect (intersection, area);
-  cairo_region_translate (intersection, dx, dy);
+  intersection = gdk_region_copy (impl->needs_display_region);
+  gdk_region_intersect (intersection, area);
+  gdk_region_offset (intersection, dx, dy);
 
-  _gdk_quartz_window_set_needs_display_in_region (window, intersection);
-  cairo_region_destroy (intersection);
+  gdk_region_get_rectangles (intersection, &rects, &n_rects);
+
+  for (i = 0; i < n_rects; i++)
+    _gdk_quartz_window_set_needs_display_in_rect (window, &rects[i]);
+
+  g_free (rects);
+  gdk_region_destroy (intersection);
 }
 
 gboolean
diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h
index 098f0f0..49aafb4 100644
--- a/gdk/quartz/gdkprivate-quartz.h
+++ b/gdk/quartz/gdkprivate-quartz.h
@@ -160,8 +160,8 @@ void       _gdk_quartz_window_did_resign_main       (GdkWindow *window);
 void       _gdk_quartz_window_debug_highlight       (GdkWindow *window,
                                                      gint       number);
 
-void       _gdk_quartz_window_set_needs_display_in_region (GdkWindow    *window,
-                                                           GdkRegion    *region);
+void       _gdk_quartz_window_set_needs_display_in_rect (GdkWindow    *window,
+                                                         GdkRectangle *rect);
 
 void       _gdk_quartz_window_update_position           (GdkWindow    *window);
 
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 7a5316f..a8e385f 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -111,28 +111,28 @@ gdk_window_impl_quartz_get_context (GdkDrawable *drawable,
     {
       CGRect rect;
       CGRect *cg_rects;
+      GdkRectangle *rects;
       gint n_rects, i;
 
-      n_rects = cairo_region_num_rectangles (window_impl->paint_clip_region);
+      gdk_region_get_rectangles (window_impl->paint_clip_region,
+                                 &rects, &n_rects);
 
       if (n_rects == 1)
-	cg_rects = &rect;
+        cg_rects = &rect;
       else
-	cg_rects = g_new (CGRect, n_rects);
+        cg_rects = g_new (CGRect, n_rects);
 
       for (i = 0; i < n_rects; i++)
-	{
-          cairo_rectangle_int_t cairo_rect;
-          cairo_region_get_rectangle (window_impl->paint_clip_region,
-                                      i, &cairo_rect);
-	  cg_rects[i].origin.x = cairo_rect.x;
-	  cg_rects[i].origin.y = cairo_rect.y;
-	  cg_rects[i].size.width = cairo_rect.width;
-	  cg_rects[i].size.height = cairo_rect.height;
-	}
+        {
+          cg_rects[i].origin.x = rects[i].x;
+          cg_rects[i].origin.y = rects[i].y;
+          cg_rects[i].size.width = rects[i].width;
+          cg_rects[i].size.height = rects[i].height;
+        }
 
-      CGContextClipToRects (context, cg_rects, n_rects);
+      CGContextClipToRects (cg_context, cg_rects, n_rects);
 
+      g_free (rects);
       if (cg_rects != &rect)
         g_free (cg_rects);
     }
@@ -188,7 +188,7 @@ gdk_window_impl_quartz_finalize (GObject *object)
   check_grab_destroy (GDK_DRAWABLE_IMPL_QUARTZ (object)->wrapper);
 
   if (impl->paint_clip_region)
-    cairo_region_destroy (impl->paint_clip_region);
+    gdk_region_destroy (impl->paint_clip_region);
 
   if (impl->transient_for)
     g_object_unref (impl->transient_for);
@@ -223,17 +223,18 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable    *paintable,
   GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (paintable);
   GdkWindowObject *private = (GdkWindowObject*)window;
   int n_rects;
+  GdkRectangle *rects = NULL;
   GdkPixmap *bg_pixmap;
   GdkRegion *clipped_and_offset_region;
   gboolean free_clipped_and_offset_region = TRUE;
 
   bg_pixmap = private->bg_pixmap;
 
-  clipped_and_offset_region = cairo_region_copy (region);
+  clipped_and_offset_region = gdk_region_copy (region);
 
-  cairo_region_intersect (clipped_and_offset_region,
+  gdk_region_intersect (clipped_and_offset_region,
                         private->clip_region_with_children);
-  cairo_region_translate (clipped_and_offset_region,
+  gdk_region_offset (clipped_and_offset_region,
                      private->abs_x, private->abs_y);
 
   if (impl->begin_paint_count == 0)
@@ -242,14 +243,14 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable    *paintable,
       free_clipped_and_offset_region = FALSE;
     }
   else
-    cairo_region_union (impl->paint_clip_region, clipped_and_offset_region);
+    gdk_region_union (impl->paint_clip_region, clipped_and_offset_region);
 
   impl->begin_paint_count++;
 
   if (bg_pixmap == GDK_NO_BG)
     goto done;
 
-  n_rects = cairo_region_num_rectangles (clipped_and_offset_region);
+  gdk_region_get_rectangles (clipped_and_offset_region, &rects, &n_rects);
 
   if (bg_pixmap == NULL)
     {
@@ -265,11 +266,9 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable    *paintable,
  
       for (i = 0; i < n_rects; i++)
         {
-          cairo_rectangle_int_t rect;
-          cairo_region_get_rectangle (clipped_and_offset_region, i, &rect);
           CGContextFillRect (cg_context,
-                             CGRectMake (rect.x, rect.y,
-                                         rect.width, rect.height));
+                             CGRectMake (rects[i].x, rects[i].y,
+                                         rects[i].width, rects[i].height));
         }
 
       gdk_quartz_drawable_release_context (GDK_DRAWABLE (impl), cg_context);
@@ -279,7 +278,6 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable    *paintable,
       int x, y;
       int x_offset, y_offset;
       int width, height;
-      cairo_int_rectangle_t rect;
       GdkGC *gc;
 
       x_offset = y_offset = 0;
@@ -312,15 +310,14 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable    *paintable,
       gdk_drawable_get_size (GDK_DRAWABLE (bg_pixmap), &width, &height);
 
       x = -x_offset;
-      cairo_region_get_rectangle (clipped_and_offset_region, 0, &rect);
-      while (x < (rect.x + rect.width))
+      while (x < (rects[0].x + rects[0].width))
         {
-          if (x + width >= rect.x)
+          if (x + width >= rects[0].x)
 	    {
               y = -y_offset;
-              while (y < (rect.y + rect.height))
+              while (y < (rects[0].y + rects[0].height))
                 {
-                  if (y + height >= rect.y)
+                  if (y + height >= rects[0].y)
                     gdk_draw_drawable (GDK_DRAWABLE (impl), gc, bg_pixmap, 0, 0, x, y, width, height);
 		  
                   y += height;
@@ -334,7 +331,8 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable    *paintable,
 
  done:
   if (free_clipped_and_offset_region)
-    cairo_region_destroy (clipped_and_offset_region);
+    gdk_region_destroy (clipped_and_offset_region);
+  g_free (rects);
 }
 
 static void
@@ -346,41 +344,38 @@ gdk_window_impl_quartz_end_paint (GdkPaintable *paintable)
 
   if (impl->begin_paint_count == 0)
     {
-      cairo_region_destroy (impl->paint_clip_region);
+      gdk_region_destroy (impl->paint_clip_region);
       impl->paint_clip_region = NULL;
     }
 }
 
 void
-_gdk_quartz_window_set_needs_display_in_region (GdkWindow    *window,
-                                                GdkRegion    *region)
+_gdk_quartz_window_set_needs_display_in_rect (GdkWindow    *window,
+                                              GdkRectangle *rect)
 {
   GdkWindowObject *private;
   GdkWindowImplQuartz *impl;
-  int i, n_rects;
 
   private = GDK_WINDOW_OBJECT (window);
   impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
 
   if (!impl->needs_display_region)
-    impl->needs_display_region = cairo_region_create ();
+    impl->needs_display_region = gdk_region_new ();
 
-  cairo_region_union (impl->needs_display_region, region);
+  gdk_region_union_with_rect (impl->needs_display_region, rect);
+
+  [impl->view setNeedsDisplayInRect:NSMakeRect (rect->x, rect->y,
+                                                rect->width, rect->height)];
 
-  n_rects = cairo_region_num_rectangles (region);
-  for (i = 0; i < n_rects; i++)
-    {
-      cairo_rectangle_int_t rect;
-      cairo_region_get_rectangle (region, i, &rect);
-      [impl->view setNeedsDisplayInRect:NSMakeRect (rect.x, rect.y,
-                                                    rect.width, rect.height)];
-    }
 }
 
 void
 _gdk_windowing_window_process_updates_recurse (GdkWindow *window,
                                                GdkRegion *region)
 {
+  int i, n_rects;
+  GdkRectangle *rects;
+
   /* Make sure to only flush each toplevel at most once if we're called
    * from process_all_updates.
    */
@@ -411,7 +406,12 @@ _gdk_windowing_window_process_updates_recurse (GdkWindow *window,
         }
     }
 
-  _gdk_quartz_window_set_needs_display_in_region (window, region);
+  gdk_region_get_rectangles (region, &rects, &n_rects);
+
+  for (i = 0; i < n_rects; i++)
+    _gdk_quartz_window_set_needs_display_in_rect (window, &rects[i]);
+
+  g_free (rects);
 
   /* NOTE: I'm not sure if we should displayIfNeeded here. It slows down a
    * lot (since it triggers the beam syncing) and things seem to work
@@ -1396,9 +1396,9 @@ move_resize_window_internal (GdkWindow *window,
           new_visible.width = old_visible.width;   /* parent has not changed size */
           new_visible.height = old_visible.height; /* parent has not changed size */
 
-          expose_region = cairo_region_create_rectangle (&new_visible);
-          old_region = cairo_region_create_rectangle (&old_visible);
-          cairo_region_subtract (expose_region, old_region);
+          expose_region = gdk_region_rectangle (&new_visible);
+          old_region = gdk_region_rectangle (&old_visible);
+          gdk_region_subtract (expose_region, old_region);
 
           /* Determine what (if any) part of the previously visible
            * part of the window can be copied without a redraw
@@ -1408,8 +1408,12 @@ move_resize_window_internal (GdkWindow *window,
           scroll_rect.y -= delta.height;
           gdk_rectangle_intersect (&scroll_rect, &old_visible, &scroll_rect);
 
-          if (!cairo_region_is_empty (expose_region))
+          if (!gdk_region_empty (expose_region))
             {
+              GdkRectangle* rects;
+              gint n_rects;
+              gint n;
+
               if (scroll_rect.width != 0 && scroll_rect.height != 0)
                 {
                   [impl->view scrollRect:NSMakeRect (scroll_rect.x,
@@ -1421,7 +1425,12 @@ move_resize_window_internal (GdkWindow *window,
 
               [impl->view setFrame:nsrect];
 
-              _gdk_quartz_window_set_needs_display_in_region (window, expose_region);
+              gdk_region_get_rectangles (expose_region, &rects, &n_rects);
+
+              for (n = 0; n < n_rects; ++n)
+                _gdk_quartz_window_set_needs_display_in_rect (window, &rects[n]);
+
+              g_free (rects);
             }
           else
             {
@@ -1429,8 +1438,8 @@ move_resize_window_internal (GdkWindow *window,
               [impl->view setNeedsDisplay:YES];
             }
 
-          cairo_region_destroy (expose_region);
-          cairo_region_destroy (old_region);
+          gdk_region_destroy (expose_region);
+          gdk_region_destroy (old_region);
         }
     }
 
diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c
index 2c4381b..52ab3fb 100644
--- a/gdk/win32/gdkdrawable-win32.c
+++ b/gdk/win32/gdkdrawable-win32.c
@@ -741,7 +741,7 @@ widen_bounds (GdkRectangle *bounds,
   bounds->width += 2 * pen_width;
   bounds->height += 2 * pen_width;
 
-  return cairo_region_create_rectangle (bounds);
+  return gdk_region_rectangle (bounds);
 }
 
 static void
@@ -819,7 +819,7 @@ gdk_win32_draw_rectangle (GdkDrawable *drawable,
 		(filled ? 0 : LINE_ATTRIBUTES),
 		draw_rectangle, region, filled, x, y, width, height);
 
-  cairo_region_destroy (region);
+  gdk_region_destroy (region);
 }
 
 static void
@@ -917,7 +917,7 @@ gdk_win32_draw_arc (GdkDrawable *drawable,
 		GDK_GC_FOREGROUND | (filled ? 0 : LINE_ATTRIBUTES),
 		draw_arc, region, filled, x, y, width, height, angle1, angle2);
 
-  cairo_region_destroy (region);
+  gdk_region_destroy (region);
 }
 
 static void
@@ -1001,7 +1001,7 @@ gdk_win32_draw_polygon (GdkDrawable *drawable,
 		GDK_GC_FOREGROUND | (filled ? 0 : LINE_ATTRIBUTES),
 		draw_polygon, region, filled, pts, npoints);
 
-  cairo_region_destroy (region);
+  gdk_region_destroy (region);
   g_free (pts);
 }
 
@@ -1295,7 +1295,7 @@ gdk_win32_draw_segments (GdkDrawable *drawable,
   generic_draw (drawable, gc, GDK_GC_FOREGROUND | LINE_ATTRIBUTES,
 		draw_segments, region, segs, nsegs);
 
-  cairo_region_destroy (region);
+  gdk_region_destroy (region);
 }
 
 static void
@@ -1397,7 +1397,7 @@ gdk_win32_draw_lines (GdkDrawable *drawable,
 			      LINE_ATTRIBUTES,
 		draw_lines, region, pts, npoints);
 
-  cairo_region_destroy (region);
+  gdk_region_destroy (region);
   g_free (pts);
 }
 
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 4528112..3773e4d 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -1286,7 +1286,7 @@ synthesize_expose_events (GdkWindow *window)
 	  event->expose.area.y = r.top;
 	  event->expose.area.width = r.right - r.left;
 	  event->expose.area.height = r.bottom - r.top;
-	  event->expose.region = cairo_region_create_rectangle (&(event->expose.area));
+	  event->expose.region = gdk_region_rectangle (&(event->expose.area));
 	  event->expose.count = 0;
   
 	  append_event (event);
@@ -1536,7 +1536,7 @@ _gdk_win32_hrgn_to_region (HRGN hrgn)
       return NULL;
     }
 
-  result = cairo_region_create ();
+  result = gdk_region_new ();
   rects = (RECT *) rgndata->Buffer;
   for (i = 0; i < rgndata->rdh.nCount; i++)
     {
@@ -1547,7 +1547,7 @@ _gdk_win32_hrgn_to_region (HRGN hrgn)
       r.width = rects[i].right - r.x;
       r.height = rects[i].bottom - r.y;
 
-      cairo_region_union_rectangle (result, &r);
+      gdk_region_union_with_rect (result, &r);
     }
 
   g_free (rgndata);
@@ -1635,9 +1635,9 @@ handle_wm_paint (MSG        *msg,
     }
 
   update_region = _gdk_win32_hrgn_to_region (hrgn);
-  if (!cairo_region_is_empty (update_region))
+  if (!gdk_region_empty (update_region))
     _gdk_window_invalidate_for_expose (window, update_region);
-  cairo_region_destroy (update_region);
+  gdk_region_destroy (update_region);
 
   DeleteObject (hrgn);
 }
diff --git a/gdk/win32/gdkgeometry-win32.c b/gdk/win32/gdkgeometry-win32.c
index 044479d..6cdb860 100644
--- a/gdk/win32/gdkgeometry-win32.c
+++ b/gdk/win32/gdkgeometry-win32.c
@@ -252,26 +252,26 @@ gdk_window_clip_changed (GdkWindow    *window,
   obj = (GdkWindowObject *) window;
   impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
   
-  old_clip_region = cairo_region_create_rectangle (old_clip);
-  new_clip_region = cairo_region_create_rectangle (new_clip);
+  old_clip_region = gdk_region_rectangle (old_clip);
+  new_clip_region = gdk_region_rectangle (new_clip);
 
   /* Trim invalid region of window to new clip rectangle
    */
   if (obj->update_area)
-    cairo_region_intersect (obj->update_area, new_clip_region);
+    gdk_region_intersect (obj->update_area, new_clip_region);
 
   /* Invalidate newly exposed portion of window
    */
-  cairo_region_subtract (new_clip_region, old_clip_region);
-  if (!cairo_region_is_empty (new_clip_region))
+  gdk_region_subtract (new_clip_region, old_clip_region);
+  if (!gdk_region_empty (new_clip_region))
     gdk_window_tmp_unset_bg (window);
   else
     {
-      cairo_region_destroy (new_clip_region);
+      gdk_region_destroy (new_clip_region);
       new_clip_region = NULL;
     }
 
-  cairo_region_destroy (old_clip_region);
+  gdk_region_destroy (old_clip_region);
 
   return new_clip_region;
 }
@@ -288,7 +288,7 @@ gdk_window_post_scroll (GdkWindow    *window,
 
   gdk_window_invalidate_region (window, new_clip_region, FALSE);
   g_print ("gdk_window_post_scroll\n");
-  cairo_region_destroy (new_clip_region);
+  gdk_region_destroy (new_clip_region);
 }
 
 #endif
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index 8056c50..4b7fd85 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -320,7 +320,7 @@ free_cache_child (GdkCacheChild *child,
                   GdkDisplay    *display)
 {
   if (child->shape)
-    cairo_region_destroy (child->shape);
+    gdk_region_destroy (child->shape);
 
   if (child->shape_selected && display)
     {
@@ -379,7 +379,7 @@ gdk_window_cache_shape_filter (GdkXEvent *xev,
           child->shape_valid = FALSE;
           if (child->shape)
             {
-              cairo_region_destroy (child->shape);
+              gdk_region_destroy (child->shape);
               child->shape = NULL;
             }
         }
@@ -621,8 +621,8 @@ is_pointer_within_shape (GdkDisplay    *display,
                                         child->xid, ShapeInput);
       if (child->shape && input_shape)
         {
-          cairo_region_intersect (child->shape, input_shape);
-          cairo_region_destroy (input_shape);
+          gdk_region_intersect (child->shape, input_shape);
+          gdk_region_destroy (input_shape);
         }
       else if (input_shape)
         {
@@ -634,7 +634,7 @@ is_pointer_within_shape (GdkDisplay    *display,
     }
 
   return child->shape == NULL ||
-         cairo_region_contains_point (child->shape, x_pos, y_pos);
+         gdk_region_point_in (child->shape, x_pos, y_pos);
 }
 
 static Window
diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c
index 248da96..1f27497 100644
--- a/gdk/x11/gdkevents-x11.c
+++ b/gdk/x11/gdkevents-x11.c
@@ -1647,7 +1647,7 @@ gdk_event_translate (GdkDisplay *display,
 	  {
 	    event->expose.type = GDK_EXPOSE;
 	    event->expose.area = expose_rect;
-	    event->expose.region = cairo_region_create_rectangle (&expose_rect);
+	    event->expose.region = gdk_region_rectangle (&expose_rect);
 	    event->expose.window = window;
 	    event->expose.count = xevent->xgraphicsexpose.count;
 
diff --git a/gdk/x11/gdkgeometry-x11.c b/gdk/x11/gdkgeometry-x11.c
index 3d572bd..7917031 100644
--- a/gdk/x11/gdkgeometry-x11.c
+++ b/gdk/x11/gdkgeometry-x11.c
@@ -148,11 +148,11 @@ queue_item_free (GdkWindowQueueItem *item)
     }
   
   if (item->type == GDK_WINDOW_QUEUE_ANTIEXPOSE)
-    cairo_region_destroy (item->u.antiexpose.area);
+    gdk_region_destroy (item->u.antiexpose.area);
   else
     {
       if (item->u.translate.area)
-	cairo_region_destroy (item->u.translate.area);
+	gdk_region_destroy (item->u.translate.area);
     }
   
   g_free (item);
@@ -235,7 +235,7 @@ _gdk_x11_window_queue_translation (GdkWindow *window,
 {
   GdkWindowQueueItem *item = g_new (GdkWindowQueueItem, 1);
   item->type = GDK_WINDOW_QUEUE_TRANSLATE;
-  item->u.translate.area = area ? cairo_region_copy (area) : NULL;
+  item->u.translate.area = area ? gdk_region_copy (area) : NULL;
   item->u.translate.dx = dx;
   item->u.translate.dy = dy;
 
@@ -265,7 +265,7 @@ _gdk_window_process_expose (GdkWindow    *window,
 			    gulong        serial,
 			    GdkRectangle *area)
 {
-  GdkRegion *invalidate_region = cairo_region_create_rectangle (area);
+  GdkRegion *invalidate_region = gdk_region_rectangle (area);
   GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (window));
 
   if (display_x11->translate_queue)
@@ -288,19 +288,19 @@ _gdk_window_process_expose (GdkWindow    *window,
 			{
 			  GdkRegion *intersection;
 
-			  intersection = cairo_region_copy (invalidate_region);
-			  cairo_region_intersect (intersection, item->u.translate.area);
-			  cairo_region_subtract (invalidate_region, intersection);
-			  cairo_region_translate (intersection, item->u.translate.dx, item->u.translate.dy);
-			  cairo_region_union (invalidate_region, intersection);
-			  cairo_region_destroy (intersection);
+			  intersection = gdk_region_copy (invalidate_region);
+			  gdk_region_intersect (intersection, item->u.translate.area);
+			  gdk_region_subtract (invalidate_region, intersection);
+			  gdk_region_offset (intersection, item->u.translate.dx, item->u.translate.dy);
+			  gdk_region_union (invalidate_region, intersection);
+			  gdk_region_destroy (intersection);
 			}
 		      else
-			cairo_region_translate (invalidate_region, item->u.translate.dx, item->u.translate.dy);
+			gdk_region_offset (invalidate_region, item->u.translate.dx, item->u.translate.dy);
 		    }
 		  else		/* anti-expose */
 		    {
-		      cairo_region_subtract (invalidate_region, item->u.antiexpose.area);
+		      gdk_region_subtract (invalidate_region, item->u.antiexpose.area);
 		    }
 		}
 	    }
@@ -313,10 +313,10 @@ _gdk_window_process_expose (GdkWindow    *window,
 	}
     }
 
-  if (!cairo_region_is_empty (invalidate_region))
+  if (!gdk_region_empty (invalidate_region))
     _gdk_window_invalidate_for_expose (window, invalidate_region);
 
-  cairo_region_destroy (invalidate_region);
+  gdk_region_destroy (invalidate_region);
 }
 
 #define __GDK_GEOMETRY_X11_C__
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 64dc38b..236f17f 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -1671,19 +1671,20 @@ gdk_window_x11_clear_region (GdkWindow *window,
 			     GdkRegion *region,
 			     gboolean   send_expose)
 {
-  cairo_rectangle_int_t rect;
-  int n_rects, i;
+  GdkRectangle *rectangles;
+  int n_rectangles, i;
 
-  n_rects = cairo_region_num_rectangles (region);
+  gdk_region_get_rectangles  (region,
+			      &rectangles,
+			      &n_rectangles);
 
-  for (i = 0; i < n_rects; i++)
-    {
-      cairo_region_get_rectangle (region, i, &rect);
-      XClearArea (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
-                  rect.x, rect.y,
-                  rect.width, rect.height,
-                  send_expose);
-    }
+  for (i = 0; i < n_rectangles; i++)
+    XClearArea (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
+		rectangles[i].x, rectangles[i].y,
+		rectangles[i].width, rectangles[i].height,
+		send_expose);
+
+  g_free (rectangles);
 }
 
 static void
@@ -4610,7 +4611,7 @@ _xwindow_get_shape (Display *xdisplay,
 			     shape_type, &rn, &ord);
 
   if (xrl == NULL || rn == 0)
-    return cairo_region_create (); /* Empty */
+    return gdk_region_new (); /* Empty */
 
   if (ord != YXBanded)
     {
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index b2c03a3..6bedc86 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -2730,9 +2730,9 @@ gtk_container_propagate_expose (GtkContainer   *container,
       g_object_ref (child_event->expose.window);
 
       child_event->expose.region = gtk_widget_region_intersect (child, event->region);
-      if (!cairo_region_is_empty (child_event->expose.region))
+      if (!gdk_region_empty (child_event->expose.region))
 	{
-	  cairo_region_get_extents (child_event->expose.region, &child_event->expose.area);
+	  gdk_region_get_clipbox (child_event->expose.region, &child_event->expose.area);
 	  gtk_widget_send_expose (child, child_event);
 	}
       gdk_event_free (child_event);
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 755a842..ebb63a1 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -1573,7 +1573,7 @@ gtk_icon_view_expose (GtkWidget *widget,
       area.width = item->width;
       area.height = item->height;
 	
-      if (cairo_region_contains_rectangle (expose->region, &area) == CAIRO_REGION_OVERLAP_OUT)
+      if (gdk_region_rect_in (expose->region, &area) == GDK_OVERLAP_RECTANGLE_OUT)
 	continue;
       
       gtk_icon_view_paint_item (icon_view, cr, item, &expose->area, 
@@ -1645,16 +1645,17 @@ gtk_icon_view_expose (GtkWidget *widget,
   
   if (icon_view->priv->doing_rubberband)
     {
-      cairo_rectangle_int_t rectangle;
+      GdkRectangle *rectangles;
       gint n_rectangles;
       
-      n_rectangles = cairo_region_num_rectangles (expose->region);
+      gdk_region_get_rectangles (expose->region,
+				 &rectangles,
+				 &n_rectangles);
       
       while (n_rectangles--)
-        {
-          cairo_region_get_rectangle (expose->region, n_rectangles--, &rectangle);
-	  gtk_icon_view_paint_rubberband (icon_view, cr, &rectangle);
-        }
+	gtk_icon_view_paint_rubberband (icon_view, cr, &rectangles[n_rectangles]);
+
+      g_free (rectangles);
     }
 
   cairo_destroy (cr);
@@ -2333,8 +2334,8 @@ gtk_icon_view_update_rubberband (gpointer data)
   new_area.width = ABS (x - icon_view->priv->rubberband_x1) + 1;
   new_area.height = ABS (y - icon_view->priv->rubberband_y1) + 1;
 
-  invalid_region = cairo_region_create_rectangle (&old_area);
-  cairo_region_union_rectangle (invalid_region, &new_area);
+  invalid_region = gdk_region_rectangle (&old_area);
+  gdk_region_union_with_rect (invalid_region, &new_area);
 
   gdk_rectangle_intersect (&old_area, &new_area, &common);
   if (common.width > 2 && common.height > 2)
@@ -2347,15 +2348,15 @@ gtk_icon_view_update_rubberband (gpointer data)
       common.width -= 2;
       common.height -= 2;
       
-      common_region = cairo_region_create_rectangle (&common);
+      common_region = gdk_region_rectangle (&common);
 
-      cairo_region_subtract (invalid_region, common_region);
-      cairo_region_destroy (common_region);
+      gdk_region_subtract (invalid_region, common_region);
+      gdk_region_destroy (common_region);
     }
   
   gdk_window_invalidate_region (icon_view->priv->bin_window, invalid_region, TRUE);
     
-  cairo_region_destroy (invalid_region);
+  gdk_region_destroy (invalid_region);
 
   icon_view->priv->rubberband_x2 = x;
   icon_view->priv->rubberband_y2 = y;  
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 216e300..10e5850 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -3597,7 +3597,7 @@ gtk_label_expose (GtkWidget      *widget,
                                                    x, y,
                                                    range,
                                                    1);
-	  cairo_region_intersect (clip, event->region);
+	  gdk_region_intersect (clip, event->region);
 
          /* FIXME should use gtk_paint, but it can't use a clip
            * region
@@ -3618,7 +3618,7 @@ gtk_label_expose (GtkWidget      *widget,
                                        &widget->style->base[state]);
 
           gdk_gc_set_clip_region (widget->style->black_gc, NULL);
-          cairo_region_destroy (clip);
+          gdk_region_destroy (clip);
         }
       else if (info)
         {
@@ -3668,7 +3668,7 @@ gtk_label_expose (GtkWidget      *widget,
               gdk_color_free (visited_link_color);
 
               gdk_gc_set_clip_region (widget->style->black_gc, NULL);
-              cairo_region_destroy (clip);
+              gdk_region_destroy (clip);
             }
 
           if (focus_link && gtk_widget_has_focus (widget))
@@ -3680,13 +3680,13 @@ gtk_label_expose (GtkWidget      *widget,
                                                        x, y,
                                                        range,
                                                        1);
-              cairo_region_get_extents (clip, &rect);
+              gdk_region_get_clipbox (clip, &rect);
 
               gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
                                &event->area, widget, "label",
                                rect.x, rect.y, rect.width, rect.height);
 
-              cairo_region_destroy (clip);
+              gdk_region_destroy (clip);
             }
         }
     }
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c
index 136e55a..1b9a7f2 100644
--- a/gtk/gtktextdisplay.c
+++ b/gtk/gtktextdisplay.c
@@ -426,7 +426,7 @@ get_selected_clip (GtkTextRenderer    *text_renderer,
 {
   gint *ranges;
   gint n_ranges, i;
-  GdkRegion *clip_region = cairo_region_create ();
+  GdkRegion *clip_region = gdk_region_new ();
   GdkRegion *tmp_region;
 
   pango_layout_line_get_x_ranges (line, start_index, end_index, &ranges, &n_ranges);
@@ -440,12 +440,12 @@ get_selected_clip (GtkTextRenderer    *text_renderer,
       rect.width = PANGO_PIXELS (ranges[2*i + 1]) - PANGO_PIXELS (ranges[2*i]);
       rect.height = height;
       
-      cairo_region_union_rectangle (clip_region, &rect);
+      gdk_region_union_with_rect (clip_region, &rect);
     }
 
-  tmp_region = cairo_region_create_rectangle (&text_renderer->clip_rect);
-  cairo_region_intersect (clip_region, tmp_region);
-  cairo_region_destroy (tmp_region);
+  tmp_region = gdk_region_rectangle (&text_renderer->clip_rect);
+  gdk_region_intersect (clip_region, tmp_region);
+  gdk_region_destroy (tmp_region);
 
   g_free (ranges);
   return clip_region;
@@ -612,7 +612,7 @@ render_para (GtkTextRenderer    *text_renderer,
               gdk_gc_set_clip_region (fg_gc, NULL);
 	      gdk_pango_renderer_set_gc (GDK_PANGO_RENDERER (text_renderer), fg_gc);
 	      
-              cairo_region_destroy (clip_region);
+              gdk_region_destroy (clip_region);
 
               /* Paint in the ends of the line */
               if (line_rect.x > line_display->left_margin * PANGO_SCALE &&
diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c
index 2fbe502..a6ca505 100644
--- a/gtk/gtktreeitem.c
+++ b/gtk/gtktreeitem.c
@@ -691,9 +691,9 @@ gtk_tree_item_expose_child (GtkWidget *child,
 
       child_event->expose.region = gtk_widget_region_intersect (child,
 								data->event->region);
-      if (!cairo_region_is_empty (child_event->expose.region))
+      if (!gdk_region_empty (child_event->expose.region))
         {
-          cairo_region_get_extents (child_event->expose.region, &child_event->expose.area);
+          gdk_region_get_clipbox (child_event->expose.region, &child_event->expose.area);
           gtk_widget_send_expose (child, child_event);
 	}
       gdk_event_free (child_event);
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 07307fe..053ed02 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -4027,8 +4027,8 @@ gtk_tree_view_update_rubber_band (GtkTreeView *tree_view)
   new_area.width = ABS (x - tree_view->priv->press_start_x) + 1;
   new_area.height = ABS (y - tree_view->priv->press_start_y) + 1;
 
-  invalid_region = cairo_region_create_rectangle (&old_area);
-  cairo_region_union_rectangle (invalid_region, &new_area);
+  invalid_region = gdk_region_rectangle (&old_area);
+  gdk_region_union_with_rect (invalid_region, &new_area);
 
   gdk_rectangle_intersect (&old_area, &new_area, &common);
   if (common.width > 2 && common.height > 2)
@@ -4041,15 +4041,15 @@ gtk_tree_view_update_rubber_band (GtkTreeView *tree_view)
       common.width -= 2;
       common.height -= 2;
 
-      common_region = cairo_region_create_rectangle (&common);
+      common_region = gdk_region_rectangle (&common);
 
-      cairo_region_subtract (invalid_region, common_region);
-      cairo_region_destroy (common_region);
+      gdk_region_subtract (invalid_region, common_region);
+      gdk_region_destroy (common_region);
     }
 
   gdk_window_invalidate_region (tree_view->priv->bin_window, invalid_region, TRUE);
 
-  cairo_region_destroy (invalid_region);
+  gdk_region_destroy (invalid_region);
 
   tree_view->priv->rubber_band_x = x;
   tree_view->priv->rubber_band_y = y;
@@ -4515,7 +4515,7 @@ gtk_tree_view_bin_expose (GtkWidget      *widget,
 	      cell_area.height -= grid_line_width;
 	    }
 
-	  if (cairo_region_contains_rectangle (event->region, &background_area) == CAIRO_REGION_OVERLAP_OUT)
+	  if (gdk_region_rect_in (event->region, &background_area) == GDK_OVERLAP_RECTANGLE_OUT)
 	    {
 	      cell_offset += column->width;
 	      continue;
@@ -4986,19 +4986,20 @@ gtk_tree_view_bin_expose (GtkWidget      *widget,
 done:
   gtk_tree_view_draw_grid_lines (tree_view, event, n_visible_columns);
 
-  if (tree_view->priv->rubber_band_status == RUBBER_BAND_ACTIVE)
-    {
-      GdkRectangle rectangle;
-      gint n_rectangles;
- 
-      n_rectangles = cairo_region_num_rectangles (event->region);
- 
-      while (n_rectangles--)
-        {
-          cairo_region_get_rectangle (event->region, n_rectangles, &rectangle);
-          gtk_tree_view_paint_rubber_band (tree_view, &rectangle);
-        }
-    }
+ if (tree_view->priv->rubber_band_status == RUBBER_BAND_ACTIVE)
+   {
+     GdkRectangle *rectangles;
+     gint n_rectangles;
+
+     gdk_region_get_rectangles (event->region,
+				&rectangles,
+				&n_rectangles);
+
+     while (n_rectangles--)
+       gtk_tree_view_paint_rubber_band (tree_view, &rectangles[n_rectangles]);
+
+     g_free (rectangles);
+   }
 
   if (cursor_path)
     gtk_tree_path_free (cursor_path);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 6eeac7a..5d660f5 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -3937,7 +3937,7 @@ gtk_widget_invalidate_widget_windows (GtkWidget *widget,
       int x, y;
       
       gdk_window_get_position (widget->window, &x, &y);
-      cairo_region_translate (region, -x, -y);
+      gdk_region_offset (region, -x, -y);
     }
 
   gdk_window_invalidate_maybe_recurse (widget->window, region,
@@ -3976,9 +3976,9 @@ gtk_widget_queue_shallow_draw (GtkWidget *widget)
       rect.y += wy;
     }
   
-  region = cairo_region_create_rectangle (&rect);
+  region = gdk_region_rectangle (&rect);
   gtk_widget_invalidate_widget_windows (widget, region);
-  cairo_region_destroy (region);
+  gdk_region_destroy (region);
 }
 
 /**
@@ -4066,11 +4066,11 @@ gtk_widget_size_allocate (GtkWidget	*widget,
 	{
 	  /* Invalidate union(old_allaction,widget->allocation) in widget->window
 	   */
-	  GdkRegion *invalidate = cairo_region_create_rectangle (&widget->allocation);
-	  cairo_region_union_rectangle (invalidate, &old_allocation);
+	  GdkRegion *invalidate = gdk_region_rectangle (&widget->allocation);
+	  gdk_region_union_with_rect (invalidate, &old_allocation);
 
 	  gdk_window_invalidate_region (widget->window, invalidate, FALSE);
-	  cairo_region_destroy (invalidate);
+	  gdk_region_destroy (invalidate);
 	}
       
       if (size_changed)
@@ -4079,11 +4079,11 @@ gtk_widget_size_allocate (GtkWidget	*widget,
 	    {
 	      /* Invalidate union(old_allaction,widget->allocation) in widget->window and descendents owned by widget
 	       */
-	      GdkRegion *invalidate = cairo_region_create_rectangle (&widget->allocation);
-	      cairo_region_union_rectangle (invalidate, &old_allocation);
+	      GdkRegion *invalidate = gdk_region_rectangle (&widget->allocation);
+	      gdk_region_union_with_rect (invalidate, &old_allocation);
 
 	      gtk_widget_invalidate_widget_windows (widget, invalidate);
-	      cairo_region_destroy (invalidate);
+	      gdk_region_destroy (invalidate);
 	    }
 	}
     }
@@ -4091,9 +4091,9 @@ gtk_widget_size_allocate (GtkWidget	*widget,
   if ((size_changed || position_changed) && widget->parent &&
       gtk_widget_get_realized (widget->parent) && GTK_CONTAINER (widget->parent)->reallocate_redraws)
     {
-      GdkRegion *invalidate = cairo_region_create_rectangle (&widget->parent->allocation);
+      GdkRegion *invalidate = gdk_region_rectangle (&widget->parent->allocation);
       gtk_widget_invalidate_widget_windows (widget->parent, invalidate);
-      cairo_region_destroy (invalidate);
+      gdk_region_destroy (invalidate);
     }
 }
 
@@ -5212,7 +5212,7 @@ gtk_widget_intersect (GtkWidget	         *widget,
  *           widgets with their own window.
  * 
  * Computes the intersection of a @widget's area and @region, returning
- * the intersection. The result may be empty, use cairo_region_is_empty() to
+ * the intersection. The result may be empty, use gdk_region_empty() to
  * check.
  **/
 GdkRegion *
@@ -5227,9 +5227,9 @@ gtk_widget_region_intersect (GtkWidget       *widget,
 
   gtk_widget_get_draw_rectangle (widget, &rect);
   
-  dest = cairo_region_create_rectangle (&rect);
+  dest = gdk_region_rectangle (&rect);
  
-  cairo_region_intersect (dest, region);
+  gdk_region_intersect (dest, region);
 
   return dest;
 }
@@ -9530,7 +9530,7 @@ expose_window (GdkWindow *window)
   gdk_drawable_get_size (GDK_DRAWABLE (window),
 			 &event.expose.area.width,
 			 &event.expose.area.height);
-  event.expose.region = cairo_region_create_rectangle (&event.expose.area);
+  event.expose.region = gdk_region_rectangle (&event.expose.area);
 
   /* If this is not double buffered, force a double buffer so that
      redirection works. */
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 78d688f..ba57dc4 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -482,8 +482,8 @@ window_expose_event (GtkWidget *widget,
                                child->allocation.y);
 
   /* draw no more than our expose event intersects our child */
-  region = cairo_region_create_rectangle (&child->allocation);
-  cairo_region_intersect (region, event->region);
+  region = gdk_region_rectangle (&child->allocation);
+  gdk_region_intersect (region, event->region);
   gdk_cairo_region (cr, region);
   cairo_clip (cr);
 
@@ -10538,7 +10538,7 @@ create_shapes (GtkWidget *widget)
       /* reset shape from mask to a region */
       x = 0;
       y = 0;
-      region = cairo_region_create ();
+      region = gdk_region_new ();
 
       while (x < 460)
         {
@@ -10550,7 +10550,7 @@ create_shapes (GtkWidget *widget)
               rect.width = 10;
               rect.height = 10;
 
-              cairo_region_union_rectangle (region, &rect);
+              gdk_region_union_with_rect (region, &rect);
               
               y += 20;
             }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]