and move the vfunc into GdkDrop.
g_return_if_fail (context != NULL);
}
-/* Destination side */
-
-static void
-gdk_broadway_drag_context_drop_finish (GdkDragContext *context,
- gboolean success,
- guint32 time)
-{
- g_return_if_fail (context != NULL);
-}
-
void
_gdk_broadway_surface_register_dnd (GdkSurface *surface)
{
context_class->drag_abort = gdk_broadway_drag_context_drag_abort;
context_class->drag_drop = gdk_broadway_drag_context_drag_drop;
- context_class->drop_finish = gdk_broadway_drag_context_drop_finish;
}
{
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
- GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_finish (context, success, time_);
+ if (success)
+ gdk_drop_finish (GDK_DROP (context), gdk_drag_context_get_selected_action (context));
+ else
+ gdk_drop_finish (GDK_DROP (context), 0);
}
static void
guint32 time_);
void (*drag_drop) (GdkDragContext *context,
guint32 time_);
- void (*drop_finish) (GdkDragContext *context,
- gboolean success,
- guint32 time_);
GdkSurface* (*get_drag_surface) (GdkDragContext *context);
void (*set_hotspot) (GdkDragContext *context,
gint hot_x,
GDK_DROP_GET_CLASS (self)->status (self, actions);
}
+/**
+ * gdk_drop_finish:
+ * @self: a #GdkDrop
+ * @action: the action performed by the destination or 0 if the drop
+ * failed
+ *
+ * Ends the drag operation after a drop.
+ *
+ * The @action must be a single action selected from the actions
+ * available via gdk_drop_get_actions().
+ **/
+void
+gdk_drop_finish (GdkDrop *self,
+ GdkDragAction action)
+{
+ g_return_if_fail (GDK_IS_DROP (self));
+ g_return_if_fail (gdk_drag_action_is_unique (action));
+
+ GDK_DROP_GET_CLASS (self)->finish (self, action);
+}
+
/**
* gdk_drop_read_async:
* @self: a #GdkDrop
GDK_AVAILABLE_IN_ALL
void gdk_drop_status (GdkDrop *self,
GdkDragAction actions);
+GDK_AVAILABLE_IN_ALL
+void gdk_drop_finish (GdkDrop *self,
+ GdkDragAction action);
GDK_AVAILABLE_IN_ALL
void gdk_drop_read_async (GdkDrop *self,
GObjectClass parent_class;
void (* status) (GdkDrop *self,
+ GdkDragAction actions);
+ void (* finish) (GdkDrop *self,
GdkDragAction action);
+
void (* read_async) (GdkDrop *self,
GdkContentFormats *formats,
int io_priority,
/* FIXME: Implement */
}
-static void
-gdk_quartz_drag_context_drop_finish (GdkDragContext *context,
- gboolean success,
- guint32 time)
-{
- /* FIXME: Implement */
-}
-
void
_gdk_quartz_surface_register_dnd (GdkSurface *window)
{
context_class->drag_abort = gdk_quartz_drag_context_drag_abort;
context_class->drag_drop = gdk_quartz_drag_context_drag_drop;
- context_class->drop_finish = gdk_quartz_drag_context_drop_finish;
}
}
static void
-gdk_wayland_drag_context_drop_finish (GdkDragContext *context,
- gboolean success,
- guint32 time)
+gdk_wayland_drag_context_finish (GdkDrop *drop,
+ GdkDragAction action)
{
- GdkWaylandDragContext *wayland_context = GDK_WAYLAND_DRAG_CONTEXT (context);
- GdkDisplay *display = gdk_device_get_display (gdk_drag_context_get_device (context));
+ GdkWaylandDragContext *wayland_context = GDK_WAYLAND_DRAG_CONTEXT (drop);
+ GdkDisplay *display = gdk_drop_get_display (drop);
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
- if (success && wayland_context->selected_action &&
- wayland_context->selected_action != GDK_ACTION_ASK)
+ if (action)
{
- gdk_wayland_drag_context_commit_status (context);
+ gdk_wayland_drag_context_commit_status (GDK_DRAG_CONTEXT (drop));
if (display_wayland->data_device_manager_version >=
WL_DATA_OFFER_FINISH_SINCE_VERSION)
object_class->finalize = gdk_wayland_drag_context_finalize;
drop_class->status = gdk_wayland_drag_context_status;
+ drop_class->finish = gdk_wayland_drag_context_finish;
drop_class->read_async = gdk_wayland_drag_context_read_async;
drop_class->read_finish = gdk_wayland_drag_context_read_finish;
context_class->drag_abort = gdk_wayland_drag_context_drag_abort;
context_class->drag_drop = gdk_wayland_drag_context_drag_drop;
- context_class->drop_finish = gdk_wayland_drag_context_drop_finish;
- context_class->drop_finish = gdk_wayland_drag_context_drop_finish;
context_class->get_drag_surface = gdk_wayland_drag_context_get_drag_surface;
context_class->set_hotspot = gdk_wayland_drag_context_set_hotspot;
context_class->drop_done = gdk_wayland_drag_context_drop_done;
}
static void
-gdk_win32_drop_context_drop_finish (GdkDragContext *context,
- gboolean success,
- guint32 time)
+gdk_win32_drop_context_finish (GdkDrop *drop,
+ GdkDragAction action)
{
+ GdkDragContext *context = GDK_DRAG_CONTEXT (drop);
GdkDragContext *src_context;
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
GDK_NOTE (DND, g_print ("gdk_drag_finish\n"));
+ if (context->action != action)
+ gdk_win32_drop_context_status (context, action);
+
if (!use_ole2_dnd)
{
src_context = _gdk_win32_drag_context_find (context->source_surface,
}
else
{
- _gdk_win32_drag_do_leave (context, time);
+ _gdk_win32_drag_do_leave (context, GDK_CURRENT_TIME);
- if (success)
+ if (action)
clipdrop->dnd_target_state = GDK_WIN32_DND_DROPPED;
else
clipdrop->dnd_target_state = GDK_WIN32_DND_FAILED;
object_class->finalize = gdk_win32_drop_context_finalize;
drop_class->status = gdk_win32_drop_context_status;
+ drop_class->finish = gdk_win32_drop_context_finish;
drop_class->read_async = gdk_win32_drop_context_read_async;
drop_class->read_finish = gdk_win32_drop_context_read_finish;
-
- context_class->drop_finish = gdk_win32_drop_context_drop_finish;
}
void
guint32 time_);
static void gdk_x11_drag_context_drag_drop (GdkDragContext *context,
guint32 time_);
-static void gdk_x11_drag_context_drop_finish (GdkDragContext *context,
- gboolean success,
- guint32 time_);
+static void gdk_x11_drag_context_finish (GdkDrop *drop,
+ GdkDragAction action);
static GdkSurface * gdk_x11_drag_context_get_drag_surface (GdkDragContext *context);
static void gdk_x11_drag_context_set_hotspot (GdkDragContext *context,
gint hot_x,
object_class->finalize = gdk_x11_drag_context_finalize;
drop_class->status = gdk_x11_drag_context_status;
+ drop_class->finish = gdk_x11_drag_context_finish;
drop_class->read_async = gdk_x11_drag_context_read_async;
drop_class->read_finish = gdk_x11_drag_context_read_finish;
context_class->drag_abort = gdk_x11_drag_context_drag_abort;
context_class->drag_drop = gdk_x11_drag_context_drag_drop;
- context_class->drop_finish = gdk_x11_drag_context_drop_finish;
context_class->get_drag_surface = gdk_x11_drag_context_get_drag_surface;
context_class->set_hotspot = gdk_x11_drag_context_set_hotspot;
context_class->drop_done = gdk_x11_drag_context_drop_done;
}
static void
-gdk_x11_drag_context_drop_finish (GdkDragContext *context,
- gboolean success,
- guint32 time)
+gdk_x11_drag_context_finish (GdkDrop *drop,
+ GdkDragAction action)
{
- if (GDK_X11_DRAG_CONTEXT (context)->protocol == GDK_DRAG_PROTO_XDND)
+ if (GDK_X11_DRAG_CONTEXT (drop)->protocol == GDK_DRAG_PROTO_XDND)
{
- GdkDisplay *display = gdk_drag_context_get_display (context);
+ GdkDragContext *context = GDK_DRAG_CONTEXT (drop);
+ GdkDisplay *display = gdk_drop_get_display (drop);
XEvent xev;
- if (success && gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE)
+ if (action == GDK_ACTION_MOVE)
{
XConvertSelection (GDK_DISPLAY_XDISPLAY (display),
gdk_x11_get_xatom_by_name_for_display (display, "XdndSelection"),
gdk_x11_get_xatom_by_name_for_display (display, "DELETE"),
gdk_x11_get_xatom_by_name_for_display (display, "GDK_SELECTION"),
GDK_SURFACE_XID (context->source_surface),
- time);
+ GDK_X11_DRAG_CONTEXT (drop)->timestamp);
/* XXX: Do we need to wait for a reply here before sending the next message? */
}
xev.xclient.window = GDK_SURFACE_XID (context->source_surface);
xev.xclient.data.l[0] = GDK_SURFACE_XID (context->dest_surface);
- if (success)
+ if (action != 0)
{
xev.xclient.data.l[1] = 1;
- xev.xclient.data.l[2] = xdnd_action_to_atom (display,
- context->action);
+ xev.xclient.data.l[2] = xdnd_action_to_atom (display, action);
}
else
{