]> git.sur5r.net Git - i3/i3lock/blobdiff - i3lock.c
Indicate that the --inactivity-timeout option takes an argument.
[i3/i3lock] / i3lock.c
index bd2e138f3ef011ecb7e1cbf478312b45a624ef00..18d7667ddfa1e8b3e55cca3ce499c396f8c0523f 100644 (file)
--- a/i3lock.c
+++ b/i3lock.c
@@ -1,7 +1,7 @@
 /*
  * vim:ts=4:sw=4:expandtab
  *
- * © 2010-2013 Michael Stapelberg
+ * © 2010 Michael Stapelberg
  *
  * See LICENSE for licensing information
  *
@@ -240,10 +240,12 @@ static void clear_input(void) {
 
     /* 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) {
@@ -322,7 +324,8 @@ static void input_done(void) {
     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). */
@@ -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);
 
-    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);
 }
 
@@ -793,7 +799,7 @@ int main(int argc, char *argv[]) {
     while ((o = getopt_long(argc, argv, optstring, longopts, &optind)) != -1) {
         switch (o) {
             case 'v':
-                errx(EXIT_SUCCESS, "version " VERSION " © 2010-2012 Michael Stapelberg");
+                errx(EXIT_SUCCESS, "version " VERSION " © 2010 Michael Stapelberg");
             case 'n':
                 dont_fork = true;
                 break;
@@ -852,7 +858,7 @@ int main(int argc, char *argv[]) {
                 break;
             default:
                 errx(EXIT_FAILURE, "Syntax: i3lock [-v] [-n] [-b] [-d] [-c color] [-u] [-p win|default]"
-                                   " [-i image.png] [-t] [-e] [-I] [-f]");
+                                   " [-i image.png] [-t] [-e] [-I timeout] [-f]");
         }
     }