summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2011-11-16 11:05:46 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2011-11-16 11:05:46 +0000
commitf65ceebee8124080d42295f5fc9aee0af5eb0799 (patch)
treefad81d253c3c79a89beb0df3deaa7ebfc30e2bf8 /apps
parentea2a3ee7a8c3d0660f674de69d764d155b4d3a80 (diff)
Change the "keyclick repeat" setting behaviour so when it is off only the *first* repeat will click.
Otherwise single presses and all wheel movements will cause a click. with "keyclick repeat" enabled *all* repeats will cause clicks git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30997 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/misc.c51
1 files changed, 37 insertions, 14 deletions
diff --git a/apps/misc.c b/apps/misc.c
index 04a6d05c91..407a26c90f 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -872,10 +872,12 @@ void system_sound_play(enum system_sound sound)
params->amplitude * *params->setting);
}
}
-
+
/* Produce keyclick based upon button and global settings */
void keyclick_click(int button)
{
+ static long last_button = BUTTON_NONE;
+ bool do_beep = false;
/* Settings filters */
if (
#ifdef HAVE_HARDWARE_CLICK
@@ -883,27 +885,48 @@ void keyclick_click(int button)
#else
global_settings.keyclick
#endif
- && (global_settings.keyclick_repeats || !(button & BUTTON_REPEAT)))
+ )
{
- /* Button filters */
- if (button != BUTTON_NONE && !(button & BUTTON_REL)
- && !(button & (SYS_EVENT|BUTTON_MULTIMEDIA)) )
+ if (global_settings.keyclick_repeats || !(button & BUTTON_REPEAT))
{
-#ifdef HAVE_HARDWARE_CLICK
- if (global_settings.keyclick)
+ /* Button filters */
+ if (button != BUTTON_NONE && !(button & BUTTON_REL)
+ && !(button & (SYS_EVENT|BUTTON_MULTIMEDIA)) )
{
- system_sound_play(SOUND_KEYCLICK);
+ do_beep = true;
}
- if (global_settings.keyclick_hardware)
- {
-#if !defined(SIMULATOR)
- piezo_button_beep(false, false);
+ }
+ else if ((button & BUTTON_REPEAT) && (last_button == BUTTON_NONE))
+ {
+ do_beep = true;
+ }
+#ifdef HAVE_SCROLLWHEEL
+ else if (button & (BUTTON_SCROLL_BACK | BUTTON_SCROLL_FWD))
+ {
+ do_beep = true;
+ }
#endif
- }
-#else
+ }
+ if (button&BUTTON_REPEAT)
+ last_button = button;
+ else
+ last_button = BUTTON_NONE;
+ if (do_beep)
+ {
+#ifdef HAVE_HARDWARE_CLICK
+ if (global_settings.keyclick)
+ {
system_sound_play(SOUND_KEYCLICK);
+ }
+ if (global_settings.keyclick_hardware)
+ {
+#if !defined(SIMULATOR)
+ piezo_button_beep(false, false);
#endif
}
+#else
+ system_sound_play(SOUND_KEYCLICK);
+#endif
}
}
#endif /* CONFIG_CODEC == SWCODEC */