forked from enlightenment/efl
Add elm_widget_newest_focus_order_get function for fixing a bug in elm_win. After elm_win is created, if there is no manual focus setting, only elm_win should get focus when focus state is changed.
This commit is contained in:
parent
0d05c1aeb4
commit
f6a73beb76
|
@ -1123,3 +1123,8 @@
|
|||
|
||||
* Add elm_naviframe_item_pop_cb_set().
|
||||
* Naviframe works for H/W backkey event.
|
||||
|
||||
2013-03-08 WooHyun Jung
|
||||
|
||||
* Add elm_widget_newest_focus_order_get for knowing the last object(and its focus order) which got focus.
|
||||
* After elm_win is created, if there is no manual focus setting, only elm_win should get focus when focus state is changed.
|
||||
|
|
|
@ -48,6 +48,7 @@ Additions:
|
|||
* Add elm_object_item_signal_callback_add(), elm_object_item_signal_callback_del().
|
||||
* Add the config ELM_THUMBSCROLL_HOLD_THRESHOLD.
|
||||
* Add elm_naviframe_item_pop_cb_set().
|
||||
* Add elm_widget_newest_focus_order_get for knowing the last object(and its focus order) which got focus.
|
||||
|
||||
Improvements:
|
||||
|
||||
|
@ -175,6 +176,7 @@ Fixes:
|
|||
* Focus highlight should not be shown on (0 ,0).
|
||||
* Fix elm_conform didn't set size hint when keypad on.
|
||||
* Fix elm_conform didn't change indicator mode when create.
|
||||
* After elm_win is created, if there is no manual focus setting, only elm_win should get focus when focus state is changed.
|
||||
|
||||
Removals:
|
||||
|
||||
|
|
|
@ -188,42 +188,6 @@ _elm_widget_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
}
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_newest_focus_order_get(Evas_Object *obj,
|
||||
unsigned int *newest_focus_order,
|
||||
Eina_Bool can_focus_only)
|
||||
{
|
||||
const Eina_List *l;
|
||||
Evas_Object *child, *ret, *best;
|
||||
|
||||
API_ENTRY return NULL;
|
||||
|
||||
if (!evas_object_visible_get(obj)
|
||||
|| (elm_widget_disabled_get(obj))
|
||||
|| (elm_widget_tree_unfocusable_get(obj)))
|
||||
return NULL;
|
||||
|
||||
best = NULL;
|
||||
if (*newest_focus_order < sd->focus_order)
|
||||
{
|
||||
*newest_focus_order = sd->focus_order;
|
||||
best = obj;
|
||||
}
|
||||
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
||||
{
|
||||
ret = _newest_focus_order_get
|
||||
(child, newest_focus_order, can_focus_only);
|
||||
if (!ret) continue;
|
||||
best = ret;
|
||||
}
|
||||
if (can_focus_only)
|
||||
{
|
||||
if ((!best) || (!elm_widget_can_focus_get(best)))
|
||||
return NULL;
|
||||
}
|
||||
return best;
|
||||
}
|
||||
|
||||
static void
|
||||
_if_focused_revert(Evas_Object *obj,
|
||||
Eina_Bool can_focus_only)
|
||||
|
@ -240,7 +204,7 @@ _if_focused_revert(Evas_Object *obj,
|
|||
top = elm_widget_top_get(sd->parent_obj);
|
||||
if (top)
|
||||
{
|
||||
newest = _newest_focus_order_get
|
||||
newest = elm_widget_newest_focus_order_get
|
||||
(top, &newest_focus_order, can_focus_only);
|
||||
if (newest)
|
||||
{
|
||||
|
@ -2445,7 +2409,6 @@ elm_widget_focus_direction_get(const Evas_Object *obj,
|
|||
Evas_Object **direction,
|
||||
double *weight)
|
||||
{
|
||||
|
||||
ELM_WIDGET_CHECK(obj) EINA_FALSE;
|
||||
Eina_Bool ret = EINA_FALSE;
|
||||
eo_do((Eo *) obj, elm_wdg_focus_direction_get(base, degree, direction, weight, &ret));
|
||||
|
@ -3079,7 +3042,7 @@ _elm_widget_focus_restore(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNU
|
|||
Evas_Object *newest = NULL;
|
||||
unsigned int newest_focus_order = 0;
|
||||
|
||||
newest = _newest_focus_order_get(obj, &newest_focus_order, EINA_TRUE);
|
||||
newest = elm_widget_newest_focus_order_get(obj, &newest_focus_order, EINA_TRUE);
|
||||
if (newest)
|
||||
{
|
||||
elm_object_focus_set(newest, EINA_FALSE);
|
||||
|
@ -4346,6 +4309,56 @@ _elm_widget_focus_order_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
|||
*ret = sd->focus_order;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
elm_widget_newest_focus_order_get(Evas_Object *obj,
|
||||
unsigned int *newest_focus_order,
|
||||
Eina_Bool can_focus_only)
|
||||
{
|
||||
ELM_WIDGET_CHECK(obj) NULL;
|
||||
Evas_Object *ret = NULL;
|
||||
eo_do((Eo *) obj, elm_wdg_newest_focus_order_get(newest_focus_order, can_focus_only, &ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_widget_newest_focus_order_get(Eo *obj, void *_pd, va_list *list)
|
||||
{
|
||||
unsigned int *newest_focus_order = va_arg(*list, unsigned int *);
|
||||
Eina_Bool can_focus_only = va_arg(*list, int);
|
||||
Evas_Object **ret = va_arg(*list, Evas_Object **);
|
||||
Elm_Widget_Smart_Data *sd = _pd;
|
||||
*ret = NULL;
|
||||
|
||||
const Eina_List *l;
|
||||
Evas_Object *child, *cur, *best;
|
||||
|
||||
if (!evas_object_visible_get(obj)
|
||||
|| (elm_widget_disabled_get(obj))
|
||||
|| (elm_widget_tree_unfocusable_get(obj)))
|
||||
return;
|
||||
|
||||
best = NULL;
|
||||
if (*newest_focus_order < sd->focus_order)
|
||||
{
|
||||
*newest_focus_order = sd->focus_order;
|
||||
best = obj;
|
||||
}
|
||||
EINA_LIST_FOREACH(sd->subobjs, l, child)
|
||||
{
|
||||
cur = elm_widget_newest_focus_order_get
|
||||
(child, newest_focus_order, can_focus_only);
|
||||
if (!cur) continue;
|
||||
best = cur;
|
||||
}
|
||||
if (can_focus_only)
|
||||
{
|
||||
if ((!best) || (!elm_widget_can_focus_get(best)))
|
||||
return;
|
||||
}
|
||||
*ret = best;
|
||||
return;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_widget_activate(Evas_Object *obj, Elm_Activate act)
|
||||
{
|
||||
|
@ -5712,6 +5725,7 @@ _class_constructor(Eo_Class *klass)
|
|||
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_TREE_UNFOCUSABLE_GET), _elm_widget_tree_unfocusable_get),
|
||||
|
||||
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_CAN_FOCUS_CHILD_LIST_GET), _elm_widget_can_focus_child_list_get),
|
||||
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_NEWEST_FOCUS_ORDER_GET), _elm_widget_newest_focus_order_get),
|
||||
|
||||
EO_OP_FUNC_SENTINEL
|
||||
};
|
||||
|
@ -5853,6 +5867,7 @@ static const Eo_Op_Description op_desc[] = {
|
|||
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_TREE_UNFOCUSABLE_GET, "Returns true, if the object sub-tree is unfocusable"),
|
||||
|
||||
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_CAN_FOCUS_CHILD_LIST_GET, "Get the list of focusable child objects."),
|
||||
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_NEWEST_FOCUS_ORDER_GET, "Get the newest focused object and its order."),
|
||||
|
||||
EO_OP_DESCRIPTION_SENTINEL
|
||||
};
|
||||
|
|
|
@ -633,6 +633,7 @@ EAPI Evas_Object *elm_widget_parent_get(const Evas_Object *obj);
|
|||
EAPI Evas_Object *elm_widget_parent2_get(const Evas_Object *obj);
|
||||
EAPI void elm_widget_parent2_set(Evas_Object *obj, Evas_Object *parent);
|
||||
EAPI void elm_widget_focus_steal(Evas_Object *obj);
|
||||
EAPI Evas_Object *elm_widget_newest_focus_order_get(Evas_Object *obj, unsigned int *newest_focus_order, Eina_Bool can_focus_only);
|
||||
EAPI Evas_Display_Mode elm_widget_display_mode_get(const Evas_Object *obj);
|
||||
EAPI void elm_widget_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode);
|
||||
EAPI const Elm_Widget_Smart_Class *elm_widget_smart_class_get(void);
|
||||
|
@ -1153,6 +1154,7 @@ enum
|
|||
ELM_WIDGET_SUB_ID_TREE_UNFOCUSABLE_GET,
|
||||
|
||||
ELM_WIDGET_SUB_ID_CAN_FOCUS_CHILD_LIST_GET,
|
||||
ELM_WIDGET_SUB_ID_NEWEST_FOCUS_ORDER_GET,
|
||||
#if 0
|
||||
ELM_WIDGET_SUB_ID_THEME, /* API + virtual*/
|
||||
ELM_WIDGET_SUB_ID_THEME_SPECIFIC,
|
||||
|
@ -2398,6 +2400,19 @@ typedef void * (*list_data_get_func_type)(const Eina_List * l);
|
|||
*/
|
||||
#define elm_wdg_can_focus_child_list_get(ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_CAN_FOCUS_CHILD_LIST_GET), EO_TYPECHECK(Eina_List **, ret)
|
||||
|
||||
/**
|
||||
* @def elm_wdg_newest_focus_order_get
|
||||
* @since 1.8
|
||||
*
|
||||
* No description supplied by the EAPI.
|
||||
*
|
||||
* @param[out] newest_focus_order
|
||||
* @param[in] can_focus_only
|
||||
* @param[out] ret
|
||||
*
|
||||
*/
|
||||
#define elm_wdg_newest_focus_order_get(newest_focus_order, can_focus_only, ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_NEWEST_FOCUS_ORDER_GET), EO_TYPECHECK(unsigned int *, newest_focus_order), EO_TYPECHECK(Eina_Bool, can_focus_only), EO_TYPECHECK(Evas_Object **, ret)
|
||||
|
||||
/**
|
||||
* @def elm_wdg_orientation_set
|
||||
* @since 1.8
|
||||
|
|
|
@ -93,7 +93,6 @@ struct _Elm_Win_Smart_Data
|
|||
} shot;
|
||||
int resize_location;
|
||||
int *autodel_clear, rot;
|
||||
int show_count;
|
||||
struct
|
||||
{
|
||||
int x, y;
|
||||
|
@ -786,16 +785,17 @@ _elm_win_focus_in(Ecore_Evas *ee)
|
|||
{
|
||||
Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
|
||||
Evas_Object *obj;
|
||||
unsigned int order = 0;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||
|
||||
obj = sd->obj;
|
||||
|
||||
_elm_widget_top_win_focused_set(obj, EINA_TRUE);
|
||||
if (!elm_widget_focus_order_get(obj))
|
||||
if (!elm_widget_focus_order_get(obj)
|
||||
|| (obj == elm_widget_newest_focus_order_get(obj, &order, EINA_TRUE)))
|
||||
{
|
||||
elm_widget_focus_steal(obj);
|
||||
sd->show_count++;
|
||||
}
|
||||
else
|
||||
elm_widget_focus_restore(obj);
|
||||
|
@ -1210,7 +1210,6 @@ _elm_win_smart_show(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
|
||||
TRAP(sd, show);
|
||||
|
||||
if (!sd->show_count) sd->show_count++;
|
||||
if (sd->shot.info) _shot_handle(sd);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue