]> git.ozlabs.org Git - petitboot/commitdiff
ui/ncurses: Implement non-boot-cancelling keys
authorJeremy Kerr <jk@ozlabs.org>
Tue, 3 Jul 2018 06:34:46 +0000 (16:34 +1000)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Tue, 10 Jul 2018 03:46:12 +0000 (13:46 +1000)
Allow some keys to not cancel the default-boot process.

For the moment, this is just the screen refresh (ctrl+L).

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
ui/ncurses/nc-cui.c

index 8a3f97dc9b593f58bd14d40989b6d389eacf2365..87540cad66243f8ac56267122879ab43836005fb 100644 (file)
@@ -527,6 +527,14 @@ struct nc_scr *cui_set_current(struct cui *cui, struct nc_scr *scr)
        return old;
 }
 
+static bool key_cancels_boot(int key)
+{
+       if (key == 0xc)
+               return false;
+
+       return true;
+}
+
 static bool process_global_keys(struct cui *cui, int key)
 {
        switch (key) {
@@ -582,7 +590,7 @@ static int cui_process_key(void *arg)
                        }
                }
 
-               if (!cui->has_input) {
+               if (!cui->has_input && key_cancels_boot(c)) {
                        cui->has_input = true;
                        if (cui->client) {
                                pb_log("UI input received (key = %d), aborting "