summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2017-06-09 16:02:07 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2017-06-12 11:46:23 +1000
commit7c7a540f1e1d6b5466e1c9aa28476a2d7273d5ed (patch)
tree68081b39e3bfabe3fbede0ed994cc7240553b481
parentfbc9814975fe82be25becf1a55d4f8d34298a956 (diff)
xwayland: Implement tablet_tool_wheel for scrolling
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@wacom.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--hw/xwayland/xwayland-input.c24
-rw-r--r--hw/xwayland/xwayland.h2
2 files changed, 26 insertions, 0 deletions
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 0e5f84f54..c5bb38184 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 a05e0862c..066877099 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -214,6 +214,8 @@ struct xwl_tablet_tool {
uint32_t buttons_now,
buttons_prev;
+ int32_t wheel_clicks;
+
struct xwl_cursor cursor;
};