]> git.ozlabs.org Git - petitboot/blobdiff - ui/ncurses/ps3-main.c
ui/ncurses: Allow multiple hot key handlers per pmenu
[petitboot] / ui / ncurses / ps3-main.c
index 1269549b7f8ac13a5dbff83b581d2d64a74f8ef2..f60a05e41a8c842395ae6350b4c86c8930805632 100644 (file)
@@ -24,9 +24,9 @@
  * ncurses mouse support
  */
 
+#if defined(HAVE_CONFIG_H)
 #include "config.h"
-
-#define _GNU_SOURCE
+#endif
 
 #include <assert.h>
 #include <errno.h>
@@ -411,7 +411,15 @@ static struct pmenu *ps3_mm_init(struct ps3_cui *ps3_cui)
                return NULL;
        }
 
-       m->hot_key = ps3_hot_key;
+       m->n_hot_keys = 2;
+       m->hot_keys = talloc_array(m, hot_key_fn *, m->n_hot_keys);
+       if (!m->hot_keys) {
+               pb_log("%s: failed to allocate hot_keys\n", __func__);
+               talloc_free(m);
+               return NULL;
+       }
+       m->hot_keys[0] = ps3_hot_key;
+       m->hot_keys[1] = pmenu_main_hot_keys;
        m->on_new = cui_item_new;
 
 #if defined(DEBUG)