diff -urpN gtk+-2.20.1.orig/gdk/gdk.def gtk+-2.20.1/gdk/gdk.def
--- gtk+-2.20.1.orig/gdk/gdk.def	2010-06-02 18:23:25 +0200
+++ gtk+-2.20.1/gdk/gdk.def	2010-06-02 18:24:52 +0200
@@ -669,6 +669,8 @@ EXPORTS
 	gdk_win32_hdc_get
 	gdk_win32_hdc_release
 	gdk_win32_selection_add_targets
+	gdk_win32_window_start_draw_libgtk_only
+	gdk_win32_window_end_draw_libgtk_only
 	gdk_app_launch_context_get_type 
 	gdk_app_launch_context_new
 	gdk_app_launch_context_set_display
diff -urpN gtk+-2.20.1.orig/gdk/gdkinternals.h gtk+-2.20.1/gdk/gdkinternals.h
--- gtk+-2.20.1.orig/gdk/gdkinternals.h	2010-06-02 18:23:25 +0200
+++ gtk+-2.20.1/gdk/gdkinternals.h	2010-06-02 18:24:41 +0200
@@ -423,6 +423,31 @@ void       _gdk_gc_set_clip_region_inter
 					     gboolean reset_origin);
 GdkSubwindowMode _gdk_gc_get_subwindow (GdkGC *gc);
 
+GdkDrawable *_gdk_window_start_draw_helper (GdkDrawable *drawable,
+                                            GdkGC *gc,
+                                            gint *x_offset_out,
+                                            gint *y_offset_out);
+
+#define GDK_WINDOW_BEGIN_DRAW			\
+  {							\
+    GdkDrawable *impl;					\
+    gint x_offset, y_offset;				\
+    gint old_clip_x = gc->clip_x_origin;		\
+    gint old_clip_y = gc->clip_y_origin;		\
+    gint old_ts_x = gc->ts_x_origin;			\
+    gint old_ts_y = gc->ts_y_origin;			\
+    impl = _gdk_window_start_draw_helper (drawable, gc,	\
+			      &x_offset, &y_offset);
+
+#define GDK_WINDOW_END_DRAW			    \
+    if (x_offset != 0 || y_offset != 0)			    \
+     {                                                      \
+       gdk_gc_set_clip_origin (gc, old_clip_x, old_clip_y); \
+       gdk_gc_set_ts_origin (gc, old_ts_x, old_ts_y);       \
+     }                                                      \
+  }
+
+
 /*****************************************
  * Interfaces provided by windowing code *
  *****************************************/
diff -urpN gtk+-2.20.1.orig/gdk/gdkwindow.c gtk+-2.20.1/gdk/gdkwindow.c
--- gtk+-2.20.1.orig/gdk/gdkwindow.c	2010-06-02 18:23:25 +0200
+++ gtk+-2.20.1/gdk/gdkwindow.c	2010-06-02 18:24:49 +0200
@@ -3527,8 +3527,8 @@ gdk_window_get_internal_paint_info (GdkW
     *y_offset = y_off;
 }
 
-static GdkDrawable *
-start_draw_helper (GdkDrawable *drawable,
+GdkDrawable *
+_gdk_window_start_draw_helper (GdkDrawable *drawable,
 		   GdkGC *gc,
 		   gint *x_offset_out,
 		   gint *y_offset_out)
@@ -3617,25 +3617,6 @@ start_draw_helper (GdkDrawable *drawable
   return impl;
 }
 
-#define BEGIN_DRAW					\
-  {							\
-    GdkDrawable *impl;					\
-    gint x_offset, y_offset;				\
-    gint old_clip_x = gc->clip_x_origin;		\
-    gint old_clip_y = gc->clip_y_origin;		\
-    gint old_ts_x = gc->ts_x_origin;			\
-    gint old_ts_y = gc->ts_y_origin;			\
-    impl = start_draw_helper (drawable, gc,		\
-			      &x_offset, &y_offset);
-
-#define END_DRAW					    \
-    if (x_offset != 0 || y_offset != 0)			    \
-     {                                                      \
-       gdk_gc_set_clip_origin (gc, old_clip_x, old_clip_y); \
-       gdk_gc_set_ts_origin (gc, old_ts_x, old_ts_y);       \
-     }                                                      \
-  }
-
 static GdkGC *
 gdk_window_create_gc (GdkDrawable     *drawable,
 		      GdkGCValues     *values,
@@ -3662,10 +3643,10 @@ gdk_window_draw_rectangle (GdkDrawable *
   if (GDK_WINDOW_DESTROYED (drawable))
     return;
 
-  BEGIN_DRAW;
+  GDK_WINDOW_BEGIN_DRAW;
   gdk_draw_rectangle (impl, gc, filled,
 		      x - x_offset, y - y_offset, width, height);
-  END_DRAW;
+  GDK_WINDOW_END_DRAW;
 }
 
 static void
@@ -3682,11 +3663,11 @@ gdk_window_draw_arc (GdkDrawable *drawab
   if (GDK_WINDOW_DESTROYED (drawable))
     return;
 
-  BEGIN_DRAW;
+  GDK_WINDOW_BEGIN_DRAW;
   gdk_draw_arc (impl, gc, filled,
 		x - x_offset, y - y_offset,
 		width, height, angle1, angle2);
-  END_DRAW;
+  GDK_WINDOW_END_DRAW;
 }
 
 static void
@@ -3701,7 +3682,7 @@ gdk_window_draw_polygon (GdkDrawable *dr
   if (GDK_WINDOW_DESTROYED (drawable))
     return;
 
-  BEGIN_DRAW;
+  GDK_WINDOW_BEGIN_DRAW;
 
   if (x_offset != 0 || y_offset != 0)
     {
@@ -3722,7 +3703,7 @@ gdk_window_draw_polygon (GdkDrawable *dr
   if (new_points != points)
     g_free (new_points);
 
-  END_DRAW;
+  GDK_WINDOW_END_DRAW;
 }
 
 static void
@@ -3737,10 +3718,10 @@ gdk_window_draw_text (GdkDrawable *drawa
   if (GDK_WINDOW_DESTROYED (drawable))
     return;
 
-  BEGIN_DRAW;
+  GDK_WINDOW_BEGIN_DRAW;
   gdk_draw_text (impl, font, gc,
 		 x - x_offset, y - y_offset, text, text_length);
-  END_DRAW;
+  GDK_WINDOW_END_DRAW;
 }
 
 static void
@@ -3755,10 +3736,10 @@ gdk_window_draw_text_wc (GdkDrawable
   if (GDK_WINDOW_DESTROYED (drawable))
     return;
 
-  BEGIN_DRAW;
+  GDK_WINDOW_BEGIN_DRAW;
   gdk_draw_text_wc (impl, font, gc,
 		    x - x_offset, y - y_offset, text, text_length);
-  END_DRAW;
+  GDK_WINDOW_END_DRAW;
 }
 
 static GdkDrawable *
@@ -3962,7 +3943,7 @@ gdk_window_draw_drawable (GdkDrawable *d
   if (GDK_WINDOW_DESTROYED (drawable))
     return;
 
-  BEGIN_DRAW;
+  GDK_WINDOW_BEGIN_DRAW;
 
   /* Call the method directly to avoid getting the composite drawable again */
   GDK_DRAWABLE_GET_CLASS (impl)->draw_drawable_with_src (impl, gc,
@@ -4031,7 +4012,7 @@ gdk_window_draw_drawable (GdkDrawable *d
 	}
     }
 
-  END_DRAW;
+  GDK_WINDOW_END_DRAW;
 }
 
 static void
@@ -4045,7 +4026,7 @@ gdk_window_draw_points (GdkDrawable *dra
   if (GDK_WINDOW_DESTROYED (drawable))
     return;
 
-  BEGIN_DRAW;
+  GDK_WINDOW_BEGIN_DRAW;
 
   if (x_offset != 0 || y_offset != 0)
     {
@@ -4066,7 +4047,7 @@ gdk_window_draw_points (GdkDrawable *dra
   if (new_points != points)
     g_free (new_points);
 
-  END_DRAW;
+  GDK_WINDOW_END_DRAW;
 }
 
 static void
@@ -4080,7 +4061,7 @@ gdk_window_draw_segments (GdkDrawable *d
   if (GDK_WINDOW_DESTROYED (drawable))
     return;
 
-  BEGIN_DRAW;
+  GDK_WINDOW_BEGIN_DRAW;
 
   if (x_offset != 0 || y_offset != 0)
     {
@@ -4103,7 +4084,7 @@ gdk_window_draw_segments (GdkDrawable *d
   if (new_segs != segs)
     g_free (new_segs);
 
-  END_DRAW;
+  GDK_WINDOW_END_DRAW;
 }
 
 static void
@@ -4117,7 +4098,7 @@ gdk_window_draw_lines (GdkDrawable *draw
   if (GDK_WINDOW_DESTROYED (drawable))
     return;
 
-  BEGIN_DRAW;
+  GDK_WINDOW_BEGIN_DRAW;
 
   if (x_offset != 0 || y_offset != 0)
     {
@@ -4138,7 +4119,7 @@ gdk_window_draw_lines (GdkDrawable *draw
   if (new_points != points)
     g_free (new_points);
 
-  END_DRAW;
+  GDK_WINDOW_END_DRAW;
 }
 
 static void
@@ -4152,10 +4133,10 @@ gdk_window_draw_glyphs (GdkDrawable
   if (GDK_WINDOW_DESTROYED (drawable))
     return;
 
-  BEGIN_DRAW;
+  GDK_WINDOW_BEGIN_DRAW;
   gdk_draw_glyphs (impl, gc, font,
 		   x - x_offset, y - y_offset, glyphs);
-  END_DRAW;
+  GDK_WINDOW_END_DRAW;
 }
 
 static void
@@ -4172,7 +4153,7 @@ gdk_window_draw_glyphs_transformed (GdkD
   if (GDK_WINDOW_DESTROYED (drawable))
     return;
 
-  BEGIN_DRAW;
+  GDK_WINDOW_BEGIN_DRAW;
 
   if (x_offset != 0 || y_offset != 0)
     {
@@ -4201,7 +4182,7 @@ gdk_window_draw_glyphs_transformed (GdkD
 
   gdk_draw_glyphs_transformed (impl, gc, matrix, font, x, y, glyphs);
 
-  END_DRAW;
+  GDK_WINDOW_END_DRAW;
 }
 
 typedef struct {
@@ -4651,11 +4632,11 @@ gdk_window_draw_image (GdkDrawable *draw
   if (GDK_WINDOW_DESTROYED (drawable))
     return;
 
-  BEGIN_DRAW;
+  GDK_WINDOW_BEGIN_DRAW;
   gdk_draw_image (impl, gc, image, xsrc, ysrc,
 		  xdest - x_offset, ydest - y_offset,
 		  width, height);
-  END_DRAW;
+  GDK_WINDOW_END_DRAW;
 }
 
 static void
@@ -4683,7 +4664,7 @@ gdk_window_draw_pixbuf (GdkDrawable
   if (!gc)
     gc = _gdk_drawable_get_scratch_gc (drawable, FALSE);
 
-  BEGIN_DRAW;
+  GDK_WINDOW_BEGIN_DRAW;
 
   klass = GDK_DRAWABLE_GET_CLASS (impl);
 
@@ -4697,7 +4678,7 @@ gdk_window_draw_pixbuf (GdkDrawable
 			dest_x - x_offset, dest_y - y_offset,
 			width, height,
 			dither, x_dither, y_dither);
-  END_DRAW;
+  GDK_WINDOW_END_DRAW;
 }
 
 static void
@@ -4711,7 +4692,7 @@ gdk_window_draw_trapezoids (GdkDrawable
   if (GDK_WINDOW_DESTROYED (drawable))
     return;
 
-  BEGIN_DRAW;
+  GDK_WINDOW_BEGIN_DRAW;
 
   if (x_offset != 0 || y_offset != 0)
     {
@@ -4735,7 +4716,7 @@ gdk_window_draw_trapezoids (GdkDrawable
 
   g_free (new_trapezoids);
 
-  END_DRAW;
+  GDK_WINDOW_END_DRAW;
 }
 
 static void
diff -urpN gtk+-2.20.1.orig/gdk/win32/gdkwin32.h gtk+-2.20.1/gdk/win32/gdkwin32.h
--- gtk+-2.20.1.orig/gdk/win32/gdkwin32.h	2010-06-02 18:23:25 +0200
+++ gtk+-2.20.1/gdk/win32/gdkwin32.h	2010-06-02 18:24:33 +0200
@@ -107,6 +107,23 @@ GdkPixbuf    *gdk_win32_icon_to_pixbuf_l
 HICON         gdk_win32_pixbuf_to_hicon_libgtk_only (GdkPixbuf *pixbuf);
 void          gdk_win32_set_modal_dialog_libgtk_only (HWND window);
 
+GdkDrawable  *gdk_win32_window_start_draw_libgtk_only (GdkDrawable *drawable,
+                                                       GdkGC *gc,
+                                                       gint *x_offset_out,
+                                                       gint *y_offset_out,
+                                                       gint *clip_x_out,
+                                                       gint *clip_y_out,
+                                                       gint *ts_x_out,
+                                                       gint *ts_y_out);
+void          gdk_win32_window_end_draw_libgtk_only (GdkGC *gc,
+                                                     gint x_offset,
+                                                     gint y_offset,
+                                                     gint clip_x,
+                                                     gint clip_y,
+                                                     gint ts_x,
+                                                     gint ts_y);
+
+
 G_END_DECLS
 
 #endif /* __GDK_WIN32_H__ */
diff -urpN gtk+-2.20.1.orig/gdk/win32/gdkwindow-win32.c gtk+-2.20.1/gdk/win32/gdkwindow-win32.c
--- gtk+-2.20.1.orig/gdk/win32/gdkwindow-win32.c	2010-06-02 18:23:25 +0200
+++ gtk+-2.20.1/gdk/win32/gdkwindow-win32.c	2010-06-02 18:24:36 +0200
@@ -3545,3 +3545,55 @@ gdk_window_impl_iface_init (GdkWindowImp
   iface->input_window_destroy = _gdk_input_window_destroy;
   iface->input_window_crossing = _gdk_input_crossing_event;
 }
+
+#define GDK_WIN32_MACRO_BEGIN \
+  {
+
+#define GDK_WIN32_MACRO_END \
+  }
+
+GdkDrawable *gdk_win32_window_start_draw_libgtk_only (GdkDrawable *drawable,
+                                                      GdkGC *gc,
+                                                      gint *x_offset_out,
+                                                      gint *y_offset_out,
+                                                      gint *clip_x_out,
+                                                      gint *clip_y_out,
+                                                      gint *ts_x_out,
+                                                      gint *ts_y_out)
+{
+  if (GDK_WINDOW_DESTROYED (drawable))
+    return NULL;
+
+  GDK_WINDOW_BEGIN_DRAW;
+  
+  *x_offset_out = x_offset;
+  *y_offset_out = y_offset;
+  *clip_x_out = old_clip_x;
+  *clip_y_out = old_clip_y;
+  *ts_x_out = old_ts_x;
+  *ts_y_out = old_ts_y;
+  
+  return impl;
+  
+  GDK_WIN32_MACRO_END;
+  
+  return NULL;
+}
+
+void gdk_win32_window_end_draw_libgtk_only (GdkGC *gc,
+                                            gint x_offset,
+                                            gint y_offset,
+                                            gint clip_x,
+                                            gint clip_y,
+                                            gint ts_x,
+                                            gint ts_y)
+{
+  GDK_WIN32_MACRO_BEGIN;
+  
+  gint old_clip_x = clip_x;
+  gint old_clip_y = clip_y;
+  gint old_ts_x = ts_x;
+  gint old_ts_y = ts_y;
+  
+  GDK_WINDOW_END_DRAW;
+}
diff -urpN gtk+-2.20.1.orig/modules/engines/ms-windows/xp_theme.c gtk+-2.20.1/modules/engines/ms-windows/xp_theme.c
--- gtk+-2.20.1.orig/modules/engines/ms-windows/xp_theme.c	2010-06-02 18:23:25 +0200
+++ gtk+-2.20.1/modules/engines/ms-windows/xp_theme.c	2010-06-02 18:24:55 +0200
@@ -849,6 +849,18 @@ xp_theme_map_gtk_state (XpThemeElement e
   return ret;
 }
 
+struct _GdkWindowPaint
+{
+  GdkRegion *region;
+  GdkPixmap *pixmap;
+  gint x_offset;
+  gint y_offset;
+  cairo_surface_t *surface;
+  guint uses_implicit : 1;
+  guint flushed : 1;
+  guint32 region_tag;
+};
+
 gboolean
 xp_theme_draw (GdkWindow *win, XpThemeElement element, GtkStyle *style,
 	       int x, int y, int width, int height,
@@ -856,10 +868,13 @@ xp_theme_draw (GdkWindow *win, XpThemeEl
 {
   HTHEME theme;
   RECT rect, clip, *pClip;
-  int xoff, yoff;
   HDC dc;
   GdkDrawable *drawable;
+  GdkGC *gc = style->dark_gc[state_type];
   int part_state;
+  gint x_offset, y_offset;
+  gint clip_x, clip_y;
+  gint ts_x, ts_y;
 
   if (!xp_theme_is_drawable (element))
     return FALSE;
@@ -871,26 +886,21 @@ xp_theme_draw (GdkWindow *win, XpThemeEl
   /* FIXME: Recheck its function */
   enable_theme_dialog_texture_func (GDK_WINDOW_HWND (win), ETDT_ENABLETAB);
 
-  if (!GDK_IS_WINDOW (win))
-    {
-      xoff = 0;
-      yoff = 0;
-      drawable = win;
-    }
-  else
-    {
-      gdk_window_get_internal_paint_info (win, &drawable, &xoff, &yoff);
-    }
-
-  rect.left = x - xoff;
-  rect.top = y - yoff;
+  drawable = gdk_win32_window_start_draw_libgtk_only(win,
+                                                     gc,
+                                                     &x_offset, &y_offset,
+													 &clip_x, &clip_y,
+													 &ts_x, &ts_y);
+  
+  rect.left = x - x_offset;
+  rect.top = y - y_offset;
   rect.right = rect.left + width;
   rect.bottom = rect.top + height;
 
   if (area)
     {
-      clip.left = area->x - xoff;
-      clip.top = area->y - yoff;
+      clip.left = area->x - x_offset;
+      clip.top = area->y - y_offset;
       clip.right = clip.left + area->width;
       clip.bottom = clip.top + area->height;
 
@@ -901,8 +911,7 @@ xp_theme_draw (GdkWindow *win, XpThemeEl
       pClip = NULL;
     }
 
-  gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
-  dc = gdk_win32_hdc_get (drawable, style->dark_gc[state_type], 0);
+  dc = gdk_win32_hdc_get (drawable, gc, 0);
   if (!dc)
     return FALSE;
 
@@ -911,17 +920,19 @@ xp_theme_draw (GdkWindow *win, XpThemeEl
   draw_theme_background_func (theme, dc, element_part_map[element],
 			      part_state, &rect, pClip);
 
-  gdk_win32_hdc_release (drawable, style->dark_gc[state_type], 0);
+  gdk_win32_hdc_release (drawable, gc, 0);
 
+  gdk_win32_window_end_draw_libgtk_only (gc,
+                                         x_offset, y_offset,
+                                         clip_x, clip_y,
+                                         ts_x, ts_y);
+  
   return TRUE;
 }
 
 gboolean
 xp_theme_is_active (void)
 {
-  /* Workaround for bug #598299 */
-  return FALSE;
-
   return use_xp_theme;
 }
 
