Fix an off-by-one error in 'area_get'.

Fixes #160.
This commit is contained in:
LemonBoy 2015-12-15 19:05:39 +01:00
parent f26b88272e
commit 7c8eb7495b

View File

@ -326,10 +326,9 @@ area_t *
area_get (xcb_window_t win, const int btn, const int x) area_get (xcb_window_t win, const int btn, const int x)
{ {
// Looping backwards ensures that we get the innermost area first // Looping backwards ensures that we get the innermost area first
for (int i = area_stack.at; i >= 0; i--) { for (int i = area_stack.at - 1; i >= 0; i--) {
area_t *a = &area_stack.area[i]; area_t *a = &area_stack.area[i];
if (a->window == win && a->button == btn if (a->window == win && a->button == btn && x >= a->begin && x < a->end)
&& x >= a->begin && x < a->end)
return a; return a;
} }
return NULL; return NULL;