summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-05-10 21:26:07 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-05-31 19:03:04 +0900
commitea8c6e5632beb4c5cf1e445473ca85b0135a4aa9 (patch)
tree5c203f24b90db3e9a9797d7d52d07cbd0a029105
parentc06cdadca28db6c4547562b2f577a2c21452d24e (diff)
Evas: Extend pointer events and add legacy conversion routines
To be honest, this commit is a bit of a mess since it's a rebased version of some temporary work patches.
-rw-r--r--src/Makefile_Evas.am1
-rw-r--r--src/lib/efl/interfaces/efl_common_internal.h36
-rw-r--r--src/lib/efl/interfaces/efl_event.eo3
-rw-r--r--src/lib/efl/interfaces/efl_pointer_event.c130
-rw-r--r--src/lib/efl/interfaces/efl_pointer_event.eo31
-rw-r--r--src/lib/elementary/elm_win.eo2
-rw-r--r--src/lib/evas/canvas/evas_canvas.eo14
-rw-r--r--src/lib/evas/canvas/evas_events.c69
-rw-r--r--src/lib/evas/canvas/evas_events_legacy.c349
-rw-r--r--src/lib/evas/canvas/evas_main.c3
-rw-r--r--src/lib/evas/include/evas_private.h7
11 files changed, 592 insertions, 53 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 19fea04991..e9ee137d43 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -152,6 +152,7 @@ lib/evas/canvas/evas_common_interface.c \
152lib/evas/canvas/evas_data.c \ 152lib/evas/canvas/evas_data.c \
153lib/evas/canvas/evas_device.c \ 153lib/evas/canvas/evas_device.c \
154lib/evas/canvas/evas_events.c \ 154lib/evas/canvas/evas_events.c \
155lib/evas/canvas/evas_events_legacy.c \
155lib/evas/canvas/evas_focus.c \ 156lib/evas/canvas/evas_focus.c \
156lib/evas/canvas/evas_key.c \ 157lib/evas/canvas/evas_key.c \
157lib/evas/canvas/evas_key_grab.c \ 158lib/evas/canvas/evas_key_grab.c \
diff --git a/src/lib/efl/interfaces/efl_common_internal.h b/src/lib/efl/interfaces/efl_common_internal.h
index 32d5471b07..d2467d2d98 100644
--- a/src/lib/efl/interfaces/efl_common_internal.h
+++ b/src/lib/efl/interfaces/efl_common_internal.h
@@ -23,19 +23,27 @@ typedef struct _Efl_Input_State_Data Efl_Input_State_Data;
23//typedef struct _Evas_Lock Evas_Lock; 23//typedef struct _Evas_Lock Evas_Lock;
24#endif 24#endif
25 25
26struct _Efl_Input_State_Data
27{
28 Eo *eo;
29 /* FIXME / TODO */
30// Evas_Modifier *modifiers;
31// Evas_Lock *locks;
32};
33
26struct _Efl_Pointer_Event_Data 34struct _Efl_Pointer_Event_Data
27{ 35{
28 Eo *eo; 36 Eo *eo;
29 unsigned int timestamp; /* FIXME: store as double? */ 37 unsigned int timestamp; /* FIXME: store as double? */
30 int button; 38 int button;
31 unsigned int pressed_buttons; 39 unsigned int pressed_buttons;
40 int finger;
41 double radius, radius_x, radius_y;
42 double pressure;
43 double angle;
32 struct { 44 struct {
33 struct { 45 int x, y;
34 int x, y; 46 double xsub, ysub; // couldn't we just cast from double to int?
35 } output;
36 struct {
37 int x, y;
38 } canvas;
39 } cur, prev; 47 } cur, prev;
40 struct { 48 struct {
41 Efl_Orient dir; 49 Efl_Orient dir;
@@ -48,17 +56,11 @@ struct _Efl_Pointer_Event_Data
48 Efl_Pointer_Event_Flags event_flags; 56 Efl_Pointer_Event_Flags event_flags;
49 void *data; /* evas data - whatever that is */ 57 void *data; /* evas data - whatever that is */
50 const Eo_Event_Description *event_desc; 58 const Eo_Event_Description *event_desc;
51 //Efl_Input_State state; 59 Eina_Bool window_pos; /* true if positions are window-relative
52}; 60 (see input vs. feed: this is "input") */
53 61 //Efl_Input_State *state;
54struct _Efl_Input_State_Data 62 void *legacy; /* DO NOT TOUCH */
55{ 63 Eina_Bool evas_done; /* set by evas */
56 Eo *eo;
57 /* FIXME / TODO */
58#if 0
59 Evas_Modifier *modifiers;
60 Evas_Lock *locks;
61#endif
62}; 64};
63 65
64struct _Efl_Input_Device_Data 66struct _Efl_Input_Device_Data
diff --git a/src/lib/efl/interfaces/efl_event.eo b/src/lib/efl/interfaces/efl_event.eo
index 076bc1562d..f00a0472cb 100644
--- a/src/lib/efl/interfaces/efl_event.eo
+++ b/src/lib/efl/interfaces/efl_event.eo
@@ -34,5 +34,8 @@ interface Efl.Event
34 type: const(Eo_Event_Description)*; 34 type: const(Eo_Event_Description)*;
35 } 35 }
36 } 36 }
37 reset {
38 [[Resets the internal data to 0 or default values.]]
39 }
37 } 40 }
38} 41}
diff --git a/src/lib/efl/interfaces/efl_pointer_event.c b/src/lib/efl/interfaces/efl_pointer_event.c
index 7e479024b6..b55da3f407 100644
--- a/src/lib/efl/interfaces/efl_pointer_event.c
+++ b/src/lib/efl/interfaces/efl_pointer_event.c
@@ -20,15 +20,78 @@
20 * Do not add any logic here. 20 * Do not add any logic here.
21 */ 21 */
22 22
23static Efl_Pointer_Event *s_cached_event = NULL;
24
25static void
26_del_hook(Eo *evt)
27{
28 if (!s_cached_event)
29 {
30 if (eo_parent_get(evt))
31 {
32 eo_ref(evt);
33 eo_parent_set(evt, NULL);
34 }
35 s_cached_event = evt;
36 }
37 else
38 {
39 eo_del_intercept_set(evt, NULL);
40 eo_unref(evt);
41 }
42}
43
44EOLIAN static Efl_Pointer_Event *
45_efl_pointer_event_instance_get(Eo_Class *klass EINA_UNUSED, void *pd EINA_UNUSED,
46 Eo *owner, void **priv)
47{
48 Efl_Pointer_Event *evt;
49
50 if (s_cached_event)
51 {
52 evt = s_cached_event;
53 s_cached_event = NULL;
54 efl_event_reset(evt);
55 eo_parent_set(evt, owner);
56 }
57 else
58 {
59 evt = eo_add(EFL_POINTER_EVENT_CLASS, owner);
60 eo_del_intercept_set(evt, _del_hook);
61 }
62
63 if (priv)
64 *priv = eo_data_scope_get(evt, EFL_POINTER_EVENT_CLASS);
65
66 return evt;
67}
68
69EOLIAN static void
70_efl_pointer_event_class_destructor(Eo_Class *klass EINA_UNUSED)
71{
72 // this is a strange situation...
73 eo_unref(s_cached_event);
74 s_cached_event = NULL;
75}
76
23EOLIAN static Eo_Base * 77EOLIAN static Eo_Base *
24_efl_pointer_event_eo_base_constructor(Eo *obj, Efl_Pointer_Event_Data *pd) 78_efl_pointer_event_eo_base_constructor(Eo *obj, Efl_Pointer_Event_Data *pd EINA_UNUSED)
25{ 79{
26 eo_constructor(eo_super(obj, MY_CLASS)); 80 eo_constructor(eo_super(obj, MY_CLASS));
27 pd->eo = obj; 81 efl_event_reset(obj);
28 return obj; 82 return obj;
29} 83}
30 84
31EOLIAN static void 85EOLIAN static void
86_efl_pointer_event_efl_event_reset(Eo *obj, Efl_Pointer_Event_Data *pd)
87{
88 free(pd->legacy);
89 memset(pd, 0, sizeof(*pd));
90 pd->eo = obj;
91 pd->wheel.dir = EFL_ORIENT_VERTICAL;
92}
93
94EOLIAN static void
32_efl_pointer_event_action_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, Efl_Pointer_Action act) 95_efl_pointer_event_action_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, Efl_Pointer_Action act)
33{ 96{
34 pd->action = act; 97 pd->action = act;
@@ -72,37 +135,35 @@ _efl_pointer_event_button_pressed_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Dat
72} 135}
73 136
74EOLIAN static void 137EOLIAN static void
75_efl_pointer_event_position_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, int x, int y) 138_efl_pointer_event_position_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, int x, int y, double xsub, double ysub)
76{ 139{
77 pd->cur.canvas.x = x; 140 pd->cur.x = x;
78 pd->cur.canvas.y = y; 141 pd->cur.y = y;
79 /* FIXME: What is the difference??? */ 142 pd->cur.xsub = xsub;
80 pd->cur.output.x = x; 143 pd->cur.ysub = ysub;
81 pd->cur.output.y = y;
82} 144}
83 145
84EOLIAN static void 146EOLIAN static void
85_efl_pointer_event_position_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, int *x, int *y) 147_efl_pointer_event_position_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, int *x, int *y, double *xsub, double *ysub)
86{ 148{
87 if (x) *x = pd->cur.canvas.x; 149 if (x) *x = pd->cur.x;
88 if (y) *y = pd->cur.canvas.y; 150 if (y) *y = pd->cur.y;
151 if (xsub) *xsub = pd->cur.xsub;
152 if (ysub) *ysub = pd->cur.ysub;
89} 153}
90 154
91EOLIAN static void 155EOLIAN static void
92_efl_pointer_event_previous_position_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, int x, int y) 156_efl_pointer_event_previous_position_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, int x, int y)
93{ 157{
94 pd->prev.canvas.x = x; 158 pd->prev.x = x;
95 pd->prev.canvas.y = y; 159 pd->prev.y = y;
96 /* FIXME: What is the difference??? */
97 pd->prev.output.x = x;
98 pd->prev.output.y = y;
99} 160}
100 161
101EOLIAN static void 162EOLIAN static void
102_efl_pointer_event_previous_position_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, int *x, int *y) 163_efl_pointer_event_previous_position_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, int *x, int *y)
103{ 164{
104 if (x) *x = pd->prev.canvas.x; 165 if (x) *x = pd->prev.x;
105 if (y) *y = pd->prev.canvas.y; 166 if (y) *y = pd->prev.y;
106} 167}
107 168
108 169
@@ -219,4 +280,37 @@ _efl_pointer_event_wheel_distance_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Dat
219 return pd->wheel.z; 280 return pd->wheel.z;
220} 281}
221 282
283EOLIAN static int
284_efl_pointer_event_finger_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd)
285{
286 return pd->finger;
287}
288
289EOLIAN static void
290_efl_pointer_event_finger_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, int id)
291{
292 pd->finger = id;
293}
294
295EOLIAN static void
296_efl_pointer_event_touch_get(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, double *r, double *rx, double *ry, double *press, double *angle)
297{
298 if (r) *r = pd->radius;
299 if (rx) *rx = pd->radius_x;
300 if (ry) *ry = pd->radius_y;
301 if (press) *press = pd->pressure;
302 if (angle) *angle = pd->angle;
303}
304
305
306EOLIAN static void
307_efl_pointer_event_touch_set(Eo *obj EINA_UNUSED, Efl_Pointer_Event_Data *pd, double r, double rx, double ry, double press, double angle)
308{
309 pd->radius = r;
310 pd->radius_x = rx;
311 pd->radius_y = ry;
312 pd->pressure = press;
313 pd->angle = angle;
314}
315
222#include "interfaces/efl_pointer_event.eo.c" 316#include "interfaces/efl_pointer_event.eo.c"
diff --git a/src/lib/efl/interfaces/efl_pointer_event.eo b/src/lib/efl/interfaces/efl_pointer_event.eo
index 2ee4625177..05268c852e 100644
--- a/src/lib/efl/interfaces/efl_pointer_event.eo
+++ b/src/lib/efl/interfaces/efl_pointer_event.eo
@@ -7,7 +7,6 @@ class Efl.Pointer.Event (Eo.Base, Efl.Event)
7 7
8 @since 1.18 8 @since 1.18
9 ]] 9 ]]
10 legacy_prefix: null;
11 methods { 10 methods {
12 @property action { 11 @property action {
13 [[The action represented by this event.]] 12 [[The action represented by this event.]]
@@ -36,6 +35,8 @@ class Efl.Pointer.Event (Eo.Base, Efl.Event)
36 values { 35 values {
37 x: int; 36 x: int;
38 y: int; 37 y: int;
38 xsub: double;
39 ysub: double;
39 } 40 }
40 } 41 }
41 @property previous_position { 42 @property previous_position {
@@ -63,6 +64,22 @@ class Efl.Pointer.Event (Eo.Base, Efl.Event)
63 dev: Efl.Input.Device; 64 dev: Efl.Input.Device;
64 } 65 }
65 } 66 }
67 @property finger {
68 [[Finger ID in case of a multi touch event.]]
69 values {
70 id: int;
71 }
72 }
73 @property touch {
74 [[Touch information about a specific finger or pointer.]]
75 values {
76 radius: double;
77 rad_x: double;
78 rad_y: double;
79 pressure: double;
80 angle: double;
81 }
82 }
66 @property source { 83 @property source {
67 [[The object where this event first originated, in case of 84 [[The object where this event first originated, in case of
68 propagation or repetition of the event. 85 propagation or repetition of the event.
@@ -94,9 +111,21 @@ class Efl.Pointer.Event (Eo.Base, Efl.Event)
94 dist: int; 111 dist: int;
95 } 112 }
96 } 113 }
114 instance_get @class {
115 [[Creates an instance of this events or returns a fresh one from
116 a memory pool.
117 ]]
118 params {
119 @in owner: Eo.Base; [[The parent object.]]
120 @out priv: void*; [[Pointer to the internal data of the object.]]
121 }
122 return: own(Efl.Pointer.Event);
123 }
97 } 124 }
98 implements { 125 implements {
99 Eo.Base.constructor; 126 Eo.Base.constructor;
127 class.destructor;
128 Efl.Event.reset;
100 Efl.Event.timestamp.set; 129 Efl.Event.timestamp.set;
101 Efl.Event.timestamp.get; 130 Efl.Event.timestamp.get;
102 Efl.Event.event_type.set; 131 Efl.Event.event_type.set;
diff --git a/src/lib/elementary/elm_win.eo b/src/lib/elementary/elm_win.eo
index 6fe5b41422..0dcccca9c0 100644
--- a/src/lib/elementary/elm_win.eo
+++ b/src/lib/elementary/elm_win.eo
@@ -830,7 +830,7 @@ class Elm.Win (Elm.Widget, Elm.Interface.Atspi.Window,
830 name: const(char)* @nullable; 830 name: const(char)* @nullable;
831 } 831 }
832 } 832 }
833 @property type { 833 @property type { /* FIXME: before finalize */
834 [[The type of the window. 834 [[The type of the window.
835 835
836 It is a hint of how the Window Manager should handle it. 836 It is a hint of how the Window Manager should handle it.
diff --git a/src/lib/evas/canvas/evas_canvas.eo b/src/lib/evas/canvas/evas_canvas.eo
index b05e906904..8bcf38cd48 100644
--- a/src/lib/evas/canvas/evas_canvas.eo
+++ b/src/lib/evas/canvas/evas_canvas.eo
@@ -410,8 +410,8 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
410 canvas. 410 canvas.
411 411
412 When this function is called it will return a value of either 412 When this function is called it will return a value of either
413 $false or $true, depending on if @.event_feed_mouse_in or 413 $false or $true, depending on if $event_feed_mouse_in or
414 @.event_feed_mouse_out have been called to feed in a mouse 414 $event_feed_mouse_out have been called to feed in a mouse
415 enter event into the canvas. 415 enter event into the canvas.
416 416
417 A return value of $true indicates the mouse is logically 417 A return value of $true indicates the mouse is logically
@@ -504,7 +504,7 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
504 any host system's pointing device abilities. 504 any host system's pointing device abilities.
505 505
506 A canvas by default begins with no mouse buttons being 506 A canvas by default begins with no mouse buttons being
507 pressed and only calls to @.event_feed can alter that. 507 pressed and only calls to $event_feed can alter that.
508 508
509 The least significant bit corresponds to the first mouse 509 The least significant bit corresponds to the first mouse
510 button (button 1) and the most significant bit corresponds 510 button (button 1) and the most significant bit corresponds
@@ -1553,13 +1553,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
1553 @in data: const(void)*; [[Data for canvas.]] 1553 @in data: const(void)*; [[Data for canvas.]]
1554 } 1554 }
1555 } 1555 }
1556 event_feed {
1557 [[Feed an input event.]]
1558 legacy: null;
1559 params {
1560 event: const(Efl.Pointer.Event);
1561 }
1562 }
1563 } 1556 }
1564 implements { 1557 implements {
1565 Eo.Base.constructor; 1558 Eo.Base.constructor;
@@ -1580,5 +1573,6 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface, Efl.Animator)
1580 device,changed; 1573 device,changed;
1581 axis,update; 1574 axis,update;
1582 viewport,resize; 1575 viewport,resize;
1576 pointer;
1583 } 1577 }
1584} 1578}
diff --git a/src/lib/evas/canvas/evas_events.c b/src/lib/evas/canvas/evas_events.c
index 7fc0c8ff40..9379b4bf8a 100644
--- a/src/lib/evas/canvas/evas_events.c
+++ b/src/lib/evas/canvas/evas_events.c
@@ -1421,9 +1421,8 @@ evas_event_feed_mouse_wheel(Eo *eo_e, int direction, int z, unsigned int timesta
1421} 1421}
1422 1422
1423static void 1423static void
1424_canvas_event_feed_mouse_move_internal(Eo *eo_e, void *_pd, int x, int y, unsigned int timestamp, const void *data) 1424_canvas_event_feed_mouse_move_internal(Eo *eo_e, Evas_Public_Data *e, int x, int y, unsigned int timestamp, const void *data)
1425{ 1425{
1426 Evas_Public_Data *e = _pd;
1427 Evas_Object *nogrep_obj = NULL; 1426 Evas_Object *nogrep_obj = NULL;
1428 int px, py; 1427 int px, py;
1429 1428
@@ -3033,9 +3032,67 @@ _evas_canvas_event_down_count_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
3033 return e->pointer.downs; 3032 return e->pointer.downs;
3034} 3033}
3035 3034
3036EOLIAN void 3035static Eina_Bool
3037_evas_canvas_event_feed(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, const Efl_Pointer_Event *event) 3036_evas_canvas_event_pointer_cb(void *data, const Eo_Event *event)
3037{
3038 Efl_Pointer_Event_Data *ev = eo_data_scope_get(event->info, EFL_POINTER_EVENT_CLASS);
3039 Evas_Public_Data *e = data;
3040 Evas *eo_e = event->object;
3041
3042 if (!ev) return EO_CALLBACK_CONTINUE;
3043
3044 /* TODO:
3045 * - pass event to the internal functions
3046 * - implement legacy over oo instead of this
3047 */
3048
3049 switch (ev->action)
3050 {
3051 case EFL_POINTER_ACTION_MOUSE_MOVE:
3052 if (ev->window_pos)
3053 {
3054 _canvas_event_feed_mouse_move_internal(eo_e, e,
3055 ev->cur.x - e->framespace.x,
3056 ev->cur.y - e->framespace.y,
3057 ev->timestamp, ev->data);
3058 }
3059 else
3060 {
3061 _canvas_event_feed_mouse_move_internal(eo_e, e, ev->cur.x, ev->cur.y,
3062 ev->timestamp, ev->data);
3063 }
3064 break;
3065
3066 case EFL_POINTER_ACTION_MOUSE_DOWN:
3067 evas_event_feed_mouse_down(eo_e, ev->button, ev->button_flags, ev->timestamp, ev->data);
3068 break;
3069
3070 case EFL_POINTER_ACTION_MOUSE_UP:
3071 evas_event_feed_mouse_up(eo_e, ev->button, ev->button_flags, ev->timestamp, ev->data);
3072 break;
3073
3074 case EFL_POINTER_ACTION_MOUSE_WHEEL:
3075 evas_event_feed_mouse_wheel(eo_e,
3076 (ev->wheel.dir == EFL_ORIENT_HORIZONTAL) ? 1 : 0,
3077 ev->wheel.z, ev->timestamp, ev->data);
3078 break;
3079
3080 default:
3081 ERR("not implemented yet");
3082 break;
3083 }
3084
3085 return EO_CALLBACK_CONTINUE;
3086}
3087
3088void
3089_evas_canvas_event_init(Evas *eo_e, Evas_Public_Data *e)
3090{
3091 eo_event_callback_add(eo_e, EVAS_CANVAS_EVENT_POINTER, _evas_canvas_event_pointer_cb, e);
3092}
3093
3094void
3095_evas_canvas_event_shutdown(Evas *eo_e, Evas_Public_Data *e)
3038{ 3096{
3039 Efl_Pointer_Event_Data *ev = eo_data_scope_get(event, EFL_POINTER_EVENT_CLASS); 3097 eo_event_callback_del(eo_e, EVAS_CANVAS_EVENT_POINTER, _evas_canvas_event_pointer_cb, e);
3040 /* TODO */
3041} 3098}
diff --git a/src/lib/evas/canvas/evas_events_legacy.c b/src/lib/evas/canvas/evas_events_legacy.c
new file mode 100644
index 0000000000..4a0d7fdb2c
--- /dev/null
+++ b/src/lib/evas/canvas/evas_events_legacy.c
@@ -0,0 +1,349 @@
1#include "evas_common_private.h"
2#include "evas_private.h"
3
4#define EFL_INTERNAL_UNSTABLE
5#include "interfaces/efl_common_internal.h"
6
7Eina_Bool
8efl_pointer_event_legacy_info_set(Efl_Pointer_Event *evt, const void *event_info, Evas_Callback_Type type)
9{
10 Efl_Pointer_Event_Data *ev = eo_data_scope_get(evt, EFL_POINTER_EVENT_CLASS);
11 if (!ev || !event_info) return EINA_FALSE;
12
13 /* FIXME/TODO:
14 *
15 * Some things that are not supported or should be eo-ified somehow
16 *
17 * 1. Lock
18 * 2. Modifiers
19 * 3. data
20 *
21 * Some events definitely don't have all the info they could have. Need
22 * to get it from ecore!
23 */
24
25#warning Modifiers and locks not supported yet - very bad!
26
27 switch (type)
28 {
29 //cse EVAS_CALLBACK_MOUSE_IN:
30 //case EVAS_CALLBACK_MOUSE_OUT:
31 case EVAS_CALLBACK_MOUSE_DOWN:
32 {
33 const Evas_Event_Mouse_Down *e = event_info;
34 ev->action = EFL_POINTER_ACTION_MOUSE_DOWN;
35 ev->button = e->button;
36 ev->cur.x = e->canvas.x;
37 ev->cur.y = e->canvas.y;
38 ev->cur.xsub = e->canvas.x;
39 ev->cur.ysub = e->canvas.y;
40 ev->data = e->data;
41 ev->button_flags = e->flags;
42 ev->timestamp = e->timestamp;
43 ev->event_flags = e->event_flags;
44 ev->device = e->dev;
45 ev->source = e->event_src;
46 break;
47 }
48
49 case EVAS_CALLBACK_MOUSE_UP:
50 {
51 const Evas_Event_Mouse_Up *e = event_info;
52 ev->action = EFL_POINTER_ACTION_MOUSE_UP;
53 ev->button = e->button;
54 ev->cur.x = e->canvas.x;
55 ev->cur.y = e->canvas.y;
56 ev->cur.xsub = e->canvas.x;
57 ev->cur.ysub = e->canvas.y;
58 ev->data = e->data;
59 ev->button_flags = e->flags;
60 ev->timestamp = e->timestamp;
61 ev->event_flags = e->event_flags;
62 ev->device = e->dev;
63 ev->source = e->event_src;
64 break;
65 }
66
67 case EVAS_CALLBACK_MOUSE_MOVE:
68 {
69 const Evas_Event_Mouse_Move *e = event_info;
70 ev->action = EFL_POINTER_ACTION_MOUSE_MOVE;
71 ev->pressed_buttons = e->buttons;
72 ev->cur.x = e->cur.canvas.x;
73 ev->cur.y = e->cur.canvas.y;
74 ev->cur.xsub = e->cur.canvas.x;
75 ev->cur.ysub = e->cur.canvas.y;
76 ev->prev.x = e->prev.canvas.x;
77 ev->prev.y = e->prev.canvas.y;
78 ev->prev.xsub = e->prev.canvas.x;
79 ev->prev.ysub = e->prev.canvas.y;
80 ev->data = e->data;
81 ev->timestamp = e->timestamp;
82 ev->event_flags = e->event_flags;
83 ev->device = e->dev;
84 ev->source = e->event_src;
85 break;
86 }
87
88 case EVAS_CALLBACK_MOUSE_WHEEL:
89 {
90 const Evas_Event_Mouse_Wheel *e = event_info;
91 ev->action = EFL_POINTER_ACTION_MOUSE_WHEEL;
92 ev->wheel.dir = (e->direction ? EFL_ORIENT_HORIZONTAL : EFL_ORIENT_VERTICAL);
93 ev->wheel.z = e->z;
94 ev->cur.x = e->canvas.x;
95 ev->cur.y = e->canvas.y;
96 ev->cur.xsub = e->canvas.x;
97 ev->cur.ysub = e->canvas.y;
98 ev->data = e->data;
99 ev->timestamp = e->timestamp;
100 ev->event_flags = e->event_flags;
101 ev->device = e->dev;
102 break;
103 }
104
105 case EVAS_CALLBACK_MULTI_DOWN:
106 {
107 const Evas_Event_Multi_Down *e = event_info;
108 ev->action = EFL_POINTER_ACTION_MOUSE_DOWN; // TOUCH DOWN???
109 ev->finger = e->device;
110 ev->radius = e->radius;
111 ev->radius_x = e->radius_x;
112 ev->radius_y = e->radius_y;
113 ev->pressure = e->pressure;
114 ev->angle = e->angle;
115 ev->cur.x = e->canvas.x;
116 ev->cur.y = e->canvas.y;
117 ev->cur.xsub = e->canvas.xsub;
118 ev->cur.ysub = e->canvas.ysub;
119 ev->data = e->data;
120 ev->button_flags = e->flags;
121 ev->timestamp = e->timestamp;
122 ev->event_flags = e->event_flags;
123 ev->device = e->dev;
124 break;
125 }
126
127 case EVAS_CALLBACK_MULTI_UP:
128 {
129 const Evas_Event_Multi_Up *e = event_info;
130 ev->action = EFL_POINTER_ACTION_MOUSE_UP;
131 ev->finger = e->device;
132 ev->radius = e->radius;
133 ev->radius_x = e->radius_x;
134 ev->radius_y = e->radius_y;
135 ev->pressure = e->pressure;
136 ev->angle = e->angle;
137 ev->cur.x = e->canvas.x;
138 ev->cur.y = e->canvas.y;
139 ev->cur.xsub = e->canvas.xsub;
140 ev->cur.ysub = e->canvas.ysub;
141 ev->data = e->data;
142 ev->button_flags = e->flags;
143 ev->timestamp = e->timestamp;
144 ev->event_flags = e->event_flags;
145 ev->device = e->dev;
146 break;
147 }
148
149 case EVAS_CALLBACK_MULTI_MOVE:
150 {
151 const Evas_Event_Multi_Move *e = event_info;
152 ev->action = EFL_POINTER_ACTION_MOUSE_MOVE;
153 ev->finger = e->device;
154 ev->radius = e->radius;
155 ev->radius_x = e->radius_x;
156 ev->radius_y = e->radius_y;
157 ev->pressure = e->pressure;
158 ev->angle = e->angle;
159 ev->cur.x = e->cur.canvas.x;
160 ev->cur.y = e->cur.canvas.y;
161 ev->cur.xsub = e->cur.canvas.xsub;
162 ev->cur.ysub = e->cur.canvas.ysub;
163 ev->data = e->data;
164 ev->timestamp = e->timestamp;
165 ev->event_flags = e->event_flags;
166 ev->device = e->dev;
167 break;
168 }
169
170 default:
171 ERR("invalid event type %d", type);
172 return EINA_FALSE;
173 }
174
175 return EINA_TRUE;
176}
177
178const void *
179efl_pointer_event_legacy_info_get(const Efl_Pointer_Event *evt, Evas_Callback_Type *ptype, Eina_Bool multi)
180{
181 Efl_Pointer_Event_Data *ev = eo_data_scope_get(evt, EFL_POINTER_EVENT_CLASS);
182 if (!ev) return NULL;
183
184 switch (ev->action)
185 {
186 case EFL_POINTER_ACTION_MOUSE_DOWN:
187 if (!ev->finger || !multi)
188 {
189 Evas_Event_Mouse_Down *e = calloc(1, sizeof(*e));
190 if (ptype) *ptype = EVAS_CALLBACK_MOUSE_DOWN;
191 ev->legacy = e;
192
193 e->button = ev->button;
194 e->canvas.x = ev->cur.x;
195 e->canvas.y = ev->cur.y;
196 e->output.x = ev->cur.x;
197 e->output.y = ev->cur.y;
198 e->data = ev->data;
199 e->flags = ev->button_flags;
200 e->timestamp = ev->timestamp;
201 e->event_flags = ev->event_flags;
202 e->dev = ev->device;
203 e->event_src = ev->source;
204 }
205 else
206 {
207 Evas_Event_Multi_Down *e = calloc(1, sizeof(*e));
208 if (ptype) *ptype = EVAS_CALLBACK_MULTI_DOWN;
209 ev->legacy = e;
210
211 e->device = ev->finger;
212 e->radius = ev->radius;
213 e->radius_x = ev->radius_x;
214 e->radius_y = ev->radius_y;
215 e->pressure = ev->pressure;
216 e->angle = ev->angle;
217 e->canvas.x = ev->cur.x;
218 e->canvas.y = ev->cur.y;
219 e->canvas.xsub = ev->cur.xsub;
220 e->canvas.ysub = ev->cur.ysub;
221 e->output.x = ev->cur.x;
222 e->output.y = ev->cur.y;
223 e->data = ev->data;
224 e->flags = ev->button_flags;
225 e->timestamp = ev->timestamp;
226 e->event_flags = ev->event_flags;
227 e->dev = ev->device;
228 }
229 break;
230
231 case EFL_POINTER_ACTION_MOUSE_UP:
232 if (!ev->finger || !multi)
233 {
234 Evas_Event_Mouse_Up *e = calloc(1, sizeof(*e));
235 if (ptype) *ptype = EVAS_CALLBACK_MOUSE_UP;
236 ev->legacy = e;
237
238 e->button = ev->button;
239 e->canvas.x = ev->cur.x;
240 e->canvas.y = ev->cur.y;
241 e->output.x = ev->cur.x;
242 e->output.y = ev->cur.y;
243 e->data = ev->data;
244 e->flags = ev->button_flags;
245 e->timestamp = ev->timestamp;
246 e->event_flags = ev->event_flags;
247 e->dev = ev->device;
248 e->event_src = ev->source;
249 }
250 else
251 {
252 Evas_Event_Multi_Down *e = calloc(1, sizeof(*e));
253 if (ptype) *ptype = EVAS_CALLBACK_MULTI_UP;
254 ev->legacy = e;
255
256 e->device = ev->finger;
257 e->radius = ev->radius;
258 e->radius_x = ev->radius_x;
259 e->radius_y = ev->radius_y;
260 e->pressure = ev->pressure;
261 e->angle = ev->angle;
262 e->canvas.x = ev->cur.x;
263 e->canvas.y = ev->cur.y;
264 e->canvas.xsub = ev->cur.xsub;
265 e->canvas.ysub = ev->cur.ysub;
266 e->output.x = ev->cur.x;
267 e->output.y = ev->cur.y;
268 e->data = ev->data;
269 e->flags = ev->button_flags;
270 e->timestamp = ev->timestamp;
271 e->event_flags = ev->event_flags;
272 e->dev = ev->device;
273 break;
274 }
275 break;
276
277 case EFL_POINTER_ACTION_MOUSE_MOVE:
278 if (!ev->finger || !multi)
279 {
280 Evas_Event_Mouse_Move *e = calloc(1, sizeof(*e));
281 if (ptype) *ptype = EVAS_CALLBACK_MOUSE_MOVE;
282 ev->legacy = e;
283
284 e->buttons = ev->pressed_buttons;
285 e->cur.canvas.x = ev->cur.x;
286 e->cur.canvas.y = ev->cur.y;
287 e->cur.output.x = ev->cur.x;
288 e->cur.output.y = ev->cur.y;
289 e->prev.canvas.x = ev->prev.x;
290 e->prev.canvas.y = ev->prev.y;
291 e->prev.output.x = ev->prev.x;
292 e->prev.output.y = ev->prev.y;
293 e->data = ev->data;
294 e->timestamp = ev->timestamp;
295 e->event_flags = ev->event_flags;
296 e->dev = ev->device;
297 e->event_src = ev->source;
298 }
299 else
300 {
301 Evas_Event_Multi_Move *e = calloc(1, sizeof(*e));
302 if (ptype) *ptype = EVAS_CALLBACK_MULTI_MOVE;
303 ev->legacy = e;
304
305 e->device = ev->finger;
306 e->radius = ev->radius;
307 e->radius_x = ev->radius_x;
308 e->radius_y = ev->radius_y;
309 e->pressure = ev->pressure;
310 e->angle = ev->angle;
311 e->cur.canvas.x = ev->cur.x;
312 e->cur.canvas.y = ev->cur.y;
313 e->cur.canvas.xsub = ev->cur.xsub;
314 e->cur.canvas.ysub = ev->cur.ysub;
315 e->cur.output.x = ev->cur.x;
316 e->cur.output.y = ev->cur.y;
317 e->data = ev->data;
318 e->timestamp = ev->timestamp;
319 e->event_flags = ev->event_flags;
320 e->dev = ev->device;
321 }
322 break;
323
324 case EFL_POINTER_ACTION_MOUSE_WHEEL:
325 {
326 Evas_Event_Mouse_Wheel *e = calloc(1, sizeof(*e));
327 if (ptype) *ptype = EVAS_CALLBACK_MOUSE_WHEEL;
328 ev->legacy = e;
329
330 e->direction = (ev->wheel.dir == EFL_ORIENT_VERTICAL);
331 e->z = ev->wheel.z;
332 e->canvas.x = ev->cur.x;
333 e->canvas.y = ev->cur.y;
334 e->output.x = ev->cur.x;
335 e->output.y = ev->cur.y;
336 e->data = ev->data;
337 e->timestamp = ev->timestamp;
338 e->event_flags = ev->event_flags;
339 e->dev = ev->device;
340 break;
341 }
342
343 default:
344 ERR("invalid event type %d", ev->action);
345 return NULL;
346 }
347
348 return ev->legacy;
349}
diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c
index ae434d0a61..844b3364d6 100644
--- a/src/lib/evas/canvas/evas_main.c
+++ b/src/lib/evas/canvas/evas_main.c
@@ -199,6 +199,8 @@ _evas_canvas_eo_base_constructor(Eo *eo_obj, Evas_Public_Data *e)
199 eina_lock_new(&(e->lock_objects)); 199 eina_lock_new(&(e->lock_objects));
200 eina_spinlock_new(&(e->render.lock)); 200 eina_spinlock_new(&(e->render.lock));
201 201
202 _evas_canvas_event_init(eo_obj, e);
203
202 return eo_obj; 204 return eo_obj;
203} 205}
204 206
@@ -230,6 +232,7 @@ _evas_canvas_eo_base_destructor(Eo *eo_e, Evas_Public_Data *e)
230 evas_render_idle_flush(eo_e); 232 evas_render_idle_flush(eo_e);
231 233
232 _evas_post_event_callback_free(eo_e); 234 _evas_post_event_callback_free(eo_e);
235 _evas_canvas_event_shutdown(eo_e, e);
233 236
234 del = EINA_TRUE; 237 del = EINA_TRUE;
235 e->walking_list++; 238 e->walking_list++;
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index e6ff51a0bb..5bf9b99d5d 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1881,6 +1881,9 @@ struct _Evas_Proxy_Render_Data
1881 Eina_Bool source_clip : 1; 1881 Eina_Bool source_clip : 1;
1882}; 1882};
1883 1883
1884void _evas_canvas_event_init(Evas *eo_e, Evas_Public_Data *e);
1885void _evas_canvas_event_shutdown(Evas *eo_e, Evas_Public_Data *e);
1886
1884int evas_async_events_init(void); 1887int evas_async_events_init(void);
1885int evas_async_events_shutdown(void); 1888int evas_async_events_shutdown(void);
1886int evas_async_target_del(const void *target); 1889int evas_async_target_del(const void *target);
@@ -1933,6 +1936,10 @@ void _evas_touch_point_remove(Evas *e, int id);
1933void _evas_device_cleanup(Evas *e); 1936void _evas_device_cleanup(Evas *e);
1934Evas_Device *_evas_device_top_get(const Evas *e); 1937Evas_Device *_evas_device_top_get(const Evas *e);
1935 1938
1939/* legacy/eo events */
1940Eina_Bool efl_pointer_event_legacy_info_set(Efl_Pointer_Event *evt, const void *event_info, Evas_Callback_Type type);
1941const void *efl_pointer_event_legacy_info_get(const Efl_Pointer_Event *evt, Evas_Callback_Type *ptype, Eina_Bool multi);
1942
1936Eina_Bool evas_vg_loader_svg(Evas_Object *vg, const Eina_File *f, const char *key EINA_UNUSED); 1943Eina_Bool evas_vg_loader_svg(Evas_Object *vg, const Eina_File *f, const char *key EINA_UNUSED);
1937 1944
1938void *_evas_object_image_surface_get(Evas_Object *eo, Evas_Object_Protected_Data *obj); 1945void *_evas_object_image_surface_get(Evas_Object *eo, Evas_Object_Protected_Data *obj);