1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00

Merge branch 'indev_focus_fix' of https://github.com/joltwallet/lvgl into joltwallet-indev_focus_fix

This commit is contained in:
Gabor Kiss-Vamosi 2019-05-21 15:29:42 +02:00
commit f42e6b82c4
10 changed files with 171 additions and 146 deletions

View File

@ -42,11 +42,15 @@ static void indev_proc_reset_query_handler(lv_indev_t * indev);
static lv_obj_t * indev_search_obj(const lv_indev_proc_t * proc, lv_obj_t * obj); static lv_obj_t * indev_search_obj(const lv_indev_proc_t * proc, lv_obj_t * obj);
static void indev_drag(lv_indev_proc_t * state); static void indev_drag(lv_indev_proc_t * state);
static void indev_drag_throw(lv_indev_proc_t * proc); static void indev_drag_throw(lv_indev_proc_t * proc);
static bool indev_reset_check(lv_indev_proc_t *proc);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static lv_indev_t * indev_act; static lv_indev_t * indev_act;
#if LV_USE_GROUP
static lv_obj_t * indev_obj_act = NULL;
#endif
/********************** /**********************
* MACROS * MACROS
@ -310,6 +314,19 @@ lv_task_t * lv_indev_get_read_task(lv_disp_t * indev)
return indev->refr_task; return indev->refr_task;
} }
/**
* Gets a pointer to the currently active object in indev proc functions.
* NULL if no object is currently being handled or if groups aren't used.
* @return pointer to currently focused object
*/
lv_obj_t * lv_indev_get_obj_act( void ) {
#if LV_USE_GROUP
return indev_obj_act;
#else
return NULL;
#endif
}
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
@ -360,8 +377,8 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
lv_group_t * g = i->group; lv_group_t * g = i->group;
if(g == NULL) return; if(g == NULL) return;
lv_obj_t * focused = lv_group_get_focused(g); indev_obj_act = lv_group_get_focused(g);
if(focused == NULL) return; if(indev_obj_act == NULL) return;
/*Save the last key to compare it with the current latter on RELEASE*/ /*Save the last key to compare it with the current latter on RELEASE*/
uint32_t prev_key = i->proc.types.keypad.last_key; uint32_t prev_key = i->proc.types.keypad.last_key;
@ -385,30 +402,30 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
/*Send the ENTER as a normal KEY*/ /*Send the ENTER as a normal KEY*/
lv_group_send_data(g, LV_KEY_ENTER); lv_group_send_data(g, LV_KEY_ENTER);
focused->signal_cb(focused, LV_SIGNAL_PRESSED, NULL); indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_PRESSED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
lv_event_send(focused, LV_EVENT_PRESSED, NULL); lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
} else if(data->key == LV_KEY_ESC) { } else if(data->key == LV_KEY_ESC) {
/*Send the ESC as a normal KEY*/ /*Send the ESC as a normal KEY*/
lv_group_send_data(g, LV_KEY_ESC); lv_group_send_data(g, LV_KEY_ESC);
lv_event_send(focused, LV_EVENT_CANCEL, NULL); lv_event_send(indev_obj_act, LV_EVENT_CANCEL, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
} }
/*Move the focus on NEXT*/ /*Move the focus on NEXT*/
else if(data->key == LV_KEY_NEXT) { else if(data->key == LV_KEY_NEXT) {
lv_group_set_editing(g, lv_group_set_editing(g,
false); /*Editing is not used by KEYPAD is be sure it is disabled*/ false); /*Editing is not used by KEYPAD is be sure it is disabled*/
lv_group_focus_next(g); lv_group_focus_next(g);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
} }
/*Move the focus on PREV*/ /*Move the focus on PREV*/
else if(data->key == LV_KEY_PREV) { else if(data->key == LV_KEY_PREV) {
lv_group_set_editing(g, lv_group_set_editing(g,
false); /*Editing is not used by KEYPAD is be sure it is disabled*/ false); /*Editing is not used by KEYPAD is be sure it is disabled*/
lv_group_focus_prev(g); lv_group_focus_prev(g);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
} }
/*Just send other keys to the object (e.g. 'A' or `LV_GROUP_KEY_RIGHT`)*/ /*Just send other keys to the object (e.g. 'A' or `LV_GROUP_KEY_RIGHT`)*/
else { else {
@ -423,10 +440,10 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
i->proc.long_pr_sent = 1; i->proc.long_pr_sent = 1;
if(data->key == LV_KEY_ENTER) { if(data->key == LV_KEY_ENTER) {
i->proc.longpr_rep_timestamp = lv_tick_get(); i->proc.longpr_rep_timestamp = lv_tick_get();
focused->signal_cb(focused, LV_SIGNAL_LONG_PRESS, NULL); indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
lv_event_send(focused, LV_EVENT_LONG_PRESSED, NULL); lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
} }
} }
/*Long press repeated time has elapsed?*/ /*Long press repeated time has elapsed?*/
@ -437,29 +454,29 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
/*Send LONG_PRESS_REP on ENTER*/ /*Send LONG_PRESS_REP on ENTER*/
if(data->key == LV_KEY_ENTER) { if(data->key == LV_KEY_ENTER) {
focused->signal_cb(focused, LV_SIGNAL_LONG_PRESS_REP, NULL); indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS_REP, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
lv_event_send(focused, LV_EVENT_LONG_PRESSED_REPEAT, NULL); lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
} }
/*Move the focus on NEXT again*/ /*Move the focus on NEXT again*/
else if(data->key == LV_KEY_NEXT) { else if(data->key == LV_KEY_NEXT) {
lv_group_set_editing( lv_group_set_editing(
g, false); /*Editing is not used by KEYPAD is be sure it is disabled*/ g, false); /*Editing is not used by KEYPAD is be sure it is disabled*/
lv_group_focus_next(g); lv_group_focus_next(g);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
} }
/*Move the focus on PREV again*/ /*Move the focus on PREV again*/
else if(data->key == LV_KEY_PREV) { else if(data->key == LV_KEY_PREV) {
lv_group_set_editing( lv_group_set_editing(
g, false); /*Editing is not used by KEYPAD is be sure it is disabled*/ g, false); /*Editing is not used by KEYPAD is be sure it is disabled*/
lv_group_focus_prev(g); lv_group_focus_prev(g);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
} }
/*Just send other keys again to the object (e.g. 'A' or `LV_GORUP_KEY_RIGHT)*/ /*Just send other keys again to the object (e.g. 'A' or `LV_GORUP_KEY_RIGHT)*/
else { else {
lv_group_send_data(g, data->key); lv_group_send_data(g, data->key);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
} }
} }
} }
@ -469,23 +486,24 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
data->key = prev_key; data->key = prev_key;
if(data->key == LV_KEY_ENTER) { if(data->key == LV_KEY_ENTER) {
focused->signal_cb(focused, LV_SIGNAL_RELEASED, NULL); indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
if(i->proc.long_pr_sent == 0) { if(i->proc.long_pr_sent == 0) {
lv_event_send(focused, LV_EVENT_SHORT_CLICKED, NULL); lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
} }
lv_event_send(focused, LV_EVENT_CLICKED, NULL); lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
lv_event_send(focused, LV_EVENT_RELEASED, NULL); lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
} }
i->proc.pr_timestamp = 0; i->proc.pr_timestamp = 0;
i->proc.long_pr_sent = 0; i->proc.long_pr_sent = 0;
} }
indev_obj_act = NULL;
#else #else
(void)data; /*Unused*/ (void)data; /*Unused*/
(void)i; /*Unused*/ (void)i; /*Unused*/
@ -519,10 +537,8 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
lv_group_t * g = i->group; lv_group_t * g = i->group;
if(g == NULL) return; if(g == NULL) return;
lv_obj_t * focused = lv_group_get_focused(g); indev_obj_act = lv_group_get_focused(g);
if(focused == NULL) return; if(indev_obj_act == NULL) return;
/*Process the steps first. They are valid only with released button*/ /*Process the steps first. They are valid only with released button*/
if(data->state == LV_INDEV_STATE_REL) { if(data->state == LV_INDEV_STATE_REL) {
@ -547,21 +563,21 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
} }
/*Refresh the focused object. It might change due to lv_group_focus_prev/next*/ /*Refresh the focused object. It might change due to lv_group_focus_prev/next*/
focused = lv_group_get_focused(g); indev_obj_act = lv_group_get_focused(g);
if(focused == NULL) return; if(indev_obj_act == NULL) return;
/*Button press happened*/ /*Button press happened*/
if(data->state == LV_INDEV_STATE_PR && last_state == LV_INDEV_STATE_REL) { if(data->state == LV_INDEV_STATE_PR && last_state == LV_INDEV_STATE_REL) {
bool editable = false; bool editable = false;
focused->signal_cb(focused, LV_SIGNAL_GET_EDITABLE, &editable); indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
i->proc.pr_timestamp = lv_tick_get(); i->proc.pr_timestamp = lv_tick_get();
if(lv_group_get_editing(g) == true || editable == false) { if(lv_group_get_editing(g) == true || editable == false) {
focused->signal_cb(focused, LV_SIGNAL_PRESSED, NULL); indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_PRESSED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
lv_event_send(focused, LV_EVENT_PRESSED, NULL); lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
} }
} }
/*Pressing*/ /*Pressing*/
@ -570,7 +586,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
if(i->proc.long_pr_sent == 0 && if(i->proc.long_pr_sent == 0 &&
lv_tick_elaps(i->proc.pr_timestamp) > i->driver.long_press_time) { lv_tick_elaps(i->proc.pr_timestamp) > i->driver.long_press_time) {
bool editable = false; bool editable = false;
focused->signal_cb(focused, LV_SIGNAL_GET_EDITABLE, &editable); indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
/*On enter long press toggle edit mode.*/ /*On enter long press toggle edit mode.*/
if(editable) { if(editable) {
@ -583,10 +599,10 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
} }
/*If not editable then just send a long press signal*/ /*If not editable then just send a long press signal*/
else { else {
focused->signal_cb(focused, LV_SIGNAL_LONG_PRESS, NULL); indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
lv_event_send(focused, LV_EVENT_LONG_PRESSED, NULL); lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
} }
i->proc.long_pr_sent = 1; i->proc.long_pr_sent = 1;
} }
@ -596,37 +612,37 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
last_state == LV_INDEV_STATE_PR) { last_state == LV_INDEV_STATE_PR) {
bool editable = false; bool editable = false;
focused->signal_cb(focused, LV_SIGNAL_GET_EDITABLE, &editable); indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
/*The button was released on a non-editable object. Just send enter*/ /*The button was released on a non-editable object. Just send enter*/
if(editable == false) { if(editable == false) {
focused->signal_cb(focused, LV_SIGNAL_RELEASED, NULL); indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
if(i->proc.long_pr_sent == 0) lv_event_send(focused, LV_EVENT_SHORT_CLICKED, NULL); if(i->proc.long_pr_sent == 0) lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
lv_event_send(focused, LV_EVENT_CLICKED, NULL); lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
lv_event_send(focused, LV_EVENT_RELEASED, NULL); lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
} }
/*An object is being edited and the button is released. */ /*An object is being edited and the button is released. */
else if(g->editing) { else if(g->editing) {
/*Ignore long pressed enter release because it comes from mode switch*/ /*Ignore long pressed enter release because it comes from mode switch*/
if(!i->proc.long_pr_sent || lv_ll_is_empty(&g->obj_ll)) { if(!i->proc.long_pr_sent || lv_ll_is_empty(&g->obj_ll)) {
focused->signal_cb(focused, LV_SIGNAL_RELEASED, NULL); indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
lv_event_send(focused, LV_EVENT_SHORT_CLICKED, NULL); lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
lv_event_send(focused, LV_EVENT_CLICKED, NULL); lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
lv_event_send(focused, LV_EVENT_RELEASED, NULL); lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
if(i->proc.reset_query) return; /*The object might be deleted*/ if(indev_reset_check(&i->proc)) return;
lv_group_send_data(g, LV_KEY_ENTER); lv_group_send_data(g, LV_KEY_ENTER);
} }
@ -640,7 +656,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
i->proc.pr_timestamp = 0; i->proc.pr_timestamp = 0;
i->proc.long_pr_sent = 0; i->proc.long_pr_sent = 0;
} }
indev_obj_act = NULL;
#else #else
(void)data; /*Unused*/ (void)data; /*Unused*/
(void)i; /*Unused*/ (void)i; /*Unused*/
@ -713,9 +729,9 @@ static void indev_proc_press(lv_indev_proc_t * proc)
if(proc->types.pointer.act_obj != NULL) { if(proc->types.pointer.act_obj != NULL) {
proc->types.pointer.act_obj->signal_cb(proc->types.pointer.act_obj, proc->types.pointer.act_obj->signal_cb(proc->types.pointer.act_obj,
LV_SIGNAL_PRESS_LOST, indev_act); LV_SIGNAL_PRESS_LOST, indev_act);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
lv_event_send(proc->types.pointer.act_obj, LV_EVENT_PRESS_LOST, NULL); lv_event_send(proc->types.pointer.act_obj, LV_EVENT_PRESS_LOST, NULL);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
} }
proc->types.pointer.act_obj = pr_obj; /*Save the pressed object*/ proc->types.pointer.act_obj = pr_obj; /*Save the pressed object*/
@ -750,9 +766,9 @@ static void indev_proc_press(lv_indev_proc_t * proc)
/*Send a signal about the press*/ /*Send a signal about the press*/
proc->types.pointer.act_obj->signal_cb(proc->types.pointer.act_obj, LV_SIGNAL_PRESSED, proc->types.pointer.act_obj->signal_cb(proc->types.pointer.act_obj, LV_SIGNAL_PRESSED,
indev_act); indev_act);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
lv_event_send(proc->types.pointer.act_obj, LV_EVENT_PRESSED, NULL); lv_event_send(proc->types.pointer.act_obj, LV_EVENT_PRESSED, NULL);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
} }
} }
@ -778,23 +794,23 @@ static void indev_proc_press(lv_indev_proc_t * proc)
/*If there is active object and it can be dragged run the drag*/ /*If there is active object and it can be dragged run the drag*/
if(proc->types.pointer.act_obj != NULL) { if(proc->types.pointer.act_obj != NULL) {
proc->types.pointer.act_obj->signal_cb(proc->types.pointer.act_obj, LV_SIGNAL_PRESSING, proc->types.pointer.act_obj->signal_cb(proc->types.pointer.act_obj,
indev_act); LV_SIGNAL_PRESSING, indev_act);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
lv_event_send(proc->types.pointer.act_obj, LV_EVENT_PRESSING, NULL); lv_event_send(proc->types.pointer.act_obj, LV_EVENT_PRESSING, NULL);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
indev_drag(proc); indev_drag(proc);
if(proc->reset_query != 0) return; if(indev_reset_check(proc)) return;
/*If there is no drag then check for long press time*/ /*If there is no drag then check for long press time*/
if(proc->types.pointer.drag_in_prog == 0 && proc->long_pr_sent == 0) { if(proc->types.pointer.drag_in_prog == 0 && proc->long_pr_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(proc->pr_timestamp) > indev_act->driver.long_press_time) { if(lv_tick_elaps(proc->pr_timestamp) > indev_act->driver.long_press_time) {
pr_obj->signal_cb(pr_obj, LV_SIGNAL_LONG_PRESS, indev_act); pr_obj->signal_cb(pr_obj, LV_SIGNAL_LONG_PRESS, indev_act);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
lv_event_send(pr_obj, LV_EVENT_LONG_PRESSED, NULL); lv_event_send(pr_obj, LV_EVENT_LONG_PRESSED, NULL);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
/*Mark the signal sending to do not send it again*/ /*Mark the signal sending to do not send it again*/
proc->long_pr_sent = 1; proc->long_pr_sent = 1;
@ -808,9 +824,9 @@ static void indev_proc_press(lv_indev_proc_t * proc)
/*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(proc->longpr_rep_timestamp) > indev_act->driver.long_press_rep_time) { if(lv_tick_elaps(proc->longpr_rep_timestamp) > indev_act->driver.long_press_rep_time) {
pr_obj->signal_cb(pr_obj, LV_SIGNAL_LONG_PRESS_REP, indev_act); pr_obj->signal_cb(pr_obj, LV_SIGNAL_LONG_PRESS_REP, indev_act);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
lv_event_send(pr_obj, LV_EVENT_LONG_PRESSED_REPEAT, NULL); lv_event_send(pr_obj, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
proc->longpr_rep_timestamp = lv_tick_get(); proc->longpr_rep_timestamp = lv_tick_get();
} }
} }
@ -840,41 +856,41 @@ static void indev_proc_release(lv_indev_proc_t * proc)
if(lv_obj_is_protected(proc->types.pointer.act_obj, LV_PROTECT_PRESS_LOST)) { if(lv_obj_is_protected(proc->types.pointer.act_obj, LV_PROTECT_PRESS_LOST)) {
proc->types.pointer.act_obj->signal_cb(proc->types.pointer.act_obj, LV_SIGNAL_RELEASED, proc->types.pointer.act_obj->signal_cb(proc->types.pointer.act_obj, LV_SIGNAL_RELEASED,
indev_act); indev_act);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
if(proc->types.pointer.drag_in_prog == 0) { if(proc->types.pointer.drag_in_prog == 0) {
if(proc->long_pr_sent == 0) { if(proc->long_pr_sent == 0) {
lv_event_send(proc->types.pointer.act_obj, LV_EVENT_SHORT_CLICKED, NULL); lv_event_send(proc->types.pointer.act_obj, LV_EVENT_SHORT_CLICKED, NULL);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
} }
lv_event_send(proc->types.pointer.act_obj, LV_EVENT_CLICKED, NULL); lv_event_send(proc->types.pointer.act_obj, LV_EVENT_CLICKED, NULL);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
} }
lv_event_send(proc->types.pointer.act_obj, LV_EVENT_RELEASED, NULL); lv_event_send(proc->types.pointer.act_obj, LV_EVENT_RELEASED, NULL);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
} }
/* The simple case: `act_obj` was not protected against press lost. /* The simple case: `act_obj` was not protected against press lost.
* If it is already not pressed then was `indev_proc_press` would set `act_obj = NULL`*/ * If it is already not pressed then was `indev_proc_press` would set `act_obj = NULL`*/
else { else {
proc->types.pointer.act_obj->signal_cb(proc->types.pointer.act_obj, LV_SIGNAL_RELEASED, proc->types.pointer.act_obj->signal_cb(proc->types.pointer.act_obj, LV_SIGNAL_RELEASED,
indev_act); indev_act);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
if(proc->long_pr_sent == 0 && proc->types.pointer.drag_in_prog == 0) { if(proc->long_pr_sent == 0 && proc->types.pointer.drag_in_prog == 0) {
lv_event_send(proc->types.pointer.act_obj, LV_EVENT_SHORT_CLICKED, NULL); lv_event_send(proc->types.pointer.act_obj, LV_EVENT_SHORT_CLICKED, NULL);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
} }
lv_event_send(proc->types.pointer.act_obj, LV_EVENT_CLICKED, NULL); lv_event_send(proc->types.pointer.act_obj, LV_EVENT_CLICKED, NULL);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
lv_event_send(proc->types.pointer.act_obj, LV_EVENT_RELEASED, NULL); lv_event_send(proc->types.pointer.act_obj, LV_EVENT_RELEASED, NULL);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
} }
if(proc->reset_query != 0) return; if(indev_reset_check(proc)) return;
/*Handle click focus*/ /*Handle click focus*/
#if LV_USE_GROUP #if LV_USE_GROUP
@ -912,16 +928,15 @@ static void indev_proc_release(lv_indev_proc_t * proc)
* a focus/defucus signal because of `click focus`*/ * a focus/defucus signal because of `click focus`*/
if(proc->types.pointer.last_pressed != proc->types.pointer.act_obj) { if(proc->types.pointer.last_pressed != proc->types.pointer.act_obj) {
lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_DEFOCUSED, NULL); lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_DEFOCUSED, NULL);
if(proc->reset_query) if(indev_reset_check(proc)) return;
return; /*Not so strict as it's only the previous object and indev not uses it.*/
lv_event_send(proc->types.pointer.act_obj, LV_EVENT_FOCUSED, NULL); lv_event_send(proc->types.pointer.act_obj, LV_EVENT_FOCUSED, NULL);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
proc->types.pointer.last_pressed = proc->types.pointer.act_obj; proc->types.pointer.last_pressed = proc->types.pointer.act_obj;
} }
if(proc->reset_query != 0) return; if(indev_reset_check(proc)) return;
proc->types.pointer.act_obj = NULL; proc->types.pointer.act_obj = NULL;
proc->pr_timestamp = 0; proc->pr_timestamp = 0;
proc->longpr_rep_timestamp = 0; proc->longpr_rep_timestamp = 0;
@ -931,7 +946,7 @@ static void indev_proc_release(lv_indev_proc_t * proc)
* In case of reset query ignore the remaining parts.*/ * In case of reset query ignore the remaining parts.*/
if(proc->types.pointer.last_obj != NULL && proc->reset_query == 0) { if(proc->types.pointer.last_obj != NULL && proc->reset_query == 0) {
indev_drag_throw(proc); indev_drag_throw(proc);
if(proc->reset_query != 0) return; if(indev_reset_check(proc)) return;
} }
} }
@ -1094,9 +1109,9 @@ static void indev_drag(lv_indev_proc_t * state)
/*Send the drag begin signal on first move*/ /*Send the drag begin signal on first move*/
if(state->types.pointer.drag_in_prog == 0) { if(state->types.pointer.drag_in_prog == 0) {
drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_BEGIN, indev_act); drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_BEGIN, indev_act);
if(state->reset_query != 0) return; if(indev_reset_check(state)) return;
lv_event_send(drag_obj, LV_EVENT_DRAG_BEGIN, NULL); lv_event_send(drag_obj, LV_EVENT_DRAG_BEGIN, NULL);
if(state->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(state)) return;
} }
state->types.pointer.drag_in_prog = 1; state->types.pointer.drag_in_prog = 1;
@ -1143,7 +1158,7 @@ static void indev_drag_throw(lv_indev_proc_t * proc)
proc->types.pointer.drag_in_prog = 0; proc->types.pointer.drag_in_prog = 0;
drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_END, indev_act); drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_END, indev_act);
lv_event_send(drag_obj, LV_EVENT_DRAG_END, NULL); lv_event_send(drag_obj, LV_EVENT_DRAG_END, NULL);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
lv_event_send(drag_obj, LV_EVENT_DRAG_END, NULL); lv_event_send(drag_obj, LV_EVENT_DRAG_END, NULL);
return; return;
@ -1183,9 +1198,9 @@ static void indev_drag_throw(lv_indev_proc_t * proc)
proc->types.pointer.drag_throw_vect.x = 0; proc->types.pointer.drag_throw_vect.x = 0;
proc->types.pointer.drag_throw_vect.y = 0; proc->types.pointer.drag_throw_vect.y = 0;
drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_END, indev_act); drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_END, indev_act);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
lv_event_send(drag_obj, LV_EVENT_DRAG_END, NULL); lv_event_send(drag_obj, LV_EVENT_DRAG_END, NULL);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
} }
} }
/*If the types.pointer.vectors become 0 -> types.pointer.drag_in_prog = 0 and send a drag end /*If the types.pointer.vectors become 0 -> types.pointer.drag_in_prog = 0 and send a drag end
@ -1193,8 +1208,22 @@ static void indev_drag_throw(lv_indev_proc_t * proc)
else { else {
proc->types.pointer.drag_in_prog = 0; proc->types.pointer.drag_in_prog = 0;
drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_END, indev_act); drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_END, indev_act);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
lv_event_send(drag_obj, LV_EVENT_DRAG_END, NULL); lv_event_send(drag_obj, LV_EVENT_DRAG_END, NULL);
if(proc->reset_query) return; /*The object might be deleted*/ if(indev_reset_check(proc)) return;
} }
} }
/**
* Checks if the reset_query flag has been set. If so, perform necessary global indev cleanup actions
* @param proc pointer to an input device 'proc'
* return true if indev query should be immediately truncated.
*/
static bool indev_reset_check(lv_indev_proc_t *proc) {
#if LV_USE_GROUP
if(proc->reset_query) {
indev_obj_act = NULL;
}
#endif
return proc->reset_query;
}

View File

@ -141,6 +141,13 @@ void lv_indev_wait_release(lv_indev_t * indev);
*/ */
lv_task_t * lv_indev_get_read_task(lv_disp_t * indev); lv_task_t * lv_indev_get_read_task(lv_disp_t * indev);
/**
* Gets a pointer to the currently active object in indev proc functions.
* NULL if no object is currently being handled or if groups aren't used.
* @return pointer to currently active object
*/
lv_obj_t * lv_indev_get_obj_act( void );
/********************** /**********************
* MACROS * MACROS
**********************/ **********************/

View File

@ -378,13 +378,8 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
/*Delete from the group*/ /*Delete from the group*/
#if LV_USE_GROUP #if LV_USE_GROUP
bool was_focused = false;
lv_group_t * group = lv_obj_get_group(obj); lv_group_t * group = lv_obj_get_group(obj);
if(group) lv_group_remove_obj(obj);
if(group) {
if(lv_group_get_focused(group) == obj) was_focused = true;
lv_group_remove_obj(obj);
}
#endif #endif
/*Remove the animations from this object*/ /*Remove the animations from this object*/
@ -432,7 +427,7 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
} }
#if LV_USE_GROUP #if LV_USE_GROUP
if(indev->group == group && was_focused) { if(indev->group == group && obj == lv_indev_get_obj_act() ) {
lv_indev_reset(indev); lv_indev_reset(indev);
} }
#endif #endif
@ -2197,15 +2192,11 @@ static void delete_children(lv_obj_t * obj)
* the object still has access to all children during the * the object still has access to all children during the
* LV_SIGNAL_DEFOCUS call*/ * LV_SIGNAL_DEFOCUS call*/
#if LV_USE_GROUP #if LV_USE_GROUP
bool was_focused = false;
lv_group_t * group = lv_obj_get_group(obj); lv_group_t * group = lv_obj_get_group(obj);
if(group) lv_group_remove_obj(obj);
if(group) {
if(lv_group_get_focused(obj->group_p) == obj) was_focused = true;
lv_group_remove_obj(obj);
}
#endif #endif
while(i != NULL) { while(i != NULL) {
/*Get the next object before delete this*/ /*Get the next object before delete this*/
i_next = lv_ll_get_next(&(obj->child_ll), i); i_next = lv_ll_get_next(&(obj->child_ll), i);
@ -2239,7 +2230,7 @@ static void delete_children(lv_obj_t * obj)
indev->proc.types.pointer.last_pressed = NULL; indev->proc.types.pointer.last_pressed = NULL;
} }
#if LV_USE_GROUP #if LV_USE_GROUP
if(indev->group == group && was_focused) { if(indev->group == group && obj == lv_indev_get_obj_act() ) {
lv_indev_reset(indev); lv_indev_reset(indev);
} }
#endif #endif

View File

@ -31,7 +31,7 @@
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
static void style_animator(lv_style_anim_dsc_t * dsc, int32_t val); static void style_animator(lv_style_anim_dsc_t * dsc, int16_t val);
static void style_animation_common_end_cb(lv_anim_t * a); static void style_animation_common_end_cb(lv_anim_t * a);
#endif #endif
@ -316,9 +316,9 @@ void lv_style_anim_set_styles(lv_anim_t * a, lv_style_t * to_anim, const lv_styl
/** /**
* Used by the style animations to set the values of a style according to start and end style. * Used by the style animations to set the values of a style according to start and end style.
* @param dsc the 'animated variable' set by lv_style_anim_create() * @param dsc the 'animated variable' set by lv_style_anim_create()
* @param val the current state of the animation between 0 and LV_STYLE_ANIM_RES * @param val the current state of the animation between 0 and LV_ANIM_RESOLUTION
*/ */
static void style_animator(lv_style_anim_dsc_t * dsc, int32_t val) static void style_animator(lv_style_anim_dsc_t * dsc, int16_t val)
{ {
const lv_style_t * start = &dsc->style_start; const lv_style_t * start = &dsc->style_start;
const lv_style_t * end = &dsc->style_end; const lv_style_t * end = &dsc->style_end;

View File

@ -30,7 +30,7 @@
static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode_t mode); static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode_t mode);
static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param); static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param);
static void lv_bar_animate(void * bar, int32_t value); static void lv_bar_anim(void * bar, int16_t value);
static void lv_bar_anim_ready(lv_anim_t * a); static void lv_bar_anim_ready(lv_anim_t * a);
/********************** /**********************
@ -158,9 +158,9 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value, bool anim)
a.var = bar; a.var = bar;
a.start = LV_BAR_ANIM_STATE_START; a.start = LV_BAR_ANIM_STATE_START;
a.end = LV_BAR_ANIM_STATE_END; a.end = LV_BAR_ANIM_STATE_END;
a.exec_cb = (lv_anim_exec_cb_t)lv_bar_animate; a.exec_cb = (lv_anim_exec_cb_t)lv_bar_anim;
a.path_cb = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.ready_cb = lv_bar_anim_ready; a.ready_cb = lv_bar_anim_ready;
a.act_time = 0; a.act_time = 0;
a.time = ext->anim_time; a.time = ext->anim_time;
a.playback = 0; a.playback = 0;
@ -475,7 +475,7 @@ static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param)
return res; return res;
} }
static void lv_bar_animate(void * bar, int32_t value) static void lv_bar_anim(void * bar, int16_t value)
{ {
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar); lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
ext->anim_state = value; ext->anim_state = value;

View File

@ -35,7 +35,7 @@ static bool lv_btn_design(lv_obj_t * btn, const lv_area_t * mask, lv_design_mode
static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param); static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param);
#if LV_USE_ANIMATION && LV_BTN_INK_EFFECT #if LV_USE_ANIMATION && LV_BTN_INK_EFFECT
static void lv_btn_ink_effect_anim(lv_obj_t * btn, int32_t val); static void lv_btn_ink_effect_anim(lv_obj_t * btn, int16_t val);
static void lv_btn_ink_effect_anim_ready(lv_anim_t * a); static void lv_btn_ink_effect_anim_ready(lv_anim_t * a);
#endif #endif
@ -517,9 +517,9 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
a.var = btn; a.var = btn;
a.start = 0; a.start = 0;
a.end = LV_BTN_INK_VALUE_MAX; a.end = LV_BTN_INK_VALUE_MAX;
a.exec_cb = (lv_anim_exec_cb_t)lv_btn_ink_effect_anim; a.exec_cb = (lv_anim_exec_cb_t)lv_btn_ink_effect_anim;
a.path_cb = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.ready_cb = lv_btn_ink_effect_anim_ready; a.ready_cb = lv_btn_ink_effect_anim_ready;
a.act_time = 0; a.act_time = 0;
a.time = ext->ink_in_time; a.time = ext->ink_in_time;
a.playback = 0; a.playback = 0;
@ -586,9 +586,9 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
a.var = ink_obj; a.var = ink_obj;
a.start = LV_BTN_INK_VALUE_MAX; a.start = LV_BTN_INK_VALUE_MAX;
a.end = 0; a.end = 0;
a.exec_cb = (lv_anim_exec_cb_t)lv_btn_ink_effect_anim; a.exec_cb = (lv_anim_exec_cb_t)lv_btn_ink_effect_anim;
a.path_cb = lv_anim_path_linear; a.path_cb = lv_anim_path_linear;
a.ready_cb = lv_btn_ink_effect_anim_ready; a.ready_cb = lv_btn_ink_effect_anim_ready;
a.act_time = 0; a.act_time = 0;
a.time = ext->ink_out_time; a.time = ext->ink_out_time;
a.playback = 0; a.playback = 0;
@ -632,7 +632,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
* @param btn pointer to the animated button * @param btn pointer to the animated button
* @param val the new radius * @param val the new radius
*/ */
static void lv_btn_ink_effect_anim(lv_obj_t * btn, int32_t val) static void lv_btn_ink_effect_anim(lv_obj_t * btn, int16_t val)
{ {
if(btn) { if(btn) {
ink_act_value = val; ink_act_value = val;

View File

@ -46,7 +46,7 @@ static void lv_ddlist_pos_current_option(lv_obj_t * ddlist);
static void lv_ddlist_refr_width(lv_obj_t* ddlist); static void lv_ddlist_refr_width(lv_obj_t* ddlist);
static void lv_ddlist_anim_ready_cb(lv_anim_t * a); static void lv_ddlist_anim_ready_cb(lv_anim_t * a);
static void lv_ddlist_anim_finish(lv_obj_t* ddlist); static void lv_ddlist_anim_finish(lv_obj_t* ddlist);
static void lv_ddlist_adjust_height(lv_obj_t * ddlist, int32_t height); static void lv_ddlist_adjust_height(lv_obj_t * ddlist, int16_t height);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
@ -937,7 +937,7 @@ static void lv_ddlist_anim_finish(lv_obj_t* ddlist)
* @param ddlist Drop down list object * @param ddlist Drop down list object
* @param height New drop down list height * @param height New drop down list height
*/ */
static void lv_ddlist_adjust_height(lv_obj_t * ddlist, int32_t height) static void lv_ddlist_adjust_height(lv_obj_t * ddlist, int16_t height)
{ {
lv_obj_set_height(ddlist, height); lv_obj_set_height(ddlist, height);
lv_ddlist_pos_current_option(ddlist); lv_ddlist_pos_current_option(ddlist);

View File

@ -40,7 +40,7 @@ static bool lv_page_design(lv_obj_t * page, const lv_area_t * mask, lv_design_mo
static bool lv_scrl_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mode_t mode); static bool lv_scrl_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mode_t mode);
static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param); static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param);
static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param); static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
static void edge_flash_anim(void * page, int32_t v); static void edge_flash_anim(void * page, int16_t v);
static void edge_flash_anim_end(lv_anim_t * a); static void edge_flash_anim_end(lv_anim_t * a);
static void scrl_def_event_cb(lv_obj_t * scrl, lv_event_t event); static void scrl_def_event_cb(lv_obj_t * scrl, lv_event_t event);
@ -435,10 +435,8 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, uint16_t anim_time)
* because it can overide the current changes*/ * because it can overide the current changes*/
lv_anim_del(page, (lv_anim_exec_cb_t)lv_obj_set_x); lv_anim_del(page, (lv_anim_exec_cb_t)lv_obj_set_x);
lv_anim_del(page, (lv_anim_exec_cb_t)lv_obj_set_y); lv_anim_del(page, (lv_anim_exec_cb_t)lv_obj_set_y);
lv_anim_del(page, (lv_anim_exec_cb_t)lv_obj_set_pos);
lv_anim_del(ext->scrl, (lv_anim_exec_cb_t)lv_obj_set_x); lv_anim_del(ext->scrl, (lv_anim_exec_cb_t)lv_obj_set_x);
lv_anim_del(ext->scrl, (lv_anim_exec_cb_t)lv_obj_set_y); lv_anim_del(ext->scrl, (lv_anim_exec_cb_t)lv_obj_set_y);
lv_anim_del(ext->scrl, (lv_anim_exec_cb_t)lv_obj_set_pos);
#endif #endif
const lv_style_t * style = lv_page_get_style(page, LV_PAGE_STYLE_BG); const lv_style_t * style = lv_page_get_style(page, LV_PAGE_STYLE_BG);
@ -1195,7 +1193,7 @@ static void lv_page_sb_refresh(lv_obj_t * page)
} }
} }
static void edge_flash_anim(void * page, int32_t v) static void edge_flash_anim(void * page, int16_t v)
{ {
lv_page_ext_t * ext = lv_obj_get_ext_attr(page); lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
ext->edge_flash.state = v; ext->edge_flash.state = v;

View File

@ -127,7 +127,7 @@ lv_obj_t * lv_preload_create(lv_obj_t * par, const lv_obj_t * copy)
* @param preload pointer to a preload object * @param preload pointer to a preload object
* @param deg length of the arc * @param deg length of the arc
*/ */
void lv_preload_set_arc_length(lv_obj_t * preload, uint16_t deg) void lv_preload_set_arc_length(lv_obj_t * preload, int16_t deg)
{ {
lv_preload_ext_t * ext = lv_obj_get_ext_attr(preload); lv_preload_ext_t * ext = lv_obj_get_ext_attr(preload);
@ -189,9 +189,9 @@ void lv_preload_set_anim_type(lv_obj_t * preload, lv_preload_type_t type)
a.start = 0; a.start = 0;
a.end = 360; a.end = 360;
} }
a.exec_cb = (lv_anim_exec_cb_t)lv_preload_spinner_anim; a.exec_cb = (lv_anim_exec_cb_t)lv_preload_spinner_anim;
a.path_cb = lv_anim_path_ease_in_out; a.path_cb = lv_anim_path_ease_in_out;
a.ready_cb = NULL; a.ready_cb = NULL;
a.act_time = 0; a.act_time = 0;
a.time = ext->time; a.time = ext->time;
a.playback = 0; a.playback = 0;
@ -211,9 +211,9 @@ void lv_preload_set_anim_type(lv_obj_t * preload, lv_preload_type_t type)
b.start = ext->arc_length; b.start = ext->arc_length;
b.end = 360 - ext->arc_length; b.end = 360 - ext->arc_length;
} }
b.exec_cb = (lv_anim_exec_cb_t)lv_preload_set_arc_length; b.exec_cb = (lv_anim_exec_cb_t)lv_preload_set_arc_length;
b.path_cb = lv_anim_path_ease_in_out; b.path_cb = lv_anim_path_ease_in_out;
b.ready_cb = NULL; b.ready_cb = NULL;
b.act_time = 0; b.act_time = 0;
b.time = ext->time; b.time = ext->time;
b.playback = 1; b.playback = 1;
@ -237,9 +237,9 @@ void lv_preload_set_anim_type(lv_obj_t * preload, lv_preload_type_t type)
a.start = 0; a.start = 0;
a.end = 360; a.end = 360;
} }
a.exec_cb = (lv_anim_exec_cb_t)lv_preload_spinner_anim; a.exec_cb = (lv_anim_exec_cb_t)lv_preload_spinner_anim;
a.path_cb = lv_anim_path_ease_in_out; a.path_cb = lv_anim_path_ease_in_out;
a.ready_cb = NULL; a.ready_cb = NULL;
a.act_time = 0; a.act_time = 0;
a.time = ext->time; a.time = ext->time;
a.playback = 0; a.playback = 0;
@ -328,7 +328,7 @@ lv_preload_dir_t lv_preload_get_anim_dir(lv_obj_t * preload) {
* @param ptr pointer to preloader * @param ptr pointer to preloader
* @param val the current desired value [0..360] * @param val the current desired value [0..360]
*/ */
void lv_preload_spinner_anim(void * ptr, int32_t val) void lv_preload_spinner_anim(void * ptr, int16_t val)
{ {
lv_obj_t * preload = ptr; lv_obj_t * preload = ptr;
lv_preload_ext_t * ext = lv_obj_get_ext_attr(preload); lv_preload_ext_t * ext = lv_obj_get_ext_attr(preload);

View File

@ -92,7 +92,7 @@ lv_obj_t * lv_preload_create(lv_obj_t * par, const lv_obj_t * copy);
* @param preload pointer to a preload object * @param preload pointer to a preload object
* @param deg length of the arc * @param deg length of the arc
*/ */
void lv_preload_set_arc_length(lv_obj_t * preload, uint16_t deg); void lv_preload_set_arc_length(lv_obj_t * preload, int16_t deg);
/** /**
* Set the spin time of the arc * Set the spin time of the arc
@ -175,7 +175,7 @@ lv_preload_dir_t lv_preload_get_anim_dir(lv_obj_t * preload);
* @param type which style should be get * @param type which style should be get
* @return style pointer to the style * @return style pointer to the style
* */ * */
void lv_preload_spinner_anim(void * ptr, int32_t val); void lv_preload_spinner_anim(void * ptr, int16_t val);
/********************** /**********************
* MACROS * MACROS