[mutter/wip/garnacho/wayland-extra-scroll-events: 3/3] wayland: Implement wl_pointer.axis_source/axis_stop/axis_frame emission
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/garnacho/wayland-extra-scroll-events: 3/3] wayland: Implement wl_pointer.axis_source/axis_stop/axis_frame emission
- Date: Mon, 19 Oct 2015 10:36:51 +0000 (UTC)
commit d886cb377cda8325e04f8330060a402a4b8ace5b
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Sep 8 14:32:50 2015 +0200
wayland: Implement wl_pointer.axis_source/axis_stop/axis_frame emission
As per the spec. wl_pointer.axis_source determines the current source of
scroll events, wl_pointer.axis_stop determines when there's no further
scroll events on any axis (Which Clutter sends as dx/dy=0 events).
wl_pointer.axis_frame marks the end of a series of axis_* events.
v2: Updated to v4 of the protocol spec by
Peter Hutterer <peter hutterer who-t net>
src/wayland/meta-wayland-pointer.c | 30 ++++++++++++++++++++++++++++++
src/wayland/meta-wayland-versions.h | 2 +-
2 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index 894a64d..9fd350d 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -494,10 +494,23 @@ handle_scroll_event (MetaWaylandPointer *pointer,
{
struct wl_resource *resource;
wl_fixed_t x_value = 0, y_value = 0;
+ ClutterInputDevice *dev;
+ enum wl_pointer_axis_source source = -1;
if (clutter_event_is_pointer_emulated (event))
return;
+ dev = clutter_event_get_source_device (event);
+ switch (clutter_input_device_get_device_type (dev))
+ {
+ case CLUTTER_TOUCHPAD_DEVICE:
+ source = WL_POINTER_AXIS_SOURCE_FINGER;
+ break;
+ default:
+ source = WL_POINTER_AXIS_SOURCE_WHEEL;
+ break;
+ }
+
switch (clutter_event_get_scroll_direction (event))
{
case CLUTTER_SCROLL_UP:
@@ -537,12 +550,29 @@ handle_scroll_event (MetaWaylandPointer *pointer,
{
wl_resource_for_each (resource, &pointer->focus_client->pointer_resources)
{
+ if (wl_resource_get_version (resource) >= WL_POINTER_AXIS_SOURCE_SINCE_VERSION)
+ wl_pointer_send_axis_source (resource, source);
+
if (x_value)
wl_pointer_send_axis (resource, clutter_event_get_time (event),
WL_POINTER_AXIS_HORIZONTAL_SCROLL, x_value);
+ else if (source == WL_POINTER_AXIS_SOURCE_FINGER &&
+ wl_resource_get_version (resource) >= WL_POINTER_AXIS_STOP_SINCE_VERSION)
+ wl_pointer_send_axis_stop (resource,
+ clutter_event_get_time (event),
+ WL_POINTER_AXIS_HORIZONTAL_SCROLL);
+
if (y_value)
wl_pointer_send_axis (resource, clutter_event_get_time (event),
WL_POINTER_AXIS_VERTICAL_SCROLL, y_value);
+ else if (source == WL_POINTER_AXIS_SOURCE_FINGER &&
+ wl_resource_get_version (resource) >= WL_POINTER_AXIS_STOP_SINCE_VERSION)
+ wl_pointer_send_axis_stop (resource,
+ clutter_event_get_time (event),
+ WL_POINTER_AXIS_VERTICAL_SCROLL);
+
+ if (wl_resource_get_version (resource) >= WL_POINTER_AXIS_SOURCE_SINCE_VERSION)
+ wl_pointer_send_axis_frame (resource);
}
}
}
diff --git a/src/wayland/meta-wayland-versions.h b/src/wayland/meta-wayland-versions.h
index 9ca8def..e0b6b92 100644
--- a/src/wayland/meta-wayland-versions.h
+++ b/src/wayland/meta-wayland-versions.h
@@ -39,7 +39,7 @@
#define META_WL_DATA_DEVICE_MANAGER_VERSION 2
#define META_XDG_SHELL_VERSION 1
#define META_WL_SHELL_VERSION 1
-#define META_WL_SEAT_VERSION 4
+#define META_WL_SEAT_VERSION 5
#define META_WL_OUTPUT_VERSION 2
#define META_XSERVER_VERSION 1
#define META_GTK_SHELL_VERSION 2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]