#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
+#include <X11/extensions/Xrender.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "server.h"
#include "panel.h"
+// QUESTION: Why do we need Pixmaps for drawing? Can't we draw directly in the Window???
+// Parent could pass a cairo_surface_t to the children, and children use it, for drawing...
+
+
// 1) resize child
// 2) resize parent
// 3) redraw parent
}
// draw current Area
- Pixmap *pmap = (a->is_active == 0) ? (&a->pix.pmap) : (&a->pix_active.pmap);
- if (*pmap == 0) printf("empty area posx %d, width %d\n", a->posx, a->width);
- XCopyArea (server.dsp, *pmap, ((Panel *)a->panel)->temp_pmap, server.gc, 0, 0, a->width, a->height, a->posx, a->posy);
+ Pixmap pmap = (a->is_active == 0) ? (a->pix.pmap) : (a->pix_active.pmap);
+ if (pmap == 0) printf("empty area posx %d, width %d\n", a->posx, a->width);
+ XCopyArea (server.dsp, pmap, ((Panel *)a->panel)->temp_pmap, server.gc, 0, 0, a->width, a->height, a->posx, a->posy);
// and then refresh child object
GSList *l;
if (*pmap) XFreePixmap (server.dsp, *pmap);
*pmap = XCreatePixmap (server.dsp, server.root_win, a->width, a->height, server.depth);
- // add layer of root pixmap
+ // add layer of root pixmap (or clear pixmap if real_transparency==true)
+ if (real_transparency)
+ clear_pixmap(*pmap, 0 ,0, a->width, a->height);
XCopyArea (server.dsp, ((Panel *)a->panel)->temp_pmap, *pmap, server.gc, a->posx, a->posy, a->width, a->height, 0, 0);
cairo_surface_t *cs;
}
+void clear_pixmap(Pixmap p, int x, int y, int w, int h)
+{
+ Picture pict = XRenderCreatePicture(server.dsp, p, XRenderFindVisualFormat(server.dsp, server.visual), 0, 0);
+ XRenderColor col = { .red=0, .green=0, .blue=0, .alpha=0 };
+ XRenderFillRectangle(server.dsp, PictOpSrc, pict, &col, x, y, w, h);
+}