Do not use imlib2 for taking screenshot (issue #574)

This commit is contained in:
o9000 2016-03-27 23:23:55 +02:00
parent 14716d41b9
commit dcc163ec0b

View file

@ -567,10 +567,12 @@ void get_snapshot(const char *path)
XSync(server.display, False);
DATA32 *pixels = calloc(panel->area.width * panel->area.height, sizeof(DATA32));
Imlib_Image img = NULL;
XImage *ximg =
XGetImage(server.display, panel->temp_pmap, 0, 0, panel->area.width, panel->area.height, AllPlanes, ZPixmap);
if (ximg) {
DATA32 *pixels = calloc(panel->area.width * panel->area.height, sizeof(DATA32));
for (int x = 0; x < panel->area.width; x++) {
for (int y = 0; y < panel->area.height; y++) {
DATA32 xpixel = XGetPixel(ximg, x, y);
@ -585,12 +587,13 @@ void get_snapshot(const char *path)
}
}
XDestroyImage(ximg);
img = imlib_create_image_using_data(panel->area.width, panel->area.height, pixels);
} else {
imlib_context_set_drawable(panel->temp_pmap);
img = imlib_create_image_from_drawable(0, 0, 0, panel->area.width, panel->area.height, 1);
}
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);
if (img) {
imlib_context_set_image(img);
if (!panel_horizontal) {
// rotate 90° vertical panel
@ -599,6 +602,7 @@ void get_snapshot(const char *path)
}
imlib_save_image(path);
imlib_free_image();
}
}
void window_action(Task *task, MouseAction action)