drawin: Update the drawing-stuff less often

We don't need an up-to-date pixmap and cairo surface for a drawin which isn't
visible. Thus, only bring those up-to-date when the drawin is visible.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2011-03-09 16:16:00 +01:00
parent 2f406a9385
commit 61fde273ca
1 changed files with 5 additions and 2 deletions

View File

@ -94,6 +94,10 @@ drawin_unref_simplified(drawin_t **item)
static void static void
drawin_update_drawing(drawin_t *w) drawin_update_drawing(drawin_t *w)
{ {
/* If this drawin isn't visible, we don't need an up-to-date cairo surface
* for it. (drawin_map() will later make sure we are called again) */
if(w->screen == NULL)
return;
/* Clean up old stuff */ /* Clean up old stuff */
if(w->surface) if(w->surface)
{ {
@ -150,8 +154,6 @@ drawin_init(drawin_t *w)
globalconf.default_cmap globalconf.default_cmap
}); });
drawin_update_drawing(w);
/* Set the right type property */ /* Set the right type property */
ewmh_update_window_type(w->window, window_translate_type(w->type)); ewmh_update_window_type(w->window, window_translate_type(w->type));
} }
@ -269,6 +271,7 @@ drawin_map(drawin_t *drawin)
client_ignore_enterleave_events(); client_ignore_enterleave_events();
/* Map the drawin */ /* Map the drawin */
xcb_map_window(globalconf.connection, drawin->window); xcb_map_window(globalconf.connection, drawin->window);
drawin_update_drawing(drawin);
/* Deactivate BMA */ /* Deactivate BMA */
client_restore_enterleave_events(); client_restore_enterleave_events();
/* Stack this drawin correctly */ /* Stack this drawin correctly */