1
0
Fork 0
mirror of https://github.com/Raymo111/i3lock-color.git synced 2024-11-11 13:50:52 -05:00

restore intended functionality of images over blurring

This commit is contained in:
Chris Guillott 2017-05-30 18:34:30 -04:00
parent 12e3a846b8
commit aa906d564c
2 changed files with 21 additions and 14 deletions

View file

@ -136,6 +136,7 @@ static uint8_t xkb_base_event;
static uint8_t xkb_base_error;
cairo_surface_t *img = NULL;
cairo_surface_t *blur_img = NULL;
bool tile = false;
bool ignore_empty_password = false;
bool skip_repeated_empty_password = false;
@ -1342,22 +1343,21 @@ int main(int argc, char *argv[]) {
free(image_path);
}
xcb_pixmap_t blur_pixmap;
xcb_pixmap_t* blur_pixmap = NULL;
if (blur) {
if(!img) {
xcb_visualtype_t *vistype = get_root_visual_type(screen);
blur_pixmap = capture_bg_pixmap(conn, screen, last_resolution);
cairo_surface_t *xcb_img = cairo_xcb_surface_create(conn, blur_pixmap, vistype, last_resolution[0], last_resolution[1]);
blur_pixmap = malloc(sizeof(xcb_pixmap_t));
xcb_visualtype_t *vistype = get_root_visual_type(screen);
*blur_pixmap = capture_bg_pixmap(conn, screen, last_resolution);
cairo_surface_t *xcb_img = cairo_xcb_surface_create(conn, *blur_pixmap, vistype, last_resolution[0], last_resolution[1]);
img = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, last_resolution[0], last_resolution[1]);
cairo_t *ctx = cairo_create(img);
cairo_set_source_surface(ctx, xcb_img, 0, 0);
cairo_paint(ctx);
blur_img = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, last_resolution[0], last_resolution[1]);
cairo_t *ctx = cairo_create(blur_img);
cairo_set_source_surface(ctx, xcb_img, 0, 0);
cairo_paint(ctx);
cairo_destroy(ctx);
cairo_surface_destroy(xcb_img);
}
blur_image_surface(img, blur_sigma);
cairo_destroy(ctx);
cairo_surface_destroy(xcb_img);
blur_image_surface(blur_img, blur_sigma);
}
/* Pixmap on which the image is rendered to (if any) */
@ -1367,7 +1367,9 @@ int main(int argc, char *argv[]) {
win = open_fullscreen_window(conn, screen, color, bg_pixmap);
xcb_free_pixmap(conn, bg_pixmap);
if (blur_pixmap) {
xcb_free_pixmap(conn, blur_pixmap);
xcb_free_pixmap(conn, *blur_pixmap);
free(blur_pixmap);
blur_pixmap = NULL;
}

View file

@ -56,6 +56,7 @@ extern char *modifier_string;
/* A Cairo surface containing the specified image (-i), if any. */
extern cairo_surface_t *img;
extern cairo_surface_t *blur_img;
/* Whether the image should be tiled. */
extern bool tile;
@ -164,6 +165,10 @@ xcb_pixmap_t draw_image(uint32_t *resolution) {
cairo_surface_t *xcb_output = cairo_xcb_surface_create(conn, bg_pixmap, vistype, resolution[0], resolution[1]);
cairo_t *xcb_ctx = cairo_create(xcb_output);
if (blur_img) {
cairo_set_source_surface(xcb_ctx, blur_img, 0, 0);
cairo_paint(xcb_ctx);
}
if (img) {
if (!tile) {
cairo_set_source_surface(xcb_ctx, img, 0, 0);