seat->pointer_info.surface_x = wl_fixed_to_double (x);
seat->pointer_info.surface_y = wl_fixed_to_double (y);
+ seat->drop_context = _gdk_wayland_drop_context_new (seat->display,
+ seat->data_device);
+ if (seat->master_pointer)
+ gdk_drag_context_set_device (seat->drop_context, seat->master_pointer);
+ else if (seat->touch_master)
+ gdk_drag_context_set_device (seat->drop_context, seat->touch_master);
+
gdk_wayland_drop_context_update_targets (seat->drop_context);
dnd_owner = seat->foreign_dnd_surface;
GDK_DISPLAY_NOTE (seat->display, EVENTS,
g_message ("data device leave, data device %p", data_device));
- if (!gdk_drag_context_get_dest_surface (seat->drop_context))
+ if (seat->drop_context == NULL)
return;
g_object_unref (seat->pointer_info.focus);
_gdk_wayland_drag_context_emit_event (seat->drop_context, GDK_DRAG_LEAVE,
GDK_CURRENT_TIME);
_gdk_wayland_drag_context_set_dest_surface (seat->drop_context, NULL, 0);
+
+ g_clear_object (&seat->drop_context);
}
static void
g_message ("data device motion, data_device = %p, time = %d, x = %f, y = %f",
data_device, time, wl_fixed_to_double (x), wl_fixed_to_double (y)));
- if (!gdk_drag_context_get_dest_surface (seat->drop_context))
+ if (seat->drop_context == NULL)
return;
/* Update pointer state, so device state queries work during DnD */
g_clear_object (&seat->touch_master);
g_clear_object (&seat->touch);
}
-
- if (seat->master_pointer)
- gdk_drag_context_set_device (seat->drop_context, seat->master_pointer);
- else if (seat->touch_master)
- gdk_drag_context_set_device (seat->drop_context, seat->touch_master);
}
static GdkDevice *
wl_data_device_manager_get_data_device (display_wayland->data_device_manager,
seat->wl_seat);
seat->clipboard = gdk_wayland_clipboard_new (display);
- seat->drop_context = _gdk_wayland_drop_context_new (display,
- seat->data_device);
wl_data_device_add_listener (seat->data_device,
&data_device_listener, seat);
seat = gdk_display_get_default_seat (display);
device = gdk_seat_get_pointer (seat);
drop_context = gdk_wayland_device_get_drop_context (device);
+ if (drop_context == NULL)
+ return;
drop_context->actions = _wl_to_gdk_actions (source_actions);
GDK_DISPLAY_NOTE (display, EVENTS,
g_message ("data offer source actions, offer %p, actions %d", wl_data_offer, source_actions));
- if (gdk_drag_context_get_dest_surface (drop_context))
- _gdk_wayland_drag_context_emit_event (drop_context, GDK_DRAG_MOTION,
- GDK_CURRENT_TIME);
+ _gdk_wayland_drag_context_emit_event (drop_context, GDK_DRAG_MOTION,
+ GDK_CURRENT_TIME);
}
static void
seat = gdk_display_get_default_seat (display);
device = gdk_seat_get_pointer (seat);
drop_context = gdk_wayland_device_get_drop_context (device);
+ if (drop_context == NULL)
+ return;
drop_context->action = _wl_to_gdk_actions (action);
- if (gdk_drag_context_get_dest_surface (drop_context))
- _gdk_wayland_drag_context_emit_event (drop_context, GDK_DRAG_MOTION,
- GDK_CURRENT_TIME);
+ _gdk_wayland_drag_context_emit_event (drop_context, GDK_DRAG_MOTION,
+ GDK_CURRENT_TIME);
}
static const struct wl_data_offer_listener data_offer_listener = {