aboutsummaryrefslogtreecommitdiff
path: root/menu.h
diff options
context:
space:
mode:
authoradnano <me@adnano.co>2024-06-09 20:30:58 -0400
committeradnano <me@adnano.co>2024-06-09 20:30:58 -0400
commit7d717b3696e8295f1236bb5c6c69417f14394883 (patch)
tree266bddf4aa2660869364ba658278a5fb448f6cdf /menu.h
parenta0df7959f9182a87a833d0a7f653f5ac8a2b5d0e (diff)
downloadwmenu-7d717b3696e8295f1236bb5c6c69417f14394883.tar.gz
Streamline menu callbacks
Diffstat (limited to 'menu.h')
-rw-r--r--menu.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/menu.h b/menu.h
index 724aa53..261c2f2 100644
--- a/menu.h
+++ b/menu.h
@@ -6,6 +6,9 @@
#include <xkbcommon/xkbcommon.h>
#include <wayland-client.h>
+struct menu;
+typedef void (*menu_callback)(struct menu *menu, char *text, bool exit);
+
// A menu item.
struct item {
char *text;
@@ -68,12 +71,12 @@ struct menu {
struct item *sel; // selected item
struct page *pages; // list of pages
- void (*callback)(struct menu *menu);
+ menu_callback callback;
bool exit;
bool failure;
};
-struct menu *menu_create();
+struct menu *menu_create(menu_callback callback);
void menu_destroy(struct menu *menu);
void menu_getopts(struct menu *menu, int argc, char *argv[]);
void menu_add_item(struct menu *menu, char *text, bool sort);