From fb85a383ac410652b113213abfae222f3fed6d86 Mon Sep 17 00:00:00 2001 From: WooHyun Jung Date: Tue, 13 Dec 2016 19:33:58 +0900 Subject: [PATCH] focus: is_focus_target flag is added for on_focus function Now, widgets can know whether the on_focus is called by _parent_focus of its child OR of itself. And, it's firstly applied to genlist's on_focus. @tizen_feature Change-Id: I2516ff71a5cb728e0c952cccd9e5646e8e29b072 --- src/lib/elm_widget.c | 7 +++++++ src/lib/elm_widget.h | 3 +++ src/mobile_lib/elm_genlist.c | 3 +++ 3 files changed, 13 insertions(+) diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index 46f3915..0c1e8e3 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -3081,7 +3081,14 @@ _elm_widget_focus_steal(Eo *obj, Elm_Widget_Smart_Data *sd, Elm_Object_Item *ite } } } + /* TIZEN_ONLY(20161212): Some winsets should know whether it's focus target or not in _on_focus */ + sd = eo_data_scope_get(obj, MY_CLASS); + sd->is_focus_target = EINA_TRUE; + // _parent_focus(obj, item); + /* TIZEN_ONLY(20161212): Some winsets should know whether it's focus target or not in _on_focus */ + sd->is_focus_target = EINA_FALSE; + // elm_widget_focus_region_show(obj); return; } diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index f1f98a2..a9b4a04 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -454,6 +454,9 @@ typedef struct _Elm_Widget_Smart_Data Eina_Bool top_win_focused : 1; Eina_Bool tree_unfocusable : 1; Eina_Bool focus_move_policy_auto_mode : 1; /* This is TRUE by default */ + /* TIZEN_ONLY(20161212): With this flag, on_focus can know whether it's the focus target or not */ + Eina_Bool is_focus_target : 1; + // Eina_Bool highlight_ignore : 1; Eina_Bool highlight_in_theme : 1; Eina_Bool access_highlight_in_theme : 1; diff --git a/src/mobile_lib/elm_genlist.c b/src/mobile_lib/elm_genlist.c index 2adbfa8..6cba92b 100644 --- a/src/mobile_lib/elm_genlist.c +++ b/src/mobile_lib/elm_genlist.c @@ -3865,6 +3865,9 @@ _elm_genlist_elm_widget_on_focus(Eo *obj, Elm_Genlist_Data *sd, Elm_Object_Item if (sd->select_on_focus_enabled) return EINA_TRUE; if (elm_widget_focus_get(obj)) { + // Do nothing if on_focus is called by child's parent_focus + if (!wd->is_focus_target) return EINA_TRUE; + if (sd->focused_item) { if (!sd->focused_content) -- 2.7.4