Hello.
 
In some cases, this new policy is useful.
For example,
 - there are elm_entry and elm_check.
 - elm_entry gets focus and software keyboard is shown. (in the smart phone 
application) 
 - this elm_check is for changing the password mode of elm_entry. (it will 
set/unset password mode) 
 - Without this policy, every clicking of elm_check will set focus to elm_check.
 - software keyboard will be hidden because of losing focus from elm_entry.
 
Many smart phone application does not want to move focus to elm_check in this 
case.
I know this can be implemented by using elm_object_focus_allow_set(check, 
EINA_FALSE).
But this is not good way because elm_check should be accessible when somebody 
uses h/w keyboard only.
 
For this case, other platforms are supporting this special focus move policy, 
too.
 
Thanks :)  
 
-----Original Message-----
From: "Daniel Juyung Seo"<seojuyu...@gmail.com> 
To: "WooHyun Jung"<wh0705.j...@samsung.com>; 
Cc: "Enlightenment developer 
list"<enlightenment-devel@lists.sourceforge.net>; 
Sent: 2015-06-02 (화) 18:15:25
Subject: Re: [E-devel] [EGIT] [core/elementary] master 01/01: elm_focus: added 
new focus move policy and elm_object_focus_move_policy_set/get
 
Hello Woohyun Jung,

I have a strong doubt about this commit.
1. In what case do you need ELM_FOCUS_MOVE_POLICY_KEY_ONLY? It would be
confusing to users if the focus does not move with pointing devices when
you have both pointing and key devices. If you have only key device, there
is nothing you need to do because pointing event would not be triggered.
2. Why do you need to set a separate focus policy per object? Focus is a
general concept used between multiple objects. Having a different focus
move policy per object does not make sense. This would be confusing to
users too.

Thanks,
Daniel Juyung Seo (SeoZ)

On Tue, Jun 2, 2015 at 1:47 PM, WooHyun Jung <wh0705.j...@samsung.com>
wrote:

> woohyun pushed a commit to branch master.
>
>
> 
http://git.enlightenment.org/core/elementary.git/commit/?id=f0a7fafa5959f7b182100e31cab2a808e3543c9b
>
> commit f0a7fafa5959f7b182100e31cab2a808e3543c9b
> Author: WooHyun Jung <wh0705.j...@samsung.com>
> Date:   Tue Jun 2 13:42:00 2015 +0900
>
>     elm_focus: added new focus move policy and
> elm_object_focus_move_policy_set/get
>
>     New focus move policy, ELM_FOCUS_MOVE_POLICY_KEY_ONLY, is added.
>     If you set this policy as base focus move policy, objects cannot steal
>     focus by using mouse click or mouse in. Only keyboard input (such as
> Left,
>     Right, Up, Down, ...) can make focus be moved.
>     Additaionally, an object can have its own focus move policy by using
>     elm_object_focus_move_policy_set API.
>
>     @feature
> ---
>  src/bin/Makefile.am   |  1 +
>  src/bin/test.c        |  2 ++
>  src/lib/elm_config.h  |  3 ++-
>  src/lib/elm_focus.h   | 36 ++++++++++++++++++++++++++++++++++++
>  src/lib/elm_main.c    | 15 +++++++++++++++
>  src/lib/elm_widget.c  | 38 +++++++++++++++++++++++++++++++++++---
>  src/lib/elm_widget.eo | 11 +++++++++++
>  src/lib/elm_widget.h  |  3 +++
>  8 files changed, 105 insertions(+), 4 deletions(-)
>
> diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
> index 3d0a990..fdaafa4 100644
> --- a/src/bin/Makefile.am
> +++ b/src/bin/Makefile.am
> @@ -65,6 +65,7 @@ test_flipselector.c \
>  test_floating.c \
>  test_focus.c \
>  test_focus_custom_chain.c \
> +test_focus_policy.c \
>  test_focus_style.c \
>  test_gengrid.c \
>  test_genlist.c \
> diff --git a/src/bin/test.c b/src/bin/test.c
> index 9a7de33..443d69c 100644
> --- a/src/bin/test.c
> +++ b/src/bin/test.c
> @@ -206,6 +206,7 @@ void test_focus_style(void *data, Evas_Object *obj,
> void *event_info);
>  void test_focus_part(void *data, Evas_Object *obj, void *event_info);
>  void test_focus3(void *data, Evas_Object *obj, void *event_info);
>  void test_focus_object_style(void *data, Evas_Object *obj, void
> *event_info);
> +void test_focus_object_policy(void *data, Evas_Object *obj, void
> *event_info);
>  void test_flipselector(void *data, Evas_Object *obj, void *event_info);
>  void test_diskselector(void *data, Evas_Object *obj, void *event_info);
>  void test_colorselector(void *data, Evas_Object *obj, void *event_info);
> @@ -804,6 +805,7 @@ add_tests:
>     ADD_TEST(NULL, "Focus", "Focus On Part", test_focus_part);
>     ADD_TEST(NULL, "Focus", "Focus 3", test_focus3);
>     ADD_TEST(NULL, "Focus", "Focus Object Style", test_focus_object_style);
> +   ADD_TEST(NULL, "Focus", "Focus Object Policy",
> test_focus_object_policy);
>
>     //------------------------------//
>     ADD_TEST(NULL, "Naviframe", "Naviframe", test_naviframe);
> diff --git a/src/lib/elm_config.h b/src/lib/elm_config.h
> index b069c60..5718790 100644
> --- a/src/lib/elm_config.h
> +++ b/src/lib/elm_config.h
> @@ -1422,7 +1422,8 @@ EAPI void
> elm_config_focus_highlight_clip_disabled_set(Eina_Bool disable);
>  typedef enum
>  {
>     ELM_FOCUS_MOVE_POLICY_CLICK, /**< move focus by mouse click or 
touch.
> Elementary focus is set on mouse click and this is checked at mouse up
> time. (default) */
> -   ELM_FOCUS_MOVE_POLICY_IN /**< move focus by mouse in. Elementary 
focus
> is set on mouse move when the mouse pointer is moved into an object. */
> +   ELM_FOCUS_MOVE_POLICY_IN, /**< move focus by mouse in. Elementary
> focus is set on mouse move when the mouse pointer is moved into an object.
> */
> +   ELM_FOCUS_MOVE_POLICY_KEY_ONLY /**< move focus by key. Elementary
> focus is set on key input like Left, Right, Up, Down, Tab, or Shift+Tab.*/
>  } Elm_Focus_Move_Policy;
>
>  /**
> diff --git a/src/lib/elm_focus.h b/src/lib/elm_focus.h
> index 3aad5e9..29883f7 100644
> --- a/src/lib/elm_focus.h
> +++ b/src/lib/elm_focus.h
> @@ -335,3 +335,39 @@ EAPI const char
> *elm_object_focus_highlight_style_get(const Evas_Object *obj);
>   * @since 1.10
>   */
>  EAPI Elm_Object_Item             *elm_object_focused_item_get(const
> Evas_Object *obj);
> +
> +/**
> + * Set the focus movement policy to a given Elementary object.
> + *
> + * @param obj The Elementary object to operate on
> + * @param policy A policy to apply for the focus movement
> + *
> + * @see elm_object_focus_move_policy_get
> + *
> + * @since 1.15
> + *
> + * @ingroup Focus
> + */
> +EAPI void                 elm_object_focus_move_policy_set(Evas_Object
> *obj, Elm_Focus_Move_Policy policy);
> +
> +/**
> + * Get the focus movement policy from a given Elementary objet.
> + *
> + * @param obj The Elementary widget to get the information from
> + * @return The focus movement policy
> + *
> + * Get how the focus is moved to the give Elemenray object. It can be
> + * #ELM_FOCUS_MOVE_POLICY_CLICK, #ELM_FOCUS_MOVE_POLICY_IN,
> + * or #ELM_FOCUS_MOVE_POLICY_KEY_ONLY.
> + * The first means elementary focus is moved on elementary object click.
> + * The second means elementary focus is moved on elementary object mouse
> in.
> + * The last means elementary focus is moved only by key input like Left,
> + * Right, Up, Down, Tab, or Shift+Tab.
> + *
> + * @see elm_object_focus_move_policy_set
> + *
> + * @since 1.15
> + *
> + * @ingroup Focus
> + */
> +EAPI Elm_Focus_Move_Policy  elm_object_focus_move_policy_get(Evas_Object
> *obj);
> diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c
> index c1f57c7..0fcebc5 100644
> --- a/src/lib/elm_main.c
> +++ b/src/lib/elm_main.c
> @@ -1484,6 +1484,21 @@ elm_object_tree_focus_allow_get(const Evas_Object
> *obj)
>  }
>
>  EAPI void
> +elm_object_focus_move_policy_set(Evas_Object *obj,
> +                                 Elm_Focus_Move_Policy policy)
> +{
> +   EINA_SAFETY_ON_NULL_RETURN(obj);
> +   elm_widget_focus_move_policy_set(obj, policy);
> +}
> +
> +EAPI Elm_Focus_Move_Policy
> +elm_object_focus_move_policy_get(Evas_Object *obj)
> +{
> +   EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
> +   return elm_widget_focus_move_policy_get(obj);
> +}
> +
> +EAPI void
>  elm_object_scroll_hold_push(Evas_Object *obj)
>  {
>     EINA_SAFETY_ON_NULL_RETURN(obj);
> diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c
> index 1fe8a99..c21981f 100644
> --- a/src/lib/elm_widget.c
> +++ b/src/lib/elm_widget.c
> @@ -352,19 +352,20 @@ _obj_mouse_up(void *data,
>  {
>     ELM_WIDGET_DATA_GET(data, sd);
>     if (sd->still_in &&
> -       (_elm_config->focus_move_policy == ELM_FOCUS_MOVE_POLICY_CLICK))
> +       (sd->focus_move_policy == ELM_FOCUS_MOVE_POLICY_CLICK))
>       elm_widget_focus_mouse_up_handle(obj);
>
>     sd->still_in = EINA_FALSE;
>  }
>
>  static void
> -_obj_mouse_in(void *data EINA_UNUSED,
> +_obj_mouse_in(void *data,
>                Evas *e EINA_UNUSED,
>                Evas_Object *obj,
>                void *event_info EINA_UNUSED)
>  {
> -   if (_elm_config->focus_move_policy == ELM_FOCUS_MOVE_POLICY_IN)
> +   ELM_WIDGET_DATA_GET(data, sd);
> +   if (sd->focus_move_policy == ELM_FOCUS_MOVE_POLICY_IN)
>       elm_widget_focus_mouse_up_handle(obj);
>  }
>
> @@ -377,6 +378,7 @@ _elm_widget_evas_object_smart_add(Eo *obj,
> Elm_Widget_Smart_Data *priv)
>                                            * settings */
>     elm_widget_can_focus_set(obj, EINA_TRUE);
>     priv->is_mirrored = elm_config_mirrored_get();
> +   priv->focus_move_policy = _elm_config->focus_move_policy;
>
>     evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN,
>                                    _obj_mouse_down, obj);
> @@ -4108,6 +4110,36 @@ _elm_widget_orientation_set(Eo *obj,
> Elm_Widget_Smart_Data *sd, int orient_mode)
>       }
>  }
>
> +/**
> + * @internal
> + *
> + * Returns the widget's focus move policy.
> + *
> + * @param obj The widget.
> + * @return focus move policy of the object.
> + *
> + **/
> +EOLIAN static Elm_Focus_Move_Policy
> +_elm_widget_focus_move_policy_get(Eo *obj EINA_UNUSED,
> Elm_Widget_Smart_Data *sd)
> +{
> +   return sd->focus_move_policy;
> +}
> +
> +/**
> + * @internal
> + *
> + * Sets the widget's focus move policy.
> + *
> + * @param obj The widget.
> + * @param policy Elm_Focus_Momve_Policy to set object's focus move policy.
> + */
> +
> +EOLIAN static void
> +_elm_widget_focus_move_policy_set(Eo *obj EINA_UNUSED,
> Elm_Widget_Smart_Data *sd, Elm_Focus_Move_Policy policy)
> +{
> +   if (sd->focus_move_policy == policy) return;
> +   sd->focus_move_policy = policy;
> +}
>  static void
>  _track_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
>
> diff --git a/src/lib/elm_widget.eo b/src/lib/elm_widget.eo
> index 4b58a86..22b4417 100644
> --- a/src/lib/elm_widget.eo
> +++ b/src/lib/elm_widget.eo
> @@ -793,6 +793,17 @@ abstract Elm.Widget (Evas.Object_Smart,
> Elm_Interface_Atspi_Accessible, Elm_Inte
>              @in relative_child: Evas.Object * @optional;
>           }
>        }
> +      @property focus_move_policy {
> +         set {
> +            /*@ No description supplied by the EAPI. */
> +         }
> +         get {
> +            /*@ No description supplied by the EAPI. */
> +         }
> +         values {
> +            policy: Elm_Focus_Move_Policy;
> +         }
> +      }
>     }
>     implements {
>        class.constructor;
> diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h
> index 7ab1a58..12e6ebb 100644
> --- a/src/lib/elm_widget.h
> +++ b/src/lib/elm_widget.h
> @@ -419,6 +419,7 @@ typedef struct _Elm_Widget_Smart_Data
>                                                   Evas_Object *obj);
>
>     int                           orient_mode; /* -1 is disabled */
> +   Elm_Focus_Move_Policy         focus_move_policy;
>
>     Eina_Bool                     drag_x_locked : 1;
>     Eina_Bool                     drag_y_locked : 1;
> @@ -775,6 +776,8 @@ EAPI void
>  elm_widget_orientation_mode_disabled_set(Evas_Object *obj,
>  EAPI Eina_Bool        elm_widget_orientation_mode_disabled_get(const
> Evas_Object *obj);
>  EAPI void             elm_widget_focus_highlight_geometry_get(const
> Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord
> *h);
>  void                  _elm_widget_item_highlight_in_theme(Evas_Object
> *obj, Elm_Object_Item *it);
> +EAPI void             elm_widget_focus_move_policy_set(Evas_Object *obj,
> Elm_Focus_Move_Policy policy);
> +EAPI Elm_Focus_Move_Policy elm_widget_focus_move_policy_get(const
> Evas_Object *obj);
>
>  /**
>   * Function to operate on a given widget's scrollabe children when
> necessary.
>
> --
>
>
>
------------------------------------------------------------------------------
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

------------------------------------------------------------------------------
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to