aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/evas/canvas/evas_callbacks.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-08-17 20:29:39 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-08-26 10:18:00 +0900
commit56c682452c17134959cb07bc290d9d7d059026e3 (patch)
treec6687dc17cdef6773a823a11ae1c54b778502a00 /src/lib/evas/canvas/evas_callbacks.c
parentevas events: Switch key up/down event to new eo type (diff)
downloadefl-56c682452c17134959cb07bc290d9d7d059026e3.tar.gz
evas events: Switch mouse up/down to the new event type
This is getting trickier, as those events have a lot more side effects and complexity than a simple wheel event... Some code has been added that should be fixed in the following commits.
Diffstat (limited to 'src/lib/evas/canvas/evas_callbacks.c')
-rw-r--r--src/lib/evas/canvas/evas_callbacks.c68
1 files changed, 12 insertions, 56 deletions
diff --git a/src/lib/evas/canvas/evas_callbacks.c b/src/lib/evas/canvas/evas_callbacks.c
index cdc20afc53..de8d566dd4 100644
--- a/src/lib/evas/canvas/evas_callbacks.c
+++ b/src/lib/evas/canvas/evas_callbacks.c
@@ -261,6 +261,7 @@ evas_object_event_callback_call(Evas_Object *eo_obj, Evas_Object_Protected_Data
const Efl_Event_Description *efl_event_desc, Efl_Event *efl_event_info)
{
/* MEM OK */
+ const Evas_Button_Flags mask = EVAS_BUTTON_DOUBLE_CLICK | EVAS_BUTTON_TRIPLE_CLICK;
Evas_Button_Flags flags = EVAS_BUTTON_NONE;
Evas_Public_Data *e;
@@ -286,44 +287,15 @@ evas_object_event_callback_call(Evas_Object *eo_obj, Evas_Object_Protected_Data
if ((type == EVAS_CALLBACK_MOVE) && (obj->move_ref == 0))
goto nothing_here;
- switch (type)
+ if ((type == EVAS_CALLBACK_MOUSE_DOWN) || (type == EVAS_CALLBACK_MOUSE_UP))
{
- case EVAS_CALLBACK_MOUSE_DOWN:
- {
- Evas_Event_Mouse_Down *ev = event_info;
-
- flags = ev->flags;
- if (ev->flags & (EVAS_BUTTON_DOUBLE_CLICK | EVAS_BUTTON_TRIPLE_CLICK))
- {
- if (obj->last_mouse_down_counter < (e->last_mouse_down_counter - 1))
- ev->flags &= ~(EVAS_BUTTON_DOUBLE_CLICK | EVAS_BUTTON_TRIPLE_CLICK);
- }
- obj->last_mouse_down_counter = e->last_mouse_down_counter;
- if (efl_event_info)
- {
- efl_event_pointer_button_flags_set(efl_event_info, ev->flags);
- }
- break;
- }
- case EVAS_CALLBACK_MOUSE_UP:
- {
- Evas_Event_Mouse_Up *ev = event_info;
-
- flags = ev->flags;
- if (ev->flags & (EVAS_BUTTON_DOUBLE_CLICK | EVAS_BUTTON_TRIPLE_CLICK))
- {
- if (obj->last_mouse_up_counter < (e->last_mouse_up_counter - 1))
- ev->flags &= ~(EVAS_BUTTON_DOUBLE_CLICK | EVAS_BUTTON_TRIPLE_CLICK);
- }
- obj->last_mouse_up_counter = e->last_mouse_up_counter;
- if (efl_event_info)
- {
- efl_event_pointer_button_flags_set(efl_event_info, ev->flags);
- }
- break;
- }
- default:
- break;
+ flags = efl_event_pointer_button_flags_get(efl_event_info);
+ if (flags & mask)
+ {
+ if (obj->last_mouse_down_counter < (e->last_mouse_down_counter - 1))
+ efl_event_pointer_button_flags_set(efl_event_info, flags & ~mask);
+ }
+ obj->last_mouse_down_counter = e->last_mouse_down_counter;
}
if (_evas_event_efl_event_info_exists(type))
@@ -332,28 +304,12 @@ evas_object_event_callback_call(Evas_Object *eo_obj, Evas_Object_Protected_Data
}
else
{
- /* legacy callbacks - relying on Efl.Canvas.Object events */
efl_event_callback_call(eo_obj, _legacy_evas_callback_table(type), event_info);
-
- /* new input events - unlikely */
- if (efl_event_desc)
- efl_event_callback_call(eo_obj, efl_event_desc, efl_event_info);
+ if (efl_event_desc) CRI("Internal error with events!"); // FIXME
}
- if (type == EVAS_CALLBACK_MOUSE_DOWN)
- {
- Evas_Event_Mouse_Down *ev = event_info;
- ev->flags = flags;
- if (efl_event_info)
- efl_event_pointer_button_flags_set(efl_event_info, ev->flags);
- }
- else if (type == EVAS_CALLBACK_MOUSE_UP)
- {
- Evas_Event_Mouse_Up *ev = event_info;
- ev->flags = flags;
- if (efl_event_info)
- efl_event_pointer_button_flags_set(efl_event_info, ev->flags);
- }
+ if ((type == EVAS_CALLBACK_MOUSE_DOWN) || (type == EVAS_CALLBACK_MOUSE_UP))
+ efl_event_pointer_button_flags_set(efl_event_info, flags);
nothing_here:
if (!obj->no_propagate)