From e3e0c7b73c9d3be53d58dcae22a0ce3c0a510353 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Mon, 1 Aug 2022 10:52:24 +0100 Subject: [PATCH] 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 --- apps/gui/skin_engine/skin_parser.c | 5 +++-- apps/gui/skin_engine/wps_internals.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 28b4de4b2c..2537e869ab 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -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; diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index a6d9d2b472..d007fe6d7e 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h @@ -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 */