From fb44ce9fa8aadc1fee59b13f5780b493ed0a425f Mon Sep 17 00:00:00 2001 From: random human Date: Mon, 1 Oct 2018 21:49:26 +0530 Subject: relative_pointer: send frame event to pointer for Xwayland --- include/wlr/types/wlr_relative_pointer_v1.h | 2 +- types/seat/wlr_seat_pointer.c | 11 +++++++++-- types/wlr_relative_pointer_v1.c | 6 ++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/include/wlr/types/wlr_relative_pointer_v1.h b/include/wlr/types/wlr_relative_pointer_v1.h index b2eb7241..22441bb6 100644 --- a/include/wlr/types/wlr_relative_pointer_v1.h +++ b/include/wlr/types/wlr_relative_pointer_v1.h @@ -69,7 +69,7 @@ struct wlr_relative_pointer_v1 { struct wlr_relative_pointer_manager_v1 *wlr_relative_pointer_v1_create(struct wl_display *display); void wlr_relative_pointer_v1_destroy(struct wlr_relative_pointer_manager_v1 *relative_pointer_manager); -void wlr_relative_pointer_v1_send_relative_motion(struct wl_resource *resource, +void wlr_relative_pointer_v1_send_relative_motion(struct wlr_relative_pointer_v1 *relative_pointer, uint64_t time, double dx, double dy, double dx_unaccel, double dy_unaccel); #endif diff --git a/types/seat/wlr_seat_pointer.c b/types/seat/wlr_seat_pointer.c index 3c7e98e9..2515fddc 100644 --- a/types/seat/wlr_seat_pointer.c +++ b/types/seat/wlr_seat_pointer.c @@ -315,8 +315,15 @@ void wlr_seat_pointer_notify_relative_motion(struct wlr_seat *wlr_seat, struct wl_resource *resource; wl_resource_for_each(resource, &client->relative_pointers) { - wlr_relative_pointer_v1_send_relative_motion(resource, time, dx, dy, - dx_unaccel, dy_unaccel); + struct wlr_relative_pointer_v1 *relative_pointer = + wl_resource_get_user_data(resource); + if (relative_pointer == NULL) { + continue; + } + + wlr_relative_pointer_v1_send_relative_motion(relative_pointer, time, + dx, dy, dx_unaccel, dy_unaccel); + pointer_send_frame((struct wl_resource *) relative_pointer->pointer); } } diff --git a/types/wlr_relative_pointer_v1.c b/types/wlr_relative_pointer_v1.c index 93d96fa4..c5c4650f 100644 --- a/types/wlr_relative_pointer_v1.c +++ b/types/wlr_relative_pointer_v1.c @@ -182,12 +182,10 @@ void wlr_relative_pointer_v1_destroy(struct wlr_relative_pointer_manager_v1 *rel } -void wlr_relative_pointer_v1_send_relative_motion(struct wl_resource *resource, +void wlr_relative_pointer_v1_send_relative_motion(struct wlr_relative_pointer_v1 *relative_pointer, uint64_t time, double dx, double dy, double dx_unaccel, double dy_unaccel) { - assert(wl_resource_instance_of(resource, &zwp_relative_pointer_v1_interface, - &relative_pointer_v1_impl)); - zwp_relative_pointer_v1_send_relative_motion(resource, + zwp_relative_pointer_v1_send_relative_motion(relative_pointer->resource, (uint32_t)(time >> 32), (uint32_t)time, wl_fixed_from_double(dx), wl_fixed_from_double(dy), wl_fixed_from_double(dx_unaccel), wl_fixed_from_double(dy_unaccel)); -- cgit v1.2.3