diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-03-24 08:09:45 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-03-24 08:09:45 +0000 |
commit | c388b4e3c34aa8ba5f114ec9fef4197eda7d3837 (patch) | |
tree | 3c5b0ec1a0a7072aaa4eeed5fdcc1bfa9e69fdf6 /usr.bin/tmux/menu.c | |
parent | 3561354fc3a5a7594b6f545cf5e8521f05553d04 (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 'usr.bin/tmux/menu.c')
-rw-r--r-- | usr.bin/tmux/menu.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/usr.bin/tmux/menu.c b/usr.bin/tmux/menu.c index e7ab42fba81..a11f4c5882a 100644 --- a/usr.bin/tmux/menu.c +++ b/usr.bin/tmux/menu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: menu.c,v 1.14 2020/03/20 17:26:14 nicm Exp $ */ +/* $OpenBSD: menu.c,v 1.15 2020/03/24 08:09:44 nicm Exp $ */ /* * Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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); } |