diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 46414ff..1f0738a 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -3497,7 +3497,12 @@ paint_decorated_window (GtkStyle *style,
 
   gradient = cairo_pattern_create_linear (width / 2 - 1, vmargin,
                                           width / 2 + 1, height);
-  color = &style->bg[state_type];
+  if (GTK_IS_WINDOW (widget) &&
+      gtk_window_has_toplevel_focus (GTK_WINDOW (widget)) &&
+      gtk_window_is_active (GTK_WINDOW (widget)))
+    color = &style->bg[GTK_STATE_SELECTED];
+  else
+    color = &style->bg[GTK_STATE_NORMAL];
   cairo_pattern_add_color_stop_rgba (gradient, 0,
 				     color->red / 65535.,
 				     color->green / 65535.,
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 1c6af7a..c247498 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5121,13 +5121,19 @@ is_client_side_decorated (GtkWindow *window)
   GtkWindowPrivate *priv;
   gboolean client_side_decorated;
 
+  if (!window->decorated)
+    return FALSE;
+
   priv = GTK_WINDOW_GET_PRIVATE (window);
 
+  if (priv->disable_client_side_decorations)
+    return FALSE;
+
   gtk_widget_style_get (GTK_WIDGET (window),
                         "client-side-decorated", &client_side_decorated,
                         NULL);
 
-  return client_side_decorated && window->decorated && !priv->disable_client_side_decorations;
+  return client_side_decorated;
 }
 
 static void
@@ -5973,6 +5979,9 @@ gtk_window_focus_in_event (GtkWidget     *widget,
     {
       _gtk_window_set_has_toplevel_focus (window, TRUE);
       _gtk_window_set_is_active (window, TRUE);
+      /* FIXME only invalidate the frame area */
+      if (is_client_side_decorated (widget))
+        gtk_widget_queue_draw (widget);
     }
       
   return FALSE;
@@ -5986,6 +5995,9 @@ gtk_window_focus_out_event (GtkWidget     *widget,
 
   _gtk_window_set_has_toplevel_focus (window, FALSE);
   _gtk_window_set_is_active (window, FALSE);
+  /* FIXME only invalidate the frame area */
+  if (is_client_side_decorated (widget))
+    gtk_widget_queue_draw (widget);
 
   return FALSE;
 }
@@ -7340,11 +7352,16 @@ static void
 gtk_window_paint (GtkWidget     *widget,
 		  GdkRectangle *area)
 {
-#if 0
+#if 1
   if (is_client_side_decorated (GTK_WINDOW (widget)))
     {
+      GtkAllocation *alloc = &(GTK_WINDOW (widget)->bin.child->allocation);
+      /* FIXME: don't the whole window twice */
       gtk_paint_box (widget->style, widget->window, GTK_STATE_NORMAL, 
 		     GTK_SHADOW_OUT, area, widget, "decoration", 0, 0, -1, -1);
+      gtk_paint_flat_box (widget->style, widget->window, GTK_STATE_NORMAL,
+                          GTK_SHADOW_NONE, area, widget, "base",
+                          alloc->x, alloc->y, alloc->width, alloc->height);
     }
   else
     {
