diff --git a/apps/main.c b/apps/main.c index ef8ca7bea7..8bcc25ae40 100644 --- a/apps/main.c +++ b/apps/main.c @@ -149,8 +149,7 @@ void init(void) global_settings.mdb_enable, global_settings.superbass); mpeg_init(); - while (button_get(false) != 0) - ; /* Empty the keyboard buffer */ + button_clear_queue(); /* Empty the keyboard buffer */ } #else diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c index 04231f471e..193ac8a7ce 100644 --- a/apps/plugins/calculator.c +++ b/apps/plugins/calculator.c @@ -397,7 +397,7 @@ void cal_initial (void) printResult(); /* clear button queue */ - while (rb->button_get(false)); + rb->button_clear_queue(); } /* ----------------------------------------------------------------------- @@ -1357,7 +1357,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) } /* while (calStatus != cal_exit ) */ /* rb->splash(HZ*2, true, "Hello world!"); */ - while (rb->button_get(false)); + rb->button_clear_queue(); return PLUGIN_OK; } diff --git a/apps/plugins/euroconverter.c b/apps/plugins/euroconverter.c index 0a01f3a1d6..3fb1e0e819 100644 --- a/apps/plugins/euroconverter.c +++ b/apps/plugins/euroconverter.c @@ -437,7 +437,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) load_config(); /*Empty the event queue*/ - while (rb->button_get(false)!=BUTTON_NONE) ; + rb->button_clear_queue(); display(e,h,false); show_abbrev(); diff --git a/apps/plugins/jackpot.c b/apps/plugins/jackpot.c index e392c3b35a..d35e35a8c0 100644 --- a/apps/plugins/jackpot.c +++ b/apps/plugins/jackpot.c @@ -125,7 +125,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) rb->lcd_puts_scroll(0,1,"PLAY to begin"); /*Empty the event queue*/ - while (rb->button_get(false)!=BUTTON_NONE); + rb->button_clear_queue(); /* Define the start pattern */ s[0]=(rb->rand()%9)*7; diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c index c601712b11..d760812b86 100644 --- a/apps/plugins/jpeg.c +++ b/apps/plugins/jpeg.c @@ -1520,7 +1520,7 @@ int scroll_bmp(struct t_disp* pdisp) int lastbutton = 0; /*empty the button queue first, to avoid unwanted scrolling */ - while(rb->button_get(false) != BUTTON_NONE); + rb->button_clear_queue(); while (true) { diff --git a/apps/plugins/nim.c b/apps/plugins/nim.c index 48e0937908..27f1210ea4 100644 --- a/apps/plugins/nim.c +++ b/apps/plugins/nim.c @@ -174,7 +174,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) min=0; /*Empty the event queue*/ - while (rb->button_get(false)!=BUTTON_NONE); + rb->button_clear_queue(); /* Game loop */ while(end!=true) diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index 4628f8e7b3..281868bf65 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c @@ -356,7 +356,7 @@ static void fill_buffer(long pos, unsigned char* buf, unsigned size) rb->lseek(fd, pos, SEEK_SET); numread = rb->read(fd, buf, size); - while (rb->button_get(false)); /* clear button queue */ + rb->button_clear_queue(); /* clear button queue */ for(i = 0; i < numread; i++) { switch(buf[i]) { diff --git a/apps/screens.c b/apps/screens.c index e4f44dd601..8010ebf022 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -901,7 +901,7 @@ void splash(int ticks, /* how long the splash is displayed */ void charging_splash(void) { splash(2*HZ, true, str(LANG_BATTERY_CHARGE)); - while (button_get(false)); + button_clear_queue(); } diff --git a/apps/tree.c b/apps/tree.c index 7c21dfecdf..b482682e67 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -1127,7 +1127,7 @@ static bool dirbrowse(void) lastfilter = *tc.dirfilter; lastsortcase = global_settings.sort_case; restore = true; - while (button_get(false)); /* clear button queue */ + button_clear_queue(); /* clear button queue */ } if (exit_func) diff --git a/uisimulator/x11/button-x11.c b/uisimulator/x11/button-x11.c index a8dd709110..ba70c8129b 100644 --- a/uisimulator/x11/button-x11.c +++ b/uisimulator/x11/button-x11.c @@ -235,4 +235,5 @@ int button_status(void) void button_clear_queue(void) { + while (get_raw_button()); }