diff --git a/uwac/libuwac/uwac-display.c b/uwac/libuwac/uwac-display.c index 518d430ba..13e5d63de 100644 --- a/uwac/libuwac/uwac-display.c +++ b/uwac/libuwac/uwac-display.c @@ -141,6 +141,15 @@ static void display_destroy_seat(UwacDisplay* d, uint32_t name) } } +static void UwacSeatRegisterDDM(UwacSeat *seat) +{ + UwacDisplay *d = seat->display; + if (!d->data_device_manager) + return; + + seat->data_device = wl_data_device_manager_get_data_device(d->data_device_manager, seat->seat); +} + static void registry_handle_global(void* data, struct wl_registry* registry, uint32_t id, const char* interface, uint32_t version) { @@ -191,6 +200,7 @@ static void registry_handle_global(void* data, struct wl_registry* registry, uin return; } + UwacSeatRegisterDDM(seat); UwacSeatRegisterClipboard(seat); ev = (UwacSeatNewEvent*)UwacDisplayNewEvent(d, UWAC_EVENT_NEW_SEAT); @@ -204,8 +214,15 @@ static void registry_handle_global(void* data, struct wl_registry* registry, uin } else if (strcmp(interface, "wl_data_device_manager") == 0) { + UwacSeat* seat; + d->data_device_manager = wl_registry_bind(registry, id, &wl_data_device_manager_interface, min(TARGET_DDM_INTERFACE, version)); + + wl_list_for_each(seat, &d->seats, link) + { + UwacSeatRegisterDDM(seat); + } } else if (strcmp(interface, "wl_shell") == 0) { diff --git a/uwac/libuwac/uwac-input.c b/uwac/libuwac/uwac-input.c index f5602d41d..3e7799ef2 100644 --- a/uwac/libuwac/uwac-input.c +++ b/uwac/libuwac/uwac-input.c @@ -807,7 +807,6 @@ UwacSeat *UwacSeatNew(UwacDisplay *d, uint32_t id, uint32_t version) { goto error_watch_timerfd; } - ret->data_device = wl_data_device_manager_get_data_device(d->data_device_manager, ret->seat); wl_list_insert(d->seats.prev, &ret->link); return ret; @@ -820,6 +819,7 @@ error_xkb_context: return NULL; } + void UwacSeatDestroy(UwacSeat *s) { UwacSeatInhibitShortcuts(s, false); if (s->seat) {