Add wibox_map() helper function

This moves some common code into a helper function to reduce code
duplication and open-coding that function all the time.

This commit doesn't cause any behaviour change at all.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2009-04-11 13:14:50 +02:00 committed by Julien Danjou
parent 4574d87988
commit ff34fd2f3b
1 changed files with 11 additions and 10 deletions

21
wibox.c
View File

@ -39,6 +39,15 @@ wibox_need_update(wibox_t *wibox)
wibox->mouse_over = NULL; wibox->mouse_over = NULL;
} }
static void
wibox_map(wibox_t *wibox)
{
xcb_map_window(globalconf.connection, wibox->sw.window);
simplewindow_refresh_pixmap(&wibox->sw);
/* Stack this wibox correctly */
client_stack();
}
static void static void
wibox_move(wibox_t *wibox, int16_t x, int16_t y) wibox_move(wibox_t *wibox, int16_t x, int16_t y)
{ {
@ -564,12 +573,7 @@ wibox_setvisible(wibox_t *wibox, bool v)
if(wibox->screen != SCREEN_UNDEF) if(wibox->screen != SCREEN_UNDEF)
{ {
if(wibox->isvisible) if(wibox->isvisible)
{ wibox_map(wibox);
xcb_map_window(globalconf.connection, wibox->sw.window);
simplewindow_refresh_pixmap(&wibox->sw);
/* stack correctly the wibox */
client_stack();
}
else else
xcb_unmap_window(globalconf.connection, wibox->sw.window); xcb_unmap_window(globalconf.connection, wibox->sw.window);
@ -665,10 +669,7 @@ wibox_attach(wibox_t *wibox, screen_t *s)
{ {
/* draw it right now once to avoid garbage shown */ /* draw it right now once to avoid garbage shown */
wibox_draw(wibox); wibox_draw(wibox);
xcb_map_window(globalconf.connection, wibox->sw.window); wibox_map(wibox);
simplewindow_refresh_pixmap(&wibox->sw);
/* stack correctly the wibox */
client_stack();
} }
else else
wibox_need_update(wibox); wibox_need_update(wibox);