wayland: Survive without primary selection

I am testing GTK+ master against mutter 3.19.90, so I'd
like GTK+ to survive even when the compositor does not
support the primary selection interface.
This commit is contained in:
Matthias Clasen 2016-02-26 19:41:25 -05:00
parent b72996cde4
commit 914f7bd6e4
2 changed files with 15 additions and 9 deletions

View File

@ -2920,11 +2920,14 @@ _gdk_wayland_device_manager_add_seat (GdkDeviceManager *device_manager,
wl_seat_add_listener (seat->wl_seat, &seat_listener, seat);
wl_seat_set_user_data (seat->wl_seat, seat);
seat->primary_data_device =
gtk_primary_selection_device_manager_get_device (display_wayland->primary_selection_manager,
seat->wl_seat);
gtk_primary_selection_device_add_listener (seat->primary_data_device,
&primary_selection_device_listener, seat);
if (display_wayland->primary_selection_manager)
{
seat->primary_data_device =
gtk_primary_selection_device_manager_get_device (display_wayland->primary_selection_manager,
seat->wl_seat);
gtk_primary_selection_device_add_listener (seat->primary_data_device,
&primary_selection_device_listener, seat);
}
seat->data_device =
wl_data_device_manager_get_data_device (display_wayland->data_device_manager,

View File

@ -1089,10 +1089,13 @@ gdk_wayland_selection_get_data_source (GdkWindow *owner,
if (selection == atoms[ATOM_PRIMARY])
{
source = gtk_primary_selection_device_manager_create_source (display_wayland->primary_selection_manager);
gtk_primary_selection_source_add_listener (source,
&primary_source_listener,
wayland_selection);
if (display_wayland->primary_selection_manager)
{
source = gtk_primary_selection_device_manager_create_source (display_wayland->primary_selection_manager);
gtk_primary_selection_source_add_listener (source,
&primary_source_listener,
wayland_selection);
}
}
else
{