From 1816667937b7659bd9c31a47086492d8c7e25c1c Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sat, 21 Aug 2021 20:13:19 +0100 Subject: [PATCH] touchscreen: Allow bar tag touchregions to be labeled This is necessary if you want to detect touches on the bar region using %Tl conditionals. Suppressing the auto-created region and then creating one manually using %T doesn't give exactly the same results because user-defined touch regions can't yet specify padding. Change-Id: I2f4bde8eb56ba89645c72f3cc9d4b2355b934abd --- apps/gui/skin_engine/skin_parser.c | 14 +++++++++++++- manual/appendix/wps_tags.tex | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index c2d597d329..28b4de4b2c 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -982,6 +982,7 @@ static int parse_progressbar_tag(struct skin_element* element, char *image_filename = NULL; #ifdef HAVE_TOUCHSCREEN bool suppress_touchregion = false; + char *touchregion_label = NULL; #endif if (element->params_count == 0 && @@ -1156,6 +1157,17 @@ static int parse_progressbar_tag(struct skin_element* element, #ifdef HAVE_TOUCHSCREEN else if (pb_op == eNOTOUCH) suppress_touchregion = true; + else if (!strcmp(text, "touchlabel")) + { + if (curr_param+1 < element->params_count) + { + curr_param++; + param++; + touchregion_label = SKINOFFSETTOPTR(skin_buffer, param->data.text); + } + else /* option needs the next param */ + return -1; + } #endif else if (token->type == SKIN_TOKEN_SETTING && pb_op == eSETTING_OFFSET) { @@ -1285,7 +1297,7 @@ static int parse_progressbar_tag(struct skin_element* element, region->press_length = PRESS; region->last_press = -1; region->bar = PTRTOSKINOFFSET(skin_buffer, pb); - region->label = PTRTOSKINOFFSET(skin_buffer, NULL); + region->label = PTRTOSKINOFFSET(skin_buffer, touchregion_label); item = new_skin_token_list_item(NULL, region); if (!item) diff --git a/manual/appendix/wps_tags.tex b/manual/appendix/wps_tags.tex index 4084e424c9..762dbbad41 100644 --- a/manual/appendix/wps_tags.tex +++ b/manual/appendix/wps_tags.tex @@ -758,6 +758,7 @@ display cycling round the defined sublines. See ``slider'' option). \opt{touchscreen}{ \item[notouch] -- don't create the touchregion for progress/volume bars. + \item[touchlabel] -- the next option sets the label of the bar touch area, for linking with the \%Tl tag. } \item[soffset] -- For compound settings (such as the equalizer), this lets you pick which element in the set to use. The next param must be the number. Must be specified prior to the setting name. \item[setting] -- Specify the setting name to draw the bar from (bar must be