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
This commit is contained in:
parent
45bd4c7220
commit
73b1e30bb0
8 changed files with 46 additions and 39 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -310,13 +310,13 @@ int sb_touch_to_button(int context)
|
|||
int button, offset;
|
||||
if (bypass_sb_touchregions)
|
||||
return ACTION_TOUCHSCREEN;
|
||||
|
||||
|
||||
struct gui_wps *gwps = skin_get_gwps(CUSTOM_STATUSBAR, SCREEN_MAIN);
|
||||
if (last_context != context)
|
||||
skin_disarm_touchregions(skin_get_gwps(CUSTOM_STATUSBAR, SCREEN_MAIN)->data);
|
||||
skin_disarm_touchregions(gwps);
|
||||
last_context = context;
|
||||
button = skin_get_touchaction(skin_get_gwps(CUSTOM_STATUSBAR, SCREEN_MAIN)->data,
|
||||
&offset);
|
||||
|
||||
|
||||
button = skin_get_touchaction(gwps, &offset);
|
||||
switch (button)
|
||||
{
|
||||
#ifdef HAVE_VOLUME_IN_LIST
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include "icon.h"
|
||||
#include "skin_engine/skin_engine.h"
|
||||
|
||||
struct wps_data;
|
||||
|
||||
char* sb_create_from_settings(enum screen_type screen);
|
||||
void sb_skin_init(void) INIT_ATTR;
|
||||
struct viewport *sb_skin_get_info_vp(enum screen_type screen);
|
||||
|
|
|
@ -156,11 +156,12 @@ static bool update_onvol_change(enum screen_type screen)
|
|||
|
||||
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
static int skintouch_to_wps(struct wps_data *data)
|
||||
static int skintouch_to_wps(void)
|
||||
{
|
||||
int offset = 0;
|
||||
struct wps_state *gstate = get_wps_state();
|
||||
int button = skin_get_touchaction(data, &offset);
|
||||
struct gui_wps *gwps = skin_get_gwps(WPS, SCREEN_MAIN);
|
||||
int button = skin_get_touchaction(gwps, &offset);
|
||||
switch (button)
|
||||
{
|
||||
case ACTION_STD_PREV:
|
||||
|
@ -327,7 +328,7 @@ static bool ffwd_rew(int button, bool seek_from_end)
|
|||
button = get_action(CONTEXT_WPS|ALLOW_SOFTLOCK,TIMEOUT_BLOCK);
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
if (button == ACTION_TOUCHSCREEN)
|
||||
button = skintouch_to_wps(skin_get_gwps(WPS, SCREEN_MAIN)->data);
|
||||
button = skintouch_to_wps();
|
||||
#endif
|
||||
if (button != ACTION_WPS_SEEKFWD
|
||||
&& button != ACTION_WPS_SEEKBACK
|
||||
|
@ -517,12 +518,12 @@ static void gwps_leave_wps(void)
|
|||
{
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
skin_get_gwps(WPS, i)->display->scroll_stop();
|
||||
struct gui_wps *gwps = skin_get_gwps(WPS, i);
|
||||
gwps->display->scroll_stop();
|
||||
#ifdef HAVE_BACKDROP_IMAGE
|
||||
skin_backdrop_show(sb_get_backdrop(i));
|
||||
#endif
|
||||
viewportmanager_theme_undo(i, skin_has_sbs(i, skin_get_gwps(WPS, i)->data));
|
||||
|
||||
viewportmanager_theme_undo(i, skin_has_sbs(gwps));
|
||||
}
|
||||
|
||||
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
||||
|
@ -547,7 +548,7 @@ static void gwps_enter_wps(void)
|
|||
gwps = skin_get_gwps(WPS, i);
|
||||
display = gwps->display;
|
||||
display->scroll_stop();
|
||||
viewportmanager_theme_enable(i, skin_has_sbs(i, skin_get_gwps(WPS, i)->data), NULL);
|
||||
viewportmanager_theme_enable(i, skin_has_sbs(gwps), NULL);
|
||||
|
||||
/* Update the values in the first (default) viewport - in case the user
|
||||
has modified the statusbar or colour settings */
|
||||
|
@ -574,7 +575,7 @@ static void gwps_enter_wps(void)
|
|||
}
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
gwps = skin_get_gwps(WPS, SCREEN_MAIN);
|
||||
skin_disarm_touchregions(gwps->data);
|
||||
skin_disarm_touchregions(gwps);
|
||||
if (gwps->data->touchregions < 0)
|
||||
touchscreen_set_mode(TOUCHSCREEN_BUTTON);
|
||||
#endif
|
||||
|
@ -655,7 +656,7 @@ long gui_wps_show(void)
|
|||
exit = true;
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
if (button == ACTION_TOUCHSCREEN)
|
||||
button = skintouch_to_wps(skin_get_gwps(WPS, SCREEN_MAIN)->data);
|
||||
button = skintouch_to_wps();
|
||||
#endif
|
||||
/* The iPods/X5/M5 use a single button for the A-B mode markers,
|
||||
defined as ACTION_WPSAB_SINGLE in their config files. */
|
||||
|
|
|
@ -63,12 +63,12 @@ void fms_fix_displays(enum fms_exiting toggle_state)
|
|||
{
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
struct wps_data *data = skin_get_gwps(FM_SCREEN, i)->data;
|
||||
struct gui_wps *gwps = skin_get_gwps(FM_SCREEN, i);
|
||||
if (toggle_state == FMS_ENTER)
|
||||
{
|
||||
viewportmanager_theme_enable(i, skin_has_sbs(i, data), NULL);
|
||||
viewportmanager_theme_enable(i, skin_has_sbs(gwps), NULL);
|
||||
#ifdef HAVE_BACKDROP_IMAGE
|
||||
skin_backdrop_show(data->backdrop_id);
|
||||
skin_backdrop_show(gwps->data->backdrop_id);
|
||||
#endif
|
||||
screens[i].clear_display();
|
||||
/* force statusbar/skin update since we just cleared the whole screen */
|
||||
|
@ -80,10 +80,10 @@ void fms_fix_displays(enum fms_exiting toggle_state)
|
|||
#ifdef HAVE_BACKDROP_IMAGE
|
||||
skin_backdrop_show(sb_get_backdrop(i));
|
||||
#endif
|
||||
viewportmanager_theme_undo(i, skin_has_sbs(i, data));
|
||||
viewportmanager_theme_undo(i, skin_has_sbs(gwps));
|
||||
}
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
if (i==SCREEN_MAIN && !data->touchregions)
|
||||
if (i==SCREEN_MAIN && !gwps->data->touchregions)
|
||||
touchscreen_set_mode(toggle_state == FMS_ENTER ?
|
||||
TOUCHSCREEN_BUTTON : global_settings.touch_mode);
|
||||
#endif
|
||||
|
@ -96,10 +96,10 @@ int fms_do_button_loop(bool update_screen)
|
|||
int button = skin_wait_for_action(FM_SCREEN, CONTEXT_FM|ALLOW_SOFTLOCK,
|
||||
update_screen ? TIMEOUT_NOBLOCK : HZ/5);
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
struct gui_wps *gwps = skin_get_gwps(FM_SCREEN, SCREEN_MAIN);
|
||||
int offset;
|
||||
if (button == ACTION_TOUCHSCREEN)
|
||||
button = skin_get_touchaction(skin_get_gwps(FM_SCREEN, SCREEN_MAIN)->data,
|
||||
&offset);
|
||||
button = skin_get_touchaction(gwps, &offset);
|
||||
switch (button)
|
||||
{
|
||||
case ACTION_WPS_STOP:
|
||||
|
|
Loading…
Reference in a new issue