Remove the code for floating wiboxes from wibox_position_update_non_floating()

The last commit moved the handling of floating wiboxes into its own function,
so the checks for floating wiboxes in here can be removed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2009-04-12 21:11:46 +02:00
parent b4b08fd926
commit bee45f1b4a
1 changed files with 51 additions and 52 deletions

103
wibox.c
View File

@ -343,72 +343,70 @@ wibox_position_update_non_floating(wibox_t *wibox)
if (wibox->screen == SCREEN_UNDEF) if (wibox->screen == SCREEN_UNDEF)
return; return;
/* If this is a non-floating wibox, it limits the space available to clients /* This wibox limits the space available to clients and thus clients
* and thus clients need to be repositioned. * need to be repositioned.
*/ */
if (wibox->position != Floating) globalconf.screens[wibox->screen].need_arrange = true;
globalconf.screens[wibox->screen].need_arrange = true;
/* Place wibox'es at the edge of the screen, struts come later. */ /* Place wibox'es at the edge of the screen, struts come later. */
area = screen_area_get(wibox->screen, NULL, area = screen_area_get(wibox->screen, NULL,
&globalconf.screens[wibox->screen].padding, false); &globalconf.screens[wibox->screen].padding, false);
/* Top and Bottom wibox_t have prio */ /* Top and Bottom wibox_t have prio */
if(wibox->position != Floating) foreach(_w, globalconf.screens[wibox->screen].wiboxes)
foreach(_w, globalconf.screens[wibox->screen].wiboxes) {
wibox_t *w = *_w;
/* Ignore every wibox after me that is in the same position */
if(wibox == w)
{ {
wibox_t *w = *_w; ignore = true;
/* Ignore every wibox after me that is in the same position */ continue;
if(wibox == w) }
else if((ignore && wibox->position == w->position) || !w->isvisible)
continue;
switch(w->position)
{
case Floating:
break;
case Left:
if(wibox->position == Left)
area.x += wibox->sw.geometry.height;
break;
case Right:
if(wibox->position == Right)
area.x -= wibox->sw.geometry.height;
break;
case Top:
switch(wibox->position)
{ {
ignore = true; case Top:
continue; area.y += w->sw.geometry.height;
}
else if((ignore && wibox->position == w->position) || !w->isvisible)
continue;
switch(w->position)
{
case Floating:
break; break;
case Left: case Left:
if(wibox->position == Left)
area.x += wibox->sw.geometry.height;
break;
case Right: case Right:
if(wibox->position == Right) area.height -= w->sw.geometry.height;
area.x -= wibox->sw.geometry.height; area.y += w->sw.geometry.height;
break; break;
case Top: default:
switch(wibox->position)
{
case Top:
area.y += w->sw.geometry.height;
break;
case Left:
case Right:
area.height -= w->sw.geometry.height;
area.y += w->sw.geometry.height;
break;
default:
break;
}
break;
case Bottom:
switch(wibox->position)
{
case Bottom:
area.y -= w->sw.geometry.height;
break;
case Left:
case Right:
area.height -= w->sw.geometry.height;
break;
default:
break;
}
break; break;
} }
break;
case Bottom:
switch(wibox->position)
{
case Bottom:
area.y -= w->sw.geometry.height;
break;
case Left:
case Right:
area.height -= w->sw.geometry.height;
break;
default:
break;
}
break;
} }
}
/* The "length" of a wibox is always chosen to be the optimal size (non-floating). /* The "length" of a wibox is always chosen to be the optimal size (non-floating).
* The "width" of a wibox is kept if it exists. * The "width" of a wibox is kept if it exists.
@ -483,8 +481,9 @@ wibox_position_update_non_floating(wibox_t *wibox)
} }
break; break;
case Floating: case Floating:
wingeom.width = MAX(1, wibox->sw.geometry.width); /* Floating wiboxes are not handled here, but in
wingeom.height = MAX(1, wibox->sw.geometry.height); * wibox_position_update_floating(), but the compiler insists...
*/
break; break;
} }