]> git.sur5r.net Git - i3/i3/commitdiff
i3bar: also use the position option when in 'hide' mode
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 21 Oct 2011 18:59:25 +0000 (19:59 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 21 Oct 2011 18:59:25 +0000 (19:59 +0100)
i3bar/include/config.h
i3bar/src/config.c
i3bar/src/xcb.c

index 5997b7f1be899842ce6ddacb3514abfe99f73ccb..b914954c21a9b2c0cfd00d1d5dab3cae75e1364c 100644 (file)
@@ -4,14 +4,14 @@
 #include "common.h"
 
 typedef enum {
-    DOCKPOS_NONE = 0,
-    DOCKPOS_TOP,
-    DOCKPOS_BOT
-} dockpos_t;
+    POS_NONE = 0,
+    POS_TOP,
+    POS_BOT
+} position_t;
 
 typedef struct config_t {
     int          hide_on_modifier;
-    dockpos_t    dockpos;
+    position_t   position;
     int          verbose;
     struct xcb_color_strings_t colors;
     int          disable_ws;
index 644c623e0214375f35b34be1a296130d3a3ed696..caf130293bab80d46b99d1b4d3c0eae0743dfc7d 100644 (file)
@@ -63,7 +63,7 @@ static int config_string_cb(void *params_, const unsigned char *val, unsigned in
 
     if (!strcmp(cur_key, "position")) {
         DLOG("position = %.*s\n", len, val);
-        config.dockpos = (len == 3 && !strncmp((const char*)val, "top", strlen("top")) ? DOCKPOS_TOP : DOCKPOS_BOT);
+        config.position = (len == 3 && !strncmp((const char*)val, "top", strlen("top")) ? POS_TOP : POS_BOT);
         return 1;
     }
 
index 4e347f576716ad98516e832762dc4220e348a2c4..a9ecc004489afe50bec055abd805101b8eae917b 100644 (file)
@@ -281,7 +281,9 @@ void unhide_bars() {
                XCB_CONFIG_WINDOW_HEIGHT |
                XCB_CONFIG_WINDOW_STACK_MODE;
         values[0] = walk->rect.x;
-        values[1] = walk->rect.y + walk->rect.h - font_height - 6;
+        if (config.position == POS_TOP)
+            values[1] = walk->rect.y;
+        else values[1] = walk->rect.y + walk->rect.h - font_height - 6;
         values[2] = walk->rect.w;
         values[3] = font_height + 6;
         values[4] = XCB_STACK_MODE_ABOVE;
@@ -1305,15 +1307,15 @@ void reconfig_windows() {
                 uint32_t bottom_start_x;
                 uint32_t bottom_end_x;
             } __attribute__((__packed__)) strut_partial = {0,};
-            switch (config.dockpos) {
-                case DOCKPOS_NONE:
+            switch (config.position) {
+                case POS_NONE:
                     break;
-                case DOCKPOS_TOP:
+                case POS_TOP:
                     strut_partial.top = font_height + 6;
                     strut_partial.top_start_x = walk->rect.x;
                     strut_partial.top_end_x = walk->rect.x + walk->rect.w;
                     break;
-                case DOCKPOS_BOT:
+                case POS_BOT:
                     strut_partial.bottom = font_height + 6;
                     strut_partial.bottom_start_x = walk->rect.x;
                     strut_partial.bottom_end_x = walk->rect.x + walk->rect.w;