diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-10-04 23:22:21 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-11-15 14:20:31 +0000 |
commit | 73b1e30bb04d87144c4106ff7a9457507d191491 (patch) | |
tree | 377a307a2ba7f3065fa60cf316c20c01d03a2725 /apps/gui/skin_engine | |
parent | 45bd4c7220280e3eafdd2722cc17c8db8617b676 (diff) | |
download | rockbox-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.c | 8 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_engine.h | 15 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_touchsupport.c | 8 | ||||
-rw-r--r-- | apps/gui/skin_engine/wps_internals.h | 9 |
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) | |||
709 | } | 709 | } |
710 | #endif | 710 | #endif |
711 | 711 | ||
712 | bool skin_has_sbs(enum screen_type screen, struct wps_data *data) | 712 | bool skin_has_sbs(struct gui_wps *gwps) |
713 | { | 713 | { |
714 | (void)screen; | 714 | struct wps_data *data = gwps->data; |
715 | (void)data; | 715 | |
716 | bool draw = false; | 716 | bool draw = false; |
717 | if (data->wps_sb_tag) | 717 | if (data->wps_sb_tag) |
718 | draw = data->show_sb_on_wps; | 718 | draw = data->show_sb_on_wps; |
719 | else if (statusbar_position(screen) != STATUSBAR_OFF) | 719 | else if (statusbar_position(gwps->display->screen_type) != STATUSBAR_OFF) |
720 | draw = true; | 720 | draw = true; |
721 | return draw; | 721 | return draw; |
722 | } | 722 | } |
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 { | |||
40 | 40 | ||
41 | struct skin_stats; | 41 | struct skin_stats; |
42 | struct skin_viewport; | 42 | struct skin_viewport; |
43 | struct wps_data; | 43 | struct gui_wps; |
44 | 44 | ||
45 | #ifdef HAVE_TOUCHSCREEN | 45 | #ifdef HAVE_TOUCHSCREEN |
46 | int skin_get_touchaction(struct wps_data *data, int* edge_offset); | 46 | int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset); |
47 | void skin_disarm_touchregions(struct wps_data *data); | 47 | void skin_disarm_touchregions(struct gui_wps *gwps); |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | /* Do a update_type update of the skinned screen */ | 50 | /* Do a update_type update of the skinned screen */ |
51 | void skin_update(enum skinnable_screens skin, enum screen_type screen, | 51 | void skin_update(enum skinnable_screens skin, enum screen_type screen, |
52 | unsigned int update_type); | 52 | unsigned int update_type); |
53 | 53 | ||
54 | /* | 54 | bool skin_has_sbs(struct gui_wps *gwps); |
55 | * setup up the skin-data from a format-buffer (isfile = false) | ||
56 | * or from a skinfile (isfile = true) | ||
57 | */ | ||
58 | bool skin_data_load(enum screen_type screen, struct wps_data *wps_data, | ||
59 | const char *buf, bool isfile, struct skin_stats *stats); | ||
60 | |||
61 | bool skin_has_sbs(enum screen_type screen, struct wps_data *data); | ||
62 | 55 | ||
63 | 56 | ||
64 | /* load a backdrop into the skin buffer. | 57 | /* 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 @@ | |||
35 | #include "dsp_misc.h" | 35 | #include "dsp_misc.h" |
36 | 36 | ||
37 | /** Disarms all touchregions. */ | 37 | /** Disarms all touchregions. */ |
38 | void skin_disarm_touchregions(struct wps_data *data) | 38 | void skin_disarm_touchregions(struct gui_wps *gwps) |
39 | { | 39 | { |
40 | struct wps_data *data = gwps->data; | ||
40 | char* skin_buffer = get_skin_buffer(data); | 41 | char* skin_buffer = get_skin_buffer(data); |
41 | struct skin_token_list *regions = SKINOFFSETTOPTR(skin_buffer, data->touchregions); | 42 | struct skin_token_list *regions = SKINOFFSETTOPTR(skin_buffer, data->touchregions); |
42 | while (regions) | 43 | while (regions) |
@@ -52,8 +53,9 @@ void skin_disarm_touchregions(struct wps_data *data) | |||
52 | * egde_offset is a percentage value for the position of the touch | 53 | * egde_offset is a percentage value for the position of the touch |
53 | * inside the bar for regions which arnt WPS_TOUCHREGION_ACTION type. | 54 | * inside the bar for regions which arnt WPS_TOUCHREGION_ACTION type. |
54 | */ | 55 | */ |
55 | int skin_get_touchaction(struct wps_data *data, int* edge_offset) | 56 | int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset) |
56 | { | 57 | { |
58 | struct wps_data *data = gwps->data; | ||
57 | int returncode = ACTION_NONE; | 59 | int returncode = ACTION_NONE; |
58 | short x,y; | 60 | short x,y; |
59 | short vx, vy; | 61 | short vx, vy; |
@@ -161,7 +163,7 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset) | |||
161 | 163 | ||
162 | /* On release, all regions are disarmed. */ | 164 | /* On release, all regions are disarmed. */ |
163 | if (released) | 165 | if (released) |
164 | skin_disarm_touchregions(data); | 166 | skin_disarm_touchregions(gwps); |
165 | if (temp && temp->press_length == LONG_PRESS) | 167 | if (temp && temp->press_length == LONG_PRESS) |
166 | temp->armed = false; | 168 | temp->armed = false; |
167 | 169 | ||
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 @@ | |||
31 | #include "core_alloc.h" | 31 | #include "core_alloc.h" |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | struct wps_data; | ||
35 | |||
34 | struct skin_stats { | 36 | struct skin_stats { |
35 | size_t buflib_handles; | 37 | size_t buflib_handles; |
36 | size_t tree_size; | 38 | size_t tree_size; |
@@ -42,6 +44,13 @@ struct skin_stats *skin_get_stats(int number, int screen); | |||
42 | #define skin_clear_stats(stats) memset(stats, 0, sizeof(struct skin_stats)) | 44 | #define skin_clear_stats(stats) memset(stats, 0, sizeof(struct skin_stats)) |
43 | bool skin_backdrop_get_debug(int index, char **path, int *ref_count, size_t *size); | 45 | bool skin_backdrop_get_debug(int index, char **path, int *ref_count, size_t *size); |
44 | 46 | ||
47 | /* | ||
48 | * setup up the skin-data from a format-buffer (isfile = false) | ||
49 | * or from a skinfile (isfile = true) | ||
50 | */ | ||
51 | bool skin_data_load(enum screen_type screen, struct wps_data *wps_data, | ||
52 | const char *buf, bool isfile, struct skin_stats *stats); | ||
53 | |||
45 | /* Timeout unit expressed in HZ. In WPS, all timeouts are given in seconds | 54 | /* Timeout unit expressed in HZ. In WPS, all timeouts are given in seconds |
46 | (possibly with a decimal fraction) but stored as integer values. | 55 | (possibly with a decimal fraction) but stored as integer values. |
47 | E.g. 2.5 is stored as 25. This means 25 tenth of a second, i.e. 25 units. | 56 | E.g. 2.5 is stored as 25. This means 25 tenth of a second, i.e. 25 units. |