diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-02-19 13:34:12 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-02-19 13:34:12 +0000 |
commit | 237d3c4c4b9d4ae1ee48ab812b83009761811604 (patch) | |
tree | 0222738324467191968fe1d3ee81d7130c390a6c /uisimulator/sdl/button.c | |
parent | 1b45b130dcee36b1f9f7965fd0b062789bb99bc0 (diff) | |
download | rockbox-237d3c4c4b9d4ae1ee48ab812b83009761811604.tar.gz rockbox-237d3c4c4b9d4ae1ee48ab812b83009761811604.zip |
Adaptive button repeat: adapts repeat rate depending on the ability of the application to cope. Avoids afterscroll and similar effects. * Yield while scrolling through lists.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8738 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/sdl/button.c')
-rw-r--r-- | uisimulator/sdl/button.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c index 671cf12d5c..72224315a2 100644 --- a/uisimulator/sdl/button.c +++ b/uisimulator/sdl/button.c | |||
@@ -39,7 +39,6 @@ static int btn = 0; /* Hopefully keeps track of currently pressed keys... */ | |||
39 | 39 | ||
40 | void button_event(int key, bool pressed) | 40 | void button_event(int key, bool pressed) |
41 | { | 41 | { |
42 | bool post = false; | ||
43 | int new_btn = 0; | 42 | int new_btn = 0; |
44 | int diff = 0; | 43 | int diff = 0; |
45 | static int count = 0; | 44 | static int count = 0; |
@@ -47,6 +46,7 @@ void button_event(int key, bool pressed) | |||
47 | static int repeat_speed = REPEAT_INTERVAL_START; | 46 | static int repeat_speed = REPEAT_INTERVAL_START; |
48 | static int repeat_count = 0; | 47 | static int repeat_count = 0; |
49 | static bool repeat = false; | 48 | static bool repeat = false; |
49 | static bool post = false; | ||
50 | 50 | ||
51 | switch (key) | 51 | switch (key) |
52 | { | 52 | { |
@@ -175,7 +175,8 @@ void button_event(int key, bool pressed) | |||
175 | { | 175 | { |
176 | if ( repeat ) | 176 | if ( repeat ) |
177 | { | 177 | { |
178 | count--; | 178 | if (!post) |
179 | count--; | ||
179 | if (count == 0) | 180 | if (count == 0) |
180 | { | 181 | { |
181 | post = true; | 182 | post = true; |
@@ -203,9 +204,18 @@ void button_event(int key, bool pressed) | |||
203 | if ( post ) | 204 | if ( post ) |
204 | { | 205 | { |
205 | if(repeat) | 206 | if(repeat) |
206 | queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); | 207 | { |
208 | if (queue_empty(&button_queue)) | ||
209 | { | ||
210 | queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); | ||
211 | post = false; | ||
212 | } | ||
213 | } | ||
207 | else | 214 | else |
215 | { | ||
208 | queue_post(&button_queue, btn, NULL); | 216 | queue_post(&button_queue, btn, NULL); |
217 | post = false; | ||
218 | } | ||
209 | 219 | ||
210 | #ifdef HAVE_REMOTE_LCD | 220 | #ifdef HAVE_REMOTE_LCD |
211 | if(btn & BUTTON_REMOTE) | 221 | if(btn & BUTTON_REMOTE) |