[menu] fix bottom disableds in menu PoC

pull/2610/head
nick black 2 years ago
parent d3b6e47d15
commit b198c99f31
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -30,23 +30,20 @@ run_menu(struct notcurses* nc, struct ncmenu* ncm){
notcurses_render(nc);
while((keypress = notcurses_get_blocking(nc, &ni)) != (uint32_t)-1){
if(!ncmenu_offer_input(ncm, &ni)){
if(ni.evtype == NCTYPE_RELEASE){
if(ni.id == NCKEY_BUTTON1){
const char* sel = ncmenu_mouse_selected(ncm, &ni, NULL);
if(sel && !strcmp(sel, "Quit")){
ncmenu_destroy(ncm);
ncplane_destroy(selplane);
return 0;
}
}else{
continue;
const char* sel;
if( (sel = ncmenu_mouse_selected(ncm, &ni, NULL)) ){
if(sel && !strcmp(sel, "Quit")){
ncmenu_destroy(ncm);
ncplane_destroy(selplane);
return 0;
}
}else if(ni.evtype == NCTYPE_RELEASE){
continue;
}else if(keypress == 'q'){
ncmenu_destroy(ncm);
ncplane_destroy(selplane);
return 0;
}else if(keypress == NCKEY_ENTER){ // selected a menu item
const char* sel;
if( (sel = ncmenu_selected(ncm, &ni)) ){
if(strcmp(sel, "Quit") == 0){
ncmenu_destroy(ncm);
@ -144,10 +141,10 @@ int main(void){
if(bottom == NULL){
goto err;
}
if(ncmenu_item_set_status(top, "Schwarzgerät", "Restart", false)){
if(ncmenu_item_set_status(bottom, "Schwarzgerät", "Restart", false)){
goto err;
}
if(ncmenu_item_set_status(top, "Schwarzgerät", "Derp", false)){
if(ncmenu_item_set_status(bottom, "Schwarzgerät", "Derp", false)){
goto err;
}
if(ncplane_putstr_aligned(n, 0, NCALIGN_RIGHT, " -=+ menu poc. press q to exit +=- ") < 0){

Loading…
Cancel
Save