Merge pull request #5212 from hardening/ddm_fix

uwac: fix initialization of data_device_manager
This commit is contained in:
akallabeth 2019-01-24 11:53:37 +01:00 committed by GitHub
commit 58f616b687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -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)
{

View File

@ -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) {