add term_dims() func
This commit is contained in:
parent
f73dbd7d8a
commit
79f5c5235a
1 changed files with 16 additions and 2 deletions
18
cli/tree.c
18
cli/tree.c
|
|
@ -87,6 +87,13 @@ static struct crs_nodedims *get_dims(const struct crs_node *node) {
|
||||||
return dims;
|
return dims;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct crs_nodedims term_dims(void) {
|
||||||
|
struct crs_nodedims dims;
|
||||||
|
getbegyx(stdscr, dims.y, dims.x);
|
||||||
|
getmaxyx(stdscr, dims.height, dims.width);
|
||||||
|
return dims;
|
||||||
|
}
|
||||||
|
|
||||||
/* Calculate the dimensions for nodes resulting from a bifurcation.
|
/* Calculate the dimensions for nodes resulting from a bifurcation.
|
||||||
* Returns 0 on success, and 1 on failure if any width/height are 0 characters.
|
* Returns 0 on success, and 1 on failure if any width/height are 0 characters.
|
||||||
* WARNING: This function does not guarantee the x,y positions returned
|
* WARNING: This function does not guarantee the x,y positions returned
|
||||||
|
|
@ -162,7 +169,6 @@ void bifurcate_window_node(struct crs_node **node,
|
||||||
struct crs_nodedims *dims0, *dims1;
|
struct crs_nodedims *dims0, *dims1;
|
||||||
struct crs_node *node0, *node1;
|
struct crs_node *node0, *node1;
|
||||||
|
|
||||||
|
|
||||||
if (bifurcate_dims(*node, axis, ratio, &dims0, &dims1)) {
|
if (bifurcate_dims(*node, axis, ratio, &dims0, &dims1)) {
|
||||||
printf("FAILED TERRIBLY THE FUCK\n");
|
printf("FAILED TERRIBLY THE FUCK\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
@ -202,7 +208,15 @@ static void collapse_abstract_node(struct crs_node **node,
|
||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
static struct crs_node *init_root_node(void) {
|
static struct crs_node *init_root_node(void) {
|
||||||
return init_window_node(root_window());
|
struct crs_nodedims rootdims;
|
||||||
|
WINDOW *rootwin;
|
||||||
|
|
||||||
|
// rootdims = term_dims();
|
||||||
|
// rootwin = new_window(rootdims.x, rootdims.y,
|
||||||
|
// rootdims.height, rootdims.height);
|
||||||
|
// rootwin = new_window(0, 0, 0, 0);
|
||||||
|
rootwin = root_window();
|
||||||
|
return init_window_node(rootwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
int init_tree(struct crs_tree **const tree) {
|
int init_tree(struct crs_tree **const tree) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue