screen, client: clamp strut size to relevant dimension

- gnome-panel (for example) requests the space for all it's windows
- this approach can never work for multiple applications, so we clamp it

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Maarten Maathuis 2009-03-30 19:40:02 +02:00 committed by Julien Danjou
parent 264a81f3fb
commit db68ae2ebe
1 changed files with 7 additions and 5 deletions

View File

@ -176,7 +176,9 @@ screen_area_get(int screen, wibox_array_t *wiboxes,
area.height -= padding->top + padding->bottom; area.height -= padding->top + padding->bottom;
} }
/* struts are additive, to allow for multiple clients at the screen edge. */ /* Struts are additive, to allow for multiple clients at the screen edge. */
/* Some clients request more space than their size, because another window of the same app already has some space. */
/* So we clamp the strut size. */
if(strut) if(strut)
{ {
client_t *c; client_t *c;
@ -186,28 +188,28 @@ screen_area_get(int screen, wibox_array_t *wiboxes,
if(c->strut.top_start_x || c->strut.top_end_x) if(c->strut.top_start_x || c->strut.top_end_x)
{ {
if(c->strut.top) if(c->strut.top)
top += c->strut.top; top += MIN(c->strut.top, c->geometry.height);
else else
top += c->geometry.height; top += c->geometry.height;
} }
if(c->strut.bottom_start_x || c->strut.bottom_end_x) if(c->strut.bottom_start_x || c->strut.bottom_end_x)
{ {
if(c->strut.bottom) if(c->strut.bottom)
bottom += c->strut.bottom; bottom += MIN(c->strut.bottom, c->geometry.height);
else else
bottom += c->geometry.height; bottom += c->geometry.height;
} }
if(c->strut.left_start_y || c->strut.left_end_y) if(c->strut.left_start_y || c->strut.left_end_y)
{ {
if(c->strut.left) if(c->strut.left)
left += c->strut.left; left += MIN(c->strut.left, c->geometry.width);
else else
left += c->geometry.width; left += c->geometry.width;
} }
if(c->strut.right_start_y || c->strut.right_end_y) if(c->strut.right_start_y || c->strut.right_end_y)
{ {
if(c->strut.right) if(c->strut.right)
right += c->strut.right; right += MIN(c->strut.right, c->geometry.width);
else else
right += c->geometry.width; right += c->geometry.width;
} }