}
static inline Eina_Bool
+_is_focused(Evas_Object *obj)
+{
+ API_ENTRY return EINA_FALSE;
+ return sd->focused;
+}
+
+static inline Eina_Bool
_elm_scrollable_is(const Evas_Object *obj)
{
INTERNAL_ENTRY EINA_FALSE;
if (_elm_widget_is(event->obj))
{
- if (elm_widget_focus_get(event->obj)) _parents_unfocus(sd->obj);
+ if (_is_focused(event->obj)) _parents_unfocus(sd->obj);
}
if (event->obj == sd->resize_obj)
{
ELM_WIDGET_DATA_GET(newest, sd2);
if (!sd2) return;
- if (!elm_widget_focus_get(newest))
+ if (!_is_focused(newest))
elm_widget_focus_steal(newest, NULL);
else
{
- if (sd2->resize_obj && elm_widget_focus_get(sd2->resize_obj))
+ if (sd2->resize_obj && _is_focused(sd2->resize_obj))
elm_widget_focused_object_clear(sd2->resize_obj);
else
{
EINA_LIST_FOREACH(sd2->subobjs, l, child)
{
if (!_elm_widget_is(child)) continue;
- if (elm_widget_focus_get(child))
+ if (_is_focused(child))
{
elm_widget_focused_object_clear(child);
break;
focus_order++;
sd->focus_order = focus_order;
+ sd->focused = EINA_TRUE;
if (sd->top_win_focused)
- {
- sd->focused = EINA_TRUE;
- elm_obj_widget_on_focus(obj, item);
- }
+ elm_obj_widget_on_focus(obj, item);
sd->focus_order_on_calc = EINA_FALSE;
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
elm_widget_theme(sobj);
}
- if (elm_widget_focus_get(sobj)) _parents_focus(obj);
+ if (_is_focused(sobj)) _parents_focus(obj);
elm_widget_display_mode_set(sobj,
evas_object_size_hint_display_mode_get(obj));
if (_elm_widget_is(sobj))
{
- if (elm_widget_focus_get(sobj))
+ if (_is_focused(sobj))
{
elm_widget_tree_unfocusable_set(sobj, EINA_TRUE);
elm_widget_tree_unfocusable_set(sobj, EINA_FALSE);
if (_elm_widget_is(sd->resize_obj))
{
- if (elm_widget_focus_get(sd->resize_obj)) _parents_unfocus(obj);
+ if (_is_focused(sd->resize_obj)) _parents_unfocus(obj);
}
elm_widget_sub_object_del(obj, sd->resize_obj);
}
EOLIAN static Eina_Bool
_elm_widget_focus_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
{
- return sd->focused;
+ return (sd->focused && sd->top_win_focused);
}
EOLIAN static Eina_Bool
const Evas_Object *subobj;
const Eina_List *l;
- if (!sd->focused) return NULL;
+ if (!sd->focused || !sd->top_win_focused) return NULL;
EINA_LIST_FOREACH(sd->subobjs, l, subobj)
{
Evas_Object *fobj;
double weight = 0.0;
if (!_elm_widget_is(obj)) return EINA_FALSE;
- if (!elm_widget_focus_get(obj)) return EINA_FALSE;
+ if (!_is_focused(obj)) return EINA_FALSE;
current_focused = elm_widget_focused_object_get(obj);
return int_ret;
}
- if (!elm_widget_can_focus_get(obj) || elm_widget_focus_get(obj))
+ if (!elm_widget_can_focus_get(obj) || _is_focused((Eo *)obj))
return EINA_FALSE;
c_weight = _elm_widget_focus_direction_weight_get(base, obj, degree);
{
Eina_Bool int_ret = EINA_FALSE;
int_ret = elm_obj_widget_focus_next((Eo *)obj, dir, next, next_item);
- if (!int_ret && elm_widget_focus_get(obj))
+ if (!int_ret && _is_focused((Eo *)obj))
{
Evas_Object *o = NULL;
if (dir == ELM_FOCUS_PREVIOUS)
else if (!elm_widget_can_focus_get(obj))
return EINA_FALSE;
- if (elm_widget_focus_get(obj))
+ if (_is_focused((Eo *)obj))
{
if (dir == ELM_FOCUS_PREVIOUS)
*next_item = sd->item_focus_previous;
|| (dir == ELM_FOCUS_RIGHT)
|| (dir == ELM_FOCUS_LEFT))
{
- if (tmp && elm_widget_focus_get(cur))
+ if (tmp && _is_focused(cur))
{
*next = tmp;
*next_item = tmp_item;
_focused_object_clear(Elm_Widget_Smart_Data *sd)
{
if (sd->resize_obj && elm_widget_is(sd->resize_obj) &&
- elm_widget_focus_get(sd->resize_obj))
+ _is_focused(sd->resize_obj))
{
elm_obj_widget_focused_object_clear(sd->resize_obj);
}
Evas_Object *child;
EINA_LIST_FOREACH(sd->subobjs, l, child)
{
- if (_elm_widget_is(child) && elm_widget_focus_get(child))
+ if (_elm_widget_is(child) && _is_focused(child))
{
elm_obj_widget_focused_object_clear(child);
break;
if (!sd->focused) return;
_focused_object_clear(sd);
sd->focused = EINA_FALSE;
- elm_obj_widget_on_focus(obj, NULL);
+ if (sd->top_win_focused)
+ elm_obj_widget_on_focus(obj, NULL);
}
EOLIAN static void
return;
}
+static void
+_parents_on_focus(Evas_Object *obj)
+{
+ API_ENTRY return;
+ if (!sd->focused || !sd->top_win_focused) return;
+
+ Evas_Object *o = elm_widget_parent_get(obj);
+ if (o) _parents_on_focus(o);
+ elm_obj_widget_on_focus(obj, NULL);
+}
+
EOLIAN static void
_elm_widget_focus_restore(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED)
{
newest = elm_widget_newest_focus_order_get(obj, &newest_focus_order, EINA_TRUE);
if (newest)
- {
- elm_object_focus_set(newest, EINA_FALSE);
- elm_object_focus_set(newest, EINA_TRUE);
- }
+ _parents_on_focus(newest);
}
void
_elm_widget_top_win_focused_set(child, top_win_focused);
}
sd->top_win_focused = top_win_focused;
+
+ if (sd->focused && !sd->top_win_focused)
+ elm_obj_widget_on_focus(obj, NULL);
}
Eina_Bool
{
Elm_Win_Data *sd = _elm_win_associate_get(ee);
Evas_Object *obj;
- unsigned int order = 0;
if ((!sd) || (sd->modal_count)) return;
_elm_widget_top_win_focused_set(obj, EINA_TRUE);
if (sd->type != ELM_WIN_FAKE)
{
- if (!elm_widget_focus_order_get(obj)
- || (obj == elm_widget_newest_focus_order_get(obj, &order, EINA_TRUE)))
+ if (!elm_widget_focus_order_get(obj))
{
elm_widget_focus_steal(obj, NULL);
}
newest = elm_widget_newest_focus_order_get
(obj, &newest_focus_order, EINA_TRUE);
- if (newest && _elm_widget_onscreen_is(newest))
+ if (newest &&
+ (_elm_widget_onscreen_is(newest) || (newest == obj)))
elm_widget_focus_restore(obj);
else
evas_object_focus_set(obj, EINA_TRUE);
obj = sd->obj;
- elm_object_focus_set(obj, EINA_FALSE);
_elm_widget_top_win_focused_set(obj, EINA_FALSE);
// FIXME: the event is deprecated but still in use.
// Has to be removed in EFL2.0