evas events: Add "raw" x,y values for future extensions
authorJean-Philippe Andre <jp.andre@samsung.com>
Thu, 1 Sep 2016 09:34:10 +0000 (18:34 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Tue, 6 Sep 2016 07:54:53 +0000 (16:54 +0900)
For pen tablets, this exposes the values as given by the driver
(quite useless without knowledge of the device itself).

For mice, this exposes x,y as set by the display manager, without
any extra processing in terms of smoothing or prediction. IOW
this returns the same as x,y until a smoothing algorithm is
implemented (todo).

src/lib/efl/interfaces/efl_common_internal.h
src/lib/efl/interfaces/efl_input_types.eot
src/lib/evas/canvas/efl_input_pointer.c

index 4af02c1..dd1b29e 100644 (file)
@@ -33,6 +33,10 @@ struct _Efl_Input_Pointer_Data
    double          radius, radius_x, radius_y;
    double          pressure, distance, azimuth, tilt, twist;
    double          angle;
+   /* current, previous positions in window coordinates.
+    * raw can be either un-smoothed, un-predicted x,y or a tablet's raw input.
+    * norm is the normalized value in [0..1] for tablet input.
+    */
    Eina_Vector2    cur, prev, raw, norm;
    struct {
       Efl_Orient   dir;
index fdd9df2..60f0833 100644 (file)
@@ -88,15 +88,25 @@ enum Efl.Input.Value {
    tool,       [[ID of the finger or tool (eg. pen) that triggered this event.
                  Prefer the property $tool to read this value. Default: 0.]]
    x,          [[Absolute X position where this event occurred, in pixels.
-                 Relative to the window. Default: last known position.]]
+                 Relative to the window. Default: last known position.
+                 This value may be smoothed out or even extrapolated by EFL.]]
    y,          [[Absolute Y position where this event occurred, in pixels.
-                 Relative to the window. Default: last known position.]]
+                 Relative to the window. Default: last known position.
+                 This value may be smoothed out or even extrapolated by EFL.]]
    dx,         [[Relative X movement, in pixels. Range: unbounded. Default: 0.]]
    dy,         [[Relative Y movement, in pixels. Range: unbounded. Default: 0.]]
    previous_x, [[Previous X position of the pointer, in pixels.
                  Default: last known position, may be equal to x.]]
    previous_y, [[Previous Y position of the pointer, in pixels.
                  Default: last known position, may be equal to y.]]
+   raw_x,      [[Absolute X position where this event occurred. Default: 0.
+                 This value will be set from the hardware input without any
+                 smoothing or extrapolation. For an axis input event, this is
+                 the raw value set by the driver (undefined range and unit).]]
+   raw_y,      [[Absolute X position where this event occurred. Default: 0.
+                 This value will be set from the hardware input without any
+                 smoothing or extrapolation. For an axis input event, this is
+                 the raw value set by the driver (undefined range and unit).]]
    radius,     [[Average radius of the pressed area under a finger or tool,
                  in pixels. Default is 1.]]
    radius_x,   [[Spread over X of the pressed area under a finger or tool,
index cfbb6a0..2214871 100644 (file)
@@ -525,6 +525,16 @@ _efl_input_pointer_value_get(Eo *obj EINA_UNUSED, Efl_Input_Pointer_Data *pd, Ef
       case EFL_INPUT_VALUE_PREVIOUS_Y:
         return pd->prev.y;
 
+      case EFL_INPUT_VALUE_RAW_X:
+        if (!_efl_input_value_has(pd, EFL_INPUT_VALUE_RAW_X))
+          return pd->cur.x;
+        return pd->raw.x;
+
+      case EFL_INPUT_VALUE_RAW_Y:
+        if (!_efl_input_value_has(pd, EFL_INPUT_VALUE_RAW_Y))
+          return pd->cur.y;
+        return pd->raw.y;
+
       case EFL_INPUT_VALUE_RADIUS:
         return pd->radius;