all repos — tint2 @ 9d8350dabc1c33d5872a762e6c22573799165f74

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

Invalidate cached pixmaps on resize/move (issue #576)
o9000 mrovi9000@gmail.com
commit

9d8350dabc1c33d5872a762e6c22573799165f74

parent

a6879ea2a5df21f0d3f77605ae80952e930ae993

1 files changed, 37 insertions(+), 23 deletions(-)

jump to
M src/util/area.csrc/util/area.c

@@ -70,17 +70,15 @@ for (l = a->children; l; l = l->next)

relayout_fixed(l->data); // Recalculate size - a->_changed = 0; + a->_changed = FALSE; if (a->resize_needed && a->size_mode == LAYOUT_FIXED) { - a->resize_needed = 0; + a->resize_needed = FALSE; - if (a->_resize) { - if (a->_resize(a)) { - // The size hash changed => resize needed for the parent - if (a->parent) - ((Area *)a->parent)->resize_needed = 1; - a->_changed = 1; - } + if (a->_resize && a->_resize(a)) { + // The size has changed => resize needed for the parent + if (a->parent) + ((Area *)a->parent)->resize_needed = TRUE; + a->_changed = TRUE; } } }

@@ -92,10 +90,11 @@ return;

// Area is resized before its children if (a->resize_needed && a->size_mode == LAYOUT_DYNAMIC) { - a->resize_needed = 0; + a->resize_needed = FALSE; if (a->_resize) { - a->_resize(a); + if (a->_resize(a)) + a->_changed = TRUE; // resize children with LAYOUT_DYNAMIC for (GList *l = a->children; l; l = l->next) { Area *child = ((Area *)l->data);

@@ -119,13 +118,13 @@ if (panel_horizontal) {

if (pos != child->posx) { // pos changed => redraw child->posx = pos; - child->_changed = 1; + child->_changed = TRUE; } } else { if (pos != child->posy) { // pos changed => redraw child->posy = pos; - child->_changed = 1; + child->_changed = TRUE; } }

@@ -148,13 +147,13 @@ if (panel_horizontal) {

if (pos != child->posx) { // pos changed => redraw child->posx = pos; - child->_changed = 1; + child->_changed = TRUE; } } else { if (pos != child->posy) { // pos changed => redraw child->posy = pos; - child->_changed = 1; + child->_changed = TRUE; } }

@@ -187,13 +186,13 @@ if (panel_horizontal) {

if (pos != child->posx) { // pos changed => redraw child->posx = pos; - child->_changed = 1; + child->_changed = TRUE; } } else { if (pos != child->posy) { // pos changed => redraw child->posy = pos; - child->_changed = 1; + child->_changed = TRUE; } }

@@ -224,7 +223,7 @@ if (!a->on_screen)

return; if (a->_redraw_needed) { - a->_redraw_needed = 0; + a->_redraw_needed = FALSE; draw(a); }

@@ -286,7 +285,7 @@ child->width++;

modulo--; } if (child->width != old_width) - child->_changed = 1; + child->_changed = TRUE; } } } else {

@@ -326,7 +325,7 @@ child->height++;

modulo--; } if (child->height != old_height) - child->_changed = 1; + child->_changed = TRUE; } } }

@@ -361,7 +360,7 @@ Area *parent = (Area *)a->parent;

a->on_screen = FALSE; if (parent) - parent->resize_needed = 1; + parent->resize_needed = TRUE; if (panel_horizontal) a->width = 0; else

@@ -374,12 +373,27 @@ Area *parent = (Area *)a->parent;

a->on_screen = TRUE; if (parent) - parent->resize_needed = 1; - a->resize_needed = 1; + parent->resize_needed = TRUE; + a->resize_needed = TRUE; } void draw(Area *a) { + if (a->_changed) { + // On resize/move, invalidate cached pixmaps + for (int i = 0; i < MOUSE_STATE_COUNT; i++) { + XFreePixmap(server.display, a->pix_by_state[i]); + if (a->pix == a->pix_by_state[i]) { + a->pix = None; + } + a->pix_by_state[i] = None; + } + if (a->pix) { + XFreePixmap(server.display, a->pix); + a->pix = None; + } + } + if (a->pix) { XFreePixmap(server.display, a->pix); if (a->pix_by_state[a->has_mouse_over_effect ? a->mouse_state : 0] != a->pix)