]> git.sur5r.net Git - i3/i3lock/commitdiff
Only redraw the screen if the unlock indicator is actually used. 13/head
authorIngo Bürk <ingo.buerk@tngtech.com>
Fri, 24 Apr 2015 21:36:24 +0000 (23:36 +0200)
committerIngo Bürk <ingo.buerk@tngtech.com>
Fri, 24 Apr 2015 21:36:24 +0000 (23:36 +0200)
fixes #12

i3lock.c

index 0909dd0fc71988d10f4a78516e494b40cd75b672..5d90924d04da4d39db68900f2108661485cd1627 100644 (file)
--- a/i3lock.c
+++ b/i3lock.c
@@ -240,10 +240,12 @@ static void clear_input(void) {
 
     /* Hide the unlock indicator after a bit if the password buffer is
      * empty. */
 
     /* Hide the unlock indicator after a bit if the password buffer is
      * empty. */
-    START_TIMER(clear_indicator_timeout, 1.0, clear_indicator_cb);
-    unlock_state = STATE_BACKSPACE_ACTIVE;
-    redraw_screen();
-    unlock_state = STATE_KEY_PRESSED;
+    if (unlock_indicator) {
+        START_TIMER(clear_indicator_timeout, 1.0, clear_indicator_cb);
+        unlock_state = STATE_BACKSPACE_ACTIVE;
+        redraw_screen();
+        unlock_state = STATE_KEY_PRESSED;
+    }
 }
 
 static void turn_off_monitors_cb(EV_P_ ev_timer *w, int revents) {
 }
 
 static void turn_off_monitors_cb(EV_P_ ev_timer *w, int revents) {
@@ -322,7 +324,8 @@ static void input_done(void) {
     pam_state = STATE_PAM_WRONG;
     failed_attempts += 1;
     clear_input();
     pam_state = STATE_PAM_WRONG;
     failed_attempts += 1;
     clear_input();
-    redraw_screen();
+    if (unlock_indicator)
+        redraw_screen();
 
     /* Clear this state after 2 seconds (unless the user enters another
      * password during that time). */
 
     /* Clear this state after 2 seconds (unless the user enters another
      * password during that time). */
@@ -470,13 +473,16 @@ static void handle_key_press(xcb_key_press_event_t *event) {
     input_position += n - 1;
     DEBUG("current password = %.*s\n", input_position, password);
 
     input_position += n - 1;
     DEBUG("current password = %.*s\n", input_position, password);
 
-    unlock_state = STATE_KEY_ACTIVE;
-    redraw_screen();
-    unlock_state = STATE_KEY_PRESSED;
+    if (unlock_indicator) {
+        unlock_state = STATE_KEY_ACTIVE;
+        redraw_screen();
+        unlock_state = STATE_KEY_PRESSED;
+
+        struct ev_timer *timeout = NULL;
+        START_TIMER(timeout, TSTAMP_N_SECS(0.25), redraw_timeout);
+        STOP_TIMER(clear_indicator_timeout);
+    }
 
 
-    struct ev_timer *timeout = NULL;
-    START_TIMER(timeout, TSTAMP_N_SECS(0.25), redraw_timeout);
-    STOP_TIMER(clear_indicator_timeout);
     START_TIMER(discard_passwd_timeout, TSTAMP_N_MINS(3), discard_passwd_cb);
 }
 
     START_TIMER(discard_passwd_timeout, TSTAMP_N_MINS(3), discard_passwd_cb);
 }