summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-07-24 23:35:26 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-07-24 23:40:38 +0200
commitdd883a706407e0983168bdfad307ade0ca2787b9 (patch)
tree97a4d6e3ceba4a513d7b38d35e79eefaa029f032
parent6f0b79fe4b9552f3b3f29f72241ed6b79ce3532c (diff)
downloadefl-dd883a706407e0983168bdfad307ade0ca2787b9.tar.gz
elm_widget: only emit events when there is really a changed manager
A manager change to NULL is to be used as "this object is not registered anymore" call, which will happen quite regular during shutdown.
-rw-r--r--src/lib/elementary/efl_ui_focus_manager_sub.c2
-rw-r--r--src/lib/elementary/elm_widget.c33
-rw-r--r--src/lib/elementary/elm_widget.h1
3 files changed, 22 insertions, 14 deletions
diff --git a/src/lib/elementary/efl_ui_focus_manager_sub.c b/src/lib/elementary/efl_ui_focus_manager_sub.c
index 73a7691f67..02f0898a8c 100644
--- a/src/lib/elementary/efl_ui_focus_manager_sub.c
+++ b/src/lib/elementary/efl_ui_focus_manager_sub.c
@@ -250,4 +250,4 @@ _efl_ui_focus_manager_sub_efl_object_destructor(Eo *obj, Efl_Ui_Focus_Manager_Su
}
-#include "efl_ui_focus_manager_sub.eo.c" \ No newline at end of file
+#include "efl_ui_focus_manager_sub.eo.c"
diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c
index ede91bf82c..8b758a940b 100644
--- a/src/lib/elementary/elm_widget.c
+++ b/src/lib/elementary/elm_widget.c
@@ -291,7 +291,7 @@ _focus_state_eval(Eo *obj, Elm_Widget_Smart_Data *pd)
{
Eina_Bool should = EINA_FALSE;
Eina_Bool want_full = EINA_FALSE;
- Efl_Ui_Focus_Manager *manager = efl_ui_focus_user_manager_get(obj);
+ Efl_Ui_Focus_Manager *manager = pd->manager.manager;
//there are two reasons to be registered, the child count is bigger than 0, or the widget is flagged to be able to handle focus
if (pd->can_focus)
@@ -331,22 +331,25 @@ _focus_state_eval(Eo *obj, Elm_Widget_Smart_Data *pd)
{
efl_ui_focus_manager_unregister(pd->focus.manager, obj);
pd->focus.manager = NULL;
+ pd->focus.parent = NULL;
}
//now register in the manager
if (should && !pd->focus.manager)
{
- if (manager != obj)
+ if (manager && manager != obj)
{
if (!pd->logical.parent) return;
pd->focus.manager = manager;
pd->focus.logical = !want_full;
+ pd->focus.parent = pd->logical.parent;
if (!elm_obj_widget_focus_register(obj, pd->focus.manager,
- pd->logical.parent, &pd->focus.logical))
+ pd->focus.parent, &pd->focus.logical))
{
pd->focus.manager = NULL;
+ pd->focus.parent = NULL;
}
}
}
@@ -354,6 +357,7 @@ _focus_state_eval(Eo *obj, Elm_Widget_Smart_Data *pd)
{
efl_ui_focus_manager_unregister(pd->focus.manager, obj);
pd->focus.manager = NULL;
+ pd->focus.parent = NULL;
}
}
@@ -402,6 +406,7 @@ static void
_full_eval(Eo *obj, Elm_Widget_Smart_Data *pd)
{
Efl_Ui_Focus_Object *old_parent, *old_manager;
+ Efl_Ui_Focus_Object *old_registered_parent, *old_registered_manager;
old_parent = _logical_parent_eval(obj, pd);
old_manager = _focus_manager_eval(obj, pd);
@@ -420,19 +425,21 @@ _full_eval(Eo *obj, Elm_Widget_Smart_Data *pd)
_focus_state_eval(pd->logical.parent, new_pd);
}
+ old_registered_parent = pd->focus.parent;
+ old_registered_manager = pd->focus.manager;
+
_focus_state_eval(obj, pd);
- if (old_parent != pd->logical.parent)
+ if (old_registered_parent != pd->focus.parent)
{
efl_event_callback_call(obj,
- EFL_UI_FOCUS_USER_EVENT_LOGICAL_CHANGED, old_parent);
+ EFL_UI_FOCUS_USER_EVENT_LOGICAL_CHANGED, old_registered_parent);
}
- if (old_manager != pd->manager.manager)
+ if (old_registered_manager != pd->focus.manager)
{
- //emit signal
efl_event_callback_call(obj,
- EFL_UI_FOCUS_USER_EVENT_MANAGER_CHANGED, old_manager);
+ EFL_UI_FOCUS_USER_EVENT_MANAGER_CHANGED, old_registered_manager);
}
}
@@ -780,7 +787,7 @@ _elm_widget_efl_gfx_visible_set(Eo *obj, Elm_Widget_Smart_Data *pd, Eina_Bool vi
efl_gfx_visible_set(efl_super(obj, MY_CLASS), vis);
- _focus_state_eval(obj, pd);
+ _full_eval(obj, pd);
it = evas_object_smart_iterator_new(obj);
EINA_ITERATOR_FOREACH(it, o)
@@ -1715,7 +1722,7 @@ _elm_widget_can_focus_set(Eo *obj, Elm_Widget_Smart_Data *sd, Eina_Bool can_focu
efl_event_callback_array_del(obj, focus_callbacks(), NULL);
}
if (efl_finalized_get(obj))
- _focus_state_eval(obj, sd);
+ _full_eval(obj, sd);
}
EOLIAN static Eina_Bool
@@ -6200,7 +6207,7 @@ _elm_widget_efl_object_finalize(Eo *obj, Elm_Widget_Smart_Data *pd)
eo = efl_finalize(efl_super(obj, MY_CLASS));
- _focus_state_eval(obj, pd);
+ _full_eval(obj, pd);
return eo;
}
@@ -6483,13 +6490,13 @@ _elm_widget_efl_object_provider_find(Eo *obj, Elm_Widget_Smart_Data *pd, const E
EOLIAN static Efl_Ui_Focus_Manager*
_elm_widget_efl_ui_focus_user_parent_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *pd EINA_UNUSED)
{
- return pd->logical.parent;
+ return pd->focus.parent;
}
EOLIAN static Efl_Ui_Focus_Manager*
_elm_widget_efl_ui_focus_user_manager_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *pd EINA_UNUSED)
{
- return pd->manager.manager;
+ return pd->focus.manager;
}
EOLIAN static Eina_Rectangle
diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h
index 4b7b55c8c1..bcfb5aed52 100644
--- a/src/lib/elementary/elm_widget.h
+++ b/src/lib/elementary/elm_widget.h
@@ -434,6 +434,7 @@ typedef struct _Elm_Widget_Smart_Data
struct {
Efl_Ui_Focus_Manager *manager; //manager which is currently regsitered in
+ Efl_Ui_Focus_Object *parent; //the parent where it is currently registered
Eina_Bool logical;
} focus;
struct {