diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/skin_engine/wps_internals.h | 5 | ||||
-rw-r--r-- | apps/gui/skin_engine/wps_parser.c | 53 |
2 files changed, 39 insertions, 19 deletions
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index a64ec93f08..ffebed7bad 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h | |||
@@ -390,6 +390,11 @@ struct touchregion { | |||
390 | short int y; /* y-pos */ | 390 | short int y; /* y-pos */ |
391 | short int width; /* width */ | 391 | short int width; /* width */ |
392 | short int height; /* height */ | 392 | short int height; /* height */ |
393 | enum { | ||
394 | WPS_TOUCHREGION_ACTION, | ||
395 | WPS_TOUCHREGION_SCROLLBAR, | ||
396 | WPS_TOUCHREGION_VOLUME | ||
397 | } type; /* type of touch region */ | ||
393 | bool repeat; /* requires the area be held for the action */ | 398 | bool repeat; /* requires the area be held for the action */ |
394 | int action; /* action this button will return */ | 399 | int action; /* action this button will return */ |
395 | }; | 400 | }; |
diff --git a/apps/gui/skin_engine/wps_parser.c b/apps/gui/skin_engine/wps_parser.c index 3df2c5f0aa..9671d7c4dc 100644 --- a/apps/gui/skin_engine/wps_parser.c +++ b/apps/gui/skin_engine/wps_parser.c | |||
@@ -1093,6 +1093,8 @@ static int parse_touchregion(const char *wps_bufptr, | |||
1093 | struct touchregion *region; | 1093 | struct touchregion *region; |
1094 | const char *ptr = wps_bufptr; | 1094 | const char *ptr = wps_bufptr; |
1095 | const char *action; | 1095 | const char *action; |
1096 | const char pb_string[] = "progressbar"; | ||
1097 | const char vol_string[] = "volume"; | ||
1096 | int x,y,w,h; | 1098 | int x,y,w,h; |
1097 | 1099 | ||
1098 | /* format: %T|x|y|width|height|action| | 1100 | /* format: %T|x|y|width|height|action| |
@@ -1132,28 +1134,41 @@ static int parse_touchregion(const char *wps_bufptr, | |||
1132 | region->width = w; | 1134 | region->width = w; |
1133 | region->height = h; | 1135 | region->height = h; |
1134 | region->wvp = &wps_data->viewports[wps_data->num_viewports]; | 1136 | region->wvp = &wps_data->viewports[wps_data->num_viewports]; |
1135 | i = 0; | 1137 | |
1136 | if (*action == '&') | 1138 | if(!strncmp(pb_string, action, sizeof(pb_string)-1) |
1137 | { | 1139 | && *(action + sizeof(pb_string)-1) == '|') |
1138 | action++; | 1140 | region->type = WPS_TOUCHREGION_SCROLLBAR; |
1139 | region->repeat = true; | 1141 | else if(!strncmp(vol_string, action, sizeof(vol_string)-1) |
1140 | } | 1142 | && *(action + sizeof(vol_string)-1) == '|') |
1143 | region->type = WPS_TOUCHREGION_VOLUME; | ||
1141 | else | 1144 | else |
1142 | region->repeat = false; | ||
1143 | |||
1144 | imax = ARRAYLEN(touchactions); | ||
1145 | while ((region->action == ACTION_NONE) && | ||
1146 | (i < imax)) | ||
1147 | { | 1145 | { |
1148 | /* try to match with one of our touchregion screens */ | 1146 | region->type = WPS_TOUCHREGION_ACTION; |
1149 | int len = strlen(touchactions[i].s); | 1147 | |
1150 | if (!strncmp(touchactions[i].s, action, len) | 1148 | if (*action == '&') |
1151 | && *(action+len) == '|') | 1149 | { |
1152 | region->action = touchactions[i].action; | 1150 | action++; |
1153 | i++; | 1151 | region->repeat = true; |
1152 | } | ||
1153 | else | ||
1154 | region->repeat = false; | ||
1155 | |||
1156 | i = 0; | ||
1157 | imax = ARRAYLEN(touchactions); | ||
1158 | while ((region->action == ACTION_NONE) && | ||
1159 | (i < imax)) | ||
1160 | { | ||
1161 | /* try to match with one of our touchregion screens */ | ||
1162 | int len = strlen(touchactions[i].s); | ||
1163 | if (!strncmp(touchactions[i].s, action, len) | ||
1164 | && *(action+len) == '|') | ||
1165 | region->action = touchactions[i].action; | ||
1166 | i++; | ||
1167 | } | ||
1168 | if (region->action == ACTION_NONE) | ||
1169 | return WPS_ERROR_INVALID_PARAM; | ||
1154 | } | 1170 | } |
1155 | if (region->action == ACTION_NONE) | 1171 | |
1156 | return WPS_ERROR_INVALID_PARAM; | ||
1157 | wps_data->touchregion_count++; | 1172 | wps_data->touchregion_count++; |
1158 | return skip_end_of_line(wps_bufptr); | 1173 | return skip_end_of_line(wps_bufptr); |
1159 | } | 1174 | } |