mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-08 01:10:23 +00:00
[demo] add ctrl+L to menu
This commit is contained in:
parent
b8a548873e
commit
02d95dc5af
@ -111,6 +111,7 @@ The following keypresses are recognized (and are also available from the menu):
|
||||
with the mouse.
|
||||
* **P**: Toggle the FPS graph.
|
||||
* **Ctrl-R**: Restart the demo.
|
||||
* **Ctrl-L**: Redraw the screen.
|
||||
* **Alt-d**: Toggle a window with debugging information.
|
||||
* **q**: Quit.
|
||||
|
||||
|
@ -49,6 +49,7 @@ static struct ncplane* debug; // "debug info" modal popup
|
||||
|
||||
#define MENUSTR_TOGGLE_HUD "Toggle HUD"
|
||||
#define MENUSTR_TOGGLE_PLOT "Toggle FPS plot"
|
||||
#define MENUSTR_REDRAW_SCREEN "Redraw the screen"
|
||||
#define MENUSTR_RESTART "Restart"
|
||||
#define MENUSTR_ABOUT "About"
|
||||
#define MENUSTR_DEBUG "Debug info"
|
||||
@ -270,6 +271,13 @@ bool menu_or_hud_key(struct notcurses *nc, const struct ncinput *ni){
|
||||
debug_toggle(nc);
|
||||
return true;
|
||||
}
|
||||
if(tmpni.id == 'L' && !tmpni.alt && tmpni.ctrl){
|
||||
if(menu){
|
||||
ncmenu_rollup(menu);
|
||||
}
|
||||
notcurses_refresh(nc, NULL, NULL);
|
||||
return true;
|
||||
}
|
||||
if(tmpni.id == 'R' && !tmpni.alt && tmpni.ctrl){
|
||||
if(menu){
|
||||
ncmenu_rollup(menu);
|
||||
@ -297,6 +305,7 @@ struct ncmenu* menu_create(struct notcurses* nc){
|
||||
struct ncmenu_item demo_items[] = {
|
||||
{ .desc = MENUSTR_TOGGLE_HUD, .shortcut = { .id = 'H', }, },
|
||||
{ .desc = MENUSTR_TOGGLE_PLOT, .shortcut = { .id = 'P', }, },
|
||||
{ .desc = MENUSTR_REDRAW_SCREEN, .shortcut = { .id = 'L', .ctrl = true }, },
|
||||
{ .desc = NULL, },
|
||||
{ .desc = MENUSTR_RESTART, .shortcut = { .id = 'R', .ctrl = true, }, },
|
||||
{ .desc = MENUSTR_QUIT, .shortcut = { .id = 'q', }, },
|
||||
|
@ -87,11 +87,7 @@ uint32_t demo_getc(struct notcurses* nc, const struct timespec* ts, ncinput* ni)
|
||||
handoff = true;
|
||||
}
|
||||
}else{
|
||||
if(id == 'L' && q->ni.ctrl){
|
||||
notcurses_refresh(nc, NULL, NULL);
|
||||
}else{
|
||||
handoff = true;
|
||||
}
|
||||
handoff = true;
|
||||
}
|
||||
}
|
||||
if(handoff && ni){
|
||||
|
Loading…
Reference in New Issue
Block a user