forked from enlightenment/efl
focus: Added optional focus feature - focus movement by mouse_in.
Focus is moved by mouse click by default. This patch makes moving focus by mouse_in optionally by configuration and API. Widget item focus movement is not applied yet. Need to do that as well. - configuration: "focus_move_policy" - API: elm_config_focus_move_policy_set/get - enum ELM_FOCUS_MOVE_POLICY_CLICK ELM_FOCUS_MOVE_POLICY_IN @feature
This commit is contained in:
parent
88776125a9
commit
46506cf22e
|
@ -45,6 +45,7 @@ group "Elm_Config" struct {
|
|||
value "focus_highlight_enable" uchar: 0;
|
||||
value "focus_highlight_animate" uchar: 0;
|
||||
value "focus_highlight_clip_disable" uchar: 0;
|
||||
value "focus_move_policy" uchar: 0;
|
||||
value "toolbar_shrink_mode" int: 3;
|
||||
value "fileselector_expand_enable" uchar: 0;
|
||||
value "inwin_dialogs_enable" uchar: 1;
|
||||
|
|
|
@ -45,6 +45,7 @@ group "Elm_Config" struct {
|
|||
value "focus_highlight_enable" uchar: 0;
|
||||
value "focus_highlight_animate" uchar: 0;
|
||||
value "focus_highlight_clip_disable" uchar: 0;
|
||||
value "focus_move_policy" uchar: 0;
|
||||
value "toolbar_shrink_mode" int: 3;
|
||||
value "fileselector_expand_enable" uchar: 0;
|
||||
value "inwin_dialogs_enable" uchar: 1;
|
||||
|
|
|
@ -45,6 +45,7 @@ group "Elm_Config" struct {
|
|||
value "focus_highlight_enable" uchar: 0;
|
||||
value "focus_highlight_animate" uchar: 0;
|
||||
value "focus_highlight_clip_disable" uchar: 1;
|
||||
value "focus_move_policy" uchar: 0;
|
||||
value "toolbar_shrink_mode" int: 3;
|
||||
value "fileselector_expand_enable" uchar: 1;
|
||||
value "fileselector_double_tap_navigation_enable" uchar: 1;
|
||||
|
|
|
@ -505,6 +505,7 @@ _desc_init(void)
|
|||
ELM_CONFIG_VAL(D, T, focus_highlight_enable, T_UCHAR);
|
||||
ELM_CONFIG_VAL(D, T, focus_highlight_animate, T_UCHAR);
|
||||
ELM_CONFIG_VAL(D, T, focus_highlight_clip_disable, T_UCHAR);
|
||||
ELM_CONFIG_VAL(D, T, focus_move_policy, T_UCHAR);
|
||||
ELM_CONFIG_VAL(D, T, toolbar_shrink_mode, T_INT);
|
||||
ELM_CONFIG_VAL(D, T, fileselector_expand_enable, T_UCHAR);
|
||||
ELM_CONFIG_VAL(D, T, fileselector_double_tap_navigation_enable, T_UCHAR);
|
||||
|
@ -1504,6 +1505,7 @@ _config_load(void)
|
|||
_elm_config->focus_highlight_enable = EINA_FALSE;
|
||||
_elm_config->focus_highlight_animate = EINA_TRUE;
|
||||
_elm_config->focus_highlight_clip_disable = EINA_FALSE;
|
||||
_elm_config->focus_move_policy = ELM_FOCUS_MOVE_POLICY_CLICK;
|
||||
_elm_config->toolbar_shrink_mode = 2;
|
||||
_elm_config->fileselector_expand_enable = EINA_FALSE;
|
||||
_elm_config->fileselector_double_tap_navigation_enable = EINA_FALSE;
|
||||
|
@ -2032,6 +2034,9 @@ _env_get(void)
|
|||
s = getenv("ELM_FOCUS_HIGHLIGHT_CLIP_DISABLE");
|
||||
if (s) _elm_config->focus_highlight_clip_disable = !!atoi(s);
|
||||
|
||||
s = getenv("ELM_FOCUS_MOVE_POLICY");
|
||||
if (s) _elm_config->focus_move_policy = !!atoi(s);
|
||||
|
||||
s = getenv("ELM_TOOLBAR_SHRINK_MODE");
|
||||
if (s) _elm_config->toolbar_shrink_mode = atoi(s);
|
||||
|
||||
|
@ -2555,6 +2560,17 @@ elm_config_focus_highlight_clip_disabled_set(Eina_Bool disable)
|
|||
_elm_config->focus_highlight_clip_disable = !!disable;
|
||||
}
|
||||
|
||||
EAPI Elm_Focus_Move_Policy
|
||||
elm_config_focus_move_policy_get(void)
|
||||
{
|
||||
return _elm_config->focus_move_policy;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_config_focus_move_policy_set(Elm_Focus_Move_Policy policy)
|
||||
{
|
||||
_elm_config->focus_move_policy = policy;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_config_scroll_bounce_enabled_get(void)
|
||||
|
|
|
@ -1238,6 +1238,45 @@ EAPI Eina_Bool elm_config_focus_highlight_clip_disabled_get(void);
|
|||
*/
|
||||
EAPI void elm_config_focus_highlight_clip_disabled_set(Eina_Bool disable);
|
||||
|
||||
/**
|
||||
* Focus Movement Policy
|
||||
*
|
||||
* @since 1.10
|
||||
* @ingroup Focus
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ELM_FOCUS_MOVE_POLICY_CLICK,
|
||||
ELM_FOCUS_MOVE_POLICY_IN
|
||||
} Elm_Focus_Move_Policy;
|
||||
|
||||
/**
|
||||
* Get the focus movement policy
|
||||
*
|
||||
* @return The focus movement policy
|
||||
*
|
||||
* Get how the focus is moved to another object. It can be @c
|
||||
* ELM_FOCUS_MOVE_POLICY_CLICK or @c ELM_FOCUS_MOVE_POLICY_IN. The first means
|
||||
* elementary focus is moved on elementary object click. The second means
|
||||
* elementary focus is moved on elementary object mouse in.
|
||||
*
|
||||
* @see elm_config_focus_move_policy_set()
|
||||
* @since 1.10
|
||||
* @ingroup Focus
|
||||
*/
|
||||
EAPI Elm_Focus_Move_Policy elm_config_focus_move_policy_get(void);
|
||||
|
||||
/**
|
||||
* Set elementary focus movement policy
|
||||
*
|
||||
* @param policy A policy to apply for the focus movement
|
||||
*
|
||||
* @see elm_config_focus_move_policy_get()
|
||||
* @since 1.10
|
||||
* @ingroup Focus
|
||||
*/
|
||||
EAPI void elm_config_focus_move_policy_set(Elm_Focus_Move_Policy policy);
|
||||
|
||||
/**
|
||||
* Get the system mirrored mode. This determines the default mirrored mode
|
||||
* of widgets.
|
||||
|
|
|
@ -224,6 +224,7 @@ struct _Elm_Config
|
|||
unsigned char focus_highlight_enable;
|
||||
unsigned char focus_highlight_animate;
|
||||
unsigned char focus_highlight_clip_disable; /**< This shows disabled status of focus highlight clip feature. This value is false by default so the focus highlight is clipped. */
|
||||
unsigned char focus_move_policy; /**< This show how the elementary focus is moved to another object. Focus can be moved by click or mouse_in. */
|
||||
int toolbar_shrink_mode;
|
||||
unsigned char fileselector_expand_enable;
|
||||
unsigned char fileselector_double_tap_navigation_enable;
|
||||
|
|
|
@ -250,11 +250,23 @@ _obj_mouse_up(void *data,
|
|||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
ELM_WIDGET_DATA_GET(data, sd);
|
||||
if (sd->still_in)
|
||||
if (sd->still_in &&
|
||||
(_elm_config->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,
|
||||
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_focus_mouse_up_handle(obj);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_widget_evas_smart_add(Eo *obj, Elm_Widget_Smart_Data *priv)
|
||||
{
|
||||
|
@ -271,6 +283,8 @@ _elm_widget_evas_smart_add(Eo *obj, Elm_Widget_Smart_Data *priv)
|
|||
_obj_mouse_move, obj);
|
||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP,
|
||||
_obj_mouse_up, obj);
|
||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_IN,
|
||||
_obj_mouse_in, obj);
|
||||
/* just a helper for inheriting classes */
|
||||
if (priv->resize_obj)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue