From: Ray Strode Date: Fri, 17 Mar 2017 20:35:46 +0000 (-0400) Subject: main: don't allow ESC key repeat to flood console X-Git-Tag: 0.9.3~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1f1d83bf71fc4d1748bed3366fd6a597d34fbabd;p=thirdparty%2Fplymouth.git main: don't allow ESC key repeat to flood console 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. --- diff --git a/src/main.c b/src/main.c index 0864e5e1..02e0082b 100644 --- a/src/main.c +++ b/src/main.c @@ -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