From 4f64dc84414fc32f8b363937e93c371e43bd1278 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Tue, 2 Aug 2011 10:34:30 +0000 Subject: [PATCH] fix re-focusing of widgets once inlined window is focus. kind of tricky requiring a 2nd shadowed parent. SVN revision: 61989 --- legacy/elementary/src/lib/elm_widget.c | 51 +++++++++++++++++++------- legacy/elementary/src/lib/elm_widget.h | 2 + legacy/elementary/src/lib/elm_win.c | 2 + 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/legacy/elementary/src/lib/elm_widget.c b/legacy/elementary/src/lib/elm_widget.c index 637cd0dd47..cf9d8e350a 100644 --- a/legacy/elementary/src/lib/elm_widget.c +++ b/legacy/elementary/src/lib/elm_widget.c @@ -19,6 +19,7 @@ struct _Smart_Data Evas_Object *obj; const char *type; Evas_Object *parent_obj; + Evas_Object *parent2; Evas_Coord x, y, w, h; Eina_List *subobjs; Evas_Object *resize_obj; @@ -1230,6 +1231,24 @@ elm_widget_parent_widget_get(const Evas_Object *obj) return parent; } +EAPI Evas_Object * +elm_widget_parent2_get(const Evas_Object *obj) +{ + if (_elm_widget_is(obj)) + { + Smart_Data *sd = evas_object_smart_data_get(obj); + if (sd) return sd->parent2; + } + return NULL; +} + +EAPI void +elm_widget_parent2_set(Evas_Object *obj, Evas_Object *parent) +{ + API_ENTRY return; + sd->parent2 = parent; +} + EAPI void elm_widget_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, @@ -1821,7 +1840,7 @@ elm_widget_focused_object_clear(Evas_Object *obj) EAPI void elm_widget_focus_steal(Evas_Object *obj) { - Evas_Object *parent, *o; + Evas_Object *parent, *parent2, *o; API_ENTRY return; if (sd->focused) return; @@ -1838,24 +1857,30 @@ elm_widget_focus_steal(Evas_Object *obj) if (sd->focused) break; parent = o; } - if (!elm_widget_parent_get(parent)) - elm_widget_focused_object_clear(parent); + if ((!elm_widget_parent_get(parent)) && + (!elm_widget_parent2_get(parent))) + elm_widget_focused_object_clear(parent); else { - parent = elm_widget_parent_get(parent); + parent2 = elm_widget_parent_get(parent); + if (!parent2) parent2 = elm_widget_parent2_get(parent); + parent = parent2; sd = evas_object_smart_data_get(parent); - if ((sd->resize_obj) && (elm_widget_focus_get(sd->resize_obj))) - elm_widget_focused_object_clear(sd->resize_obj); - else + if (sd) { - const Eina_List *l; - Evas_Object *child; - EINA_LIST_FOREACH(sd->subobjs, l, child) + if ((sd->resize_obj) && (elm_widget_focus_get(sd->resize_obj))) + elm_widget_focused_object_clear(sd->resize_obj); + else { - if (elm_widget_focus_get(child)) + const Eina_List *l; + Evas_Object *child; + EINA_LIST_FOREACH(sd->subobjs, l, child) { - elm_widget_focused_object_clear(child); - break; + if (elm_widget_focus_get(child)) + { + elm_widget_focused_object_clear(child); + break; + } } } } diff --git a/legacy/elementary/src/lib/elm_widget.h b/legacy/elementary/src/lib/elm_widget.h index b233d97c06..32d85e1fbb 100644 --- a/legacy/elementary/src/lib/elm_widget.h +++ b/legacy/elementary/src/lib/elm_widget.h @@ -272,6 +272,8 @@ EAPI Eina_Bool elm_widget_focus_list_next_get(const Evas_Object *obj, con EAPI void elm_widget_focus_set(Evas_Object *obj, int first); EAPI void elm_widget_focused_object_clear(Evas_Object *obj); 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 void elm_widget_activate(Evas_Object *obj); EAPI void elm_widget_change(Evas_Object *obj); diff --git a/legacy/elementary/src/lib/elm_win.c b/legacy/elementary/src/lib/elm_win.c index 098b9db65f..fc06829b52 100644 --- a/legacy/elementary/src/lib/elm_win.c +++ b/legacy/elementary/src/lib/elm_win.c @@ -1491,6 +1491,8 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type) evas_object_layer_set(win->win_obj, 50); evas_object_pass_events_set(win->win_obj, EINA_TRUE); + if (type == ELM_WIN_INLINED_IMAGE) + elm_widget_parent2_set(win->win_obj, parent); ecore_evas_object_associate(win->ee, win->win_obj, ECORE_EVAS_OBJECT_ASSOCIATE_BASE | ECORE_EVAS_OBJECT_ASSOCIATE_STACK |