summaryrefslogtreecommitdiffstats
path: root/menu.c
diff options
context:
space:
mode:
authornicm <nicm>2020-03-24 08:09:43 +0000
committernicm <nicm>2020-03-24 08:09:43 +0000
commit8a838b0372163e1a7c0379991545a55028bb9eba (patch)
treee661c7515692850627863e31a357c2305f4dabcd /menu.c
parentedca27ae45db7be104bc56a4e48e55cddc40acdb (diff)
Add support for overlay popup boxes to show text or output temporarily
above the normal layout. These work similarly to menus and are created with the display-popup command.
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/menu.c b/menu.c
index f70b1d18..7ca6253e 100644
--- a/menu.c
+++ b/menu.c
@@ -130,6 +130,16 @@ menu_free(struct menu *menu)
free(menu);
}
+static int
+menu_mode_cb(struct client *c, __unused u_int *cx, __unused u_int *cy)
+{
+ struct menu_data *md = c->overlay_data;
+
+ if (~md->flags & MENU_NOMOUSE)
+ return (MODE_MOUSE_ALL);
+ return (0);
+}
+
static void
menu_draw_cb(struct client *c, __unused struct screen_redraw_ctx *ctx0)
{
@@ -147,9 +157,6 @@ menu_draw_cb(struct client *c, __unused struct screen_redraw_ctx *ctx0)
for (i = 0; i < screen_size_y(&md->s); i++)
tty_draw_line(tty, NULL, s, 0, i, menu->width + 4, px, py + i);
-
- if (~md->flags & MENU_NOMOUSE)
- tty_update_mode(tty, MODE_MOUSE_ALL, NULL);
}
static void
@@ -317,7 +324,7 @@ menu_display(struct menu *menu, int flags, struct cmdq_item *item, u_int px,
md->cb = cb;
md->data = data;
- server_client_set_overlay(c, 0, menu_draw_cb, menu_key_cb, menu_free_cb,
- md);
+ server_client_set_overlay(c, 0, NULL, menu_mode_cb, menu_draw_cb,
+ menu_key_cb, menu_free_cb, md);
return (0);
}