diff options
-rw-r--r-- | include/wlr/types/wlr_relative_pointer_v1.h | 1 | ||||
-rw-r--r-- | types/wlr_relative_pointer_v1.c | 14 |
2 files changed, 13 insertions, 2 deletions
diff --git a/include/wlr/types/wlr_relative_pointer_v1.h b/include/wlr/types/wlr_relative_pointer_v1.h index 1bc85b05..cc4b2746 100644 --- a/include/wlr/types/wlr_relative_pointer_v1.h +++ b/include/wlr/types/wlr_relative_pointer_v1.h @@ -58,6 +58,7 @@ struct wlr_relative_pointer_v1 { } events; struct wl_listener seat_destroy; + struct wl_listener pointer_destroy; void *data; }; diff --git a/types/wlr_relative_pointer_v1.c b/types/wlr_relative_pointer_v1.c index 9d12bd93..4d3620bd 100644 --- a/types/wlr_relative_pointer_v1.c +++ b/types/wlr_relative_pointer_v1.c @@ -75,6 +75,14 @@ static void relative_pointer_handle_seat_destroy(struct wl_listener *listener, relative_pointer_destroy(relative_pointer); } +static void relative_pointer_handle_pointer_destroy(struct wl_listener *listener, + void *data) { + struct wlr_relative_pointer_v1 *relative_pointer = + wl_container_of(listener, relative_pointer, pointer_destroy); + + relative_pointer_destroy(relative_pointer); +} + /** * relative_pointer_manager handler functions */ @@ -129,10 +137,12 @@ static void relative_pointer_manager_v1_handle_get_relative_pointer(struct wl_cl wl_signal_add(&relative_pointer->seat->events.destroy, &relative_pointer->seat_destroy); - wl_resource_add_destroy_listener(relative_pointer->pointer, - &relative_pointer->seat_destroy); relative_pointer->seat_destroy.notify = relative_pointer_handle_seat_destroy; + wl_resource_add_destroy_listener(relative_pointer->pointer, + &relative_pointer->pointer_destroy); + relative_pointer->pointer_destroy.notify = relative_pointer_handle_pointer_destroy; + wlr_signal_emit_safe(&relative_pointer_manager->events.new_relative_pointer, relative_pointer); |