Browse Source

merge upstream

master
Pandora 7 years ago
parent
commit
fdd03ea1e3
  1. 6
      i3lock.c
  2. 23
      unlock_indicator.c
  3. 19
      unlock_indicator.h

6
i3lock.c

@ -665,8 +665,12 @@ static void handle_key_press(xcb_key_press_event_t *event) {
if (ksym == XKB_KEY_h && !ctrl) if (ksym == XKB_KEY_h && !ctrl)
break; 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; return;
}
/* decrement input_position to point to the previous glyph */ /* decrement input_position to point to the previous glyph */
u8_dec(password, &input_position); u8_dec(password, &input_position);

23
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); cairo_set_source_rgba(ctx, insidewrong16.red, insidewrong16.green, insidewrong16.blue, insidewrong16.alpha);
break; break;
default: 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); cairo_set_source_rgba(ctx, inside16.red, inside16.green, inside16.blue, inside16.alpha);
break; break;
} }
@ -472,6 +476,16 @@ static void draw_indic(cairo_t *ctx, double ind_x, double ind_y) {
} }
break; break;
case STATE_AUTH_IDLE: 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); cairo_set_source_rgba(ctx, ring16.red, ring16.green, ring16.blue, ring16.alpha);
if (internal_line_source == 1) { if (internal_line_source == 1) {
line16.red = ring16.red; line16.red = ring16.red;
@ -712,6 +726,15 @@ xcb_pixmap_t draw_image(uint32_t *resolution) {
status_text.align = wrong_align; status_text.align = wrong_align;
break; break;
default: 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) { if (show_failed_attempts && failed_attempts > 0) {
status_text.show = true; status_text.show = true;
status_text.font = get_font_face(WRONG_FONT); status_text.font = get_font_face(WRONG_FONT);

19
unlock_indicator.h

@ -30,20 +30,21 @@ typedef struct rgba_str {
} rgba_str_t; } rgba_str_t;
typedef enum { typedef enum {
STATE_STARTED = 0, /* default state */ STATE_STARTED = 0, /* default state */
STATE_KEY_PRESSED = 1, /* key was pressed, show unlock indicator */ STATE_KEY_PRESSED = 1, /* key was pressed, show unlock indicator */
STATE_KEY_ACTIVE = 2, /* a key was pressed recently, highlight part STATE_KEY_ACTIVE = 2, /* a key was pressed recently, highlight part
of the unlock indicator. */ 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. */ part of the unlock indicator in red. */
STATE_NOTHING_TO_DELETE = 4, /* backspace was pressed, but there is nothing to delete. */
} unlock_state_t; } unlock_state_t;
typedef enum { typedef enum {
STATE_AUTH_IDLE = 0, /* no authenticator interaction at the moment */ STATE_AUTH_IDLE = 0, /* no authenticator interaction at the moment */
STATE_AUTH_VERIFY = 1, /* currently verifying the password via authenticator */ STATE_AUTH_VERIFY = 1, /* currently verifying the password via authenticator */
STATE_AUTH_LOCK = 2, /* currently locking the screen */ STATE_AUTH_LOCK = 2, /* currently locking the screen */
STATE_AUTH_WRONG = 3, /* the password was wrong */ STATE_AUTH_WRONG = 3, /* the password was wrong */
STATE_I3LOCK_LOCK_FAILED = 4 /* i3lock failed to load */ STATE_I3LOCK_LOCK_FAILED = 4, /* i3lock failed to load */
} auth_state_t; } auth_state_t;
xcb_pixmap_t draw_image(uint32_t* resolution); xcb_pixmap_t draw_image(uint32_t* resolution);

Loading…
Cancel
Save