diff options
Diffstat (limited to 'unlock_indicator.c')
-rw-r--r-- | unlock_indicator.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/unlock_indicator.c b/unlock_indicator.c index 4c7d0e9..cf7a391 100644 --- a/unlock_indicator.c +++ b/unlock_indicator.c @@ -50,8 +50,12 @@ extern char *modifier_string; /* A Cairo surface containing the specified image (-i), if any. */ extern cairo_surface_t *img; - -/* Whether the image should be tiled. */ +/* array of Cairo surfaces containing the authorization status images (-a), if any. */ +extern cairo_surface_t * auth_images[5]; +extern bool use_auth_images; +/* Path of directory containing indicator keypress images (-k), if any. */ +extern char * keypress_image_path; +/*Whether the image should be tiled. */ extern bool tile; /* The background color to use (in hex). */ extern char color[7]; @@ -139,8 +143,25 @@ xcb_pixmap_t draw_image(uint32_t *resolution) { cairo_rectangle(xcb_ctx, 0, 0, resolution[0], resolution[1]); cairo_fill(xcb_ctx); } - - if (unlock_indicator && + //if auth images are used just draw the corresponding image + if (use_auth_images && unlock_indicator && + (unlock_state >= STATE_KEY_PRESSED || auth_state > STATE_AUTH_IDLE)) { + if (!tile) { + cairo_set_source_surface(xcb_ctx, auth_images[auth_state], 0, 0); + cairo_paint(xcb_ctx); + } else { + /* create a pattern and fill a rectangle as big as the screen */ + cairo_pattern_t *pattern; + pattern = cairo_pattern_create_for_surface(auth_images[auth_state]); + cairo_set_source(xcb_ctx, pattern); + cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT); + cairo_rectangle(xcb_ctx, 0, 0, resolution[0], resolution[1]); + cairo_fill(xcb_ctx); + cairo_pattern_destroy(pattern); + } + } + //otherwise draw the circle indicator + if ((!use_auth_images) && unlock_indicator && (unlock_state >= STATE_KEY_PRESSED || auth_state > STATE_AUTH_IDLE)) { cairo_scale(ctx, scaling_factor(), scaling_factor()); /* Draw a (centered) circle with transparent background. */ |