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:
parent
fbc9814975
commit
7c7a540f1e
|
@ -1560,6 +1560,13 @@ static void
|
||||||
tablet_tool_wheel(void *data, struct zwp_tablet_tool_v2 *tool,
|
tablet_tool_wheel(void *data, struct zwp_tablet_tool_v2 *tool,
|
||||||
wl_fixed_t degrees, int32_t clicks)
|
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
|
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;
|
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 = {
|
static const struct zwp_tablet_tool_v2_listener tablet_tool_listener = {
|
||||||
|
|
|
@ -214,6 +214,8 @@ struct xwl_tablet_tool {
|
||||||
uint32_t buttons_now,
|
uint32_t buttons_now,
|
||||||
buttons_prev;
|
buttons_prev;
|
||||||
|
|
||||||
|
int32_t wheel_clicks;
|
||||||
|
|
||||||
struct xwl_cursor cursor;
|
struct xwl_cursor cursor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue