focus: is_focus_target flag is added for on_focus function
authorWooHyun Jung <wh0705.jung@samsung.com>
Tue, 13 Dec 2016 10:33:58 +0000 (19:33 +0900)
committerWonki Kim <wonki_.kim@samsung.com>
Mon, 2 Jan 2017 05:37:08 +0000 (14:37 +0900)
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
src/lib/elm_widget.h
src/mobile_lib/elm_genlist.c

index 46f3915..0c1e8e3 100644 (file)
@@ -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;
 }
index f1f98a2..a9b4a04 100644 (file)
@@ -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;
index 2adbfa8..6cba92b 100644 (file)
@@ -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)