add area_match_coords() and area_match_area()

This commit is contained in:
Julien Danjou 2008-01-28 11:51:09 +01:00
parent 75d57960de
commit d48ad7e10a
1 changed files with 17 additions and 0 deletions

View File

@ -43,6 +43,23 @@ typedef struct
int height; int height;
} Area; } 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 typedef struct
{ {
Display *display; Display *display;