aboutsummaryrefslogtreecommitdiffstats
path: root/screen.c
diff options
context:
space:
mode:
authorokan2013-01-02 16:26:34 +0000
committerokan2013-01-02 16:26:34 +0000
commit0907a6cfbcbe286154c23e20ab13a1599851c144 (patch)
treef141b7dee22ee3b2d9c63fe9ffb2f9c753f0cd5c /screen.c
parentbc9a040b94798d093048c2152dd03804c41e6268 (diff)
downloadcwm-0907a6cfbcbe286154c23e20ab13a1599851c144.tar.gz
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.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/screen.c b/screen.c
index acfe5eb..8b12c46 100644
--- a/screen.c
+++ b/screen.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: screen.c,v 1.40 2012/12/18 18:39:55 okan Exp $
+ * $OpenBSD: screen.c,v 1.41 2013/01/02 16:26:34 okan Exp $
*/
#include <sys/param.h>
@@ -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