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/win32 | |
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/win32')
-rw-r--r-- | uisimulator/win32/button.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/uisimulator/win32/button.c b/uisimulator/win32/button.c index 7996af583d..8f21fe4396 100644 --- a/uisimulator/win32/button.c +++ b/uisimulator/win32/button.c | |||
@@ -40,7 +40,6 @@ static int btn = 0; /* Hopefully keeps track of currently pressed keys... */ | |||
40 | 40 | ||
41 | void button_event(int key, bool pressed) | 41 | void button_event(int key, bool pressed) |
42 | { | 42 | { |
43 | bool post = false; | ||
44 | int new_btn = 0; | 43 | int new_btn = 0; |
45 | int diff = 0; | 44 | int diff = 0; |
46 | static int count = 0; | 45 | static int count = 0; |
@@ -48,6 +47,7 @@ void button_event(int key, bool pressed) | |||
48 | static int repeat_speed = REPEAT_INTERVAL_START; | 47 | static int repeat_speed = REPEAT_INTERVAL_START; |
49 | static int repeat_count = 0; | 48 | static int repeat_count = 0; |
50 | static bool repeat = false; | 49 | static bool repeat = false; |
50 | static bool post = false; | ||
51 | 51 | ||
52 | switch (key) | 52 | switch (key) |
53 | { | 53 | { |
@@ -176,7 +176,8 @@ void button_event(int key, bool pressed) | |||
176 | { | 176 | { |
177 | if ( repeat ) | 177 | if ( repeat ) |
178 | { | 178 | { |
179 | count--; | 179 | if (!post) |
180 | count--; | ||
180 | if (count == 0) | 181 | if (count == 0) |
181 | { | 182 | { |
182 | post = true; | 183 | post = true; |
@@ -204,9 +205,18 @@ void button_event(int key, bool pressed) | |||
204 | if ( post ) | 205 | if ( post ) |
205 | { | 206 | { |
206 | if(repeat) | 207 | if(repeat) |
207 | queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); | 208 | { |
209 | if (queue_empty(&button_queue)) | ||
210 | { | ||
211 | queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); | ||
212 | post = false; | ||
213 | } | ||
214 | } | ||
208 | else | 215 | else |
216 | { | ||
209 | queue_post(&button_queue, btn, NULL); | 217 | queue_post(&button_queue, btn, NULL); |
218 | post = false; | ||
219 | } | ||
210 | 220 | ||
211 | #ifdef HAVE_REMOTE_LCD | 221 | #ifdef HAVE_REMOTE_LCD |
212 | if(btn & BUTTON_REMOTE) | 222 | if(btn & BUTTON_REMOTE) |