diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-08-23 20:23:48 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-08-26 10:18:01 +0900 |
commit | 925878e931a46212f47be805abdf5b09b810dad4 (patch) | |
tree | e3ca62b4745ada5175716029c288f80b6af62a4f | |
parent | 8938d8d557393b009d4db1058bcc3e342a1a9008 (diff) |
evas events: Switch axis events to the new eo type
This converts Evas_Axis or Ecore_Axis info arrays into basic
pointer data. Also marks those fields as set. All events need
to properly implement the value_has property (mark all bits
whenever a value is known).
-rw-r--r-- | src/lib/ecore_evas/ecore_evas.c | 77 | ||||
-rw-r--r-- | src/lib/efl/interfaces/efl_common_internal.h | 12 | ||||
-rw-r--r-- | src/lib/efl/interfaces/efl_input_interface.eo | 1 | ||||
-rw-r--r-- | src/lib/evas/canvas/efl_event_pointer.c | 5 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_callbacks.c | 3 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_events.c | 88 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_events_legacy.c | 34 |
7 files changed, 194 insertions, 26 deletions
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index 3ae9c92601..9b43ec370e 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c | |||
@@ -4347,6 +4347,8 @@ _event_description_get(Efl_Pointer_Action action) | |||
4347 | return EFL_EVENT_POINTER_OUT; | 4347 | return EFL_EVENT_POINTER_OUT; |
4348 | case EFL_POINTER_ACTION_WHEEL: | 4348 | case EFL_POINTER_ACTION_WHEEL: |
4349 | return EFL_EVENT_POINTER_WHEEL; | 4349 | return EFL_EVENT_POINTER_WHEEL; |
4350 | case EFL_POINTER_ACTION_AXIS: | ||
4351 | return EFL_EVENT_POINTER_AXIS; | ||
4350 | default: return NULL; | 4352 | default: return NULL; |
4351 | } | 4353 | } |
4352 | } | 4354 | } |
@@ -4521,6 +4523,74 @@ _direct_mouse_out_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_IO *info) | |||
4521 | } | 4523 | } |
4522 | 4524 | ||
4523 | static Eina_Bool | 4525 | static Eina_Bool |
4526 | _direct_axis_update_cb(Ecore_Evas *ee, const Ecore_Event_Axis_Update *info) | ||
4527 | { | ||
4528 | Efl_Event_Pointer_Data *ev; | ||
4529 | Efl_Event_Pointer *evt; | ||
4530 | Evas *e = ee->evas; | ||
4531 | Eina_Bool processed; | ||
4532 | double x = 0, y = 0; | ||
4533 | int n; | ||
4534 | |||
4535 | /* Unused information: | ||
4536 | * window, root_window, event_window | ||
4537 | */ | ||
4538 | |||
4539 | evt = efl_event_instance_get(EFL_EVENT_POINTER_CLASS, e, (void **) &ev); | ||
4540 | if (!ev) return EINA_FALSE; | ||
4541 | |||
4542 | ev->action = EFL_POINTER_ACTION_AXIS; | ||
4543 | ev->timestamp = info->timestamp; | ||
4544 | ev->tool = info->toolid; | ||
4545 | |||
4546 | // see also evas_events.c | ||
4547 | for (n = 0; n < info->naxis; n++) | ||
4548 | { | ||
4549 | const Ecore_Axis *axis = &(info->axis[n]); | ||
4550 | switch (axis->label) | ||
4551 | { | ||
4552 | case EVAS_AXIS_LABEL_X: | ||
4553 | _efl_input_value_mark(ev, EFL_INPUT_VALUE_X); | ||
4554 | x = axis->value; | ||
4555 | break; | ||
4556 | |||
4557 | case EVAS_AXIS_LABEL_Y: | ||
4558 | _efl_input_value_mark(ev, EFL_INPUT_VALUE_Y); | ||
4559 | y = axis->value; | ||
4560 | break; | ||
4561 | |||
4562 | case EVAS_AXIS_LABEL_PRESSURE: | ||
4563 | _efl_input_value_mark(ev, EFL_INPUT_VALUE_PRESSURE); | ||
4564 | ev->pressure = axis->value; | ||
4565 | break; | ||
4566 | |||
4567 | case EVAS_AXIS_LABEL_DISTANCE: | ||
4568 | case EVAS_AXIS_LABEL_AZIMUTH: | ||
4569 | case EVAS_AXIS_LABEL_TILT: | ||
4570 | case EVAS_AXIS_LABEL_TWIST: | ||
4571 | // TODO | ||
4572 | |||
4573 | case EVAS_AXIS_LABEL_UNKNOWN: | ||
4574 | case EVAS_AXIS_LABEL_TOUCH_WIDTH_MAJOR: | ||
4575 | case EVAS_AXIS_LABEL_TOUCH_WIDTH_MINOR: | ||
4576 | case EVAS_AXIS_LABEL_TOOL_WIDTH_MAJOR: | ||
4577 | case EVAS_AXIS_LABEL_TOOL_WIDTH_MINOR: | ||
4578 | default: | ||
4579 | DBG("Unsupported axis label %d, value %f (discarded)", | ||
4580 | axis->label, axis->value); | ||
4581 | break; | ||
4582 | } | ||
4583 | } | ||
4584 | _pointer_position_set(ev, ee, x, y, x, y); | ||
4585 | |||
4586 | efl_event_callback_call(e, _event_description_get(ev->action), evt); | ||
4587 | processed = ev->evas_done; | ||
4588 | efl_del(evt); | ||
4589 | |||
4590 | return processed; | ||
4591 | } | ||
4592 | |||
4593 | static Eina_Bool | ||
4524 | _direct_key_updown_cb(Ecore_Evas *ee, const Ecore_Event_Key *info, Eina_Bool down) | 4594 | _direct_key_updown_cb(Ecore_Evas *ee, const Ecore_Event_Key *info, Eina_Bool down) |
4525 | { | 4595 | { |
4526 | Efl_Event_Key_Data *ev; | 4596 | Efl_Event_Key_Data *ev; |
@@ -4561,13 +4631,6 @@ _direct_key_updown_cb(Ecore_Evas *ee, const Ecore_Event_Key *info, Eina_Bool dow | |||
4561 | return processed; | 4631 | return processed; |
4562 | } | 4632 | } |
4563 | 4633 | ||
4564 | static Eina_Bool | ||
4565 | _direct_axis_update_cb(Ecore_Evas *ee EINA_UNUSED, const Ecore_Event_Axis_Update *info EINA_UNUSED) | ||
4566 | { | ||
4567 | /* TODO: Add joystick event type. */ | ||
4568 | return EINA_FALSE; | ||
4569 | } | ||
4570 | |||
4571 | EAPI Eina_Bool | 4634 | EAPI Eina_Bool |
4572 | _ecore_evas_input_direct_cb(void *window, int type, const void *info) | 4635 | _ecore_evas_input_direct_cb(void *window, int type, const void *info) |
4573 | { | 4636 | { |
diff --git a/src/lib/efl/interfaces/efl_common_internal.h b/src/lib/efl/interfaces/efl_common_internal.h index 83fb3c2f1a..03940d560b 100644 --- a/src/lib/efl/interfaces/efl_common_internal.h +++ b/src/lib/efl/interfaces/efl_common_internal.h | |||
@@ -104,4 +104,16 @@ struct _Efl_Event_Hold_Data | |||
104 | Eina_Bool evas_done : 1; /* set by evas */ | 104 | Eina_Bool evas_done : 1; /* set by evas */ |
105 | }; | 105 | }; |
106 | 106 | ||
107 | static inline Eina_Bool | ||
108 | _efl_input_value_has(const Efl_Event_Pointer_Data *pd, Efl_Input_Value key) | ||
109 | { | ||
110 | return (pd->value_flags & (1 << (int) key)) != 0; | ||
111 | } | ||
112 | |||
113 | static inline void | ||
114 | _efl_input_value_mark(Efl_Event_Pointer_Data *pd, Efl_Input_Value key) | ||
115 | { | ||
116 | pd->value_flags |= (1 << (int) key); | ||
117 | } | ||
118 | |||
107 | #endif | 119 | #endif |
diff --git a/src/lib/efl/interfaces/efl_input_interface.eo b/src/lib/efl/interfaces/efl_input_interface.eo index c60d252e88..6a66a74455 100644 --- a/src/lib/efl/interfaces/efl_input_interface.eo +++ b/src/lib/efl/interfaces/efl_input_interface.eo | |||
@@ -34,6 +34,7 @@ interface Efl.Input.Interface () | |||
34 | pointer,in: Efl.Event.Pointer; [[Pointer entered a window or a widget.]] | 34 | pointer,in: Efl.Event.Pointer; [[Pointer entered a window or a widget.]] |
35 | pointer,out: Efl.Event.Pointer; [[Pointer left a window or a widget.]] | 35 | pointer,out: Efl.Event.Pointer; [[Pointer left a window or a widget.]] |
36 | pointer,wheel: Efl.Event.Pointer; [[Mouse wheel event.]] | 36 | pointer,wheel: Efl.Event.Pointer; [[Mouse wheel event.]] |
37 | pointer,axis: Efl.Event.Pointer; [[Pen or other axis event update.]] | ||
37 | finger,move: Efl.Event.Pointer; [[Finger moved (current and previous positions are known).]] | 38 | finger,move: Efl.Event.Pointer; [[Finger moved (current and previous positions are known).]] |
38 | finger,down: Efl.Event.Pointer; [[Finger pressed (finger id is known).]] | 39 | finger,down: Efl.Event.Pointer; [[Finger pressed (finger id is known).]] |
39 | finger,up: Efl.Event.Pointer; [[Finger released (finger id is known).]] | 40 | finger,up: Efl.Event.Pointer; [[Finger released (finger id is known).]] |
diff --git a/src/lib/evas/canvas/efl_event_pointer.c b/src/lib/evas/canvas/efl_event_pointer.c index 019eb8315a..71b78f42a7 100644 --- a/src/lib/evas/canvas/efl_event_pointer.c +++ b/src/lib/evas/canvas/efl_event_pointer.c | |||
@@ -363,10 +363,9 @@ _efl_event_pointer_efl_event_input_fake_get(Eo *obj EINA_UNUSED, Efl_Event_Point | |||
363 | EOLIAN static Eina_Bool | 363 | EOLIAN static Eina_Bool |
364 | _efl_event_pointer_value_has_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Input_Value key) | 364 | _efl_event_pointer_value_has_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Input_Value key) |
365 | { | 365 | { |
366 | // read-only | 366 | if (!pd || (key <= EFL_INPUT_VALUE_NONE) || (key > EFL_INPUT_VALUE_SLIDER)) |
367 | if ((key <= EFL_INPUT_VALUE_NONE) || (key > EFL_INPUT_VALUE_SLIDER)) | ||
368 | return EINA_FALSE; | 367 | return EINA_FALSE; |
369 | return (pd->value_flags & (1 << (int) key)) != 0; | 368 | return _efl_input_value_has(pd, key); |
370 | } | 369 | } |
371 | 370 | ||
372 | EOLIAN static Eina_Bool | 371 | EOLIAN static Eina_Bool |
diff --git a/src/lib/evas/canvas/evas_callbacks.c b/src/lib/evas/canvas/evas_callbacks.c index 3e848b281b..af3f51d324 100644 --- a/src/lib/evas/canvas/evas_callbacks.c +++ b/src/lib/evas/canvas/evas_callbacks.c | |||
@@ -70,7 +70,7 @@ DEFINE_EVAS_CALLBACKS(_legacy_evas_callback_table, EVAS_CALLBACK_LAST, | |||
70 | EFL_CANVAS_EVENT_RENDER_POST, | 70 | EFL_CANVAS_EVENT_RENDER_POST, |
71 | EFL_IMAGE_EVENT_RESIZE, | 71 | EFL_IMAGE_EVENT_RESIZE, |
72 | EFL_CANVAS_EVENT_DEVICE_CHANGED, | 72 | EFL_CANVAS_EVENT_DEVICE_CHANGED, |
73 | EVAS_CANVAS_EVENT_AXIS_UPDATE, | 73 | EFL_EVENT_POINTER_AXIS, |
74 | EVAS_CANVAS_EVENT_VIEWPORT_RESIZE ); | 74 | EVAS_CANVAS_EVENT_VIEWPORT_RESIZE ); |
75 | 75 | ||
76 | static inline Evas_Callback_Type | 76 | static inline Evas_Callback_Type |
@@ -123,6 +123,7 @@ _evas_event_efl_event_info_exists(Evas_Callback_Type type) | |||
123 | case EVAS_CALLBACK_MULTI_DOWN: | 123 | case EVAS_CALLBACK_MULTI_DOWN: |
124 | case EVAS_CALLBACK_MULTI_UP: | 124 | case EVAS_CALLBACK_MULTI_UP: |
125 | case EVAS_CALLBACK_MULTI_MOVE: | 125 | case EVAS_CALLBACK_MULTI_MOVE: |
126 | case EVAS_CALLBACK_AXIS_UPDATE: | ||
126 | return EFL_EVENT_TYPE_POINTER; | 127 | return EFL_EVENT_TYPE_POINTER; |
127 | case EVAS_CALLBACK_KEY_DOWN: | 128 | case EVAS_CALLBACK_KEY_DOWN: |
128 | case EVAS_CALLBACK_KEY_UP: | 129 | case EVAS_CALLBACK_KEY_UP: |
diff --git a/src/lib/evas/canvas/evas_events.c b/src/lib/evas/canvas/evas_events.c index f1b019fcaa..1dd71cc964 100644 --- a/src/lib/evas/canvas/evas_events.c +++ b/src/lib/evas/canvas/evas_events.c | |||
@@ -2864,26 +2864,23 @@ evas_event_feed_hold(Eo *eo_e, int hold, unsigned int timestamp, const void *dat | |||
2864 | } | 2864 | } |
2865 | 2865 | ||
2866 | void | 2866 | void |
2867 | _canvas_event_feed_axis_update_internal(Evas *eo_e, Evas_Public_Data *e, unsigned int timestamp, int device, int toolid, int naxis, const Evas_Axis *axis, const void *data) | 2867 | _canvas_event_feed_axis_update_internal(Evas_Public_Data *e, Efl_Event_Pointer_Data *ev) |
2868 | { | 2868 | { |
2869 | Eina_List *l, *copy; | 2869 | Eina_List *l, *copy; |
2870 | Evas_Event_Axis_Update ev; | ||
2871 | Evas_Object *eo_obj; | 2870 | Evas_Object *eo_obj; |
2872 | int event_id = 0; | 2871 | int event_id = 0; |
2872 | Evas *eo_e; | ||
2873 | 2873 | ||
2874 | if (!e || !ev) return; | ||
2874 | if (e->is_frozen) return; | 2875 | if (e->is_frozen) return; |
2875 | e->last_timestamp = timestamp; | ||
2876 | 2876 | ||
2877 | eo_e = e->evas; | ||
2878 | e->last_timestamp = ev->timestamp; | ||
2879 | |||
2880 | ev->action = EFL_POINTER_ACTION_AXIS; | ||
2877 | event_id = _evas_object_event_new(); | 2881 | event_id = _evas_object_event_new(); |
2878 | 2882 | ||
2879 | ev.data = (void *)data; | 2883 | if (ev->device) efl_ref(ev->device); |
2880 | ev.timestamp = timestamp; | ||
2881 | ev.device = device; | ||
2882 | ev.toolid = toolid; | ||
2883 | ev.naxis = naxis; | ||
2884 | ev.axis = (Evas_Axis *)axis; | ||
2885 | ev.dev = _evas_device_top_get(eo_e); | ||
2886 | if (ev.dev) efl_ref(ev.dev); | ||
2887 | 2884 | ||
2888 | _evas_walk(e); | 2885 | _evas_walk(e); |
2889 | copy = evas_event_list_copy(e->pointer.object.in); | 2886 | copy = evas_event_list_copy(e->pointer.object.in); |
@@ -2894,8 +2891,8 @@ _canvas_event_feed_axis_update_internal(Evas *eo_e, Evas_Public_Data *e, unsigne | |||
2894 | if (!evas_event_freezes_through(eo_obj, obj)) | 2891 | if (!evas_event_freezes_through(eo_obj, obj)) |
2895 | { | 2892 | { |
2896 | evas_object_event_callback_call(eo_obj, obj, | 2893 | evas_object_event_callback_call(eo_obj, obj, |
2897 | EVAS_CALLBACK_AXIS_UPDATE, &ev, | 2894 | EVAS_CALLBACK_AXIS_UPDATE, NULL, |
2898 | event_id, NULL, NULL); | 2895 | event_id, EFL_EVENT_POINTER_AXIS, ev->eo); |
2899 | if (e->delete_me || e->is_frozen) break; | 2896 | if (e->delete_me || e->is_frozen) break; |
2900 | } | 2897 | } |
2901 | } | 2898 | } |
@@ -2903,13 +2900,69 @@ _canvas_event_feed_axis_update_internal(Evas *eo_e, Evas_Public_Data *e, unsigne | |||
2903 | _evas_post_event_callback_call(eo_e, e); | 2900 | _evas_post_event_callback_call(eo_e, e); |
2904 | 2901 | ||
2905 | _evas_unwalk(e); | 2902 | _evas_unwalk(e); |
2903 | if (ev->device) efl_unref(ev->device); | ||
2906 | } | 2904 | } |
2907 | 2905 | ||
2908 | EAPI void | 2906 | EAPI void |
2909 | evas_event_feed_axis_update(Evas *eo_e, unsigned int timestamp, int device, int toolid, int naxis, const Evas_Axis *axis, const void *data) | 2907 | evas_event_feed_axis_update(Evas *eo_e, unsigned int timestamp, int device, int toolid, int naxis, const Evas_Axis *axes, const void *data) |
2910 | { | 2908 | { |
2909 | EINA_SAFETY_ON_FALSE_RETURN(efl_isa(eo_e, EVAS_CANVAS_CLASS)); | ||
2911 | Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS); | 2910 | Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS); |
2912 | _canvas_event_feed_axis_update_internal(eo_e, e, timestamp, device, toolid, naxis, axis, data); | 2911 | Efl_Event_Pointer_Data *ev = NULL; |
2912 | Efl_Event_Pointer *evt; | ||
2913 | int n; | ||
2914 | |||
2915 | evt = efl_event_instance_get(EFL_EVENT_POINTER_CLASS, eo_e, (void **) &ev); | ||
2916 | if (!ev) return; | ||
2917 | |||
2918 | ev->data = (void *) data; | ||
2919 | ev->timestamp = timestamp; | ||
2920 | ev->action = EFL_POINTER_ACTION_AXIS; | ||
2921 | ev->device = _evas_device_top_get(eo_e); // FIXME | ||
2922 | ev->tool = toolid; | ||
2923 | |||
2924 | // see also ecore_evas.c | ||
2925 | for (n = 0; n < naxis; n++) | ||
2926 | { | ||
2927 | const Evas_Axis *axis = &(axes[n]); | ||
2928 | switch (axis->label) | ||
2929 | { | ||
2930 | case EVAS_AXIS_LABEL_X: | ||
2931 | _efl_input_value_mark(ev, EFL_INPUT_VALUE_X); | ||
2932 | ev->cur.x = axis->value; | ||
2933 | break; | ||
2934 | |||
2935 | case EVAS_AXIS_LABEL_Y: | ||
2936 | _efl_input_value_mark(ev, EFL_INPUT_VALUE_Y); | ||
2937 | ev->cur.y = axis->value; | ||
2938 | break; | ||
2939 | |||
2940 | case EVAS_AXIS_LABEL_PRESSURE: | ||
2941 | _efl_input_value_mark(ev, EFL_INPUT_VALUE_PRESSURE); | ||
2942 | ev->pressure = axis->value; | ||
2943 | break; | ||
2944 | |||
2945 | case EVAS_AXIS_LABEL_DISTANCE: | ||
2946 | case EVAS_AXIS_LABEL_AZIMUTH: | ||
2947 | case EVAS_AXIS_LABEL_TILT: | ||
2948 | case EVAS_AXIS_LABEL_TWIST: | ||
2949 | // TODO | ||
2950 | |||
2951 | case EVAS_AXIS_LABEL_UNKNOWN: | ||
2952 | case EVAS_AXIS_LABEL_TOUCH_WIDTH_MAJOR: | ||
2953 | case EVAS_AXIS_LABEL_TOUCH_WIDTH_MINOR: | ||
2954 | case EVAS_AXIS_LABEL_TOOL_WIDTH_MAJOR: | ||
2955 | case EVAS_AXIS_LABEL_TOOL_WIDTH_MINOR: | ||
2956 | default: | ||
2957 | DBG("Unsupported axis label %d, value %f (discarded)", | ||
2958 | axis->label, axis->value); | ||
2959 | break; | ||
2960 | } | ||
2961 | } | ||
2962 | |||
2963 | _canvas_event_feed_axis_update_internal(e, ev); | ||
2964 | |||
2965 | efl_del(evt); | ||
2913 | } | 2966 | } |
2914 | 2967 | ||
2915 | static void | 2968 | static void |
@@ -3215,6 +3268,10 @@ _evas_canvas_event_pointer_cb(void *data, const Eo_Event *event) | |||
3215 | _canvas_event_feed_mouse_wheel_internal(eo_e, ev); | 3268 | _canvas_event_feed_mouse_wheel_internal(eo_e, ev); |
3216 | break; | 3269 | break; |
3217 | 3270 | ||
3271 | case EFL_POINTER_ACTION_AXIS: | ||
3272 | _canvas_event_feed_axis_update_internal(e, ev); | ||
3273 | break; | ||
3274 | |||
3218 | default: | 3275 | default: |
3219 | ERR("unsupported event type: %d", ev->action); | 3276 | ERR("unsupported event type: %d", ev->action); |
3220 | ev->evas_done = EINA_FALSE; | 3277 | ev->evas_done = EINA_FALSE; |
@@ -3259,6 +3316,7 @@ EFL_CALLBACKS_ARRAY_DEFINE(_evas_canvas_event_pointer_callbacks, | |||
3259 | { EFL_EVENT_POINTER_OUT, _evas_canvas_event_pointer_cb }, | 3316 | { EFL_EVENT_POINTER_OUT, _evas_canvas_event_pointer_cb }, |
3260 | { EFL_EVENT_POINTER_CANCEL, _evas_canvas_event_pointer_cb }, | 3317 | { EFL_EVENT_POINTER_CANCEL, _evas_canvas_event_pointer_cb }, |
3261 | { EFL_EVENT_POINTER_WHEEL, _evas_canvas_event_pointer_cb }, | 3318 | { EFL_EVENT_POINTER_WHEEL, _evas_canvas_event_pointer_cb }, |
3319 | { EFL_EVENT_POINTER_AXIS, _evas_canvas_event_pointer_cb }, | ||
3262 | { EFL_EVENT_KEY_DOWN, _evas_canvas_event_key_cb }, | 3320 | { EFL_EVENT_KEY_DOWN, _evas_canvas_event_key_cb }, |
3263 | { EFL_EVENT_KEY_UP, _evas_canvas_event_key_cb }) | 3321 | { EFL_EVENT_KEY_UP, _evas_canvas_event_key_cb }) |
3264 | 3322 | ||
diff --git a/src/lib/evas/canvas/evas_events_legacy.c b/src/lib/evas/canvas/evas_events_legacy.c index 92d25580ca..0b79fd2cab 100644 --- a/src/lib/evas/canvas/evas_events_legacy.c +++ b/src/lib/evas/canvas/evas_events_legacy.c | |||
@@ -255,6 +255,40 @@ efl_event_pointer_legacy_info_fill(Efl_Event_Key *evt, Evas_Callback_Type type, | |||
255 | return e; | 255 | return e; |
256 | } | 256 | } |
257 | 257 | ||
258 | case EFL_POINTER_ACTION_AXIS: | ||
259 | { | ||
260 | TYPE_CHK(AXIS_UPDATE); | ||
261 | Evas_Event_Axis_Update *e = ev->legacy; | ||
262 | Evas_Axis *tmp_axis; | ||
263 | if (e && e->axis) free(e->axis); | ||
264 | e = _event_alloc(ev->legacy); | ||
265 | e->data = ev->data; | ||
266 | e->timestamp = ev->timestamp; | ||
267 | e->dev = ev->device; | ||
268 | /* FIXME: Get device id from above device object. 0 for now. */ | ||
269 | e->device = 0; | ||
270 | e->toolid = ev->tool; | ||
271 | e->axis = malloc(sizeof(Evas_Axis) * 3); | ||
272 | e->axis[e->naxis].label = EVAS_AXIS_LABEL_X; | ||
273 | e->axis[e->naxis].value = ev->cur.x; | ||
274 | e->naxis++; | ||
275 | e->axis[e->naxis].label = EVAS_AXIS_LABEL_Y; | ||
276 | e->axis[e->naxis].value = ev->cur.y; | ||
277 | e->naxis++; | ||
278 | if (_efl_input_value_has(ev, EFL_INPUT_VALUE_PRESSURE)) | ||
279 | { | ||
280 | e->axis[e->naxis].label = EVAS_AXIS_LABEL_PRESSURE; | ||
281 | e->axis[e->naxis].value = ev->pressure; | ||
282 | e->naxis++; | ||
283 | } | ||
284 | // TODO: distance, azimuth, tild, twist | ||
285 | tmp_axis = realloc(e->axis, e->naxis * sizeof(Evas_Axis)); | ||
286 | if (tmp_axis) e->axis = tmp_axis; | ||
287 | if (pflags) *pflags = NULL; | ||
288 | ev->legacy = e; | ||
289 | return e; | ||
290 | } | ||
291 | |||
258 | default: | 292 | default: |
259 | return NULL; | 293 | return NULL; |
260 | } | 294 | } |