Signed-off-by: Julien Danjou <[email protected]>
---
 client.c   |   17 -----------------
 layout.c   |    7 +++++++
 structs.h  |    2 ++
 titlebar.c |   27 ++++++++++++++++++++++++++-
 titlebar.h |    1 +
 5 files changed, 36 insertions(+), 18 deletions(-)

diff --git a/client.c b/client.c
index da6262d..88bdc25 100644
--- a/client.c
+++ b/client.c
@@ -234,8 +234,6 @@ client_ban(client_t *c)
                              XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y,
                              request);
 
-        titlebar_ban(c->titlebar);
-
         c->isbanned = true;
 
         /* All the wiboxes (may) need to be repositioned. */
@@ -1053,21 +1051,6 @@ client_unban(client_t *c)
                               request);
         window_configure(c->win, c->geometries.internal, c->border);
 
-        /* Do this manually because the system doesn't know we moved the 
toolbar.
-         * Note that !isvisible titlebars are unmapped and for fullscreen it'll
-         * end up offscreen anyway. */
-        if(c->titlebar)
-        {
-            simple_window_t *sw = &c->titlebar->sw;
-            /* All resizing is done, so only move now. */
-            request[0] = sw->geometry.x;
-            request[1] = sw->geometry.y;
-
-            xcb_configure_window(globalconf.connection, sw->window,
-                                XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y,
-                                request);
-        }
-
         c->isbanned = false;
 
         /* All the wiboxes (may) need to be repositioned. */
diff --git a/layout.c b/layout.c
index f4a5c09..4ba1650 100644
--- a/layout.c
+++ b/layout.c
@@ -22,6 +22,7 @@
 #include "layout.h"
 #include "tag.h"
 #include "window.h"
+#include "titlebar.h"
 #include "screen.h"
 
 extern awesome_t globalconf;
@@ -46,10 +47,16 @@ arrange(int screen)
                                      select_input_val);
 
         if(client_isvisible(c, screen))
+        {
             client_unban(c);
+            titlebar_unban(c->titlebar);
+        }
         /* we don't touch other screens windows */
         else if(c->screen == screen)
+        {
             client_ban(c);
+            titlebar_ban(c->titlebar);
+        }
     }
 
     /* Reset status before calling arrange hook.
diff --git a/structs.h b/structs.h
index 3c1e5f3..5d1c385 100644
--- a/structs.h
+++ b/structs.h
@@ -110,6 +110,8 @@ typedef struct
     char *cursor;
     /** Background image */
     image_t *bg_image;
+    /* Banned? used for titlebars */
+    bool isbanned;
     /** Button bindings */
     button_array_t buttons;
 } wibox_t;
diff --git a/titlebar.c b/titlebar.c
index d5de3e4..430ed09 100644
--- a/titlebar.c
+++ b/titlebar.c
@@ -68,7 +68,7 @@ void
 titlebar_ban(wibox_t *titlebar)
 {
     /* Do it manually because client geometry remains unchanged. */
-    if(titlebar)
+    if(titlebar && !titlebar->isbanned)
     {
         simple_window_t *sw = &titlebar->sw;
 
@@ -80,6 +80,31 @@ titlebar_ban(wibox_t *titlebar)
                                  XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y,
                                  request);
         }
+
+        titlebar->isbanned = true;
+    }
+}
+
+/** Move a titlebar on top of its client.
+ * \param titlebar The titlebar.
+ */
+void
+titlebar_unban(wibox_t *titlebar)
+{
+    /* Do this manually because the system doesn't know we moved the toolbar.
+     * Note that !isvisible titlebars are unmapped and for fullscreen it'll
+     * end up offscreen anyway. */
+    if(titlebar && titlebar->isbanned)
+    {
+        simple_window_t *sw = &titlebar->sw;
+        /* All resizing is done, so only move now. */
+        uint32_t request[] = { sw->geometry.x, sw->geometry.y };
+
+        xcb_configure_window(globalconf.connection, sw->window,
+                            XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y,
+                            request);
+
+        titlebar->isbanned = false;
     }
 }
 
diff --git a/titlebar.h b/titlebar.h
index 691b695..488e573 100644
--- a/titlebar.h
+++ b/titlebar.h
@@ -32,6 +32,7 @@ void titlebar_client_detach(client_t *);
 void titlebar_client_attach(client_t *, wibox_t *);
 void titlebar_set_visible(wibox_t *, bool);
 void titlebar_ban(wibox_t *);
+void titlebar_unban(wibox_t *);
 
 int luaA_titlebar_newindex(lua_State *, wibox_t *, awesome_token_t);
 
-- 
1.6.2.1


-- 
To unsubscribe, send mail to [email protected].

Reply via email to