summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-08-23 18:12:10 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-08-26 10:18:01 +0900
commit8938d8d557393b009d4db1058bcc3e342a1a9008 (patch)
tree57e642f2cc0f8617fd3df9ddf24e0d7be8557111 /src
parentef4859d5bdab3a9d8c5d7e2114c1d42bcc94f50f (diff)
evas events: Rename properties and introduce generic value
This paves the way to a merge of pointer and axis events into the class Efl.Event.Pointer.
Diffstat (limited to 'src')
-rw-r--r--src/lib/ecore_evas/ecore_evas.c4
-rw-r--r--src/lib/efl/interfaces/efl_common_internal.h3
-rw-r--r--src/lib/efl/interfaces/efl_event_types.eot54
-rw-r--r--src/lib/evas/canvas/efl_event_pointer.c252
-rw-r--r--src/lib/evas/canvas/efl_event_pointer.eo102
-rw-r--r--src/lib/evas/canvas/evas_events.c34
-rw-r--r--src/lib/evas/canvas/evas_events_legacy.c12
7 files changed, 351 insertions, 110 deletions
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index 7d491ca..3ae9c92 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -4376,7 +4376,7 @@ _direct_mouse_updown(Ecore_Evas *ee, const Ecore_Event_Mouse_Button *info, Efl_P
4376 if (info->double_click) ev->button_flags |= EFL_POINTER_FLAGS_DOUBLE_CLICK; 4376 if (info->double_click) ev->button_flags |= EFL_POINTER_FLAGS_DOUBLE_CLICK;
4377 if (info->triple_click) ev->button_flags |= EFL_POINTER_FLAGS_TRIPLE_CLICK; 4377 if (info->triple_click) ev->button_flags |= EFL_POINTER_FLAGS_TRIPLE_CLICK;
4378 ev->timestamp = info->timestamp; 4378 ev->timestamp = info->timestamp;
4379 ev->finger = info->multi.device; 4379 ev->tool = info->multi.device;
4380 _pointer_position_set(ev, ee, info->x, info->y, info->multi.x, info->multi.y); 4380 _pointer_position_set(ev, ee, info->x, info->y, info->multi.x, info->multi.y);
4381 ev->radius = info->multi.radius; 4381 ev->radius = info->multi.radius;
4382 ev->radius_x = info->multi.radius_x; 4382 ev->radius_x = info->multi.radius_x;
@@ -4433,7 +4433,7 @@ _direct_mouse_move_cb(Ecore_Evas *ee, const Ecore_Event_Mouse_Move *info)
4433 4433
4434 ev->action = EFL_POINTER_ACTION_MOVE; 4434 ev->action = EFL_POINTER_ACTION_MOVE;
4435 ev->timestamp = info->timestamp; 4435 ev->timestamp = info->timestamp;
4436 ev->finger = info->multi.device; 4436 ev->tool = info->multi.device;
4437 _pointer_position_set(ev, ee, info->x, info->y, info->multi.x, info->multi.y); 4437 _pointer_position_set(ev, ee, info->x, info->y, info->multi.x, info->multi.y);
4438 4438
4439 ev->radius = info->multi.radius; 4439 ev->radius = info->multi.radius;
diff --git a/src/lib/efl/interfaces/efl_common_internal.h b/src/lib/efl/interfaces/efl_common_internal.h
index 5063fe8..83fb3c2 100644
--- a/src/lib/efl/interfaces/efl_common_internal.h
+++ b/src/lib/efl/interfaces/efl_common_internal.h
@@ -29,7 +29,7 @@ struct _Efl_Event_Pointer_Data
29 unsigned int timestamp; /* FIXME: store as double? */ 29 unsigned int timestamp; /* FIXME: store as double? */
30 int button; 30 int button;
31 unsigned int pressed_buttons; 31 unsigned int pressed_buttons;
32 int finger; 32 int tool; /* finger or tool ID */
33 double radius, radius_x, radius_y; 33 double radius, radius_x, radius_y;
34 double pressure; 34 double pressure;
35 double angle; 35 double angle;
@@ -49,6 +49,7 @@ struct _Efl_Event_Pointer_Data
49 Evas_Modifier *modifiers; 49 Evas_Modifier *modifiers;
50 Evas_Lock *locks; 50 Evas_Lock *locks;
51 void *legacy; /* DO NOT TOUCH THIS */ 51 void *legacy; /* DO NOT TOUCH THIS */
52 uint32_t value_flags;
52 Eina_Bool evas_done : 1; /* set by evas */ 53 Eina_Bool evas_done : 1; /* set by evas */
53 Eina_Bool fake : 1; 54 Eina_Bool fake : 1;
54 Eina_Bool win_fed : 1; 55 Eina_Bool win_fed : 1;
diff --git a/src/lib/efl/interfaces/efl_event_types.eot b/src/lib/efl/interfaces/efl_event_types.eot
index 2cb1fa7..93aadb8 100644
--- a/src/lib/efl/interfaces/efl_event_types.eot
+++ b/src/lib/efl/interfaces/efl_event_types.eot
@@ -65,3 +65,57 @@ enum Efl.Event.Object_Pointer_Mode {
65 @since 1.2 65 @since 1.2
66 ]] 66 ]]
67} 67}
68
69enum Efl.Input.Value {
70 [[Keys for the generic values of all events.
71
72 @since 1.19
73 ]]
74 none, [[Not a valid value type.]]
75 timestamp, [[Timestamp of this event in seconds.]]
76 button, [[ID of the button that triggered this event (unsigned int).
77 Prefer the method $button to read this value. Default: 0.]]
78 buttons_pressed, [[32-bit bit mask (unsigned int). Prefer the
79 method $buttons_pressed to read this value. Default: 0.]]
80 tool, [[ID of the finger or tool (eg. pen) that triggered this event.
81 Prefer the property $tool to read this value. Default: 0.]]
82 x, [[Absolute X position where this event occurred, in pixels.
83 Relative to the window. Default: last known position.]]
84 y, [[Absolute Y position where this event occurred, in pixels.
85 Relative to the window. Default: last known position.]]
86 dx, [[Relative X movement, in pixels. Range: unbounded. Default: 0.]]
87 dy, [[Relative Y movement, in pixels. Range: unbounded. Default: 0.]]
88 previous_x, [[Previous X position of the pointer, in pixels.
89 Default: last known position, may be equal to x.]]
90 previous_y, [[Previous Y position of the pointer, in pixels.
91 Default: last known position, may be equal to y.]]
92 radius, [[Average radius of the pressed area under a finger or tool,
93 in pixels. Default is 1.]]
94 radius_x, [[Spread over X of the pressed area under a finger or tool,
95 in pixels. Default is 1.]]
96 radius_y, [[Spread over Y of the pressed area under a finger or tool,
97 in pixels. Default is 1.]]
98 pressure, [[Pressure applied to the button, touch or pen tip.
99 Range: [0, 1]. Default is 1.]]
100 distance, [[Relative distance along physical Z axis. Range: [0, 1].
101 Default is 0.]]
102 azimuth, [[Angle of tool about the Z axis from positive X axis.
103 Range: [-PI, PI]. Unit: Radians.]]
104 tilt, [[Angle of tool about plane of sensor from positive Z axis.
105 Range: [0.0, PI]. Unit: Radians.]]
106 tilt_x, [[Current tilt along the X axis of the tablet's current logical
107 orientation, in radians off the tablet's Z axis.
108 Range: [-PI, PI]. Unit: Radians.]]
109 tilt_y, [[Current tilt along the Y axis of the tablet's current logical
110 orientation, in radians off the tablet's Z axis.
111 Range: [-PI, PI]. Unit: Radians.]]
112 twist, [[Rotation of tool about its major axis from its "natural"
113 position. Range: [-PI, PI] Unit: Radians.]]
114 wheel_delta, [[Delta movement of the wheel in discrete steps (int).
115 Default: 0.]]
116 wheel_angle, [[Delta movement of the wheel in radians. Default: 0.]]
117 wheel_direction, [[Direction of the wheel (horizontal = 1 or vertical = 0).
118 Default: 0. Prefer the property $wheel_direction to read.]]
119 slider, [[Current position of the slider on the tool. Range: [-1, 1].
120 Default: 0.]]
121}
diff --git a/src/lib/evas/canvas/efl_event_pointer.c b/src/lib/evas/canvas/efl_event_pointer.c
index 69881dd..019eb83 100644
--- a/src/lib/evas/canvas/efl_event_pointer.c
+++ b/src/lib/evas/canvas/efl_event_pointer.c
@@ -190,20 +190,6 @@ _efl_event_pointer_position_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd,
190} 190}
191 191
192EOLIAN static void 192EOLIAN static void
193_efl_event_pointer_position_precise_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double x, double y)
194{
195 pd->cur.x = x;
196 pd->cur.y = y;
197}
198
199EOLIAN static void
200_efl_event_pointer_position_precise_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double *x, double *y)
201{
202 if (x) *x = pd->cur.x;
203 if (y) *y = pd->cur.y;
204}
205
206EOLIAN static void
207_efl_event_pointer_previous_position_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int x, int y) 193_efl_event_pointer_previous_position_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int x, int y)
208{ 194{
209 pd->prev.x = (double) x; 195 pd->prev.x = (double) x;
@@ -218,17 +204,11 @@ _efl_event_pointer_previous_position_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_
218} 204}
219 205
220EOLIAN static void 206EOLIAN static void
221_efl_event_pointer_previous_position_precise_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double x, double y) 207_efl_event_pointer_delta_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int *dx, int *dy)
222{
223 pd->prev.x = x;
224 pd->prev.y = y;
225}
226
227EOLIAN static void
228_efl_event_pointer_previous_position_precise_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double *x, double *y)
229{ 208{
230 if (x) *x = pd->prev.x; 209 // Using (int) twice to return the same as previous_position - position
231 if (y) *y = pd->prev.y; 210 if (dx) *dx = (int) pd->prev.x - (int) pd->cur.x;
211 if (dy) *dy = (int) pd->prev.y - (int) pd->cur.y;
232} 212}
233 213
234EOLIAN static void 214EOLIAN static void
@@ -306,47 +286,27 @@ _efl_event_pointer_wheel_direction_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Da
306} 286}
307 287
308EOLIAN static void 288EOLIAN static void
309_efl_event_pointer_wheel_distance_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int dist) 289_efl_event_pointer_wheel_delta_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int dist)
310{ 290{
311 pd->wheel.z = dist; 291 pd->wheel.z = dist;
312} 292}
313 293
314EOLIAN static int 294EOLIAN static int
315_efl_event_pointer_wheel_distance_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd) 295_efl_event_pointer_wheel_delta_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
316{ 296{
317 return pd->wheel.z; 297 return pd->wheel.z;
318} 298}
319 299
320EOLIAN static int 300EOLIAN static int
321_efl_event_pointer_finger_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd) 301_efl_event_pointer_tool_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd)
322{
323 return pd->finger;
324}
325
326EOLIAN static void
327_efl_event_pointer_finger_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int id)
328{ 302{
329 pd->finger = id; 303 return pd->tool;
330} 304}
331 305
332EOLIAN static void 306EOLIAN static void
333_efl_event_pointer_touch_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double *r, double *rx, double *ry, double *press, double *angle) 307_efl_event_pointer_tool_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, int id)
334{ 308{
335 if (r) *r = pd->radius; 309 pd->tool = id;
336 if (rx) *rx = pd->radius_x;
337 if (ry) *ry = pd->radius_y;
338 if (press) *press = pd->pressure;
339 if (angle) *angle = pd->angle;
340}
341
342EOLIAN static void
343_efl_event_pointer_touch_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, double r, double rx, double ry, double press, double angle)
344{
345 pd->radius = r;
346 pd->radius_x = rx;
347 pd->radius_y = ry;
348 pd->pressure = press;
349 pd->angle = angle;
350} 310}
351 311
352EOLIAN static Eina_Bool 312EOLIAN static Eina_Bool
@@ -400,4 +360,196 @@ _efl_event_pointer_efl_event_input_fake_get(Eo *obj EINA_UNUSED, Efl_Event_Point
400 return pd->fake; 360 return pd->fake;
401} 361}
402 362
363EOLIAN static Eina_Bool
364_efl_event_pointer_value_has_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Input_Value key)
365{
366 // read-only
367 if ((key <= EFL_INPUT_VALUE_NONE) || (key > EFL_INPUT_VALUE_SLIDER))
368 return EINA_FALSE;
369 return (pd->value_flags & (1 << (int) key)) != 0;
370}
371
372EOLIAN static Eina_Bool
373_efl_event_pointer_value_set(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Input_Value key, double val)
374{
375 if ((key <= EFL_INPUT_VALUE_NONE) || (key > EFL_INPUT_VALUE_SLIDER))
376 return EINA_FALSE;
377
378 // note: not a fan of setting ints based on a double...
379 switch (key)
380 {
381 case EFL_INPUT_VALUE_TIMESTAMP:
382 pd->timestamp = (unsigned int) (val * 1000.0);
383 break;
384
385 case EFL_INPUT_VALUE_BUTTON:
386 pd->button = (int) val;
387 break;
388
389 case EFL_INPUT_VALUE_BUTTONS_PRESSED:
390 pd->pressed_buttons = (int) val;
391 break;
392
393 case EFL_INPUT_VALUE_TOOL:
394 pd->tool = (int) val;
395 break;
396
397 case EFL_INPUT_VALUE_X:
398 pd->cur.x = val;
399 break;
400
401 case EFL_INPUT_VALUE_Y:
402 pd->cur.y = val;
403 break;
404
405 case EFL_INPUT_VALUE_DX:
406 case EFL_INPUT_VALUE_DY:
407 return EINA_FALSE;
408
409 case EFL_INPUT_VALUE_PREVIOUS_X:
410 pd->prev.x = val;
411 break;
412
413 case EFL_INPUT_VALUE_PREVIOUS_Y:
414 pd->prev.y = val;
415 break;
416
417 case EFL_INPUT_VALUE_RADIUS:
418 pd->radius = val;
419 break;
420
421 case EFL_INPUT_VALUE_RADIUS_X:
422 pd->radius_x = val;
423 break;
424
425 case EFL_INPUT_VALUE_RADIUS_Y:
426 pd->radius_y = val;
427 break;
428
429 case EFL_INPUT_VALUE_PRESSURE:
430 return pd->pressure;
431
432 case EFL_INPUT_VALUE_DISTANCE:
433 return EINA_FALSE; // TODO
434
435 case EFL_INPUT_VALUE_AZIMUTH:
436 return EINA_FALSE; // TODO
437
438 case EFL_INPUT_VALUE_TILT:
439 return EINA_FALSE; // TODO
440
441 case EFL_INPUT_VALUE_TILT_X:
442 return EINA_FALSE; // TODO
443
444 case EFL_INPUT_VALUE_TILT_Y:
445 return EINA_FALSE; // TODO
446
447 case EFL_INPUT_VALUE_TWIST:
448 return EINA_FALSE; // TODO
449
450 case EFL_INPUT_VALUE_WHEEL_DELTA:
451 pd->wheel.z = (int) val;
452 break;
453
454 case EFL_INPUT_VALUE_WHEEL_ANGLE:
455 return EINA_FALSE; // TODO
456
457 case EFL_INPUT_VALUE_WHEEL_DIRECTION:
458 pd->wheel.dir = val ? EFL_ORIENT_HORIZONTAL : EFL_ORIENT_VERTICAL;
459 break;
460
461 case EFL_INPUT_VALUE_SLIDER:
462 return EINA_FALSE; // TODO
463
464 case EFL_INPUT_VALUE_NONE:
465 default:
466 return EINA_FALSE;
467 }
468
469 return EINA_TRUE;
470}
471
472EOLIAN static double
473_efl_event_pointer_value_get(Eo *obj EINA_UNUSED, Efl_Event_Pointer_Data *pd, Efl_Input_Value key)
474{
475 switch (key)
476 {
477 case EFL_INPUT_VALUE_TIMESTAMP:
478 return (double) pd->timestamp / 1000.0;
479
480 case EFL_INPUT_VALUE_BUTTON:
481 return (double) pd->button;
482
483 case EFL_INPUT_VALUE_BUTTONS_PRESSED:
484 return (double) pd->pressed_buttons;
485
486 case EFL_INPUT_VALUE_TOOL:
487 return (double) pd->tool;
488
489 case EFL_INPUT_VALUE_X:
490 return pd->cur.x;
491
492 case EFL_INPUT_VALUE_Y:
493 return pd->cur.y;
494
495 case EFL_INPUT_VALUE_DX:
496 return pd->cur.x - pd->prev.x;
497
498 case EFL_INPUT_VALUE_DY:
499 return pd->cur.y - pd->prev.y;
500
501 case EFL_INPUT_VALUE_PREVIOUS_X:
502 return pd->prev.x;
503
504 case EFL_INPUT_VALUE_PREVIOUS_Y:
505 return pd->prev.y;
506
507 case EFL_INPUT_VALUE_RADIUS:
508 return pd->radius;
509
510 case EFL_INPUT_VALUE_RADIUS_X:
511 return pd->radius_x;
512
513 case EFL_INPUT_VALUE_RADIUS_Y:
514 return pd->radius_y;
515
516 case EFL_INPUT_VALUE_PRESSURE:
517 return pd->pressure;
518
519 case EFL_INPUT_VALUE_DISTANCE:
520 return 0.0; // TODO
521
522 case EFL_INPUT_VALUE_AZIMUTH:
523 return 0.0; // TODO
524
525 case EFL_INPUT_VALUE_TILT:
526 return 0.0; // TODO
527
528 case EFL_INPUT_VALUE_TILT_X:
529 return 0.0; // TODO
530
531 case EFL_INPUT_VALUE_TILT_Y:
532 return 0.0; // TODO
533
534 case EFL_INPUT_VALUE_TWIST:
535 return 0.0; // TODO
536
537 case EFL_INPUT_VALUE_WHEEL_DELTA:
538 return (double) pd->wheel.z;
539
540 case EFL_INPUT_VALUE_WHEEL_ANGLE:
541 return 0.0; // TODO (emulate??)
542
543 case EFL_INPUT_VALUE_WHEEL_DIRECTION:
544 return (pd->wheel.dir == EFL_ORIENT_HORIZONTAL) ? 1.0 : 0.0;
545
546 case EFL_INPUT_VALUE_SLIDER:
547 return 0.0; // TODO
548
549 case EFL_INPUT_VALUE_NONE:
550 default:
551 return 0;
552 }
553}
554
403#include "efl_event_pointer.eo.c" 555#include "efl_event_pointer.eo.c"
diff --git a/src/lib/evas/canvas/efl_event_pointer.eo b/src/lib/evas/canvas/efl_event_pointer.eo
index e73866a..2722d1c 100644
--- a/src/lib/evas/canvas/efl_event_pointer.eo
+++ b/src/lib/evas/canvas/efl_event_pointer.eo
@@ -3,7 +3,7 @@ import efl_event_types;
3 3
4class Efl.Event.Pointer (Efl.Object, Efl.Event, Efl.Input.State, Efl.Event.Input) 4class Efl.Event.Pointer (Efl.Object, Efl.Event, Efl.Input.State, Efl.Event.Input)
5{ 5{
6 [[Event data carried over with any pointer event (mouse, touch, ...) 6 [[Event data carried over with any pointer event (mouse, touch, pen, ...)
7 7
8 @since 1.18 8 @since 1.18
9 ]] 9 ]]
@@ -14,14 +14,52 @@ class Efl.Event.Pointer (Efl.Object, Efl.Event, Efl.Input.State, Efl.Event.Input
14 act: Efl.Pointer.Action; 14 act: Efl.Pointer.Action;
15 } 15 }
16 } 16 }
17 @property value_has {
18 [[$true if this event carries a valid value for the specified $key.]]
19 get {}
20 keys {
21 key: Efl.Input.Value;
22 }
23 values {
24 has: bool;
25 }
26 }
27 @property value {
28 [[Represents a generic value for this event.
29
30 Refer to the documentation of @Efl.Input.Value for each value's
31 meaning, type and range. Call @.value_has.get to determine whether
32 the returned value is valid or not for this event.
33
34 Most values are precise floating point values, usually in pixels,
35 radians, or in a range of [-1, 1] or [0, 1]. Some values are
36 discrete values (integers) and thus should preferably be queried
37 with the other methods of this class.
38 ]]
39 set {
40 return: bool; [[$false if the value could not be set (eg. delta).]]
41 }
42 get {}
43 keys {
44 key: Efl.Input.Value;
45 }
46 values {
47 val: double;
48 }
49 }
17 @property button { 50 @property button {
18 [[The mouse button that triggered the event.]] 51 [[The mouse button that triggered the event.
52
53 Valid if and only if @.value_has($button) is $true.
54 ]]
19 values { 55 values {
20 but: int; [[1 to 32, 0 if not a button event.]] 56 but: int; [[1 to 32, 0 if not a button event.]]
21 } 57 }
22 } 58 }
23 @property button_pressed { 59 @property button_pressed {
24 [[Whether a mouse button is pressed at the moment of the event.]] 60 [[Whether a mouse button is pressed at the moment of the event.
61
62 Valid if and only if @.value_has($button_pressed) is $true.]]
25 keys { 63 keys {
26 button: int; 64 button: int;
27 } 65 }
@@ -30,59 +68,53 @@ class Efl.Event.Pointer (Efl.Object, Efl.Event, Efl.Input.State, Efl.Event.Input
30 } 68 }
31 } 69 }
32 @property position { 70 @property position {
33 [[Position where the event happened, relative to the window.]] 71 [[Position where the event happened, relative to the window.
34 values {
35 x: int;
36 y: int;
37 }
38 }
39 @property position_precise {
40 [[Position where the event happened, with subpixel precision
41 72
42 Note: Same value as @.position, relative to the window. 73 This position, in integers, is an approximation of
74 @.value.get($x), @.value.get($y). Use @.position if you need
75 simple pixel positions, but prefer the generic interface
76 if you need precise coordinates.
43 ]] 77 ]]
44 values { 78 values {
45 x: double; 79 x: int;
46 y: double; 80 y: int;
47 } 81 }
48 } 82 }
49 @property previous_position { 83 @property previous_position {
50 [[Position of the previous event, valid for move events. 84 [[Position of the previous event, valid for move events.
51 85
52 Relative to the window. May be equal to @.position. 86 Relative to the window. May be equal to @.position (by default).
87
88 This position, in integers, is an approximation of
89 @.value.get($previous_x), @.value.get($previous_y).
90 Use @.previous_position if you need simple pixel positions,
91 but prefer the generic interface if you need precise coordinates.
53 ]] 92 ]]
54 values { 93 values {
55 x: int; 94 x: int;
56 y: int; 95 y: int;
57 } 96 }
58 } 97 }
59 @property previous_position_precise { 98 @property delta {
60 [[Position of the previous event, with subpixel precision. 99 [[Position delta, or movement, since the last event.
61 100
62 Valid for move events, may not be valid for other events. 101 This position, in integers, is an approximation of
63 Relative to the window. May be equal to @.position_precise. 102 @.value.get($dx), @.value.get($dy). Use @.delta if you need
103 simple pixel positions, but prefer the generic interface
104 if you need precise coordinates.
64 ]] 105 ]]
106 get {}
65 values { 107 values {
66 x: double; 108 dx: int;
67 y: double; 109 dy: int;
68 } 110 }
69 } 111 }
70 @property finger { 112 @property tool {
71 [[Finger ID in case of a multi touch event.]] 113 [[ID of the tool (eg. pen) that triggered this event.]]
72 values { 114 values {
73 id: int; 115 id: int;
74 } 116 }
75 } 117 }
76 @property touch {
77 [[Touch information about a specific finger or pointer.]]
78 values {
79 radius: double;
80 rad_x: double;
81 rad_y: double;
82 pressure: double;
83 angle: double;
84 }
85 }
86 @property source { 118 @property source {
87 [[The object where this event first originated, in case of 119 [[The object where this event first originated, in case of
88 propagation or repetition of the event. 120 propagation or repetition of the event.
@@ -116,11 +148,13 @@ class Efl.Event.Pointer (Efl.Object, Efl.Event, Efl.Input.State, Efl.Event.Input
116 } 148 }
117 } 149 }
118 @property wheel_direction { 150 @property wheel_direction {
151 [[Direction of the wheel.]]
119 values { 152 values {
120 dir: Efl.Orient; [[Horizontal or Vertical only.]] 153 dir: Efl.Orient; [[Horizontal or Vertical only.]]
121 } 154 }
122 } 155 }
123 @property wheel_distance { 156 @property wheel_delta {
157 [[Delta movement of the wheel in discrete steps.]]
124 values { 158 values {
125 dist: int; 159 dist: int;
126 } 160 }
diff --git a/src/lib/evas/canvas/evas_events.c b/src/lib/evas/canvas/evas_events.c
index 83539fa..f1b019f 100644
--- a/src/lib/evas/canvas/evas_events.c
+++ b/src/lib/evas/canvas/evas_events.c
@@ -395,7 +395,7 @@ _evas_event_source_mouse_down_events(Evas_Object *eo_obj, Evas *eo_e,
395 _transform_to_src_space_f(obj, src, &ev->cur); 395 _transform_to_src_space_f(obj, src, &ev->cur);
396 point = ev->cur; 396 point = ev->cur;
397 ev->source = eo_obj; 397 ev->source = eo_obj;
398 ev->finger = 0; 398 ev->tool = 0;
399 399
400 EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, src->proxy, Evas_Object_Proxy_Data, proxy_write) 400 EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, src->proxy, Evas_Object_Proxy_Data, proxy_write)
401 { 401 {
@@ -480,7 +480,7 @@ _evas_event_source_mouse_move_events(Evas_Object *eo_obj, Evas *eo_e,
480 curpt = ev->cur; 480 curpt = ev->cur;
481 prevpt = ev->prev; 481 prevpt = ev->prev;
482 ev->source = eo_obj; 482 ev->source = eo_obj;
483 ev->finger = 0; 483 ev->tool = 0;
484 484
485 if (e->pointer.mouse_grabbed) 485 if (e->pointer.mouse_grabbed)
486 { 486 {
@@ -650,7 +650,7 @@ _evas_event_source_mouse_up_events(Evas_Object *eo_obj, Evas *eo_e,
650 _transform_to_src_space_f(obj, src, &ev->cur); 650 _transform_to_src_space_f(obj, src, &ev->cur);
651 point = ev->cur; 651 point = ev->cur;
652 ev->source = eo_obj; 652 ev->source = eo_obj;
653 ev->finger = 0; 653 ev->tool = 0;
654 654
655 copy = evas_event_list_copy(src->proxy->src_event_in); 655 copy = evas_event_list_copy(src->proxy->src_event_in);
656 EINA_LIST_FOREACH(copy, l, eo_child) 656 EINA_LIST_FOREACH(copy, l, eo_child)
@@ -1242,7 +1242,7 @@ _canvas_event_feed_mouse_down_internal(Evas_Public_Data *e, Efl_Event_Pointer_Da
1242 ev->modifiers = &(e->modifiers); 1242 ev->modifiers = &(e->modifiers);
1243 ev->locks = &(e->locks); 1243 ev->locks = &(e->locks);
1244 ev->event_flags = e->default_event_flags; 1244 ev->event_flags = e->default_event_flags;
1245 ev->finger = 0; 1245 ev->tool = 0;
1246 if (ev->device) efl_ref(ev->device); 1246 if (ev->device) efl_ref(ev->device);
1247 1247
1248 _evas_walk(e); 1248 _evas_walk(e);
@@ -1440,7 +1440,7 @@ _canvas_event_feed_mouse_up_internal(Evas_Public_Data *e, Efl_Event_Pointer_Data
1440 ev->modifiers = &(e->modifiers); 1440 ev->modifiers = &(e->modifiers);
1441 ev->locks = &(e->locks); 1441 ev->locks = &(e->locks);
1442 ev->event_flags = e->default_event_flags; 1442 ev->event_flags = e->default_event_flags;
1443 ev->finger = 0; 1443 ev->tool = 0;
1444 if (ev->device) efl_ref(ev->device); 1444 if (ev->device) efl_ref(ev->device);
1445 1445
1446 _evas_walk(e); 1446 _evas_walk(e);
@@ -1721,7 +1721,7 @@ _canvas_event_feed_mouse_move_internal(Evas_Public_Data *e, Efl_Event_Pointer_Da
1721 ev->locks = &(e->locks); 1721 ev->locks = &(e->locks);
1722 ev->event_flags = e->default_event_flags; 1722 ev->event_flags = e->default_event_flags;
1723 ev->pressed_buttons = e->pointer.button; 1723 ev->pressed_buttons = e->pointer.button;
1724 ev->finger = 0; 1724 ev->tool = 0;
1725 if (ev->device) efl_ref(ev->device); 1725 if (ev->device) efl_ref(ev->device);
1726 1726
1727 _evas_walk(e); 1727 _evas_walk(e);
@@ -2236,7 +2236,7 @@ _canvas_event_feed_multi_down_internal(Evas_Public_Data *e, Efl_Event_Pointer_Da
2236 2236
2237 eo_e = e->evas; 2237 eo_e = e->evas;
2238 DBG("ButtonEvent:multi down time=%u x=%.1f y=%.1f button=%d downs=%d", 2238 DBG("ButtonEvent:multi down time=%u x=%.1f y=%.1f button=%d downs=%d",
2239 ev->timestamp, ev->cur.x, ev->cur.y, ev->finger, e->pointer.downs); 2239 ev->timestamp, ev->cur.x, ev->cur.y, ev->tool, e->pointer.downs);
2240 e->pointer.downs++; 2240 e->pointer.downs++;
2241 if (e->is_frozen) return; 2241 if (e->is_frozen) return;
2242 e->last_timestamp = ev->timestamp; 2242 e->last_timestamp = ev->timestamp;
@@ -2252,7 +2252,7 @@ _canvas_event_feed_multi_down_internal(Evas_Public_Data *e, Efl_Event_Pointer_Da
2252 2252
2253 _evas_walk(e); 2253 _evas_walk(e);
2254 /* append new touch point to the touch point list */ 2254 /* append new touch point to the touch point list */
2255 _evas_touch_point_append(eo_e, ev->finger, ev->cur.x, ev->cur.y); 2255 _evas_touch_point_append(eo_e, ev->tool, ev->cur.x, ev->cur.y);
2256 if (e->pointer.mouse_grabbed == 0) 2256 if (e->pointer.mouse_grabbed == 0)
2257 { 2257 {
2258 if (e->pointer.downs > 1) addgrab = e->pointer.downs - 1; 2258 if (e->pointer.downs > 1) addgrab = e->pointer.downs - 1;
@@ -2282,7 +2282,7 @@ _canvas_event_feed_multi_down_internal(Evas_Public_Data *e, Efl_Event_Pointer_Da
2282 2282
2283 _evas_post_event_callback_call(eo_e, e); 2283 _evas_post_event_callback_call(eo_e, e);
2284 /* update touch point's state to EVAS_TOUCH_POINT_STILL */ 2284 /* update touch point's state to EVAS_TOUCH_POINT_STILL */
2285 _evas_touch_point_update(eo_e, ev->finger, ev->cur.x, ev->cur.y, EVAS_TOUCH_POINT_STILL); 2285 _evas_touch_point_update(eo_e, ev->tool, ev->cur.x, ev->cur.y, EVAS_TOUCH_POINT_STILL);
2286 _evas_unwalk(e); 2286 _evas_unwalk(e);
2287 2287
2288 if (ev->device) efl_unref(ev->device); 2288 if (ev->device) efl_unref(ev->device);
@@ -2301,7 +2301,7 @@ _canvas_event_feed_multi_up_internal(Evas_Public_Data *e, Efl_Event_Pointer_Data
2301 2301
2302 eo_e = e->evas; 2302 eo_e = e->evas;
2303 DBG("ButtonEvent:multi up time=%u x=%.1f y=%.1f device=%d downs=%d", 2303 DBG("ButtonEvent:multi up time=%u x=%.1f y=%.1f device=%d downs=%d",
2304 ev->timestamp, ev->cur.x, ev->cur.y, ev->finger, e->pointer.downs); 2304 ev->timestamp, ev->cur.x, ev->cur.y, ev->tool, e->pointer.downs);
2305 if (e->pointer.downs <= 0) return; 2305 if (e->pointer.downs <= 0) return;
2306 e->pointer.downs--; 2306 e->pointer.downs--;
2307 if (e->is_frozen) return; 2307 if (e->is_frozen) return;
@@ -2318,7 +2318,7 @@ _canvas_event_feed_multi_up_internal(Evas_Public_Data *e, Efl_Event_Pointer_Data
2318 2318
2319 _evas_walk(e); 2319 _evas_walk(e);
2320 /* update released touch point */ 2320 /* update released touch point */
2321 _evas_touch_point_update(eo_e, ev->finger, ev->cur.x, ev->cur.y, EVAS_TOUCH_POINT_UP); 2321 _evas_touch_point_update(eo_e, ev->tool, ev->cur.x, ev->cur.y, EVAS_TOUCH_POINT_UP);
2322 copy = evas_event_list_copy(e->pointer.object.in); 2322 copy = evas_event_list_copy(e->pointer.object.in);
2323 EINA_LIST_FOREACH(copy, l, eo_obj) 2323 EINA_LIST_FOREACH(copy, l, eo_obj)
2324 { 2324 {
@@ -2342,7 +2342,7 @@ _canvas_event_feed_multi_up_internal(Evas_Public_Data *e, Efl_Event_Pointer_Data
2342 if ((e->pointer.mouse_grabbed == 0) && !_post_up_handle(e, ev->eo)) 2342 if ((e->pointer.mouse_grabbed == 0) && !_post_up_handle(e, ev->eo))
2343 _evas_post_event_callback_call(eo_e, e); 2343 _evas_post_event_callback_call(eo_e, e);
2344 /* remove released touch point from the touch point list */ 2344 /* remove released touch point from the touch point list */
2345 _evas_touch_point_remove(eo_e, ev->finger); 2345 _evas_touch_point_remove(eo_e, ev->tool);
2346 _evas_unwalk(e); 2346 _evas_unwalk(e);
2347 2347
2348 if (ev->device) efl_unref(ev->device); 2348 if (ev->device) efl_unref(ev->device);
@@ -2368,7 +2368,7 @@ _canvas_event_feed_multi_internal(Evas *eo_e, Evas_Public_Data *e,
2368 if (!fy) fy = y; 2368 if (!fy) fy = y;
2369 2369
2370 ev->action = action; 2370 ev->action = action;
2371 ev->finger = d; 2371 ev->tool = d;
2372 ev->cur.x = fx; 2372 ev->cur.x = fx;
2373 ev->cur.y = fy; 2373 ev->cur.y = fy;
2374 ev->pressure = pres; 2374 ev->pressure = pres;
@@ -2468,7 +2468,7 @@ _canvas_event_feed_multi_move_internal(Evas_Public_Data *e, Efl_Event_Pointer_Da
2468 2468
2469 _evas_walk(e); 2469 _evas_walk(e);
2470 /* update moved touch point */ 2470 /* update moved touch point */
2471 _evas_touch_point_update(eo_e, ev->finger, ev->cur.x, ev->cur.y, EVAS_TOUCH_POINT_MOVE); 2471 _evas_touch_point_update(eo_e, ev->tool, ev->cur.x, ev->cur.y, EVAS_TOUCH_POINT_MOVE);
2472 /* if our mouse button is grabbed to any objects */ 2472 /* if our mouse button is grabbed to any objects */
2473 if (e->pointer.mouse_grabbed > 0) 2473 if (e->pointer.mouse_grabbed > 0)
2474 { 2474 {
@@ -3179,21 +3179,21 @@ _evas_canvas_event_pointer_cb(void *data, const Eo_Event *event)
3179 switch (ev->action) 3179 switch (ev->action)
3180 { 3180 {
3181 case EFL_POINTER_ACTION_MOVE: 3181 case EFL_POINTER_ACTION_MOVE:
3182 if (ev->finger == 0) 3182 if (ev->tool == 0)
3183 _canvas_event_feed_mouse_move_internal(e, ev); 3183 _canvas_event_feed_mouse_move_internal(e, ev);
3184 else 3184 else
3185 _canvas_event_feed_multi_move_internal(e, ev); 3185 _canvas_event_feed_multi_move_internal(e, ev);
3186 break; 3186 break;
3187 3187
3188 case EFL_POINTER_ACTION_DOWN: 3188 case EFL_POINTER_ACTION_DOWN:
3189 if (ev->finger == 0) 3189 if (ev->tool == 0)
3190 _canvas_event_feed_mouse_down_internal(e, ev); 3190 _canvas_event_feed_mouse_down_internal(e, ev);
3191 else 3191 else
3192 _canvas_event_feed_multi_down_internal(e, ev); 3192 _canvas_event_feed_multi_down_internal(e, ev);
3193 break; 3193 break;
3194 3194
3195 case EFL_POINTER_ACTION_UP: 3195 case EFL_POINTER_ACTION_UP:
3196 if (ev->finger == 0) 3196 if (ev->tool == 0)
3197 _canvas_event_feed_mouse_up_internal(e, ev); 3197 _canvas_event_feed_mouse_up_internal(e, ev);
3198 else 3198 else
3199 _canvas_event_feed_multi_up_internal(e, ev); 3199 _canvas_event_feed_multi_up_internal(e, ev);
diff --git a/src/lib/evas/canvas/evas_events_legacy.c b/src/lib/evas/canvas/evas_events_legacy.c
index a025530..92d2558 100644
--- a/src/lib/evas/canvas/evas_events_legacy.c
+++ b/src/lib/evas/canvas/evas_events_legacy.c
@@ -82,7 +82,7 @@ efl_event_pointer_legacy_info_fill(Efl_Event_Key *evt, Evas_Callback_Type type,
82 } 82 }
83 83
84 case EFL_POINTER_ACTION_DOWN: 84 case EFL_POINTER_ACTION_DOWN:
85 if (ev->finger == 0) 85 if (ev->tool == 0)
86 { 86 {
87 // filter out MULTI with finger 0, valid for eo, invalid for legacy 87 // filter out MULTI with finger 0, valid for eo, invalid for legacy
88 if (type == EVAS_CALLBACK_MULTI_DOWN) 88 if (type == EVAS_CALLBACK_MULTI_DOWN)
@@ -109,7 +109,7 @@ efl_event_pointer_legacy_info_fill(Efl_Event_Key *evt, Evas_Callback_Type type,
109 { 109 {
110 TYPE_CHK(MULTI_DOWN); 110 TYPE_CHK(MULTI_DOWN);
111 Evas_Event_Multi_Down *e = _event_alloc(ev->legacy); 111 Evas_Event_Multi_Down *e = _event_alloc(ev->legacy);
112 e->device = ev->finger; 112 e->device = ev->tool;
113 e->radius = ev->radius; 113 e->radius = ev->radius;
114 e->radius_x = ev->radius_x; 114 e->radius_x = ev->radius_x;
115 e->radius_y = ev->radius_y; 115 e->radius_y = ev->radius_y;
@@ -133,7 +133,7 @@ efl_event_pointer_legacy_info_fill(Efl_Event_Key *evt, Evas_Callback_Type type,
133 } 133 }
134 134
135 case EFL_POINTER_ACTION_UP: 135 case EFL_POINTER_ACTION_UP:
136 if (ev->finger == 0) 136 if (ev->tool == 0)
137 { 137 {
138 // filter out MULTI with finger 0, valid for eo, invalid for legacy 138 // filter out MULTI with finger 0, valid for eo, invalid for legacy
139 if (type == EVAS_CALLBACK_MULTI_UP) 139 if (type == EVAS_CALLBACK_MULTI_UP)
@@ -160,7 +160,7 @@ efl_event_pointer_legacy_info_fill(Efl_Event_Key *evt, Evas_Callback_Type type,
160 { 160 {
161 TYPE_CHK(MULTI_UP); 161 TYPE_CHK(MULTI_UP);
162 Evas_Event_Multi_Up *e = _event_alloc(ev->legacy); 162 Evas_Event_Multi_Up *e = _event_alloc(ev->legacy);
163 e->device = ev->finger; 163 e->device = ev->tool;
164 e->radius = ev->radius; 164 e->radius = ev->radius;
165 e->radius_x = ev->radius_x; 165 e->radius_x = ev->radius_x;
166 e->radius_y = ev->radius_y; 166 e->radius_y = ev->radius_y;
@@ -184,7 +184,7 @@ efl_event_pointer_legacy_info_fill(Efl_Event_Key *evt, Evas_Callback_Type type,
184 } 184 }
185 185
186 case EFL_POINTER_ACTION_MOVE: 186 case EFL_POINTER_ACTION_MOVE:
187 if (ev->finger == 0) 187 if (ev->tool == 0)
188 { 188 {
189 // filter out MULTI with finger 0, valid for eo, invalid for legacy 189 // filter out MULTI with finger 0, valid for eo, invalid for legacy
190 if (type == EVAS_CALLBACK_MULTI_MOVE) 190 if (type == EVAS_CALLBACK_MULTI_MOVE)
@@ -213,7 +213,7 @@ efl_event_pointer_legacy_info_fill(Efl_Event_Key *evt, Evas_Callback_Type type,
213 { 213 {
214 TYPE_CHK(MULTI_MOVE); 214 TYPE_CHK(MULTI_MOVE);
215 Evas_Event_Multi_Move *e = _event_alloc(ev->legacy); 215 Evas_Event_Multi_Move *e = _event_alloc(ev->legacy);
216 e->device = ev->finger; 216 e->device = ev->tool;
217 e->radius = ev->radius; 217 e->radius = ev->radius;
218 e->radius_x = ev->radius_x; 218 e->radius_x = ev->radius_x;
219 e->radius_y = ev->radius_y; 219 e->radius_y = ev->radius_y;