From 61fde273ca9c724f8a73292b920c4a35acdc2940 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 9 Mar 2011 16:16:00 +0100 Subject: [PATCH] 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 --- objects/drawin.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/objects/drawin.c b/objects/drawin.c index b5b210be..100a5f7a 100644 --- a/objects/drawin.c +++ b/objects/drawin.c @@ -94,6 +94,10 @@ drawin_unref_simplified(drawin_t **item) static void 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 */ if(w->surface) { @@ -150,8 +154,6 @@ drawin_init(drawin_t *w) globalconf.default_cmap }); - drawin_update_drawing(w); - /* Set the right type property */ ewmh_update_window_type(w->window, window_translate_type(w->type)); } @@ -269,6 +271,7 @@ drawin_map(drawin_t *drawin) client_ignore_enterleave_events(); /* Map the drawin */ xcb_map_window(globalconf.connection, drawin->window); + drawin_update_drawing(drawin); /* Deactivate BMA */ client_restore_enterleave_events(); /* Stack this drawin correctly */