forked from len0rd/rockbox
FS#10636: Quickscreen incorrect operation when menu has negative step
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22887 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e7df285a85
commit
22933cc19c
1 changed files with 9 additions and 8 deletions
|
|
@ -240,21 +240,20 @@ void option_select_next_val(const struct settings_list *setting,
|
|||
else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING)
|
||||
{
|
||||
struct int_setting *info = (struct int_setting *)setting->int_setting;
|
||||
int step = info->step;
|
||||
if (step < 0)
|
||||
step = -step;
|
||||
bool neg_step = (info->step < 0);
|
||||
if (!previous)
|
||||
{
|
||||
val = *value + step;
|
||||
if (val > info->max)
|
||||
val = *value + info->step;
|
||||
if (neg_step ? (val < info->max) : (val > info->max))
|
||||
val = info->min;
|
||||
}
|
||||
else
|
||||
{
|
||||
val = *value - step;
|
||||
if (val < info->min)
|
||||
val = *value - info->step;
|
||||
if (neg_step ? (val > info->min) : (val < info->min))
|
||||
val = info->max;
|
||||
}
|
||||
*value = val;
|
||||
if (apply && info->option_callback)
|
||||
info->option_callback(val);
|
||||
}
|
||||
|
|
@ -276,6 +275,7 @@ void option_select_next_val(const struct settings_list *setting,
|
|||
if (val < min)
|
||||
val = max;
|
||||
}
|
||||
*value = val;
|
||||
}
|
||||
else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING)
|
||||
{
|
||||
|
|
@ -293,6 +293,7 @@ void option_select_next_val(const struct settings_list *setting,
|
|||
if (val < 0)
|
||||
val = info->count-1;
|
||||
}
|
||||
*value = val;
|
||||
if (apply && info->option_callback)
|
||||
info->option_callback(val);
|
||||
}
|
||||
|
|
@ -311,9 +312,9 @@ void option_select_next_val(const struct settings_list *setting,
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*value = val;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int selection_to_val(const struct settings_list *setting, int selection)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue