i3lock-color

The world's most popular non-default computer lockscreen.
Index Commits Files Refs README LICENSE
unlock_indicator.h (2111B)
   1 #ifndef _UNLOCK_INDICATOR_H
   2 #define _UNLOCK_INDICATOR_H
   3 
   4 #include <ev.h>
   5 #include <xcb/xcb.h>
   6 
   7 #include <fonts.h>
   8 
   9 typedef enum {
  10     STATE_STARTED = 0,           /* default state */
  11     STATE_KEY_PRESSED = 1,       /* key was pressed, show unlock indicator */
  12     STATE_KEY_ACTIVE = 2,        /* a key was pressed recently, highlight part
  13                                    of the unlock indicator. */
  14     STATE_BACKSPACE_ACTIVE = 3,  /* backspace was pressed recently, highlight
  15                                    part of the unlock indicator in red. */
  16     STATE_NOTHING_TO_DELETE = 4, /* backspace was pressed, but there is nothing to delete. */
  17 } unlock_state_t;
  18 
  19 typedef enum {
  20     STATE_AUTH_IDLE = 0,          /* no authenticator interaction at the moment */
  21     STATE_AUTH_VERIFY = 1,        /* currently verifying the password via authenticator */
  22     STATE_AUTH_LOCK = 2,          /* currently locking the screen */
  23     STATE_AUTH_WRONG = 3,         /* the password was wrong */
  24     STATE_I3LOCK_LOCK_FAILED = 4, /* i3lock failed to load */
  25 } auth_state_t;
  26 
  27 typedef struct {
  28     text_t status_text;
  29     text_t mod_text;
  30     text_t keylayout_text;
  31     text_t time_text;
  32     text_t date_text;
  33     text_t greeter_text;
  34 
  35     double indicator_x, indicator_y;
  36 
  37     double screen_x, screen_y;
  38     double bar_x, bar_y, bar_width;
  39 } DrawData;
  40 
  41 typedef enum {
  42     NONE,
  43     TILE,
  44     CENTER,
  45     FILL,
  46     SCALE,
  47     MAX,
  48 } background_type_t;
  49 
  50 
  51 typedef enum {
  52     CC_POS_RESET,
  53     CC_POS_CHANGE,
  54     CC_POS_KEEP,
  55     CC_POS_TAB
  56 } control_char_pos_t;
  57 
  58 typedef struct {
  59     char character;
  60     control_char_pos_t x_behavior;
  61     int x_behavior_arg;
  62     control_char_pos_t y_behavior;
  63     int y_behavior_arg;
  64 } control_char_config_t;
  65 
  66 void render_lock(uint32_t* resolution, xcb_drawable_t drawable);
  67 void draw_image(uint32_t* resolution, cairo_surface_t* img, cairo_t* xcb_ctx);
  68 void init_colors_once(void);
  69 void redraw_screen(void);
  70 void clear_indicator(void);
  71 void start_time_redraw_timeout(void);
  72 void* start_time_redraw_tick_pthread(void* arg);
  73 void start_time_redraw_tick(struct ev_loop* main_loop);
  74 #endif