Browse Source

restore intended functionality of images over blurring

master
Chris Guillott 8 years ago
parent
commit
aa906d564c
  1. 34
      i3lock.c
  2. 5
      unlock_indicator.c

34
i3lock.c

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

5
unlock_indicator.c

@ -56,6 +56,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 *blur_img;
/* Whether the image should be tiled. */ /* Whether the image should be tiled. */
extern bool tile; 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_surface_t *xcb_output = cairo_xcb_surface_create(conn, bg_pixmap, vistype, resolution[0], resolution[1]);
cairo_t *xcb_ctx = cairo_create(xcb_output); 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 (img) {
if (!tile) { if (!tile) {
cairo_set_source_surface(xcb_ctx, img, 0, 0); cairo_set_source_surface(xcb_ctx, img, 0, 0);

Loading…
Cancel
Save