aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-10-25 17:19:16 +0000
committerJoursoir <chat@joursoir.net>2021-10-25 17:25:27 +0000
commitd807043b4b2fd18a7ea6af362787d2e6130472a4 (patch)
treef90d5835da9b203c92c3ee0776928be5e646a27d
parent51635072ddd0fe714a7d9983288abbb32315824f (diff)
downloadufm-d807043b4b2fd18a7ea6af362787d2e6130472a4.tar.gz
ufm-d807043b4b2fd18a7ea6af362787d2e6130472a4.tar.bz2
ufm-d807043b4b2fd18a7ea6af362787d2e6130472a4.zip
tbi/win: add macro to validate (x, y) in a window
-rw-r--r--lib/tbi/win.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/tbi/win.c b/lib/tbi/win.c
index e3ba31e..bf674a2 100644
--- a/lib/tbi/win.c
+++ b/lib/tbi/win.c
@@ -7,6 +7,10 @@
#include "screen.h"
#include "win.h"
+#define CHECK_POSITION(win, x, y) \
+ if(x < 0 || y < 0 || x >= w->width || y >= w->height) \
+ return FALSE
+
struct window *newwin(struct screen *s,
INT32 ncols, INT32 nlines, INT32 begin_x, INT32 begin_y)
{