summaryrefslogtreecommitdiff
path: root/src/lib/evas
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-05-31 15:31:17 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-06-27 16:38:46 +0900
commit9f5d27972252d67fe92ca44a1c610da4ed531b86 (patch)
tree980da56df52daf304a9227fb76faf083be4153e7 /src/lib/evas
parent9c69afd535a7e8ebe72f590cb634733fcac23da1 (diff)
Evas events: Implement support for hold event
Diffstat (limited to 'src/lib/evas')
-rw-r--r--src/lib/evas/Evas_Eo.h3
-rw-r--r--src/lib/evas/canvas/efl_canvas_object.eo2
-rw-r--r--src/lib/evas/canvas/efl_event_hold.c56
-rw-r--r--src/lib/evas/canvas/efl_event_hold.eo24
-rw-r--r--src/lib/evas/canvas/evas_events.c29
-rw-r--r--src/lib/evas/canvas/evas_events_legacy.c21
-rw-r--r--src/lib/evas/include/evas_private.h1
7 files changed, 123 insertions, 13 deletions
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index 02a993f426..37db8fb210 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -302,5 +302,6 @@ typedef void (Evas_Canvas3D_Surface_Func)(Evas_Real *out_x,
302#ifdef EFL_EO_API_SUPPORT 302#ifdef EFL_EO_API_SUPPORT
303#include "canvas/efl_event_input.eo.h" 303#include "canvas/efl_event_input.eo.h"
304#include "canvas/efl_event_pointer.eo.h" 304#include "canvas/efl_event_pointer.eo.h"
305#endif /* EFL_EO_API_SUPPORT */
306#include "canvas/efl_event_key.eo.h" 305#include "canvas/efl_event_key.eo.h"
306#include "canvas/efl_event_hold.eo.h"
307#endif /* EFL_EO_API_SUPPORT */
diff --git a/src/lib/evas/canvas/efl_canvas_object.eo b/src/lib/evas/canvas/efl_canvas_object.eo
index 1af0a78aac..d9b795591e 100644
--- a/src/lib/evas/canvas/efl_canvas_object.eo
+++ b/src/lib/evas/canvas/efl_canvas_object.eo
@@ -725,6 +725,6 @@ abstract Efl.Canvas.Object (Eo.Base, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
725 focus,in; [[Focus In Event ]] 725 focus,in; [[Focus In Event ]]
726 focus,out; [[Focus Out Event ]] 726 focus,out; [[Focus Out Event ]]
727 del @beta; [[Object Being Deleted (called before Free) ]] 727 del @beta; [[Object Being Deleted (called before Free) ]]
728 hold; [[Events go on/off hold ]] 728 hold @beta; [[Events go on/off hold ]]
729 } 729 }
730} 730}
diff --git a/src/lib/evas/canvas/efl_event_hold.c b/src/lib/evas/canvas/efl_event_hold.c
new file mode 100644
index 0000000000..099b34a152
--- /dev/null
+++ b/src/lib/evas/canvas/efl_event_hold.c
@@ -0,0 +1,56 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <Evas.h>
6
7#define EFL_INTERNAL_UNSTABLE
8#include "interfaces/efl_common_internal.h"
9
10#define MY_CLASS EFL_EVENT_HOLD_CLASS
11
12EOLIAN static void
13_efl_event_hold_hold_set(Eo *obj EINA_UNUSED, Efl_Event_Hold_Data *pd, Eina_Bool val)
14{
15 pd->hold = !!val;
16}
17
18EOLIAN static Eina_Bool
19_efl_event_hold_hold_get(Eo *obj EINA_UNUSED, Efl_Event_Hold_Data *pd)
20{
21 return pd->hold;
22}
23
24EOLIAN static void
25_efl_event_hold_device_set(Eo *obj EINA_UNUSED, Efl_Event_Hold_Data *pd, Efl_Input_Device *dev)
26{
27 pd->device = dev;
28}
29
30EOLIAN static Efl_Input_Device *
31_efl_event_hold_device_get(Eo *obj EINA_UNUSED, Efl_Event_Hold_Data *pd)
32{
33 return pd->device;
34}
35
36EOLIAN static double
37_efl_event_hold_efl_event_timestamp_get(Eo *obj EINA_UNUSED, Efl_Event_Hold_Data *pd)
38{
39 return pd->timestamp;
40}
41
42EOLIAN static void
43_efl_event_hold_efl_event_timestamp_set(Eo *obj EINA_UNUSED, Efl_Event_Hold_Data *pd, double ms)
44{
45 pd->timestamp = ms;
46}
47
48EOLIAN static Eo *
49_efl_event_hold_eo_base_constructor(Eo *obj, Efl_Event_Hold_Data *pd)
50{
51 obj = eo_constructor(eo_super(obj, MY_CLASS));
52 pd->eo = obj;
53 return obj;
54}
55
56#include "efl_event_hold.eo.c"
diff --git a/src/lib/evas/canvas/efl_event_hold.eo b/src/lib/evas/canvas/efl_event_hold.eo
new file mode 100644
index 0000000000..1b8d7f4c7e
--- /dev/null
+++ b/src/lib/evas/canvas/efl_event_hold.eo
@@ -0,0 +1,24 @@
1class Efl.Event.Hold (Eo.Base, Efl.Event.Input)
2{
3 [[Event data sent when inputs are put on hold or resumed.]]
4 methods {
5 @property hold {
6 [[$true if inputs are now on hold.]]
7 values {
8 val: bool;
9 }
10 }
11 @property device {
12 [[Input device that is now on hold or resumed.]]
13 values {
14 dev: Efl.Input.Device;
15 }
16 }
17 /* FIXME: does not expose event_flags - is it necessary? */
18 }
19 implements {
20 Eo.Base.constructor;
21 Efl.Event.timestamp.get;
22 Efl.Event.timestamp.set;
23 }
24}
diff --git a/src/lib/evas/canvas/evas_events.c b/src/lib/evas/canvas/evas_events.c
index 9c39b60aa9..8bf07e45b3 100644
--- a/src/lib/evas/canvas/evas_events.c
+++ b/src/lib/evas/canvas/evas_events.c
@@ -83,6 +83,7 @@ _efl_event_create(Efl_Event *evt, Evas_Callback_Type type, void *ev,
83 EV_CASE(MOUSE_WHEEL, Mouse_Wheel, POINTER, pointer); 83 EV_CASE(MOUSE_WHEEL, Mouse_Wheel, POINTER, pointer);
84 EV_CASE(KEY_DOWN, Key_Down, KEY, key); 84 EV_CASE(KEY_DOWN, Key_Down, KEY, key);
85 EV_CASE(KEY_UP, Key_Up, KEY, key); 85 EV_CASE(KEY_UP, Key_Up, KEY, key);
86 EV_CASE(HOLD, Hold, HOLD, hold);
86 87
87 default: 88 default:
88 DBG("Support for event type %d not implemented yet.", type); 89 DBG("Support for event type %d not implemented yet.", type);
@@ -597,25 +598,28 @@ _evas_event_source_mouse_up_events(Evas_Object *eo_obj, Evas *eo_e,
597} 598}
598 599
599static void 600static void
600_evas_event_source_hold_events(Evas_Object *eo_obj, Evas *eo_e EINA_UNUSED, void *ev, int event_id) 601_evas_event_source_hold_events(Evas_Object *eo_obj, Evas *eo_e EINA_UNUSED, void *ev,
602 int event_id, Efl_Event_Hold *parent_he)
601{ 603{
602 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 604 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
603 Evas_Object *eo_src = _evas_object_image_source_get(eo_obj); 605 Evas_Object *eo_src = _evas_object_image_source_get(eo_obj);
604 Evas_Object_Protected_Data *src = eo_data_scope_get(eo_src, EFL_CANVAS_OBJECT_CLASS); 606 Evas_Object_Protected_Data *src = eo_data_scope_get(eo_src, EFL_CANVAS_OBJECT_CLASS);
607 Evas_Object_Protected_Data *child;
608 Efl_Event_Hold *he = NULL;
609 Evas_Object *eo_child;
610 Eina_List *l;
605 611
606 if (obj->layer->evas->is_frozen) return; 612 if (obj->layer->evas->is_frozen) return;
607 613
608 Eina_List *l; 614 EINA_LIST_FOREACH(src->proxy->src_event_in, l, eo_child)
609 Evas_Object *child_eo;
610 Evas_Object_Protected_Data *child;
611 EINA_LIST_FOREACH(src->proxy->src_event_in, l, child_eo)
612 { 615 {
613 if (src->delete_me) return; 616 if (src->delete_me) return;
614 child = eo_data_scope_get(child_eo, EFL_CANVAS_OBJECT_CLASS); 617 child = eo_data_scope_get(eo_child, EFL_CANVAS_OBJECT_CLASS);
615 evas_object_event_callback_call(child_eo, child, EVAS_CALLBACK_HOLD, ev, 618 EV_CALL(eo_child, child, EVAS_CALLBACK_HOLD, ev, event_id, he, parent_he);
616 event_id, NULL, NULL);
617 if (src->layer->evas->delete_me) break; 619 if (src->layer->evas->delete_me) break;
618 } 620 }
621
622 EV_DEL(he);
619} 623}
620 624
621static void 625static void
@@ -2904,6 +2908,7 @@ EAPI void
2904evas_event_feed_hold(Eo *eo_e, int hold, unsigned int timestamp, const void *data) 2908evas_event_feed_hold(Eo *eo_e, int hold, unsigned int timestamp, const void *data)
2905{ 2909{
2906 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS); 2910 Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
2911 Efl_Event_Hold *he = NULL;
2907 Eina_List *l, *copy; 2912 Eina_List *l, *copy;
2908 Evas_Event_Hold ev; 2913 Evas_Event_Hold ev;
2909 Evas_Object *eo_obj; 2914 Evas_Object *eo_obj;
@@ -2929,10 +2934,9 @@ evas_event_feed_hold(Eo *eo_e, int hold, unsigned int timestamp, const void *dat
2929 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 2934 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
2930 if ( !evas_event_freezes_through(eo_obj, obj)) 2935 if ( !evas_event_freezes_through(eo_obj, obj))
2931 { 2936 {
2932 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_HOLD, 2937 EV_CALL(eo_obj, obj, EVAS_CALLBACK_HOLD, &ev, event_id, he, NULL);
2933 &ev, event_id, NULL, NULL);
2934 if ((obj->proxy->is_proxy) && (obj->proxy->src_events)) 2938 if ((obj->proxy->is_proxy) && (obj->proxy->src_events))
2935 _evas_event_source_hold_events(eo_obj, eo_e, &ev, event_id); 2939 _evas_event_source_hold_events(eo_obj, eo_e, &ev, event_id, he);
2936 } 2940 }
2937 if (e->delete_me || e->is_frozen) break; 2941 if (e->delete_me || e->is_frozen) break;
2938 } 2942 }
@@ -2941,6 +2945,8 @@ evas_event_feed_hold(Eo *eo_e, int hold, unsigned int timestamp, const void *dat
2941 if (ev.dev) eo_unref(ev.dev); 2945 if (ev.dev) eo_unref(ev.dev);
2942 _evas_unwalk(e); 2946 _evas_unwalk(e);
2943 _evas_object_event_new(); 2947 _evas_object_event_new();
2948
2949 EV_DEL(he);
2944} 2950}
2945 2951
2946void 2952void
@@ -3352,6 +3358,7 @@ _evas_canvas_event_key_cb(void *data, const Eo_Event *event)
3352 ev->evas_done = EINA_TRUE; 3358 ev->evas_done = EINA_TRUE;
3353} 3359}
3354 3360
3361// note: "hold" event comes from above (elm), not below (ecore)
3355EO_CALLBACKS_ARRAY_DEFINE(_evas_canvas_event_pointer_callbacks, 3362EO_CALLBACKS_ARRAY_DEFINE(_evas_canvas_event_pointer_callbacks,
3356{ EFL_EVENT_POINTER_MOVE, _evas_canvas_event_pointer_cb }, 3363{ EFL_EVENT_POINTER_MOVE, _evas_canvas_event_pointer_cb },
3357{ EFL_EVENT_POINTER_DOWN, _evas_canvas_event_pointer_cb }, 3364{ EFL_EVENT_POINTER_DOWN, _evas_canvas_event_pointer_cb },
diff --git a/src/lib/evas/canvas/evas_events_legacy.c b/src/lib/evas/canvas/evas_events_legacy.c
index 79c3d22369..463a73d2e1 100644
--- a/src/lib/evas/canvas/evas_events_legacy.c
+++ b/src/lib/evas/canvas/evas_events_legacy.c
@@ -260,3 +260,24 @@ efl_event_key_legacy_info_set(Efl_Event_Key *evt, const void *event_info, Evas_C
260 260
261 return EINA_TRUE; 261 return EINA_TRUE;
262} 262}
263
264Eina_Bool
265efl_event_hold_legacy_info_set(Efl_Event_Hold *evt, const void *event_info, Evas_Callback_Type type)
266{
267 Efl_Event_Hold_Data *ev = eo_data_scope_get(evt, EFL_EVENT_HOLD_CLASS);
268 const Evas_Event_Hold *e = event_info;
269
270 if (!ev || !event_info) return EINA_FALSE;
271
272 if (type != EVAS_CALLBACK_HOLD)
273 {
274 ERR("invalid event type %d", type);
275 return EINA_FALSE;
276 }
277
278 ev->timestamp = e->timestamp;
279 ev->device = e->dev;
280 ev->hold = !!e->hold;
281
282 return EINA_TRUE;
283}
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index d5dc42f966..f8d3e9ba00 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1953,6 +1953,7 @@ Evas_Device *_evas_device_top_get(const Evas *e);
1953/* legacy/eo events */ 1953/* legacy/eo events */
1954Eina_Bool efl_event_pointer_legacy_info_set(Efl_Event_Pointer *evt, const void *event_info, Evas_Callback_Type type); 1954Eina_Bool efl_event_pointer_legacy_info_set(Efl_Event_Pointer *evt, const void *event_info, Evas_Callback_Type type);
1955Eina_Bool efl_event_key_legacy_info_set(Efl_Event_Key *evt, const void *event_info, Evas_Callback_Type type); 1955Eina_Bool efl_event_key_legacy_info_set(Efl_Event_Key *evt, const void *event_info, Evas_Callback_Type type);
1956Eina_Bool efl_event_hold_legacy_info_set(Efl_Event_Hold *evt, const void *event_info, Evas_Callback_Type type);
1956 1957
1957Eina_Bool evas_vg_loader_svg(Evas_Object *vg, const Eina_File *f, const char *key EINA_UNUSED); 1958Eina_Bool evas_vg_loader_svg(Evas_Object *vg, const Eina_File *f, const char *key EINA_UNUSED);
1958 1959