diff options
Diffstat (limited to 'apps/gui/gwps.c')
-rw-r--r-- | apps/gui/gwps.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c index 0c8a3aa2b1..26b531e332 100644 --- a/apps/gui/gwps.c +++ b/apps/gui/gwps.c | |||
@@ -293,7 +293,38 @@ void gwps_draw_statusbars(void) | |||
293 | { | 293 | { |
294 | viewportmanager_set_statusbar(wpsbars); | 294 | viewportmanager_set_statusbar(wpsbars); |
295 | } | 295 | } |
296 | 296 | #ifdef HAVE_TOUCHSCREEN | |
297 | static int wps_get_touchaction(struct wps_data *data) | ||
298 | { | ||
299 | short x,y; | ||
300 | short vx, vy; | ||
301 | int type = action_get_touchscreen_press(&x, &y); | ||
302 | int i; | ||
303 | struct touchregion *r; | ||
304 | if (type != BUTTON_REL) | ||
305 | return ACTION_TOUCHSCREEN; | ||
306 | for (i=0; i<data->touchregion_count; i++) | ||
307 | { | ||
308 | r = &data->touchregion[i]; | ||
309 | /* make sure this region's viewport is visible */ | ||
310 | if (r->wvp->hidden_flags&VP_DRAW_HIDDEN) | ||
311 | continue; | ||
312 | /* reposition the touch inside the viewport */ | ||
313 | vx = x - r->wvp->vp.x; | ||
314 | vy = y - r->wvp->vp.y; | ||
315 | /* check if its inside this viewport */ | ||
316 | if (vx >= 0 && vx < r->wvp->vp.x + r->wvp->vp.width && | ||
317 | vy >= 0 && vy < r->wvp->vp.y + r->wvp->vp.height) | ||
318 | { | ||
319 | /* now see if the point is inside this region */ | ||
320 | if (vx >= r->x && vx < r->x+r->width && | ||
321 | vy >= r->y && vy < r->y+r->height) | ||
322 | return r->action; | ||
323 | } | ||
324 | } | ||
325 | return ACTION_TOUCHSCREEN; | ||
326 | } | ||
327 | #endif | ||
297 | /* The WPS can be left in two ways: | 328 | /* The WPS can be left in two ways: |
298 | * a) call a function, which draws over the wps. In this case, the wps | 329 | * a) call a function, which draws over the wps. In this case, the wps |
299 | * will be still active (i.e. the below function didn't return) | 330 | * will be still active (i.e. the below function didn't return) |
@@ -393,6 +424,10 @@ long gui_wps_show(void) | |||
393 | playlist or if using the sleep timer. */ | 424 | playlist or if using the sleep timer. */ |
394 | if (!(audio_status() & AUDIO_STATUS_PLAY)) | 425 | if (!(audio_status() & AUDIO_STATUS_PLAY)) |
395 | exit = true; | 426 | exit = true; |
427 | #ifdef HAVE_TOUCHSCREEN | ||
428 | if (button == ACTION_TOUCHSCREEN) | ||
429 | button = wps_get_touchaction(gui_wps[SCREEN_MAIN].data); | ||
430 | #endif | ||
396 | /* The iPods/X5/M5 use a single button for the A-B mode markers, | 431 | /* The iPods/X5/M5 use a single button for the A-B mode markers, |
397 | defined as ACTION_WPSAB_SINGLE in their config files. */ | 432 | defined as ACTION_WPSAB_SINGLE in their config files. */ |
398 | #ifdef ACTION_WPSAB_SINGLE | 433 | #ifdef ACTION_WPSAB_SINGLE |