void gdk_wayland_selection_add_targets (GdkWindow *window, GdkAtom selection, guint ntargets, GdkAtom *targets) { struct wl_data_source *data_source; guint i; g_return_if_fail (GDK_IS_WINDOW (window)); data_source = gdk_wayland_selection_get_data_source (window, selection); if (!data_source) return; for (i = 0; i < ntargets; i++) wl_data_source_offer (data_source, gdk_atom_name (targets[i])); if (selection == atoms[ATOM_CLIPBOARD]) { GdkDeviceManager *device_manager; GdkDisplay *display; GdkDevice *device; display = gdk_window_get_display (window); device_manager = gdk_display_get_device_manager (display); device = gdk_device_manager_get_client_pointer (device_manager); gdk_wayland_device_set_selection (device, data_source); } }
void gdk_wayland_selection_add_targets (GdkWindow *window, GdkAtom selection, guint ntargets, GdkAtom *targets) { GdkDisplay *display = gdk_window_get_display (window); GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display); gpointer data_source; guint i; g_return_if_fail (GDK_IS_WINDOW (window)); data_source = gdk_wayland_selection_get_data_source (window, selection); if (!data_source) return; g_array_append_vals (wayland_selection->source_targets, targets, ntargets); for (i = 0; i < ntargets; i++) { gchar *mimetype = gdk_atom_name (targets[i]); wl_data_source_offer (data_source, mimetype); g_free (mimetype); } if (selection == atoms[ATOM_CLIPBOARD]) { GdkDisplay *display; GdkDevice *device; display = gdk_window_get_display (window); device = gdk_seat_get_pointer (gdk_display_get_default_seat (display)); gdk_wayland_device_set_selection (device, data_source); } else if (selection == atoms[ATOM_PRIMARY]) { GdkSeat *seat; seat = gdk_display_get_default_seat (display); gdk_wayland_seat_set_primary (seat, data_source); } }