]> git.sur5r.net Git - i3/i3lock/blobdiff - unlock_indicator.c
Turn on the screen on successful authentication
[i3/i3lock] / unlock_indicator.c
index a0decb44657a6d7263f79df7c5638af0299075f9..5e4015c745f59887221b565f1ffff7617b593808 100644 (file)
 #include <stdlib.h>
 #include <math.h>
 #include <xcb/xcb.h>
-#include <xcb/xcb_keysyms.h>
 #include <ev.h>
-
-#ifndef NOLIBCAIRO
 #include <cairo.h>
 #include <cairo/cairo-xcb.h>
-#endif
 
 #include "xcb.h"
 #include "unlock_indicator.h"
@@ -47,10 +43,8 @@ extern uint32_t last_resolution[2];
 /* Whether the unlock indicator is enabled (defaults to true). */
 extern bool unlock_indicator;
 
-#ifndef NOLIBCAIRO
 /* A Cairo surface containing the specified image (-i), if any. */
 extern cairo_surface_t *img;
-#endif
 
 /* Whether the image should be tiled. */
 extern bool tile;
@@ -79,7 +73,6 @@ pam_state_t pam_state;
 xcb_pixmap_t draw_image(uint32_t *resolution) {
     xcb_pixmap_t bg_pixmap = XCB_NONE;
 
-#ifndef NOLIBCAIRO
     if (!vistype)
         vistype = get_root_visual_type(screen);
     bg_pixmap = create_bg_pixmap(conn, screen, resolution, color);
@@ -253,8 +246,8 @@ xcb_pixmap_t draw_image(uint32_t *resolution) {
         /* We have no information about the screen sizes/positions, so we just
          * place the unlock indicator in the middle of the X root window and
          * hope for the best. */
-        int x = (last_resolution[0] / 2);
-        int y = (last_resolution[1] / 2);
+        int x = (last_resolution[0] / 2) - (BUTTON_DIAMETER / 2);
+        int y = (last_resolution[1] / 2) - (BUTTON_DIAMETER / 2);
         cairo_set_source_surface(xcb_ctx, output, x, y);
         cairo_rectangle(xcb_ctx, x, y, BUTTON_DIAMETER, BUTTON_DIAMETER);
         cairo_fill(xcb_ctx);
@@ -264,7 +257,6 @@ xcb_pixmap_t draw_image(uint32_t *resolution) {
     cairo_surface_destroy(output);
     cairo_destroy(ctx);
     cairo_destroy(xcb_ctx);
-#endif
     return bg_pixmap;
 }