diff --git a/cli/curse.c b/cli/curse.c index 58b2dc2..3274239 100644 --- a/cli/curse.c +++ b/cli/curse.c @@ -70,6 +70,16 @@ WINDOW *root_window(void) { return rootwin; } +/* Resize and move (if resized successfully) an ncurses WINDOW. + * Returns ERR (1) on fail, and OK (0) on success. + * NOTE: Failure occurs if width or height <= 0, + * NOTE: or if the x,y coordinate is outside the screen bounds. + */ +int resizemv_window(const int x, const int y, const int width, const int height, + WINDOW *const win) { + return wresize(win, height, width) || mvwin(win, y, x); +} + /* int main(const int argc, const char *const argv[]) { init_ncurses(); diff --git a/cli/curse.h b/cli/curse.h index 8d517eb..338ffe6 100644 --- a/cli/curse.h +++ b/cli/curse.h @@ -22,4 +22,7 @@ WINDOW *init_window(const int x, const int y, const int width, const int height); WINDOW *root_window(void); +int resizemv_window(const int x, const int y, const int width, const int height, + WINDOW *const win); + #endif /* DORNE_CURSE_H */