diff --git a/src/lib/eo/eina_types.eot b/src/lib/eo/eina_types.eot index f340ef3b0a..d483fe8eea 100644 --- a/src/lib/eo/eina_types.eot +++ b/src/lib/eo/eina_types.eot @@ -21,6 +21,12 @@ struct @extern Eina.Size2D { struct @extern Eina.File; [[Eina file data structure]] +struct @extern Eina.Vector2 { + [[A simple 2D vector type using floating point values.]] + x: double; [[X coordinate.]] + y: double; [[Y coordinate.]] +} + struct @extern Eina.Matrix3 { [[Eina 3x3 Matrix]] xx: double; [[XX matrix value]] diff --git a/src/lib/evas/canvas/efl_input_pointer.c b/src/lib/evas/canvas/efl_input_pointer.c index 2d30ddb910..6e95a11bc0 100644 --- a/src/lib/evas/canvas/efl_input_pointer.c +++ b/src/lib/evas/canvas/efl_input_pointer.c @@ -223,6 +223,20 @@ _efl_input_pointer_position_get(Eo *obj EINA_UNUSED, Efl_Input_Pointer_Data *pd) return EINA_POSITION2D((int) pd->cur.x, (int) pd->cur.y); } +EOLIAN static void +_efl_input_pointer_precise_position_set(Eo *obj EINA_UNUSED, Efl_Input_Pointer_Data *pd, Eina_Vector2 pos) +{ + _efl_input_value_mark(pd, EFL_INPUT_VALUE_X); + _efl_input_value_mark(pd, EFL_INPUT_VALUE_Y); + pd->cur = pos; +} + +EOLIAN static Eina_Vector2 +_efl_input_pointer_precise_position_get(Eo *obj EINA_UNUSED, Efl_Input_Pointer_Data *pd) +{ + return pd->cur; +} + EOLIAN static void _efl_input_pointer_previous_position_set(Eo *obj EINA_UNUSED, Efl_Input_Pointer_Data *pd, Eina_Position2D pos) { diff --git a/src/lib/evas/canvas/efl_input_pointer.eo b/src/lib/evas/canvas/efl_input_pointer.eo index dd8ccd210d..1519e93243 100644 --- a/src/lib/evas/canvas/efl_input_pointer.eo +++ b/src/lib/evas/canvas/efl_input_pointer.eo @@ -70,15 +70,27 @@ class Efl.Input.Pointer (Efl.Object, Efl.Input.Event, Efl.Input.State) @property position { [[Position where the event happened, relative to the window. - This position, in integers, is an approximation of - @.value.get($x), @.value.get($y). Use @.position if you need - simple pixel positions, but prefer the generic interface - if you need precise coordinates. + See @.precise_position for floating point precision (subpixel + location). ]] values { pos: Eina.Position2D; [[The position of the event, in pixels.]] } } + @property precise_position { + [[Position where the event happened, relative to the window. + + This position is in floating point values, for more precise + coordinates, in subpixels. Note that many input devices are unable + to give better precision than a single pixel, so this may be + equal to @.position. + + See also @.position. + ]] + values { + pos: Eina.Vector2; [[The position of the event, in pixels.]] + } + } @property previous_position { [[Position of the previous event, valid for move events.