X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Futil.c;h=c8f4ee389492962b8817b8be39737dcbed20362a;hb=a0e33c1d683ffe3b67a3967980f61f828b41fef2;hp=cf8f8df69bda9aaf244cf1f70955903492e6b0ba;hpb=eec762ea8f184735f5cfb366bb5a77ac410c3499;p=i3%2Fi3 diff --git a/src/util.c b/src/util.c index cf8f8df6..c8f4ee38 100644 --- a/src/util.c +++ b/src/util.c @@ -31,6 +31,13 @@ int max(int a, int b) { return (a > b ? a : b); } +bool rect_contains(Rect rect, uint32_t x, uint32_t y) { + return (x >= rect.x && + x <= (rect.x + rect.width) && + y >= rect.y && + y <= (rect.y + rect.height)); +} + /* * Updates *destination with new_value and returns true if it was changed or false * if it was the same