jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=d4b4ee867be2819eea69ec7b92cd2843ae33c7c7

commit d4b4ee867be2819eea69ec7b92cd2843ae33c7c7
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Wed Aug 9 21:04:10 2017 +0900

    evas: Modify wheel events direction to bool (EO)
    
    The orientation was overkill here. We only want a bool.
    
    Ref T5870
---
 src/examples/evas/evas-multiseat-events.c |  2 +-
 src/lib/ecore_evas/ecore_evas.c           |  2 +-
 src/lib/edje/edje_callbacks.c             |  2 +-
 src/lib/evas/canvas/efl_input_pointer.c   | 24 ++++++++++--------------
 src/lib/evas/canvas/efl_input_pointer.eo  |  6 +++---
 src/lib/evas/canvas/evas_events.c         |  4 ++--
 src/lib/evas/canvas/evas_events_legacy.c  |  2 +-
 7 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/src/examples/evas/evas-multiseat-events.c 
b/src/examples/evas/evas-multiseat-events.c
index 24d76f182c..c0659f06ff 100644
--- a/src/examples/evas/evas-multiseat-events.c
+++ b/src/examples/evas/evas-multiseat-events.c
@@ -159,7 +159,7 @@ _pointer_wheel_cb(void *data EINA_UNUSED, const Efl_Event 
*event)
    seat = efl_input_device_seat_get(efl_input_device_get(ev));
 
    printf("Wheel: '%i,%i' on object %s from seat %s\n",
-          efl_input_pointer_wheel_direction_get(ev),
+          efl_input_pointer_wheel_horizontal_get(ev),
           efl_input_pointer_wheel_delta_get(ev),
           evas_object_name_get(event->object),
           efl_name_get(seat));
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index e4c8001b4a..127b945c7d 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -4778,7 +4778,7 @@ _direct_mouse_wheel_cb(Ecore_Evas *ee, const 
Ecore_Event_Mouse_Wheel *info)
    ev->timestamp = info->timestamp;
    _pointer_position_set(ev, ee, info->x, info->y, info->x, info->y);
    ev->wheel.z = info->z;
-   ev->wheel.dir = info->direction ? EFL_ORIENT_HORIZONTAL : 
EFL_ORIENT_VERTICAL;
+   ev->wheel.horizontal = !!info->direction;
    if (info->dev) ev->device = efl_ref(info->dev);
    else ev->device = efl_ref(evas_default_device_get(e, 
EFL_INPUT_DEVICE_TYPE_MOUSE));
    efl_input_pointer_finalize(evt);
diff --git a/src/lib/edje/edje_callbacks.c b/src/lib/edje/edje_callbacks.c
index 06ed0f81a7..c64df5c4a9 100644
--- a/src/lib/edje/edje_callbacks.c
+++ b/src/lib/edje/edje_callbacks.c
@@ -363,7 +363,7 @@ _edje_mouse_wheel_signal_cb(void *data, const Efl_Event 
*event)
         if (!(ev->event_flags) || !(rp->ignore_flags & ev->event_flags))
           {
              snprintf(buf, sizeof(buf), "mouse,wheel,%i,%i",
-                      ev->wheel.dir == EFL_ORIENT_HORIZONTAL ? 1 : 0,
+                      ev->wheel.horizontal,
                       (ev->wheel.z < 0) ? (-1) : (1));
              _edje_seat_emit(ed, ev->device, buf, rp->part->name);
           }
diff --git a/src/lib/evas/canvas/efl_input_pointer.c 
b/src/lib/evas/canvas/efl_input_pointer.c
index 5b720925f8..d469488938 100644
--- a/src/lib/evas/canvas/efl_input_pointer.c
+++ b/src/lib/evas/canvas/efl_input_pointer.c
@@ -139,7 +139,6 @@ _efl_input_pointer_efl_input_event_reset(Eo *obj, 
Efl_Input_Pointer_Data *pd)
    _efl_input_pointer_free(pd);
    memset(pd, 0, sizeof(*pd));
    pd->eo = obj;
-   pd->wheel.dir = EFL_ORIENT_VERTICAL;
    pd->fake = fake;
 }
 
@@ -312,16 +311,16 @@ _efl_input_pointer_efl_input_event_timestamp_get(Eo *obj 
EINA_UNUSED, Efl_Input_
 }
 
 EOLIAN static void
-_efl_input_pointer_wheel_direction_set(Eo *obj EINA_UNUSED, 
Efl_Input_Pointer_Data *pd, Efl_Orient dir)
+_efl_input_pointer_wheel_horizontal_set(Eo *obj EINA_UNUSED, 
Efl_Input_Pointer_Data *pd, Eina_Bool dir)
 {
-   _efl_input_value_mark(pd, EFL_INPUT_VALUE_WHEEL_DIRECTION);
-   pd->wheel.dir = dir;
+   _efl_input_value_mark(pd, EFL_INPUT_VALUE_WHEEL_HORIZONTAL);
+   pd->wheel.horizontal = !!dir;
 }
 
-EOLIAN static Efl_Orient
-_efl_input_pointer_wheel_direction_get(Eo *obj EINA_UNUSED, 
Efl_Input_Pointer_Data *pd)
+EOLIAN static Eina_Bool
+_efl_input_pointer_wheel_horizontal_get(Eo *obj EINA_UNUSED, 
Efl_Input_Pointer_Data *pd)
 {
-   return pd->wheel.dir;
+   return pd->wheel.horizontal;
 }
 
 EOLIAN static void
@@ -524,11 +523,8 @@ _efl_input_pointer_value_set(Eo *obj EINA_UNUSED, 
Efl_Input_Pointer_Data *pd, Ef
       case EFL_INPUT_VALUE_WHEEL_ANGLE:
         return EINA_FALSE; // TODO
 
-      case EFL_INPUT_VALUE_WHEEL_DIRECTION:
-        if (EINA_DBL_EQ(val, 0.0))
-          pd->wheel.dir = EFL_ORIENT_VERTICAL;
-        else
-          pd->wheel.dir = EFL_ORIENT_HORIZONTAL;
+      case EFL_INPUT_VALUE_WHEEL_HORIZONTAL:
+        pd->wheel.horizontal = (((int) val) == 1);
         break;
 
       case EFL_INPUT_VALUE_SLIDER:
@@ -623,8 +619,8 @@ _efl_input_pointer_value_get(Eo *obj EINA_UNUSED, 
Efl_Input_Pointer_Data *pd, Ef
       case EFL_INPUT_VALUE_WHEEL_ANGLE:
         return 0.0; // TODO (emulate??)
 
-      case EFL_INPUT_VALUE_WHEEL_DIRECTION:
-        return (pd->wheel.dir == EFL_ORIENT_HORIZONTAL) ? 1.0 : 0.0;
+      case EFL_INPUT_VALUE_WHEEL_HORIZONTAL:
+        return (double) pd->wheel.horizontal;
 
       case EFL_INPUT_VALUE_SLIDER:
         return 0.0; // TODO
diff --git a/src/lib/evas/canvas/efl_input_pointer.eo 
b/src/lib/evas/canvas/efl_input_pointer.eo
index 07f60ac727..1ece52644e 100644
--- a/src/lib/evas/canvas/efl_input_pointer.eo
+++ b/src/lib/evas/canvas/efl_input_pointer.eo
@@ -147,10 +147,10 @@ class Efl.Input.Pointer (Efl.Object, Efl.Input.Event, 
Efl.Input.State)
             val: bool; [[$true if the button press was a triple click, $false 
otherwise]]
          }
       }
-      @property wheel_direction {
-         [[Direction of the wheel.]]
+      @property wheel_horizontal {
+         [[Direction of the wheel, usually vertical.]]
          values {
-            dir: Efl.Orient; [[Horizontal or Vertical only.]]
+            horizontal: bool(false); [[If $true this was a horizontal wheel.]]
          }
       }
       @property wheel_delta {
diff --git a/src/lib/evas/canvas/evas_events.c 
b/src/lib/evas/canvas/evas_events.c
index e1184e1066..30d60d1004 100644
--- a/src/lib/evas/canvas/evas_events.c
+++ b/src/lib/evas/canvas/evas_events.c
@@ -1970,7 +1970,7 @@ _canvas_event_feed_mouse_wheel_internal(Eo *eo_e, 
Efl_Input_Pointer_Data *pe)
          _efl_input_value_mask(EFL_INPUT_VALUE_X) |
          _efl_input_value_mask(EFL_INPUT_VALUE_Y) |
          _efl_input_value_mask(EFL_INPUT_VALUE_WHEEL_DELTA) |
-         _efl_input_value_mask(EFL_INPUT_VALUE_WHEEL_DIRECTION);
+         _efl_input_value_mask(EFL_INPUT_VALUE_WHEEL_HORIZONTAL);
 
    if (e->is_frozen) return;
    EVAS_EVENT_FEED_SAFETY_CHECK(e);
@@ -2036,7 +2036,7 @@ evas_event_feed_mouse_wheel(Eo *eo_e, int direction, int 
z, unsigned int timesta
 
    if (!ev) return;
 
-   ev->wheel.dir = direction ? EFL_ORIENT_HORIZONTAL : EFL_ORIENT_VERTICAL;
+   ev->wheel.horizontal = !!direction;
    ev->wheel.z = z;
    ev->timestamp = timestamp;
    ev->data = (void *) data;
diff --git a/src/lib/evas/canvas/evas_events_legacy.c 
b/src/lib/evas/canvas/evas_events_legacy.c
index f87cf94c5a..37059068c7 100644
--- a/src/lib/evas/canvas/evas_events_legacy.c
+++ b/src/lib/evas/canvas/evas_events_legacy.c
@@ -246,7 +246,7 @@ efl_input_pointer_legacy_info_fill(Evas *eo_evas, 
Efl_Input_Key *eo_ev, Evas_Cal
         {
            TYPE_CHK(MOUSE_WHEEL);
            Evas_Event_Mouse_Wheel *e = _event_alloc(ev->legacy);
-           e->direction =  (ev->wheel.dir == EFL_ORIENT_HORIZONTAL) ? 1 : 0;
+           e->direction = ev->wheel.horizontal;
            e->z = ev->wheel.z;
            e->canvas.x = ev->cur.x;
            e->canvas.y = ev->cur.y;

-- 


Reply via email to