mirror of
https://github.com/Raymo111/i3lock-color.git
synced 2024-11-18 13:54:55 -05:00
really hacky blur + overlayed image support
This commit is contained in:
parent
27ba87c8e4
commit
db9e953bde
2 changed files with 31 additions and 24 deletions
9
i3lock.c
9
i3lock.c
|
@ -114,6 +114,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;
|
||||
|
@ -1194,20 +1195,18 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
xcb_pixmap_t blur_pixmap;
|
||||
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]);
|
||||
|
||||
img = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, last_resolution[0], last_resolution[1]);
|
||||
cairo_t *ctx = cairo_create(img);
|
||||
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, 10000);
|
||||
blur_image_surface(blur_img, 10000);
|
||||
}
|
||||
|
||||
/* Pixmap on which the image is rendered to (if any) */
|
||||
|
|
|
@ -53,6 +53,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;
|
||||
|
@ -138,6 +139,11 @@ 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 (img || blur_img) {
|
||||
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);
|
||||
|
@ -152,6 +158,8 @@ xcb_pixmap_t draw_image(uint32_t *resolution) {
|
|||
cairo_fill(xcb_ctx);
|
||||
cairo_pattern_destroy(pattern);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
char strgroups[3][3] = {{color[0], color[1], '\0'},
|
||||
{color[2], color[3], '\0'},
|
||||
|
|
Loading…
Reference in a new issue