summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2018-04-06 12:48:41 +0200
committerMarcel Hollerbach <marcel@osg.samsung.com>2018-04-09 18:27:45 +0200
commit78f4babbb5bc13eb4349cfaca419ef60736333a9 (patch)
tree89b3915f4d18e11f043bfb013372afbb83359446
parente70bf4e2311885d1302ce13254938d9ee3a2a494 (diff)
efl_ui_focus_object:
make the prepare call safe to recursive calls. There is no need to prepare a item again if it is already in prepare.
-rw-r--r--src/lib/elementary/efl_ui_focus_composition.c4
-rw-r--r--src/lib/elementary/efl_ui_focus_composition.eo2
-rw-r--r--src/lib/elementary/efl_ui_focus_object.c14
-rw-r--r--src/lib/elementary/efl_ui_focus_object.eo6
-rw-r--r--src/lib/elementary/elm_gengrid.c4
-rw-r--r--src/lib/elementary/elm_gengrid_item.eo2
-rw-r--r--src/lib/elementary/elm_genlist.c8
-rw-r--r--src/lib/elementary/elm_genlist_item.eo2
-rw-r--r--src/lib/elementary/elm_widget_item_static_focus.c6
-rw-r--r--src/lib/elementary/elm_widget_item_static_focus.eo2
10 files changed, 34 insertions, 16 deletions
diff --git a/src/lib/elementary/efl_ui_focus_composition.c b/src/lib/elementary/efl_ui_focus_composition.c
index c1a76ef271..261dab2882 100644
--- a/src/lib/elementary/efl_ui_focus_composition.c
+++ b/src/lib/elementary/efl_ui_focus_composition.c
@@ -155,7 +155,7 @@ _efl_ui_focus_composition_dirty(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Composition_Da
155} 155}
156 156
157EOLIAN static void 157EOLIAN static void
158_efl_ui_focus_composition_efl_ui_focus_object_prepare_logical(Eo *obj, Efl_Ui_Focus_Composition_Data *pd EINA_UNUSED) 158_efl_ui_focus_composition_efl_ui_focus_object_prepare_logical_none_recursive(Eo *obj, Efl_Ui_Focus_Composition_Data *pd EINA_UNUSED)
159{ 159{
160 if (pd->dirty) 160 if (pd->dirty)
161 { 161 {
@@ -163,7 +163,7 @@ _efl_ui_focus_composition_efl_ui_focus_object_prepare_logical(Eo *obj, Efl_Ui_Fo
163 pd->dirty = EINA_FALSE; 163 pd->dirty = EINA_FALSE;
164 } 164 }
165 165
166 efl_ui_focus_object_prepare_logical(efl_super(obj, MY_CLASS)); 166 efl_ui_focus_object_prepare_logical_none_recursive(efl_super(obj, MY_CLASS));
167} 167}
168 168
169EOLIAN static void 169EOLIAN static void
diff --git a/src/lib/elementary/efl_ui_focus_composition.eo b/src/lib/elementary/efl_ui_focus_composition.eo
index 11e632bca8..2538078d84 100644
--- a/src/lib/elementary/efl_ui_focus_composition.eo
+++ b/src/lib/elementary/efl_ui_focus_composition.eo
@@ -47,7 +47,7 @@ mixin Efl.Ui.Focus.Composition (Efl.Interface, Efl.Ui.Widget) {
47 } 47 }
48 implements { 48 implements {
49 Efl.Ui.Widget.focus_state_apply; 49 Efl.Ui.Widget.focus_state_apply;
50 Efl.Ui.Focus.Object.prepare_logical; 50 Efl.Ui.Focus.Object.prepare_logical_none_recursive;
51 @empty .prepare; 51 @empty .prepare;
52 } 52 }
53} 53}
diff --git a/src/lib/elementary/efl_ui_focus_object.c b/src/lib/elementary/efl_ui_focus_object.c
index df565b4300..71764c4eae 100644
--- a/src/lib/elementary/efl_ui_focus_object.c
+++ b/src/lib/elementary/efl_ui_focus_object.c
@@ -9,6 +9,7 @@
9 9
10typedef struct { 10typedef struct {
11 Eina_Bool old_focus; 11 Eina_Bool old_focus;
12 Eina_Bool ongoing_prepare_call;
12} Efl_Ui_Focus_Object_Data; 13} Efl_Ui_Focus_Object_Data;
13 14
14EOLIAN static void 15EOLIAN static void
@@ -26,5 +27,18 @@ _efl_ui_focus_object_focus_get(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Object_Data *pd
26 return pd->old_focus; 27 return pd->old_focus;
27} 28}
28 29
30EOLIAN static void
31_efl_ui_focus_object_prepare_logical(Eo *obj, Efl_Ui_Focus_Object_Data *pd)
32{
33 if (pd->ongoing_prepare_call) return;
34
35 pd->ongoing_prepare_call = EINA_TRUE;
36
37 efl_ui_focus_object_prepare_logical_none_recursive(obj);
38
39 pd->ongoing_prepare_call = EINA_FALSE;
40}
41
42
29 43
30#include "efl_ui_focus_object.eo.c" 44#include "efl_ui_focus_object.eo.c"
diff --git a/src/lib/elementary/efl_ui_focus_object.eo b/src/lib/elementary/efl_ui_focus_object.eo
index a8ce1130b8..901de5d44b 100644
--- a/src/lib/elementary/efl_ui_focus_object.eo
+++ b/src/lib/elementary/efl_ui_focus_object.eo
@@ -56,10 +56,14 @@ mixin Efl.Ui.Focus.Object
56 } 56 }
57 prepare_logical { 57 prepare_logical {
58 [[Tells the object that its children will be queried soon by the given manager. 58 [[Tells the object that its children will be queried soon by the given manager.
59 The call will be a NOP if there is already a active preprare_logical call on this object
59 60
60 Deleting manager items in this call will result in undefied behaviour and may cause your system to crash. 61 Deleting manager items in this call will result in undefied behaviour and may cause your system to crash.
61 ]] 62 ]]
62 } 63 }
64 prepare_logical_none_recursive @protected {
65 [[]]
66 }
63 on_focus_update @protected @pure_virtual { 67 on_focus_update @protected @pure_virtual {
64 [[Virtual function handling focus in/out events on the widget]] 68 [[Virtual function handling focus in/out events on the widget]]
65 return: bool; [[$true if this widget can handle focus, $false otherwise]] 69 return: bool; [[$true if this widget can handle focus, $false otherwise]]
@@ -67,7 +71,7 @@ mixin Efl.Ui.Focus.Object
67 } 71 }
68 implements { 72 implements {
69 @empty .focus_geometry; 73 @empty .focus_geometry;
70 @empty .prepare_logical; 74 @empty .prepare_logical_none_recursive;
71 @empty .focus_manager; 75 @empty .focus_manager;
72 @empty .focus_parent; 76 @empty .focus_parent;
73 } 77 }
diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c
index 2659ff0b22..be5879cae7 100644
--- a/src/lib/elementary/elm_gengrid.c
+++ b/src/lib/elementary/elm_gengrid.c
@@ -5742,7 +5742,7 @@ _elm_gengrid_efl_ui_widget_focus_state_apply(Eo *obj, Elm_Gengrid_Data *pd EINA_
5742} 5742}
5743 5743
5744EOLIAN static void 5744EOLIAN static void
5745_elm_gengrid_item_efl_ui_focus_object_prepare_logical(Eo *obj, Elm_Gen_Item *pd) 5745_elm_gengrid_item_efl_ui_focus_object_prepare_logical_none_recursive(Eo *obj, Elm_Gen_Item *pd)
5746{ 5746{
5747 Eina_List *n; 5747 Eina_List *n;
5748 Efl_Ui_Widget *wid; 5748 Efl_Ui_Widget *wid;
@@ -5753,7 +5753,7 @@ _elm_gengrid_item_efl_ui_focus_object_prepare_logical(Eo *obj, Elm_Gen_Item *pd)
5753 _elm_widget_full_eval(wid); 5753 _elm_widget_full_eval(wid);
5754 } 5754 }
5755 5755
5756 efl_ui_focus_object_prepare_logical(efl_super(obj, ELM_GENGRID_ITEM_CLASS)); 5756 efl_ui_focus_object_prepare_logical_none_recursive(efl_super(obj, ELM_GENGRID_ITEM_CLASS));
5757} 5757}
5758 5758
5759/* Standard widget overrides */ 5759/* Standard widget overrides */
diff --git a/src/lib/elementary/elm_gengrid_item.eo b/src/lib/elementary/elm_gengrid_item.eo
index e761d9deb9..4f2b0370a8 100644
--- a/src/lib/elementary/elm_gengrid_item.eo
+++ b/src/lib/elementary/elm_gengrid_item.eo
@@ -255,6 +255,6 @@ class Elm.Gengrid.Item(Elm.Widget.Item.Static_Focus, Efl.Ui.Focus.Object, Efl.Ui
255 Elm.Widget.Item.cursor_unset; 255 Elm.Widget.Item.cursor_unset;
256 Efl.Access.i18n_name { get; } 256 Efl.Access.i18n_name { get; }
257 Efl.Access.state_set { get; } 257 Efl.Access.state_set { get; }
258 Efl.Ui.Focus.Object.prepare_logical; 258 Efl.Ui.Focus.Object.prepare_logical_none_recursive;
259 } 259 }
260} 260}
diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index ff361b8cb1..82025ebe0a 100644
--- a/src/lib/elementary/elm_genlist.c
+++ b/src/lib/elementary/elm_genlist.c
@@ -8988,7 +8988,7 @@ _elm_genlist_efl_object_provider_find(const Eo *obj, Elm_Genlist_Data *pd, const
8988 return efl_provider_find(efl_super(obj, ELM_GENLIST_CLASS), klass); 8988 return efl_provider_find(efl_super(obj, ELM_GENLIST_CLASS), klass);
8989} 8989}
8990 8990
8991EOLIAN static void 8991EOLIAN static void
8992_elm_genlist_efl_ui_focus_composition_prepare(Eo *obj, Elm_Genlist_Data *pd) 8992_elm_genlist_efl_ui_focus_composition_prepare(Eo *obj, Elm_Genlist_Data *pd)
8993{ 8993{
8994 Elm_Gen_Item *item; 8994 Elm_Gen_Item *item;
@@ -9015,7 +9015,7 @@ _elm_genlist_efl_ui_focus_composition_prepare(Eo *obj, Elm_Genlist_Data *pd)
9015} 9015}
9016 9016
9017EOLIAN static void 9017EOLIAN static void
9018_elm_genlist_item_efl_ui_focus_object_prepare_logical(Eo *obj, Elm_Gen_Item *pd) 9018_elm_genlist_item_efl_ui_focus_object_prepare_logical_none_recursive(Eo *obj, Elm_Gen_Item *pd)
9019{ 9019{
9020 Eina_List *n; 9020 Eina_List *n;
9021 Efl_Ui_Widget *wid; 9021 Efl_Ui_Widget *wid;
@@ -9026,10 +9026,10 @@ _elm_genlist_item_efl_ui_focus_object_prepare_logical(Eo *obj, Elm_Gen_Item *pd)
9026 _elm_widget_full_eval(wid); 9026 _elm_widget_full_eval(wid);
9027 } 9027 }
9028 9028
9029 efl_ui_focus_object_prepare_logical(efl_super(obj, ELM_GENLIST_ITEM_CLASS)); 9029 efl_ui_focus_object_prepare_logical_none_recursive(efl_super(obj, ELM_GENLIST_ITEM_CLASS));
9030} 9030}
9031 9031
9032EOLIAN static Eina_Bool 9032EOLIAN static Eina_Bool
9033_elm_genlist_efl_ui_widget_focus_state_apply(Eo *obj, Elm_Genlist_Data *pd EINA_UNUSED, Efl_Ui_Widget_Focus_State current_state, Efl_Ui_Widget_Focus_State *configured_state, Efl_Ui_Widget *redirect EINA_UNUSED) 9033_elm_genlist_efl_ui_widget_focus_state_apply(Eo *obj, Elm_Genlist_Data *pd EINA_UNUSED, Efl_Ui_Widget_Focus_State current_state, Efl_Ui_Widget_Focus_State *configured_state, Efl_Ui_Widget *redirect EINA_UNUSED)
9034{ 9034{
9035 return efl_ui_widget_focus_state_apply(efl_super(obj, MY_CLASS), current_state, configured_state, obj); 9035 return efl_ui_widget_focus_state_apply(efl_super(obj, MY_CLASS), current_state, configured_state, obj);
diff --git a/src/lib/elementary/elm_genlist_item.eo b/src/lib/elementary/elm_genlist_item.eo
index fcc789ddbf..aba6d872bb 100644
--- a/src/lib/elementary/elm_genlist_item.eo
+++ b/src/lib/elementary/elm_genlist_item.eo
@@ -462,6 +462,6 @@ class Elm.Genlist.Item(Elm.Widget.Item.Static_Focus, Efl.Ui.Legacy)
462 Elm.Widget.Item.cursor_unset; 462 Elm.Widget.Item.cursor_unset;
463 Efl.Access.i18n_name { get; } 463 Efl.Access.i18n_name { get; }
464 Efl.Access.state_set { get; } 464 Efl.Access.state_set { get; }
465 Efl.Ui.Focus.Object.prepare_logical; 465 Efl.Ui.Focus.Object.prepare_logical_none_recursive;
466 } 466 }
467} 467}
diff --git a/src/lib/elementary/elm_widget_item_static_focus.c b/src/lib/elementary/elm_widget_item_static_focus.c
index 09a892326c..a1301ff793 100644
--- a/src/lib/elementary/elm_widget_item_static_focus.c
+++ b/src/lib/elementary/elm_widget_item_static_focus.c
@@ -46,12 +46,12 @@ _unrealized_cb(void *data, const Efl_Event *ev EINA_UNUSED)
46} 46}
47 47
48EOLIAN static void 48EOLIAN static void
49_elm_widget_item_static_focus_efl_ui_focus_object_prepare_logical(Eo *obj, Elm_Widget_Item_Static_Focus_Data *pd EINA_UNUSED) 49_elm_widget_item_static_focus_efl_ui_focus_object_prepare_logical_none_recursive(Eo *obj, Elm_Widget_Item_Static_Focus_Data *pd EINA_UNUSED)
50{ 50{
51 Eo *logical_child; 51 Eo *logical_child;
52 Elm_Widget_Item_Data *wpd = efl_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS); 52 Elm_Widget_Item_Data *wpd = efl_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
53 53
54 efl_ui_focus_object_prepare_logical(efl_super(obj, MY_CLASS)); 54 efl_ui_focus_object_prepare_logical_none_recursive(efl_super(obj, MY_CLASS));
55 55
56 if (!pd->realized) 56 if (!pd->realized)
57 { 57 {
@@ -102,7 +102,7 @@ _elm_widget_item_static_focus_efl_object_constructor(Eo *obj, Elm_Widget_Item_St
102 return ret; 102 return ret;
103} 103}
104 104
105EOLIAN static void 105EOLIAN static void
106_elm_widget_item_static_focus_efl_object_destructor(Eo *obj, Elm_Widget_Item_Static_Focus_Data *pd EINA_UNUSED) 106_elm_widget_item_static_focus_efl_object_destructor(Eo *obj, Elm_Widget_Item_Static_Focus_Data *pd EINA_UNUSED)
107{ 107{
108 Elm_Widget_Item_Data *wpd = efl_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS); 108 Elm_Widget_Item_Data *wpd = efl_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
diff --git a/src/lib/elementary/elm_widget_item_static_focus.eo b/src/lib/elementary/elm_widget_item_static_focus.eo
index 1ea4b9344e..51d0fd0e46 100644
--- a/src/lib/elementary/elm_widget_item_static_focus.eo
+++ b/src/lib/elementary/elm_widget_item_static_focus.eo
@@ -4,6 +4,6 @@ class Elm.Widget.Item.Static_Focus (Elm.Widget.Item, Efl.Ui.Focus.Object)
4 implements { 4 implements {
5 Efl.Object.constructor; 5 Efl.Object.constructor;
6 Efl.Object.destructor; 6 Efl.Object.destructor;
7 Efl.Ui.Focus.Object.prepare_logical; 7 Efl.Ui.Focus.Object.prepare_logical_none_recursive;
8 } 8 }
9} 9}