(UNDER CONSTRUCTION) fixed bad free + testing AXIS_X bifurcation
This commit is contained in:
parent
b16590fd5a
commit
5e99b09f8a
7 changed files with 92 additions and 46 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "ncrswrap.h"
|
||||
#include "node.h"
|
||||
#include "tree.h"
|
||||
#include "_ncurses.h"
|
||||
|
||||
|
|
@ -12,6 +13,19 @@ int ct_init(struct ct_tree **const tree) {
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* Recursively search the tree for update requests.
|
||||
*/
|
||||
static void __update_rec(struct ct_node *const node) {
|
||||
if (node->flags & NFLAG_RESIZE) {
|
||||
/* TODO: the child has requested a resizing, but resize_node()
|
||||
* TODO: wastes CPU time resizing itself!
|
||||
*/
|
||||
resize_node(node, dup_dims(node->surface->dims));
|
||||
}
|
||||
for (int i=0; i < node->cindex; i++) {
|
||||
__update_rec(node->child[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void ct_update(struct ct_tree *const tree) {
|
||||
const int key = wgetch(curscr);
|
||||
|
|
@ -32,9 +46,11 @@ void ct_update(struct ct_tree *const tree) {
|
|||
doupdate();
|
||||
break;
|
||||
default:
|
||||
wclear(tree->root->surface->win);
|
||||
// wclear(tree->root->surface->win);
|
||||
mvwprintw(tree->root->surface->win, 0, 0, " \r%d\n", key);
|
||||
wrefresh(tree->root->surface->win);
|
||||
break;
|
||||
}
|
||||
|
||||
__update_rec(tree->root);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue