mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-21 06:53:01 +08:00
improve LV_PROTECT_PRESS_LOST
This commit is contained in:
parent
e50410ffb1
commit
13f0b61953
@ -773,27 +773,18 @@ static void indev_proc_release(lv_indev_proc_t * proc)
|
|||||||
/*Forgot the act obj and send a released signal */
|
/*Forgot the act obj and send a released signal */
|
||||||
if(proc->types.pointer.act_obj != NULL) {
|
if(proc->types.pointer.act_obj != NULL) {
|
||||||
/* If the object was protected against press lost then it possible that
|
/* If the object was protected against press lost then it possible that
|
||||||
* the object is already not pressed but still it is the `types.pointer.act_obj`.
|
* the object is already not pressed but still it is the `act_obj`.
|
||||||
* In this case send the `LV_SIGNAL_RELEASED` if the indev is ON the `types.pointer.act_obj` */
|
* In this case send the `LV_SIGNAL_RELEASED/CLICKED` of `LV_SIGNAL_PRESS_LOST` if the indev is ON the `types.pointer.act_obj` */
|
||||||
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)) {
|
||||||
/* Search the object on the current current coordinates.
|
proc->types.pointer.act_obj->signal_cb(proc->types.pointer.act_obj, LV_SIGNAL_RELEASED, indev_act);
|
||||||
* The start object is the object itself. If not ON it the the result will be NULL*/
|
if(proc->long_pr_sent == 0 && proc->types.pointer.drag_in_prog == 0) {
|
||||||
lv_obj_t * obj_on = indev_search_obj(proc, proc->types.pointer.act_obj);
|
lv_obj_send_event(proc->types.pointer.act_obj, LV_EVENT_CLICKED);
|
||||||
if(obj_on == proc->types.pointer.act_obj) {
|
} else {
|
||||||
proc->types.pointer.act_obj->signal_cb(proc->types.pointer.act_obj, LV_SIGNAL_RELEASED, indev_act);
|
lv_obj_send_event(proc->types.pointer.act_obj, LV_EVENT_RELEASED);
|
||||||
if(proc->long_pr_sent == 0 && proc->types.pointer.drag_in_prog == 0) {
|
|
||||||
lv_obj_send_event(proc->types.pointer.act_obj, LV_EVENT_CLICKED);
|
|
||||||
} else {
|
|
||||||
lv_obj_send_event(proc->types.pointer.act_obj, LV_EVENT_RELEASED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
proc->types.pointer.act_obj->signal_cb(proc->types.pointer.act_obj, LV_SIGNAL_PRESS_LOST, indev_act);
|
|
||||||
lv_obj_send_event(proc->types.pointer.act_obj, LV_SIGNAL_PRESS_LOST);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* The simple case: `types.pointer.act_obj` was not protected against press lost.
|
/* The simple case: `types.pointer.act_obj` was not protected against press lost.
|
||||||
* If it is already not pressed then was handled in `indev_proc_press`*/
|
* 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, indev_act);
|
proc->types.pointer.act_obj->signal_cb(proc->types.pointer.act_obj, LV_SIGNAL_RELEASED, indev_act);
|
||||||
|
|
||||||
|
@ -476,7 +476,6 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
|
|||||||
} else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) {
|
} else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) {
|
||||||
lv_slider_set_value(slider, ext->drag_value, false);
|
lv_slider_set_value(slider, ext->drag_value, false);
|
||||||
ext->drag_value = LV_SLIDER_NOT_PRESSED;
|
ext->drag_value = LV_SLIDER_NOT_PRESSED;
|
||||||
lv_obj_send_event(slider, LV_EVENT_VALUE_CHANGED);
|
|
||||||
} else if(sign == LV_SIGNAL_CORD_CHG) {
|
} else if(sign == LV_SIGNAL_CORD_CHG) {
|
||||||
/* The knob size depends on slider size.
|
/* The knob size depends on slider size.
|
||||||
* During the drawing method the ext. size is used by the knob so refresh the ext. size.*/
|
* During the drawing method the ext. size is used by the knob so refresh the ext. size.*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user