xwayland: Implement tablet_tool_wheel for scrolling

The 'tablet_tool_wheel' function for tablet scrolling was added back in
8a1defcc63 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>
This commit is contained in:
Jason Gerecke 2017-06-09 16:02:07 -07:00 committed by Peter Hutterer
parent fbc9814975
commit 7c7a540f1e
2 changed files with 26 additions and 0 deletions

View File

@ -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 = {

View File

@ -214,6 +214,8 @@ struct xwl_tablet_tool {
uint32_t buttons_now,
buttons_prev;
int32_t wheel_clicks;
struct xwl_cursor cursor;
};