xwayland: Dispatch pointer motion events on wl_pointer.frame if possible
Wait until wl_pointer.frame with dispatching the pointer motion event, if wl_pointer.frame is supported by the compositor. This will later be used to combine unaccelerated motion deltas with the absolute motion delta. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
42e8902395
commit
aa9634d03b
|
@ -347,18 +347,18 @@ pointer_handle_leave(void *data, struct wl_pointer *pointer,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pointer_handle_motion(void *data, struct wl_pointer *pointer,
|
dispatch_pointer_event(struct xwl_seat *xwl_seat)
|
||||||
uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w)
|
|
||||||
{
|
{
|
||||||
struct xwl_seat *xwl_seat = data;
|
|
||||||
int32_t dx, dy;
|
|
||||||
int sx = wl_fixed_to_int(sx_w);
|
|
||||||
int sy = wl_fixed_to_int(sy_w);
|
|
||||||
ValuatorMask mask;
|
ValuatorMask mask;
|
||||||
|
|
||||||
if (!xwl_seat->focus_window)
|
if (xwl_seat->pending_pointer_event.has_absolute) {
|
||||||
return;
|
int sx;
|
||||||
|
int sy;
|
||||||
|
int dx;
|
||||||
|
int dy;
|
||||||
|
|
||||||
|
sx = wl_fixed_to_int(xwl_seat->pending_pointer_event.x);
|
||||||
|
sy = wl_fixed_to_int(xwl_seat->pending_pointer_event.y);
|
||||||
dx = xwl_seat->focus_window->window->drawable.x;
|
dx = xwl_seat->focus_window->window->drawable.x;
|
||||||
dy = xwl_seat->focus_window->window->drawable.y;
|
dy = xwl_seat->focus_window->window->drawable.y;
|
||||||
|
|
||||||
|
@ -368,6 +368,26 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer,
|
||||||
|
|
||||||
QueuePointerEvents(xwl_seat->pointer, MotionNotify, 0,
|
QueuePointerEvents(xwl_seat->pointer, MotionNotify, 0,
|
||||||
POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
|
POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
xwl_seat->pending_pointer_event.has_absolute = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pointer_handle_motion(void *data, struct wl_pointer *pointer,
|
||||||
|
uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w)
|
||||||
|
{
|
||||||
|
struct xwl_seat *xwl_seat = data;
|
||||||
|
|
||||||
|
if (!xwl_seat->focus_window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
xwl_seat->pending_pointer_event.has_absolute = TRUE;
|
||||||
|
xwl_seat->pending_pointer_event.x = sx_w;
|
||||||
|
xwl_seat->pending_pointer_event.y = sy_w;
|
||||||
|
|
||||||
|
if (wl_proxy_get_version((struct wl_proxy *) xwl_seat->wl_pointer) < 5)
|
||||||
|
dispatch_pointer_event(xwl_seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -427,12 +447,41 @@ pointer_handle_axis(void *data, struct wl_pointer *pointer,
|
||||||
QueuePointerEvents(xwl_seat->pointer, MotionNotify, 0, POINTER_RELATIVE, &mask);
|
QueuePointerEvents(xwl_seat->pointer, MotionNotify, 0, POINTER_RELATIVE, &mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pointer_handle_frame(void *data, struct wl_pointer *wl_pointer)
|
||||||
|
{
|
||||||
|
struct xwl_seat *xwl_seat = data;
|
||||||
|
|
||||||
|
dispatch_pointer_event(xwl_seat);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pointer_handle_axis_source(void *data, struct wl_pointer *wl_pointer, uint32_t axis_source)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pointer_handle_axis_stop(void *data, struct wl_pointer *wl_pointer,
|
||||||
|
uint32_t time, uint32_t axis)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pointer_handle_axis_discrete(void *data, struct wl_pointer *wl_pointer,
|
||||||
|
uint32_t axis, int32_t discrete)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static const struct wl_pointer_listener pointer_listener = {
|
static const struct wl_pointer_listener pointer_listener = {
|
||||||
pointer_handle_enter,
|
pointer_handle_enter,
|
||||||
pointer_handle_leave,
|
pointer_handle_leave,
|
||||||
pointer_handle_motion,
|
pointer_handle_motion,
|
||||||
pointer_handle_button,
|
pointer_handle_button,
|
||||||
pointer_handle_axis,
|
pointer_handle_axis,
|
||||||
|
pointer_handle_frame,
|
||||||
|
pointer_handle_axis_source,
|
||||||
|
pointer_handle_axis_stop,
|
||||||
|
pointer_handle_axis_discrete,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -987,7 +1036,7 @@ create_input_device(struct xwl_screen *xwl_screen, uint32_t id, uint32_t version
|
||||||
|
|
||||||
xwl_seat->seat =
|
xwl_seat->seat =
|
||||||
wl_registry_bind(xwl_screen->registry, id,
|
wl_registry_bind(xwl_screen->registry, id,
|
||||||
&wl_seat_interface, min(version, 4));
|
&wl_seat_interface, min(version, 5));
|
||||||
xwl_seat->id = id;
|
xwl_seat->id = id;
|
||||||
|
|
||||||
xwl_seat->cursor = wl_compositor_create_surface(xwl_screen->compositor);
|
xwl_seat->cursor = wl_compositor_create_surface(xwl_screen->compositor);
|
||||||
|
|
|
@ -146,6 +146,12 @@ struct xwl_seat {
|
||||||
struct wl_surface *keyboard_focus;
|
struct wl_surface *keyboard_focus;
|
||||||
|
|
||||||
struct xorg_list sync_pending;
|
struct xorg_list sync_pending;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
Bool has_absolute;
|
||||||
|
wl_fixed_t x;
|
||||||
|
wl_fixed_t y;
|
||||||
|
} pending_pointer_event;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct xwl_output {
|
struct xwl_output {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user