2019-02-07 19:17:10 +01:00
|
|
|
/**
|
|
|
|
* @file lv_disp.c
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
|
|
|
#include "lv_disp.h"
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* STATIC PROTOTYPES
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* STATIC VARIABLES
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* GLOBAL FUNCTIONS
|
|
|
|
**********************/
|
|
|
|
|
2019-02-12 15:38:13 +01:00
|
|
|
/**
|
2019-02-20 23:58:13 +01:00
|
|
|
* Return with a pointer to the active screen
|
|
|
|
* @param disp pointer to display which active screen should be get. (NULL to use the default screen)
|
|
|
|
* @return pointer to the active screen object (loaded by 'lv_scr_load()')
|
2019-02-12 15:38:13 +01:00
|
|
|
*/
|
2019-02-20 23:58:13 +01:00
|
|
|
lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp)
|
2019-02-12 15:38:13 +01:00
|
|
|
{
|
2019-02-20 23:58:13 +01:00
|
|
|
if(!disp) disp = lv_disp_get_default();
|
|
|
|
if(!disp) {
|
|
|
|
LV_LOG_WARN("lv_scr_act: no display registered to get its top layer");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return disp->act_scr;
|
2019-02-12 15:38:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-02-20 23:58:13 +01:00
|
|
|
* Make a screen active
|
|
|
|
* @param scr pointer to a screen
|
2019-02-12 15:38:13 +01:00
|
|
|
*/
|
2019-02-20 23:58:13 +01:00
|
|
|
void lv_disp_set_scr_act(lv_obj_t * scr)
|
2019-02-12 15:38:13 +01:00
|
|
|
{
|
2019-02-20 23:58:13 +01:00
|
|
|
lv_disp_t * d = lv_obj_get_disp(scr);
|
|
|
|
|
|
|
|
d->act_scr = scr;
|
2019-02-12 15:38:13 +01:00
|
|
|
|
2019-02-20 23:58:13 +01:00
|
|
|
lv_obj_invalidate(scr);
|
2019-02-12 15:38:13 +01:00
|
|
|
}
|
|
|
|
|
2019-02-20 23:58:13 +01:00
|
|
|
/**
|
|
|
|
* Return with the top layer. (Same on every screen and it is above the normal screen layer)
|
|
|
|
* @param disp pointer to display which top layer should be get. (NULL to use the default screen)
|
|
|
|
* @return pointer to the top layer object (transparent screen sized lv_obj)
|
|
|
|
*/
|
|
|
|
lv_obj_t * lv_disp_get_layer_top(lv_disp_t * disp)
|
|
|
|
{
|
|
|
|
if(!disp) disp = lv_disp_get_default();
|
|
|
|
if(!disp) {
|
|
|
|
LV_LOG_WARN("lv_layer_top: no display registered to get its top layer");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return disp->top_layer;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return with the sys. layer. (Same on every screen and it is above the normal screen and the top layer)
|
|
|
|
* @param disp pointer to display which sys. layer should be get. (NULL to use the default screen)
|
|
|
|
* @return pointer to the sys layer object (transparent screen sized lv_obj)
|
|
|
|
*/
|
|
|
|
lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp)
|
2019-02-12 16:20:59 +01:00
|
|
|
{
|
2019-02-20 23:58:13 +01:00
|
|
|
if(!disp) disp = lv_disp_get_default();
|
|
|
|
if(!disp) {
|
|
|
|
LV_LOG_WARN("lv_layer_sys: no display registered to get its top layer");
|
|
|
|
return NULL;
|
|
|
|
}
|
2019-02-12 16:20:59 +01:00
|
|
|
|
2019-02-20 23:58:13 +01:00
|
|
|
return disp->sys_layer;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Assign a screen to a display.
|
|
|
|
* @param disp pointer to a display where to assign the screen
|
|
|
|
* @param scr pointer to a screen object to assign
|
|
|
|
*/
|
|
|
|
void lv_disp_assign_screen(lv_disp_t * disp, lv_obj_t * scr)
|
|
|
|
{
|
|
|
|
if(lv_obj_get_parent(scr) != NULL) {
|
|
|
|
LV_LOG_WARN("lv_disp_assign_screen: try to assign a non-screen object");
|
2019-02-12 16:20:59 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-02-20 23:58:13 +01:00
|
|
|
lv_disp_t * old_disp = lv_obj_get_disp(scr);
|
|
|
|
|
|
|
|
if(old_disp == disp) return;
|
|
|
|
|
2019-02-12 16:20:59 +01:00
|
|
|
lv_ll_chg_list(&old_disp->scr_ll, &disp->scr_ll, scr);
|
|
|
|
}
|
|
|
|
|
2019-02-07 19:17:10 +01:00
|
|
|
/**********************
|
|
|
|
* STATIC FUNCTIONS
|
|
|
|
**********************/
|