aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/evas/canvas/evas_callbacks.c
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/evas/canvas/evas_callbacks.c
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/evas/canvas/evas_callbacks.c')
-rw-r--r--src/lib/evas/canvas/evas_callbacks.c66
1 files changed, 55 insertions, 11 deletions
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)
{