all repos — tint2 @ 14716d41b919cbcefacf99c1bccb987b8705536d

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

Do not use imlib2 for taking screenshot (issue #574)
o9000 mrovi9000@gmail.com
commit

14716d41b919cbcefacf99c1bccb987b8705536d

parent

9018313fb26fe1f95166c358bee78731f9efb0a3

1 files changed, 25 insertions(+), 3 deletions(-)

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

@@ -565,9 +565,31 @@ panel->temp_pmap =

XCreatePixmap(server.display, server.root_win, panel->area.width, panel->area.height, server.depth); render_panel(panel); - Imlib_Image img = NULL; - imlib_context_set_drawable(panel->temp_pmap); - img = imlib_create_image_from_drawable(0, 0, 0, panel->area.width, panel->area.height, 0); + XSync(server.display, False); + + DATA32 *pixels = calloc(panel->area.width * panel->area.height, sizeof(DATA32)); + XImage *ximg = + XGetImage(server.display, panel->temp_pmap, 0, 0, panel->area.width, panel->area.height, AllPlanes, ZPixmap); + + for (int x = 0; x < panel->area.width; x++) { + for (int y = 0; y < panel->area.height; y++) { + DATA32 xpixel = XGetPixel(ximg, x, y); + + DATA32 r = (xpixel >> 16) & 0xff; + DATA32 g = (xpixel >> 8) & 0xff; + DATA32 b = (xpixel >> 0) & 0xff; + DATA32 a = 0x0; + + DATA32 argb = (a << 24) | (r << 16) | (g << 8) | b; + pixels[y * panel->area.width + x] = argb; + } + } + XDestroyImage(ximg); + + Imlib_Image img = imlib_create_image_using_data(panel->area.width, panel->area.height, pixels); + + // imlib_context_set_drawable(panel->temp_pmap); + // Imlib_Image img = imlib_create_image_from_drawable(0, 0, 0, panel->area.width, panel->area.height, 1); imlib_context_set_image(img); if (!panel_horizontal) {