i3lock-color

The world's most popular non-default computer lockscreen.
Index Commits Files Refs README LICENSE
commit fdd03ea1e39c953167a0b99c520c2c7c9ab9ee58
parent 6b943766dae08295e8ecdeb81d126e9f06f39194
Author: Pandora <Pandora@techfo.xyz>
Date:   Sat, 20 Jan 2018 00:06:10 -0500

merge upstream

Diffstat:
Mi3lock.c | 6+++++-
Munlock_indicator.c | 23+++++++++++++++++++++++
Munlock_indicator.h | 19++++++++++---------
3 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/i3lock.c b/i3lock.c
@@ -665,8 +665,12 @@ static void handle_key_press(xcb_key_press_event_t *event) {
             if (ksym == XKB_KEY_h && !ctrl)
                 break;
 
-            if (input_position == 0)
+            if (input_position == 0) {
+                START_TIMER(clear_indicator_timeout, 1.0, clear_indicator_cb);
+                unlock_state = STATE_NOTHING_TO_DELETE;
+                redraw_screen();
                 return;
+            }
 
             /* decrement input_position to point to the previous glyph */
             u8_dec(password, &input_position);
diff --git a/unlock_indicator.c b/unlock_indicator.c
@@ -445,6 +445,10 @@ static void draw_indic(cairo_t *ctx, double ind_x, double ind_y) {
                 cairo_set_source_rgba(ctx, insidewrong16.red, insidewrong16.green, insidewrong16.blue, insidewrong16.alpha);
                 break;
             default:
+                if (unlock_state == STATE_NOTHING_TO_DELETE) {
+                    cairo_set_source_rgba(ctx, insidewrong16.red, insidewrong16.green, insidewrong16.blue, insidewrong16.alpha);
+                    break;
+                }
                 cairo_set_source_rgba(ctx, inside16.red, inside16.green, inside16.blue, inside16.alpha);
                 break;
         }
@@ -472,6 +476,16 @@ static void draw_indic(cairo_t *ctx, double ind_x, double ind_y) {
                 }
                 break;
             case STATE_AUTH_IDLE:
+                if (unlock_state == STATE_NOTHING_TO_DELETE) {
+                    cairo_set_source_rgba(ctx, ringwrong16.red, ringwrong16.green, ringwrong16.blue, ringwrong16.alpha);
+                    if (internal_line_source == 1) {
+                        line16.red = ringwrong16.red;
+                        line16.green = ringwrong16.green;
+                        line16.blue = ringwrong16.blue;
+                        line16.alpha = ringwrong16.alpha;
+                    }
+                    break;
+                }
                 cairo_set_source_rgba(ctx, ring16.red, ring16.green, ring16.blue, ring16.alpha);
                 if (internal_line_source == 1) {
                   line16.red = ring16.red;
@@ -712,6 +726,15 @@ xcb_pixmap_t draw_image(uint32_t *resolution) {
                 status_text.align = wrong_align;
                 break;
             default:
+                if (unlock_state == STATE_NOTHING_TO_DELETE) {
+                    status_text.show = true;
+                    strncpy(status_text.str, "no input", sizeof(status_text.str));
+                    status_text.font = get_font_face(WRONG_FONT);
+                    status_text.color = wrong16;
+                    status_text.size = wrong_size;
+                    status_text.align = wrong_align;
+                    break;
+                }
                 if (show_failed_attempts && failed_attempts > 0) {
                     status_text.show = true;
                     status_text.font = get_font_face(WRONG_FONT);
diff --git a/unlock_indicator.h b/unlock_indicator.h
@@ -30,20 +30,21 @@ typedef struct rgba_str {
 } rgba_str_t;
 
 typedef enum {
-    STATE_STARTED = 0,         /* default state */
-    STATE_KEY_PRESSED = 1,     /* key was pressed, show unlock indicator */
-    STATE_KEY_ACTIVE = 2,      /* a key was pressed recently, highlight part
+    STATE_STARTED = 0,           /* default state */
+    STATE_KEY_PRESSED = 1,       /* key was pressed, show unlock indicator */
+    STATE_KEY_ACTIVE = 2,        /* a key was pressed recently, highlight part
                                    of the unlock indicator. */
-    STATE_BACKSPACE_ACTIVE = 3 /* backspace was pressed recently, highlight
+    STATE_BACKSPACE_ACTIVE = 3,  /* backspace was pressed recently, highlight
                                    part of the unlock indicator in red. */
+    STATE_NOTHING_TO_DELETE = 4, /* backspace was pressed, but there is nothing to delete. */
 } unlock_state_t;
 
 typedef enum {
-    STATE_AUTH_IDLE = 0,         /* no authenticator interaction at the moment */
-    STATE_AUTH_VERIFY = 1,       /* currently verifying the password via authenticator */
-    STATE_AUTH_LOCK = 2,         /* currently locking the screen */
-    STATE_AUTH_WRONG = 3,        /* the password was wrong */
-    STATE_I3LOCK_LOCK_FAILED = 4 /* i3lock failed to load */
+    STATE_AUTH_IDLE = 0,          /* no authenticator interaction at the moment */
+    STATE_AUTH_VERIFY = 1,        /* currently verifying the password via authenticator */
+    STATE_AUTH_LOCK = 2,          /* currently locking the screen */
+    STATE_AUTH_WRONG = 3,         /* the password was wrong */
+    STATE_I3LOCK_LOCK_FAILED = 4, /* i3lock failed to load */
 } auth_state_t;
 
 xcb_pixmap_t draw_image(uint32_t* resolution);