drawin: Don't unconditionally redraw when made visible
Before this commit, we always threw away the drawin's cairo surface whenever it was made visible and thus forced a redraw. This commit changes this so that we only force a redraw if the drawin was resized why it wasn't visible. To remember when this happens, we free the drawin's cairo surface without allocating a new one when the drawin is resized while not being visible. Thus, we then only have to allocate a new surface if the drawin doesn't have one when it is being made visible. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
d6bfec84ad
commit
c816ad7b63
|
@ -92,15 +92,22 @@ drawin_unref_simplified(drawin_t **item)
|
||||||
static void
|
static void
|
||||||
drawin_update_drawing(drawin_t *w, int widx)
|
drawin_update_drawing(drawin_t *w, int widx)
|
||||||
{
|
{
|
||||||
/* 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->visible)
|
|
||||||
return;
|
|
||||||
/* Clean up old stuff */
|
/* Clean up old stuff */
|
||||||
luaA_object_push_item(globalconf.L, widx, w->drawable);
|
luaA_object_push_item(globalconf.L, widx, w->drawable);
|
||||||
drawable_unset_surface(w->drawable);
|
drawable_unset_surface(w->drawable);
|
||||||
if(w->pixmap)
|
if(w->pixmap)
|
||||||
|
{
|
||||||
xcb_free_pixmap(globalconf.connection, w->pixmap);
|
xcb_free_pixmap(globalconf.connection, w->pixmap);
|
||||||
|
w->pixmap = XCB_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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->visible)
|
||||||
|
{
|
||||||
|
lua_pop(globalconf.L, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create a pixmap */
|
/* Create a pixmap */
|
||||||
xcb_screen_t *s = globalconf.screen;
|
xcb_screen_t *s = globalconf.screen;
|
||||||
|
@ -217,13 +224,15 @@ drawin_map(drawin_t *drawin, int widx)
|
||||||
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, widx);
|
|
||||||
/* Deactivate BMA */
|
/* Deactivate BMA */
|
||||||
client_restore_enterleave_events();
|
client_restore_enterleave_events();
|
||||||
/* Stack this drawin correctly */
|
/* Stack this drawin correctly */
|
||||||
stack_windows();
|
stack_windows();
|
||||||
/* Add it to the list of visible drawins */
|
/* Add it to the list of visible drawins */
|
||||||
drawin_array_append(&globalconf.drawins, drawin);
|
drawin_array_append(&globalconf.drawins, drawin);
|
||||||
|
/* Make sure it has a surface */
|
||||||
|
if(drawin->drawable->surface == NULL)
|
||||||
|
drawin_update_drawing(drawin, widx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue