[PATCH xwayland 2/2] xwayland: Implement tablet_tool_wheel for scrolling
Jason Gerecke
killertofu at gmail.com
Fri Jun 9 23:02:07 UTC 2017
The 'tablet_tool_wheel' function for tablet scrolling was added back in
8a1defcc634 but left unimplemented. This commit fills in the necessary
details, using the "clicks" count as the number of discrete scroll up/down
events to send.
Signed-off-by: Jason Gerecke <jason.gerecke at wacom.com>
---
hw/xwayland/xwayland-input.c | 24 ++++++++++++++++++++++++
hw/xwayland/xwayland.h | 2 ++
2 files changed, 26 insertions(+)
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index c2801fa70..ffdb25dfd 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -1560,6 +1560,13 @@ static void
tablet_tool_wheel(void *data, struct zwp_tablet_tool_v2 *tool,
wl_fixed_t degrees, int32_t clicks)
{
+ struct xwl_tablet_tool *xwl_tablet_tool = data;
+ struct xwl_seat *xwl_seat = xwl_tablet_tool->seat;
+
+ if (!xwl_seat->focus_window)
+ return;
+
+ xwl_tablet_tool->wheel_clicks = clicks;
}
static void
@@ -1671,6 +1678,23 @@ tablet_tool_frame(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t time)
}
xwl_tablet_tool->buttons_prev = xwl_tablet_tool->buttons_now;
+
+ while (xwl_tablet_tool->wheel_clicks) {
+ if (xwl_tablet_tool->wheel_clicks < 0) {
+ button = 4;
+ xwl_tablet_tool->wheel_clicks++;
+ }
+ else {
+ button = 5;
+ xwl_tablet_tool->wheel_clicks--;
+ }
+
+ QueuePointerEvents(xwl_tablet_tool->xdevice,
+ ButtonPress, button, 0, &mask);
+ QueuePointerEvents(xwl_tablet_tool->xdevice,
+ ButtonRelease, button, 0, &mask);
+
+ }
}
static const struct zwp_tablet_tool_v2_listener tablet_tool_listener = {
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index b37e73b94..ccab93b33 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -216,6 +216,8 @@ struct xwl_tablet_tool {
uint32_t buttons_now,
buttons_prev;
+ int32_t wheel_clicks;
+
struct xwl_cursor cursor;
};
--
2.13.0
More information about the xorg-devel
mailing list