From 424bff48f5c7b9ebc41c3d910382c6c890fb63a2 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 9 May 2019 06:04:45 +0200 Subject: [PATCH] lv_obj_move_fore/background: move only if not there now --- src/lv_core/lv_obj.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index af7b50aa2..5bd6353a6 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -572,6 +572,9 @@ void lv_obj_move_foreground(lv_obj_t * obj) { lv_obj_t * parent = lv_obj_get_parent(obj); + /*Do nothing of already in the foreground*/ + if(lv_ll_get_head(&parent->child_ll) == obj) return; + lv_obj_invalidate(parent); lv_ll_chg_list(&parent->child_ll, &parent->child_ll, obj, true); @@ -590,6 +593,9 @@ void lv_obj_move_background(lv_obj_t * obj) { lv_obj_t * parent = lv_obj_get_parent(obj); + /*Do nothing of already in the background*/ + if(lv_ll_get_tail(&parent->child_ll) == obj) return; + lv_obj_invalidate(parent); lv_ll_chg_list(&parent->child_ll, &parent->child_ll, obj, false);