mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 01:29:05 -04:00
don't allow moving a plane above/below itself #71
This commit is contained in:
parent
599b7a6d9a
commit
c5acdaaef0
@ -345,11 +345,32 @@ API void ncplane_yx(const struct ncplane* n, int* RESTRICT y, int* RESTRICT x);
|
||||
API int ncplane_move_top(struct ncplane* n);
|
||||
API int ncplane_move_bottom(struct ncplane* n);
|
||||
|
||||
// Splice ncplane 'n' out of the z-buffer, and reinsert it below 'below'.
|
||||
API int ncplane_move_below(struct ncplane* RESTRICT n, struct ncplane* RESTRICT below);
|
||||
|
||||
// Splice ncplane 'n' out of the z-buffer, and reinsert it above 'above'.
|
||||
API int ncplane_move_above(struct ncplane* RESTRICT n, struct ncplane* RESTRICT above);
|
||||
API int ncplane_move_above_unsafe(struct ncplane* RESTRICT n,
|
||||
struct ncplane* RESTRICT above);
|
||||
|
||||
static inline int
|
||||
ncplane_move_above(struct ncplane* n, struct ncplane* above){
|
||||
if(n == above){
|
||||
return -1;
|
||||
}
|
||||
return ncplane_move_above_unsafe(n, above);
|
||||
}
|
||||
|
||||
// Splice ncplane 'n' out of the z-buffer, and reinsert it below 'below'.
|
||||
API int ncplane_move_below_unsafe(struct ncplane* RESTRICT n,
|
||||
struct ncplane* RESTRICT below);
|
||||
|
||||
static inline int
|
||||
ncplane_move_below(struct ncplane* n, struct ncplane* below){
|
||||
if(n == below){
|
||||
return -1;
|
||||
}
|
||||
return ncplane_move_below_unsafe(n, below);
|
||||
}
|
||||
|
||||
// Return the plane above this one, or NULL if this is at the top.
|
||||
API struct ncplane* ncplane_below(struct ncplane* n);
|
||||
|
||||
// Return the plane below this one, or NULL if this is at the bottom.
|
||||
API struct ncplane* ncplane_below(struct ncplane* n);
|
||||
|
@ -1174,7 +1174,7 @@ visible_cell(cell* c, int y, int x, ncplane* n, bool* damage){
|
||||
// Call with c->gcluster == 3, falpha == 3, balpha == 0, *retp == topplane.
|
||||
|
||||
// 'n' ends up above 'above'
|
||||
int ncplane_move_above(ncplane* restrict n, ncplane* restrict above){
|
||||
int ncplane_move_above_unsafe(ncplane* restrict n, ncplane* restrict above){
|
||||
ncplane** an = find_above_ncplane(n);
|
||||
if(an == NULL){
|
||||
return -1;
|
||||
@ -1190,7 +1190,7 @@ int ncplane_move_above(ncplane* restrict n, ncplane* restrict above){
|
||||
}
|
||||
|
||||
// 'n' ends up below 'below'
|
||||
int ncplane_move_below(ncplane* restrict n, ncplane* restrict below){
|
||||
int ncplane_move_below_unsafe(ncplane* restrict n, ncplane* restrict below){
|
||||
ncplane** an = find_above_ncplane(n);
|
||||
if(an == NULL){
|
||||
return -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user