wibox: support for border when not floating

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-10-24 13:58:25 +02:00
parent a0416a9abf
commit f43c455035
2 changed files with 21 additions and 25 deletions

View File

@ -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);

42
wibox.c
View File

@ -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;