summaryrefslogtreecommitdiff
path: root/apps/gui/wps_engine/wps_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/wps_engine/wps_parser.c')
-rw-r--r--apps/gui/wps_engine/wps_parser.c55
1 files changed, 35 insertions, 20 deletions
diff --git a/apps/gui/wps_engine/wps_parser.c b/apps/gui/wps_engine/wps_parser.c
index 15acc1401d..91c63059b0 100644
--- a/apps/gui/wps_engine/wps_parser.c
+++ b/apps/gui/wps_engine/wps_parser.c
@@ -1173,6 +1173,8 @@ static int parse_touchregion(const char *wps_bufptr,
1173 struct touchregion *region; 1173 struct touchregion *region;
1174 const char *ptr = wps_bufptr; 1174 const char *ptr = wps_bufptr;
1175 const char *action; 1175 const char *action;
1176 const char pb_string[] = "progressbar";
1177 const char vol_string[] = "volume";
1176 int x,y,w,h; 1178 int x,y,w,h;
1177 1179
1178 /* format: %T|x|y|width|height|action| 1180 /* format: %T|x|y|width|height|action|
@@ -1203,7 +1205,7 @@ static int parse_touchregion(const char *wps_bufptr,
1203 /* Check there is a terminating | */ 1205 /* Check there is a terminating | */
1204 if (*ptr != '|') 1206 if (*ptr != '|')
1205 return WPS_ERROR_INVALID_PARAM; 1207 return WPS_ERROR_INVALID_PARAM;
1206 1208
1207 /* should probably do some bounds checking here with the viewport... but later */ 1209 /* should probably do some bounds checking here with the viewport... but later */
1208 region = &wps_data->touchregion[wps_data->touchregion_count]; 1210 region = &wps_data->touchregion[wps_data->touchregion_count];
1209 region->action = ACTION_NONE; 1211 region->action = ACTION_NONE;
@@ -1212,28 +1214,41 @@ static int parse_touchregion(const char *wps_bufptr,
1212 region->width = w; 1214 region->width = w;
1213 region->height = h; 1215 region->height = h;
1214 region->wvp = &wps_data->viewports[wps_data->num_viewports]; 1216 region->wvp = &wps_data->viewports[wps_data->num_viewports];
1215 i = 0;
1216 if (*action == '&')
1217 {
1218 action++;
1219 region->repeat = true;
1220 }
1221 else
1222 region->repeat = false;
1223 1217
1224 imax = ARRAYLEN(touchactions); 1218 if(!strncmp(pb_string, action, sizeof(pb_string)-1)
1225 while ((region->action == ACTION_NONE) && 1219 && *(action + sizeof(pb_string)-1) == '|')
1226 (i < imax)) 1220 region->type = WPS_TOUCHREGION_SCROLLBAR;
1221 else if(!strncmp(vol_string, action, sizeof(vol_string)-1)
1222 && *(action + sizeof(vol_string)-1) == '|')
1223 region->type = WPS_TOUCHREGION_VOLUME;
1224 else
1227 { 1225 {
1228 /* try to match with one of our touchregion screens */ 1226 region->type = WPS_TOUCHREGION_ACTION;
1229 int len = strlen(touchactions[i].s); 1227
1230 if (!strncmp(touchactions[i].s, action, len) 1228 if (*action == '&')
1231 && *(action+len) == '|') 1229 {
1232 region->action = touchactions[i].action; 1230 action++;
1233 i++; 1231 region->repeat = true;
1232 }
1233 else
1234 region->repeat = false;
1235
1236 i = 0;
1237 imax = ARRAYLEN(touchactions);
1238 while ((region->action == ACTION_NONE) &&
1239 (i < imax))
1240 {
1241 /* try to match with one of our touchregion screens */
1242 int len = strlen(touchactions[i].s);
1243 if (!strncmp(touchactions[i].s, action, len)
1244 && *(action+len) == '|')
1245 region->action = touchactions[i].action;
1246 i++;
1247 }
1248 if (region->action == ACTION_NONE)
1249 return WPS_ERROR_INVALID_PARAM;
1234 } 1250 }
1235 if (region->action == ACTION_NONE) 1251
1236 return WPS_ERROR_INVALID_PARAM;
1237 wps_data->touchregion_count++; 1252 wps_data->touchregion_count++;
1238 return skip_end_of_line(wps_bufptr); 1253 return skip_end_of_line(wps_bufptr);
1239} 1254}