summaryrefslogtreecommitdiff
path: root/uisimulator/sdl/button.c
diff options
context:
space:
mode:
authorHristo Kovachev <bger@rockbox.org>2006-03-25 19:16:45 +0000
committerHristo Kovachev <bger@rockbox.org>2006-03-25 19:16:45 +0000
commita70c6b9b1e2bcf7a5a207017d6c40f5254f6ef98 (patch)
treee39563c6b848d65c0700875676c01da43d3f645b /uisimulator/sdl/button.c
parent7b9ab84e7d37a761a7b4a5817c6da71213cc17ad (diff)
Patch #4913 by David Rothenberger with some changes by me: add only backlight on first keypress to the lcd remotes, too.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9253 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/sdl/button.c')
-rw-r--r--uisimulator/sdl/button.c60
1 files changed, 57 insertions, 3 deletions
diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c
index bf0396e18d..b371643c6f 100644
--- a/uisimulator/sdl/button.c
+++ b/uisimulator/sdl/button.c
@@ -44,6 +44,14 @@ void set_backlight_filter_keypress(bool value)
{
filter_first_keypress = value;
}
+#ifdef HAVE_REMOTE_LCD
+static bool remote_filter_first_keypress;
+
+void set_remote_backlight_filter_keypress(bool value)
+{
+ remote_filter_first_keypress = value;
+}
+#endif
#endif
void button_event(int key, bool pressed)
@@ -56,6 +64,12 @@ void button_event(int key, bool pressed)
static int repeat_count = 0;
static bool repeat = false;
static bool post = false;
+#ifdef CONFIG_BACKLIGHT
+ static bool skip_release = false;
+#ifdef HAVE_REMOTE_LCD
+ static bool skip_remote_release = false;
+#endif
+#endif
switch (key)
{
@@ -169,11 +183,26 @@ void button_event(int key, bool pressed)
/* Find out if a key has been released */
diff = btn ^ lastbtn;
-
if(diff && (btn & diff) == 0)
{
+#ifdef CONFIG_BACKLIGHT
+#ifdef HAVE_REMOTE_LCD
+ if(diff & BUTTON_REMOTE)
+ if(!skip_remote_release)
+ queue_post(&button_queue, BUTTON_REL | diff, NULL);
+ else
+ skip_remote_release = false;
+ else
+#endif
+ if(!skip_release)
+ queue_post(&button_queue, BUTTON_REL | diff, NULL);
+ else
+ skip_release = false;
+#else
queue_post(&button_queue, BUTTON_REL | diff, NULL);
+#endif
}
+
else
{
if ( btn )
@@ -223,15 +252,40 @@ void button_event(int key, bool pressed)
if (queue_empty(&button_queue))
{
queue_post(&button_queue, BUTTON_REPEAT | btn, NULL);
+#ifdef CONFIG_BACKLIGHT
+#ifdef HAVE_REMOTE_LCD
+ if(btn & BUTTON_REMOTE)
+ {
+ if(skip_remote_release)
+ skip_remote_release = false;
+ }
+ else
+#endif
+ if(skip_release)
+ skip_release = false;
+#endif
post = false;
}
}
else
{
#ifdef CONFIG_BACKLIGHT
- if ( !filter_first_keypress || is_backlight_on())
-#endif
+#ifdef HAVE_REMOTE_LCD
+ if (btn & BUTTON_REMOTE) {
+ if (!remote_filter_first_keypress || is_remote_backlight_on())
+ queue_post(&button_queue, btn, NULL);
+ else
+ skip_remote_release = true;
+ }
+ else
+#endif
+ if (!filter_first_keypress || is_backlight_on())
+ queue_post(&button_queue, btn, NULL);
+ else
+ skip_release = true;
+#else /* no backlight, nothing to skip */
queue_post(&button_queue, btn, NULL);
+#endif
post = false;
}