BigW Consortium Gitlab

Commit dcf50104 by Gabor Kiss-Vamosi

lv_obj: add top and sys layers

parent d6fe59bf
...@@ -38,12 +38,12 @@ ...@@ -38,12 +38,12 @@
Misc. setting Misc. setting
*=================*/ *=================*/
/*Display Input settings*/ /*Display Input settings*/
#define LV_indev_proc_READ_PERIOD 50 /*Input device read period milliseconds*/ #define LV_INDEV_READ_PERIOD 50 /*Input device read period milliseconds*/
#define LV_indev_proc_TP_MARKER 0 /*Mark the pressed points (Value means marker point size)*/ #define LV_INDEV_TP_MARKER 0 /*Mark the pressed points (Value means marker point size)*/
#define LV_indev_proc_DRAG_LIMIT (10 * LV_DOWNSCALE) /*Drag threshold in pixels */ #define LV_INDEV_DRAG_LIMIT (10 * LV_DOWNSCALE) /*Drag threshold in pixels */
#define LV_indev_proc_DRAG_THROW 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */ #define LV_INDEV_DRAG_THROW 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */
#define LV_indev_proc_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/ #define LV_INDEV_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/
#define LV_indev_proc_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */ #define LV_INDEV_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */
/*lv_obj (base object) settings*/ /*lv_obj (base object) settings*/
#define LV_OBJ_FREE_NUM 1 /*Enable the free number attribute*/ #define LV_OBJ_FREE_NUM 1 /*Enable the free number attribute*/
......
...@@ -73,8 +73,8 @@ ...@@ -73,8 +73,8 @@
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static lv_action_res_t btn_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); static lv_action_res_t btn_rel_action(lv_obj_t * btn, LV_INDEV_t * indev_proc);
static lv_action_res_t ddlist_action(lv_obj_t * ddlist, lv_indev_proc_t * indev_proc); static lv_action_res_t ddlist_action(lv_obj_t * ddlist, LV_INDEV_t * indev_proc);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
...@@ -190,7 +190,7 @@ void lv_ex_objects(void) ...@@ -190,7 +190,7 @@ void lv_ex_objects(void)
* @param indev_proc pointer to caller display input (e.g. touchpad) * @param indev_proc pointer to caller display input (e.g. touchpad)
* @return LV_ACTION_RES_OK because the object is not deleted in this function * @return LV_ACTION_RES_OK because the object is not deleted in this function
*/ */
static lv_action_res_t btn_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc) static lv_action_res_t btn_rel_action(lv_obj_t * btn, LV_INDEV_t * indev_proc)
{ {
/*Increase the button width*/ /*Increase the button width*/
cord_t width = lv_obj_get_width(btn); cord_t width = lv_obj_get_width(btn);
...@@ -205,7 +205,7 @@ static lv_action_res_t btn_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_p ...@@ -205,7 +205,7 @@ static lv_action_res_t btn_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_p
* @param indev_proc pointer to caller display input (e.g. touchpad) * @param indev_proc pointer to caller display input (e.g. touchpad)
* @return LV_ACTION_RES_OK because the object is not deleted in this function * @return LV_ACTION_RES_OK because the object is not deleted in this function
*/ */
static lv_action_res_t ddlist_action(lv_obj_t * ddlist, lv_indev_proc_t * indev_proc) static lv_action_res_t ddlist_action(lv_obj_t * ddlist, LV_INDEV_t * indev_proc)
{ {
uint16_t opt = lv_ddlist_get_selected(ddlist); /*Get the id of selected option*/ uint16_t opt = lv_ddlist_get_selected(ddlist); /*Get the id of selected option*/
......
...@@ -51,13 +51,13 @@ ...@@ -51,13 +51,13 @@
**********************/ **********************/
static void gui_create(void); static void gui_create(void);
static void enc_create(void); static void enc_create(void);
static lv_action_res_t mbox_yes_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); static lv_action_res_t mbox_yes_action(lv_obj_t * btn, LV_INDEV_t * indev_proc);
static lv_action_res_t mbox_no_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); static lv_action_res_t mbox_no_action(lv_obj_t * btn, LV_INDEV_t * indev_proc);
static lv_action_res_t enable_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); static lv_action_res_t enable_action(lv_obj_t * btn, LV_INDEV_t * indev_proc);
static lv_action_res_t enc_next(lv_obj_t * btn, lv_indev_proc_t * indev_proc); static lv_action_res_t enc_next(lv_obj_t * btn, LV_INDEV_t * indev_proc);
static lv_action_res_t enc_inc(lv_obj_t * btn, lv_indev_proc_t * indev_proc); static lv_action_res_t enc_inc(lv_obj_t * btn, LV_INDEV_t * indev_proc);
static lv_action_res_t enc_dec(lv_obj_t * btn, lv_indev_proc_t * indev_proc); static lv_action_res_t enc_dec(lv_obj_t * btn, LV_INDEV_t * indev_proc);
static lv_action_res_t enc_sel(lv_obj_t * btn, lv_indev_proc_t * indev_proc); static lv_action_res_t enc_sel(lv_obj_t * btn, LV_INDEV_t * indev_proc);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
...@@ -196,7 +196,7 @@ static void enc_create(void) ...@@ -196,7 +196,7 @@ static void enc_create(void)
* @param indev_proc pointer to the caller display input or NULL if the encoder used * @param indev_proc pointer to the caller display input or NULL if the encoder used
* @return LV_ACTION_RES_OK: because the button is not deleted * @return LV_ACTION_RES_OK: because the button is not deleted
*/ */
static lv_action_res_t enable_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc) static lv_action_res_t enable_action(lv_obj_t * btn, LV_INDEV_t * indev_proc)
{ {
/*If the butto nsi released the show message box to be sure about the Enable*/ /*If the butto nsi released the show message box to be sure about the Enable*/
if(lv_btn_get_state(btn) == LV_BTN_STATE_REL) { if(lv_btn_get_state(btn) == LV_BTN_STATE_REL) {
...@@ -238,7 +238,7 @@ static lv_action_res_t enable_action(lv_obj_t * btn, lv_indev_proc_t * indev_pro ...@@ -238,7 +238,7 @@ static lv_action_res_t enable_action(lv_obj_t * btn, lv_indev_proc_t * indev_pro
* @param indev_proc pointer to the caller display input or NULL if the encoder used * @param indev_proc pointer to the caller display input or NULL if the encoder used
* @return LV_ACTION_RES_INV: because the button along with the message box will be deleted * @return LV_ACTION_RES_INV: because the button along with the message box will be deleted
*/ */
static lv_action_res_t mbox_yes_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc) static lv_action_res_t mbox_yes_action(lv_obj_t * btn, LV_INDEV_t * indev_proc)
{ {
lv_group_focus_freeze(g, false); /*Release the freeze*/ lv_group_focus_freeze(g, false); /*Release the freeze*/
lv_obj_t * mbox = lv_mbox_get_from_btn(btn); lv_obj_t * mbox = lv_mbox_get_from_btn(btn);
...@@ -259,7 +259,7 @@ static lv_action_res_t mbox_yes_action(lv_obj_t * btn, lv_indev_proc_t * indev_p ...@@ -259,7 +259,7 @@ static lv_action_res_t mbox_yes_action(lv_obj_t * btn, lv_indev_proc_t * indev_p
* @param indev_proc pointer to the caller display input or NULL if the encoder used * @param indev_proc pointer to the caller display input or NULL if the encoder used
* @return LV_ACTION_RES_INV: because the button along with the message box will be deleted * @return LV_ACTION_RES_INV: because the button along with the message box will be deleted
*/ */
static lv_action_res_t mbox_no_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc) static lv_action_res_t mbox_no_action(lv_obj_t * btn, LV_INDEV_t * indev_proc)
{ {
lv_group_focus_freeze(g, false); /*Release the freeze*/ lv_group_focus_freeze(g, false); /*Release the freeze*/
lv_obj_t * mbox = lv_mbox_get_from_btn(btn); lv_obj_t * mbox = lv_mbox_get_from_btn(btn);
...@@ -274,7 +274,7 @@ static lv_action_res_t mbox_no_action(lv_obj_t * btn, lv_indev_proc_t * indev_pr ...@@ -274,7 +274,7 @@ static lv_action_res_t mbox_no_action(lv_obj_t * btn, lv_indev_proc_t * indev_pr
* @param indev_proc pointer to the caller display input * @param indev_proc pointer to the caller display input
* @return LV_ACTION_RES_OK: because the button is not deleted * @return LV_ACTION_RES_OK: because the button is not deleted
*/ */
static lv_action_res_t enc_next(lv_obj_t * btn, lv_indev_proc_t * indev_proc) static lv_action_res_t enc_next(lv_obj_t * btn, LV_INDEV_t * indev_proc)
{ {
/*Focus on the next object in the group*/ /*Focus on the next object in the group*/
lv_group_focus_next(g); lv_group_focus_next(g);
...@@ -288,7 +288,7 @@ static lv_action_res_t enc_next(lv_obj_t * btn, lv_indev_proc_t * indev_proc) ...@@ -288,7 +288,7 @@ static lv_action_res_t enc_next(lv_obj_t * btn, lv_indev_proc_t * indev_proc)
* @param indev_proc pointer to the caller display input * @param indev_proc pointer to the caller display input
* @return LV_ACTION_RES_OK: because the button is not deleted * @return LV_ACTION_RES_OK: because the button is not deleted
*/ */
static lv_action_res_t enc_inc(lv_obj_t * btn, lv_indev_proc_t * indev_proc) static lv_action_res_t enc_inc(lv_obj_t * btn, LV_INDEV_t * indev_proc)
{ {
/* Send RIGHT key when rotate to right. /* Send RIGHT key when rotate to right.
* It will trigger an increment like action in the object */ * It will trigger an increment like action in the object */
...@@ -302,7 +302,7 @@ static lv_action_res_t enc_inc(lv_obj_t * btn, lv_indev_proc_t * indev_proc) ...@@ -302,7 +302,7 @@ static lv_action_res_t enc_inc(lv_obj_t * btn, lv_indev_proc_t * indev_proc)
* @param indev_proc pointer to the caller display input * @param indev_proc pointer to the caller display input
* @return LV_ACTION_RES_OK: because the button is not deleted * @return LV_ACTION_RES_OK: because the button is not deleted
*/ */
static lv_action_res_t enc_dec(lv_obj_t * btn, lv_indev_proc_t * indev_proc) static lv_action_res_t enc_dec(lv_obj_t * btn, LV_INDEV_t * indev_proc)
{ {
/* Send LEFT key when rotate to left. /* Send LEFT key when rotate to left.
* It will trigger a decrement like action in the object */ * It will trigger a decrement like action in the object */
...@@ -316,7 +316,7 @@ static lv_action_res_t enc_dec(lv_obj_t * btn, lv_indev_proc_t * indev_proc) ...@@ -316,7 +316,7 @@ static lv_action_res_t enc_dec(lv_obj_t * btn, lv_indev_proc_t * indev_proc)
* @param indev_proc pointer to the caller display input * @param indev_proc pointer to the caller display input
* @return LV_ACTION_RES_OK: because the button is not deleted * @return LV_ACTION_RES_OK: because the button is not deleted
*/ */
static lv_action_res_t enc_sel(lv_obj_t * btn, lv_indev_proc_t * indev_proc) static lv_action_res_t enc_sel(lv_obj_t * btn, LV_INDEV_t * indev_proc)
{ {
/* Send ENTER key. /* Send ENTER key.
* It will trigger an 'OK' or 'Select' action in the object */ * It will trigger an 'OK' or 'Select' action in the object */
......
...@@ -51,10 +51,10 @@ static lv_indev_t *indev_act; ...@@ -51,10 +51,10 @@ static lv_indev_t *indev_act;
/** /**
* Initialize the display input device subsystem * Initialize the display input device subsystem
*/ */
void lv_indev_proc_init(void) void lv_indev_init(void)
{ {
#if LV_indev_proc_READ_PERIOD != 0 #if LV_INDEV_READ_PERIOD != 0
indev_proc_task_p = ptask_create(indev_proc_task, LV_indev_proc_READ_PERIOD, PTASK_PRIO_MID, NULL); indev_proc_task_p = ptask_create(indev_proc_task, LV_INDEV_READ_PERIOD, PTASK_PRIO_MID, NULL);
#else #else
indev_proc_task_p = ptask_create(indev_proc_task, 1, PTASK_PRIO_OFF); /*Not use lv_indev_proc*/ indev_proc_task_p = ptask_create(indev_proc_task, 1, PTASK_PRIO_OFF); /*Not use lv_indev_proc*/
#endif #endif
...@@ -63,21 +63,6 @@ void lv_indev_proc_init(void) ...@@ -63,21 +63,6 @@ void lv_indev_proc_init(void)
} }
/** /**
* Enable input devices device by type
* @param type Input device type
* @param enable true: enable this type; false: disable this type
*/
void lv_indev_enable(lv_hal_indev_type_t type, bool enable)
{
lv_indev_t *i = lv_indev_next(NULL);
while (i) {
if (i->drv.type == type) i->state.disable = enable == false ? 1 : 0;
i = lv_indev_next(i);
}
}
/**
* Get the currently processed input device. Can be used in action functions too. * Get the currently processed input device. Can be used in action functions too.
* @return pointer to the currently processed input device or NULL if no input device processing right now * @return pointer to the currently processed input device or NULL if no input device processing right now
*/ */
...@@ -114,6 +99,34 @@ void lv_indev_reset_lpr(lv_indev_t * indev_proc) ...@@ -114,6 +99,34 @@ void lv_indev_reset_lpr(lv_indev_t * indev_proc)
} }
/** /**
* Enable input devices device by type
* @param type Input device type
* @param enable true: enable this type; false: disable this type
*/
void lv_indev_enable(lv_hal_indev_type_t type, bool enable)
{
lv_indev_t *i = lv_indev_next(NULL);
while (i) {
if (i->drv.type == type) i->state.disable = enable == false ? 1 : 0;
i = lv_indev_next(i);
}
}
/**
* Enable input devices device by type
* @param indev pointer to an input device
* @param cur_obj pointer to an object to be used as cursor
*/
void lv_indev_set_cursor(lv_indev_t * indev, lv_obj_t * cur_obj)
{
indev->cursor = cur_obj;
lv_obj_set_parent(indev->cursor, lv_sys_layer());
lv_obj_set_pos(indev->cursor, indev->state.act_point.x, indev->state.act_point.y);
}
/**
* Get the last point of an input device * Get the last point of an input device
* @param indev pointer to an input device * @param indev pointer to an input device
* @param point pointer to a point to store the result * @param point pointer to a point to store the result
...@@ -186,10 +199,17 @@ static void indev_proc_task(void * param) ...@@ -186,10 +199,17 @@ static void indev_proc_task(void * param)
lv_indev_get(i, &data); lv_indev_get(i, &data);
i->state.pressed = data.state; i->state.pressed = data.state;
indev_proc_point(&i->state, data.point.x , data.point.y);
if(i->cursor != NULL &&
(i->state.last_point.x != data.point.x ||
i->state.last_point.y != data.point.y))
{
lv_obj_set_pos_us(i->cursor, data.point.x, data.point.y);
}
indev_proc_point(&i->state, data.point.x , data.point.y);
i = lv_indev_next(i); i = lv_indev_next(i);
} }
...@@ -213,12 +233,12 @@ static void indev_proc_point(lv_indev_state_t * indev, cord_t x, cord_t y) ...@@ -213,12 +233,12 @@ static void indev_proc_point(lv_indev_state_t * indev, cord_t x, cord_t y)
#endif #endif
if(indev->pressed != false){ if(indev->pressed != false){
#if LV_indev_proc_TP_MARKER != 0 #if LV_INDEV_TP_MARKER != 0
area_t area; area_t area;
area.x1 = x - (LV_indev_proc_TP_MARKER >> 1); area.x1 = x - (LV_INDEV_TP_MARKER >> 1);
area.y1 = y - (LV_indev_proc_TP_MARKER >> 1); area.y1 = y - (LV_INDEV_TP_MARKER >> 1);
area.x2 = x + ((LV_indev_proc_TP_MARKER >> 1) | 0x1); area.x2 = x + ((LV_INDEV_TP_MARKER >> 1) | 0x1);
area.y2 = y + ((LV_indev_proc_TP_MARKER >> 1) | 0x1); area.y2 = y + ((LV_INDEV_TP_MARKER >> 1) | 0x1);
lv_rfill(&area, NULL, COLOR_MAKE(0xFF, 0, 0), OPA_COVER); lv_rfill(&area, NULL, COLOR_MAKE(0xFF, 0, 0), OPA_COVER);
#endif #endif
indev_proc_press(indev); indev_proc_press(indev);
...@@ -226,7 +246,6 @@ static void indev_proc_point(lv_indev_state_t * indev, cord_t x, cord_t y) ...@@ -226,7 +246,6 @@ static void indev_proc_point(lv_indev_state_t * indev, cord_t x, cord_t y)
disi_proc_release(indev); disi_proc_release(indev);
} }
indev->last_point.x = indev->act_point.x; indev->last_point.x = indev->act_point.x;
indev->last_point.y = indev->act_point.y; indev->last_point.y = indev->act_point.y;
} }
...@@ -315,7 +334,7 @@ static void indev_proc_press(lv_indev_state_t * state) ...@@ -315,7 +334,7 @@ static void indev_proc_press(lv_indev_state_t * state)
/*If there is no drag then check for long press time*/ /*If there is no drag then check for long press time*/
if(state->drag_in_prog == 0 && state->long_press_sent == 0) { if(state->drag_in_prog == 0 && state->long_press_sent == 0) {
/*Send a signal about the long press if enough time elapsed*/ /*Send a signal about the long press if enough time elapsed*/
if(lv_tick_elaps(state->press_time_stamp) > LV_indev_proc_LONG_PRESS_TIME) { if(lv_tick_elaps(state->press_time_stamp) > LV_INDEV_LONG_PRESS_TIME) {
pr_obj->signal_f(pr_obj, LV_SIGNAL_LONG_PRESS, indev_act); pr_obj->signal_f(pr_obj, LV_SIGNAL_LONG_PRESS, indev_act);
/*Mark the signal sending to do not send it again*/ /*Mark the signal sending to do not send it again*/
...@@ -328,7 +347,7 @@ static void indev_proc_press(lv_indev_state_t * state) ...@@ -328,7 +347,7 @@ static void indev_proc_press(lv_indev_state_t * state)
/*Send long press repeated signal*/ /*Send long press repeated signal*/
if(state->drag_in_prog == 0 && state->long_press_sent == 1) { if(state->drag_in_prog == 0 && state->long_press_sent == 1) {
/*Send a signal about the long press repeate if enough time elapsed*/ /*Send a signal about the long press repeate if enough time elapsed*/
if(lv_tick_elaps(state->lpr_rep_time_stamp) > LV_indev_proc_LONG_PRESS_REP_TIME) { if(lv_tick_elaps(state->lpr_rep_time_stamp) > LV_INDEV_LONG_PRESS_REP_TIME) {
pr_obj->signal_f(pr_obj, LV_SIGNAL_LONG_PRESS_REP, indev_act); pr_obj->signal_f(pr_obj, LV_SIGNAL_LONG_PRESS_REP, indev_act);
state->lpr_rep_time_stamp = lv_tick_get(); state->lpr_rep_time_stamp = lv_tick_get();
...@@ -432,8 +451,8 @@ static void indev_drag(lv_indev_state_t * state) ...@@ -432,8 +451,8 @@ static void indev_drag(lv_indev_state_t * state)
state->vect_sum.y += state->vect.y; state->vect_sum.y += state->vect.y;
/*If a move is greater then LV_DRAG_LIMIT then begin the drag*/ /*If a move is greater then LV_DRAG_LIMIT then begin the drag*/
if(MATH_ABS(state->vect_sum.x) >= LV_indev_proc_DRAG_LIMIT || if(MATH_ABS(state->vect_sum.x) >= LV_INDEV_DRAG_LIMIT ||
MATH_ABS(state->vect_sum.y) >= LV_indev_proc_DRAG_LIMIT) MATH_ABS(state->vect_sum.y) >= LV_INDEV_DRAG_LIMIT)
{ {
state->drag_range_out = 1; state->drag_range_out = 1;
} }
...@@ -490,8 +509,8 @@ static void indev_drag_throw(lv_indev_state_t * state) ...@@ -490,8 +509,8 @@ static void indev_drag_throw(lv_indev_state_t * state)
} }
/*Reduce the vectors*/ /*Reduce the vectors*/
state->vect.x = state->vect.x * (100 -LV_indev_proc_DRAG_THROW) / 100; state->vect.x = state->vect.x * (100 -LV_INDEV_DRAG_THROW) / 100;
state->vect.y = state->vect.y * (100 -LV_indev_proc_DRAG_THROW) / 100; state->vect.y = state->vect.y * (100 -LV_INDEV_DRAG_THROW) / 100;
if(state->vect.x != 0 || if(state->vect.x != 0 ||
state->vect.y != 0) state->vect.y != 0)
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* *
*/ */
#ifndef LV_indev_proc_H #ifndef LV_INDEV_H
#define LV_indev_proc_H #define LV_INDEV_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
...@@ -39,7 +39,7 @@ typedef lv_action_res_t ( * lv_action_t) (struct __LV_OBJ_T * obj); ...@@ -39,7 +39,7 @@ typedef lv_action_res_t ( * lv_action_t) (struct __LV_OBJ_T * obj);
/** /**
* Initialize the display input subsystem * Initialize the display input subsystem
*/ */
void lv_indev_proc_init(void); void lv_indev_init(void);
/** /**
* Get the currently processed input device. Can be used in action functions too. * Get the currently processed input device. Can be used in action functions too.
...@@ -59,6 +59,13 @@ void lv_indev_reset(lv_indev_t * indev); ...@@ -59,6 +59,13 @@ void lv_indev_reset(lv_indev_t * indev);
void lv_indev_reset_lpr(lv_indev_t * indev_proc); void lv_indev_reset_lpr(lv_indev_t * indev_proc);
/** /**
* Enable input devices device by type
* @param indev pointer to an input device
* @param cur_obj pointer to an object to be used as cursor
*/
void lv_indev_set_cursor(lv_indev_t * indev, lv_obj_t * cur_obj);
/**
* Get the last point on display input * Get the last point on display input
* @param indev_proc pointer to a display input * @param indev_proc pointer to a display input
* @param point pointer to a point to store the result * @param point pointer to a point to store the result
...@@ -94,4 +101,4 @@ void lv_indev_wait_release(lv_indev_t * indev_proc); ...@@ -94,4 +101,4 @@ void lv_indev_wait_release(lv_indev_t * indev_proc);
} /* extern "C" */ } /* extern "C" */
#endif #endif
#endif /*LV_indev_proc_H*/ #endif /*LV_INDEV_H*/
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
/********************** /**********************
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
...@@ -43,6 +44,8 @@ static bool lv_obj_design(lv_obj_t * obj, const area_t * mask_p, lv_design_mode ...@@ -43,6 +44,8 @@ static bool lv_obj_design(lv_obj_t * obj, const area_t * mask_p, lv_design_mode
**********************/ **********************/
static lv_obj_t * def_scr = NULL; static lv_obj_t * def_scr = NULL;
static lv_obj_t * act_scr = NULL; static lv_obj_t * act_scr = NULL;
static lv_obj_t * top_layer = NULL;
static lv_obj_t * sys_layer = NULL;
static ll_dsc_t scr_ll; static ll_dsc_t scr_ll;
#ifdef LV_IMG_DEF_WALLPAPER #ifdef LV_IMG_DEF_WALLPAPER
...@@ -86,12 +89,18 @@ void lv_init(void) ...@@ -86,12 +89,18 @@ void lv_init(void)
#endif #endif
act_scr = def_scr; act_scr = def_scr;
top_layer = lv_obj_create(NULL, NULL);
lv_obj_set_style(top_layer, lv_style_get(LV_STYLE_TRANSP_TIGHT, NULL));
sys_layer = lv_obj_create(NULL, NULL);
lv_obj_set_style(sys_layer, lv_style_get(LV_STYLE_TRANSP_TIGHT, NULL));
/*Refresh the screen*/ /*Refresh the screen*/
lv_obj_inv(act_scr); lv_obj_inv(act_scr);
#if LV_indev_proc_READ_PERIOD != 0 #if LV_INDEV_READ_PERIOD != 0
/*Init the input device handling*/ /*Init the input device handling*/
lv_indev_proc_init(); lv_indev_init();
#endif #endif
/*Initialize the application level*/ /*Initialize the application level*/
...@@ -354,8 +363,10 @@ bool lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param) ...@@ -354,8 +363,10 @@ bool lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
void lv_obj_inv(lv_obj_t * obj) void lv_obj_inv(lv_obj_t * obj)
{ {
/*Invalidate the object only if it belongs to the 'act_scr'*/ /*Invalidate the object only if it belongs to the 'act_scr'*/
lv_obj_t * act_scr_p = lv_scr_act(); lv_obj_t * obj_scr = lv_obj_get_scr(obj);
if(lv_obj_get_scr(obj) == act_scr_p) { if(obj_scr == lv_scr_act() ||
obj_scr == lv_top_layer() ||
obj_scr == lv_sys_layer()) {
/*Truncate recursively to the parents*/ /*Truncate recursively to the parents*/
area_t area_trunc; area_t area_trunc;
lv_obj_t * par = lv_obj_get_parent(obj); lv_obj_t * par = lv_obj_get_parent(obj);
...@@ -376,7 +387,7 @@ void lv_obj_inv(lv_obj_t * obj) ...@@ -376,7 +387,7 @@ void lv_obj_inv(lv_obj_t * obj)
par = lv_obj_get_parent(par); par = lv_obj_get_parent(par);
} }
if(union_ok != false) lv_inv_area(&area_trunc); if(union_ok != false) lv_inv_area(&area_trunc);
} }
} }
...@@ -1090,7 +1101,7 @@ void lv_obj_anim(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t ...@@ -1090,7 +1101,7 @@ void lv_obj_anim(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t
/** /**
* Return with the actual screen * Return with the actual screen
* @return pointer to to the actual screen object * @return pointer to the actual screen object
*/ */
lv_obj_t * lv_scr_act(void) lv_obj_t * lv_scr_act(void)
{ {
...@@ -1098,6 +1109,25 @@ lv_obj_t * lv_scr_act(void) ...@@ -1098,6 +1109,25 @@ lv_obj_t * lv_scr_act(void)
} }
/** /**
* Return with the top layer. (Same on every screen and it is above the normal screen layer)
* @return pointer to the top layer object (transparent screen sized lv_obj)
*/
lv_obj_t * lv_top_layer(void)
{
return top_layer;
}
/**
* Return with the system layer. (Same on every screen and it is above the all other layers)
* It is used for example by the cursor
* @return pointer to the system layer object (transparent screen sized lv_obj)
*/
lv_obj_t * lv_sys_layer(void)
{
return sys_layer;
}
/**
* Return with the screen of an object * Return with the screen of an object
* @param obj pointer to an object * @param obj pointer to an object
* @return pointer to a screen * @return pointer to a screen
...@@ -1269,6 +1299,9 @@ lv_style_t * lv_obj_get_style(lv_obj_t * obj) ...@@ -1269,6 +1299,9 @@ lv_style_t * lv_obj_get_style(lv_obj_t * obj)
} }
} }
#endif #endif
if(style_act == NULL) style_act = lv_style_get(LV_STYLE_PLAIN, NULL);
return style_act; return style_act;
} }
......
...@@ -491,7 +491,14 @@ void lv_obj_anim(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t ...@@ -491,7 +491,14 @@ void lv_obj_anim(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t
* Return with the actual screen * Return with the actual screen
* @return pointer to to the actual screen object * @return pointer to to the actual screen object
*/ */
lv_obj_t * lv_scr_act(void); lv_obj_t * lv_scr_act(void);lv_obj_t * lv_top_layer(void);
/**
* Return with the system layer. (Same on every screen and it is above the all other layers)
* It is used for example by the cursor
* @return pointer to the system layer object (transparent screen sized lv_obj)
*/
lv_obj_t * lv_sys_layer(void);
/** /**
* Return with the screen of an object * Return with the screen of an object
......
...@@ -315,6 +315,11 @@ static void lv_refr_area_part_vdb(const area_t * area_p) ...@@ -315,6 +315,11 @@ static void lv_refr_area_part_vdb(const area_t * area_p)
/*Do the refreshing from the top object*/ /*Do the refreshing from the top object*/
lv_refr_make(top_p, &start_mask); lv_refr_make(top_p, &start_mask);
/*Also refresh top and sys layer unconditionally*/
lv_refr_make(lv_top_layer(), &start_mask);
lv_refr_make(lv_sys_layer(), &start_mask);
/*Flush the content of the VDB*/ /*Flush the content of the VDB*/
lv_vdb_flush(); lv_vdb_flush();
} }
......
...@@ -514,11 +514,11 @@ static void tabpage_pressing_hadler(lv_obj_t * tabview, lv_obj_t * tabpage) ...@@ -514,11 +514,11 @@ static void tabpage_pressing_hadler(lv_obj_t * tabview, lv_obj_t * tabpage)
cord_t y_diff = point_act.y - ext->point_last.y; cord_t y_diff = point_act.y - ext->point_last.y;
if(ext->draging == 0) { if(ext->draging == 0) {
if(x_diff >= LV_indev_proc_DRAG_LIMIT || x_diff<= -LV_indev_proc_DRAG_LIMIT) { if(x_diff >= LV_INDEV_DRAG_LIMIT || x_diff<= -LV_INDEV_DRAG_LIMIT) {
ext->drag_h = 1; ext->drag_h = 1;
ext->draging = 1; ext->draging = 1;
lv_obj_set_drag(lv_page_get_scrl(tabpage), false); lv_obj_set_drag(lv_page_get_scrl(tabpage), false);
} else if(y_diff >= LV_indev_proc_DRAG_LIMIT || y_diff <= -LV_indev_proc_DRAG_LIMIT) { } else if(y_diff >= LV_INDEV_DRAG_LIMIT || y_diff <= -LV_INDEV_DRAG_LIMIT) {
ext->drag_h = 0; ext->drag_h = 0;
ext->draging = 1; ext->draging = 1;
} }
...@@ -559,7 +559,7 @@ static void tabpage_press_lost_hadler(lv_obj_t * tabview, lv_obj_t * tabpage) ...@@ -559,7 +559,7 @@ static void tabpage_press_lost_hadler(lv_obj_t * tabview, lv_obj_t * tabpage)
while(x_diff != 0) { while(x_diff != 0) {
x_predict += x_diff; x_predict += x_diff;
x_diff = x_diff * (100 - LV_indev_proc_DRAG_THROW) / 100; x_diff = x_diff * (100 - LV_INDEV_DRAG_THROW) / 100;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment