forked from enlightenment/efl
gesture_manager: Changed function param to reduce internal function calls.
Summary: 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. Reviewers: Hermet, smohanty, bu5hm4n Reviewed By: Hermet Subscribers: zmike, bu5hm4n, q66, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10437
This commit is contained in:
parent
c7f37fe618
commit
2f41f867ae
|
@ -393,7 +393,7 @@ evas_object_event_callback_call(Evas_Object *eo_obj, Evas_Object_Protected_Data
|
||||||
type == EVAS_CALLBACK_MULTI_DOWN ||
|
type == EVAS_CALLBACK_MULTI_DOWN ||
|
||||||
type == EVAS_CALLBACK_MOUSE_UP ||
|
type == EVAS_CALLBACK_MOUSE_UP ||
|
||||||
type == EVAS_CALLBACK_MULTI_UP)
|
type == EVAS_CALLBACK_MULTI_UP)
|
||||||
_efl_canvas_gesture_manager_filter_event(e->gesture_manager, eo_obj, event_info);
|
_efl_canvas_gesture_manager_filter_event(e->gmd, eo_obj, event_info);
|
||||||
|
|
||||||
if (obj->is_smart)
|
if (obj->is_smart)
|
||||||
_evas_object_smart_callback_call_internal(eo_obj, efl_event_desc);
|
_evas_object_smart_callback_call_internal(eo_obj, efl_event_desc);
|
||||||
|
@ -817,17 +817,12 @@ void
|
||||||
evas_object_callbacks_event_catcher_add(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, const Efl_Callback_Array_Item *array)
|
evas_object_callbacks_event_catcher_add(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, const Efl_Callback_Array_Item *array)
|
||||||
{
|
{
|
||||||
Evas_Callback_Type type = EVAS_CALLBACK_LAST;
|
Evas_Callback_Type type = EVAS_CALLBACK_LAST;
|
||||||
void *gd = NULL;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; array[i].desc != NULL; i++)
|
for (i = 0; array[i].desc != NULL; i++)
|
||||||
{
|
{
|
||||||
if (obj->layer && obj->layer->evas && obj->layer->evas->gesture_manager)
|
if (obj->layer && obj->layer->evas && obj->layer->evas->gesture_manager)
|
||||||
{
|
_efl_canvas_gesture_manager_callback_add_hook(obj->layer->evas->gmd, obj->object, array[i].desc);
|
||||||
if (!gd) gd = _efl_canvas_gesture_manager_private_data_get(obj->layer->evas->gesture_manager);
|
|
||||||
|
|
||||||
_efl_canvas_gesture_manager_callback_add_hook(gd, obj->object, array[i].desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (array[i].desc == EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK)
|
if (array[i].desc == EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK)
|
||||||
{
|
{
|
||||||
|
@ -855,7 +850,6 @@ evas_object_callbacks_event_catcher_add(Eo *eo_obj EINA_UNUSED, Evas_Object_Prot
|
||||||
void
|
void
|
||||||
evas_object_callbacks_event_catcher_del(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, const Efl_Callback_Array_Item *array)
|
evas_object_callbacks_event_catcher_del(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, const Efl_Callback_Array_Item *array)
|
||||||
{
|
{
|
||||||
void *gd = NULL;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!obj->layer ||
|
if (!obj->layer ||
|
||||||
|
@ -865,11 +859,7 @@ evas_object_callbacks_event_catcher_del(Eo *eo_obj EINA_UNUSED, Evas_Object_Prot
|
||||||
for (i = 0; array[i].desc != NULL; i++)
|
for (i = 0; array[i].desc != NULL; i++)
|
||||||
{
|
{
|
||||||
if (obj->layer->evas->gesture_manager)
|
if (obj->layer->evas->gesture_manager)
|
||||||
{
|
_efl_canvas_gesture_manager_callback_del_hook(obj->layer->evas->gmd, obj->object, array[i].desc);
|
||||||
if (!gd) gd = _efl_canvas_gesture_manager_private_data_get(obj->layer->evas->gesture_manager);
|
|
||||||
|
|
||||||
_efl_canvas_gesture_manager_callback_del_hook(gd, obj->object, array[i].desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (array[i].desc == EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK)
|
if (array[i].desc == EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK)
|
||||||
{
|
{
|
||||||
|
|
|
@ -312,6 +312,7 @@ _evas_canvas_efl_object_constructor(Eo *eo_obj, Evas_Public_Data *e)
|
||||||
eina_clist_init(&e->calc_done);
|
eina_clist_init(&e->calc_done);
|
||||||
|
|
||||||
efl_wref_add(efl_add(EFL_CANVAS_GESTURE_MANAGER_CLASS, eo_obj), &e->gesture_manager);
|
efl_wref_add(efl_add(EFL_CANVAS_GESTURE_MANAGER_CLASS, eo_obj), &e->gesture_manager);
|
||||||
|
e->gmd = efl_data_scope_get(e->gesture_manager, EFL_CANVAS_GESTURE_MANAGER_CLASS);
|
||||||
|
|
||||||
#define EVAS_ARRAY_SET(E, Array) \
|
#define EVAS_ARRAY_SET(E, Array) \
|
||||||
eina_array_step_set(&E->Array, sizeof (E->Array), \
|
eina_array_step_set(&E->Array, sizeof (E->Array), \
|
||||||
|
|
|
@ -153,19 +153,17 @@ _efl_canvas_gesture_manager_callback_del_hook(void *data, Eo *target, const Efl_
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_efl_canvas_gesture_manager_filter_event(Eo *obj, Eo *target, void *event)
|
_efl_canvas_gesture_manager_filter_event(void *data, Eo *target, void *event)
|
||||||
{
|
{
|
||||||
|
Efl_Canvas_Gesture_Manager_Data *pd = data;
|
||||||
Eina_List *l, *gesture_context;
|
Eina_List *l, *gesture_context;
|
||||||
Efl_Canvas_Gesture_Manager_Data *pd;
|
|
||||||
const Efl_Event_Description *gesture_type;
|
const Efl_Event_Description *gesture_type;
|
||||||
Efl_Canvas_Gesture_Recognizer *recognizer;
|
Efl_Canvas_Gesture_Recognizer *recognizer;
|
||||||
Efl_Canvas_Gesture *gesture;
|
Efl_Canvas_Gesture *gesture;
|
||||||
Efl_Canvas_Gesture_Recognizer_Result recog_result;
|
Efl_Canvas_Gesture_Recognizer_Result recog_result;
|
||||||
Efl_Canvas_Gesture_Recognizer_Result recog_state;
|
Efl_Canvas_Gesture_Recognizer_Result recog_state;
|
||||||
Efl_Canvas_Gesture_Touch *touch_event;
|
Efl_Canvas_Gesture_Touch *touch_event;
|
||||||
Efl_Input_Pointer_Data *pointer_data = efl_data_scope_get(event, EFL_INPUT_POINTER_CLASS);
|
|
||||||
|
|
||||||
pd = efl_data_scope_get(obj, MY_CLASS);
|
|
||||||
gesture_context = eina_hash_find(pd->m_gesture_contex, &target);
|
gesture_context = eina_hash_find(pd->m_gesture_contex, &target);
|
||||||
if (gesture_context)
|
if (gesture_context)
|
||||||
{
|
{
|
||||||
|
@ -180,8 +178,7 @@ _efl_canvas_gesture_manager_filter_event(Eo *obj, Eo *target, void *event)
|
||||||
eina_hash_add(pd->m_object_events, &gesture_type, touch_event);
|
eina_hash_add(pd->m_object_events, &gesture_type, touch_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
efl_gesture_touch_point_record(touch_event, pointer_data->touch_id, pointer_data->cur,
|
efl_gesture_touch_point_record(touch_event, event);
|
||||||
pointer_data->timestamp, pointer_data->action);
|
|
||||||
|
|
||||||
//This is for handling the case that mouse event pairs dont match.
|
//This is for handling the case that mouse event pairs dont match.
|
||||||
//Such as the case of canceling gesture recognition after a mouse down.
|
//Such as the case of canceling gesture recognition after a mouse down.
|
||||||
|
|
|
@ -42,9 +42,14 @@ _efl_canvas_gesture_touch_state_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gestur
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_gesture_touch_point_record(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Touch_Data *pd,
|
_efl_canvas_gesture_touch_point_record(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Touch_Data *pd, void *event)
|
||||||
int id, Eina_Vector2 pos, unsigned int timestamp, Efl_Pointer_Action action)
|
|
||||||
{
|
{
|
||||||
|
Efl_Input_Pointer_Data *pointer_data = efl_data_scope_get(event, EFL_INPUT_POINTER_CLASS);
|
||||||
|
int id = pointer_data->touch_id;
|
||||||
|
int timestamp = pointer_data->timestamp;
|
||||||
|
Efl_Pointer_Action action = pointer_data->action;
|
||||||
|
Eina_Vector2 pos = pointer_data->cur;
|
||||||
|
|
||||||
Pointer_Data *point = eina_hash_find(pd->touch_points, &id);
|
Pointer_Data *point = eina_hash_find(pd->touch_points, &id);
|
||||||
Eina_Position2D _pos = { pos.x, pos.y };
|
Eina_Position2D _pos = { pos.x, pos.y };
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,7 @@ class @beta Efl.Canvas.Gesture_Touch extends Efl.Object
|
||||||
point_record {
|
point_record {
|
||||||
[[Touch point record method]]
|
[[Touch point record method]]
|
||||||
params {
|
params {
|
||||||
@in tool : int; [[The finger id ]]
|
@in event : void_ptr; [[The EFL_INPUT_POINTER_CLASS pointer ]]
|
||||||
@in pos : Eina.Vector2; [[Position of the event]]
|
|
||||||
@in timestamp : uint; [[The timestamp of the event]]
|
|
||||||
@in action : Efl.Pointer.Action; [[action of the event]]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* FIXME: This is most likely not useful (without timestamps). */
|
/* FIXME: This is most likely not useful (without timestamps). */
|
||||||
|
|
|
@ -879,6 +879,7 @@ struct _Evas_Public_Data
|
||||||
int smart_calc_count;
|
int smart_calc_count;
|
||||||
|
|
||||||
Eo *gesture_manager;
|
Eo *gesture_manager;
|
||||||
|
void *gmd;
|
||||||
Eo *pending_default_focus_obj;
|
Eo *pending_default_focus_obj;
|
||||||
Eina_Hash *focused_objects; //Key - seat; value - the focused object
|
Eina_Hash *focused_objects; //Key - seat; value - the focused object
|
||||||
Eina_List *focused_by; //Which seat has the canvas focus
|
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);
|
||||||
void evas_object_pixels_get_force(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj);
|
void evas_object_pixels_get_force(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj);
|
||||||
|
|
||||||
// Gesture Manager
|
// Gesture Manager
|
||||||
void *_efl_canvas_gesture_manager_private_data_get(Eo *obj);
|
void _efl_canvas_gesture_manager_filter_event(void *data, Eo *target, void *event);
|
||||||
void _efl_canvas_gesture_manager_filter_event(Eo *gesture_manager, Eo *target, void *event);
|
|
||||||
void _efl_canvas_gesture_manager_callback_del_hook(void *data, Eo *target, const Efl_Event_Description *type);
|
void _efl_canvas_gesture_manager_callback_del_hook(void *data, Eo *target, const Efl_Event_Description *type);
|
||||||
void _efl_canvas_gesture_manager_callback_add_hook(void *data, Eo *target, const Efl_Event_Description *type);
|
void _efl_canvas_gesture_manager_callback_add_hook(void *data, Eo *target, const Efl_Event_Description *type);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue