lv_obj_del: reset the dispi-s only if it is really required

This commit is contained in:
Gabor
2017-06-21 10:26:23 +02:00
parent 166fa39d89
commit 662c22b51a
3 changed files with 37 additions and 8 deletions

View File

@@ -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);