From f43c455035c81c3d9c050f84b47e0975eb70b766 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 24 Oct 2008 13:58:25 +0200 Subject: [PATCH] wibox: support for border when not floating Signed-off-by: Julien Danjou --- screen.c | 4 ++-- wibox.c | 42 +++++++++++++++++++----------------------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/screen.c b/screen.c index 366e3dd3..40169d6c 100644 --- a/screen.c +++ b/screen.c @@ -223,13 +223,13 @@ screen_area_get(int screen, wibox_array_t *wiboxes, switch(w->position) { case Top: - top = MAX(top, (uint16_t) (w->sw.geometry.y - area.y) + w->sw.geometry.height); + top = MAX(top, (uint16_t) (w->sw.geometry.y - area.y) + w->sw.geometry.height + 2 * w->sw.border.width); break; case Bottom: bottom = MAX(bottom, (uint16_t) (area.y + area.height) - w->sw.geometry.y); break; case Left: - left = MAX(left, (uint16_t) (w->sw.geometry.x - area.x) + w->sw.geometry.width); + left = MAX(left, (uint16_t) (w->sw.geometry.x - area.x) + w->sw.geometry.width + 2 * w->sw.border.width); break; case Right: right = MAX(right, (uint16_t) (area.x + area.width) - w->sw.geometry.x); diff --git a/wibox.c b/wibox.c index 5b74a6a4..4cf0698b 100644 --- a/wibox.c +++ b/wibox.c @@ -352,77 +352,73 @@ wibox_position_update(wibox_t *wibox) switch(wibox->position) { case Right: - wingeom.height = wibox->sw.geometry.height > 0 ? wibox->sw.geometry.height : area.height; + wingeom.height = wibox->sw.geometry.height > 0 ? + wibox->sw.geometry.height : area.height - 2 * wibox->sw.border.width; wingeom.width = wibox->sw.geometry.width > 0 ? wibox->sw.geometry.width : 1.5 * globalconf.font->height; + wingeom.x = area.x + area.width - wingeom.width - 2 * wibox->sw.border.width; switch(wibox->align) { default: - wingeom.x = area.x + area.width - wingeom.width; wingeom.y = area.y; break; case AlignRight: - wingeom.x = area.x + area.width - wingeom.width; wingeom.y = area.y + area.height - wingeom.height; break; case AlignCenter: - wingeom.x = area.x + area.width - wingeom.width; wingeom.y = (area.y + area.height - wingeom.height) / 2; break; } break; case Left: - wingeom.height = wibox->sw.geometry.height > 0 ? wibox->sw.geometry.height : area.height; + wingeom.height = wibox->sw.geometry.height > 0 ? + wibox->sw.geometry.height : area.height - 2 * wibox->sw.border.width; wingeom.width = wibox->sw.geometry.width > 0 ? wibox->sw.geometry.width : 1.5 * globalconf.font->height; + wingeom.x = area.x; switch(wibox->align) { default: - wingeom.x = area.x; - wingeom.y = (area.y + area.height) - wingeom.height; + wingeom.y = (area.y + area.height) - wingeom.height - 2 * wibox->sw.border.width; break; case AlignRight: - wingeom.x = area.x; wingeom.y = area.y; break; case AlignCenter: - wingeom.x = area.x; wingeom.y = (area.y + area.height - wingeom.height) / 2; } break; case Bottom: wingeom.height = wibox->sw.geometry.height > 0 ? wibox->sw.geometry.height : 1.5 * globalconf.font->height; - wingeom.width = wibox->sw.geometry.width > 0 ? wibox->sw.geometry.width : area.width; + wingeom.width = wibox->sw.geometry.width > 0 ? + wibox->sw.geometry.width : area.width - 2 * wibox->sw.border.width; + wingeom.y = (area.y + area.height) - wingeom.height - 2 * wibox->sw.border.width; + wingeom.x = area.x; switch(wibox->align) { default: - wingeom.x = area.x; - wingeom.y = (area.y + area.height) - wingeom.height; break; case AlignRight: - wingeom.x = area.x + area.width - wingeom.width; - wingeom.y = (area.y + area.height) - wingeom.height; + wingeom.x += area.width - wingeom.width; break; case AlignCenter: - wingeom.x = area.x + (area.width - wingeom.width) / 2; - wingeom.y = (area.y + area.height) - wingeom.height; + wingeom.x += (area.width - wingeom.width) / 2; break; } break; case Top: wingeom.height = wibox->sw.geometry.height > 0 ? wibox->sw.geometry.height : 1.5 * globalconf.font->height; - wingeom.width = wibox->sw.geometry.width > 0 ? wibox->sw.geometry.width : area.width; + wingeom.width = wibox->sw.geometry.width > 0 ? + wibox->sw.geometry.width : area.width - 2 * wibox->sw.border.width; + wingeom.x = area.x; + wingeom.y = area.y; switch(wibox->align) { default: - wingeom.x = area.x; - wingeom.y = area.y; break; case AlignRight: - wingeom.x = area.x + area.width - wingeom.width; - wingeom.y = area.y; + wingeom.x += area.width - wingeom.width; break; case AlignCenter: - wingeom.x = area.x + (area.width - wingeom.width) / 2; - wingeom.y = area.y; + wingeom.x += (area.width - wingeom.width) / 2; break; } break; -- 2.11.4.GIT