summaryrefslogtreecommitdiffstats
path: root/apps/gui/skin_engine
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-10-04 23:22:21 +0100
committerAidan MacDonald <amachronic@protonmail.com>2022-11-15 14:20:31 +0000
commit73b1e30bb04d87144c4106ff7a9457507d191491 (patch)
tree377a307a2ba7f3065fa60cf316c20c01d03a2725 /apps/gui/skin_engine
parent45bd4c7220280e3eafdd2722cc17c8db8617b676 (diff)
downloadrockbox-73b1e30bb04d87144c4106ff7a9457507d191491.tar.gz
rockbox-73b1e30bb04d87144c4106ff7a9457507d191491.zip
skin engine: Reduce scope of internal wps_data struct
A bunch of public API calls take a wps_data struct argument, but that's an internal type that doesn't have a direct getter. Instead the skin engine provides a gui_wps struct as a way to refer to a particular skin instance. Use that instead of wps_data in the public API. Change-Id: I13e1aa8df7f08ccfb789bb728d493ac8d7de1a9b
Diffstat (limited to 'apps/gui/skin_engine')
-rw-r--r--apps/gui/skin_engine/skin_display.c8
-rw-r--r--apps/gui/skin_engine/skin_engine.h15
-rw-r--r--apps/gui/skin_engine/skin_touchsupport.c8
-rw-r--r--apps/gui/skin_engine/wps_internals.h9
4 files changed, 22 insertions, 18 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 3ff804263b..1a012dc1a6 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -709,14 +709,14 @@ void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear)
}
#endif
-bool skin_has_sbs(enum screen_type screen, struct wps_data *data)
+bool skin_has_sbs(struct gui_wps *gwps)
{
- (void)screen;
- (void)data;
+ struct wps_data *data = gwps->data;
+
bool draw = false;
if (data->wps_sb_tag)
draw = data->show_sb_on_wps;
- else if (statusbar_position(screen) != STATUSBAR_OFF)
+ else if (statusbar_position(gwps->display->screen_type) != STATUSBAR_OFF)
draw = true;
return draw;
}
diff --git a/apps/gui/skin_engine/skin_engine.h b/apps/gui/skin_engine/skin_engine.h
index b56674112c..d04c873e84 100644
--- a/apps/gui/skin_engine/skin_engine.h
+++ b/apps/gui/skin_engine/skin_engine.h
@@ -40,25 +40,18 @@ enum skinnable_screens {
struct skin_stats;
struct skin_viewport;
-struct wps_data;
+struct gui_wps;
#ifdef HAVE_TOUCHSCREEN
-int skin_get_touchaction(struct wps_data *data, int* edge_offset);
-void skin_disarm_touchregions(struct wps_data *data);
+int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset);
+void skin_disarm_touchregions(struct gui_wps *gwps);
#endif
/* Do a update_type update of the skinned screen */
void skin_update(enum skinnable_screens skin, enum screen_type screen,
unsigned int update_type);
-/*
- * setup up the skin-data from a format-buffer (isfile = false)
- * or from a skinfile (isfile = true)
- */
-bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
- const char *buf, bool isfile, struct skin_stats *stats);
-
-bool skin_has_sbs(enum screen_type screen, struct wps_data *data);
+bool skin_has_sbs(struct gui_wps *gwps);
/* load a backdrop into the skin buffer.
diff --git a/apps/gui/skin_engine/skin_touchsupport.c b/apps/gui/skin_engine/skin_touchsupport.c
index eba6b82f5b..77ab30d675 100644
--- a/apps/gui/skin_engine/skin_touchsupport.c
+++ b/apps/gui/skin_engine/skin_touchsupport.c
@@ -35,8 +35,9 @@
#include "dsp_misc.h"
/** Disarms all touchregions. */
-void skin_disarm_touchregions(struct wps_data *data)
+void skin_disarm_touchregions(struct gui_wps *gwps)
{
+ struct wps_data *data = gwps->data;
char* skin_buffer = get_skin_buffer(data);
struct skin_token_list *regions = SKINOFFSETTOPTR(skin_buffer, data->touchregions);
while (regions)
@@ -52,8 +53,9 @@ void skin_disarm_touchregions(struct wps_data *data)
* egde_offset is a percentage value for the position of the touch
* inside the bar for regions which arnt WPS_TOUCHREGION_ACTION type.
*/
-int skin_get_touchaction(struct wps_data *data, int* edge_offset)
+int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset)
{
+ struct wps_data *data = gwps->data;
int returncode = ACTION_NONE;
short x,y;
short vx, vy;
@@ -161,7 +163,7 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset)
/* On release, all regions are disarmed. */
if (released)
- skin_disarm_touchregions(data);
+ skin_disarm_touchregions(gwps);
if (temp && temp->press_length == LONG_PRESS)
temp->armed = false;
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 2506688659..f3e4577cc2 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -31,6 +31,8 @@
#include "core_alloc.h"
#endif
+struct wps_data;
+
struct skin_stats {
size_t buflib_handles;
size_t tree_size;
@@ -42,6 +44,13 @@ struct skin_stats *skin_get_stats(int number, int screen);
#define skin_clear_stats(stats) memset(stats, 0, sizeof(struct skin_stats))
bool skin_backdrop_get_debug(int index, char **path, int *ref_count, size_t *size);
+/*
+ * setup up the skin-data from a format-buffer (isfile = false)
+ * or from a skinfile (isfile = true)
+ */
+bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
+ const char *buf, bool isfile, struct skin_stats *stats);
+
/* Timeout unit expressed in HZ. In WPS, all timeouts are given in seconds
(possibly with a decimal fraction) but stored as integer values.
E.g. 2.5 is stored as 25. This means 25 tenth of a second, i.e. 25 units.