pointer_notify_axis(device, time,
t->scroll.direction,
LIBINPUT_POINTER_AXIS_SOURCE_FINGER,
- 0.0);
+ 0.0,
+ 0);
t->scroll.direction = -1;
}
continue;
pointer_notify_axis(device, time, axis,
LIBINPUT_POINTER_AXIS_SOURCE_FINGER,
- *delta);
+ *delta,
+ 0);
t->scroll.direction = axis;
tp_edge_scroll_handle_event(tp, t, SCROLL_EVENT_POSTED);
pointer_notify_axis(device, time,
t->scroll.direction,
LIBINPUT_POINTER_AXIS_SOURCE_FINGER,
- 0.0);
+ 0.0,
+ 0);
t->scroll.direction = -1;
}
}
uint64_t time,
enum libinput_pointer_axis axis,
enum libinput_pointer_axis_source source,
- double value)
+ double value,
+ double discrete)
{
- if (device->scroll.natural_scrolling_enabled)
+ if (device->scroll.natural_scrolling_enabled) {
value *= -1;
+ discrete *= -1;
+ }
pointer_notify_axis(&device->base,
time,
axis,
source,
- value);
+ value,
+ discrete);
}
static inline void
time,
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
LIBINPUT_POINTER_AXIS_SOURCE_WHEEL,
- -1 * e->value * device->scroll.wheel_click_angle);
+ -1 * e->value * device->scroll.wheel_click_angle,
+ -1 * e->value);
break;
case REL_HWHEEL:
evdev_flush_pending_event(device, time);
time,
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL,
LIBINPUT_POINTER_AXIS_SOURCE_WHEEL,
- e->value * device->scroll.wheel_click_angle);
+ e->value * device->scroll.wheel_click_angle,
+ e->value);
break;
}
}
time,
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
source,
- dy);
+ dy,
+ 0);
}
if (dx != 0.0 &&
time,
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL,
source,
- dx);
+ dx,
+ 0);
}
}
time,
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
source,
- 0);
+ 0, 0);
if (device->scroll.direction & (1 << LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL))
pointer_notify_axis(&device->base,
time,
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL,
source,
- 0);
+ 0, 0);
device->scroll.buildup_horizontal = 0;
device->scroll.buildup_vertical = 0;
uint64_t time,
enum libinput_pointer_axis axis,
enum libinput_pointer_axis_source source,
- double value);
+ double value,
+ double discrete);
void
touch_notify_touch_down(struct libinput_device *device,
enum libinput_pointer_axis axis;
enum libinput_pointer_axis_source source;
double value;
+ double discrete;
};
struct libinput_event_touch {
return event->value;
}
+LIBINPUT_EXPORT double
+libinput_event_pointer_get_axis_value_discrete(struct libinput_event_pointer *event)
+{
+ return event->discrete;
+}
+
LIBINPUT_EXPORT enum libinput_pointer_axis_source
libinput_event_pointer_get_axis_source(struct libinput_event_pointer *event)
{
uint64_t time,
enum libinput_pointer_axis axis,
enum libinput_pointer_axis_source source,
- double value)
+ double value,
+ double discrete)
{
struct libinput_event_pointer *axis_event;
.axis = axis,
.value = value,
.source = source,
+ .discrete = discrete,
};
post_device_event(device, time,
* @ref LIBINPUT_EVENT_POINTER_AXIS.
*
* @return the axis value of this event
+ *
+ * @see libinput_event_pointer_get_axis_value_discrete
*/
double
libinput_event_pointer_get_axis_value(struct libinput_event_pointer *event);
libinput_event_pointer_get_axis_source(struct libinput_event_pointer *event);
/**
+ * @ingroup pointer
+ *
+ * Return the axis value in discrete steps for a given axis event. How a
+ * value translates into a discrete step depends on the source.
+ *
+ * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL, the discrete
+ * value correspond to the number of physical mouse clicks.
+ *
+ * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS or @ref
+ * LIBINPUT_POINTER_AXIS_SOURCE_FINGER, the discrete value is always 0.
+ *
+ * @return The discrete value for the given event.
+ *
+ * @see libinput_event_pointer_get_axis_value
+ */
+double
+libinput_event_pointer_get_axis_value_discrete(struct libinput_event_pointer *event);
+
+/**
* @ingroup event_pointer
*
* @return The generic libinput_event of this event
libinput_event_pointer_get_axis;
libinput_event_pointer_get_axis_source;
libinput_event_pointer_get_axis_value;
+ libinput_event_pointer_get_axis_value_discrete;
libinput_event_pointer_get_base_event;
libinput_event_pointer_get_button_state;
libinput_event_pointer_get_button;
up by a factor 15 */
const int scroll_step = 15;
int expected = amount * scroll_step;
+ int discrete = amount;
- if (libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device))
+ if (libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device)) {
expected *= -1;
+ discrete *= -1;
+ }
/* mouse scroll wheels are 'upside down' */
if (which == REL_WHEEL)
ck_assert_int_eq(libinput_event_pointer_get_axis_value(ptrev), expected);
ck_assert_int_eq(libinput_event_pointer_get_axis_source(ptrev),
LIBINPUT_POINTER_AXIS_SOURCE_WHEEL);
+ ck_assert_int_eq(libinput_event_pointer_get_axis_value_discrete(ptrev),
+ discrete);
libinput_event_destroy(event);
}