skin engine: Add 'touch' command to the %vs() tag

%vs(label, touch, -) will reset the timeout for the variable without
changing the variables value.

Change-Id: Idba03f454a82ac7460bb53a4de3aa6903656c585
This commit is contained in:
Jonathan Gordon 2012-02-21 00:34:58 +11:00
parent 43fc2a51d9
commit 9c21258e2c
2 changed files with 10 additions and 2 deletions

View file

@ -1179,7 +1179,10 @@ static int parse_skinvar( struct skin_element *element,
if (!data)
return WPS_ERROR_INVALID_PARAM;
data->var = PTRTOSKINOFFSET(skin_buffer, var);
data->newval = get_param(element, 2)->data.number;
if (!isdefault(get_param(element, 2)))
data->newval = get_param(element, 2)->data.number;
else if (strcmp(get_param_text(element, 1), "touch"))
return WPS_ERROR_INVALID_PARAM;
data->max = 0;
if (!strcmp(get_param_text(element, 1), "set"))
data->direct = true;
@ -1192,6 +1195,11 @@ static int parse_skinvar( struct skin_element *element,
data->direct = false;
data->newval *= -1;
}
else if (!strcmp(get_param_text(element, 1), "touch"))
{
data->direct = false;
data->newval = 0;
}
if (element->params_count > 3)
data->max = get_param(element, 3)->data.number;
token->value.data = PTRTOSKINOFFSET(skin_buffer, data);

View file

@ -236,7 +236,7 @@ static const struct tag_info legal_tags[] =
{ SKIN_TOKEN_REC_HOURS, "Rh" , "", SKIN_REFRESH_DYNAMIC },
/* Skin variables */
{ SKIN_TOKEN_VAR_SET, "vs", "SSI|I", SKIN_REFRESH_DYNAMIC },
{ SKIN_TOKEN_VAR_SET, "vs", "SSi|I", SKIN_REFRESH_DYNAMIC },
{ SKIN_TOKEN_VAR_GETVAL, "vg", "S", SKIN_REFRESH_DYNAMIC },
{ SKIN_TOKEN_VAR_TIMEOUT, "vl", "S|D", SKIN_REFRESH_DYNAMIC },