summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/tmux.h
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2019-05-10 18:04:06 +0000
committernicm <nicm@openbsd.org>2019-05-10 18:04:06 +0000
commit3546f4c9d7222217295f53482140bcb81efab8e5 (patch)
tree6120d1b07ee95901b9a5c9d120fbc31ada8b32c3 /usr.bin/tmux/tmux.h
parenttweak previous: fix three wrong macros and one missing macro (diff)
downloadwireguard-openbsd-3546f4c9d7222217295f53482140bcb81efab8e5.tar.xz
wireguard-openbsd-3546f4c9d7222217295f53482140bcb81efab8e5.zip
Add support for simple menus usable with mouse or keyboard. New command
display-menu shows a menu (bound to the mouse on status line by default) and a couple of extra formats for the default menus.
Diffstat (limited to 'usr.bin/tmux/tmux.h')
-rw-r--r--usr.bin/tmux/tmux.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 74bf710149b..7ff83cd7e2c 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.894 2019/05/10 14:12:47 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.895 2019/05/10 18:04:06 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -748,20 +748,20 @@ struct screen_redraw_ctx {
#define screen_hsize(s) ((s)->grid->hsize)
#define screen_hlimit(s) ((s)->grid->hlimit)
-/* Menu item. */
+/* Menu. */
struct menu_item {
- char *name;
- char *command;
- key_code key;
+ char *name;
+ char *command;
+ key_code key;
};
-
-/* Menu. */
struct menu {
char *title;
struct menu_item *items;
u_int count;
u_int width;
};
+typedef void (*menu_choice_cb)(struct menu *, u_int, key_code, void *);
+#define MENU_NOMOUSE 0x1
/*
* Window mode. Windows can be in several modes and this is used to call the
@@ -2550,6 +2550,16 @@ void printflike(1, 2) log_debug(const char *, ...);
__dead void printflike(1, 2) fatal(const char *, ...);
__dead void printflike(1, 2) fatalx(const char *, ...);
+/* menu.c */
+struct menu *menu_create_from_items(struct menu_item *, u_int,
+ struct client *, struct cmd_find_state *, const char *);
+struct menu *menu_create_from_string(const char *, struct client *,
+ struct cmd_find_state *, const char *);
+void menu_free(struct menu *);
+int menu_display(struct menu *, int, struct cmdq_item *, u_int,
+ u_int, struct client *, struct cmd_find_state *,
+ menu_choice_cb, void *);
+
/* style.c */
int style_parse(struct style *,const struct grid_cell *,
const char *);