aboutsummaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2020-10-30 10:01:22 +0000
committerThomas Adam <thomas@xteddy.org>2020-10-30 10:01:22 +0000
commit970e8f734c996e6a1402be1181c48abd14b6404a (patch)
treead8797fa0e081a6f46b7e9ee7a162b9144fe7361 /menu.c
parentce2b6ff40e13fd25f359cfe3faad49b094aad115 (diff)
parent910457f68dfc04c491f31d773788c61300f3f8c7 (diff)
downloadrtmux-970e8f734c996e6a1402be1181c48abd14b6404a.tar.gz
rtmux-970e8f734c996e6a1402be1181c48abd14b6404a.tar.bz2
rtmux-970e8f734c996e6a1402be1181c48abd14b6404a.zip
Merge branch 'obsd-master'
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/menu.c b/menu.c
index 4fcf660a..3bd56ab1 100644
--- a/menu.c
+++ b/menu.c
@@ -203,16 +203,28 @@ menu_key_cb(struct client *c, struct key_event *event)
m->x > md->px + 4 + menu->width ||
m->y < md->py + 1 ||
m->y > md->py + 1 + count - 1) {
- if (MOUSE_RELEASE(m->b))
- return (1);
+ if (~md->flags & MENU_STAYOPEN) {
+ if (MOUSE_RELEASE(m->b))
+ return (1);
+ } else {
+ if (!MOUSE_RELEASE(m->b) &&
+ MOUSE_WHEEL(m->b) == 0 &&
+ !MOUSE_DRAG(m->b))
+ return (1);
+ }
if (md->choice != -1) {
md->choice = -1;
c->flags |= CLIENT_REDRAWOVERLAY;
}
return (0);
}
- if (MOUSE_RELEASE(m->b))
- goto chosen;
+ if (~md->flags & MENU_STAYOPEN) {
+ if (MOUSE_RELEASE(m->b))
+ goto chosen;
+ } else {
+ if (MOUSE_WHEEL(m->b) == 0 && !MOUSE_DRAG(m->b))
+ goto chosen;
+ }
md->choice = m->y - (md->py + 1);
if (md->choice != old)
c->flags |= CLIENT_REDRAWOVERLAY;
@@ -303,6 +315,8 @@ chosen:
if (md->choice == -1)
return (1);
item = &menu->items[md->choice];
+ if ((md->flags & MENU_STAYOPEN) && item->name == NULL)
+ return (0);
if (item->name == NULL || *item->name == '-')
return (1);
if (md->cb != NULL) {