diff options
author | Thomas Martitz <kugel@rockbox.org> | 2011-01-29 15:34:36 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2011-01-29 15:34:36 +0000 |
commit | 5e3d8f961c2cd64283049667c6481fa3649fbc6c (patch) | |
tree | c4b291837456b256e0d57442252fda91eee1f298 /apps | |
parent | c402519e31341397d8097240317a1c180ec55bef (diff) |
Improve sometimes glitchy touchscreen handling in the pitchscreen.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29166 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/pitchscreen.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c index 5f987cb5d4..c35140db90 100644 --- a/apps/gui/pitchscreen.c +++ b/apps/gui/pitchscreen.c @@ -636,6 +636,7 @@ static int pitchscreen_do_touchscreen(struct viewport vps[]) short x, y; struct viewport *this_vp = &vps[PITCH_TOP]; int ret; + static bool wait_for_release = false; ret = action_get_touchscreen_press_in_vp(&x, &y, this_vp); /* top row */ @@ -651,7 +652,7 @@ static int pitchscreen_do_touchscreen(struct viewport vps[]) { /* center column pressed */ if (ret == BUTTON_REPEAT) return ACTION_PS_INC_BIG; - else if (ret == BUTTON_TOUCHSCREEN) + else if (ret & BUTTON_REL) return ACTION_PS_INC_SMALL; } return ACTION_NONE; @@ -668,21 +669,37 @@ static int pitchscreen_do_touchscreen(struct viewport vps[]) if (x < column) { /* left column */ if (ret & BUTTON_REL) + { + wait_for_release = false; return ACTION_PS_NUDGE_LEFTOFF; + } else if (ret & BUTTON_REPEAT) return ACTION_PS_SLOWER; - return ACTION_PS_NUDGE_LEFT; + if (!wait_for_release) + { + wait_for_release = true; + return ACTION_PS_NUDGE_LEFT; + } } else if (x > (2*column)) { /* right column */ + debugf("%s(): %8x", __func__, ret); if (ret & BUTTON_REL) + { + wait_for_release = false; return ACTION_PS_NUDGE_LEFTOFF; + } else if (ret & BUTTON_REPEAT) return ACTION_PS_FASTER; - return ACTION_PS_NUDGE_LEFT; + if (!wait_for_release) + { + wait_for_release = true; + return ACTION_PS_NUDGE_LEFT; + } } - /* center column was pressed */ - return ACTION_PS_RESET; + else + /* center column was pressed */ + return ACTION_PS_RESET; } /* now the bottom row */ @@ -698,9 +715,9 @@ static int pitchscreen_do_touchscreen(struct viewport vps[]) return ACTION_PS_EXIT; else if (x >= column && x <= (2*column)) { /* center column was pressed */ - if (ret == BUTTON_REPEAT) + if (ret & BUTTON_REPEAT) return ACTION_PS_DEC_BIG; - else if (ret == BUTTON_TOUCHSCREEN) + else if (ret & BUTTON_REL) return ACTION_PS_DEC_SMALL; } return ACTION_NONE; |