summary refs log tree commit diff
path: root/screen.c
diff options
context:
space:
mode:
authorokan <okan>2013-01-02 16:26:34 +0000
committerokan <okan>2013-01-02 16:26:34 +0000
commitce8ef02ed22041e88d23c20341060b3b977906a5 (patch)
tree3e4d240ea1633c916a1e7cb137dce6e2d1633ac6 /screen.c
parente492ed8e4138b3552349c314d45f2514ad3e62d5 (diff)
downloadcwm-ce8ef02ed22041e88d23c20341060b3b977906a5.tar.gz
cwm-ce8ef02ed22041e88d23c20341060b3b977906a5.tar.xz
cwm-ce8ef02ed22041e88d23c20341060b3b977906a5.zip
have screen_find_xinerama() return struct geom *reliably* instead of
XineramaScreenInfo; simplifies goop around the callers.
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/screen.c b/screen.c
index 461d308..a8ed509 100644
--- a/screen.c
+++ b/screen.c
@@ -146,22 +146,30 @@ screen_init_xinerama(struct screen_ctx *sc)
 /*
  * Find which xinerama screen the coordinates (x,y) is on.
  */
-XineramaScreenInfo *
+struct geom
 screen_find_xinerama(struct screen_ctx *sc, int x, int y)
 {
 	XineramaScreenInfo	*info;
+	struct geom		 geom;
 	int			 i;
 
+	geom = sc->view;
+
 	if (sc->xinerama == NULL)
-		return (NULL);
+		return (geom);
 
 	for (i = 0; i < sc->xinerama_no; i++) {
 		info = &sc->xinerama[i];
 		if (x >= info->x_org && x < info->x_org + info->width &&
-		    y >= info->y_org && y < info->y_org + info->height)
-			return (info);
+		    y >= info->y_org && y < info->y_org + info->height) {
+			geom.x = info->x_org;
+			geom.y = info->y_org;
+			geom.w = info->width;
+			geom.h = info->height;
+			break;
+		}
 	}
-	return (NULL);
+	return (geom);
 }
 
 void