Index: openbox/openbox/client.c
===================================================================
--- openbox.orig/openbox/client.c
+++ openbox/openbox/client.c
@@ -284,7 +284,7 @@ void client_manage(Window window)
     XChangeSaveSet(ob_display, window, SetModeInsert);
 
     /* create the decoration frame for the client window */
-    self->frame = frame_new();
+    self->frame = frame_new(window);
 
     frame_grab_client(self->frame, self);
 
Index: openbox/openbox/frame.c
===================================================================
--- openbox.orig/openbox/frame.c
+++ openbox/openbox/frame.c
@@ -47,19 +47,28 @@ static gboolean flash_timeout(gpointer d
 static void set_theme_statics(ObFrame *self);
 static void free_theme_statics(ObFrame *self);
 
-static Window createWindow(Window parent, gulong mask,
-                           XSetWindowAttributes *attrib)
+
+static Window createWindow(Window parent, gint depth, Visual *vis,
+                           gulong mask, XSetWindowAttributes *attrib)
 {
+    if (!depth)
+        depth = RrDepth(ob_rr_inst);
+
+    if (!vis)
+        vis = RrVisual(ob_rr_inst);
+
     return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
-                         RrDepth(ob_rr_inst), InputOutput,
-                         RrVisual(ob_rr_inst), mask, attrib);
-                       
+                         depth, InputOutput, vis, mask, attrib);
 }
 
-ObFrame *frame_new()
+ObFrame *frame_new(Window win)
 {
     XSetWindowAttributes attrib;
+    XWindowAttributes child_attrs;
+    Status s;
     gulong mask;
+    Visual *vis = NULL;
+    gint depth = 0;
     ObFrame *self;
 
     self = g_new0(ObFrame, 1);
@@ -70,36 +79,50 @@ ObFrame *frame_new()
     mask = CWEventMask;
     attrib.event_mask = FRAME_EVENTMASK;
     self->window = createWindow(RootWindow(ob_display, ob_screen),
+                                depth, vis,
                                 mask, &attrib);
 
     mask = 0;
-    self->plate = createWindow(self->window, mask, &attrib);
+
+    /* is this an ARGB window? */
+    s = XGetWindowAttributes(ob_display, win, &child_attrs);
+    if (s != BadDrawable && s != BadWindow && child_attrs.depth == 32) {
+        vis = child_attrs.visual;
+        depth = child_attrs.depth;
+        attrib.colormap = child_attrs.colormap;
+    }
+
+    self->plate = createWindow(self->window, depth, vis, mask, &attrib);
 
     mask = CWEventMask;
     attrib.event_mask = ELEMENT_EVENTMASK;
-    self->title = createWindow(self->window, mask, &attrib);
+
+	depth = 0;
+	vis = NULL;
+
+    self->title = createWindow(self->window, depth, vis, mask, &attrib);
 
     mask |= CWCursor;
     attrib.cursor = ob_cursor(OB_CURSOR_NORTHWEST);
-    self->tlresize = createWindow(self->title, mask, &attrib);
+    self->tlresize = createWindow(self->title, depth, vis, mask, &attrib);
     attrib.cursor = ob_cursor(OB_CURSOR_NORTHEAST);
-    self->trresize = createWindow(self->title, mask, &attrib);
+    self->trresize = createWindow(self->title, depth, vis, mask, &attrib);
 
     mask &= ~CWCursor;
-    self->label = createWindow(self->title, mask, &attrib);
-    self->max = createWindow(self->title, mask, &attrib);
-    self->close = createWindow(self->title, mask, &attrib);
-    self->desk = createWindow(self->title, mask, &attrib);
-    self->shade = createWindow(self->title, mask, &attrib);
-    self->icon = createWindow(self->title, mask, &attrib);
-    self->iconify = createWindow(self->title, mask, &attrib);
-    self->handle = createWindow(self->window, mask, &attrib);
+    self->label = createWindow(self->title, depth, vis, mask, &attrib);
+    self->max = createWindow(self->title, depth, vis, mask, &attrib);
+    self->close = createWindow(self->title, depth, vis, mask, &attrib);
+    self->desk = createWindow(self->title, depth, vis, mask, &attrib);
+    self->shade = createWindow(self->title, depth, vis, mask, &attrib);
+    self->icon = createWindow(self->title, depth, vis, mask, &attrib);
+    self->iconify = createWindow(self->title, depth, vis, mask, &attrib);
+    self->handle = createWindow(self->window, depth, vis, mask, &attrib);
 
     mask |= CWCursor;
     attrib.cursor = ob_cursor(OB_CURSOR_SOUTHWEST);
-    self->lgrip = createWindow(self->handle, mask, &attrib);
+    self->lgrip = createWindow(self->handle, depth, vis, mask, &attrib);
     attrib.cursor = ob_cursor(OB_CURSOR_SOUTHEAST);
-    self->rgrip = createWindow(self->handle, mask, &attrib); 
+    self->rgrip = createWindow(self->handle, depth, vis, mask, &attrib);
 
     self->focused = FALSE;
 
Index: openbox/openbox/frame.h
===================================================================
--- openbox.orig/openbox/frame.h
+++ openbox/openbox/frame.h
@@ -141,7 +141,7 @@ struct _ObFrame
     GTimeVal  flash_end;
 };
 
-ObFrame *frame_new();
+ObFrame *frame_new(Window win);
 void frame_show(ObFrame *self);
 void frame_hide(ObFrame *self);
 void frame_adjust_theme(ObFrame *self);

