]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
main: don't allow ESC key repeat to flood console
authorRay Strode <rstrode@redhat.com>
Fri, 17 Mar 2017 20:35:46 +0000 (16:35 -0400)
committerRay Strode <rstrode@redhat.com>
Fri, 24 Mar 2017 19:12:12 +0000 (15:12 -0400)
If the user holds down ESC the system can easily get
overrun toggling details and the theme back and forth.

This commit changes the code to ignore any ESC key events
that come in while ESC is getting processed.

src/main.c

index 0864e5e1629a2ecd5500d5556e0fcaba18b8e26e..02e0082b35b81214dceecee6beddaa874373a6e4 100644 (file)
@@ -102,6 +102,7 @@ typedef struct
         ply_terminal_t         *local_console_terminal;
         ply_device_manager_t   *device_manager;
 
+        ply_trigger_t          *details_trigger;
         ply_trigger_t          *deactivate_trigger;
         ply_trigger_t          *quit_trigger;
 
@@ -1500,8 +1501,24 @@ toggle_between_splash_and_details (state_t *state)
 static void
 on_escape_pressed (state_t *state)
 {
+
+        if (state->details_trigger != NULL) {
+                return;
+        }
+
+        state->details_trigger = ply_trigger_new (&state->details_trigger);
+
+        ply_trigger_add_handler (state->details_trigger,
+                                 (ply_trigger_handler_t)
+                                 toggle_between_splash_details,
+                                 state);
+
         ply_trace ("escape key pressed");
-        toggle_between_splash_and_details (state);
+        ply_event_loop_watch_for_timeout (state->loop,
+                                          0.01,
+                                          (ply_event_loop_timeout_handler_t)
+                                          ply_trigger_pull
+                                          state->details_trigger);
 }
 
 static void