evas: Modify wheel events direction to bool (EO)
authorJean-Philippe Andre <jp.andre@samsung.com>
Wed, 9 Aug 2017 12:04:10 +0000 (21:04 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Thu, 10 Aug 2017 05:42:08 +0000 (14:42 +0900)
The orientation was overkill here. We only want a bool.

Ref T5870

src/examples/evas/evas-multiseat-events.c
src/lib/ecore_evas/ecore_evas.c
src/lib/edje/edje_callbacks.c
src/lib/evas/canvas/efl_input_pointer.c
src/lib/evas/canvas/efl_input_pointer.eo
src/lib/evas/canvas/evas_events.c
src/lib/evas/canvas/evas_events_legacy.c

index 24d76f1..c0659f0 100644 (file)
@@ -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));
index e4c8001..127b945 100644 (file)
@@ -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);
index 06ed0f8..c64df5c 100644 (file)
@@ -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);
           }
index 5b72092..d469488 100644 (file)
@@ -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
index 07f60ac..1ece526 100644 (file)
@@ -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 {
index e1184e1..30d60d1 100644 (file)
@@ -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;
index f87cf94..3705906 100644 (file)
@@ -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;