summaryrefslogtreecommitdiffstats
path: root/source/x11-helper.c
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-10-25 22:45:11 +0200
committerDave Davenport <qball@gmpclient.org>2016-10-25 22:45:11 +0200
commit163934fa8cb1cc0d0cd7b649723b68b9a0fe5211 (patch)
treed0f94e129e207e8f716a9f03fe4974c0db7ae436 /source/x11-helper.c
parent89cf6d2d63bd67aded86e1e91d37fb7130cd1d8a (diff)
Simplify some code, more comments. (90% docu)
Diffstat (limited to 'source/x11-helper.c')
-rw-r--r--source/x11-helper.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/source/x11-helper.c b/source/x11-helper.c
index b316973a..1aa65d41 100644
--- a/source/x11-helper.c
+++ b/source/x11-helper.c
@@ -46,13 +46,8 @@
#include "helper.h"
#include <rofi.h>
-#define OVERLAP( a, b, c, \
- d ) ( ( ( a ) == ( c ) && \
- ( b ) == ( d ) ) || \
- MIN ( ( a ) + ( b ), ( c ) + ( d ) ) - MAX ( ( a ), ( c ) ) > 0 )
-#define INTERSECT( x, y, w, h, x1, y1, w1, \
- h1 ) ( OVERLAP ( ( x ), ( w ), ( x1 ), \
- ( w1 ) ) && OVERLAP ( ( y ), ( h ), ( y1 ), ( h1 ) ) )
+/** Checks if the if x and y is inside rectangle. */
+#define INTERSECT( x,y, x1, y1, w1, h1 ) ( ( ((x) >= (x1)) && ((x) < (x1+w1)) ) && ( ((y) >= (y1)) && ((y) < (y1+h1)) ) )
#include "x11-helper.h"
#include "xkb-internal.h"
@@ -347,7 +342,7 @@ static void monitor_dimensions ( int x, int y, workarea *mon )
mon->h = xcb->screen->height_in_pixels;
for ( workarea *iter = xcb->monitors; iter; iter = iter->next ) {
- if ( INTERSECT ( x, y, 1, 1, iter->x, iter->y, iter->w, iter->h ) ) {
+ if ( INTERSECT ( x, y, iter->x, iter->y, iter->w, iter->h ) ) {
*mon = *iter;
break;
}