ncmenu: check mouse clicks for presence #306

pull/396/head
nick black 5 years ago
parent a325a6d4b0
commit c6a3f93691
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -479,8 +479,18 @@ const char* ncmenu_selected(const ncmenu* n, ncinput* ni){
}
bool ncmenu_offer_input(ncmenu* n, const ncinput* nc){
fprintf(stderr, "KEY: %lc %u\n", nc->id, nc->id);
if(n->unrolledsection < 0){
if(nc->id == NCKEY_RELEASE && ncplane_mouseevent_p(n->ncp, nc)){
int y, x, dimy, dimx;
y = nc->y;
x = nc->x;
ncplane_dim_yx(n->ncp, &dimy, &dimx);
ncplane_translate(ncplane_stdplane(n->ncp), n->ncp, &y, &x);
if(y != (n->bottom ? dimy - 1 : 0)){
return false;
}
ncmenu_rollup(n);
// FIXME unroll appropriate menu selection
}else if(n->unrolledsection < 0){ // all following need an unrolled section
return false;
}
if(nc->id == NCKEY_LEFT){
@ -503,8 +513,6 @@ fprintf(stderr, "KEY: %lc %u\n", nc->id, nc->id);
return false;
}
return true;
}else if(nc->id == NCKEY_BUTTON1){
// FIXME did we clock on the menu? if so, unroll appropriately
}
return false;
}

@ -75,6 +75,7 @@ int main(void){
if(nc == NULL){
return EXIT_FAILURE;
}
notcurses_mouse_enable(nc);
struct ncmenu_item demo_items[] = {
{ .desc = "Restart", .shortcut = { .id = 'r', .ctrl = true, }, },
};

Loading…
Cancel
Save