@@ -232,6 +232,10 @@ int failed_attempts = 0;
232
232
bool show_failed_attempts = false;
233
233
bool retry_verification = false;
234
234
235
+ /* Set to true by `input_done` when the password is correct.
236
+ * Needed if user has entered password before intialization completed. */
237
+ bool unlocked = false;
238
+
235
239
static struct xkb_state * xkb_state ;
236
240
static struct xkb_context * xkb_context ;
237
241
static struct xkb_keymap * xkb_keymap ;
@@ -564,6 +568,7 @@ static void input_done(void) {
564
568
565
569
if (no_verify ) {
566
570
ev_break (EV_DEFAULT , EVBREAK_ALL );
571
+ unlocked = true;
567
572
return ;
568
573
}
569
574
@@ -578,6 +583,7 @@ static void input_done(void) {
578
583
clear_password_memory ();
579
584
580
585
ev_break (EV_DEFAULT , EVBREAK_ALL );
586
+ unlocked = true;
581
587
return ;
582
588
}
583
589
#else
@@ -593,6 +599,7 @@ static void input_done(void) {
593
599
pam_cleanup = true;
594
600
595
601
ev_break (EV_DEFAULT , EVBREAK_ALL );
602
+ unlocked = true;
596
603
return ;
597
604
}
598
605
#endif
@@ -2633,19 +2640,24 @@ int main(int argc, char *argv[]) {
2633
2640
* file descriptor becomes readable). */
2634
2641
ev_invoke (main_loop , xcb_check , 0 );
2635
2642
2636
- if (show_clock || bar_enabled || slideshow_enabled ) {
2637
- if (redraw_thread ) {
2638
- struct timespec ts ;
2639
- double s ;
2640
- double ns = modf (refresh_rate , & s );
2641
- ts .tv_sec = (time_t ) s ;
2642
- ts .tv_nsec = ns * NANOSECONDS_IN_SECOND ;
2643
- (void ) pthread_create (& draw_thread , NULL , start_time_redraw_tick_pthread , (void * ) & ts );
2644
- } else {
2645
- start_time_redraw_tick (main_loop );
2643
+ /* If the user was fast enough to have typed their password (and pressed Enter) before
2644
+ * i3lock has finished intializing, all of that is processed in the above `ev_invoke`.
2645
+ * If the password was correct (`unlocked` is true), we should not enter the event loop. */
2646
+ if (!unlocked ) {
2647
+ if (show_clock || bar_enabled || slideshow_enabled ) {
2648
+ if (redraw_thread ) {
2649
+ struct timespec ts ;
2650
+ double s ;
2651
+ double ns = modf (refresh_rate , & s );
2652
+ ts .tv_sec = (time_t ) s ;
2653
+ ts .tv_nsec = ns * NANOSECONDS_IN_SECOND ;
2654
+ (void ) pthread_create (& draw_thread , NULL , start_time_redraw_tick_pthread , (void * ) & ts );
2655
+ } else {
2656
+ start_time_redraw_tick (main_loop );
2657
+ }
2646
2658
}
2659
+ ev_loop (main_loop , 0 );
2647
2660
}
2648
- ev_loop (main_loop , 0 );
2649
2661
2650
2662
#ifndef __OpenBSD__
2651
2663
if (pam_cleanup ) {
0 commit comments