From dc82832ccfad42dc964db2e47a2e6f4cbea3316e Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 11 Apr 2009 13:26:58 +0200 Subject: [PATCH] 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 w.visible = true Signed-off-by: Uli Schlachter --- wibox.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/wibox.c b/wibox.c index f43638ba..94b9ab3f 100644 --- a/wibox.c +++ b/wibox.c @@ -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); }