diff options
| author | Louis Burda <quent.burda@gmail.com> | 2021-12-28 22:56:43 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2021-12-28 22:56:43 +0100 |
| commit | fb0a1cabe8d61d3305d9d14acc4754a1b6151b8c (patch) | |
| tree | 8752b2189e25f1638f18b3450d02b512d6e715bc /src/pane.c | |
| parent | fee76b1e3d8da5152e44d67293165ae0c5651d25 (diff) | |
| download | tmus-fb0a1cabe8d61d3305d9d14acc4754a1b6151b8c.tar.gz tmus-fb0a1cabe8d61d3305d9d14acc4754a1b6151b8c.zip | |
Refactor for readability, use static line buffer for statusline etc
Diffstat (limited to 'src/pane.c')
| -rw-r--r-- | src/pane.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/pane.c b/src/pane.c new file mode 100644 index 0000000..c5aea81 --- /dev/null +++ b/src/pane.c @@ -0,0 +1,35 @@ +#include "pane.h" +#include "util.h" + +void +pane_init(struct pane *pane, pane_handler handle, pane_updater update) +{ + pane->win = newwin(1, 1, 0, 0); + ASSERT(pane->win != NULL); + pane->handle = handle; + pane->update = update; +} + +void +pane_resize(struct pane *pane, int sx, int sy, int ex, int ey) +{ + pane->sx = sx; + pane->sy = sy; + pane->ex = ex; + pane->ey = ey; + pane->w = pane->ex - pane->sx; + pane->h = pane->ey - pane->sy; + + pane->active = (pane->w > 0 && pane->h > 0); + if (pane->active) { + wresize(pane->win, pane->h, pane->w); + mvwin(pane->win, pane->sy, pane->sx); + redrawwin(pane->win); + } +} + +void +pane_free(struct pane *pane) +{ + delwin(pane->win); +} |
