diff options
author | nicm <nicm> | 2020-04-16 17:20:23 +0000 |
---|---|---|
committer | nicm <nicm> | 2020-04-16 17:20:23 +0000 |
commit | 9311ed049b2dba24d562e34ae17af0f5e316784e (patch) | |
tree | 441ccb6ae7e412fdfc0c55c11507013cb0bb96f1 | |
parent | 2e347d6a384a5cfa9e18058393043e623a10c584 (diff) | |
download | rtmux-9311ed049b2dba24d562e34ae17af0f5e316784e.tar.gz rtmux-9311ed049b2dba24d562e34ae17af0f5e316784e.tar.bz2 rtmux-9311ed049b2dba24d562e34ae17af0f5e316784e.zip |
Start menu with top item selected if no mouse, GitHub issue 2169.
-rw-r--r-- | menu.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -298,6 +298,8 @@ menu_display(struct menu *menu, int flags, struct cmdq_item *item, u_int px, void *data) { struct menu_data *md; + u_int i; + const char *name; if (c->tty.sx < menu->width + 4 || c->tty.sy < menu->count + 2) return (-1); @@ -318,7 +320,18 @@ menu_display(struct menu *menu, int flags, struct cmdq_item *item, u_int px, md->py = py; md->menu = menu; - md->choice = -1; + if (md->flags & MENU_NOMOUSE) { + for (i = 0; i < menu->count; i++) { + name = menu->items[i].name; + if (name != NULL && *name != '-') + break; + } + if (i != menu->count) + md->choice = i; + else + md->choice = -1; + } else + md->choice = -1; md->cb = cb; md->data = data; |