Root frame window is now handle by obclient
authorBenoit Gschwind <doth.gschwind@gmail.com>
Wed, 20 Feb 2008 22:44:55 +0000 (23:44 +0100)
committerDana Jansens <danakj@orodu.net>
Thu, 21 Feb 2008 17:06:18 +0000 (12:06 -0500)
engines/default/plugin.c
openbox/client.c

index 46275401aa0e0bd6e1645791daaa3a8295e08d01..fad3e60de9f5dedad2d40385f7e011c959aadc73 100644 (file)
@@ -119,8 +119,7 @@ gpointer frame_new(struct _ObClient * client, Window w_client, Window w_frame)
         attrib.background_pixel = BlackPixel(obp_display, obp_screen);
         attrib.border_pixel = BlackPixel(obp_display, obp_screen);
     }
-    self->window = createWindow(RootWindow(obp_display, obp_screen), visual,
-            mask, &attrib);
+    self->window = w_frame;
 
     /* create the visible decor windows */
 
index a9cbd9175bbed305a6f8fe4bbc8536d10d82e06b..dace803639d84a6a5ba33f7e6aab1c6682d8a035 100644 (file)
@@ -107,6 +107,33 @@ static void client_call_notifies(ObClient *self, GSList *list);
 static void client_ping_event(ObClient *self, gboolean dead);
 static void client_prompt_kill(ObClient *self);
 
+Window createWindow(Window parent, Visual *visual, gulong mask,
+        XSetWindowAttributes *attrib)
+{
+    return XCreateWindow(obt_display, parent, 0, 0, 1, 1, 0, (visual ? 32
+            : RrDepth(ob_rr_inst)), InputOutput, (visual ? visual
+            : RrVisual(ob_rr_inst)), mask, attrib);
+
+}
+
+Visual *check_32bit_client(ObClient *c)
+{
+    XWindowAttributes wattrib;
+    Status ret;
+
+    /* we're already running at 32 bit depth, yay. we don't need to use their
+     visual */
+    if (RrDepth(ob_rr_inst) == 32)
+        return NULL;
+
+    ret = XGetWindowAttributes(obt_display, c->w_client, &wattrib);
+    g_assert(ret != BadDrawable);
+    g_assert(ret != BadWindow);
+
+    if (wattrib.depth == 32)
+        return wattrib.visual;
+    return NULL;
+}
 
 void client_startup(gboolean reconfig)
 {
@@ -229,6 +256,21 @@ void client_manage(Window window, ObPrompt *prompt)
         XChangeSaveSet(obt_display, window, SetModeInsert);
 
     /* create the decoration frame for the client window */
+    Visual *visual = check_32bit_client(self);
+    gulong mask = 0;
+    XSetWindowAttributes attrib;
+    if (visual) {
+        /* client has a 32-bit visual */
+        mask |= CWColormap | CWBackPixel | CWBorderPixel;
+        /* create a colormap with the visual */
+        attrib.colormap = XCreateColormap(
+                obt_display, RootWindow(obt_display, ob_screen), visual,
+                AllocNone);
+        attrib.background_pixel = BlackPixel(obt_display, ob_screen);
+        attrib.border_pixel = BlackPixel(obt_display, ob_screen);
+    }
+    self->w_frame = createWindow(RootWindow(obt_display, ob_screen), visual,
+            mask, &attrib);
     self->frame = render_plugin->frame_new(self, self->w_client, self->w_frame);
     render_plugin->frame_grab(self->frame, window_map);
 
@@ -582,6 +624,21 @@ ObClient *client_fake_manage(Window window)
     client_setup_decor_and_functions(self, FALSE);
 
     /* create the decoration frame for the client window and adjust its size */
+    Visual *visual = check_32bit_client(self);
+    gulong mask = 0;
+    XSetWindowAttributes attrib;
+    if (visual) {
+        /* client has a 32-bit visual */
+        mask |= CWColormap | CWBackPixel | CWBorderPixel;
+        /* create a colormap with the visual */
+        attrib.colormap = XCreateColormap(
+                obt_display, RootWindow(obt_display, ob_screen), visual,
+                AllocNone);
+        attrib.background_pixel = BlackPixel(obt_display, ob_screen);
+        attrib.border_pixel = BlackPixel(obt_display, ob_screen);
+    }
+    self->w_frame = createWindow(RootWindow(obt_display, ob_screen), visual,
+            mask, &attrib);
     self->frame = render_plugin->frame_new(self, self->w_client, self->w_frame);
     render_plugin->frame_set_decorations (self->frame, self->decorations);
     render_plugin->frame_update_title (self->frame, self->title);