Make sure a wibox does not display garbage when made visible

This moves the call to wibox_draw() into wibox_map() which fixes garbage
being displayed if a wibox is made visible by setting its .visible.

Since wibox_draw() already calls simplewindow_refresh_pixmap(), that call is
dropped. Because wibox_need_update() just makes sure wibox_draw() is later
called, we can replace the call to wibox_draw() by this call. This should avoid
superflous updates.

Found by lua code like this:

local w = wibox({ position = "floating", bg = "#ff0000" })
w.visible = false
w.screen = 1
<do some other stuff>
w.visible = true

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2009-04-11 13:26:58 +02:00 committed by Julien Danjou
parent ff34fd2f3b
commit dc82832ccf
1 changed files with 2 additions and 5 deletions

View File

@ -43,7 +43,8 @@ static void
wibox_map(wibox_t *wibox)
{
xcb_map_window(globalconf.connection, wibox->sw.window);
simplewindow_refresh_pixmap(&wibox->sw);
/* We must make sure the wibox does not display garbage */
wibox_need_update(wibox);
/* Stack this wibox correctly */
client_stack();
}
@ -666,11 +667,7 @@ wibox_attach(wibox_t *wibox, screen_t *s)
ewmh_update_workarea(screen_virttophys(s->index));
if(wibox->isvisible)
{
/* draw it right now once to avoid garbage shown */
wibox_draw(wibox);
wibox_map(wibox);
}
else
wibox_need_update(wibox);
}