Fix bad clear of panel pixmap when display compositing is disabled
This commit is contained in:
parent
c31a2856f9
commit
1ecfdf5289
4 changed files with 43 additions and 50 deletions
63
src/panel.c
63
src/panel.c
|
@ -34,6 +34,8 @@
|
||||||
#include "panel.h"
|
#include "panel.h"
|
||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
|
|
||||||
|
void panel_clear_background(void *obj);
|
||||||
|
|
||||||
int signal_pending;
|
int signal_pending;
|
||||||
|
|
||||||
MouseAction mouse_left;
|
MouseAction mouse_left;
|
||||||
|
@ -198,6 +200,7 @@ void init_panel()
|
||||||
p->area.resize_needed = 1;
|
p->area.resize_needed = 1;
|
||||||
p->area.size_mode = LAYOUT_DYNAMIC;
|
p->area.size_mode = LAYOUT_DYNAMIC;
|
||||||
p->area._resize = resize_panel;
|
p->area._resize = resize_panel;
|
||||||
|
p->area._clear = panel_clear_background;
|
||||||
init_panel_size_and_position(p);
|
init_panel_size_and_position(p);
|
||||||
// add children according to panel_items
|
// add children according to panel_items
|
||||||
for (int k = 0; k < strlen(panel_items_order); k++) {
|
for (int k = 0; k < strlen(panel_items_order); k++) {
|
||||||
|
@ -688,21 +691,17 @@ void set_panel_properties(Panel *p)
|
||||||
XFree(classhint);
|
XFree(classhint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_panel_background(Panel *p)
|
void panel_clear_background(void *obj)
|
||||||
{
|
{
|
||||||
if (p->area.pix)
|
Panel *p = obj;
|
||||||
XFreePixmap(server.display, p->area.pix);
|
|
||||||
p->area.pix = XCreatePixmap(server.display, server.root_win, p->area.width, p->area.height, server.depth);
|
|
||||||
|
|
||||||
int xoff = 0, yoff = 0;
|
int xoff = 0, yoff = 0;
|
||||||
if (panel_horizontal && panel_position & BOTTOM)
|
if (panel_horizontal && panel_position & BOTTOM)
|
||||||
yoff = p->area.height - p->hidden_height;
|
yoff = p->area.height - p->hidden_height;
|
||||||
else if (!panel_horizontal && panel_position & RIGHT)
|
else if (!panel_horizontal && panel_position & RIGHT)
|
||||||
xoff = p->area.width - p->hidden_width;
|
xoff = p->area.width - p->hidden_width;
|
||||||
|
|
||||||
if (server.real_transparency) {
|
clear_pixmap(p->area.pix, 0, 0, p->area.width, p->area.height);
|
||||||
clear_pixmap(p->area.pix, 0, 0, p->area.width, p->area.height);
|
if (!server.real_transparency) {
|
||||||
} else {
|
|
||||||
get_root_pixmap();
|
get_root_pixmap();
|
||||||
// copy background (server.root_pmap) in panel.area.pix
|
// copy background (server.root_pmap) in panel.area.pix
|
||||||
Window dummy;
|
Window dummy;
|
||||||
|
@ -715,48 +714,16 @@ void set_panel_background(Panel *p)
|
||||||
XSetTSOrigin(server.display, server.gc, -x, -y);
|
XSetTSOrigin(server.display, server.gc, -x, -y);
|
||||||
XFillRectangle(server.display, p->area.pix, server.gc, 0, 0, p->area.width, p->area.height);
|
XFillRectangle(server.display, p->area.pix, server.gc, 0, 0, p->area.width, p->area.height);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// draw background panel
|
void set_panel_background(Panel *p)
|
||||||
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);
|
panel_clear_background(p);
|
||||||
draw_background(&p->area, c);
|
schedule_redraw(&p->area);
|
||||||
cairo_destroy(c);
|
|
||||||
cairo_surface_destroy(cs);
|
|
||||||
|
|
||||||
if (panel_autohide) {
|
if (p->hidden_pixmap) {
|
||||||
if (p->hidden_pixmap)
|
XFreePixmap(server.display, p->hidden_pixmap);
|
||||||
XFreePixmap(server.display, p->hidden_pixmap);
|
p->hidden_pixmap = 0;
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
18
src/tint.c
18
src/tint.c
|
@ -1484,6 +1484,24 @@ start:
|
||||||
Panel *panel = &panels[i];
|
Panel *panel = &panels[i];
|
||||||
|
|
||||||
if (panel->is_hidden) {
|
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,
|
XCopyArea(server.display,
|
||||||
panel->hidden_pixmap,
|
panel->hidden_pixmap,
|
||||||
panel->main_win,
|
panel->main_win,
|
||||||
|
|
|
@ -379,9 +379,14 @@ void draw(Area *a)
|
||||||
a->pix_by_state[a->has_mouse_over_effect ? a->mouse_state : 0] = a->pix;
|
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)
|
// 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);
|
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_surface_t *cs = cairo_xlib_surface_create(server.display, a->pix, server.visual, a->width, a->height);
|
||||||
cairo_t *c = cairo_create(cs);
|
cairo_t *c = cairo_create(cs);
|
||||||
|
|
|
@ -202,6 +202,9 @@ typedef struct Area {
|
||||||
|
|
||||||
// Callbacks
|
// 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
|
// Called on draw, obj = pointer to the Area
|
||||||
void (*_draw_foreground)(void *obj, cairo_t *c);
|
void (*_draw_foreground)(void *obj, cairo_t *c);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue