all repos — tint2 @ 1ecfdf52892197deb8e413504aeaa142cd683621

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

Fix bad clear of panel pixmap when display compositing is disabled
o9000 mrovi9000@gmail.com
commit

1ecfdf52892197deb8e413504aeaa142cd683621

parent

c31a2856f9299adb213114852d0f81eb49960fce

4 files changed, 43 insertions(+), 50 deletions(-)

jump to
M src/panel.csrc/panel.c

@@ -34,6 +34,8 @@ #include "task.h"

#include "panel.h" #include "tooltip.h" +void panel_clear_background(void *obj); + int signal_pending; MouseAction mouse_left;

@@ -198,6 +200,7 @@ p->area.on_screen = TRUE;

p->area.resize_needed = 1; p->area.size_mode = LAYOUT_DYNAMIC; p->area._resize = resize_panel; + p->area._clear = panel_clear_background; init_panel_size_and_position(p); // add children according to panel_items for (int k = 0; k < strlen(panel_items_order); k++) {

@@ -688,21 +691,17 @@ XSetClassHint(server.display, p->main_win, classhint);

XFree(classhint); } -void set_panel_background(Panel *p) +void panel_clear_background(void *obj) { - if (p->area.pix) - XFreePixmap(server.display, p->area.pix); - p->area.pix = XCreatePixmap(server.display, server.root_win, p->area.width, p->area.height, server.depth); - + Panel *p = obj; int xoff = 0, yoff = 0; if (panel_horizontal && panel_position & BOTTOM) yoff = p->area.height - p->hidden_height; else if (!panel_horizontal && panel_position & RIGHT) xoff = p->area.width - p->hidden_width; - if (server.real_transparency) { - clear_pixmap(p->area.pix, 0, 0, p->area.width, p->area.height); - } else { + clear_pixmap(p->area.pix, 0, 0, p->area.width, p->area.height); + if (!server.real_transparency) { get_root_pixmap(); // copy background (server.root_pmap) in panel.area.pix Window dummy;

@@ -715,48 +714,16 @@ }

XSetTSOrigin(server.display, server.gc, -x, -y); XFillRectangle(server.display, p->area.pix, server.gc, 0, 0, p->area.width, p->area.height); } - - // draw background panel - cairo_surface_t *cs = cairo_xlib_surface_create(server.display, p->area.pix, server.visual, p->area.width, p->area.height); - cairo_t *c = cairo_create(cs); - draw_background(&p->area, c); - cairo_destroy(c); - cairo_surface_destroy(cs); - - if (panel_autohide) { - if (p->hidden_pixmap) - XFreePixmap(server.display, p->hidden_pixmap); - p->hidden_pixmap = XCreatePixmap(server.display, server.root_win, p->hidden_width, p->hidden_height, server.depth); - XCopyArea(server.display, - p->area.pix, - p->hidden_pixmap, - server.gc, - xoff, - yoff, - p->hidden_width, - p->hidden_height, - 0, - 0); - } +} - // redraw panel's object - for (GList *l = p->area.children; l; l = l->next) { - Area *a = (Area *)l->data; - schedule_redraw(a); - } +void set_panel_background(Panel *p) +{ + panel_clear_background(p); + schedule_redraw(&p->area); - // reset task/taskbar 'state_pix' - Taskbar *taskbar; - for (int i = 0; i < p->num_desktops; i++) { - taskbar = &p->taskbar[i]; - schedule_redraw(&taskbar->area); - schedule_redraw(&taskbar->bar_name.area); - GList *l = taskbar->area.children; - if (taskbarname_enabled) - l = l->next; - for (; l; l = l->next) { - schedule_redraw((Area *)l->data); - } + if (p->hidden_pixmap) { + XFreePixmap(server.display, p->hidden_pixmap); + p->hidden_pixmap = 0; } }
M src/tint.csrc/tint.c

@@ -1484,6 +1484,24 @@ for (int i = 0; i < num_panels; i++) {

Panel *panel = &panels[i]; if (panel->is_hidden) { + if (!panel->hidden_pixmap) { + panel->hidden_pixmap = XCreatePixmap(server.display, server.root_win, panel->hidden_width, panel->hidden_height, server.depth); + int xoff = 0, yoff = 0; + if (panel_horizontal && panel_position & BOTTOM) + yoff = panel->area.height - panel->hidden_height; + else if (!panel_horizontal && panel_position & RIGHT) + xoff = panel->area.width - panel->hidden_width; + XCopyArea(server.display, + panel->area.pix, + panel->hidden_pixmap, + server.gc, + xoff, + yoff, + panel->hidden_width, + panel->hidden_height, + 0, + 0); + } XCopyArea(server.display, panel->hidden_pixmap, panel->main_win,
M src/util/area.csrc/util/area.c

@@ -379,9 +379,14 @@ a->pix = XCreatePixmap(server.display, server.root_win, a->width, a->height, server.depth);

a->pix_by_state[a->has_mouse_over_effect ? a->mouse_state : 0] = a->pix; // Add layer of root pixmap (or clear pixmap if real_transparency==true) - if (server.real_transparency) + if (!a->_clear) { clear_pixmap(a->pix, 0, 0, a->width, a->height); - XCopyArea(server.display, ((Panel *)a->panel)->temp_pmap, a->pix, server.gc, a->posx, a->posy, a->width, a->height, 0, 0); + if (!server.real_transparency) { + XCopyArea(server.display, ((Panel *)a->panel)->temp_pmap, a->pix, server.gc, a->posx, a->posy, a->width, a->height, 0, 0); + } + } else { + a->_clear(a); + } cairo_surface_t *cs = cairo_xlib_surface_create(server.display, a->pix, server.visual, a->width, a->height); cairo_t *c = cairo_create(cs);
M src/util/area.hsrc/util/area.h

@@ -202,6 +202,9 @@ Pixmap pix_by_state[MOUSE_STATE_COUNT];

// Callbacks + // Called on draw before any drawing takes place, obj = pointer to the Area + void (*_clear)(void *obj); + // Called on draw, obj = pointer to the Area void (*_draw_foreground)(void *obj, cairo_t *c);