mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
lv_obj_del: reset the dispi-s only if it is really required
This commit is contained in:
parent
166fa39d89
commit
662c22b51a
@ -41,6 +41,7 @@ static void dispi_drag_throw(lv_dispi_t * dispi_p);
|
||||
static ptask_t* dispi_task_p;
|
||||
static bool lv_dispi_reset_qry;
|
||||
static bool lv_dispi_reset_now;
|
||||
static lv_dispi_t dispi_array[INDEV_NUM];
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@ -65,6 +66,15 @@ void lv_dispi_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with all the display inputs. Contains (INDEV_NUM elements)
|
||||
* @return pointer to a an lv_dispi_t array.
|
||||
*/
|
||||
lv_dispi_t * lv_dispi_get_array(void)
|
||||
{
|
||||
return dispi_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all display inputs
|
||||
*/
|
||||
@ -135,15 +145,13 @@ void lv_dispi_wait_release(lv_dispi_t * dispi)
|
||||
*/
|
||||
static void dispi_task(void * param)
|
||||
{
|
||||
|
||||
static lv_dispi_t dispi[INDEV_NUM];
|
||||
cord_t x;
|
||||
cord_t y;
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < INDEV_NUM; i++) {
|
||||
dispi[i].pressed = indev_get(i, &x, &y);
|
||||
dispi_proc_point(&dispi[i], x, y);
|
||||
dispi_array[i].pressed = indev_get(i, &x, &y);
|
||||
dispi_proc_point(&dispi_array[i], x, y);
|
||||
}
|
||||
|
||||
/*If reset query occurred in this round then set a flag to
|
||||
|
@ -55,6 +55,12 @@ typedef lv_action_res_t ( * lv_action_t) (struct __LV_OBJ_T * obj, lv_dispi_t *
|
||||
*/
|
||||
void lv_dispi_init(void);
|
||||
|
||||
/**
|
||||
* Get an array with all the display inputs. Contains (INDEV_NUM elements)
|
||||
* @return pointer to a an lv_dispi_t array.
|
||||
*/
|
||||
lv_dispi_t * lv_dispi_get_array(void);
|
||||
|
||||
/**
|
||||
* Reset all display inputs
|
||||
*/
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "lvgl/lv_app/lv_app.h"
|
||||
#include "lvgl/lv_draw/lv_draw_rbasic.h"
|
||||
#include "misc/gfx/anim.h"
|
||||
#include "hal/indev/indev.h"
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -280,10 +281,24 @@ void lv_obj_del(lv_obj_t * obj)
|
||||
if(obj->ext != NULL) dm_free(obj->ext);
|
||||
dm_free(obj); /*Free the object itself*/
|
||||
|
||||
/* Reset all display input (dispi) because
|
||||
* the deleted object can be being pressed*/
|
||||
lv_dispi_reset();
|
||||
|
||||
/* Reset all display input (dispi) if
|
||||
* the currently pressed object is deleted too*/
|
||||
lv_dispi_t * dispi_array = lv_dispi_get_array();
|
||||
lv_obj_t * dpar;
|
||||
uint8_t d;
|
||||
for(d = 0; d < INDEV_NUM; d++) {
|
||||
dpar = obj;
|
||||
while(dpar != NULL) {
|
||||
if(dispi_array[d].act_obj == dpar ||
|
||||
dispi_array[d].last_obj == dpar) {
|
||||
lv_dispi_reset();
|
||||
break;
|
||||
} else {
|
||||
dpar = lv_obj_get_parent(dpar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*Send a signal to the parent to notify it about the child delete*/
|
||||
if(par != NULL) {
|
||||
par->signal_f(par, LV_SIGNAL_CHILD_CHG, NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user