summary refs log tree commit diff
path: root/screen.c
diff options
context:
space:
mode:
authorokan <okan>2009-01-15 00:32:35 +0000
committerokan <okan>2009-01-15 00:32:35 +0000
commit49e218cf53abe04f6ab07ef29687c9e0ece46a89 (patch)
treeaab8f23d9d3b44f03719f26a501e4606c9f3aa71 /screen.c
parent7e110f379be217bbf6a5476acb8043c1ff73a8e6 (diff)
downloadcwm-49e218cf53abe04f6ab07ef29687c9e0ece46a89.tar.gz
cwm-49e218cf53abe04f6ab07ef29687c9e0ece46a89.tar.xz
cwm-49e218cf53abe04f6ab07ef29687c9e0ece46a89.zip
- add missing prototypes.
- properly name, place and static private functions.
- move function which finds the xinerama screen for a coordinate to
a more appropriate place while altering its semantics to match others.
- tiny bit of style.

ok oga@
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/screen.c b/screen.c
index 3fe2847..e061149 100644
--- a/screen.c
+++ b/screen.c
@@ -92,3 +92,21 @@ screen_init_xinerama(struct screen_ctx *sc)
 	sc->xinerama = info;
 	sc->xinerama_no = no;
 }
+
+/*
+ * Find which xinerama screen the coordinates (x,y) is on.
+ */
+XineramaScreenInfo *
+screen_find_xinerama(struct screen_ctx *sc, int x, int y)
+{
+	XineramaScreenInfo	*info;
+	int			 i;
+
+	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);
+	}
+	return (NULL);
+}