From 669f620a6aa6d340d617941deaedf583767c5ff0 Mon Sep 17 00:00:00 2001 From: Emile Clark-Boman Date: Thu, 11 Sep 2025 17:40:25 +1000 Subject: [PATCH] add resizemv_window() method to curse.* interface --- cli/curse.c | 10 ++++++++++ cli/curse.h | 3 +++ 2 files changed, 13 insertions(+) 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 */