{
uint32_t action;
- if (!offer->source || !offer->source->actions_set)
+ if (!offer->source)
return;
action = data_offer_choose_action(offer);
offer->source = NULL;
}
-static struct wl_resource *
+static struct weston_data_offer *
weston_data_source_send_offer(struct weston_data_source *source,
struct wl_resource *target)
{
source->offer = offer;
source->accepted = false;
- data_offer_update_action(offer);
- return offer->resource;
+ return offer;
}
static void
if (drag->data_source) {
drag->data_source->accepted = false;
- offer_resource = weston_data_source_send_offer(drag->data_source,
- resource);
- if (offer_resource == NULL)
+ offer = weston_data_source_send_offer(drag->data_source, resource);
+ if (offer == NULL)
return;
+ data_offer_update_action(offer);
+
+ offer_resource = offer->resource;
if (wl_resource_get_version (offer_resource) >=
WL_DATA_OFFER_SOURCE_ACTIONS_SINCE_VERSION) {
wl_data_offer_send_source_actions (offer_resource,
WL_EXPORT void
weston_seat_send_selection(struct weston_seat *seat, struct wl_client *client)
{
- struct wl_resource *data_device, *offer;
+ struct weston_data_offer *offer;
+ struct wl_resource *data_device;
wl_resource_for_each(data_device, &seat->drag_resource_list) {
if (wl_resource_get_client(data_device) != client)
if (seat->selection_data_source) {
offer = weston_data_source_send_offer(seat->selection_data_source,
- data_device);
- wl_data_device_send_selection(data_device, offer);
+ data_device);
+ wl_data_device_send_selection(data_device, offer->resource);
} else {
wl_data_device_send_selection(data_device, NULL);
}