From a398aa49ddad0f53e305d87336f3015667fd0636 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 7 Aug 2002 08:43:55 +0000 Subject: healing the X11 simulator (button_get_w_tmo wise), please bear with me as I haven't tested this fix but it compiles nicely ;-) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1579 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/x11/button-x11.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'uisimulator/x11/button-x11.c') diff --git a/uisimulator/x11/button-x11.c b/uisimulator/x11/button-x11.c index 1d27eff134..734272c6c4 100644 --- a/uisimulator/x11/button-x11.c +++ b/uisimulator/x11/button-x11.c @@ -134,6 +134,25 @@ static int get_raw_button (void) } } +/* + * Timeout after TICKS unless a key is pressed. + */ +int button_get_w_tmo(int ticks) +{ + int bits; + int i=0; + + for(i=0; i< ticks; i++) { + bits = get_raw_button(); + if(!bits) + x11_sleep(1); + else + break; + }; + + return bits; +} + /* * Get the currently pressed button. * Returns one of BUTTON_xxx codes, with possibly a modifier bit set. -- cgit v1.2.3