summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWoochanlee <wc0917.lee@samsung.com>2019-12-03 07:14:29 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-12-03 09:53:37 +0100
commitfc456d2b77b00b33f6904f882cae69763b59f192 (patch)
tree5e455efc4eeb212ff898d0fbdbd1f9d4f01a91e7
parentdfae8c518551b55ad4376d825eacde626cc0b977 (diff)
gesture_manager: Changed function param to reduce internal function calls.
The filter_event function calling a lot of times when it runs. This can help performance by reducing the number of calls to the efl_data_scope_get() function. Reviewed-by: Hermet Park <hermetpark@gmail.com> Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D10437
-rw-r--r--src/lib/evas/canvas/evas_callbacks.c16
-rw-r--r--src/lib/evas/canvas/evas_main.c1
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_manager.c9
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_manager.eo2
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_touch.c9
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_touch.eo5
-rw-r--r--src/lib/evas/include/evas_private.h4
7 files changed, 19 insertions, 27 deletions
diff --git a/src/lib/evas/canvas/evas_callbacks.c b/src/lib/evas/canvas/evas_callbacks.c
index d19ce68..d9aac15 100644
--- a/src/lib/evas/canvas/evas_callbacks.c
+++ b/src/lib/evas/canvas/evas_callbacks.c
@@ -393,7 +393,7 @@ evas_object_event_callback_call(Evas_Object *eo_obj, Evas_Object_Protected_Data
393 type == EVAS_CALLBACK_MULTI_DOWN || 393 type == EVAS_CALLBACK_MULTI_DOWN ||
394 type == EVAS_CALLBACK_MOUSE_UP || 394 type == EVAS_CALLBACK_MOUSE_UP ||
395 type == EVAS_CALLBACK_MULTI_UP) 395 type == EVAS_CALLBACK_MULTI_UP)
396 _efl_canvas_gesture_manager_filter_event(e->gesture_manager, eo_obj, event_info); 396 _efl_canvas_gesture_manager_filter_event(e->gmd, eo_obj, event_info);
397 397
398 if (obj->is_smart) 398 if (obj->is_smart)
399 _evas_object_smart_callback_call_internal(eo_obj, efl_event_desc); 399 _evas_object_smart_callback_call_internal(eo_obj, efl_event_desc);
@@ -817,17 +817,12 @@ void
817evas_object_callbacks_event_catcher_add(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, const Efl_Callback_Array_Item *array) 817evas_object_callbacks_event_catcher_add(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, const Efl_Callback_Array_Item *array)
818{ 818{
819 Evas_Callback_Type type = EVAS_CALLBACK_LAST; 819 Evas_Callback_Type type = EVAS_CALLBACK_LAST;
820 void *gd = NULL;
821 int i; 820 int i;
822 821
823 for (i = 0; array[i].desc != NULL; i++) 822 for (i = 0; array[i].desc != NULL; i++)
824 { 823 {
825 if (obj->layer && obj->layer->evas && obj->layer->evas->gesture_manager) 824 if (obj->layer && obj->layer->evas && obj->layer->evas->gesture_manager)
826 { 825 _efl_canvas_gesture_manager_callback_add_hook(obj->layer->evas->gmd, obj->object, array[i].desc);
827 if (!gd) gd = _efl_canvas_gesture_manager_private_data_get(obj->layer->evas->gesture_manager);
828
829 _efl_canvas_gesture_manager_callback_add_hook(gd, obj->object, array[i].desc);
830 }
831 826
832 if (array[i].desc == EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK) 827 if (array[i].desc == EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK)
833 { 828 {
@@ -855,7 +850,6 @@ evas_object_callbacks_event_catcher_add(Eo *eo_obj EINA_UNUSED, Evas_Object_Prot
855void 850void
856evas_object_callbacks_event_catcher_del(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, const Efl_Callback_Array_Item *array) 851evas_object_callbacks_event_catcher_del(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, const Efl_Callback_Array_Item *array)
857{ 852{
858 void *gd = NULL;
859 int i; 853 int i;
860 854
861 if (!obj->layer || 855 if (!obj->layer ||
@@ -865,11 +859,7 @@ evas_object_callbacks_event_catcher_del(Eo *eo_obj EINA_UNUSED, Evas_Object_Prot
865 for (i = 0; array[i].desc != NULL; i++) 859 for (i = 0; array[i].desc != NULL; i++)
866 { 860 {
867 if (obj->layer->evas->gesture_manager) 861 if (obj->layer->evas->gesture_manager)
868 { 862 _efl_canvas_gesture_manager_callback_del_hook(obj->layer->evas->gmd, obj->object, array[i].desc);
869 if (!gd) gd = _efl_canvas_gesture_manager_private_data_get(obj->layer->evas->gesture_manager);
870
871 _efl_canvas_gesture_manager_callback_del_hook(gd, obj->object, array[i].desc);
872 }
873 863
874 if (array[i].desc == EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK) 864 if (array[i].desc == EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK)
875 { 865 {
diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c
index 6d4c07c..86a7881 100644
--- a/src/lib/evas/canvas/evas_main.c
+++ b/src/lib/evas/canvas/evas_main.c
@@ -312,6 +312,7 @@ _evas_canvas_efl_object_constructor(Eo *eo_obj, Evas_Public_Data *e)
312 eina_clist_init(&e->calc_done); 312 eina_clist_init(&e->calc_done);
313 313
314 efl_wref_add(efl_add(EFL_CANVAS_GESTURE_MANAGER_CLASS, eo_obj), &e->gesture_manager); 314 efl_wref_add(efl_add(EFL_CANVAS_GESTURE_MANAGER_CLASS, eo_obj), &e->gesture_manager);
315 e->gmd = efl_data_scope_get(e->gesture_manager, EFL_CANVAS_GESTURE_MANAGER_CLASS);
315 316
316#define EVAS_ARRAY_SET(E, Array) \ 317#define EVAS_ARRAY_SET(E, Array) \
317 eina_array_step_set(&E->Array, sizeof (E->Array), \ 318 eina_array_step_set(&E->Array, sizeof (E->Array), \
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_manager.c b/src/lib/evas/gesture/efl_canvas_gesture_manager.c
index 2d821b5..d510318 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_manager.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_manager.c
@@ -153,19 +153,17 @@ _efl_canvas_gesture_manager_callback_del_hook(void *data, Eo *target, const Efl_
153} 153}
154 154
155void 155void
156_efl_canvas_gesture_manager_filter_event(Eo *obj, Eo *target, void *event) 156_efl_canvas_gesture_manager_filter_event(void *data, Eo *target, void *event)
157{ 157{
158 Efl_Canvas_Gesture_Manager_Data *pd = data;
158 Eina_List *l, *gesture_context; 159 Eina_List *l, *gesture_context;
159 Efl_Canvas_Gesture_Manager_Data *pd;
160 const Efl_Event_Description *gesture_type; 160 const Efl_Event_Description *gesture_type;
161 Efl_Canvas_Gesture_Recognizer *recognizer; 161 Efl_Canvas_Gesture_Recognizer *recognizer;
162 Efl_Canvas_Gesture *gesture; 162 Efl_Canvas_Gesture *gesture;
163 Efl_Canvas_Gesture_Recognizer_Result recog_result; 163 Efl_Canvas_Gesture_Recognizer_Result recog_result;
164 Efl_Canvas_Gesture_Recognizer_Result recog_state; 164 Efl_Canvas_Gesture_Recognizer_Result recog_state;
165 Efl_Canvas_Gesture_Touch *touch_event; 165 Efl_Canvas_Gesture_Touch *touch_event;
166 Efl_Input_Pointer_Data *pointer_data = efl_data_scope_get(event, EFL_INPUT_POINTER_CLASS);
167 166
168 pd = efl_data_scope_get(obj, MY_CLASS);
169 gesture_context = eina_hash_find(pd->m_gesture_contex, &target); 167 gesture_context = eina_hash_find(pd->m_gesture_contex, &target);
170 if (gesture_context) 168 if (gesture_context)
171 { 169 {
@@ -180,8 +178,7 @@ _efl_canvas_gesture_manager_filter_event(Eo *obj, Eo *target, void *event)
180 eina_hash_add(pd->m_object_events, &gesture_type, touch_event); 178 eina_hash_add(pd->m_object_events, &gesture_type, touch_event);
181 } 179 }
182 180
183 efl_gesture_touch_point_record(touch_event, pointer_data->touch_id, pointer_data->cur, 181 efl_gesture_touch_point_record(touch_event, event);
184 pointer_data->timestamp, pointer_data->action);
185 182
186 //This is for handling the case that mouse event pairs dont match. 183 //This is for handling the case that mouse event pairs dont match.
187 //Such as the case of canceling gesture recognition after a mouse down. 184 //Such as the case of canceling gesture recognition after a mouse down.
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_manager.eo b/src/lib/evas/gesture/efl_canvas_gesture_manager.eo
index 762fcca..1784f20 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_manager.eo
+++ b/src/lib/evas/gesture/efl_canvas_gesture_manager.eo
@@ -1,3 +1,5 @@
1import efl_canvas_gesture_types;
2
1class @beta Efl.Canvas.Gesture_Manager extends Efl.Object 3class @beta Efl.Canvas.Gesture_Manager extends Efl.Object
2{ 4{
3 [[This class keeps track of active @Efl.Canvas.Gesture_Recognizer objects. 5 [[This class keeps track of active @Efl.Canvas.Gesture_Recognizer objects.
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_touch.c b/src/lib/evas/gesture/efl_canvas_gesture_touch.c
index 25ff597..bec99b7 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_touch.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_touch.c
@@ -42,9 +42,14 @@ _efl_canvas_gesture_touch_state_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gestur
42} 42}
43 43
44EOLIAN static void 44EOLIAN static void
45_efl_canvas_gesture_touch_point_record(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Touch_Data *pd, 45_efl_canvas_gesture_touch_point_record(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Touch_Data *pd, Efl_Input_Pointer *event)
46 int id, Eina_Vector2 pos, unsigned int timestamp, Efl_Pointer_Action action)
47{ 46{
47 Efl_Input_Pointer_Data *pointer_data = efl_data_scope_get(event, EFL_INPUT_POINTER_CLASS);
48 int id = pointer_data->touch_id;
49 int timestamp = pointer_data->timestamp;
50 Efl_Pointer_Action action = pointer_data->action;
51 Eina_Vector2 pos = pointer_data->cur;
52
48 Pointer_Data *point = eina_hash_find(pd->touch_points, &id); 53 Pointer_Data *point = eina_hash_find(pd->touch_points, &id);
49 Eina_Position2D _pos = { pos.x, pos.y }; 54 Eina_Position2D _pos = { pos.x, pos.y };
50 55
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_touch.eo b/src/lib/evas/gesture/efl_canvas_gesture_touch.eo
index 4d274eb..0425aa7 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_touch.eo
+++ b/src/lib/evas/gesture/efl_canvas_gesture_touch.eo
@@ -15,10 +15,7 @@ class @beta Efl.Canvas.Gesture_Touch extends Efl.Object
15 point_record { 15 point_record {
16 [[Touch point record method]] 16 [[Touch point record method]]
17 params { 17 params {
18 @in tool : int; [[The finger id ]] 18 @in event : Efl.Input.Pointer; [[The pointer information ]]
19 @in pos : Eina.Vector2; [[Position of the event]]
20 @in timestamp : uint; [[The timestamp of the event]]
21 @in action : Efl.Pointer.Action; [[action of the event]]
22 } 19 }
23 } 20 }
24 /* FIXME: This is most likely not useful (without timestamps). */ 21 /* FIXME: This is most likely not useful (without timestamps). */
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 1f514d2..391d816 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -879,6 +879,7 @@ struct _Evas_Public_Data
879 int smart_calc_count; 879 int smart_calc_count;
880 880
881 Eo *gesture_manager; 881 Eo *gesture_manager;
882 void *gmd;
882 Eo *pending_default_focus_obj; 883 Eo *pending_default_focus_obj;
883 Eina_Hash *focused_objects; //Key - seat; value - the focused object 884 Eina_Hash *focused_objects; //Key - seat; value - the focused object
884 Eina_List *focused_by; //Which seat has the canvas focus 885 Eina_List *focused_by; //Which seat has the canvas focus
@@ -1944,8 +1945,7 @@ void efl_canvas_output_info_get(Evas_Public_Data *e, Efl_Canvas_Output *output);
1944void evas_object_pixels_get_force(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj); 1945void evas_object_pixels_get_force(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj);
1945 1946
1946// Gesture Manager 1947// Gesture Manager
1947void *_efl_canvas_gesture_manager_private_data_get(Eo *obj); 1948void _efl_canvas_gesture_manager_filter_event(void *data, Eo *target, void *event);
1948void _efl_canvas_gesture_manager_filter_event(Eo *gesture_manager, Eo *target, void *event);
1949void _efl_canvas_gesture_manager_callback_del_hook(void *data, Eo *target, const Efl_Event_Description *type); 1949void _efl_canvas_gesture_manager_callback_del_hook(void *data, Eo *target, const Efl_Event_Description *type);
1950void _efl_canvas_gesture_manager_callback_add_hook(void *data, Eo *target, const Efl_Event_Description *type); 1950void _efl_canvas_gesture_manager_callback_add_hook(void *data, Eo *target, const Efl_Event_Description *type);
1951 1951