Split wibox_position_update() up

Floating wiboxes are much easier to handle, so they deserve their own
function.
This function, wibox_position_update_floating() does exactly the same things
wibox_position_update() did before. No behaviour change involved.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2009-04-12 21:08:59 +02:00
parent 62bfc2e9ac
commit b4b08fd926
1 changed files with 31 additions and 6 deletions

37
wibox.c
View File

@ -315,12 +315,24 @@ wibox_systray_refresh(wibox_t *wibox)
}
}
/** Update the wibox position. It deletes every wibox resources and
* create them back.
* \param wibox The wibox.
*/
void
wibox_position_update(wibox_t *wibox)
/* Only called by wibox_position_update() */
static void
wibox_position_update_floating(wibox_t *wibox)
{
area_t wingeom = wibox->sw.geometry;
/* We only make sure the wibox is at least 1x1 pixel big. */
wingeom.width = MAX(1, wibox->sw.geometry.width);
wingeom.height = MAX(1, wibox->sw.geometry.height);
if(wingeom.width != wibox->sw.geometry.width
|| wingeom.height != wibox->sw.geometry.height)
wibox_resize(wibox, wingeom.width, wingeom.height);
}
/* Only called by wibox_position_update() */
static void
wibox_position_update_non_floating(wibox_t *wibox)
{
area_t area, wingeom = wibox->sw.geometry;
bool ignore = false;
@ -486,6 +498,19 @@ wibox_position_update(wibox_t *wibox)
wibox_move(wibox, wingeom.x, wingeom.y);
}
/** Update the wibox position. It deletes every wibox resources and
* create them back.
* \param wibox The wibox.
*/
void
wibox_position_update(wibox_t *wibox)
{
if(wibox->position == Floating)
wibox_position_update_floating(wibox);
else
wibox_position_update_non_floating(wibox);
}
/** Get a wibox by its window.
* \param w The window id.
* \return A wibox if found, NULL otherwise.