skin_engine: Make pressing the setting bar touch region work
might need some tweaking, but works. Change-Id: I0784cd4fe9996531da6cc275491ff3b4e83cdbcf
This commit is contained in:
parent
65f9df3083
commit
68ee7aac6e
5 changed files with 41 additions and 1 deletions
|
@ -254,6 +254,7 @@ enum {
|
|||
ACTION_TOUCH_SCROLLBAR,
|
||||
ACTION_TOUCH_VOLUME,
|
||||
ACTION_TOUCH_SOFTLOCK,
|
||||
ACTION_TOUCH_SETTING,
|
||||
#endif
|
||||
|
||||
/* USB HID codes */
|
||||
|
|
|
@ -600,3 +600,21 @@ int get_setting_info_for_bar(int setting_id, int *count, int *val)
|
|||
val_to_selection(setting, oldvalue, count, val, &function);
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
void update_setting_value_from_touch(int setting_id, int selection)
|
||||
{
|
||||
const struct settings_list *setting = &settings[setting_id];
|
||||
int new_val = selection_to_val(setting, selection);
|
||||
int var_type = setting->flags&F_T_MASK;
|
||||
|
||||
if (var_type == F_T_INT || var_type == F_T_UINT)
|
||||
{
|
||||
*(int*)setting->setting = new_val;
|
||||
}
|
||||
else if (var_type == F_T_BOOL)
|
||||
{
|
||||
*(bool*)setting->setting = new_val ? true : false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -49,5 +49,8 @@ void option_talk_value(const struct settings_list *setting, int value, bool enqu
|
|||
int option_value_as_int(const struct settings_list *setting);
|
||||
|
||||
int get_setting_info_for_bar(int setting_id, int *count, int *val);
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
void update_setting_value_from_touch(int setting_id, int selection);
|
||||
#endif
|
||||
|
||||
#endif /* _GUI_OPTION_SELECT_H_ */
|
||||
|
|
|
@ -1091,7 +1091,9 @@ static int parse_progressbar_tag(struct skin_element* element,
|
|||
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
if (!suppress_touchregion &&
|
||||
(token->type == SKIN_TOKEN_VOLUMEBAR || token->type == SKIN_TOKEN_PROGRESSBAR))
|
||||
(token->type == SKIN_TOKEN_VOLUMEBAR ||
|
||||
token->type == SKIN_TOKEN_PROGRESSBAR ||
|
||||
token->type == SKIN_TOKEN_SETTINGBAR))
|
||||
{
|
||||
struct touchregion *region = skin_buffer_alloc(sizeof(*region));
|
||||
struct skin_token_list *item;
|
||||
|
@ -1102,6 +1104,8 @@ static int parse_progressbar_tag(struct skin_element* element,
|
|||
|
||||
if (token->type == SKIN_TOKEN_VOLUMEBAR)
|
||||
region->action = ACTION_TOUCH_VOLUME;
|
||||
else if (token->type == SKIN_TOKEN_SETTINGBAR)
|
||||
region->action = ACTION_TOUCH_SETTING;
|
||||
else
|
||||
region->action = ACTION_TOUCH_SCROLLBAR;
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset,
|
|||
{
|
||||
case ACTION_TOUCH_SCROLLBAR:
|
||||
case ACTION_TOUCH_VOLUME:
|
||||
case ACTION_TOUCH_SETTING:
|
||||
if (edge_offset)
|
||||
{
|
||||
struct progressbar *bar =
|
||||
|
@ -284,6 +285,19 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset,
|
|||
returncode = ACTION_REDRAW;
|
||||
}
|
||||
break;
|
||||
case ACTION_TOUCH_SETTING:
|
||||
{
|
||||
struct progressbar *bar =
|
||||
SKINOFFSETTOPTR(skin_buffer, temp->bar);
|
||||
if (bar && edge_offset)
|
||||
{
|
||||
int val, count;
|
||||
get_setting_info_for_bar(bar->setting_id, &count, &val);
|
||||
val = *edge_offset * count / 100;
|
||||
update_setting_value_from_touch(bar->setting_id, val);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return returncode;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue