summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdk/broadway/gdkdnd-broadway.c11
-rw-r--r--gdk/gdkdnd.c5
-rw-r--r--gdk/gdkdndprivate.h3
-rw-r--r--gdk/gdkdrop.c21
-rw-r--r--gdk/gdkdrop.h3
-rw-r--r--gdk/gdkdropprivate.h3
-rw-r--r--gdk/quartz/gdkdnd-quartz.c9
-rw-r--r--gdk/wayland/gdkdnd-wayland.c17
-rw-r--r--gdk/win32/gdkdrop-win32.c16
-rw-r--r--gdk/x11/gdkdnd-x11.c26
10 files changed, 59 insertions, 55 deletions
diff --git a/gdk/broadway/gdkdnd-broadway.c b/gdk/broadway/gdkdnd-broadway.c
index 170b692451..fecf3b9c04 100644
--- a/gdk/broadway/gdkdnd-broadway.c
+++ b/gdk/broadway/gdkdnd-broadway.c
@@ -118,16 +118,6 @@ gdk_broadway_drag_context_drag_abort (GdkDragContext *context,
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)
{
@@ -148,5 +138,4 @@ gdk_broadway_drag_context_class_init (GdkBroadwayDragContextClass *klass)
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;
}
diff --git a/gdk/gdkdnd.c b/gdk/gdkdnd.c
index 126d8ea356..13267b7ffd 100644
--- a/gdk/gdkdnd.c
+++ b/gdk/gdkdnd.c
@@ -589,7 +589,10 @@ gdk_drag_finish (GdkDragContext *context,
{
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
diff --git a/gdk/gdkdndprivate.h b/gdk/gdkdndprivate.h
index 3e0055344e..5bead8248c 100644
--- a/gdk/gdkdndprivate.h
+++ b/gdk/gdkdndprivate.h
@@ -39,9 +39,6 @@ struct _GdkDragContextClass {
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,
diff --git a/gdk/gdkdrop.c b/gdk/gdkdrop.c
index 7fa7d029c7..b9c21c0776 100644
--- a/gdk/gdkdrop.c
+++ b/gdk/gdkdrop.c
@@ -378,6 +378,27 @@ gdk_drop_status (GdkDrop *self,
}
/**
+ * 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
* @mime_types: (array zero-terminated=1) (element-type utf8):
diff --git a/gdk/gdkdrop.h b/gdk/gdkdrop.h
index b044a28075..762c6891bf 100644
--- a/gdk/gdkdrop.h
+++ b/gdk/gdkdrop.h
@@ -51,6 +51,9 @@ GdkDragAction gdk_drop_get_actions (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,
diff --git a/gdk/gdkdropprivate.h b/gdk/gdkdropprivate.h
index 40a47ba53f..029e68de33 100644
--- a/gdk/gdkdropprivate.h
+++ b/gdk/gdkdropprivate.h
@@ -40,7 +40,10 @@ struct _GdkDropClass {
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,
diff --git a/gdk/quartz/gdkdnd-quartz.c b/gdk/quartz/gdkdnd-quartz.c
index f78a88284e..2b80e8e32e 100644
--- a/gdk/quartz/gdkdnd-quartz.c
+++ b/gdk/quartz/gdkdnd-quartz.c
@@ -70,14 +70,6 @@ gdk_quartz_drag_context_drag_abort (GdkDragContext *context,
/* 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)
{
@@ -111,5 +103,4 @@ gdk_quartz_drag_context_class_init (GdkQuartzDragContextClass *klass)
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;
}
diff --git a/gdk/wayland/gdkdnd-wayland.c b/gdk/wayland/gdkdnd-wayland.c
index d03af430e8..0cfebd6557 100644
--- a/gdk/wayland/gdkdnd-wayland.c
+++ b/gdk/wayland/gdkdnd-wayland.c
@@ -225,18 +225,16 @@ gdk_wayland_drag_context_status (GdkDrop *drop,
}
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)
@@ -403,13 +401,12 @@ gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
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;
diff --git a/gdk/win32/gdkdrop-win32.c b/gdk/win32/gdkdrop-win32.c
index d0b088b000..e385a37ffa 100644
--- a/gdk/win32/gdkdrop-win32.c
+++ b/gdk/win32/gdkdrop-win32.c
@@ -895,10 +895,10 @@ _gdk_display_put_event (GdkDisplay *display,
}
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 ();
@@ -906,6 +906,9 @@ gdk_win32_drop_context_drop_finish (GdkDragContext *context,
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,
@@ -921,9 +924,9 @@ gdk_win32_drop_context_drop_finish (GdkDragContext *context,
}
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;
@@ -1205,10 +1208,9 @@ gdk_win32_drop_context_class_init (GdkWin32DropContextClass *klass)
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
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index 6c061d5064..936c218e50 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -239,9 +239,8 @@ static void gdk_x11_drag_context_drag_abort (GdkDragContext *context,
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,
@@ -394,12 +393,12 @@ gdk_x11_drag_context_class_init (GdkX11DragContextClass *klass)
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;
@@ -2443,23 +2442,23 @@ gdk_x11_drag_context_status (GdkDrop *drop,
}
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? */
}
@@ -2469,11 +2468,10 @@ gdk_x11_drag_context_drop_finish (GdkDragContext *context,
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
{