From f2a90986919febd6d6a47e044ca7f1842980c5e9 Mon Sep 17 00:00:00 2001 From: nyorain Date: Fri, 18 Aug 2017 19:58:36 +0200 Subject: Fix wlr_data_device_manager --- examples/compositor/main.c | 5 +++-- types/wlr_data_device_manager.c | 12 +++--------- types/wlr_seat.c | 6 ++++++ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/examples/compositor/main.c b/examples/compositor/main.c index 02b75dc6..751a3f23 100644 --- a/examples/compositor/main.c +++ b/examples/compositor/main.c @@ -133,8 +133,9 @@ static void handle_keyboard_bound(struct wl_listener *listener, void *data) { wl_keyboard_send_keymap(handle->keyboard, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, state->keymap_fd, state->keymap_size); - if (wl_resource_get_version(handle->keyboard) >= 2) - wl_keyboard_send_repeat_info(handle->keyboard, 660, 25); + if (wl_resource_get_version(handle->keyboard) >= 2) { + wl_keyboard_send_repeat_info(handle->keyboard, 25, 600); + } } int main() { diff --git a/types/wlr_data_device_manager.c b/types/wlr_data_device_manager.c index 058839f1..fb3bd901 100644 --- a/types/wlr_data_device_manager.c +++ b/types/wlr_data_device_manager.c @@ -157,16 +157,10 @@ struct wlr_data_device_manager *wlr_data_device_manager_create(struct wl_display } void wlr_data_device_manager_destroy(struct wlr_data_device_manager *manager) { - if (!manager) { - return; + if (manager) { + wl_global_destroy(manager->global); + free(manager); } - - // TODO: destroy remaining resources? cancel current selection? - // if this is called why there are still resources active we will - // always get problems - - wl_global_destroy(manager->global); - free(manager); } void wlr_data_device_set_selection(struct wlr_data_device *device, diff --git a/types/wlr_seat.c b/types/wlr_seat.c index c93b7d9c..f01f7974 100644 --- a/types/wlr_seat.c +++ b/types/wlr_seat.c @@ -180,7 +180,13 @@ void wlr_seat_destroy(struct wlr_seat *wlr_seat) { return; } + struct wlr_seat_handle *handle; + wl_list_for_each(handle, &wlr_seat->handles, link) { + wl_resource_destroy(handle->wl_resource); // will destroy other resources as well + } + wl_global_destroy(wlr_seat->wl_global); + free(wlr_seat->data_device); free(wlr_seat->name); free(wlr_seat); } -- cgit v1.2.3