summaryrefslogtreecommitdiff
path: root/apps/gui/wps.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-09-05 23:57:09 +0000
committerThomas Martitz <kugel@rockbox.org>2009-09-05 23:57:09 +0000
commitc17037a80266e9e97643e8c34459f3ac81510be0 (patch)
treea28fa4f0bb9339cdd6d900276e4694f8be5a02ee /apps/gui/wps.c
parenta17d06ccc3b589cfc5eb92edbea3c09494b1ed48 (diff)
downloadrockbox-c17037a80266e9e97643e8c34459f3ac81510be0.zip
rockbox-c17037a80266e9e97643e8c34459f3ac81510be0.tar.gz
rockbox-c17037a80266e9e97643e8c34459f3ac81510be0.tar.bz2
rockbox-c17037a80266e9e97643e8c34459f3ac81510be0.tar.xz
Factor out/generalise the function that checks whether a point is within a viewport to, and use it in the wps' touchregion code. This corrects the check that was done there.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22638 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/wps.c')
-rw-r--r--apps/gui/wps.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index 99bc731..f336f77 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -601,13 +601,12 @@ int wps_get_touchaction(struct wps_data *data)
regions = regions->next;
continue;
}
- /* reposition the touch inside the viewport */
- vx = x - r->wvp->vp.x;
- vy = y - r->wvp->vp.y;
/* check if it's inside this viewport */
- if (vx >= 0 && vx < r->wvp->vp.x + r->wvp->vp.width &&
- vy >= 0 && vy < r->wvp->vp.y + r->wvp->vp.height)
- {
+ if (viewport_point_within_vp(&(r->wvp->vp), x, y))
+ { /* reposition the touch inside the viewport since touchregions
+ * are relative to a preceding viewport */
+ vx = x - r->wvp->vp.x;
+ vy = y - r->wvp->vp.y;
/* now see if the point is inside this region */
if (vx >= r->x && vx < r->x+r->width &&
vy >= r->y && vy < r->y+r->height)