From 8a838b0372163e1a7c0379991545a55028bb9eba Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 24 Mar 2020 08:09:43 +0000 Subject: 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. --- menu.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'menu.c') 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); } -- cgit v1.2.3