jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=94d671c9715fef600c515bb1ae38bfb884d0bb82

commit 94d671c9715fef600c515bb1ae38bfb884d0bb82
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Thu Aug 31 11:27:49 2017 +0900

    widget: Fix legacy for focus_mouse_up_handle (EO)
    
    This removes the special code in the legacy API for
    elm_widget_focus_mouse_up_handle. Add an internal helper to find the
    first widget parent. And mark as protected.
    Apparently this functions is still required for the new focus manager.
    
    Ref T5363
---
 src/lib/elementary/efl_ui_win.c  |  2 +-
 src/lib/elementary/elm_widget.c  | 19 ++-----------------
 src/lib/elementary/elm_widget.eo |  1 -
 src/lib/elementary/elm_widget.h  |  9 +++++++++
 4 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index 82b5636fb6..ce5986c645 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -2726,7 +2726,7 @@ _win_img_mouse_up(void *data,
 {
    Evas_Event_Mouse_Up *ev = event_info;
    if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
-     elm_widget_focus_mouse_up_handle(data);
+     elm_widget_focus_mouse_up_handle(evas_object_widget_parent_find(data));
 }
 
 static void
diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c
index cbac977eb4..4cd4157580 100644
--- a/src/lib/elementary/elm_widget.c
+++ b/src/lib/elementary/elm_widget.c
@@ -575,7 +575,7 @@ _obj_mouse_up(void *data,
 
    if (sd->still_in && (ev->flags == EVAS_BUTTON_NONE) &&
        (sd->focus_move_policy == ELM_FOCUS_MOVE_POLICY_CLICK))
-     elm_widget_focus_mouse_up_handle(obj);
+     elm_widget_focus_mouse_up_handle(evas_object_widget_parent_find(obj));
 
    sd->still_in = EINA_FALSE;
 }
@@ -588,7 +588,7 @@ _obj_mouse_in(void *data,
 {
    ELM_WIDGET_DATA_GET(data, sd);
    if (sd->focus_move_policy == ELM_FOCUS_MOVE_POLICY_IN)
-     elm_widget_focus_mouse_up_handle(obj);
+     elm_widget_focus_mouse_up_handle(evas_object_widget_parent_find(obj));
 }
 
 EOLIAN static void
@@ -4261,24 +4261,9 @@ _elm_widget_focus_hide_handle(Eo *obj, 
Elm_Widget_Smart_Data *_pd EINA_UNUSED)
    _if_focused_revert(obj, EINA_TRUE);
 }
 
-EAPI void
-elm_widget_focus_mouse_up_handle(Evas_Object *obj)
-{
-   Evas_Object *o = obj;
-   do
-     {
-        if (_elm_widget_is(o)) break;
-        o = evas_object_smart_parent_get(o);
-     }
-   while (o);
-
-   elm_obj_widget_focus_mouse_up_handle(o);
-}
-
 EOLIAN static void
 _elm_widget_focus_mouse_up_handle(Eo *obj, Elm_Widget_Smart_Data *pd)
 {
-   if (!obj) return;
    if (!_is_focusable(obj)) return;
 
    elm_obj_widget_focus_steal(obj, NULL);
diff --git a/src/lib/elementary/elm_widget.eo b/src/lib/elementary/elm_widget.eo
index c414a078c1..a2db55cfc9 100644
--- a/src/lib/elementary/elm_widget.eo
+++ b/src/lib/elementary/elm_widget.eo
@@ -409,7 +409,6 @@ abstract Elm.Widget (Efl.Canvas.Group, 
Elm.Interface.Atspi_Accessible,
       /* FIXME: Needs better doc... maybe merge with widget_event? */
       focus_mouse_up_handle {
          [[Handle focus mouse up]]
-         legacy: null;
       }
 
       /* Scroll API. */
diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h
index 453672b924..fe8f6c329f 100644
--- a/src/lib/elementary/elm_widget.h
+++ b/src/lib/elementary/elm_widget.h
@@ -826,6 +826,15 @@ elm_widget_is_legacy(const Eo *obj)
    return sd ? sd->legacy : EINA_FALSE;
 }
 
+/** Takes in any canvas object and returns the first smart parent that is a 
widget */
+static inline Elm_Widget *
+evas_object_widget_parent_find(Evas_Object *o)
+{
+   while (o && !efl_isa(o, ELM_WIDGET_CLASS))
+     evas_object_smart_parent_get(o);
+   return o;
+}
+
 /* to be used by INTERNAL classes on Elementary, so that the widgets
  * parsing script skips it */
 #define ELM_INTERNAL_SMART_SUBCLASS_NEW EVAS_SMART_SUBCLASS_NEW

-- 


Reply via email to