From 37f38b3211ce4fb525b644f452d80280366508e3 Mon Sep 17 00:00:00 2001 From: Erich Styger Date: Mon, 13 Aug 2018 06:34:00 +0200 Subject: [PATCH 1/3] fixed wrong comment --- lv_hal/lv_hal_indev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lv_hal/lv_hal_indev.h b/lv_hal/lv_hal_indev.h index 094b8be89..a7f927f5c 100644 --- a/lv_hal/lv_hal_indev.h +++ b/lv_hal/lv_hal_indev.h @@ -49,7 +49,7 @@ typedef struct { uint32_t key; /*For LV_INDEV_TYPE_KEYPAD the currently pressed key*/ uint32_t btn; /*For LV_INDEV_TYPE_BUTTON the currently pressed button*/ }; - lv_indev_state_t state; /*LV_INDEV_EVENT_REL or LV_INDEV_EVENT_PR*/ + lv_indev_state_t state; /*LV_INDEV_STATE_REL or LV_INDEV_STATE_PR*/ void *user_data; /*'lv_indev_drv_t.priv' for this driver*/ } lv_indev_data_t; From e96bbdd31a411807c8234cfe5b93a003d2047047 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 15 Aug 2018 12:32:53 +0200 Subject: [PATCH 2/3] lv_obj_set_parent: test input paramters --- lv_core/lv_obj.c | 15 +++++++++++++-- lv_core/lv_obj.h | 4 ++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lv_core/lv_obj.c b/lv_core/lv_obj.c index 8bf266e53..8980b5a49 100644 --- a/lv_core/lv_obj.c +++ b/lv_core/lv_obj.c @@ -431,11 +431,22 @@ void lv_scr_load(lv_obj_t * scr) /** * Set a new parent for an object. Its relative position will be the same. - * @param obj pointer to an object - * @param parent pointer to the new parent object + * @param obj pointer to an object. Can't be a screen. + * @param parent pointer to the new parent object. (Can't be NULL) */ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent) { + if(obj->par == NULL) { + LV_LOG_WARN("Can't set the parent of a screen"); + return; + } + + if(parent == NULL) { + LV_LOG_WARN("Can't set parent == NULL to an object"); + return; + } + + lv_obj_invalidate(obj); lv_point_t old_pos; diff --git a/lv_core/lv_obj.h b/lv_core/lv_obj.h index 369ebfdee..7a8155568 100644 --- a/lv_core/lv_obj.h +++ b/lv_core/lv_obj.h @@ -263,8 +263,8 @@ void lv_scr_load(lv_obj_t * scr); /** * Set a new parent for an object. Its relative position will be the same. - * @param obj pointer to an object - * @param parent pointer to the new parent object + * @param obj pointer to an object. Can't be a screen. + * @param parent pointer to the new parent object. (Can't be NULL) */ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent); From 507235a681af69d26785c57c57e2fa0a1113e801 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 15 Aug 2018 12:36:35 +0200 Subject: [PATCH 3/3] minor formatting --- lv_core/lv_obj.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lv_core/lv_obj.c b/lv_core/lv_obj.c index 8980b5a49..8f2c9530c 100644 --- a/lv_core/lv_obj.c +++ b/lv_core/lv_obj.c @@ -436,15 +436,15 @@ void lv_scr_load(lv_obj_t * scr) */ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent) { - if(obj->par == NULL) { - LV_LOG_WARN("Can't set the parent of a screen"); - return; - } + if(obj->par == NULL) { + LV_LOG_WARN("Can't set the parent of a screen"); + return; + } - if(parent == NULL) { - LV_LOG_WARN("Can't set parent == NULL to an object"); - return; - } + if(parent == NULL) { + LV_LOG_WARN("Can't set parent == NULL to an object"); + return; + } lv_obj_invalidate(obj);