evas: Modify wheel events direction to bool (EO)

The orientation was overkill here. We only want a bool.

Ref T5870
This commit is contained in:
Jean-Philippe Andre 2017-08-09 21:04:10 +09:00
parent b2dc2274e8
commit d4b4ee867b
7 changed files with 19 additions and 23 deletions

View 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));

View 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);

View 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);
}

View 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

View 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 {

View 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;

View 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;