window.h
1 2 #include "subterm.h" 3 4 typedef struct _window { 5 /* inclusive bounds: left/up/right/down. (always order as LURD when possible!) */ 6 int l, u, r, d; 7 8 /* padding by direction, cutting into the l/u/r/d bounds */ 9 int pl, pu, pr, pd; 10 11 /* terminal in this window. has IO + colors + modes + etc */ 12 /* NULL if there are children */ 13 struct Subterm *t; 14 15 /* NULL iff root window */ 16 struct _window *parent; 17 18 /* always either both defined, or both NULL. */ 19 struct _window *child1, *child2; 20 } Window; 21 22 /* Close the current window and fix the tree around it. */ 23 Window *close_window(Window *root, Window *focus); 24 25 /* Shrink the given window and create a new one. */ 26 Window *split_window(Window *parent, int direction); 27 28 /* find the leaf that contains (x, y) */ 29 Window *find_window(Window *root, int x, int y); 30 31 /* find the next window, from the focus in the given direction */ 32 Window *find_next_window(Window *root, Window *focus, int direction); 33 34 /* drawing helpers */ 35 void fill_window(Window *a, char c); 36 void fill_window_pad(Window *a); 37 void render(Window *w, Window *focus);