summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm>2022-02-01 18:12:20 +0000
committernicm <nicm>2022-02-01 18:12:20 +0000
commit97900d0442252aa4b76f89745718038f39717ecd (patch)
tree1dd2fc5e672174f3a737255f446b48518bcc2316
parent7e34645fcbe93984461343d67373a29e552fec20 (diff)
A menu must be shown on a client, so always give the client when adding
the items. Also fix mode menus.
-rw-r--r--menu.c2
-rw-r--r--mode-tree.c12
-rw-r--r--popup.c4
3 files changed, 5 insertions, 13 deletions
diff --git a/menu.c b/menu.c
index c770cd7d..aaa1287e 100644
--- a/menu.c
+++ b/menu.c
@@ -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/mode-tree.c b/mode-tree.c
index 1eb496fe..c007e27f 100644
--- a/mode-tree.c
+++ b/mode-tree.c
@@ -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/popup.c b/popup.c
index bebc7cc6..4b4c58ca 100644
--- a/popup.c
+++ b/popup.c
@@ -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