skin engine: Fix some user-created touch regions being suppressed

Fix the heuristic used for detecting a touch-enabled theme.
The old method assumes that volume bar and progress bar tags
are always auto-created, but this might not be true. Instead,
mark regions that originate from a %T tag as user-created and
check for those.

Change-Id: Iec732d299a2b4e298bef8069a68ff94e3b642703
This commit is contained in:
Aidan MacDonald 2022-08-01 10:52:24 +01:00
parent 1816667937
commit e3e0c7b73c
2 changed files with 4 additions and 2 deletions

View file

@ -1294,6 +1294,7 @@ static int parse_progressbar_tag(struct skin_element* element,
region->wvp = PTRTOSKINOFFSET(skin_buffer, curr_vp);
region->reverse_bar = false;
region->allow_while_locked = false;
region->user_region = false;
region->press_length = PRESS;
region->last_press = -1;
region->bar = PTRTOSKINOFFSET(skin_buffer, pb);
@ -1797,6 +1798,7 @@ static int parse_touchregion(struct skin_element *element,
region->last_press = -1;
region->press_length = PRESS;
region->allow_while_locked = false;
region->user_region = true;
region->bar = PTRTOSKINOFFSET(skin_buffer, NULL);
action = get_param_text(element, p++);
@ -2721,8 +2723,7 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
struct touchregion *r = NULL;
if (token)
r = SKINOFFSETTOPTR(skin_buffer, token->value.data);
if (r && r->action != ACTION_TOUCH_SCROLLBAR &&
r->action != ACTION_TOUCH_VOLUME)
if (r && r->user_region)
{
user_touch_region_found = true;
break;

View file

@ -219,6 +219,7 @@ struct touchregion {
int16_t hpad; /* padding to height */
bool reverse_bar; /* if true 0% is the left or top */
bool allow_while_locked;
bool user_region; /* if true this is a user-defined region */
enum {
PRESS, /* quick press only */
LONG_PRESS, /* Long press without repeat */