Allow slideshow and blur be used together
This commit is contained in:
parent
e390bb68fa
commit
c39ccc70c7
31
i3lock.c
31
i3lock.c
|
@ -244,6 +244,7 @@ static int randr_base = -1;
|
||||||
|
|
||||||
cairo_surface_t *img = NULL;
|
cairo_surface_t *img = NULL;
|
||||||
cairo_surface_t *img_slideshow[256];
|
cairo_surface_t *img_slideshow[256];
|
||||||
|
cairo_surface_t *blur_bg_img = NULL;
|
||||||
int slideshow_image_count = 0;
|
int slideshow_image_count = 0;
|
||||||
int slideshow_interval = 10;
|
int slideshow_interval = 10;
|
||||||
bool slideshow_random_selection = false;
|
bool slideshow_random_selection = false;
|
||||||
|
@ -2362,29 +2363,20 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
free(image_raw_format);
|
free(image_raw_format);
|
||||||
|
|
||||||
xcb_pixmap_t* blur_pixmap = NULL;
|
|
||||||
if (blur) {
|
if (blur) {
|
||||||
blur_pixmap = malloc(sizeof(xcb_pixmap_t));
|
xcb_pixmap_t bg_pixmap = capture_bg_pixmap(conn, screen, last_resolution);
|
||||||
xcb_visualtype_t *vistype = get_root_visual_type(screen);
|
cairo_surface_t *xcb_img = cairo_xcb_surface_create(conn, bg_pixmap, get_root_visual_type(screen), last_resolution[0], last_resolution[1]);
|
||||||
*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_bg_img = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, last_resolution[0], last_resolution[1]);
|
||||||
|
cairo_t *ctx = cairo_create(blur_bg_img);
|
||||||
|
|
||||||
cairo_surface_t *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_set_source_surface(ctx, xcb_img, 0, 0);
|
||||||
cairo_paint(ctx);
|
cairo_paint(ctx);
|
||||||
|
blur_image_surface(blur_bg_img, blur_sigma);
|
||||||
|
|
||||||
blur_image_surface(blur_img, blur_sigma);
|
|
||||||
if (img) {
|
|
||||||
// Display image on all outputs.
|
|
||||||
draw_image(last_resolution, img, ctx);
|
|
||||||
cairo_surface_destroy(img);
|
|
||||||
}
|
|
||||||
cairo_destroy(ctx);
|
cairo_destroy(ctx);
|
||||||
cairo_surface_destroy(xcb_img);
|
cairo_surface_destroy(xcb_img);
|
||||||
|
xcb_free_pixmap(conn, bg_pixmap);
|
||||||
img = blur_img;
|
|
||||||
bg_type = NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_window_t stolen_focus = find_focused_window(conn, screen->root);
|
xcb_window_t stolen_focus = find_focused_window(conn, screen->root);
|
||||||
|
@ -2395,14 +2387,7 @@ int main(int argc, char *argv[]) {
|
||||||
xcb_pixmap_t pixmap = create_bg_pixmap(conn, win, last_resolution, color);
|
xcb_pixmap_t pixmap = create_bg_pixmap(conn, win, last_resolution, color);
|
||||||
render_lock(last_resolution, pixmap);
|
render_lock(last_resolution, pixmap);
|
||||||
xcb_change_window_attributes(conn, win, XCB_CW_BACK_PIXMAP, (uint32_t[]){pixmap});
|
xcb_change_window_attributes(conn, win, XCB_CW_BACK_PIXMAP, (uint32_t[]){pixmap});
|
||||||
|
|
||||||
xcb_free_pixmap(conn, pixmap);
|
xcb_free_pixmap(conn, pixmap);
|
||||||
if (blur_pixmap) {
|
|
||||||
xcb_free_pixmap(conn, *blur_pixmap);
|
|
||||||
free(blur_pixmap);
|
|
||||||
blur_pixmap = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
cursor = create_cursor(conn, screen, win, curs_choice);
|
cursor = create_cursor(conn, screen, win, curs_choice);
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ extern char *modifier_string;
|
||||||
/* A Cairo surface containing the specified image (-i), if any. */
|
/* A Cairo surface containing the specified image (-i), if any. */
|
||||||
extern cairo_surface_t *img;
|
extern cairo_surface_t *img;
|
||||||
extern cairo_surface_t *img_slideshow[256];
|
extern cairo_surface_t *img_slideshow[256];
|
||||||
|
extern cairo_surface_t *blur_bg_img;
|
||||||
extern int slideshow_image_count;
|
extern int slideshow_image_count;
|
||||||
extern int slideshow_interval;
|
extern int slideshow_interval;
|
||||||
extern bool slideshow_random_selection;
|
extern bool slideshow_random_selection;
|
||||||
|
@ -697,14 +698,19 @@ void render_lock(uint32_t *resolution, xcb_drawable_t drawable) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (img) {
|
if (blur_bg_img) {
|
||||||
draw_image(resolution, img, xcb_ctx);
|
cairo_set_source_surface(xcb_ctx, blur_bg_img, 0, 0);
|
||||||
|
cairo_paint(xcb_ctx);
|
||||||
} else {
|
} else {
|
||||||
cairo_set_source_rgba(xcb_ctx, background.red, background.green, background.blue, background.alpha);
|
cairo_set_source_rgba(xcb_ctx, background.red, background.green, background.blue, background.alpha);
|
||||||
cairo_rectangle(xcb_ctx, 0, 0, resolution[0], resolution[1]);
|
cairo_rectangle(xcb_ctx, 0, 0, resolution[0], resolution[1]);
|
||||||
cairo_fill(xcb_ctx);
|
cairo_fill(xcb_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (img) {
|
||||||
|
draw_image(resolution, img, xcb_ctx);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gen text
|
* gen text
|
||||||
* calc vars
|
* calc vars
|
||||||
|
|
Loading…
Reference in New Issue