First draft to center the given image
Patch status: rejected
Patch by Romuald Brunet
To apply this patch, use:
curl http://cr.i3wm.org/patch/656/raw.patch | git am
b/unlock_indicator.c
13 |
@@ -112,7 +112,14 @@ xcb_pixmap_t draw_image(uint32_t *resolution) { |
14 |
|
15 |
if (img) { |
16 |
if (!tile) { |
17 |
- cairo_set_source_surface(xcb_ctx, img, 0, 0); |
18 |
+ // XXX handle multiple screens |
19 |
+ int x = (resolution[0] / 2); |
20 |
+ int y = (resolution[1] / 2); |
21 |
+ |
22 |
+ x -= cairo_image_surface_get_width(img) / 2; |
23 |
+ y -= cairo_image_surface_get_height(img) / 2; |
24 |
+ |
25 |
+ cairo_set_source_surface(xcb_ctx, img, x, y); |
26 |
cairo_paint(xcb_ctx); |
27 |
} else { |
28 |
/* create a pattern and fill a rectangle as big as the screen */ |