aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-05-31 14:39:10 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-05-31 19:03:04 +0900
commit632ef372262c717b78778c8274f1f3fea917ed3e (patch)
treebecfeb217823ea582004cdca13b8cedae83939a2 /src/lib
parentEvas events: Add helper functions to read event info (diff)
downloadefl-632ef372262c717b78778c8274f1f3fea917ed3e.tar.gz
Evas events: Propagate event flags between eo and legacy
If on_hold or on_scroll is set in an eo callback, the subsequent calls to the legacy callbacks will also have this flag set. Inversely the legacy callbacks should affect all subsequent eo callbacks. Note: those are just indicative flags.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/evas/canvas/efl_pointer_event.c4
-rw-r--r--src/lib/evas/canvas/evas_callbacks.c66
-rw-r--r--src/lib/evas/canvas/evas_events.c27
3 files changed, 84 insertions, 13 deletions
diff --git a/src/lib/evas/canvas/efl_pointer_event.c b/src/lib/evas/canvas/efl_pointer_event.c
index 456ab6bf64..1d51501f4e 100644
--- a/src/lib/evas/canvas/efl_pointer_event.c
+++ b/src/lib/evas/canvas/efl_pointer_event.c
@@ -338,7 +338,7 @@ _efl_pointer_event_efl_input_state_lock_enabled_get(Eo *obj EINA_UNUSED, Efl_Poi
return evas_key_lock_is_set(pd->locks, name);
}
-EOLIAN static Eina_Bool
+EOLIAN static void
_efl_pointer_event_double_click_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, Eina_Bool val)
{
if (val)
@@ -353,7 +353,7 @@ _efl_pointer_event_double_click_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data
return !!(pd->button_flags & EFL_POINTER_BUTTON_FLAGS_DOUBLE_CLICK);
}
-EOLIAN static Eina_Bool
+EOLIAN static void
_efl_pointer_event_triple_click_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, Eina_Bool val)
{
if (val)
diff --git a/src/lib/evas/canvas/evas_callbacks.c b/src/lib/evas/canvas/evas_callbacks.c
index 6b164de5a3..c07d70e676 100644
--- a/src/lib/evas/canvas/evas_callbacks.c
+++ b/src/lib/evas/canvas/evas_callbacks.c
@@ -1,6 +1,9 @@
#include "evas_common_private.h"
#include "evas_private.h"
+#define EFL_INTERNAL_UNSTABLE
+#include "interfaces/efl_common_internal.h"
+
int _evas_event_counter = 0;
EVAS_MEMPOOL(_mp_pc);
@@ -58,6 +61,15 @@ typedef struct
Evas_Callback_Type type;
} _eo_evas_object_cb_info;
+typedef struct
+{
+ EINA_INLIST;
+ Evas_Event_Cb func;
+ void *data;
+ Evas_Callback_Type type;
+} _eo_evas_cb_info;
+
+
static inline void *
_pointer_event_get(const _eo_evas_object_cb_info *info, const Eo_Event *event,
const Eo_Event_Description **pdesc)
@@ -87,25 +99,57 @@ _pointer_event_get(const _eo_evas_object_cb_info *info, const Eo_Event *event,
}
+static void
+_event_flags_adjust(void *ev, const Efl_Pointer_Event_Data *pedata)
+{
+#define EV_CASE(NEWTYPE, Type) \
+ case EFL_POINTER_ACTION_ ## NEWTYPE: \
+ ((Evas_Event_ ## Type *) ev)->event_flags = pedata->event_flags; \
+ break;
+
+ switch (pedata->action)
+ {
+ EV_CASE(MOVE, Mouse_Move);
+ EV_CASE(OUT, Mouse_Out);
+ EV_CASE(IN, Mouse_In);
+ EV_CASE(DOWN, Mouse_Down);
+ EV_CASE(UP, Mouse_Up);
+ EV_CASE(WHEEL, Mouse_Wheel);
+ default: break;
+ }
+
+#undef EV_CASE
+}
+
static Eina_Bool
_eo_evas_object_cb(void *data, const Eo_Event *event)
{
_eo_evas_object_cb_info *info = data;
const Eo_Event_Description *desc;
- void *pe = _pointer_event_get(info, event, &desc);
- if (pe) eo_event_callback_call(event->object, desc, pe);
- if (info->func) info->func(info->data, evas_object_evas_get(event->object), event->object, event->info);
+ Evas *evas = evas_object_evas_get(event->object);
+ void *pe;
+
+ pe = _pointer_event_get(info, event, &desc);
+ if (pe)
+ {
+ Efl_Pointer_Event_Data *pedata;
+ Efl_Pointer_Event_Flags flags;
+
+ pedata = eo_data_scope_get(pe, EFL_POINTER_EVENT_CLASS);
+ flags = pedata->event_flags;
+ eo_event_callback_call(event->object, desc, pe);
+ if (flags != pedata->event_flags)
+ _event_flags_adjust(event->info, pedata);
+ }
+ if (info->func)
+ {
+ info->func(info->data, evas, event->object, event->info);
+ // if event_flags changed, pe will be fixed in evas_events.c
+ }
+
return EINA_TRUE;
}
-typedef struct
-{
- EINA_INLIST;
- Evas_Event_Cb func;
- void *data;
- Evas_Callback_Type type;
-} _eo_evas_cb_info;
-
static Eina_Bool
_eo_evas_cb(void *data, const Eo_Event *event)
{
diff --git a/src/lib/evas/canvas/evas_events.c b/src/lib/evas/canvas/evas_events.c
index 2c336e92e4..821b0e77f0 100644
--- a/src/lib/evas/canvas/evas_events.c
+++ b/src/lib/evas/canvas/evas_events.c
@@ -94,10 +94,37 @@ _pointer_event_create(Evas_Callback_Type type, void *ev,
return evt;
}
+static inline void
+_pointer_event_flags_adjust(Efl_Pointer_Event_Data *pedata,
+ Evas_Callback_Type type, const void *ev)
+{
+#define EV_CASE(TYPE, Type) \
+ case EVAS_CALLBACK_ ## TYPE: \
+ pedata->event_flags = ((Evas_Event_ ## Type *) ev)->event_flags; \
+ break;
+
+ switch (type)
+ {
+ EV_CASE(MOUSE_MOVE, Mouse_Move);
+ EV_CASE(MOUSE_OUT, Mouse_Out);
+ EV_CASE(MOUSE_IN, Mouse_In);
+ EV_CASE(MOUSE_DOWN, Mouse_Down);
+ EV_CASE(MOUSE_UP, Mouse_Up);
+ EV_CASE(MULTI_MOVE, Multi_Move);
+ EV_CASE(MULTI_DOWN, Multi_Down);
+ EV_CASE(MULTI_UP, Multi_Up);
+ EV_CASE(MOUSE_WHEEL, Mouse_Wheel);
+ default: break;
+ }
+
+#undef EV_CASE
+}
+
#define EV_CALL(_eo_obj, _obj, _typ, _ev, _id, _pe) do { \
if (!_pe) _pe = _pointer_event_create(_typ, _ev, parent_pe, & _pe ## data); \
else efl_pointer_event_legacy_info_set(_pe, _ev, _typ); \
evas_object_event_callback_call(_eo_obj, _obj, _typ, _ev, _id); \
+ _pointer_event_flags_adjust(_pe ## data, _typ, _ev); \
} while (0)
#define EV_RESET(a) do { if (a) efl_event_reset(a); } while (0)
#define EV_DEL(a) do { if (a) { eo_unref(a); } a = NULL; } while (0)