notcurses_resize: call resizecb's across root plane #1172

pull/1190/head
nick black 4 years ago
parent edf55d8cc1
commit 764df80816
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -2197,9 +2197,15 @@ int (*ncplane_resizecb(const ncplane* n))(ncplane*){
}
int ncplane_resize_maximize(ncplane* n){
int rows, cols;
notcurses_term_dim_yx(ncplane_notcurses(n), &rows, &cols);
return ncplane_resize_simple(n, rows, cols);
const ncpile* pile = ncplane_pile(n);
const int rows = pile->dimy;
const int cols = pile->dimx;
int oldy, oldx;
ncplane_dim_yx(n, &oldy, &oldx); // current dimensions of 'n'
//fprintf(stderr, "CURRENT: %d/%d TERM: %d/%d\n", oldy, oldx, rows, cols);
int keepleny = oldy > rows ? rows : oldy;
int keeplenx = oldx > cols ? cols : oldx;
return ncplane_resize_internal(n, 0, 0, keepleny, keeplenx, 0, 0, rows, cols);
}
int ncplane_resize_realign(ncplane* n){

@ -64,14 +64,11 @@ notcurses_resize_internal(ncplane* pp, int* restrict rows, int* restrict cols){
keepx = oldcols;
}
int ret = 0;
notcurses_debug(n, stderr);
// FIXME kill this
/*if(ncplane_resize_simple(n->stdplane, *rows, *cols)){
return -1;
}*/
// FIXME restore this
//notcurses_debug(n, stderr);
for(ncplane* rootn = pile->roots ; rootn ; rootn = rootn->bnext){
ret |= resize_callbacks_children(rootn);
if(rootn->resizecb){
ret |= rootn->resizecb(rootn);
}
}
return ret;
}

Loading…
Cancel
Save