From d48ad7e10a432dc89a189474634c15e2a5f27bcb Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 28 Jan 2008 11:51:09 +0100 Subject: [PATCH] add area_match_coords() and area_match_area() --- common/draw.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/common/draw.h b/common/draw.h index a99d6c80..6556453b 100644 --- a/common/draw.h +++ b/common/draw.h @@ -43,6 +43,23 @@ typedef struct int height; } Area; +/** Check if coordinates matches given area */ +static inline Bool +area_match_coords(Area geometry, int x, int y) +{ + return (x >= geometry.x + && y >= geometry.y + && x < geometry.x + geometry.width + && y < geometry.y + geometry.height); +} + +static inline Bool +area_match_area(Area a, Area b) +{ + return (area_match_coords(a, b.x, b.y) + && area_match_coords(a, b.x + b.width, b.y + b.height)); +} + typedef struct { Display *display; -- 2.11.4.GIT