fix erroneous button read in yesno screen and missed buttons in action.c.

If two yesno screens directly follow each other the button release of the
first one was incorrectly accepted in the second one. The fix exposed another
problem in action.c if action_wait_for_release() is called when no button is
actually pressed. The next press was silently eaten.

Change-Id: Iaa5f246f7ea1fd775606620a989cdaec74a9305e
This commit is contained in:
Thomas Martitz 2012-07-18 10:25:32 +02:00
parent df9bd8730c
commit 15775c8bad
2 changed files with 11 additions and 2 deletions

View file

@ -232,7 +232,13 @@ static int get_action_worker(int context, int timeout,
/* Data from sys events can be pulled with button_get_data
* multimedia button presses don't go through the action system */
if (button == BUTTON_NONE || button & (SYS_EVENT|BUTTON_MULTIMEDIA))
{
/* no button pressed so no point in waiting for release */
if (button == BUTTON_NONE)
wait_for_release = false;
return button;
}
/* the special redraw button should result in a screen refresh */
if (button == BUTTON_REDRAW)
return ACTION_REDRAW;

View file

@ -169,9 +169,10 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
screens[i].stop_scroll();
gui_yesno_draw(&(yn[i]));
}
/* make sure to eat any extranous keypresses */
while (get_action(CONTEXT_STD+99, TIMEOUT_NOBLOCK))
action_wait_for_release();
action_wait_for_release();
while (result==-1)
{
/* Repeat the question every 5secs (more or less) */
@ -205,6 +206,7 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
result=YESNO_YES;
break;
case ACTION_NONE:
case ACTION_UNKNOWN:
case SYS_CHARGER_DISCONNECTED:
case SYS_BATTERY_UPDATE:
/* ignore some SYS events that can happen */
@ -233,6 +235,7 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
screens[i].scroll_stop(yn[i].vp);
viewportmanager_theme_undo(i, true);
}
return(result);
}