summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2022-02-01 18:12:21 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2022-02-01 18:12:21 +0000
commitb1b748cecde4d85fed803e26c3fb543cf53adffa (patch)
tree2ed7106e80488590441ced5f850f6a549a0c7fdc /usr.bin
parent37b6e53e336e1319bbeca5a85564a574d4f9192a (diff)
A menu must be shown on a client, so always give the client when adding
the items. Also fix mode menus.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/menu.c4
-rw-r--r--usr.bin/tmux/mode-tree.c14
-rw-r--r--usr.bin/tmux/popup.c6
3 files changed, 8 insertions, 16 deletions
diff --git a/usr.bin/tmux/menu.c b/usr.bin/tmux/menu.c
index d5fc75c15a2..f9bcbafce73 100644
--- a/usr.bin/tmux/menu.c
+++ b/usr.bin/tmux/menu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: menu.c,v 1.42 2022/02/01 11:52:08 nicm Exp $ */
+/* $OpenBSD: menu.c,v 1.43 2022/02/01 18:12:20 nicm Exp $ */
/*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -81,8 +81,6 @@ menu_add_item(struct menu *menu, const struct menu_item *item,
menu->count--;
return;
}
- if (c->tty.sx <= 4)
- return;
max_width = c->tty.sx - 4;
slen = strlen(s);
diff --git a/usr.bin/tmux/mode-tree.c b/usr.bin/tmux/mode-tree.c
index f5e50c7cfc6..960bccde0f0 100644
--- a/usr.bin/tmux/mode-tree.c
+++ b/usr.bin/tmux/mode-tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mode-tree.c,v 1.61 2021/12/06 10:10:52 nicm Exp $ */
+/* $OpenBSD: mode-tree.c,v 1.62 2022/02/01 18:12:20 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -104,7 +104,6 @@ struct mode_tree_menu {
struct mode_tree_data *data;
struct client *c;
u_int line;
- void *itemdata;
};
static void mode_tree_free_items(struct mode_tree_list *);
@@ -909,18 +908,14 @@ static void
mode_tree_menu_callback(__unused struct menu *menu, __unused u_int idx,
key_code key, void *data)
{
- struct mode_tree_menu *mtm = data;
- struct mode_tree_data *mtd = mtm->data;
- struct mode_tree_item *mti;
+ struct mode_tree_menu *mtm = data;
+ struct mode_tree_data *mtd = mtm->data;
if (mtd->dead || key == KEYC_NONE)
goto out;
if (mtm->line >= mtd->line_size)
goto out;
- mti = mtd->line_list[mtm->line].item;
- if (mti->itemdata != mtm->itemdata)
- goto out;
mtd->current = mtm->line;
mtd->menucb(mtd->modedata, mtm->c, key);
@@ -954,14 +949,13 @@ mode_tree_display_menu(struct mode_tree_data *mtd, struct client *c, u_int x,
title = xstrdup("");
}
menu = menu_create(title);
- menu_add_items(menu, items, NULL, NULL, NULL);
+ menu_add_items(menu, items, NULL, c, NULL);
free(title);
mtm = xmalloc(sizeof *mtm);
mtm->data = mtd;
mtm->c = c;
mtm->line = line;
- mtm->itemdata = mti->itemdata;
mtd->references++;
if (x >= (menu->width + 4) / 2)
diff --git a/usr.bin/tmux/popup.c b/usr.bin/tmux/popup.c
index 07f57ab8d61..79b01fce115 100644
--- a/usr.bin/tmux/popup.c
+++ b/usr.bin/tmux/popup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: popup.c,v 1.43 2022/01/17 10:40:03 nicm Exp $ */
+/* $OpenBSD: popup.c,v 1.44 2022/02/01 18:12:20 nicm Exp $ */
/*
* Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -566,10 +566,10 @@ popup_key_cb(struct client *c, void *data, struct key_event *event)
menu:
pd->menu = menu_create("");
if (pd->flags & POPUP_INTERNAL) {
- menu_add_items(pd->menu, popup_internal_menu_items, NULL, NULL,
+ menu_add_items(pd->menu, popup_internal_menu_items, NULL, c,
NULL);
} else
- menu_add_items(pd->menu, popup_menu_items, NULL, NULL, NULL);
+ menu_add_items(pd->menu, popup_menu_items, NULL, c, NULL);
if (m->x >= (pd->menu->width + 4) / 2)
x = m->x - (pd->menu->width + 4) / 2;
else