summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-10-11 09:42:34 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-10-11 10:03:17 -0400
commitb7432f690f86a8c38374b813d3ca497476dbd3b6 (patch)
treeb75b37f61e3cc71dbd053824088068a76363a14e /src/lib/elementary
parent9d9aa8b6ae0c07ebe23e1ea3fcb81f8050311651 (diff)
efl_ui_focus_object: do not emit focus_geometry_changed when not needed
Summary: this is emitted a lot of times, which costs time. Most of the time they are however not needed. With this commit, these events are not emitted anymore. ref T8321 Reviewers: zmike, cedric Reviewed By: zmike, cedric Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T8321 Differential Revision: https://phab.enlightenment.org/D10348
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/efl_ui_focus_object.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/lib/elementary/efl_ui_focus_object.c b/src/lib/elementary/efl_ui_focus_object.c
index 92f8578..3c02b8c 100644
--- a/src/lib/elementary/efl_ui_focus_object.c
+++ b/src/lib/elementary/efl_ui_focus_object.c
@@ -7,10 +7,13 @@
7#include <Elementary.h> 7#include <Elementary.h>
8#include "elm_priv.h" 8#include "elm_priv.h"
9 9
10#define MY_CLASS EFL_UI_FOCUS_OBJECT_MIXIN
11
10typedef struct { 12typedef struct {
11 Eina_Bool old_focus; 13 Eina_Bool old_focus;
12 Eina_Bool ongoing_prepare_call; 14 Eina_Bool ongoing_prepare_call;
13 Eina_Bool child_focus; 15 Eina_Bool child_focus;
16 Eina_Bool focus_geom_changed;
14} Efl_Ui_Focus_Object_Data; 17} Efl_Ui_Focus_Object_Data;
15 18
16EOLIAN static void 19EOLIAN static void
@@ -65,5 +68,51 @@ _efl_ui_focus_object_child_focus_get(const Eo *obj EINA_UNUSED, Efl_Ui_Focus_Obj
65} 68}
66 69
67 70
71EOLIAN static Eina_Bool
72_efl_ui_focus_object_efl_object_event_callback_priority_add(Eo *obj, Efl_Ui_Focus_Object_Data *pd,
73 const Efl_Event_Description *desc,
74 Efl_Callback_Priority priority,
75 Efl_Event_Cb func,
76 const void *user_data)
77{
78 if (desc == EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_GEOMETRY_CHANGED)
79 {
80 pd->focus_geom_changed = EINA_TRUE;
81 }
82
83 return efl_event_callback_priority_add(efl_super(obj, MY_CLASS), desc, priority, func, user_data);
84}
85
86EOLIAN static Eina_Bool
87_efl_ui_focus_object_efl_object_event_callback_array_priority_add(Eo *obj, Efl_Ui_Focus_Object_Data *pd,
88 const Efl_Callback_Array_Item *array,
89 Efl_Callback_Priority priority,
90 const void *user_data)
91{
92 for (int i = 0; array[i].desc; ++i)
93 {
94 if (array[i].desc == EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_GEOMETRY_CHANGED)
95 {
96 pd->focus_geom_changed = EINA_TRUE;
97 }
98 }
99 return efl_event_callback_array_priority_add(efl_super(obj, MY_CLASS), array, priority, user_data);
100}
101
102
103EOLIAN static Eina_Bool
104_efl_ui_focus_object_efl_object_event_callback_call(Eo *obj, Efl_Ui_Focus_Object_Data *pd,
105 const Efl_Event_Description *desc,
106 void *event_info)
107{
108 if (desc == EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_GEOMETRY_CHANGED && !pd->focus_geom_changed)
109 return EINA_TRUE;
110 return efl_event_callback_call(efl_super(obj, MY_CLASS), desc, event_info);
111}
112
113#define EFL_UI_FOCUS_OBJECT_EXTRA_OPS \
114 EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, _efl_ui_focus_object_efl_object_event_callback_priority_add), \
115 EFL_OBJECT_OP_FUNC(efl_event_callback_array_priority_add, _efl_ui_focus_object_efl_object_event_callback_array_priority_add), \
116 EFL_OBJECT_OP_FUNC(efl_event_callback_call, _efl_ui_focus_object_efl_object_event_callback_call) \
68 117
69#include "efl_ui_focus_object.eo.c" 118#include "efl_ui_focus_object.eo.c"