summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2018-07-02 21:19:45 +0000
committerMatthias Clasen <mclasen@redhat.com>2018-07-02 21:19:45 +0000
commit12464731f1dc69a0f7105f2d7f0ba20fe9c215fa (patch)
treecdf88d5b0c32c859e908b7b96188ffdfdcd5c5ff /gdk
parent269a9d8528c69b824c28ba41cddd6e56e623326f (diff)
parentc8e082f296313f738c6943577f210a18816669a9 (diff)
downloadgtk+-12464731f1dc69a0f7105f2d7f0ba20fe9c215fa.tar.gz
Merge branch 'dnd-cleanups' into 'master'
Dnd cleanups See merge request GNOME/gtk!226
Diffstat (limited to 'gdk')
-rw-r--r--gdk/broadway/gdkdnd-broadway.c62
-rw-r--r--gdk/broadway/gdkprivate-broadway.h2
-rw-r--r--gdk/gdk-autocleanup.h2
-rw-r--r--gdk/gdk.h2
-rw-r--r--gdk/gdkdnd.h100
-rw-r--r--gdk/gdkdndprivate.h105
-rw-r--r--gdk/gdkdrag.c (renamed from gdk/gdkdnd.c)365
-rw-r--r--gdk/gdkdrag.h98
-rw-r--r--gdk/gdkdragprivate.h105
-rw-r--r--gdk/gdkdrop.c10
-rw-r--r--gdk/gdkdrop.h2
-rw-r--r--gdk/gdkevents.c4
-rw-r--r--gdk/gdkevents.h2
-rw-r--r--gdk/gdkeventsprivate.h2
-rw-r--r--gdk/gdkinternals.h2
-rw-r--r--gdk/gdksurface.c4
-rw-r--r--gdk/gdksurfaceimpl.h2
-rw-r--r--gdk/gdktypes.h4
-rw-r--r--gdk/meson.build4
-rw-r--r--gdk/wayland/gdkdevice-wayland.c8
-rw-r--r--gdk/wayland/gdkdnd-wayland.c270
-rw-r--r--gdk/wayland/gdkdrop-wayland.c2
-rw-r--r--gdk/wayland/gdkprivate-wayland.h20
-rw-r--r--gdk/wayland/gdkselection-wayland.c1
-rw-r--r--gdk/win32/gdkclipdrop-win32.c2
-rw-r--r--gdk/win32/gdkdrag-win32.c360
-rw-r--r--gdk/win32/gdkdrop-win32.c22
-rw-r--r--gdk/win32/gdkevents-win32.c4
-rw-r--r--gdk/win32/gdkprivate-win32.h12
-rw-r--r--gdk/win32/gdkwin32dnd-private.h34
-rw-r--r--gdk/win32/gdkwin32dnd.h22
-rw-r--r--gdk/x11/gdkdnd-x11.c868
-rw-r--r--gdk/x11/gdkdrop-x11.c16
-rw-r--r--gdk/x11/gdkprivate-x11.h22
-rw-r--r--gdk/x11/gdkx-autocleanups.h2
-rw-r--r--gdk/x11/gdkx11dnd.h22
36 files changed, 1279 insertions, 1285 deletions
diff --git a/gdk/broadway/gdkdnd-broadway.c b/gdk/broadway/gdkdnd-broadway.c
index fecf3b9c04..1db76f43d3 100644
--- a/gdk/broadway/gdkdnd-broadway.c
+++ b/gdk/broadway/gdkdnd-broadway.c
@@ -24,7 +24,7 @@
#include "config.h"
-#include "gdkdndprivate.h"
+#include "gdkdragprivate.h"
#include "gdkinternals.h"
#include "gdkproperty.h"
@@ -34,56 +34,56 @@
#include <string.h>
-#define GDK_TYPE_BROADWAY_DRAG_CONTEXT (gdk_broadway_drag_context_get_type ())
-#define GDK_BROADWAY_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContext))
-#define GDK_BROADWAY_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContextClass))
-#define GDK_IS_BROADWAY_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_DRAG_CONTEXT))
-#define GDK_IS_BROADWAY_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_DRAG_CONTEXT))
-#define GDK_BROADWAY_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContextClass))
+#define GDK_TYPE_BROADWAY_DRAG (gdk_broadway_drag_get_type ())
+#define GDK_BROADWAY_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_DRAG, GdkBroadwayDrag))
+#define GDK_BROADWAY_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_DRAG, GdkBroadwayDragClass))
+#define GDK_IS_BROADWAY_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_DRAG))
+#define GDK_IS_BROADWAY_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_DRAG))
+#define GDK_BROADWAY_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_DRAG, GdkBroadwayDragClass))
#ifdef GDK_COMPILATION
-typedef struct _GdkBroadwayDragContext GdkBroadwayDragContext;
+typedef struct _GdkBroadwayDrag GdkBroadwayDrag;
#else
-typedef GdkDragContext GdkBroadwayDragContext;
+typedef GdkDrag GdkBroadwayDrag;
#endif
-typedef struct _GdkBroadwayDragContextClass GdkBroadwayDragContextClass;
+typedef struct _GdkBroadwayDragClass GdkBroadwayDragClass;
-GType gdk_broadway_drag_context_get_type (void);
+GType gdk_broadway_drag_get_type (void);
-struct _GdkBroadwayDragContext {
- GdkDragContext context;
+struct _GdkBroadwayDrag {
+ GdkDrag context;
};
-struct _GdkBroadwayDragContextClass
+struct _GdkBroadwayDragClass
{
- GdkDragContextClass parent_class;
+ GdkDragClass parent_class;
};
-static void gdk_broadway_drag_context_finalize (GObject *object);
+static void gdk_broadway_drag_finalize (GObject *object);
static GList *contexts;
-G_DEFINE_TYPE (GdkBroadwayDragContext, gdk_broadway_drag_context, GDK_TYPE_DRAG_CONTEXT)
+G_DEFINE_TYPE (GdkBroadwayDrag, gdk_broadway_drag, GDK_TYPE_DRAG)
static void
-gdk_broadway_drag_context_init (GdkBroadwayDragContext *dragcontext)
+gdk_broadway_drag_init (GdkBroadwayDrag *dragcontext)
{
contexts = g_list_prepend (contexts, dragcontext);
}
static void
-gdk_broadway_drag_context_finalize (GObject *object)
+gdk_broadway_drag_finalize (GObject *object)
{
- GdkDragContext *context = GDK_DRAG_CONTEXT (object);
+ GdkDrag *context = GDK_DRAG (object);
contexts = g_list_remove (contexts, context);
- G_OBJECT_CLASS (gdk_broadway_drag_context_parent_class)->finalize (object);
+ G_OBJECT_CLASS (gdk_broadway_drag_parent_class)->finalize (object);
}
/* Drag Contexts */
-GdkDragContext *
+GdkDrag *
_gdk_broadway_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
@@ -91,12 +91,12 @@ _gdk_broadway_surface_drag_begin (GdkSurface *surface,
gint dx,
gint dy)
{
- GdkDragContext *new_context;
+ GdkDrag *new_context;
g_return_val_if_fail (surface != NULL, NULL);
g_return_val_if_fail (GDK_SURFACE_IS_BROADWAY (surface), NULL);
- new_context = g_object_new (GDK_TYPE_BROADWAY_DRAG_CONTEXT,
+ new_context = g_object_new (GDK_TYPE_BROADWAY_DRAG,
"device", device,
"content", content,
NULL);
@@ -105,14 +105,14 @@ _gdk_broadway_surface_drag_begin (GdkSurface *surface,
}
static void
-gdk_broadway_drag_context_drag_drop (GdkDragContext *context,
+gdk_broadway_drag_drag_drop (GdkDrag *context,
guint32 time)
{
g_return_if_fail (context != NULL);
}
static void
-gdk_broadway_drag_context_drag_abort (GdkDragContext *context,
+gdk_broadway_drag_drag_abort (GdkDrag *context,
guint32 time)
{
g_return_if_fail (context != NULL);
@@ -129,13 +129,13 @@ _gdk_broadway_display_init_dnd (GdkDisplay *display)
}
static void
-gdk_broadway_drag_context_class_init (GdkBroadwayDragContextClass *klass)
+gdk_broadway_drag_class_init (GdkBroadwayDragClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
+ GdkDragClass *context_class = GDK_DRAG_CLASS (klass);
- object_class->finalize = gdk_broadway_drag_context_finalize;
+ object_class->finalize = gdk_broadway_drag_finalize;
- context_class->drag_abort = gdk_broadway_drag_context_drag_abort;
- context_class->drag_drop = gdk_broadway_drag_context_drag_drop;
+ context_class->drag_abort = gdk_broadway_drag_drag_abort;
+ context_class->drag_drop = gdk_broadway_drag_drag_drop;
}
diff --git a/gdk/broadway/gdkprivate-broadway.h b/gdk/broadway/gdkprivate-broadway.h
index 737bb9ed8c..11a48a0291 100644
--- a/gdk/broadway/gdkprivate-broadway.h
+++ b/gdk/broadway/gdkprivate-broadway.h
@@ -46,7 +46,7 @@ void gdk_broadway_surface_set_nodes (GdkSurface *surface,
GPtrArray *node_textures);
void _gdk_broadway_surface_register_dnd (GdkSurface *surface);
-GdkDragContext * _gdk_broadway_surface_drag_begin (GdkSurface *surface,
+GdkDrag * _gdk_broadway_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
diff --git a/gdk/gdk-autocleanup.h b/gdk/gdk-autocleanup.h
index 7d2cc3f733..6ec5aa9ba2 100644
--- a/gdk/gdk-autocleanup.h
+++ b/gdk/gdk-autocleanup.h
@@ -27,7 +27,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkCursor, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDevice, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplay, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplayManager, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDragContext, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrag, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrawContext, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkFrameClock, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkGLContext, g_object_unref)
diff --git a/gdk/gdk.h b/gdk/gdk.h
index 3362f9aefc..a537ed341f 100644
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -44,7 +44,7 @@
#include <gdk/gdkdevicetool.h>
#include <gdk/gdkdisplay.h>
#include <gdk/gdkdisplaymanager.h>
-#include <gdk/gdkdnd.h>
+#include <gdk/gdkdrag.h>
#include <gdk/gdkdrawcontext.h>
#include <gdk/gdkdrop.h>
#include <gdk/gdkenumtypes.h>
diff --git a/gdk/gdkdnd.h b/gdk/gdkdnd.h
deleted file mode 100644
index 30e391b1ac..0000000000
--- a/gdk/gdkdnd.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#ifndef __GDK_DND_H__
-#define __GDK_DND_H__
-
-#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
-#error "Only <gdk/gdk.h> can be included directly."
-#endif
-
-#include <gdk/gdktypes.h>
-#include <gdk/gdkdevice.h>
-#include <gdk/gdkevents.h>
-
-G_BEGIN_DECLS
-
-#define GDK_TYPE_DRAG_CONTEXT (gdk_drag_context_get_type ())
-#define GDK_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAG_CONTEXT, GdkDragContext))
-#define GDK_IS_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAG_CONTEXT))
-
-/**
- * GdkDragCancelReason:
- * @GDK_DRAG_CANCEL_NO_TARGET: There is no suitable drop target.
- * @GDK_DRAG_CANCEL_USER_CANCELLED: Drag cancelled by the user
- * @GDK_DRAG_CANCEL_ERROR: Unspecified error.
- *
- * Used in #GdkDragContext to the reason of a cancelled DND operation.
- */
-typedef enum {
- GDK_DRAG_CANCEL_NO_TARGET,
- GDK_DRAG_CANCEL_USER_CANCELLED,
- GDK_DRAG_CANCEL_ERROR
-} GdkDragCancelReason;
-
-GDK_AVAILABLE_IN_ALL
-GType gdk_drag_context_get_type (void) G_GNUC_CONST;
-
-GDK_AVAILABLE_IN_ALL
-GdkDisplay * gdk_drag_context_get_display (GdkDragContext *context);
-GDK_AVAILABLE_IN_ALL
-GdkDevice * gdk_drag_context_get_device (GdkDragContext *context);
-
-GDK_AVAILABLE_IN_ALL
-GdkContentFormats *gdk_drag_context_get_formats (GdkDragContext *context);
-GDK_AVAILABLE_IN_ALL
-GdkDragAction gdk_drag_context_get_actions (GdkDragContext *context);
-GDK_AVAILABLE_IN_ALL
-GdkDragAction gdk_drag_context_get_suggested_action (GdkDragContext *context);
-GDK_AVAILABLE_IN_ALL
-GdkDragAction gdk_drag_context_get_selected_action (GdkDragContext *context);
-
-GDK_AVAILABLE_IN_ALL
-gboolean gdk_drag_action_is_unique (GdkDragAction action);
-
-/* Source side */
-
-GDK_AVAILABLE_IN_ALL
-GdkDragContext * gdk_drag_begin (GdkSurface *surface,
- GdkDevice *device,
- GdkContentProvider *content,
- GdkDragAction actions,
- gint dx,
- gint dy);
-
-GDK_AVAILABLE_IN_ALL
-void gdk_drag_drop_done (GdkDragContext *context,
- gboolean success);
-
-GDK_AVAILABLE_IN_ALL
-GdkSurface *gdk_drag_context_get_drag_surface (GdkDragContext *context);
-
-GDK_AVAILABLE_IN_ALL
-void gdk_drag_context_set_hotspot (GdkDragContext *context,
- gint hot_x,
- gint hot_y);
-
-G_END_DECLS
-
-#endif /* __GDK_DND_H__ */
diff --git a/gdk/gdkdndprivate.h b/gdk/gdkdndprivate.h
deleted file mode 100644
index 0e586ca979..0000000000
--- a/gdk/gdkdndprivate.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 2010, Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __GDK_DND_PRIVATE_H__
-#define __GDK_DND_PRIVATE_H__
-
-#include "gdkdnd.h"
-
-G_BEGIN_DECLS
-
-
-#define GDK_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
-#define GDK_IS_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAG_CONTEXT))
-#define GDK_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
-
-typedef struct _GdkDragContextClass GdkDragContextClass;
-
-
-struct _GdkDragContextClass {
- GObjectClass parent_class;
-
- void (*drag_abort) (GdkDragContext *context,
- guint32 time_);
- void (*drag_drop) (GdkDragContext *context,
- guint32 time_);
- GdkSurface* (*get_drag_surface) (GdkDragContext *context);
- void (*set_hotspot) (GdkDragContext *context,
- gint hot_x,
- gint hot_y);
- void (*drop_done) (GdkDragContext *context,
- gboolean success);
-
- void (*set_cursor) (GdkDragContext *context,
- GdkCursor *cursor);
- void (*cancel) (GdkDragContext *context,
- GdkDragCancelReason reason);
- void (*drop_performed) (GdkDragContext *context,
- guint32 time);
- void (*dnd_finished) (GdkDragContext *context);
-
- gboolean (*handle_event) (GdkDragContext *context,
- const GdkEvent *event);
- void (*action_changed) (GdkDragContext *context,
- GdkDragAction action);
-};
-
-struct _GdkDragContext {
- GObject parent_instance;
-
- /*< private >*/
- GdkSurface *source_surface;
- GdkSurface *drag_surface;
-
- GdkContentProvider *content;
- GdkDragAction action;
-
- guint drop_done : 1; /* Whether gdk_drag_drop_done() was performed */
-};
-
-void gdk_drag_context_set_cursor (GdkDragContext *context,
- GdkCursor *cursor);
-void gdk_drag_context_set_actions (GdkDragContext *context,
- GdkDragAction actions,
- GdkDragAction suggested_action);
-
-void gdk_drag_context_cancel (GdkDragContext *context,
- GdkDragCancelReason reason);
-gboolean gdk_drag_context_handle_source_event (GdkEvent *event);
-GdkCursor * gdk_drag_get_cursor (GdkDragContext *context,
- GdkDragAction action);
-
-void gdk_drag_abort (GdkDragContext *context,
- guint32 time_);
-void gdk_drag_drop (GdkDragContext *context,
- guint32 time_);
-
-void gdk_drag_context_write_async (GdkDragContext *context,
- const char *mime_type,
- GOutputStream *stream,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-gboolean gdk_drag_context_write_finish (GdkDragContext *context,
- GAsyncResult *result,
- GError **error);
-
-
-G_END_DECLS
-
-#endif
diff --git a/gdk/gdkdnd.c b/gdk/gdkdrag.c
index bf42a561f5..2e8efb8e71 100644
--- a/gdk/gdkdnd.c
+++ b/gdk/gdkdrag.c
@@ -24,7 +24,7 @@
#include "config.h"
-#include "gdkdndprivate.h"
+#include "gdkdragprivate.h"
#include "gdkdisplay.h"
#include "gdksurface.h"
#include "gdkintl.h"
@@ -35,9 +35,9 @@
#include "gdkenumtypes.h"
#include "gdkeventsprivate.h"
-typedef struct _GdkDragContextPrivate GdkDragContextPrivate;
+typedef struct _GdkDragPrivate GdkDragPrivate;
-struct _GdkDragContextPrivate
+struct _GdkDragPrivate
{
GdkDisplay *display;
GdkDevice *device;
@@ -77,9 +77,9 @@ enum {
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
static guint signals[N_SIGNALS] = { 0 };
-static GList *contexts = NULL;
+static GList *drags = NULL;
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDragContext, gdk_drag_context, G_TYPE_OBJECT)
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDrag, gdk_drag, G_TYPE_OBJECT)
/**
* SECTION:dnd
@@ -98,142 +98,142 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDragContext, gdk_drag_context, G_TYPE_OB
*/
/**
- * GdkDragContext:
+ * GdkDrag:
*
- * The GdkDragContext struct contains only private fields and
+ * The GdkDrag struct contains only private fields and
* should not be accessed directly.
*/
/**
- * gdk_drag_context_get_display:
- * @context: a #GdkDragContext
+ * gdk_drag_get_display:
+ * @drag: a #GdkDrag
*
- * Gets the #GdkDisplay that the drag context was created for.
+ * Gets the #GdkDisplay that the drag object was created for.
*
* Returns: (transfer none): a #GdkDisplay
**/
GdkDisplay *
-gdk_drag_context_get_display (GdkDragContext *context)
+gdk_drag_get_display (GdkDrag *drag)
{
- GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
+ GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
- g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
+ g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
return priv->display;
}
/**
- * gdk_drag_context_get_formats:
- * @context: a #GdkDragContext
+ * gdk_drag_get_formats:
+ * @drag: a #GdkDrag
*
- * Retrieves the formats supported by this context.
+ * Retrieves the formats supported by this GdkDrag object.
*
* Returns: (transfer none): a #GdkContentFormats
**/
GdkContentFormats *
-gdk_drag_context_get_formats (GdkDragContext *context)
+gdk_drag_get_formats (GdkDrag *drag)
{
- GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
+ GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
- g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
+ g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
return priv->formats;
}
/**
- * gdk_drag_context_get_actions:
- * @context: a #GdkDragContext
+ * gdk_drag_get_actions:
+ * @drag: a #GdkDrag
*
* Determines the bitmask of actions proposed by the source if
- * gdk_drag_context_get_suggested_action() returns %GDK_ACTION_ASK.
+ * gdk_drag_get_suggested_action() returns %GDK_ACTION_ASK.
*
* Returns: the #GdkDragAction flags
**/
GdkDragAction
-gdk_drag_context_get_actions (GdkDragContext *context)
+gdk_drag_get_actions (GdkDrag *drag)
{
- GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
+ GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
- g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
+ g_return_val_if_fail (GDK_IS_DRAG (drag), 0);
return priv->actions;
}
/**
- * gdk_drag_context_get_suggested_action:
- * @context: a #GdkDragContext
+ * gdk_drag_get_suggested_action:
+ * @drag: a #GdkDrag
*
- * Determines the suggested drag action of the context.
+ * Determines the suggested drag action of the GdkDrag object.
*
* Returns: a #GdkDragAction value
**/
GdkDragAction
-gdk_drag_context_get_suggested_action (GdkDragContext *context)
+gdk_drag_get_suggested_action (GdkDrag *drag)
{
- GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
+ GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
- g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
+ g_return_val_if_fail (GDK_IS_DRAG (drag), 0);
return priv->suggested_action;
}
/**
- * gdk_drag_context_get_selected_action:
- * @context: a #GdkDragContext
+ * gdk_drag_get_selected_action:
+ * @drag: a #GdkDrag
*
* Determines the action chosen by the drag destination.
*
* Returns: a #GdkDragAction value
**/
GdkDragAction
-gdk_drag_context_get_selected_action (GdkDragContext *context)
+gdk_drag_get_selected_action (GdkDrag *drag)
{
- g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
+ g_return_val_if_fail (GDK_IS_DRAG (drag), 0);
- return context->action;
+ return drag->action;
}
/**
- * gdk_drag_context_get_device:
- * @context: a #GdkDragContext
+ * gdk_drag_get_device:
+ * @drag: a #GdkDrag
*
- * Returns the #GdkDevice associated to the drag context.
+ * Returns the #GdkDevice associated to the GdkDrag object.
*
- * Returns: (transfer none): The #GdkDevice associated to @context.
+ * Returns: (transfer none): The #GdkDevice associated to @drag.
**/
GdkDevice *
-gdk_drag_context_get_device (GdkDragContext *context)
+gdk_drag_get_device (GdkDrag *drag)
{
- GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
+ GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
- g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
+ g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
return priv->device;
}
static void
-gdk_drag_context_init (GdkDragContext *context)
+gdk_drag_init (GdkDrag *drag)
{
- contexts = g_list_prepend (contexts, context);
+ drags = g_list_prepend (drags, drag);
}
static void
-gdk_drag_context_set_property (GObject *gobject,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+gdk_drag_set_property (GObject *gobject,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GdkDragContext *context = GDK_DRAG_CONTEXT (gobject);
- GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
+ GdkDrag *drag = GDK_DRAG (gobject);
+ GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
switch (prop_id)
{
case PROP_CONTENT:
- context->content = g_value_dup_object (value);
- if (context->content)
+ drag->content = g_value_dup_object (value);
+ if (drag->content)
{
g_assert (priv->formats == NULL);
- priv->formats = gdk_content_provider_ref_formats (context->content);
+ priv->formats = gdk_content_provider_ref_formats (drag->content);
}
break;
@@ -267,18 +267,18 @@ gdk_drag_context_set_property (GObject *gobject,
}
static void
-gdk_drag_context_get_property (GObject *gobject,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+gdk_drag_get_property (GObject *gobject,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- GdkDragContext *context = GDK_DRAG_CONTEXT (gobject);
- GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
+ GdkDrag *drag = GDK_DRAG (gobject);
+ GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
switch (prop_id)
{
case PROP_CONTENT:
- g_value_set_object (value, context->content);
+ g_value_set_object (value, drag->content);
break;
case PROP_DEVICE:
@@ -300,36 +300,35 @@ gdk_drag_context_get_property (GObject *gobject,
}
static void
-gdk_drag_context_finalize (GObject *object)
+gdk_drag_finalize (GObject *object)
{
- GdkDragContext *context = GDK_DRAG_CONTEXT (object);
- GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
+ GdkDrag *drag = GDK_DRAG (object);
+ GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
- contexts = g_list_remove (contexts, context);
+ drags = g_list_remove (drags, drag);
- g_clear_object (&context->content);
+ g_clear_object (&drag->content);
g_clear_pointer (&priv->formats, gdk_content_formats_unref);
- if (context->source_surface)
- g_object_unref (context->source_surface);
+ if (drag->source_surface)
+ g_object_unref (drag->source_surface);
- G_OBJECT_CLASS (gdk_drag_context_parent_class)->finalize (object);
+ G_OBJECT_CLASS (gdk_drag_parent_class)->finalize (object);
}
static void
-gdk_drag_context_class_init (GdkDragContextClass *klass)
+gdk_drag_class_init (GdkDragClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->get_property = gdk_drag_context_get_property;
- object_class->set_property = gdk_drag_context_set_property;
- object_class->finalize = gdk_drag_context_finalize;
+ object_class->get_property = gdk_drag_get_property;
+ object_class->set_property = gdk_drag_set_property;
+ object_class->finalize = gdk_drag_finalize;
/**
- * GdkDragContext:content:
+ * GdkDrag:content:
*
- * The #GdkContentProvider or %NULL if the context is not a source-side
- * context.
+ * The #GdkContentProvider.
*/
properties[PROP_CONTENT] =
g_param_spec_object ("content",
@@ -342,7 +341,7 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
G_PARAM_EXPLICIT_NOTIFY);
/**
- * GdkDragContext:device:
+ * GdkDrag:device:
*
* The #GdkDevice that is performing the drag.
*/
@@ -357,9 +356,9 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
G_PARAM_EXPLICIT_NOTIFY);
/**
- * GdkDragContext:display:
+ * GdkDrag:display:
*
- * The #GdkDisplay that the drag context belongs to.
+ * The #GdkDisplay that the drag belongs to.
*/
properties[PROP_DISPLAY] =
g_param_spec_object ("display",
@@ -371,9 +370,9 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
G_PARAM_EXPLICIT_NOTIFY);
/**
- * GdkDragContext:formats:
+ * GdkDrag:formats:
*
- * The possible formats that the context can provide its data in.
+ * The possible formats that the drag can provide its data in.
*/
properties[PROP_FORMATS] =
g_param_spec_boxed ("formats",
@@ -386,65 +385,65 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
G_PARAM_EXPLICIT_NOTIFY);
/**
- * GdkDragContext::cancel:
- * @context: The object on which the signal is emitted
- * @reason: The reason the context was cancelled
+ * GdkDrag::cancel:
+ * @drag: The object on which the signal is emitted
+ * @reason: The reason the drag was cancelled
*
- * The drag and drop operation was cancelled.
+ * The drag operation was cancelled.
*/
signals[CANCEL] =
g_signal_new (g_intern_static_string ("cancel"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdkDragContextClass, cancel),
+ G_STRUCT_OFFSET (GdkDragClass, cancel),
NULL, NULL,
g_cclosure_marshal_VOID__ENUM,
G_TYPE_NONE, 1, GDK_TYPE_DRAG_CANCEL_REASON);
/**
- * GdkDragContext::drop-performed:
- * @context: The object on which the signal is emitted
+ * GdkDrag::drop-performed:
+ * @drag: The object on which the signal is emitted
*
- * The drag and drop operation was performed on an accepting client.
+ * The drag operation was performed on an accepting client.
*/
signals[DROP_PERFORMED] =
g_signal_new (g_intern_static_string ("drop-performed"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdkDragContextClass, drop_performed),
+ G_STRUCT_OFFSET (GdkDragClass, drop_performed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
- * GdkDragContext::dnd-finished:
- * @context: The object on which the signal is emitted
+ * GdkDrag::dnd-finished:
+ * @drag: The object on which the signal is emitted
*
- * The drag and drop operation was finished, the drag destination
- * finished reading all data. The drag source can now free all
- * miscellaneous data.
+ * The drag operation was finished, the destination
+ * finished reading all data. The drag object can now
+ * free all miscellaneous data.
*/
signals[DND_FINISHED] =
g_signal_new (g_intern_static_string ("dnd-finished"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdkDragContextClass, dnd_finished),
+ G_STRUCT_OFFSET (GdkDragClass, dnd_finished),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
- * GdkDragContext::action-changed:
- * @context: The object on which the signal is emitted
+ * GdkDrag::action-changed:
+ * @drag: The object on which the signal is emitted
* @action: The action currently chosen
*
- * A new action is being chosen for the drag and drop operation.
+ * A new action is being chosen for the drag operation.
*/
signals[ACTION_CHANGED] =
g_signal_new (g_intern_static_string ("action-changed"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdkDragContextClass, action_changed),
+ G_STRUCT_OFFSET (GdkDragClass, action_changed),
NULL, NULL,
g_cclosure_marshal_VOID__FLAGS,
G_TYPE_NONE, 1, GDK_TYPE_DRAG_ACTION);
@@ -454,7 +453,7 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
/*
* gdk_drag_abort:
- * @context: a #GdkDragContext
+ * @drag: a #GdkDrag
* @time_: the timestamp for this operation
*
* Aborts a drag without dropping.
@@ -462,17 +461,17 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
* This function is called by the drag source.
*/
void
-gdk_drag_abort (GdkDragContext *context,
- guint32 time_)
+gdk_drag_abort (GdkDrag *drag,
+ guint32 time_)
{
- g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+ g_return_if_fail (GDK_IS_DRAG (drag));
- GDK_DRAG_CONTEXT_GET_CLASS (context)->drag_abort (context, time_);
+ GDK_DRAG_GET_CLASS (drag)->drag_abort (drag, time_);
}
/*
* gdk_drag_drop:
- * @context: a #GdkDragContext
+ * @drag: a #GdkDrag
* @time_: the timestamp for this operation
*
* Drops on the current destination.
@@ -480,18 +479,18 @@ gdk_drag_abort (GdkDragContext *context,
* This function is called by the drag source.
*/
void
-gdk_drag_drop (GdkDragContext *context,
- guint32 time_)
+gdk_drag_drop (GdkDrag *drag,
+ guint32 time_)
{
- g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+ g_return_if_fail (GDK_IS_DRAG (drag));
- GDK_DRAG_CONTEXT_GET_CLASS (context)->drag_drop (context, time_);
+ GDK_DRAG_GET_CLASS (drag)->drag_drop (drag, time_);
}
static void
-gdk_drag_context_write_done (GObject *content,
- GAsyncResult *result,
- gpointer task)
+gdk_drag_write_done (GObject *content,
+ GAsyncResult *result,
+ gpointer task)
{
GError *error = NULL;
@@ -504,9 +503,9 @@ gdk_drag_context_write_done (GObject *content,
}
static void
-gdk_drag_context_write_serialize_done (GObject *content,
- GAsyncResult *result,
- gpointer task)
+gdk_drag_write_serialize_done (GObject *content,
+ GAsyncResult *result,
+ gpointer task)
{
GError *error = NULL;
@@ -519,39 +518,39 @@ gdk_drag_context_write_serialize_done (GObject *content,
}
void
-gdk_drag_context_write_async (GdkDragContext *context,
- const char *mime_type,
- GOutputStream *stream,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+gdk_drag_write_async (GdkDrag *drag,
+ const char *mime_type,
+ GOutputStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GdkContentFormats *formats, *mime_formats;
GTask *task;
GType gtype;
- g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
- g_return_if_fail (context->content);
+ g_return_if_fail (GDK_IS_DRAG (drag));
+ g_return_if_fail (drag->content);
g_return_if_fail (mime_type != NULL);
g_return_if_fail (mime_type == g_intern_string (mime_type));
g_return_if_fail (G_IS_OUTPUT_STREAM (stream));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
g_return_if_fail (callback != NULL);
- task = g_task_new (context, cancellable, callback, user_data);
+ task = g_task_new (drag, cancellable, callback, user_data);
g_task_set_priority (task, io_priority);
- g_task_set_source_tag (task, gdk_drag_context_write_async);
+ g_task_set_source_tag (task, gdk_drag_write_async);
- formats = gdk_content_provider_ref_formats (context->content);
+ formats = gdk_content_provider_ref_formats (drag->content);
if (gdk_content_formats_contain_mime_type (formats, mime_type))
{
- gdk_content_provider_write_mime_type_async (context->content,
+ gdk_content_provider_write_mime_type_async (drag->content,
mime_type,
stream,
io_priority,
cancellable,
- gdk_drag_context_write_done,
+ gdk_drag_write_done,
task);
gdk_content_formats_unref (formats);
return;
@@ -568,14 +567,14 @@ gdk_drag_context_write_async (GdkDragContext *context,
g_assert (gtype != G_TYPE_INVALID);
g_value_init (&value, gtype);
- if (gdk_content_provider_get_value (context->content, &value, &error))
+ if (gdk_content_provider_get_value (drag->content, &value, &error))
{
gdk_content_serialize_async (stream,
mime_type,
&value,
io_priority,
cancellable,
- gdk_drag_context_write_serialize_done,
+ gdk_drag_write_serialize_done,
g_object_ref (task));
}
else
@@ -597,54 +596,54 @@ gdk_drag_context_write_async (GdkDragContext *context,
}
gboolean
-gdk_drag_context_write_finish (GdkDragContext *context,
- GAsyncResult *result,
- GError **error)
+gdk_drag_write_finish (GdkDrag *drag,
+ GAsyncResult *result,
+ GError **error)
{
- g_return_val_if_fail (g_task_is_valid (result, context), FALSE);
- g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_drag_context_write_async, FALSE);
+ g_return_val_if_fail (g_task_is_valid (result, drag), FALSE);
+ g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_drag_write_async, FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
}
void
-gdk_drag_context_set_actions (GdkDragContext *context,
- GdkDragAction actions,
- GdkDragAction suggested_action)
+gdk_drag_set_actions (GdkDrag *drag,
+ GdkDragAction actions,
+ GdkDragAction suggested_action)
{
- GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
+ GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
priv->actions = actions;
priv->suggested_action = suggested_action;
}
/**
- * gdk_drag_context_get_drag_surface:
- * @context: a #GdkDragContext
+ * gdk_drag_get_drag_surface:
+ * @drag: a #GdkDrag
*
* Returns the surface on which the drag icon should be rendered
* during the drag operation. Note that the surface may not be
* available until the drag operation has begun. GDK will move
* the surface in accordance with the ongoing drag operation.
- * The surface is owned by @context and will be destroyed when
+ * The surface is owned by @drag and will be destroyed when
* the drag operation is over.
*
* Returns: (nullable) (transfer none): the drag surface, or %NULL
*/
GdkSurface *
-gdk_drag_context_get_drag_surface (GdkDragContext *context)
+gdk_drag_get_drag_surface (GdkDrag *drag)
{
- g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
+ g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
- if (GDK_DRAG_CONTEXT_GET_CLASS (context)->get_drag_surface)
- return GDK_DRAG_CONTEXT_GET_CLASS (context)->get_drag_surface (context);
+ if (GDK_DRAG_GET_CLASS (drag)->get_drag_surface)
+ return GDK_DRAG_GET_CLASS (drag)->get_drag_surface (drag);
return NULL;
}
/**
- * gdk_drag_context_set_hotspot:
- * @context: a #GdkDragContext
+ * gdk_drag_set_hotspot:
+ * @drag: a #GdkDrag
* @hot_x: x coordinate of the drag surface hotspot
* @hot_y: y coordinate of the drag surface hotspot
*
@@ -653,19 +652,19 @@ gdk_drag_context_get_drag_surface (GdkDragContext *context)
* top left corner of the drag surface.
*/
void
-gdk_drag_context_set_hotspot (GdkDragContext *context,
- gint hot_x,
- gint hot_y)
+gdk_drag_set_hotspot (GdkDrag *drag,
+ gint hot_x,
+ gint hot_y)
{
- g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+ g_return_if_fail (GDK_IS_DRAG (drag));
- if (GDK_DRAG_CONTEXT_GET_CLASS (context)->set_hotspot)
- GDK_DRAG_CONTEXT_GET_CLASS (context)->set_hotspot (context, hot_x, hot_y);
+ if (GDK_DRAG_GET_CLASS (drag)->set_hotspot)
+ GDK_DRAG_GET_CLASS (drag)->set_hotspot (drag, hot_x, hot_y);
}
/**
* gdk_drag_drop_done:
- * @context: a #GdkDragContext
+ * @drag: a #GdkDrag
* @success: whether the drag was ultimatively successful
*
* Inform GDK if the drop ended successfully. Passing %FALSE
@@ -673,60 +672,60 @@ gdk_drag_context_set_hotspot (GdkDragContext *context,
*
* This function is called by the drag source, and should
* be the last call before dropping the reference to the
- * @context.
+ * @drag.
*
- * The #GdkDragContext will only take the first gdk_drag_drop_done()
+ * The #GdkDrag will only take the first gdk_drag_drop_done()
* call as effective, if this function is called multiple times,
* all subsequent calls will be ignored.
*/
void
-gdk_drag_drop_done (GdkDragContext *context,
- gboolean success)
+gdk_drag_drop_done (GdkDrag *drag,
+ gboolean success)
{
- g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+ g_return_if_fail (GDK_IS_DRAG (drag));
- if (context->drop_done)
+ if (drag->drop_done)
return;
- context->drop_done = TRUE;
+ drag->drop_done = TRUE;
- if (GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_done)
- GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_done (context, success);
+ if (GDK_DRAG_GET_CLASS (drag)->drop_done)
+ GDK_DRAG_GET_CLASS (drag)->drop_done (drag, success);
}
void
-gdk_drag_context_set_cursor (GdkDragContext *context,
- GdkCursor *cursor)
+gdk_drag_set_cursor (GdkDrag *drag,
+ GdkCursor *cursor)
{
- g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+ g_return_if_fail (GDK_IS_DRAG (drag));
- if (GDK_DRAG_CONTEXT_GET_CLASS (context)->set_cursor)
- GDK_DRAG_CONTEXT_GET_CLASS (context)->set_cursor (context, cursor);
+ if (GDK_DRAG_GET_CLASS (drag)->set_cursor)
+ GDK_DRAG_GET_CLASS (drag)->set_cursor (drag, cursor);
}
void
-gdk_drag_context_cancel (GdkDragContext *context,
- GdkDragCancelReason reason)
+gdk_drag_cancel (GdkDrag *drag,
+ GdkDragCancelReason reason)
{
- g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+ g_return_if_fail (GDK_IS_DRAG (drag));
- g_signal_emit (context, signals[CANCEL], 0, reason);
+ g_signal_emit (drag, signals[CANCEL], 0, reason);
}
gboolean
-gdk_drag_context_handle_source_event (GdkEvent *event)
+gdk_drag_handle_source_event (GdkEvent *event)
{
- GdkDragContext *context;
+ GdkDrag *drag;
GList *l;
- for (l = contexts; l; l = l->next)
+ for (l = drags; l; l = l->next)
{
- context = l->data;
+ drag = l->data;
- if (!GDK_DRAG_CONTEXT_GET_CLASS (context)->handle_event)
+ if (!GDK_DRAG_GET_CLASS (drag)->handle_event)
continue;
- if (GDK_DRAG_CONTEXT_GET_CLASS (context)->handle_event (context, event))
+ if (GDK_DRAG_GET_CLASS (drag)->handle_event (drag, event))
return TRUE;
}
@@ -734,8 +733,8 @@ gdk_drag_context_handle_source_event (GdkEvent *event)
}
GdkCursor *
-gdk_drag_get_cursor (GdkDragContext *context,
- GdkDragAction action)
+gdk_drag_get_cursor (GdkDrag *drag,
+ GdkDragAction action)
{
gint i;
diff --git a/gdk/gdkdrag.h b/gdk/gdkdrag.h
new file mode 100644
index 0000000000..dd24c72fb1
--- /dev/null
+++ b/gdk/gdkdrag.h
@@ -0,0 +1,98 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __GDK_DND_H__
+#define __GDK_DND_H__
+
+#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only <gdk/gdk.h> can be included directly."
+#endif
+
+#include <gdk/gdktypes.h>
+#include <gdk/gdkdevice.h>
+#include <gdk/gdkevents.h>
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_DRAG (gdk_drag_get_type ())
+#define GDK_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAG, GdkDrag))
+#define GDK_IS_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAG))
+
+/**
+ * GdkDragCancelReason:
+ * @GDK_DRAG_CANCEL_NO_TARGET: There is no suitable drop target.
+ * @GDK_DRAG_CANCEL_USER_CANCELLED: Drag cancelled by the user
+ * @GDK_DRAG_CANCEL_ERROR: Unspecified error.
+ *
+ * Used in #GdkDrag to the reason of a cancelled DND operation.
+ */
+typedef enum {
+ GDK_DRAG_CANCEL_NO_TARGET,
+ GDK_DRAG_CANCEL_USER_CANCELLED,
+ GDK_DRAG_CANCEL_ERROR
+} GdkDragCancelReason;
+
+GDK_AVAILABLE_IN_ALL
+GType gdk_drag_get_type (void) G_GNUC_CONST;
+
+GDK_AVAILABLE_IN_ALL
+GdkDisplay * gdk_drag_get_display (GdkDrag *drag);
+GDK_AVAILABLE_IN_ALL
+GdkDevice * gdk_drag_get_device (GdkDrag *drag);
+
+GDK_AVAILABLE_IN_ALL
+GdkContentFormats *gdk_drag_get_formats (GdkDrag *drag);
+GDK_AVAILABLE_IN_ALL
+GdkDragAction gdk_drag_get_actions (GdkDrag *drag);
+GDK_AVAILABLE_IN_ALL
+GdkDragAction gdk_drag_get_suggested_action (GdkDrag *drag);
+GDK_AVAILABLE_IN_ALL
+GdkDragAction gdk_drag_get_selected_action (GdkDrag *drag);
+
+GDK_AVAILABLE_IN_ALL
+gboolean gdk_drag_action_is_unique (GdkDragAction action);
+
+GDK_AVAILABLE_IN_ALL
+GdkDrag * gdk_drag_begin (GdkSurface *surface,
+ GdkDevice *device,
+ GdkContentProvider *content,
+ GdkDragAction actions,
+ gint dx,
+ gint dy);
+
+GDK_AVAILABLE_IN_ALL
+void gdk_drag_drop_done (GdkDrag *drag,
+ gboolean success);
+
+GDK_AVAILABLE_IN_ALL
+GdkSurface *gdk_drag_get_drag_surface (GdkDrag *drag);
+
+GDK_AVAILABLE_IN_ALL
+void gdk_drag_set_hotspot (GdkDrag *drag,
+ gint hot_x,
+ gint hot_y);
+
+G_END_DECLS
+
+#endif /* __GDK_DND_H__ */
diff --git a/gdk/gdkdragprivate.h b/gdk/gdkdragprivate.h
new file mode 100644
index 0000000000..01a87ef632
--- /dev/null
+++ b/gdk/gdkdragprivate.h
@@ -0,0 +1,105 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2010, Red Hat, Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GDK_DND_PRIVATE_H__
+#define __GDK_DND_PRIVATE_H__
+
+#include "gdkdrag.h"
+
+G_BEGIN_DECLS
+
+
+#define GDK_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAG, GdkDragClass))
+#define GDK_IS_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAG))
+#define GDK_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAG, GdkDragClass))
+
+typedef struct _GdkDragClass GdkDragClass;
+
+
+struct _GdkDragClass {
+ GObjectClass parent_class;
+
+ void (*drag_abort) (GdkDrag *drag,
+ guint32 time_);
+ void (*drag_drop) (GdkDrag *drag,
+ guint32 time_);
+ GdkSurface* (*get_drag_surface) (GdkDrag *drag);
+ void (*set_hotspot) (GdkDrag *drag,
+ gint hot_x,
+ gint hot_y);
+ void (*drop_done) (GdkDrag *drag,
+ gboolean success);
+
+ void (*set_cursor) (GdkDrag *drag,
+ GdkCursor *cursor);
+ void (*cancel) (GdkDrag *drag,
+ GdkDragCancelReason reason);
+ void (*drop_performed) (GdkDrag *drag,
+ guint32 time);
+ void (*dnd_finished) (GdkDrag *drag);
+
+ gboolean (*handle_event) (GdkDrag *drag,
+ const GdkEvent *event);
+ void (*action_changed) (GdkDrag *drag,
+ GdkDragAction action);
+};
+
+struct _GdkDrag {
+ GObject parent_instance;
+
+ /*< private >*/
+ GdkSurface *source_surface;
+ GdkSurface *drag_surface;
+
+ GdkContentProvider *content;
+ GdkDragAction action;
+
+ guint drop_done : 1; /* Whether gdk_drag_drop_done() was performed */
+};
+
+void gdk_drag_set_cursor (GdkDrag *drag,
+ GdkCursor *cursor);
+void gdk_drag_set_actions (GdkDrag *drag,
+ GdkDragAction actions,
+ GdkDragAction suggested_action);
+
+void gdk_drag_cancel (GdkDrag *drag,
+ GdkDragCancelReason reason);
+gboolean gdk_drag_handle_source_event (GdkEvent *event);
+GdkCursor * gdk_drag_get_cursor (GdkDrag *drag,
+ GdkDragAction action);
+
+void gdk_drag_abort (GdkDrag *drag,
+ guint32 time_);
+void gdk_drag_drop (GdkDrag *drag,
+ guint32 time_);
+
+void gdk_drag_write_async (GdkDrag *drag,
+ const char *mime_type,
+ GOutputStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean gdk_drag_write_finish (GdkDrag *drag,
+ GAsyncResult *result,
+ GError **error);
+
+
+G_END_DECLS
+
+#endif
diff --git a/gdk/gdkdrop.c b/gdk/gdkdrop.c
index bdcc3866d0..03bc1e2485 100644
--- a/gdk/gdkdrop.c
+++ b/gdk/gdkdrop.c
@@ -38,7 +38,7 @@ typedef struct _GdkDropPrivate GdkDropPrivate;
struct _GdkDropPrivate {
GdkDevice *device;
- GdkDragContext *drag;
+ GdkDrag *drag;
GdkContentFormats *formats;
GdkSurface *surface;
GdkDragAction actions;
@@ -78,7 +78,7 @@ gdk_drop_read_local_write_done (GObject *drag,
gpointer stream)
{
/* we don't care about the error, we just want to clean up */
- gdk_drag_context_write_finish (GDK_DRAG_CONTEXT (drag), result, NULL);
+ gdk_drag_write_finish (GDK_DRAG (drag), result, NULL);
/* XXX: Do we need to close_async() here? */
g_output_stream_close (stream, NULL, NULL);
@@ -122,7 +122,7 @@ gdk_drop_read_local_async (GdkDrop *self,
stream = gdk_pipe_io_stream_new ();
output_stream = g_io_stream_get_output_stream (stream);
- gdk_drag_context_write_async (priv->drag,
+ gdk_drag_write_async (priv->drag,
mime_type,
output_stream,
io_priority,
@@ -321,7 +321,7 @@ gdk_drop_class_init (GdkDropClass *klass)
g_param_spec_object ("drag",
"Drag",
"The drag that initiated this drop",
- GDK_TYPE_DRAG_CONTEXT,
+ GDK_TYPE_DRAG,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS |
@@ -492,7 +492,7 @@ gdk_drop_set_actions (GdkDrop *self,
*
* Returns: (transfer none) (nullable): the corresponding #GdkDrag
**/
-GdkDragContext *
+GdkDrag *
gdk_drop_get_drag (GdkDrop *self)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
diff --git a/gdk/gdkdrop.h b/gdk/gdkdrop.h
index 0965df8019..e2f26e1822 100644
--- a/gdk/gdkdrop.h
+++ b/gdk/gdkdrop.h
@@ -50,7 +50,7 @@ GdkContentFormats * gdk_drop_get_formats (GdkDrop
GDK_AVAILABLE_IN_ALL
GdkDragAction gdk_drop_get_actions (GdkDrop *self);
GDK_AVAILABLE_IN_ALL
-GdkDragContext * gdk_drop_get_drag (GdkDrop *self);
+GdkDrag * gdk_drop_get_drag (GdkDrop *self);
GDK_AVAILABLE_IN_ALL
void gdk_drop_status (GdkDrop *self,
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 178bbd3b85..e648110212 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -28,7 +28,7 @@
#include "gdkeventsprivate.h"
#include "gdkinternals.h"
#include "gdkdisplayprivate.h"
-#include "gdkdndprivate.h"
+#include "gdkdragprivate.h"
#include "gdkdropprivate.h"
#include "gdk-private.h"
@@ -165,7 +165,7 @@ gdk_event_class_init (GdkEventClass *klass)
void
_gdk_event_emit (GdkEvent *event)
{
- if (gdk_drag_context_handle_source_event (event))
+ if (gdk_drag_handle_source_event (event))
return;
if (_gdk_event_func)
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index e8577af1a1..f496502ad2 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -31,7 +31,7 @@
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
-#include <gdk/gdkdnd.h>
+#include <gdk/gdkdrag.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdkdevicetool.h>
diff --git a/gdk/gdkeventsprivate.h b/gdk/gdkeventsprivate.h
index b706c6f383..a7ab6a88ab 100644
--- a/gdk/gdkeventsprivate.h
+++ b/gdk/gdkeventsprivate.h
@@ -26,7 +26,7 @@
#define __GDK_EVENTS_PRIVATE_H__
#include <gdk/gdktypes.h>
-#include <gdk/gdkdnd.h>
+#include <gdk/gdkdrag.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdkdevicetool.h>
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index f77ed09e6f..69b5f844f1 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -32,7 +32,7 @@
#include "gdkdisplay.h"
#include "gdkeventsprivate.h"
#include "gdkenumtypes.h"
-#include "gdkdndprivate.h"
+#include "gdkdragprivate.h"
G_BEGIN_DECLS
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index c9a27018b5..7348ce1fe8 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -5140,10 +5140,10 @@ gdk_surface_register_dnd (GdkSurface *surface)
*
* This function is called by the drag source.
*
- * Returns: (transfer full) (nullable): a newly created #GdkDragContext or
+ * Returns: (transfer full) (nullable): a newly created #GdkDrag or
* %NULL on error.
*/
-GdkDragContext *
+GdkDrag *
gdk_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
diff --git a/gdk/gdksurfaceimpl.h b/gdk/gdksurfaceimpl.h
index dfd9716617..03342e477f 100644
--- a/gdk/gdksurfaceimpl.h
+++ b/gdk/gdksurfaceimpl.h
@@ -193,7 +193,7 @@ struct _GdkSurfaceImplClass
gdouble opacity);
void (* destroy_notify) (GdkSurface *surface);
void (* register_dnd) (GdkSurface *surface);
- GdkDragContext * (*drag_begin) (GdkSurface *surface,
+ GdkDrag * (*drag_begin) (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider*content,
GdkDragAction actions,
diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
index b967ad7259..16a64df3fc 100644
--- a/gdk/gdktypes.h
+++ b/gdk/gdktypes.h
@@ -123,7 +123,7 @@ typedef struct _GdkContentProvider GdkContentProvider;
typedef struct _GdkCursor GdkCursor;
typedef struct _GdkTexture GdkTexture;
typedef struct _GdkDevice GdkDevice;
-typedef struct _GdkDragContext GdkDragContext;
+typedef struct _GdkDrag GdkDrag;
typedef struct _GdkDrop GdkDrop;
typedef struct _GdkClipboard GdkClipboard;
@@ -571,7 +571,7 @@ typedef enum
* useful if source and destination agree on what it means.
* @GDK_ACTION_ASK: Ask the user what to do with the data.
*
- * Used in #GdkDragContext to indicate what the destination
+ * Used in #GdkDrag to indicate what the destination
* should do with the dropped data.
*/
typedef enum
diff --git a/gdk/meson.build b/gdk/meson.build
index 4a2e24073c..d68307392b 100644
--- a/gdk/meson.build
+++ b/gdk/meson.build
@@ -15,7 +15,7 @@ gdk_public_sources = files([
'gdkdevicetool.c',
'gdkdisplay.c',
'gdkdisplaymanager.c',
- 'gdkdnd.c',
+ 'gdkdrag.c',
'gdkdrawcontext.c',
'gdkdrop.c',
'gdkevents.c',
@@ -65,7 +65,7 @@ gdk_public_headers = files([
'gdkdevicetool.h',
'gdkdisplay.h',
'gdkdisplaymanager.h',
- 'gdkdnd.h',
+ 'gdkdrag.h',
'gdkdrawcontext.h',
'gdkdrop.h',
'gdkevents.h',
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 64ab005aed..97201fd1a4 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -247,7 +247,7 @@ struct _GdkWaylandSeat
GdkClipboard *clipboard;
GdkClipboard *primary_clipboard;
struct wl_data_device *data_device;
- GdkDragContext *drag;
+ GdkDrag *drag;
GdkDrop *drop;
/* Source/dest for non-local dnd */
@@ -5139,12 +5139,12 @@ gdk_wayland_seat_set_global_cursor (GdkSeat *seat,
}
void
-gdk_wayland_seat_set_drag (GdkSeat *seat,
- GdkDragContext *context)
+gdk_wayland_seat_set_drag (GdkSeat *seat,
+ GdkDrag *drag)
{
GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat);
- g_set_object (&wayland_seat->drag, context);
+ g_set_object (&wayland_seat->drag, drag);
}
struct wl_data_device *
diff --git a/gdk/wayland/gdkdnd-wayland.c b/gdk/wayland/gdkdnd-wayland.c
index 36c0c9b138..4288693766 100644
--- a/gdk/wayland/gdkdnd-wayland.c
+++ b/gdk/wayland/gdkdnd-wayland.c
@@ -17,7 +17,7 @@
#include "config.h"
-#include "gdkdndprivate.h"
+#include "gdkdragprivate.h"
#include "gdkinternals.h"
#include "gdkproperty.h"
@@ -34,19 +34,19 @@
#include <gio/gunixoutputstream.h>
#include <string.h>
-#define GDK_TYPE_WAYLAND_DRAG_CONTEXT (gdk_wayland_drag_context_get_type ())
-#define GDK_WAYLAND_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_DRAG_CONTEXT, GdkWaylandDragContext))
-#define GDK_WAYLAND_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WAYLAND_DRAG_CONTEXT, GdkWaylandDragContextClass))
-#define GDK_IS_WAYLAND_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_DRAG_CONTEXT))
-#define GDK_IS_WAYLAND_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WAYLAND_DRAG_CONTEXT))
-#define GDK_WAYLAND_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_DRAG_CONTEXT, GdkWaylandDragContextClass))
+#define GDK_TYPE_WAYLAND_DRAG (gdk_wayland_drag_get_type ())
+#define GDK_WAYLAND_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_DRAG, GdkWaylandDrag))
+#define GDK_WAYLAND_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WAYLAND_DRAG, GdkWaylandDragClass))
+#define GDK_IS_WAYLAND_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_DRAG))
+#define GDK_IS_WAYLAND_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WAYLAND_DRAG))
+#define GDK_WAYLAND_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_DRAG, GdkWaylandDragClass))
-typedef struct _GdkWaylandDragContext GdkWaylandDragContext;
-typedef struct _GdkWaylandDragContextClass GdkWaylandDragContextClass;
+typedef struct _GdkWaylandDrag GdkWaylandDrag;
+typedef struct _GdkWaylandDragClass GdkWaylandDragClass;
-struct _GdkWaylandDragContext
+struct _GdkWaylandDrag
{
- GdkDragContext context;
+ GdkDrag drag;
GdkSurface *dnd_surface;
struct wl_surface *dnd_wl_surface;
struct wl_data_source *data_source;
@@ -57,34 +57,34 @@ struct _GdkWaylandDragContext
gint hot_y;
};
-struct _GdkWaylandDragContextClass
+struct _GdkWaylandDragClass
{
- GdkDragContextClass parent_class;
+ GdkDragClass parent_class;
};
-static GList *contexts;
+static GList *drags;
-GType gdk_wayland_drag_context_get_type (void);
+GType gdk_wayland_drag_get_type (void);
-G_DEFINE_TYPE (GdkWaylandDragContext, gdk_wayland_drag_context, GDK_TYPE_DRAG_CONTEXT)
+G_DEFINE_TYPE (GdkWaylandDrag, gdk_wayland_drag, GDK_TYPE_DRAG)
static void
-gdk_wayland_drag_context_finalize (GObject *object)
+gdk_wayland_drag_finalize (GObject *object)
{
- GdkWaylandDragContext *wayland_context = GDK_WAYLAND_DRAG_CONTEXT (object);
- GdkDragContext *context = GDK_DRAG_CONTEXT (object);
+ GdkWaylandDrag *wayland_drag = GDK_WAYLAND_DRAG (object);
+ GdkDrag *drag = GDK_DRAG (object);
GdkSurface *dnd_surface;
- contexts = g_list_remove (contexts, context);
+ drags = g_list_remove (drags, drag);
- gdk_drag_context_set_cursor (context, NULL);
+ gdk_drag_set_cursor (drag, NULL);
- g_clear_pointer (&wayland_context->data_source, (GDestroyNotify) wl_data_source_destroy);
- g_clear_pointer (&wayland_context->offer, (GDestroyNotify) wl_data_offer_destroy);
+ g_clear_pointer (&wayland_drag->data_source, (GDestroyNotify) wl_data_source_destroy);
+ g_clear_pointer (&wayland_drag->offer, (GDestroyNotify) wl_data_offer_destroy);
- dnd_surface = wayland_context->dnd_surface;
+ dnd_surface = wayland_drag->dnd_surface;
- G_OBJECT_CLASS (gdk_wayland_drag_context_parent_class)->finalize (object);
+ G_OBJECT_CLASS (gdk_wayland_drag_parent_class)->finalize (object);
if (dnd_surface)
gdk_surface_destroy (dnd_surface);
@@ -106,121 +106,121 @@ gdk_to_wl_actions (GdkDragAction action)
}
static void
-gdk_wayland_drag_context_drag_abort (GdkDragContext *context,
- guint32 time)
+gdk_wayland_drag_drag_abort (GdkDrag *drag,
+ guint32 time)
{
}
static void
-gdk_wayland_drag_context_drag_drop (GdkDragContext *context,
- guint32 time)
+gdk_wayland_drag_drag_drop (GdkDrag *drag,
+ guint32 time)
{
}
static void
-gdk_wayland_drag_context_init (GdkWaylandDragContext *context_wayland)
+gdk_wayland_drag_init (GdkWaylandDrag *drag_wayland)
{
- GdkDragContext *context;
+ GdkDrag *drag;
- context = GDK_DRAG_CONTEXT (context_wayland);
- contexts = g_list_prepend (contexts, context);
+ drag = GDK_DRAG (drag_wayland);
+ drags = g_list_prepend (drags, drag);
- context->action = GDK_ACTION_COPY;
+ drag->action = GDK_ACTION_COPY;
}
static GdkSurface *
-gdk_wayland_drag_context_get_drag_surface (GdkDragContext *context)
+gdk_wayland_drag_get_drag_surface (GdkDrag *drag)
{
- return GDK_WAYLAND_DRAG_CONTEXT (context)->dnd_surface;
+ return GDK_WAYLAND_DRAG (drag)->dnd_surface;
}
static void
-gdk_wayland_drag_context_set_hotspot (GdkDragContext *context,
- gint hot_x,
- gint hot_y)
+gdk_wayland_drag_set_hotspot (GdkDrag *drag,
+ gint hot_x,
+ gint hot_y)
{
- GdkWaylandDragContext *context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
- gint prev_hot_x = context_wayland->hot_x;
- gint prev_hot_y = context_wayland->hot_y;
+ GdkWaylandDrag *drag_wayland = GDK_WAYLAND_DRAG (drag);
+ gint prev_hot_x = drag_wayland->hot_x;
+ gint prev_hot_y = drag_wayland->hot_y;
const GdkRectangle damage_rect = { .width = 1, .height = 1 };
- context_wayland->hot_x = hot_x;
- context_wayland->hot_y = hot_y;
+ drag_wayland->hot_x = hot_x;
+ drag_wayland->hot_y = hot_y;
if (prev_hot_x == hot_x && prev_hot_y == hot_y)
return;
- _gdk_wayland_surface_offset_next_wl_buffer (context_wayland->dnd_surface,
+ _gdk_wayland_surface_offset_next_wl_buffer (drag_wayland->dnd_surface,
-hot_x, -hot_y);
- gdk_surface_invalidate_rect (context_wayland->dnd_surface, &damage_rect);
+ gdk_surface_invalidate_rect (drag_wayland->dnd_surface, &damage_rect);
}
static void
-gdk_wayland_drag_context_set_cursor (GdkDragContext *context,
- GdkCursor *cursor)
+gdk_wayland_drag_set_cursor (GdkDrag *drag,
+ GdkCursor *cursor)
{
- GdkDevice *device = gdk_drag_context_get_device (context);
+ GdkDevice *device = gdk_drag_get_device (drag);
gdk_wayland_seat_set_global_cursor (gdk_device_get_seat (device), cursor);
}
static void
-gdk_wayland_drag_context_action_changed (GdkDragContext *context,
- GdkDragAction action)
+gdk_wayland_drag_action_changed (GdkDrag *drag,
+ GdkDragAction action)
{
GdkCursor *cursor;
- cursor = gdk_drag_get_cursor (context, action);
- gdk_drag_context_set_cursor (context, cursor);
+ cursor = gdk_drag_get_cursor (drag, action);
+ gdk_drag_set_cursor (drag, cursor);
}
static void
-gdk_wayland_drag_context_drop_performed (GdkDragContext *context,
- guint32 time_)
+gdk_wayland_drag_drop_performed (GdkDrag *drag,
+ guint32 time_)
{
- gdk_drag_context_set_cursor (context, NULL);
+ gdk_drag_set_cursor (drag, NULL);
}
static void
-gdk_wayland_drag_context_cancel (GdkDragContext *context,
- GdkDragCancelReason reason)
+gdk_wayland_drag_cancel (GdkDrag *drag,
+ GdkDragCancelReason reason)
{
- gdk_drag_context_set_cursor (context, NULL);
+ gdk_drag_set_cursor (drag, NULL);
}
static void
-gdk_wayland_drag_context_drop_done (GdkDragContext *context,
- gboolean success)
+gdk_wayland_drag_drop_done (GdkDrag *drag,
+ gboolean success)
{
- GdkWaylandDragContext *context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
- GdkDevice *device = gdk_drag_context_get_device (context);
+ GdkWaylandDrag *drag_wayland = GDK_WAYLAND_DRAG (drag);
+ GdkDevice *device = gdk_drag_get_device (drag);
- gdk_wayland_seat_set_drag (gdk_device_get_seat (device), context);
+ gdk_wayland_seat_set_drag (gdk_device_get_seat (device), drag);
if (success)
{
- if (context_wayland->dnd_surface)
- gdk_surface_hide (context_wayland->dnd_surface);
+ if (drag_wayland->dnd_surface)
+ gdk_surface_hide (drag_wayland->dnd_surface);
}
}
static void
-gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
+gdk_wayland_drag_class_init (GdkWaylandDragClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
-
- object_class->finalize = gdk_wayland_drag_context_finalize;
-
- context_class->drag_abort = gdk_wayland_drag_context_drag_abort;
- context_class->drag_drop = gdk_wayland_drag_context_drag_drop;
- 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;
- context_class->set_cursor = gdk_wayland_drag_context_set_cursor;
- context_class->action_changed = gdk_wayland_drag_context_action_changed;
- context_class->drop_performed = gdk_wayland_drag_context_drop_performed;
- context_class->cancel = gdk_wayland_drag_context_cancel;
+ GdkDragClass *drag_class = GDK_DRAG_CLASS (klass);
+
+ object_class->finalize = gdk_wayland_drag_finalize;
+
+ drag_class->drag_abort = gdk_wayland_drag_drag_abort;
+ drag_class->drag_drop = gdk_wayland_drag_drag_drop;
+ drag_class->get_drag_surface = gdk_wayland_drag_get_drag_surface;
+ drag_class->set_hotspot = gdk_wayland_drag_set_hotspot;
+ drag_class->drop_done = gdk_wayland_drag_drop_done;
+ drag_class->set_cursor = gdk_wayland_drag_set_cursor;
+ drag_class->action_changed = gdk_wayland_drag_action_changed;
+ drag_class->drop_performed = gdk_wayland_drag_drop_performed;
+ drag_class->cancel = gdk_wayland_drag_cancel;
}
void
@@ -266,15 +266,15 @@ data_source_target (void *data,
}
static void
-gdk_wayland_drag_context_write_done (GObject *context,
- GAsyncResult *result,
- gpointer user_data)
+gdk_wayland_drag_write_done (GObject *drag,
+ GAsyncResult *result,
+ gpointer user_data)
{
GError *error = NULL;
- if (!gdk_drag_context_write_finish (GDK_DRAG_CONTEXT (context), result, &error))
+ if (!gdk_drag_write_finish (GDK_DRAG (drag), result, &error))
{
- GDK_DISPLAY_NOTE (gdk_drag_context_get_display (GDK_DRAG_CONTEXT (context)), DND, g_message ("%p: failed to write stream: %s", context, error->message));
+ GDK_DISPLAY_NOTE (gdk_drag_get_display (GDK_DRAG (drag)), DND, g_message ("%p: failed to write stream: %s", drag, error->message));
g_error_free (error);
}
}
@@ -285,23 +285,23 @@ data_source_send (void *data,
const char *mime_type,
int32_t fd)
{
- GdkDragContext *context = data;
+ GdkDrag *drag = data;
GOutputStream *stream;
- GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), DND, g_message ("%p: data source send request for %s on fd %d\n",
+ GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), DND, g_message ("%p: data source send request for %s on fd %d\n",
source, mime_type, fd));
//mime_type = gdk_intern_mime_type (mime_type);
mime_type = g_intern_string (mime_type);
stream = g_unix_output_stream_new (fd, TRUE);
- gdk_drag_context_write_async (context,
- mime_type,
- stream,
- G_PRIORITY_DEFAULT,
- NULL,
- gdk_wayland_drag_context_write_done,
- context);
+ gdk_drag_write_async (drag,
+ mime_type,
+ stream,
+ G_PRIORITY_DEFAULT,
+ NULL,
+ gdk_wayland_drag_write_done,
+ drag);
g_object_unref (stream);
}
@@ -309,30 +309,30 @@ static void
data_source_cancelled (void *data,
struct wl_data_source *source)
{
- GdkDragContext *context = data;
+ GdkDrag *drag = data;
- GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), EVENTS,
+ GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), EVENTS,
g_message ("data source cancelled, source = %p", source));
- gdk_drag_context_cancel (context, GDK_DRAG_CANCEL_ERROR);
+ gdk_drag_cancel (drag, GDK_DRAG_CANCEL_ERROR);
}
static void
data_source_dnd_drop_performed (void *data,
struct wl_data_source *source)
{
- GdkDragContext *context = data;
+ GdkDrag *drag = data;
- g_signal_emit_by_name (context, "drop-performed");
+ g_signal_emit_by_name (drag, "drop-performed");
}
static void
data_source_dnd_finished (void *data,
struct wl_data_source *source)
{
- GdkDragContext *context = data;
+ GdkDrag *drag = data;
- g_signal_emit_by_name (context, "dnd-finished");
+ g_signal_emit_by_name (drag, "dnd-finished");
}
static void
@@ -340,14 +340,14 @@ data_source_action (void *data,
struct wl_data_source *source,
uint32_t action)
{
- GdkDragContext *context = data;
+ GdkDrag *drag = data;
- GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), EVENTS,
+ GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), EVENTS,
g_message ("data source action, source = %p action=%x",
source, action));
- context->action = _wl_to_gdk_actions (action);
- g_signal_emit_by_name (context, "action-changed", context->action);
+ drag->action = _wl_to_gdk_actions (action);
+ g_signal_emit_by_name (drag, "action-changed", drag->action);
}
static const struct wl_data_source_listener data_source_listener = {
@@ -360,27 +360,27 @@ static const struct wl_data_source_listener data_source_listener = {
};
static void
-gdk_wayland_drag_context_create_data_source (GdkDragContext *context)
+gdk_wayland_drag_create_data_source (GdkDrag *drag)
{
- GdkWaylandDragContext *context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
- GdkDisplay *display = gdk_drag_context_get_display (context);
+ GdkWaylandDrag *drag_wayland = GDK_WAYLAND_DRAG (drag);
+ GdkDisplay *display = gdk_drag_get_display (drag);
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
const char *const *mimetypes;
gsize i, n_mimetypes;
- context_wayland->data_source = wl_data_device_manager_create_data_source (display_wayland->data_device_manager);
- wl_data_source_add_listener (context_wayland->data_source,
+ drag_wayland->data_source = wl_data_device_manager_create_data_source (display_wayland->data_device_manager);
+ wl_data_source_add_listener (drag_wayland->data_source,
&data_source_listener,
- context);
+ drag);
- mimetypes = gdk_content_formats_get_mime_types (gdk_drag_context_get_formats (context), &n_mimetypes);
+ mimetypes = gdk_content_formats_get_mime_types (gdk_drag_get_formats (drag), &n_mimetypes);
for (i = 0; i < n_mimetypes; i++)
{
- wl_data_source_offer (context_wayland->data_source, mimetypes[i]);
+ wl_data_source_offer (drag_wayland->data_source, mimetypes[i]);
}
}
-GdkDragContext *
+GdkDrag *
_gdk_wayland_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
@@ -388,53 +388,53 @@ _gdk_wayland_surface_drag_begin (GdkSurface *surface,
gint dx,
gint dy)
{
- GdkWaylandDragContext *context_wayland;
- GdkDragContext *context;
+ GdkWaylandDrag *drag_wayland;
+ GdkDrag *drag;
GdkSeat *seat;
GdkWaylandDisplay *display_wayland;
display_wayland = GDK_WAYLAND_DISPLAY (gdk_device_get_display (device));
seat = gdk_device_get_seat (device);
- context_wayland = g_object_new (GDK_TYPE_WAYLAND_DRAG_CONTEXT,
- "device", device,
- "content", content,
- NULL);
- context = GDK_DRAG_CONTEXT (context_wayland);
- context->source_surface = g_object_ref (surface);
+ drag_wayland = g_object_new (GDK_TYPE_WAYLAND_DRAG,
+ "device", device,
+ "content", content,
+ NULL);
+ drag = GDK_DRAG (drag_wayland);
+ drag->source_surface = g_object_ref (surface);
- context_wayland->dnd_surface = create_dnd_surface (gdk_surface_get_display (surface));
- context_wayland->dnd_wl_surface = gdk_wayland_surface_get_wl_surface (context_wayland->dnd_surface);
+ drag_wayland->dnd_surface = create_dnd_surface (gdk_surface_get_display (surface));
+ drag_wayland->dnd_wl_surface = gdk_wayland_surface_get_wl_surface (drag_wayland->dnd_surface);
- gdk_wayland_drag_context_create_data_source (context);
+ gdk_wayland_drag_create_data_source (drag);
if (display_wayland->data_device_manager_version >=
WL_DATA_SOURCE_SET_ACTIONS_SINCE_VERSION)
{
- wl_data_source_set_actions (context_wayland->data_source,
+ wl_data_source_set_actions (drag_wayland->data_source,
gdk_to_wl_actions (actions));
}
- gdk_wayland_seat_set_drag (seat, context);
+ gdk_wayland_seat_set_drag (seat, drag);
wl_data_device_start_drag (gdk_wayland_device_get_data_device (device),
- context_wayland->data_source,
+ drag_wayland->data_source,
gdk_wayland_surface_get_wl_surface (surface),
- context_wayland->dnd_wl_surface,
+ drag_wayland->dnd_wl_surface,
_gdk_wayland_display_get_serial (display_wayland));
gdk_seat_ungrab (seat);
- return context;
+ return drag;
}
void
-_gdk_wayland_drag_context_set_source_surface (GdkDragContext *context,
- GdkSurface *surface)
+_gdk_wayland_drag_set_source_surface (GdkDrag *drag,
+ GdkSurface *surface)
{
- if (context->source_surface)
- g_object_unref (context->source_surface);
+ if (drag->source_surface)
+ g_object_unref (drag->source_surface);
- context->source_surface = surface ? g_object_ref (surface) : NULL;
+ drag->source_surface = surface ? g_object_ref (surface) : NULL;
}
diff --git a/gdk/wayland/gdkdrop-wayland.c b/gdk/wayland/gdkdrop-wayland.c
index d290c6229b..1c21dafdfa 100644
--- a/gdk/wayland/gdkdrop-wayland.c
+++ b/gdk/wayland/gdkdrop-wayland.c
@@ -261,7 +261,7 @@ gdk_wayland_drop_init (GdkWaylandDrop *drop)
GdkDrop *
gdk_wayland_drop_new (GdkDevice *device,
- GdkDragContext *drag,
+ GdkDrag *drag,
GdkContentFormats *formats,
GdkSurface *surface,
struct wl_data_offer *offer,
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index e4984cc5d4..68bd84b4a5 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -95,7 +95,7 @@ void gdk_wayland_surface_attach_image (GdkSurface
const cairo_region_t *damage);
void _gdk_wayland_surface_register_dnd (GdkSurface *surface);
-GdkDragContext *_gdk_wayland_surface_drag_begin (GdkSurface *surface,
+GdkDrag *_gdk_wayland_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
@@ -105,7 +105,7 @@ void _gdk_wayland_surface_offset_next_wl_buffer (GdkSurface *surface,
int x,
int y);
GdkDrop * gdk_wayland_drop_new (GdkDevice *device,
- GdkDragContext *drag,
+ GdkDrag *drag,
GdkContentFormats *formats,
GdkSurface *surface,
struct wl_data_offer *offer,
@@ -115,13 +115,13 @@ void gdk_wayland_drop_set_source_actions (GdkDrop
void gdk_wayland_drop_set_action (GdkDrop *drop,
uint32_t action);
-void _gdk_wayland_drag_context_set_source_surface (GdkDragContext *context,
- GdkSurface *surface);
+void _gdk_wayland_drag_set_source_surface (GdkDrag *drag,
+ GdkSurface *surface);
-void _gdk_wayland_display_create_surface_impl (GdkDisplay *display,
- GdkSurface *surface,
- GdkSurface *real_parent,
- GdkSurfaceAttr *attributes);
+void _gdk_wayland_display_create_surface_impl (GdkDisplay *display,
+ GdkSurface *surface,
+ GdkSurface *real_parent,
+ GdkSurfaceAttr *attributes);
gint _gdk_wayland_display_text_property_to_utf8_list (GdkDisplay *display,
GdkAtom encoding,
@@ -147,7 +147,7 @@ struct wl_data_device * gdk_wayland_device_get_data_device (GdkDevice *gdk_devic
void gdk_wayland_device_set_selection (GdkDevice *gdk_device,
struct wl_data_source *source);
-GdkDragContext * gdk_wayland_device_get_drop_context (GdkDevice *gdk_device);
+GdkDrag* gdk_wayland_device_get_drop_context (GdkDevice *gdk_device);
void gdk_wayland_device_unset_touch_grab (GdkDevice *device,
GdkEventSequence *sequence);
@@ -193,7 +193,7 @@ struct gtk_surface1 * gdk_wayland_surface_get_gtk_surface (GdkSurface *surface);
void gdk_wayland_seat_set_global_cursor (GdkSeat *seat,
GdkCursor *cursor);
void gdk_wayland_seat_set_drag (GdkSeat *seat,
- GdkDragContext *drag);
+ GdkDrag *drag);
struct wl_output *gdk_wayland_surface_get_wl_output (GdkSurface *surface);
diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c
index 39380537a2..9683a5a8ed 100644
--- a/gdk/wayland/gdkselection-wayland.c
+++ b/gdk/wayland/gdkselection-wayland.c
@@ -28,7 +28,6 @@
#include "gdkprivate-wayland.h"
#include "gdkdisplay-wayland.h"
#include "gdkcontentformatsprivate.h"
-#include "gdkdndprivate.h"
#include "gdkproperty.h"
#include <string.h>
diff --git a/gdk/win32/gdkclipdrop-win32.c b/gdk/win32/gdkclipdrop-win32.c
index f3d4925fb5..78cf1ba892 100644
--- a/gdk/win32/gdkclipdrop-win32.c
+++ b/gdk/win32/gdkclipdrop-win32.c
@@ -280,7 +280,7 @@ Otherwise it's similar to how the clipboard works. Only the DnD server
#include "gdkclipboard-win32.h"
#include "gdkclipdrop-win32.h"
#include "gdkhdataoutputstream-win32.h"
-#include "gdk/gdkdndprivate.h"
+#include "gdk/gdkdragprivate.h"
#include "gdkwin32dnd.h"
#include "gdkwin32dnd-private.h"
#include "gdkwin32.h"
diff --git a/gdk/win32/gdkdrag-win32.c b/gdk/win32/gdkdrag-win32.c
index f605171ec1..347e0f6f19 100644
--- a/gdk/win32/gdkdrag-win32.c
+++ b/gdk/win32/gdkdrag-win32.c
@@ -130,7 +130,7 @@
* From that point forward the context gets any events emitted
* by GDK, and can prevent these events from going anywhere else.
* They are all handled in
- * S: gdk_drag_context_handle_source_event() -> backend:handle_event()
+ * S: gdk_drag_handle_source_event() -> backend:handle_event()
* (except for wayland backend - it doesn't have that function).
*
* That function catches the following events:
@@ -195,14 +195,14 @@
/* For C-style COM wrapper macros */
#define COBJMACROS
-#include "gdkdnd.h"
+#include "gdkdrag.h"
#include "gdkproperty.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
#include "gdkwin32.h"
#include "gdkwin32dnd.h"
#include "gdkdisplayprivate.h"
-#include "gdk/gdkdndprivate.h"
+#include "gdk/gdkdragprivate.h"
#include "gdkwin32dnd-private.h"
#include "gdkdisplay-win32.h"
#include "gdkdeviceprivate.h"
@@ -226,12 +226,12 @@ typedef struct
IDropSource ids;
IDropSourceNotify idsn;
gint ref_count;
- GdkDragContext *drag;
+ GdkDrag *drag;
/* These are thread-local
- * copies of the similar fields from GdkWin32DragContext
+ * copies of the similar fields from GdkWin32Drag
*/
- GdkWin32DragContextUtilityData util_data;
+ GdkWin32DragUtilityData util_data;
/* Cached here, so that we don't have to look in
* the context every time.
@@ -249,7 +249,7 @@ typedef struct
typedef struct {
IDataObject ido;
int ref_count;
- GdkDragContext *drag;
+ GdkDrag *drag;
GArray *formats;
} data_object;
@@ -342,8 +342,8 @@ struct _GdkWin32DnDThreadUpdateDragState
{
GdkWin32DnDThreadQueueItem base;
- gpointer opaque_ddd;
- GdkWin32DragContextUtilityData produced_util_data;
+ gpointer opaque_ddd;
+ GdkWin32DragUtilityData produced_util_data;
};
typedef struct _GdkWin32DnDThread GdkWin32DnDThread;
@@ -485,10 +485,10 @@ process_dnd_queue (gboolean timed,
}
void
-_gdk_win32_local_drag_context_drop_response (GdkDragContext *drag,
- GdkDragAction action)
+_gdk_win32_local_drag_drop_response (GdkDrag *drag,
+ GdkDragAction action)
{
- GDK_NOTE (DND, g_print ("_gdk_win32_local_drag_context_drop_response: 0x%p\n",
+ GDK_NOTE (DND, g_print ("_gdk_win32_local_drag_drop_response: 0x%p\n",
drag));
g_signal_emit_by_name (drag, "dnd-finished");
@@ -500,8 +500,8 @@ do_drag_drop_response (gpointer user_data)
{
GdkWin32DnDThreadDoDragDrop *ddd = (GdkWin32DnDThreadDoDragDrop *) user_data;
HRESULT hr = ddd->received_result;
- GdkDragContext *drag = GDK_DRAG_CONTEXT (ddd->base.opaque_context);
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkDrag *drag = GDK_DRAG (ddd->base.opaque_context);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
gpointer table_value = g_hash_table_lookup (clipdrop->active_source_drags, drag);
@@ -560,7 +560,7 @@ received_drag_context_data (GObject *drag,
GdkWin32DnDThreadGetData *getdata = (GdkWin32DnDThreadGetData *) user_data;
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
- if (!gdk_drag_context_write_finish (GDK_DRAG_CONTEXT (drag), result, &error))
+ if (!gdk_drag_write_finish (GDK_DRAG (drag), result, &error))
{
HANDLE handle;
gboolean is_hdata;
@@ -593,7 +593,7 @@ get_data_response (gpointer user_data)
{
GdkWin32DnDThreadGetData *getdata = (GdkWin32DnDThreadGetData *) user_data;
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
- GdkDragContext *drag = GDK_DRAG_CONTEXT (getdata->base.opaque_context);
+ GdkDrag *drag = GDK_DRAG (getdata->base.opaque_context);
gpointer ddd = g_hash_table_lookup (clipdrop->active_source_drags, drag);
GDK_NOTE (DND, g_print ("idataobject_getdata will request target 0x%p (%s)",
@@ -610,7 +610,7 @@ get_data_response (gpointer user_data)
if (stream)
{
getdata->stream = GDK_WIN32_HDATA_OUTPUT_STREAM (stream);
- gdk_drag_context_write_async (drag,
+ gdk_drag_write_async (drag,
getdata->pair.contentformat,
stream,
G_PRIORITY_DEFAULT,
@@ -721,16 +721,16 @@ typedef enum {
static gboolean use_ole2_dnd = TRUE;
-static gboolean drag_context_grab (GdkDragContext *drag);
+static gboolean drag_context_grab (GdkDrag *drag);
-G_DEFINE_TYPE (GdkWin32DragContext, gdk_win32_drag_context, GDK_TYPE_DRAG_CONTEXT)
+G_DEFINE_TYPE (GdkWin32Drag, gdk_win32_drag, GDK_TYPE_DRAG)
static void
-move_drag_surface (GdkDragContext *drag,
- guint x_root,
- guint y_root)
+move_drag_surface (GdkDrag *drag,
+ guint x_root,
+ guint y_root)
{
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
g_assert (_win32_main_thread == NULL ||
_win32_main_thread == g_thread_self ());
@@ -742,7 +742,7 @@ move_drag_surface (GdkDragContext *drag,
}
static void
-gdk_win32_drag_context_init (GdkWin32DragContext *drag)
+gdk_win32_drag_init (GdkWin32Drag *drag)
{
g_assert (_win32_main_thread == NULL ||
_win32_main_thread == g_thread_self ());
@@ -750,32 +750,32 @@ gdk_win32_drag_context_init (GdkWin32DragContext *drag)
drag->handle_events = TRUE;
drag->dest_window = INVALID_HANDLE_VALUE;
- GDK_NOTE (DND, g_print ("gdk_win32_drag_context_init %p\n", drag));
+ GDK_NOTE (DND, g_print ("gdk_win32_drag_init %p\n", drag));
}
static void
-gdk_win32_drag_context_finalize (GObject *object)
+gdk_win32_drag_finalize (GObject *object)
{
- GdkDragContext *drag;
- GdkWin32DragContext *drag_win32;
+ GdkDrag *drag;
+ GdkWin32Drag *drag_win32;
GdkSurface *drag_surface;
g_assert (_win32_main_thread == NULL ||
_win32_main_thread == g_thread_self ());
- GDK_NOTE (DND, g_print ("gdk_win32_drag_context_finalize %p\n", object));
+ GDK_NOTE (DND, g_print ("gdk_win32_drag_finalize %p\n", object));
- g_return_if_fail (GDK_IS_WIN32_DRAG_CONTEXT (object));
+ g_return_if_fail (GDK_IS_WIN32_DRAG (object));
- drag = GDK_DRAG_CONTEXT (object);
- drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ drag = GDK_DRAG (object);
+ drag_win32 = GDK_WIN32_DRAG (drag);
- gdk_drag_context_set_cursor (drag, NULL);
+ gdk_drag_set_cursor (drag, NULL);
g_set_object (&drag_win32->grab_surface, NULL);
drag_surface = drag_win32->drag_surface;
- G_OBJECT_CLASS (gdk_win32_drag_context_parent_class)->finalize (object);
+ G_OBJECT_CLASS (gdk_win32_drag_parent_class)->finalize (object);
if (drag_surface)
gdk_surface_destroy (drag_surface);
@@ -783,30 +783,30 @@ gdk_win32_drag_context_finalize (GObject *object)
/* Drag Contexts */
-static GdkDragContext *
-gdk_drag_context_new (GdkDisplay *display,
- GdkContentProvider *content,
- GdkDragAction actions,
- GdkDevice *device,
- GdkDragProtocol protocol)
+static GdkDrag *
+gdk_drag_new (GdkDisplay *display,
+ GdkContentProvider *content,
+ GdkDragAction actions,
+ GdkDevice *device,
+ GdkDragProtocol protocol)
{
- GdkWin32DragContext *drag_win32;
+ GdkWin32Drag *drag_win32;
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
- GdkDragContext *drag;
+ GdkDrag *drag;
- drag_win32 = g_object_new (GDK_TYPE_WIN32_DRAG_CONTEXT,
- "device", device,
- "content", content,
- NULL);
+ drag_win32 = g_object_new (GDK_TYPE_WIN32_DRAG,
+ "device", device,
+ "content", content,
+ NULL);
- drag = GDK_DRAG_CONTEXT (drag_win32);
+ drag = GDK_DRAG (drag_win32);
if (win32_display->has_fixed_scale)
drag_win32->scale = win32_display->surface_scale;
else
drag_win32->scale = _gdk_win32_display_get_monitor_scale_factor (win32_display, NULL, NULL, NULL);
- gdk_drag_context_set_actions (drag, actions, actions);
+ gdk_drag_set_actions (drag, actions, actions);
drag_win32->protocol = protocol;
return drag;
@@ -828,15 +828,15 @@ gdk_drag_context_new (GdkDisplay *display,
static enum_formats *enum_formats_new (GArray *formats);
-/* Finds a GdkDragContext object that corresponds to a DnD operation
+/* Finds a GdkDrag object that corresponds to a DnD operation
* which is currently targetting the dest_window
* Does not give a reference.
*/
-GdkDragContext *
+GdkDrag *
_gdk_win32_find_drag_for_dest_window (HWND dest_window)
{
GHashTableIter iter;
- GdkWin32DragContext *drag_win32;
+ GdkWin32Drag *drag_win32;
GdkWin32DnDThreadDoDragDrop *ddd;
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
@@ -844,7 +844,7 @@ _gdk_win32_find_drag_for_dest_window (HWND dest_window)
while (g_hash_table_iter_next (&iter, (gpointer *) &drag_win32, (gpointer *) &ddd))
if (ddd->src_context->dest_window_handle == dest_window)
- return GDK_DRAG_CONTEXT (drag_win32);
+ return GDK_DRAG (drag_win32);
return NULL;
}
@@ -888,7 +888,7 @@ static gboolean
notify_dnd_enter (gpointer user_data)
{
GdkWin32DnDEnterLeaveNotify *notify = (GdkWin32DnDEnterLeaveNotify *) user_data;
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (notify->opaque_context);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (notify->opaque_context);
drag_win32->dest_window = notify->target_window_handle;
@@ -901,7 +901,7 @@ static gboolean
notify_dnd_leave (gpointer user_data)
{
GdkWin32DnDEnterLeaveNotify *notify = (GdkWin32DnDEnterLeaveNotify *) user_data;
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (notify->opaque_context);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (notify->opaque_context);
if (notify->target_window_handle != drag_win32->dest_window)
g_warning ("DnD leave says that the window handle is 0x%p, but drag has 0x%p", notify->target_window_handle, drag_win32->dest_window);
@@ -998,7 +998,7 @@ idropsource_queryinterface (LPDROPSOURCE This,
static gboolean
unref_context_in_main_thread (gpointer opaque_context)
{
- GdkDragContext *drag = GDK_DRAG_CONTEXT (opaque_context);
+ GdkDrag *drag = GDK_DRAG (opaque_context);
g_clear_object (&drag);
@@ -1066,21 +1066,21 @@ idropsource_querycontinuedrag (LPDROPSOURCE This,
}
static void
-maybe_emit_action_changed (GdkWin32DragContext *drag_win32,
+maybe_emit_action_changed (GdkWin32Drag *drag_win32,
GdkDragAction actions)
{
if (actions != drag_win32->current_action)
{
drag_win32->current_action = actions;
- g_signal_emit_by_name (GDK_DRAG_CONTEXT (drag_win32), "action-changed", actions);
+ g_signal_emit_by_name (GDK_DRAG (drag_win32), "action-changed", actions);
}
}
void
-_gdk_win32_local_drag_give_feedback (GdkDragContext *drag,
+_gdk_win32_local_drag_give_feedback (GdkDrag *drag,
GdkDragAction actions)
{
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
if (drag_win32->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
drag_win32->drag_status = GDK_DRAG_STATUS_DRAG;
@@ -1101,8 +1101,8 @@ give_feedback (gpointer user_data)
if (ddd)
{
- GdkDragContext *drag = GDK_DRAG_CONTEXT (feedback->base.opaque_context);
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkDrag *drag = GDK_DRAG (feedback->base.opaque_context);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GDK_NOTE (DND, g_print ("gdk_dnd_handle_drag_status: 0x%p\n",
drag));
@@ -1587,13 +1587,13 @@ static IEnumFORMATETCVtbl ief_vtbl = {
};
static source_drag_context *
-source_context_new (GdkDragContext *drag,
+source_context_new (GdkDrag *drag,
GdkContentFormats *formats)
{
- GdkWin32DragContext *drag_win32;
+ GdkWin32Drag *drag_win32;
source_drag_context *result;
- drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ drag_win32 = GDK_WIN32_DRAG (drag);
result = g_new0 (source_drag_context, 1);
result->drag = g_object_ref (drag);
@@ -1611,7 +1611,7 @@ source_context_new (GdkDragContext *drag,
}
static data_object *
-data_object_new (GdkDragContext *drag)
+data_object_new (GdkDrag *drag)
{
data_object *result;
const char * const *mime_types;
@@ -1624,7 +1624,7 @@ data_object_new (GdkDragContext *drag)
result->drag = drag;
result->formats = g_array_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair));
- mime_types = gdk_content_formats_get_mime_types (gdk_drag_context_get_formats (drag), &n_mime_types);
+ mime_types = gdk_content_formats_get_mime_types (gdk_drag_get_formats (drag), &n_mime_types);
for (i = 0; i < n_mime_types; i++)
{
@@ -1701,7 +1701,7 @@ create_drag_surface (GdkDisplay *display)
return surface;
}
-GdkDragContext *
+GdkDrag *
_gdk_win32_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
@@ -1709,19 +1709,19 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
gint dx,
gint dy)
{
- GdkDragContext *drag;
- GdkWin32DragContext *drag_win32;
+ GdkDrag *drag;
+ GdkWin32Drag *drag_win32;
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
int x_root, y_root;
g_return_val_if_fail (surface != NULL, NULL);
- drag = gdk_drag_context_new (gdk_surface_get_display (surface),
- content,
- actions,
- device,
- use_ole2_dnd ? GDK_DRAG_PROTO_OLE2 : GDK_DRAG_PROTO_LOCAL);
- drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ drag = gdk_drag_new (gdk_surface_get_display (surface),
+ content,
+ actions,
+ device,
+ use_ole2_dnd ? GDK_DRAG_PROTO_OLE2 : GDK_DRAG_PROTO_LOCAL);
+ drag_win32 = GDK_WIN32_DRAG (drag);
g_set_object (&drag->source_surface, surface);
@@ -1752,8 +1752,7 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
source_drag_context *source_ctx;
data_object *data_obj;
- source_ctx = source_context_new (drag,
- gdk_drag_context_get_formats (drag));
+ source_ctx = source_context_new (drag, gdk_drag_get_formats (drag));
data_obj = data_object_new (drag);
ddd->base.item_type = GDK_WIN32_DND_THREAD_QUEUE_ITEM_DO_DRAG_DROP;
@@ -1830,12 +1829,12 @@ find_window_enum_proc (HWND hwnd,
* drop targets about drags that move over them.
*/
static HWND
-gdk_win32_drag_context_find_window (GdkDragContext *drag,
- GdkSurface *drag_surface,
- gint x_root,
- gint y_root)
+gdk_win32_drag_find_window (GdkDrag *drag,
+ GdkSurface *drag_surface,
+ gint x_root,
+ gint y_root)
{
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
find_window_enum_arg a;
HWND result;
@@ -1848,14 +1847,14 @@ gdk_win32_drag_context_find_window (GdkDragContext *drag,
a.result = INVALID_HANDLE_VALUE;
GDK_NOTE (DND,
- g_print ("gdk_win32_drag_context_find_window: %p %+d%+d\n",
+ g_print ("gdk_win32_drag_find_window: %p %+d%+d\n",
(drag_surface ? GDK_SURFACE_HWND (drag_surface) : NULL),
a.x, a.y));
EnumWindows (find_window_enum_proc, (LPARAM) &a);
GDK_NOTE (DND,
- g_print ("gdk_win32_drag_context_find_window: %p %+d%+d: %p\n",
+ g_print ("gdk_win32_drag_find_window: %p %+d%+d: %p\n",
(drag_surface ? GDK_SURFACE_HWND (drag_surface) : NULL),
x_root, y_root,
a.result));
@@ -1900,7 +1899,7 @@ _gdk_win32_get_drop_for_dest_window (HWND dest_window)
}
static gboolean
-gdk_win32_local_drag_motion (GdkDragContext *drag,
+gdk_win32_local_drag_motion (GdkDrag *drag,
HWND dest_window,
gint x_root,
gint y_root,
@@ -1908,7 +1907,7 @@ gdk_win32_local_drag_motion (GdkDragContext *drag,
DWORD key_state,
guint32 time_)
{
- GdkWin32DragContext *drag_win32;
+ GdkWin32Drag *drag_win32;
GdkDrop *drop;
GdkDragAction actions;
@@ -1917,11 +1916,11 @@ gdk_win32_local_drag_motion (GdkDragContext *drag,
g_return_val_if_fail (drag != NULL, FALSE);
- drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ drag_win32 = GDK_WIN32_DRAG (drag);
drop = _gdk_win32_get_drop_for_dest_window (drag_win32->dest_window);
- actions = gdk_drag_context_get_actions (drag);
+ actions = gdk_drag_get_actions (drag);
GDK_NOTE (DND, g_print ("gdk_win32_local_drag_motion: @ %+d:%+d possible=%s\n"
" dest=%p (current %p) drop=%p drag=%p:{actions=%s,suggested=%s,action=%s}\n",
@@ -1929,7 +1928,7 @@ gdk_win32_local_drag_motion (GdkDragContext *drag,
_gdk_win32_drag_action_to_string (possible_actions),
dest_window, drag_win32->dest_window, drop, drag,
_gdk_win32_drag_action_to_string (actions),
- _gdk_win32_drag_action_to_string (gdk_drag_context_get_suggested_action (drag)),
+ _gdk_win32_drag_action_to_string (gdk_drag_get_suggested_action (drag)),
_gdk_win32_drag_action_to_string (drag->action)));
if (drag_win32->dest_window != dest_window)
@@ -1962,7 +1961,7 @@ gdk_win32_local_drag_motion (GdkDragContext *drag,
drag_win32->drag_status == GDK_DRAG_STATUS_DRAG &&
_gdk_win32_local_drop_target_will_emit_motion (drop, x_root, y_root, key_state))
{
- actions = gdk_drag_context_get_actions (drag);
+ actions = gdk_drag_get_actions (drag);
drag_win32->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
_gdk_win32_local_drop_target_dragover (drop, drag, x_root, y_root, key_state, time_, &actions);
@@ -1974,31 +1973,31 @@ gdk_win32_local_drag_motion (GdkDragContext *drag,
" drag=%p:{actions=%s,suggested=%s,action=%s}\n",
(drop != NULL && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG) ? "TRUE" : "FALSE",
drag,
- _gdk_win32_drag_action_to_string (gdk_drag_context_get_actions (drag)),
- _gdk_win32_drag_action_to_string (gdk_drag_context_get_suggested_action (drag)),
+ _gdk_win32_drag_action_to_string (gdk_drag_get_actions (drag)),
+ _gdk_win32_drag_action_to_string (gdk_drag_get_suggested_action (drag)),
_gdk_win32_drag_action_to_string (drag->action)));
return (drop != NULL && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG);
}
static void
send_source_state_update (GdkWin32Clipdrop *clipdrop,
- GdkWin32DragContext *context_win32,
+ GdkWin32Drag *drag_win32,
gpointer *ddd)
{
GdkWin32DnDThreadUpdateDragState *status = g_new0 (GdkWin32DnDThreadUpdateDragState, 1);
status->base.item_type = GDK_WIN32_DND_THREAD_QUEUE_ITEM_UPDATE_DRAG_STATE;
status->opaque_ddd = ddd;
- status->produced_util_data = context_win32->util_data;
+ status->produced_util_data = drag_win32->util_data;
increment_dnd_queue_counter ();
g_async_queue_push (clipdrop->dnd_queue, status);
API_CALL (PostThreadMessage, (clipdrop->dnd_thread_id, thread_wakeup_message, 0, 0));
}
static void
-gdk_win32_drag_context_drag_drop (GdkDragContext *drag,
- guint32 time_)
+gdk_win32_drag_drop (GdkDrag *drag,
+ guint32 time_)
{
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
g_assert (_win32_main_thread == NULL ||
@@ -2006,7 +2005,7 @@ gdk_win32_drag_context_drag_drop (GdkDragContext *drag,
g_return_if_fail (drag != NULL);
- GDK_NOTE (DND, g_print ("gdk_win32_drag_context_drag_drop\n"));
+ GDK_NOTE (DND, g_print ("gdk_win32_drag_drop\n"));
if (drag_win32->protocol == GDK_DRAG_PROTO_LOCAL)
{
@@ -2016,10 +2015,10 @@ gdk_win32_drag_context_drag_drop (GdkDragContext *drag,
{
GdkDragAction actions;
- actions = gdk_drag_context_get_actions (drag);
+ actions = gdk_drag_get_actions (drag);
_gdk_win32_local_drop_target_drop (drop, drag, time_, &actions);
maybe_emit_action_changed (drag_win32, actions);
- _gdk_win32_local_drag_context_drop_response (drag, actions);
+ _gdk_win32_local_drag_drop_response (drag, actions);
}
}
else if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2)
@@ -2034,10 +2033,10 @@ gdk_win32_drag_context_drag_drop (GdkDragContext *drag,
}
static void
-gdk_win32_drag_context_drag_abort (GdkDragContext *drag,
- guint32 time_)
+gdk_win32_drag_abort (GdkDrag *drag,
+ guint32 time_)
{
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
g_assert (_win32_main_thread == NULL ||
@@ -2045,7 +2044,7 @@ gdk_win32_drag_context_drag_abort (GdkDragContext *drag,
g_return_if_fail (drag != NULL);
- GDK_NOTE (DND, g_print ("gdk_win32_drag_context_drag_abort\n"));
+ GDK_NOTE (DND, g_print ("gdk_win32_drag_abort\n"));
if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2)
{
@@ -2059,12 +2058,12 @@ gdk_win32_drag_context_drag_abort (GdkDragContext *drag,
}
static void
-gdk_win32_drag_context_set_cursor (GdkDragContext *drag,
- GdkCursor *cursor)
+gdk_win32_drag_set_cursor (GdkDrag *drag,
+ GdkCursor *cursor)
{
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
- GDK_NOTE (DND, g_print ("gdk_win32_drag_context_set_cursor: 0x%p 0x%p\n", drag, cursor));
+ GDK_NOTE (DND, g_print ("gdk_win32_drag_set_cursor: 0x%p 0x%p\n", drag, cursor));
if (!g_set_object (&drag_win32->cursor, cursor))
return;
@@ -2092,7 +2091,7 @@ ease_out_cubic (double t)
typedef struct _GdkDragAnim GdkDragAnim;
struct _GdkDragAnim {
- GdkWin32DragContext *drag;
+ GdkWin32Drag *drag;
GdkFrameClock *frame_clock;
gint64 start_time;
};
@@ -2108,7 +2107,7 @@ static gboolean
gdk_drag_anim_timeout (gpointer data)
{
GdkDragAnim *anim = data;
- GdkWin32DragContext *drag = anim->drag;
+ GdkWin32Drag *drag = anim->drag;
GdkFrameClock *frame_clock = anim->frame_clock;
gint64 current_time;
double f;
@@ -2136,10 +2135,10 @@ gdk_drag_anim_timeout (gpointer data)
}
static void
-gdk_win32_drag_context_drop_done (GdkDragContext *drag,
- gboolean success)
+gdk_win32_drag_drop_done (GdkDrag *drag,
+ gboolean success)
{
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GdkDragAnim *anim;
/*
cairo_surface_t *win_surface;
@@ -2148,7 +2147,7 @@ gdk_win32_drag_context_drop_done (GdkDragContext *drag,
*/
guint id;
- GDK_NOTE (DND, g_print ("gdk_win32_drag_context_drop_done: 0x%p %s\n",
+ GDK_NOTE (DND, g_print ("gdk_win32_drag_drop_done: 0x%p %s\n",
drag,
success ? "dropped successfully" : "dropped unsuccessfully"));
@@ -2207,7 +2206,7 @@ gdk_win32_drag_context_drop_done (GdkDragContext *drag,
anim->frame_clock = gdk_surface_get_frame_clock (drag_win32->drag_surface);
anim->start_time = gdk_frame_clock_get_frame_time (anim->frame_clock);
- GDK_NOTE (DND, g_print ("gdk_win32_drag_context_drop_done: animate the drag window from %d : %d to %d : %d\n",
+ GDK_NOTE (DND, g_print ("gdk_win32_drag_drop_done: animate the drag window from %d : %d to %d : %d\n",
drag_win32->util_data.last_x, drag_win32->util_data.last_y,
drag_win32->start_x, drag_win32->start_y));
@@ -2218,9 +2217,9 @@ gdk_win32_drag_context_drop_done (GdkDragContext *drag,
}
static gboolean
-drag_context_grab (GdkDragContext *drag)
+drag_context_grab (GdkDrag *drag)
{
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GdkSeatCapabilities capabilities;
GdkSeat *seat;
GdkCursor *cursor;
@@ -2232,11 +2231,11 @@ drag_context_grab (GdkDragContext *drag)
if (!drag_win32->grab_surface)
return FALSE;
- seat = gdk_device_get_seat (gdk_drag_context_get_device (drag));
+ seat = gdk_device_get_seat (gdk_drag_get_device (drag));
capabilities = GDK_SEAT_CAPABILITY_ALL;
- cursor = gdk_drag_get_cursor (drag, gdk_drag_context_get_selected_action (drag));
+ cursor = gdk_drag_get_cursor (drag, gdk_drag_get_selected_action (drag));
g_set_object (&drag_win32->cursor, cursor);
if (gdk_seat_grab (seat, drag_win32->grab_surface,
@@ -2252,9 +2251,9 @@ drag_context_grab (GdkDragContext *drag)
}
static void
-drag_context_ungrab (GdkDragContext *drag)
+drag_context_ungrab (GdkDrag *drag)
{
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GDK_NOTE (DND, g_print ("drag_context_ungrab: 0x%p 0x%p\n",
drag,
@@ -2271,10 +2270,10 @@ drag_context_ungrab (GdkDragContext *drag)
}
static void
-gdk_win32_drag_context_cancel (GdkDragContext *drag,
- GdkDragCancelReason reason)
+gdk_win32_drag_cancel (GdkDrag *drag,
+ GdkDragCancelReason reason)
{
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
const gchar *reason_str = NULL;
switch (reason)
@@ -2293,7 +2292,7 @@ gdk_win32_drag_context_cancel (GdkDragContext *drag,
break;
}
- GDK_NOTE (DND, g_print ("gdk_win32_drag_context_cancel: 0x%p %s\n",
+ GDK_NOTE (DND, g_print ("gdk_win32_drag_cancel: 0x%p %s\n",
drag,
reason_str));
@@ -2305,20 +2304,20 @@ gdk_win32_drag_context_cancel (GdkDragContext *drag,
drop = NULL;
}
- gdk_drag_context_set_cursor (drag, NULL);
+ gdk_drag_set_cursor (drag, NULL);
drag_context_ungrab (drag);
gdk_drag_drop_done (drag, FALSE);
}
static void
-gdk_win32_drag_context_drop_performed (GdkDragContext *drag,
- guint32 time_)
+gdk_win32_drag_drop_performed (GdkDrag *drag,
+ guint32 time_)
{
- GDK_NOTE (DND, g_print ("gdk_win32_drag_context_drop_performed: 0x%p %u\n",
+ GDK_NOTE (DND, g_print ("gdk_win32_drag_drop_performed: 0x%p %u\n",
drag,
time_));
gdk_drag_drop (drag, time_);
- gdk_drag_context_set_cursor (drag, NULL);
+ gdk_drag_set_cursor (drag, NULL);
drag_context_ungrab (drag);
}
@@ -2326,33 +2325,33 @@ gdk_win32_drag_context_drop_performed (GdkDragContext *drag,
#define SMALL_STEP 1
static void
-gdk_local_drag_update (GdkDragContext *drag,
- gdouble x_root,
- gdouble y_root,
- DWORD grfKeyState,
- guint32 evtime)
+gdk_local_drag_update (GdkDrag *drag,
+ gdouble x_root,
+ gdouble y_root,
+ DWORD grfKeyState,
+ guint32 evtime)
{
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
HWND dest_window;
g_assert (_win32_main_thread == NULL ||
_win32_main_thread == g_thread_self ());
- dest_window = gdk_win32_drag_context_find_window (drag,
- drag_win32->drag_surface,
- x_root, y_root);
+ dest_window = gdk_win32_drag_find_window (drag,
+ drag_win32->drag_surface,
+ x_root, y_root);
gdk_win32_local_drag_motion (drag, dest_window, x_root, y_root,
- gdk_drag_context_get_actions (drag),
+ gdk_drag_get_actions (drag),
grfKeyState, evtime);
}
static gboolean
-gdk_dnd_handle_motion_event (GdkDragContext *drag,
+gdk_dnd_handle_motion_event (GdkDrag *drag,
const GdkEventMotion *event)
{
GdkModifierType state;
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
DWORD key_state;
if (!gdk_event_get_state ((GdkEvent *) event, &state))
@@ -2391,10 +2390,10 @@ gdk_dnd_handle_motion_event (GdkDragContext *drag,
}
static gboolean
-gdk_dnd_handle_key_event (GdkDragContext *drag,
+gdk_dnd_handle_key_event (GdkDrag *drag,
const GdkEventKey *event)
{
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GdkModifierType state;
GdkDevice *pointer;
gint dx, dy;
@@ -2413,7 +2412,7 @@ gdk_dnd_handle_key_event (GdkDragContext *drag,
switch (event->keyval)
{
case GDK_KEY_Escape:
- gdk_drag_context_cancel (drag, GDK_DRAG_CANCEL_USER_CANCELLED);
+ gdk_drag_cancel (drag, GDK_DRAG_CANCEL_USER_CANCELLED);
return TRUE;
case GDK_KEY_space:
@@ -2421,13 +2420,13 @@ gdk_dnd_handle_key_event (GdkDragContext *drag,
case GDK_KEY_ISO_Enter:
case GDK_KEY_KP_Enter:
case GDK_KEY_KP_Space:
- if ((gdk_drag_context_get_selected_action (drag) != 0) &&
+ if ((gdk_drag_get_selected_action (drag) != 0) &&
(drag_win32->dest_window != INVALID_HANDLE_VALUE))
{
g_signal_emit_by_name (drag, "drop-performed");
}
else
- gdk_drag_context_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET);
+ gdk_drag_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET);
return TRUE;
@@ -2477,10 +2476,10 @@ gdk_dnd_handle_key_event (GdkDragContext *drag,
}
static gboolean
-gdk_dnd_handle_grab_broken_event (GdkDragContext *drag,
+gdk_dnd_handle_grab_broken_event (GdkDrag *drag,
const GdkEventGrabBroken *event)
{
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GDK_NOTE (DND, g_print ("gdk_dnd_handle_grab_broken_event: 0x%p\n",
drag));
@@ -2495,15 +2494,15 @@ gdk_dnd_handle_grab_broken_event (GdkDragContext *drag,
return FALSE;
if (gdk_event_get_device ((GdkEvent *) event) !=
- gdk_drag_context_get_device (drag))
+ gdk_drag_get_device (drag))
return FALSE;
- gdk_drag_context_cancel (drag, GDK_DRAG_CANCEL_ERROR);
+ gdk_drag_cancel (drag, GDK_DRAG_CANCEL_ERROR);
return TRUE;
}
static gboolean
-gdk_dnd_handle_button_event (GdkDragContext *drag,
+gdk_dnd_handle_button_event (GdkDrag *drag,
const GdkEventButton *event)
{
GDK_NOTE (DND, g_print ("gdk_dnd_handle_button_event: 0x%p\n",
@@ -2515,22 +2514,22 @@ gdk_dnd_handle_button_event (GdkDragContext *drag,
return FALSE;
#endif
- if ((gdk_drag_context_get_selected_action (drag) != 0))
+ if ((gdk_drag_get_selected_action (drag) != 0))
{
g_signal_emit_by_name (drag, "drop-performed");
}
else
- gdk_drag_context_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET);
+ gdk_drag_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET);
/* Make sure GTK gets mouse release button event */
return FALSE;
}
gboolean
-gdk_win32_drag_context_handle_event (GdkDragContext *drag,
- const GdkEvent *event)
+gdk_win32_drag_handle_event (GdkDrag *drag,
+ const GdkEvent *event)
{
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
if (!drag_win32->grab_seat)
return FALSE;
@@ -2560,29 +2559,29 @@ gdk_win32_drag_context_handle_event (GdkDragContext *drag,
}
void
-gdk_win32_drag_context_action_changed (GdkDragContext *drag,
- GdkDragAction action)
+gdk_win32_drag_action_changed (GdkDrag *drag,
+ GdkDragAction action)
{
GdkCursor *cursor;
cursor = gdk_drag_get_cursor (drag, action);
- gdk_drag_context_set_cursor (drag, cursor);
+ gdk_drag_set_cursor (drag, cursor);
}
static GdkSurface *
-gdk_win32_drag_context_get_drag_surface (GdkDragContext *drag)
+gdk_win32_drag_get_drag_surface (GdkDrag *drag)
{
- return GDK_WIN32_DRAG_CONTEXT (drag)->drag_surface;
+ return GDK_WIN32_DRAG (drag)->drag_surface;
}
static void
-gdk_win32_drag_context_set_hotspot (GdkDragContext *drag,
- gint hot_x,
- gint hot_y)
+gdk_win32_drag_set_hotspot (GdkDrag *drag,
+ gint hot_x,
+ gint hot_y)
{
- GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
+ GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
- GDK_NOTE (DND, g_print ("gdk_drag_context_set_hotspot: 0x%p %d:%d\n",
+ GDK_NOTE (DND, g_print ("gdk_drag_set_hotspot: 0x%p %d:%d\n",
drag,
hot_x, hot_y));
@@ -2597,23 +2596,22 @@ gdk_win32_drag_context_set_hotspot (GdkDragContext *drag,
}
static void
-gdk_win32_drag_context_class_init (GdkWin32DragContextClass *klass)
+gdk_win32_drag_class_init (GdkWin32DragClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
+ GdkDragClass *drag_class = GDK_DRAG_CLASS (klass);
- object_class->finalize = gdk_win32_drag_context_finalize;
+ object_class->finalize = gdk_win32_drag_finalize;
- context_class->drag_abort = gdk_win32_drag_context_drag_abort;
- context_class->drag_drop = gdk_win32_drag_context_drag_drop;
-
- context_class->get_drag_surface = gdk_win32_drag_context_get_drag_surface;
- context_class->set_hotspot = gdk_win32_drag_context_set_hotspot;
- context_class->drop_done = gdk_win32_drag_context_drop_done;
- context_class->set_cursor = gdk_win32_drag_context_set_cursor;
- context_class->cancel = gdk_win32_drag_context_cancel;
- context_class->drop_performed = gdk_win32_drag_context_drop_performed;
- context_class->handle_event = gdk_win32_drag_context_handle_event;
- context_class->action_changed = gdk_win32_drag_context_action_changed;
+ drag_class->drag_abort = gdk_win32_drag_abort;
+ drag_class->drag_drop = gdk_win32_drag_drop;
+ drag_class->get_drag_surface = gdk_win32_drag_get_drag_surface;
+ drag_class->set_hotspot = gdk_win32_drag_set_hotspot;
+ drag_class->drop_done = gdk_win32_drag_drop_done;
+ drag_class->set_cursor = gdk_win32_drag_set_cursor;
+ drag_class->cancel = gdk_win32_drag_cancel;
+ drag_class->drop_performed = gdk_win32_drag_drop_performed;
+ drag_class->handle_event = gdk_win32_drag_handle_event;
+ drag_class->action_changed = gdk_win32_drag_action_changed;
}
diff --git a/gdk/win32/gdkdrop-win32.c b/gdk/win32/gdkdrop-win32.c
index 1ddba01f06..1525590716 100644
--- a/gdk/win32/gdkdrop-win32.c
+++ b/gdk/win32/gdkdrop-win32.c
@@ -41,7 +41,7 @@
#include "gdkdropprivate.h"
-#include "gdkdnd.h"
+#include "gdkdrag.h"
#include "gdkproperty.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
@@ -172,7 +172,7 @@ gdk_win32_drop_finalize (GObject *object)
static GdkDrop *
gdk_drop_new (GdkDisplay *display,
GdkDevice *device,
- GdkDragContext *drag,
+ GdkDrag *drag,
GdkContentFormats *formats,
GdkSurface *surface,
GdkDragProtocol protocol)
@@ -453,7 +453,7 @@ set_source_actions_helper (GdkDrop *drop,
}
void
-_gdk_win32_local_drop_target_dragenter (GdkDragContext *drag,
+_gdk_win32_local_drop_target_dragenter (GdkDrag *drag,
GdkSurface *dest_surface,
gint x_root,
gint y_root,
@@ -478,7 +478,7 @@ _gdk_win32_local_drop_target_dragenter (GdkDragContext *drag,
drop = gdk_drop_new (display,
gdk_seat_get_pointer (gdk_display_get_default_seat (display)),
drag,
- gdk_content_formats_ref (gdk_drag_context_get_formats (drag)),
+ gdk_content_formats_ref (gdk_drag_get_formats (drag)),
dest_surface,
GDK_DRAG_PROTO_LOCAL);
drop_win32 = GDK_WIN32_DROP (drop);
@@ -518,7 +518,7 @@ idroptarget_dragenter (LPDROPTARGET This,
GdkDisplay *display;
gint pt_x;
gint pt_y;
- GdkDragContext *drag;
+ GdkDrag *drag;
GdkDragAction source_actions;
GdkDragAction dest_actions;
@@ -531,7 +531,7 @@ idroptarget_dragenter (LPDROPTARGET This,
g_clear_object (&ctx->drop);
- /* Try to find the GdkDragContext object for this DnD operation,
+ /* Try to find the GdkDrag object for this DnD operation,
* if it originated in our own application.
*/
drag = NULL;
@@ -593,7 +593,7 @@ _gdk_win32_local_drop_target_will_emit_motion (GdkDrop *drop,
void
_gdk_win32_local_drop_target_dragover (GdkDrop *drop,
- GdkDragContext *drag,
+ GdkDrag *drag,
gint x_root,
gint y_root,
DWORD grfKeyState,
@@ -710,7 +710,7 @@ idroptarget_dragleave (LPDROPTARGET This)
void
_gdk_win32_local_drop_target_drop (GdkDrop *drop,
- GdkDragContext *drag,
+ GdkDrag *drag,
guint32 time_,
GdkDragAction *actions)
{
@@ -1065,7 +1065,7 @@ gdk_win32_drop_status (GdkDrop *drop,
GdkDragAction actions)
{
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
- GdkDragContext *drag;
+ GdkDrag *drag;
g_return_if_fail (drop != NULL);
@@ -1090,7 +1090,7 @@ static void
gdk_win32_drop_finish (GdkDrop *drop,
GdkDragAction action)
{
- GdkDragContext *drag;
+ GdkDrag *drag;
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
g_return_if_fail (drop != NULL);
@@ -1107,7 +1107,7 @@ gdk_win32_drop_finish (GdkDrop *drop,
drag = gdk_drop_get_drag (drop);
if (drag != NULL)
- _gdk_win32_local_drag_context_drop_response (drag, action);
+ _gdk_win32_local_drag_drop_response (drag, action);
*/
}
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 9b2d88110f..e8934b9be8 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -59,7 +59,7 @@
#include "gdkwin32dnd-private.h"
#include "gdkdisplay-win32.h"
//#include "gdkselection-win32.h"
-#include "gdkdndprivate.h"
+#include "gdkdragprivate.h"
#include <windowsx.h>
@@ -873,7 +873,7 @@ _gdk_win32_print_event (const GdkEvent *event)
if (event->dnd.drop != NULL)
g_print ("ctx:%p: %s",
event->dnd.drop,
- _gdk_win32_drag_protocol_to_string (GDK_WIN32_DRAG_CONTEXT (event->dnd.drop)->protocol));
+ _gdk_win32_drag_protocol_to_string (GDK_WIN32_DRAG (event->dnd.drop)->protocol));
break;
case GDK_SCROLL:
g_print ("(%.4g,%.4g) (%.4g,%.4g) %s ",
diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h
index b4352f89c6..4f8a3e2f30 100644
--- a/gdk/win32/gdkprivate-win32.h
+++ b/gdk/win32/gdkprivate-win32.h
@@ -423,12 +423,12 @@ void _gdk_win32_display_create_surface_impl (GdkDisplay *display,
void _gdk_win32_surface_register_dnd (GdkSurface *window);
void _gdk_win32_surface_unregister_dnd (GdkSurface *window);
-GdkDragContext *_gdk_win32_surface_drag_begin (GdkSurface *window,
- GdkDevice *device,
- GdkContentProvider *content,
- GdkDragAction actions,
- gint x_root,
- gint y_root);
+GdkDrag *_gdk_win32_surface_drag_begin (GdkSurface *window,
+ GdkDevice *device,
+ GdkContentProvider *content,
+ GdkDragAction actions,
+ gint x_root,
+ gint y_root);
/* Stray GdkWin32Screen members */
gboolean _gdk_win32_get_setting (const gchar *name, GValue *value);
diff --git a/gdk/win32/gdkwin32dnd-private.h b/gdk/win32/gdkwin32dnd-private.h
index 0c8d89f100..efe081f77e 100644
--- a/gdk/win32/gdkwin32dnd-private.h
+++ b/gdk/win32/gdkwin32dnd-private.h
@@ -26,12 +26,12 @@
G_BEGIN_DECLS
-typedef struct _GdkWin32DragContextUtilityData GdkWin32DragContextUtilityData;
+typedef struct _GdkWin32DragUtilityData GdkWin32DragUtilityData;
/* This structure is deliberately designed to be
* copyable with memcpy(), i.e. no pointers inside.
*/
-struct _GdkWin32DragContextUtilityData
+struct _GdkWin32DragUtilityData
{
gint last_x; /* Coordinates from last event, in GDK space */
gint last_y;
@@ -39,15 +39,15 @@ struct _GdkWin32DragContextUtilityData
GdkWin32DndState state;
};
-struct _GdkWin32DragContext
+struct _GdkWin32Drag
{
- GdkDragContext drag;
+ GdkDrag drag;
/* The drag protocol being used */
GdkDragProtocol protocol;
/* The surface used for grabs.
- * Usually the same as GdkDragContext->source_surface
+ * Usually the same as GdkDrag->source_surface
*/
GdkSurface *grab_surface;
@@ -71,7 +71,7 @@ struct _GdkWin32DragContext
*/
GdkDragAction current_action;
- GdkWin32DragContextUtilityData util_data;
+ GdkWin32DragUtilityData util_data;
guint scale; /* Temporarily caches the HiDPI scale */
gint hot_x; /* Hotspot offset from the top-left of the drag-window, scaled (can be added to GDK space coordinates) */
@@ -84,23 +84,23 @@ struct _GdkWin32DragContext
guint handle_events : 1; /* Whether handle_event() should do anything */
};
-struct _GdkWin32DragContextClass
+struct _GdkWin32DragClass
{
- GdkDragContextClass parent_class;
+ GdkDragClass parent_class;
};
gpointer _gdk_win32_dnd_thread_main (gpointer data);
-GdkDragContext *_gdk_win32_find_drag_for_dest_window (HWND dest_window);
-GdkDrop *_gdk_win32_get_drop_for_dest_surface (GdkSurface *dest);
+GdkDrag *_gdk_win32_find_drag_for_dest_window (HWND dest_window);
+GdkDrop *_gdk_win32_get_drop_for_dest_surface (GdkSurface *dest);
gboolean _gdk_win32_local_drop_target_will_emit_motion (GdkDrop *drop,
gint x_root,
gint y_root,
DWORD grfKeyState);
-void _gdk_win32_local_drop_target_dragenter (GdkDragContext *drag,
+void _gdk_win32_local_drop_target_dragenter (GdkDrag *drag,
GdkSurface *dest_surface,
gint x_root,
gint y_root,
@@ -108,22 +108,22 @@ void _gdk_win32_local_drop_target_dragenter (GdkDragContext *drag,
guint32 time_,
GdkDragAction *actions);
void _gdk_win32_local_drop_target_dragover (GdkDrop *drop,
- GdkDragContext *drag,
+ GdkDrag *drag,
gint x_root,
gint y_root,
DWORD grfKeyState,
guint32 time_,
GdkDragAction *actions);
-void _gdk_win32_local_drop_target_dragleave (GdkDrop *drop,
- guint32 time_);
+void _gdk_win32_local_drop_target_dragleave (GdkDrop *drop,
+ guint32 time_);
void _gdk_win32_local_drop_target_drop (GdkDrop *drop,
- GdkDragContext *drag,
+ GdkDrag *drag,
guint32 time_,
GdkDragAction *actions);
-void _gdk_win32_local_drag_give_feedback (GdkDragContext *drag,
+void _gdk_win32_local_drag_give_feedback (GdkDrag *drag,
GdkDragAction actions);
-void _gdk_win32_local_drag_context_drop_response (GdkDragContext *drag,
+void _gdk_win32_local_drag_drop_response (GdkDrag *drag,
GdkDragAction action);
diff --git a/gdk/win32/gdkwin32dnd.h b/gdk/win32/gdkwin32dnd.h
index 31a0ee85e4..af6cc402dd 100644
--- a/gdk/win32/gdkwin32dnd.h
+++ b/gdk/win32/gdkwin32dnd.h
@@ -26,23 +26,23 @@
G_BEGIN_DECLS
-#define GDK_TYPE_WIN32_DRAG_CONTEXT (gdk_win32_drag_context_get_type ())
-#define GDK_WIN32_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WIN32_DRAG_CONTEXT, GdkWin32DragContext))
-#define GDK_WIN32_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_DRAG_CONTEXT, GdkWin32DragContextClass))
-#define GDK_IS_WIN32_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WIN32_DRAG_CONTEXT))
-#define GDK_IS_WIN32_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_DRAG_CONTEXT))
-#define GDK_WIN32_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_DRAG_CONTEXT, GdkWin32DragContextClass))
+#define GDK_TYPE_WIN32_DRAG (gdk_win32_drag_get_type ())
+#define GDK_WIN32_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WIN32_DRAG, GdkWin32Drag))
+#define GDK_WIN32_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_DRAG, GdkWin32DragClass))
+#define GDK_IS_WIN32_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WIN32_DRAG))
+#define GDK_IS_WIN32_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_DRAG))
+#define GDK_WIN32_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_DRAG, GdkWin32DragClass))
#ifdef GDK_COMPILATION
-typedef struct _GdkWin32DragContext GdkWin32DragContext;
+typedef struct _GdkWin32Drag GdkWin32Drag;
#else
-typedef GdkDragContext GdkWin32DragContext;
+typedef GdkDrag GdkWin32Drag;
#endif
-typedef struct _GdkWin32DragContextClass GdkWin32DragContextClass;
+typedef struct _GdkWin32DragClass GdkWin32DragClass;
GDK_AVAILABLE_IN_ALL
-GType gdk_win32_drag_context_get_type (void);
+GType gdk_win32_drag_get_type (void);
G_END_DECLS
-#endif /* __GDK_WIN32_DRAG_CONTEXT_H__ */
+#endif /* __GDK_WIN32_DRAG_H__ */
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index 04b6178948..383cc09e47 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -32,7 +32,7 @@
#include "gdkclipboard-x11.h"
#include "gdkdeviceprivate.h"
#include "gdkdisplay-x11.h"
-#include "gdkdndprivate.h"
+#include "gdkdragprivate.h"
#include "gdkinternals.h"
#include "gdkintl.h"
#include "gdkproperty.h"
@@ -65,7 +65,7 @@ typedef enum {
* @GDK_DRAG_PROTO_ROOTWIN: An extension to the Xdnd protocol for
* unclaimed root window drops.
*
- * Used in #GdkDragContext to indicate the protocol according to
+ * Used in #GdkDrag to indicate the protocol according to
* which DND is done.
*/
typedef enum
@@ -93,9 +93,9 @@ struct _GdkSurfaceCache {
};
-struct _GdkX11DragContext
+struct _GdkX11Drag
{
- GdkDragContext context;
+ GdkDrag drag;
GdkDragProtocol protocol;
@@ -129,9 +129,9 @@ struct _GdkX11DragContext
guint drop_failed : 1; /* Whether the drop was unsuccessful */
};
-struct _GdkX11DragContextClass
+struct _GdkX11DragClass
{
- GdkDragContextClass parent_class;
+ GdkDragClass parent_class;
};
typedef struct {
@@ -168,89 +168,89 @@ static GrabKey grab_keys[] = {
static GdkSurfaceCache *gdk_surface_cache_ref (GdkSurfaceCache *cache);
static void gdk_surface_cache_unref (GdkSurfaceCache *cache);
-gboolean gdk_x11_drag_context_handle_event (GdkDragContext *context,
- const GdkEvent *event);
-void gdk_x11_drag_context_action_changed (GdkDragContext *context,
- GdkDragAction action);
+gboolean gdk_x11_drag_handle_event (GdkDrag *drag,
+ const GdkEvent *event);
+void gdk_x11_drag_action_changed (GdkDrag *drag,
+ GdkDragAction action);
-static GList *contexts;
+static GList *drags;
static GSList *window_caches;
-G_DEFINE_TYPE (GdkX11DragContext, gdk_x11_drag_context, GDK_TYPE_DRAG_CONTEXT)
+G_DEFINE_TYPE (GdkX11Drag, gdk_x11_drag, GDK_TYPE_DRAG)
static void
-gdk_x11_drag_context_init (GdkX11DragContext *context)
-{
- contexts = g_list_prepend (contexts, context);
-}
-
-static void gdk_x11_drag_context_finalize (GObject *object);
-static Window gdk_x11_drag_context_find_surface (GdkDragContext *context,
- GdkSurface *drag_surface,
- gint x_root,
- gint y_root,
- GdkDragProtocol *protocol);
-static gboolean gdk_x11_drag_context_drag_motion (GdkDragContext *context,
- Window proxy_xid,
- GdkDragProtocol protocol,
- gint x_root,
- gint y_root,
- GdkDragAction suggested_action,
- GdkDragAction possible_actions,
- guint32 time);
-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 GdkSurface * gdk_x11_drag_context_get_drag_surface (GdkDragContext *context);
-static void gdk_x11_drag_context_set_hotspot (GdkDragContext *context,
- gint hot_x,
- gint hot_y);
-static void gdk_x11_drag_context_drop_done (GdkDragContext *context,
- gboolean success);
-static void gdk_x11_drag_context_set_cursor (GdkDragContext *context,
- GdkCursor *cursor);
-static void gdk_x11_drag_context_cancel (GdkDragContext *context,
- GdkDragCancelReason reason);
-static void gdk_x11_drag_context_drop_performed (GdkDragContext *context,
- guint32 time);
+gdk_x11_drag_init (GdkX11Drag *drag)
+{
+ drags = g_list_prepend (drags, drag);
+}
+
+static void gdk_x11_drag_finalize (GObject *object);
+static Window gdk_x11_drag_find_surface (GdkDrag *drag,
+ GdkSurface *drag_surface,
+ gint x_root,
+ gint y_root,
+ GdkDragProtocol *protocol);
+static gboolean gdk_x11_drag_drag_motion (GdkDrag *drag,
+ Window proxy_xid,
+ GdkDragProtocol protocol,
+ gint x_root,
+ gint y_root,
+ GdkDragAction suggested_action,
+ GdkDragAction possible_actions,
+ guint32 time);
+static void gdk_x11_drag_drag_abort (GdkDrag *drag,
+ guint32 time_);
+static void gdk_x11_drag_drag_drop (GdkDrag *drag,
+ guint32 time_);
+static GdkSurface * gdk_x11_drag_get_drag_surface (GdkDrag *drag);
+static void gdk_x11_drag_set_hotspot (GdkDrag *drag,
+ gint hot_x,
+ gint hot_y);
+static void gdk_x11_drag_drop_done (GdkDrag *drag,
+ gboolean success);
+static void gdk_x11_drag_set_cursor (GdkDrag *drag,
+ GdkCursor *cursor);
+static void gdk_x11_drag_cancel (GdkDrag *drag,
+ GdkDragCancelReason reason);
+static void gdk_x11_drag_drop_performed (GdkDrag *drag,
+ guint32 time);
static void
-gdk_x11_drag_context_class_init (GdkX11DragContextClass *klass)
+gdk_x11_drag_class_init (GdkX11DragClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
+ GdkDragClass *drag_class = GDK_DRAG_CLASS (klass);
- object_class->finalize = gdk_x11_drag_context_finalize;
+ object_class->finalize = gdk_x11_drag_finalize;
- context_class->drag_abort = gdk_x11_drag_context_drag_abort;
- context_class->drag_drop = gdk_x11_drag_context_drag_drop;
- 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;
- context_class->set_cursor = gdk_x11_drag_context_set_cursor;
- context_class->cancel = gdk_x11_drag_context_cancel;
- context_class->drop_performed = gdk_x11_drag_context_drop_performed;
- context_class->handle_event = gdk_x11_drag_context_handle_event;
- context_class->action_changed = gdk_x11_drag_context_action_changed;
+ drag_class->drag_abort = gdk_x11_drag_drag_abort;
+ drag_class->drag_drop = gdk_x11_drag_drag_drop;
+ drag_class->get_drag_surface = gdk_x11_drag_get_drag_surface;
+ drag_class->set_hotspot = gdk_x11_drag_set_hotspot;
+ drag_class->drop_done = gdk_x11_drag_drop_done;
+ drag_class->set_cursor = gdk_x11_drag_set_cursor;
+ drag_class->cancel = gdk_x11_drag_cancel;
+ drag_class->drop_performed = gdk_x11_drag_drop_performed;
+ drag_class->handle_event = gdk_x11_drag_handle_event;
+ drag_class->action_changed = gdk_x11_drag_action_changed;
}
static void
-gdk_x11_drag_context_finalize (GObject *object)
+gdk_x11_drag_finalize (GObject *object)
{
- GdkDragContext *context = GDK_DRAG_CONTEXT (object);
- GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (object);
+ GdkDrag *drag = GDK_DRAG (object);
+ GdkX11Drag *x11_drag = GDK_X11_DRAG (object);
GdkSurface *drag_surface, *ipc_surface;
- if (x11_context->cache)
- gdk_surface_cache_unref (x11_context->cache);
+ if (x11_drag->cache)
+ gdk_surface_cache_unref (x11_drag->cache);
- contexts = g_list_remove (contexts, context);
+ drags = g_list_remove (drags, drag);
- drag_surface = context->drag_surface;
- ipc_surface = x11_context->ipc_surface;
+ drag_surface = drag->drag_surface;
+ ipc_surface = x11_drag->ipc_surface;
- G_OBJECT_CLASS (gdk_x11_drag_context_parent_class)->finalize (object);
+ G_OBJECT_CLASS (gdk_x11_drag_parent_class)->finalize (object);
if (drag_surface)
gdk_surface_destroy (drag_surface);
@@ -260,49 +260,49 @@ gdk_x11_drag_context_finalize (GObject *object)
/* Drag Contexts */
-GdkDragContext *
-gdk_x11_drag_context_find (GdkDisplay *display,
- Window source_xid,
- Window dest_xid)
+GdkDrag *
+gdk_x11_drag_find (GdkDisplay *display,
+ Window source_xid,
+ Window dest_xid)
{
GList *tmp_list;
- GdkDragContext *context;
- GdkX11DragContext *context_x11;
- Window context_dest_xid;
+ GdkDrag *drag;
+ GdkX11Drag *drag_x11;
+ Window drag_dest_xid;
- for (tmp_list = contexts; tmp_list; tmp_list = tmp_list->next)
+ for (tmp_list = drags; tmp_list; tmp_list = tmp_list->next)
{
- context = (GdkDragContext *)tmp_list->data;
- context_x11 = (GdkX11DragContext *)context;
+ drag = (GdkDrag *)tmp_list->data;
+ drag_x11 = (GdkX11Drag *)drag;
- if (gdk_drag_context_get_display (context) != display)
+ if (gdk_drag_get_display (drag) != display)
continue;
- context_dest_xid = context_x11->proxy_xid
- ? (context_x11->drop_xid
- ? context_x11->drop_xid
- : context_x11->proxy_xid)
+ drag_dest_xid = drag_x11->proxy_xid
+ ? (drag_x11->drop_xid
+ ? drag_x11->drop_xid
+ : drag_x11->proxy_xid)
: None;
- if (((source_xid == None) || (context->source_surface &&
- (GDK_SURFACE_XID (context->source_surface) == source_xid))) &&
- ((dest_xid == None) || (context_dest_xid == dest_xid)))
- return context;
+ if (((source_xid == None) || (drag->source_surface &&
+ (GDK_SURFACE_XID (drag->source_surface) == source_xid))) &&
+ ((dest_xid == None) || (drag_dest_xid == dest_xid)))
+ return drag;
}
return NULL;
}
static void
-precache_target_list (GdkDragContext *context)
+precache_target_list (GdkDrag *drag)
{
- GdkContentFormats *formats = gdk_drag_context_get_formats (context);
+ GdkContentFormats *formats = gdk_drag_get_formats (drag);
const char * const *atoms;
gsize n_atoms;
atoms = gdk_content_formats_get_mime_types (formats, &n_atoms);
- _gdk_x11_precache_atoms (gdk_drag_context_get_display (context),
+ _gdk_x11_precache_atoms (gdk_drag_get_display (drag),
(const gchar **) atoms,
n_atoms);
}
@@ -328,13 +328,13 @@ free_cache_child (GdkCacheChild *child,
static void
gdk_surface_cache_add (GdkSurfaceCache *cache,
- guint32 xid,
- gint x,
- gint y,
- gint width,
- gint height,
- gboolean mapped)
-{
+ guint32 xid,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ gboolean mapped)
+{
GdkCacheChild *child = g_new (GdkCacheChild, 1);
child->xid = xid;
@@ -354,8 +354,8 @@ gdk_surface_cache_add (GdkSurfaceCache *cache,
GdkFilterReturn
gdk_surface_cache_shape_filter (const XEvent *xevent,
- GdkEvent *event,
- gpointer data)
+ GdkEvent *event,
+ gpointer data)
{
GdkSurfaceCache *cache = data;
@@ -388,8 +388,8 @@ gdk_surface_cache_shape_filter (const XEvent *xevent,
GdkFilterReturn
gdk_surface_cache_filter (const XEvent *xevent,
- GdkEvent *event,
- gpointer data)
+ GdkEvent *event,
+ gpointer data)
{
GdkSurfaceCache *cache = data;
@@ -855,25 +855,25 @@ xdnd_action_to_atom (GdkDisplay *display,
/* Source side */
void
-gdk_x11_drag_context_handle_status (GdkDisplay *display,
- const XEvent *xevent)
+gdk_x11_drag_handle_status (GdkDisplay *display,
+ const XEvent *xevent)
{
guint32 dest_surface = xevent->xclient.data.l[0];
guint32 flags = xevent->xclient.data.l[1];
Atom action = xevent->xclient.data.l[4];
- GdkDragContext *context;
+ GdkDrag *drag;
- context = gdk_x11_drag_context_find (display, xevent->xclient.window, dest_surface);
+ drag = gdk_x11_drag_find (display, xevent->xclient.window, dest_surface);
GDK_DISPLAY_NOTE (display, DND,
g_message ("XdndStatus: dest_surface: %#x action: %ld",
dest_surface, action));
- if (context)
+ if (drag)
{
- GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context);
- if (context_x11->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
- context_x11->drag_status = GDK_DRAG_STATUS_DRAG;
+ GdkX11Drag *drag_x11 = GDK_X11_DRAG (drag);
+ if (drag_x11->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
+ drag_x11->drag_status = GDK_DRAG_STATUS_DRAG;
if (!(action != 0) != !(flags & 1))
{
@@ -882,80 +882,80 @@ gdk_x11_drag_context_handle_status (GdkDisplay *display,
action = 0;
}
- context->action = xdnd_action_from_atom (display, action);
+ drag->action = xdnd_action_from_atom (display, action);
- if (context->action != context_x11->current_action)
+ if (drag->action != drag_x11->current_action)
{
- context_x11->current_action = context->action;
- g_signal_emit_by_name (context, "action-changed", context->action);
+ drag_x11->current_action = drag->action;
+ g_signal_emit_by_name (drag, "action-changed", drag->action);
}
}
}
void
-gdk_x11_drag_context_handle_finished (GdkDisplay *display,
- const XEvent *xevent)
+gdk_x11_drag_handle_finished (GdkDisplay *display,
+ const XEvent *xevent)
{
guint32 dest_surface = xevent->xclient.data.l[0];
- GdkDragContext *context;
- GdkX11DragContext *context_x11;
+ GdkDrag *drag;
+ GdkX11Drag *drag_x11;
- context = gdk_x11_drag_context_find (display, xevent->xclient.window, dest_surface);
+ drag = gdk_x11_drag_find (display, xevent->xclient.window, dest_surface);
GDK_DISPLAY_NOTE (display, DND,
g_message ("XdndFinished: dest_surface: %#x", dest_surface));
- if (context)
+ if (drag)
{
- g_object_ref (context);
+ g_object_ref (drag);
- context_x11 = GDK_X11_DRAG_CONTEXT (context);
- if (context_x11->version == 5)
- context_x11->drop_failed = xevent->xclient.data.l[1] == 0;
+ drag_x11 = GDK_X11_DRAG (drag);
+ if (drag_x11->version == 5)
+ drag_x11->drop_failed = xevent->xclient.data.l[1] == 0;
- g_signal_emit_by_name (context, "dnd-finished");
- gdk_drag_drop_done (context, !context_x11->drop_failed);
+ g_signal_emit_by_name (drag, "dnd-finished");
+ gdk_drag_drop_done (drag, !drag_x11->drop_failed);
- g_object_unref (context);
+ g_object_unref (drag);
}
}
static void
-xdnd_set_targets (GdkX11DragContext *context_x11)
+xdnd_set_targets (GdkX11Drag *drag_x11)
{
- GdkDragContext *context = GDK_DRAG_CONTEXT (context_x11);
+ GdkDrag *drag = GDK_DRAG (drag_x11);
Atom *atomlist;
const char * const *atoms;
gsize i, n_atoms;
- GdkDisplay *display = gdk_drag_context_get_display (context);
+ GdkDisplay *display = gdk_drag_get_display (drag);
- atoms = gdk_content_formats_get_mime_types (gdk_drag_context_get_formats (context), &n_atoms);
+ atoms = gdk_content_formats_get_mime_types (gdk_drag_get_formats (drag), &n_atoms);
atomlist = g_new (Atom, n_atoms);
for (i = 0; i < n_atoms; i++)
atomlist[i] = gdk_x11_get_xatom_by_name_for_display (display, atoms[i]);
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
- GDK_SURFACE_XID (context_x11->ipc_surface),
+ GDK_SURFACE_XID (drag_x11->ipc_surface),
gdk_x11_get_xatom_by_name_for_display (display, "XdndTypeList"),
XA_ATOM, 32, PropModeReplace,
(guchar *)atomlist, n_atoms);
g_free (atomlist);
- context_x11->xdnd_targets_set = 1;
+ drag_x11->xdnd_targets_set = 1;
}
static void
-xdnd_set_actions (GdkX11DragContext *context_x11)
+xdnd_set_actions (GdkX11Drag *drag_x11)
{
- GdkDragContext *context = GDK_DRAG_CONTEXT (context_x11);
+ GdkDrag *drag = GDK_DRAG (drag_x11);
Atom *atomlist;
gint i;
gint n_atoms;
guint actions;
- GdkDisplay *display = gdk_drag_context_get_display (context);
+ GdkDisplay *display = gdk_drag_get_display (drag);
- actions = gdk_drag_context_get_actions (context);
+ actions = gdk_drag_get_actions (drag);
n_atoms = 0;
for (i = 0; i < xdnd_n_actions; i++)
{
@@ -968,7 +968,7 @@ xdnd_set_actions (GdkX11DragContext *context_x11)
atomlist = g_new (Atom, n_atoms);
- actions = gdk_drag_context_get_actions (context);
+ actions = gdk_drag_get_actions (drag);
n_atoms = 0;
for (i = 0; i < xdnd_n_actions; i++)
{
@@ -981,14 +981,14 @@ xdnd_set_actions (GdkX11DragContext *context_x11)
}
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
- GDK_SURFACE_XID (context_x11->ipc_surface),
+ GDK_SURFACE_XID (drag_x11->ipc_surface),
gdk_x11_get_xatom_by_name_for_display (display, "XdndActionList"),
XA_ATOM, 32, PropModeReplace,
(guchar *)atomlist, n_atoms);
g_free (atomlist);
- context_x11->xdnd_actions = gdk_drag_context_get_actions (context);
+ drag_x11->xdnd_actions = gdk_drag_get_actions (drag);
}
static void
@@ -996,10 +996,10 @@ send_client_message_async_cb (Window window,
gboolean success,
gpointer data)
{
- GdkX11DragContext *context_x11 = data;
- GdkDragContext *context = data;
+ GdkX11Drag *drag_x11 = data;
+ GdkDrag *drag = data;
- GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), DND,
+ GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), DND,
g_message ("Got async callback for #%lx, success = %d",
window, success));
@@ -1007,69 +1007,69 @@ send_client_message_async_cb (Window window,
* so we don't end up blocking for a timeout
*/
if (!success &&
- window == context_x11->proxy_xid)
+ window == drag_x11->proxy_xid)
{
- context_x11->proxy_xid = None;
- context->action = 0;
- if (context->action != context_x11->current_action)
+ drag_x11->proxy_xid = None;
+ drag->action = 0;
+ if (drag->action != drag_x11->current_action)
{
- context_x11->current_action = 0;
- g_signal_emit_by_name (context, "action-changed", 0);
+ drag_x11->current_action = 0;
+ g_signal_emit_by_name (drag, "action-changed", 0);
}
- context_x11->drag_status = GDK_DRAG_STATUS_DRAG;
+ drag_x11->drag_status = GDK_DRAG_STATUS_DRAG;
}
- g_object_unref (context);
+ g_object_unref (drag);
}
static void
-send_client_message_async (GdkDragContext *context,
+send_client_message_async (GdkDrag *drag,
Window window,
glong event_mask,
XClientMessageEvent *event_send)
{
- GdkDisplay *display = gdk_drag_context_get_display (context);
+ GdkDisplay *display = gdk_drag_get_display (drag);
- g_object_ref (context);
+ g_object_ref (drag);
_gdk_x11_send_client_message_async (display, window,
FALSE, event_mask, event_send,
- send_client_message_async_cb, context);
+ send_client_message_async_cb, drag);
}
static void
-xdnd_send_xevent (GdkX11DragContext *context_x11,
+xdnd_send_xevent (GdkX11Drag *drag_x11,
XEvent *event_send)
{
- GdkDragContext *context = GDK_DRAG_CONTEXT (context_x11);
- GdkDisplay *display = gdk_drag_context_get_display (context);
+ GdkDrag *drag = GDK_DRAG (drag_x11);
+ GdkDisplay *display = gdk_drag_get_display (drag);
GdkSurface *surface;
glong event_mask;
g_assert (event_send->xany.type == ClientMessage);
/* We short-circuit messages to ourselves */
- surface = gdk_x11_surface_lookup_for_display (display, context_x11->proxy_xid);
+ surface = gdk_x11_surface_lookup_for_display (display, drag_x11->proxy_xid);
if (surface)
{
if (gdk_x11_drop_filter (surface, event_send))
return;
}
- if (_gdk_x11_display_is_root_window (display, context_x11->proxy_xid))
+ if (_gdk_x11_display_is_root_window (display, drag_x11->proxy_xid))
event_mask = ButtonPressMask;
else
event_mask = 0;
- send_client_message_async (context, context_x11->proxy_xid, event_mask,
+ send_client_message_async (drag, drag_x11->proxy_xid, event_mask,
&event_send->xclient);
}
static void
-xdnd_send_enter (GdkX11DragContext *context_x11)
+xdnd_send_enter (GdkX11Drag *drag_x11)
{
- GdkDragContext *context = GDK_DRAG_CONTEXT (context_x11);
- GdkDisplay *display = gdk_drag_context_get_display (context);
+ GdkDrag *drag = GDK_DRAG (drag_x11);
+ GdkDisplay *display = gdk_drag_get_display (drag);
const char * const *atoms;
gsize i, n_atoms;
XEvent xev;
@@ -1077,24 +1077,24 @@ xdnd_send_enter (GdkX11DragContext *context_x11)
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndEnter");
xev.xclient.format = 32;
- xev.xclient.window = context_x11->drop_xid
- ? context_x11->drop_xid
- : context_x11->proxy_xid;
- xev.xclient.data.l[0] = GDK_SURFACE_XID (context_x11->ipc_surface);
- xev.xclient.data.l[1] = (context_x11->version << 24); /* version */
+ xev.xclient.window = drag_x11->drop_xid
+ ? drag_x11->drop_xid
+ : drag_x11->proxy_xid;
+ xev.xclient.data.l[0] = GDK_SURFACE_XID (drag_x11->ipc_surface);
+ xev.xclient.data.l[1] = (drag_x11->version << 24); /* version */
xev.xclient.data.l[2] = 0;
xev.xclient.data.l[3] = 0;
xev.xclient.data.l[4] = 0;
GDK_DISPLAY_NOTE (display, DND,
g_message ("Sending enter source window %#lx XDND protocol version %d\n",
- GDK_SURFACE_XID (context_x11->ipc_surface), context_x11->version));
- atoms = gdk_content_formats_get_mime_types (gdk_drag_context_get_formats (context), &n_atoms);
+ GDK_SURFACE_XID (drag_x11->ipc_surface), drag_x11->version));
+ atoms = gdk_content_formats_get_mime_types (gdk_drag_get_formats (drag), &n_atoms);
if (n_atoms > 3)
{
- if (!context_x11->xdnd_targets_set)
- xdnd_set_targets (context_x11);
+ if (!drag_x11->xdnd_targets_set)
+ xdnd_set_targets (drag_x11);
xev.xclient.data.l[1] |= 1;
}
else
@@ -1105,79 +1105,79 @@ xdnd_send_enter (GdkX11DragContext *context_x11)
}
}
- xdnd_send_xevent (context_x11, &xev);
+ xdnd_send_xevent (drag_x11, &xev);
}
static void
-xdnd_send_leave (GdkX11DragContext *context_x11)
+xdnd_send_leave (GdkX11Drag *drag_x11)
{
- GdkDragContext *context = GDK_DRAG_CONTEXT (context_x11);
- GdkDisplay *display = gdk_drag_context_get_display (context);
+ GdkDrag *drag = GDK_DRAG (drag_x11);
+ GdkDisplay *display = gdk_drag_get_display (drag);
XEvent xev;
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndLeave");
xev.xclient.format = 32;
- xev.xclient.window = context_x11->drop_xid
- ? context_x11->drop_xid
- : context_x11->proxy_xid;
- xev.xclient.data.l[0] = GDK_SURFACE_XID (context_x11->ipc_surface);
+ xev.xclient.window = drag_x11->drop_xid
+ ? drag_x11->drop_xid
+ : drag_x11->proxy_xid;
+ xev.xclient.data.l[0] = GDK_SURFACE_XID (drag_x11->ipc_surface);
xev.xclient.data.l[1] = 0;
xev.xclient.data.l[2] = 0;
xev.xclient.data.l[3] = 0;
xev.xclient.data.l[4] = 0;
- xdnd_send_xevent (context_x11, &xev);
+ xdnd_send_xevent (drag_x11, &xev);
}
static void
-xdnd_send_drop (GdkX11DragContext *context_x11,
+xdnd_send_drop (GdkX11Drag *drag_x11,
guint32 time)
{
- GdkDragContext *context = GDK_DRAG_CONTEXT (context_x11);
- GdkDisplay *display = gdk_drag_context_get_display (context);
+ GdkDrag *drag = GDK_DRAG (drag_x11);
+ GdkDisplay *display = gdk_drag_get_display (drag);
XEvent xev;
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndDrop");
xev.xclient.format = 32;
- xev.xclient.window = context_x11->drop_xid
- ? context_x11->drop_xid
- : context_x11->proxy_xid;
- xev.xclient.data.l[0] = GDK_SURFACE_XID (context_x11->ipc_surface);
+ xev.xclient.window = drag_x11->drop_xid
+ ? drag_x11->drop_xid
+ : drag_x11->proxy_xid;
+ xev.xclient.data.l[0] = GDK_SURFACE_XID (drag_x11->ipc_surface);
xev.xclient.data.l[1] = 0;
xev.xclient.data.l[2] = time;
xev.xclient.data.l[3] = 0;
xev.xclient.data.l[4] = 0;
- xdnd_send_xevent (context_x11, &xev);
+ xdnd_send_xevent (drag_x11, &xev);
}
static void
-xdnd_send_motion (GdkX11DragContext *context_x11,
+xdnd_send_motion (GdkX11Drag *drag_x11,
gint x_root,
gint y_root,
GdkDragAction action,
guint32 time)
{
- GdkDragContext *context = GDK_DRAG_CONTEXT (context_x11);
- GdkDisplay *display = gdk_drag_context_get_display (context);
+ GdkDrag *drag = GDK_DRAG (drag_x11);
+ GdkDisplay *display = gdk_drag_get_display (drag);
XEvent xev;
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndPosition");
xev.xclient.format = 32;
- xev.xclient.window = context_x11->drop_xid
- ? context_x11->drop_xid
- : context_x11->proxy_xid;
- xev.xclient.data.l[0] = GDK_SURFACE_XID (context_x11->ipc_surface);
+ xev.xclient.window = drag_x11->drop_xid
+ ? drag_x11->drop_xid
+ : drag_x11->proxy_xid;
+ xev.xclient.data.l[0] = GDK_SURFACE_XID (drag_x11->ipc_surface);
xev.xclient.data.l[1] = 0;
xev.xclient.data.l[2] = (x_root << 16) | y_root;
xev.xclient.data.l[3] = time;
xev.xclient.data.l[4] = xdnd_action_to_atom (display, action);
- xdnd_send_xevent (context_x11, &xev);
- context_x11->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
+ xdnd_send_xevent (drag_x11, &xev);
+ drag_x11->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
}
static guint32
@@ -1309,15 +1309,15 @@ xdnd_precache_atoms (GdkDisplay *display)
/* Source side */
static void
-gdk_drag_do_leave (GdkX11DragContext *context_x11,
+gdk_drag_do_leave (GdkX11Drag *drag_x11,
guint32 time)
{
- if (context_x11->proxy_xid)
+ if (drag_x11->proxy_xid)
{
- switch (context_x11->protocol)
+ switch (drag_x11->protocol)
{
case GDK_DRAG_PROTO_XDND:
- xdnd_send_leave (context_x11);
+ xdnd_send_leave (drag_x11);
break;
case GDK_DRAG_PROTO_ROOTWIN:
case GDK_DRAG_PROTO_NONE:
@@ -1325,7 +1325,7 @@ gdk_drag_do_leave (GdkX11DragContext *context_x11,
break;
}
- context_x11->proxy_xid = None;
+ drag_x11->proxy_xid = None;
}
}
@@ -1401,33 +1401,33 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay *display,
}
static GdkSurfaceCache *
-drag_context_find_window_cache (GdkX11DragContext *context_x11,
+drag_find_window_cache (GdkX11Drag *drag_x11,
GdkDisplay *display)
{
- if (!context_x11->cache)
- context_x11->cache = gdk_surface_cache_get (display);
+ if (!drag_x11->cache)
+ drag_x11->cache = gdk_surface_cache_get (display);
- return context_x11->cache;
+ return drag_x11->cache;
}
static Window
-gdk_x11_drag_context_find_surface (GdkDragContext *context,
+gdk_x11_drag_find_surface (GdkDrag *drag,
GdkSurface *drag_surface,
gint x_root,
gint y_root,
GdkDragProtocol *protocol)
{
GdkX11Screen *screen_x11;
- GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context);
+ GdkX11Drag *drag_x11 = GDK_X11_DRAG (drag);
GdkSurfaceCache *window_cache;
GdkDisplay *display;
Window dest;
Window proxy;
- display = gdk_drag_context_get_display (context);
+ display = gdk_drag_get_display (drag);
screen_x11 = GDK_X11_SCREEN(GDK_X11_DISPLAY (display)->screen);
- window_cache = drag_context_find_window_cache (context_x11, display);
+ window_cache = drag_find_window_cache (drag_x11, display);
dest = get_client_window_at_coords (window_cache,
drag_surface && GDK_SURFACE_IS_X11 (drag_surface) ?
@@ -1435,9 +1435,9 @@ gdk_x11_drag_context_find_surface (GdkDragContext *context,
x_root * screen_x11->surface_scale,
y_root * screen_x11->surface_scale);
- if (context_x11->dest_xid != dest)
+ if (drag_x11->dest_xid != dest)
{
- context_x11->dest_xid = dest;
+ drag_x11->dest_xid = dest;
/* Check if new destination accepts drags, and which protocol */
@@ -1450,32 +1450,32 @@ gdk_x11_drag_context_find_surface (GdkDragContext *context,
proxy = _gdk_x11_display_get_drag_protocol (display,
dest,
protocol,
- &context_x11->version);
+ &drag_x11->version);
}
else
{
proxy = dest;
- *protocol = context_x11->protocol;
+ *protocol = drag_x11->protocol;
}
return proxy;
}
static void
-move_drag_surface (GdkDragContext *context,
+move_drag_surface (GdkDrag *drag,
guint x_root,
guint y_root)
{
- GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context);
+ GdkX11Drag *drag_x11 = GDK_X11_DRAG (drag);
- gdk_surface_move (context_x11->drag_surface,
- x_root - context_x11->hot_x,
- y_root - context_x11->hot_y);
- gdk_surface_raise (context_x11->drag_surface);
+ gdk_surface_move (drag_x11->drag_surface,
+ x_root - drag_x11->hot_x,
+ y_root - drag_x11->hot_y);
+ gdk_surface_raise (drag_x11->drag_surface);
}
static gboolean
-gdk_x11_drag_context_drag_motion (GdkDragContext *context,
+gdk_x11_drag_drag_motion (GdkDrag *drag,
Window proxy_xid,
GdkDragProtocol protocol,
gint x_root,
@@ -1484,68 +1484,68 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
GdkDragAction possible_actions,
guint32 time)
{
- GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context);
+ GdkX11Drag *drag_x11 = GDK_X11_DRAG (drag);
- if (context_x11->drag_surface)
- move_drag_surface (context, x_root, y_root);
+ if (drag_x11->drag_surface)
+ move_drag_surface (drag, x_root, y_root);
- gdk_drag_context_set_actions (context, possible_actions, suggested_action);
+ gdk_drag_set_actions (drag, possible_actions, suggested_action);
- if (protocol == GDK_DRAG_PROTO_XDND && context_x11->version == 0)
+ if (protocol == GDK_DRAG_PROTO_XDND && drag_x11->version == 0)
{
/* This ugly hack is necessary since GTK+ doesn't know about
* the XDND protocol version, and in particular doesn't know
* that gdk_drag_find_window() has the side-effect
- * of setting context_x11->version, and therefore sometimes call
- * gdk_x11_drag_context_drag_motion() without a prior call to
+ * of setting drag_x11->version, and therefore sometimes call
+ * gdk_x11_drag_drag_motion() without a prior call to
* gdk_drag_find_window(). This happens, e.g.
* when GTK+ is proxying DND events to embedded windows.
*/
if (proxy_xid)
{
- GdkDisplay *display = gdk_drag_context_get_display (context);
+ GdkDisplay *display = gdk_drag_get_display (drag);
xdnd_check_dest (display,
proxy_xid,
- &context_x11->version);
+ &drag_x11->version);
}
}
/* When we have a Xdnd target, make sure our XdndActionList
* matches the current actions;
*/
- if (protocol == GDK_DRAG_PROTO_XDND && context_x11->xdnd_actions != gdk_drag_context_get_actions (context))
+ if (protocol == GDK_DRAG_PROTO_XDND && drag_x11->xdnd_actions != gdk_drag_get_actions (drag))
{
if (proxy_xid)
{
- GdkDisplay *display = gdk_drag_context_get_display (context);
+ GdkDisplay *display = gdk_drag_get_display (drag);
GdkDrop *drop = GDK_X11_DISPLAY (display)->current_drop;
if (drop && GDK_SURFACE_XID (gdk_drop_get_surface (drop)) == proxy_xid)
gdk_x11_drop_read_actions (drop);
else
- xdnd_set_actions (context_x11);
+ xdnd_set_actions (drag_x11);
}
}
- if (context_x11->proxy_xid != proxy_xid)
+ if (drag_x11->proxy_xid != proxy_xid)
{
/* Send a leave to the last destination */
- gdk_drag_do_leave (context_x11, time);
- context_x11->drag_status = GDK_DRAG_STATUS_DRAG;
+ gdk_drag_do_leave (drag_x11, time);
+ drag_x11->drag_status = GDK_DRAG_STATUS_DRAG;
/* Check if new destination accepts drags, and which protocol */
if (proxy_xid)
{
- context_x11->proxy_xid = proxy_xid;
- context_x11->drop_xid = context_x11->dest_xid;
- context_x11->protocol = protocol;
+ drag_x11->proxy_xid = proxy_xid;
+ drag_x11->drop_xid = drag_x11->dest_xid;
+ drag_x11->protocol = protocol;
switch (protocol)
{
case GDK_DRAG_PROTO_XDND:
- xdnd_send_enter (context_x11);
+ xdnd_send_enter (drag_x11);
break;
case GDK_DRAG_PROTO_ROOTWIN:
@@ -1556,60 +1556,60 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
}
else
{
- context_x11->proxy_xid = None;
- context_x11->drop_xid = None;
- context->action = 0;
+ drag_x11->proxy_xid = None;
+ drag_x11->drop_xid = None;
+ drag->action = 0;
}
/* Push a status event, to let the client know that
* the drag changed
*/
- if (context->action != context_x11->current_action)
+ if (drag->action != drag_x11->current_action)
{
- context_x11->current_action = context->action;
- g_signal_emit_by_name (context, "action-changed", context->action);
+ drag_x11->current_action = drag->action;
+ g_signal_emit_by_name (drag, "action-changed", drag->action);
}
}
/* Send a drag-motion event */
- context_x11->last_x = x_root;
- context_x11->last_y = y_root;
+ drag_x11->last_x = x_root;
+ drag_x11->last_y = y_root;
- if (context_x11->proxy_xid)
+ if (drag_x11->proxy_xid)
{
- GdkDisplay *display = gdk_drag_context_get_display (context);
+ GdkDisplay *display = gdk_drag_get_display (drag);
GdkX11Screen *screen_x11 = GDK_X11_SCREEN(GDK_X11_DISPLAY (display)->screen);
- if (context_x11->drag_status == GDK_DRAG_STATUS_DRAG)
+ if (drag_x11->drag_status == GDK_DRAG_STATUS_DRAG)
{
- switch (context_x11->protocol)
+ switch (drag_x11->protocol)
{
case GDK_DRAG_PROTO_XDND:
- xdnd_send_motion (context_x11, x_root * screen_x11->surface_scale, y_root * screen_x11->surface_scale, suggested_action, time);
+ xdnd_send_motion (drag_x11, x_root * screen_x11->surface_scale, y_root * screen_x11->surface_scale, suggested_action, time);
break;
case GDK_DRAG_PROTO_ROOTWIN:
{
- GdkContentFormats *formats = gdk_drag_context_get_formats (context);
+ GdkContentFormats *formats = gdk_drag_get_formats (drag);
/* GTK+ traditionally has used application/x-rootwin-drop,
* but the XDND spec specifies x-rootwindow-drop.
*/
if (gdk_content_formats_contain_mime_type (formats, "application/x-rootwindow-drop") ||
gdk_content_formats_contain_mime_type (formats, "application/x-rootwin-drop"))
- context->action = gdk_drag_context_get_suggested_action (context);
+ drag->action = gdk_drag_get_suggested_action (drag);
else
- context->action = 0;
+ drag->action = 0;
- if (context->action != context_x11->current_action)
+ if (drag->action != drag_x11->current_action)
{
- context_x11->current_action = context->action;
- g_signal_emit_by_name (context, "action-changed", context->action);
+ drag_x11->current_action = drag->action;
+ g_signal_emit_by_name (drag, "action-changed", drag->action);
}
}
break;
case GDK_DRAG_PROTO_NONE:
- g_warning ("Invalid drag protocol %u in gdk_x11_drag_context_drag_motion()", context_x11->protocol);
+ g_warning ("Invalid drag protocol %u in gdk_x11_drag_drag_motion()", drag_x11->protocol);
break;
default:
break;
@@ -1623,24 +1623,24 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
}
static void
-gdk_x11_drag_context_drag_abort (GdkDragContext *context,
+gdk_x11_drag_drag_abort (GdkDrag *drag,
guint32 time)
{
- gdk_drag_do_leave (GDK_X11_DRAG_CONTEXT (context), time);
+ gdk_drag_do_leave (GDK_X11_DRAG (drag), time);
}
static void
-gdk_x11_drag_context_drag_drop (GdkDragContext *context,
+gdk_x11_drag_drag_drop (GdkDrag *drag,
guint32 time)
{
- GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context);
+ GdkX11Drag *drag_x11 = GDK_X11_DRAG (drag);
- if (context_x11->proxy_xid)
+ if (drag_x11->proxy_xid)
{
- switch (context_x11->protocol)
+ switch (drag_x11->protocol)
{
case GDK_DRAG_PROTO_XDND:
- xdnd_send_drop (context_x11, time);
+ xdnd_send_drop (drag_x11, time);
break;
case GDK_DRAG_PROTO_ROOTWIN:
@@ -1650,7 +1650,7 @@ gdk_x11_drag_context_drag_drop (GdkDragContext *context,
g_warning ("GDK_DRAG_PROTO_NONE is not valid in gdk_drag_drop()");
break;
default:
- g_warning ("Drag protocol %u is not valid in gdk_drag_drop()", context_x11->protocol);
+ g_warning ("Drag protocol %u is not valid in gdk_drag_drop()", drag_x11->protocol);
break;
}
}
@@ -1684,68 +1684,68 @@ _gdk_x11_surface_register_dnd (GdkSurface *surface)
}
static GdkSurface *
-gdk_x11_drag_context_get_drag_surface (GdkDragContext *context)
+gdk_x11_drag_get_drag_surface (GdkDrag *drag)
{
- return GDK_X11_DRAG_CONTEXT (context)->drag_surface;
+ return GDK_X11_DRAG (drag)->drag_surface;
}
static void
-gdk_x11_drag_context_set_hotspot (GdkDragContext *context,
+gdk_x11_drag_set_hotspot (GdkDrag *drag,
gint hot_x,
gint hot_y)
{
- GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context);
+ GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
- x11_context->hot_x = hot_x;
- x11_context->hot_y = hot_y;
+ x11_drag->hot_x = hot_x;
+ x11_drag->hot_y = hot_y;
- if (x11_context->grab_seat)
+ if (x11_drag->grab_seat)
{
/* DnD is managed, update current position */
- move_drag_surface (context, x11_context->last_x, x11_context->last_y);
+ move_drag_surface (drag, x11_drag->last_x, x11_drag->last_y);
}
}
static void
-gdk_x11_drag_context_default_output_done (GObject *context,
+gdk_x11_drag_default_output_done (GObject *drag,
GAsyncResult *result,
gpointer user_data)
{
GError *error = NULL;
- if (!gdk_drag_context_write_finish (GDK_DRAG_CONTEXT (context), result, &error))
+ if (!gdk_drag_write_finish (GDK_DRAG (drag), result, &error))
{
- GDK_DISPLAY_NOTE (gdk_drag_context_get_display (GDK_DRAG_CONTEXT (context)), DND, g_printerr ("failed to write stream: %s\n", error->message));
+ GDK_DISPLAY_NOTE (gdk_drag_get_display (GDK_DRAG (drag)), DND, g_printerr ("failed to write stream: %s\n", error->message));
g_error_free (error);
}
}
static void
-gdk_x11_drag_context_default_output_handler (GOutputStream *stream,
+gdk_x11_drag_default_output_handler (GOutputStream *stream,
const char *mime_type,
gpointer user_data)
{
- gdk_drag_context_write_async (GDK_DRAG_CONTEXT (user_data),
+ gdk_drag_write_async (GDK_DRAG (user_data),
mime_type,
stream,
G_PRIORITY_DEFAULT,
NULL,
- gdk_x11_drag_context_default_output_done,
+ gdk_x11_drag_default_output_done,
NULL);
g_object_unref (stream);
}
static gboolean
-gdk_x11_drag_context_xevent (GdkDisplay *display,
+gdk_x11_drag_xevent (GdkDisplay *display,
const XEvent *xevent,
gpointer data)
{
- GdkDragContext *context = GDK_DRAG_CONTEXT (data);
- GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context);
+ GdkDrag *drag = GDK_DRAG (data);
+ GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
Window xwindow;
Atom xselection;
- xwindow = GDK_SURFACE_XID (x11_context->ipc_surface);
+ xwindow = GDK_SURFACE_XID (x11_drag->ipc_surface);
xselection = gdk_x11_get_xatom_by_name_for_display (display, "XdndSelection");
if (xevent->xany.window != xwindow)
@@ -1757,15 +1757,15 @@ gdk_x11_drag_context_xevent (GdkDisplay *display,
if (xevent->xselectionclear.selection != xselection)
return FALSE;
- if (xevent->xselectionclear.time < x11_context->timestamp)
+ if (xevent->xselectionclear.time < x11_drag->timestamp)
{
GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("ignoring SelectionClear with too old timestamp (%lu vs %lu)\n",
- xevent->xselectionclear.time, x11_context->timestamp));
+ xevent->xselectionclear.time, x11_drag->timestamp));
return FALSE;
}
GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("got SelectionClear, aborting DND\n"));
- gdk_drag_context_cancel (context, GDK_DRAG_CANCEL_ERROR);
+ gdk_drag_cancel (drag, GDK_DRAG_CANCEL_ERROR);
return TRUE;
case SelectionRequest:
@@ -1792,23 +1792,23 @@ gdk_x11_drag_context_xevent (GdkDisplay *display,
target, property));
gdk_x11_selection_output_streams_create (display,
- gdk_drag_context_get_formats (context),
+ gdk_drag_get_formats (drag),
xevent->xselectionrequest.requestor,
xevent->xselectionrequest.selection,
xevent->xselectionrequest.target,
xevent->xselectionrequest.property ? xevent->xselectionrequest.property
: xevent->xselectionrequest.target,
xevent->xselectionrequest.time,
- gdk_x11_drag_context_default_output_handler,
- context);
+ gdk_x11_drag_default_output_handler,
+ drag);
return TRUE;
}
case ClientMessage:
if (xevent->xclient.message_type == gdk_x11_get_xatom_by_name_for_display (display, "XdndStatus"))
- gdk_x11_drag_context_handle_status (display, xevent);
+ gdk_x11_drag_handle_status (display, xevent);
else if (xevent->xclient.message_type == gdk_x11_get_xatom_by_name_for_display (display, "XdndFinished"))
- gdk_x11_drag_context_handle_finished (display, xevent);
+ gdk_x11_drag_handle_finished (display, xevent);
else
return FALSE;
return TRUE;
@@ -1830,7 +1830,7 @@ ease_out_cubic (double t)
typedef struct _GdkDragAnim GdkDragAnim;
struct _GdkDragAnim {
- GdkX11DragContext *context;
+ GdkX11Drag *drag;
GdkFrameClock *frame_clock;
gint64 start_time;
};
@@ -1838,7 +1838,7 @@ struct _GdkDragAnim {
static void
gdk_drag_anim_destroy (GdkDragAnim *anim)
{
- g_object_unref (anim->context);
+ g_object_unref (anim->drag);
g_slice_free (GdkDragAnim, anim);
}
@@ -1846,7 +1846,7 @@ static gboolean
gdk_drag_anim_timeout (gpointer data)
{
GdkDragAnim *anim = data;
- GdkX11DragContext *context = anim->context;
+ GdkX11Drag *drag = anim->drag;
GdkFrameClock *frame_clock = anim->frame_clock;
gint64 current_time;
double f;
@@ -1864,38 +1864,38 @@ gdk_drag_anim_timeout (gpointer data)
t = ease_out_cubic (f);
- gdk_surface_show (context->drag_surface);
- gdk_surface_move (context->drag_surface,
- context->last_x + (context->start_x - context->last_x) * t,
- context->last_y + (context->start_y - context->last_y) * t);
- gdk_surface_set_opacity (context->drag_surface, 1.0 - f);
+ gdk_surface_show (drag->drag_surface);
+ gdk_surface_move (drag->drag_surface,
+ drag->last_x + (drag->start_x - drag->last_x) * t,
+ drag->last_y + (drag->start_y - drag->last_y) * t);
+ gdk_surface_set_opacity (drag->drag_surface, 1.0 - f);
return G_SOURCE_CONTINUE;
}
static void
-gdk_x11_drag_context_release_selection (GdkDragContext *context)
+gdk_x11_drag_release_selection (GdkDrag *drag)
{
- GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context);
+ GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
GdkDisplay *display;
Display *xdisplay;
Window xwindow;
Atom xselection;
- display = gdk_drag_context_get_display (context);
+ display = gdk_drag_get_display (drag);
xdisplay = GDK_DISPLAY_XDISPLAY (display);
xselection = gdk_x11_get_xatom_by_name_for_display (display, "XdndSelection");
- xwindow = GDK_SURFACE_XID (x11_context->ipc_surface);
+ xwindow = GDK_SURFACE_XID (x11_drag->ipc_surface);
if (XGetSelectionOwner (xdisplay, xselection) == xwindow)
XSetSelectionOwner (xdisplay, xselection, None, CurrentTime);
}
static void
-gdk_x11_drag_context_drop_done (GdkDragContext *context,
+gdk_x11_drag_drop_done (GdkDrag *drag,
gboolean success)
{
- GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context);
+ GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
GdkDragAnim *anim;
/*
cairo_surface_t *win_surface;
@@ -1904,23 +1904,23 @@ gdk_x11_drag_context_drop_done (GdkDragContext *context,
*/
guint id;
- gdk_x11_drag_context_release_selection (context);
+ gdk_x11_drag_release_selection (drag);
- g_signal_handlers_disconnect_by_func (gdk_drag_context_get_display (context),
- gdk_x11_drag_context_xevent,
- context);
+ g_signal_handlers_disconnect_by_func (gdk_drag_get_display (drag),
+ gdk_x11_drag_xevent,
+ drag);
if (success)
{
- gdk_surface_hide (x11_context->drag_surface);
+ gdk_surface_hide (x11_drag->drag_surface);
return;
}
/*
- win_surface = _gdk_surface_ref_cairo_surface (x11_context->drag_surface);
- surface = gdk_surface_create_similar_surface (x11_context->drag_surface,
+ win_surface = _gdk_surface_ref_cairo_surface (x11_drag->drag_surface);
+ surface = gdk_surface_create_similar_surface (x11_drag->drag_surface,
cairo_surface_get_content (win_surface),
- gdk_surface_get_width (x11_context->drag_surface),
- gdk_surface_get_height (x11_context->drag_surface));
+ gdk_surface_get_width (x11_drag->drag_surface),
+ gdk_surface_get_height (x11_drag->drag_surface));
cr = cairo_create (surface);
cairo_set_source_surface (cr, win_surface, 0, 0);
cairo_paint (cr);
@@ -1929,15 +1929,15 @@ gdk_x11_drag_context_drop_done (GdkDragContext *context,
pattern = cairo_pattern_create_for_surface (surface);
- gdk_surface_set_background_pattern (x11_context->drag_surface, pattern);
+ gdk_surface_set_background_pattern (x11_drag->drag_surface, pattern);
cairo_pattern_destroy (pattern);
cairo_surface_destroy (surface);
*/
anim = g_slice_new0 (GdkDragAnim);
- anim->context = g_object_ref (x11_context);
- anim->frame_clock = gdk_surface_get_frame_clock (x11_context->drag_surface);
+ anim->drag = g_object_ref (x11_drag);
+ anim->frame_clock = gdk_surface_get_frame_clock (x11_drag->drag_surface);
anim->start_time = gdk_frame_clock_get_frame_time (anim->frame_clock);
id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
@@ -1947,10 +1947,10 @@ gdk_x11_drag_context_drop_done (GdkDragContext *context,
}
static gboolean
-drag_context_grab (GdkDragContext *context)
+drag_grab (GdkDrag *drag)
{
- GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context);
- GdkDevice *device = gdk_drag_context_get_device (context);
+ GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
+ GdkDevice *device = gdk_drag_get_device (drag);
GdkSeatCapabilities capabilities;
GdkDisplay *display;
Window root;
@@ -1958,12 +1958,12 @@ drag_context_grab (GdkDragContext *context)
gint keycode, i;
GdkCursor *cursor;
- if (!x11_context->ipc_surface)
+ if (!x11_drag->ipc_surface)
return FALSE;
- display = gdk_drag_context_get_display (context);
+ display = gdk_drag_get_display (drag);
root = GDK_DISPLAY_XROOTWIN (display);
- seat = gdk_device_get_seat (gdk_drag_context_get_device (context));
+ seat = gdk_device_get_seat (gdk_drag_get_device (drag));
#ifdef XINPUT_2
if (GDK_IS_X11_DEVICE_XI2 (device))
@@ -1972,15 +1972,15 @@ drag_context_grab (GdkDragContext *context)
#endif
capabilities = GDK_SEAT_CAPABILITY_ALL;
- cursor = gdk_drag_get_cursor (context, x11_context->current_action);
- g_set_object (&x11_context->cursor, cursor);
+ cursor = gdk_drag_get_cursor (drag, x11_drag->current_action);
+ g_set_object (&x11_drag->cursor, cursor);
- if (gdk_seat_grab (seat, x11_context->ipc_surface,
+ if (gdk_seat_grab (seat, x11_drag->ipc_surface,
capabilities, FALSE,
- x11_context->cursor, NULL, NULL, NULL) != GDK_GRAB_SUCCESS)
+ x11_drag->cursor, NULL, NULL, NULL) != GDK_GRAB_SUCCESS)
return FALSE;
- g_set_object (&x11_context->grab_seat, seat);
+ g_set_object (&x11_drag->grab_seat, seat);
gdk_x11_display_error_trap_push (display);
@@ -2040,23 +2040,23 @@ drag_context_grab (GdkDragContext *context)
}
static void
-drag_context_ungrab (GdkDragContext *context)
+drag_ungrab (GdkDrag *drag)
{
- GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context);
+ GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
GdkDisplay *display;
GdkDevice *keyboard;
Window root;
gint keycode, i;
- if (!x11_context->grab_seat)
+ if (!x11_drag->grab_seat)
return;
- gdk_seat_ungrab (x11_context->grab_seat);
+ gdk_seat_ungrab (x11_drag->grab_seat);
- display = gdk_drag_context_get_display (context);
- keyboard = gdk_seat_get_keyboard (x11_context->grab_seat);
+ display = gdk_drag_get_display (drag);
+ keyboard = gdk_seat_get_keyboard (x11_drag->grab_seat);
root = GDK_DISPLAY_XROOTWIN (display);
- g_clear_object (&x11_context->grab_seat);
+ g_clear_object (&x11_drag->grab_seat);
for (i = 0; i < G_N_ELEMENTS (grab_keys); ++i)
{
@@ -2091,91 +2091,91 @@ drag_context_ungrab (GdkDragContext *context)
}
}
-GdkDragContext *
-_gdk_x11_surface_drag_begin (GdkSurface *surface,
- GdkDevice *device,
- GdkContentProvider *content,
- GdkDragAction actions,
- gint dx,
- gint dy)
+GdkDrag *
+_gdk_x11_surface_drag_begin (GdkSurface *surface,
+ GdkDevice *device,
+ GdkContentProvider *content,
+ GdkDragAction actions,
+ gint dx,
+ gint dy)
{
- GdkX11DragContext *x11_context;
- GdkDragContext *context;
+ GdkX11Drag *x11_drag;
+ GdkDrag *drag;
GdkDisplay *display;
int x_root, y_root;
Atom xselection;
display = gdk_surface_get_display (surface);
- context = (GdkDragContext *) g_object_new (GDK_TYPE_X11_DRAG_CONTEXT,
+ drag = (GdkDrag *) g_object_new (GDK_TYPE_X11_DRAG,
"device", device,
"content", content,
NULL);
- x11_context = GDK_X11_DRAG_CONTEXT (context);
+ x11_drag = GDK_X11_DRAG (drag);
- g_signal_connect (display, "xevent", G_CALLBACK (gdk_x11_drag_context_xevent), context);
+ g_signal_connect (display, "xevent", G_CALLBACK (gdk_x11_drag_xevent), drag);
- precache_target_list (context);
+ precache_target_list (drag);
gdk_device_get_position (device, &x_root, &y_root);
x_root += dx;
y_root += dy;
- x11_context->start_x = x_root;
- x11_context->start_y = y_root;
- x11_context->last_x = x_root;
- x11_context->last_y = y_root;
+ x11_drag->start_x = x_root;
+ x11_drag->start_y = y_root;
+ x11_drag->last_x = x_root;
+ x11_drag->last_y = y_root;
- x11_context->protocol = GDK_DRAG_PROTO_XDND;
- x11_context->actions = actions;
- x11_context->ipc_surface = gdk_surface_new_popup (display, &(GdkRectangle) { -99, -99, 1, 1 });
+ x11_drag->protocol = GDK_DRAG_PROTO_XDND;
+ x11_drag->actions = actions;
+ x11_drag->ipc_surface = gdk_surface_new_popup (display, &(GdkRectangle) { -99, -99, 1, 1 });
if (gdk_surface_get_group (surface))
- gdk_surface_set_group (x11_context->ipc_surface, surface);
- gdk_surface_show (x11_context->ipc_surface);
+ gdk_surface_set_group (x11_drag->ipc_surface, surface);
+ gdk_surface_show (x11_drag->ipc_surface);
- context->source_surface = x11_context->ipc_surface;
- g_object_ref (context->source_surface);
+ drag->source_surface = x11_drag->ipc_surface;
+ g_object_ref (drag->source_surface);
- x11_context->drag_surface = create_drag_surface (display);
+ x11_drag->drag_surface = create_drag_surface (display);
- if (!drag_context_grab (context))
+ if (!drag_grab (drag))
{
- g_object_unref (context);
+ g_object_unref (drag);
return NULL;
}
- move_drag_surface (context, x_root, y_root);
+ move_drag_surface (drag, x_root, y_root);
- x11_context->timestamp = gdk_display_get_last_seen_time (display);
+ x11_drag->timestamp = gdk_display_get_last_seen_time (display);
xselection = gdk_x11_get_xatom_by_name_for_display (display, "XdndSelection");
XSetSelectionOwner (GDK_DISPLAY_XDISPLAY (display),
xselection,
- GDK_SURFACE_XID (x11_context->ipc_surface),
- x11_context->timestamp);
- if (XGetSelectionOwner (GDK_DISPLAY_XDISPLAY (display), xselection) != GDK_SURFACE_XID (x11_context->ipc_surface))
+ GDK_SURFACE_XID (x11_drag->ipc_surface),
+ x11_drag->timestamp);
+ if (XGetSelectionOwner (GDK_DISPLAY_XDISPLAY (display), xselection) != GDK_SURFACE_XID (x11_drag->ipc_surface))
{
GDK_DISPLAY_NOTE (display, DND, g_printerr ("failed XSetSelectionOwner() on \"XdndSelection\", aborting DND\n"));
- g_object_unref (context);
+ g_object_unref (drag);
return NULL;
}
- return context;
+ return drag;
}
static void
-gdk_x11_drag_context_set_cursor (GdkDragContext *context,
- GdkCursor *cursor)
+gdk_x11_drag_set_cursor (GdkDrag *drag,
+ GdkCursor *cursor)
{
- GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context);
+ GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
- if (!g_set_object (&x11_context->cursor, cursor))
+ if (!g_set_object (&x11_drag->cursor, cursor))
return;
- if (x11_context->grab_seat)
+ if (x11_drag->grab_seat)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- gdk_device_grab (gdk_seat_get_pointer (x11_context->grab_seat),
- x11_context->ipc_surface,
+ gdk_device_grab (gdk_seat_get_pointer (x11_drag->grab_seat),
+ x11_drag->ipc_surface,
GDK_OWNERSHIP_APPLICATION, FALSE,
GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
cursor, GDK_CURRENT_TIME);
@@ -2184,19 +2184,19 @@ gdk_x11_drag_context_set_cursor (GdkDragContext *context,
}
static void
-gdk_x11_drag_context_cancel (GdkDragContext *context,
- GdkDragCancelReason reason)
+gdk_x11_drag_cancel (GdkDrag *drag,
+ GdkDragCancelReason reason)
{
- drag_context_ungrab (context);
- gdk_drag_drop_done (context, FALSE);
+ drag_ungrab (drag);
+ gdk_drag_drop_done (drag, FALSE);
}
static void
-gdk_x11_drag_context_drop_performed (GdkDragContext *context,
- guint32 time_)
+gdk_x11_drag_drop_performed (GdkDrag *drag,
+ guint32 time_)
{
- gdk_drag_drop (context, time_);
- drag_context_ungrab (context);
+ gdk_drag_drop (drag, time_);
+ drag_ungrab (drag);
}
#define BIG_STEP 20
@@ -2260,30 +2260,30 @@ gdk_drag_get_current_actions (GdkModifierType state,
}
static void
-gdk_drag_update (GdkDragContext *context,
+gdk_drag_update (GdkDrag *drag,
gdouble x_root,
gdouble y_root,
GdkModifierType mods,
guint32 evtime)
{
- GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context);
+ GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
GdkDragAction action, possible_actions;
GdkDragProtocol protocol;
Window proxy;
- gdk_drag_get_current_actions (mods, GDK_BUTTON_PRIMARY, x11_context->actions,
+ gdk_drag_get_current_actions (mods, GDK_BUTTON_PRIMARY, x11_drag->actions,
&action, &possible_actions);
- proxy = gdk_x11_drag_context_find_surface (context,
- x11_context->drag_surface,
+ proxy = gdk_x11_drag_find_surface (drag,
+ x11_drag->drag_surface,
x_root, y_root, &protocol);
- gdk_x11_drag_context_drag_motion (context, proxy, protocol, x_root, y_root,
+ gdk_x11_drag_drag_motion (drag, proxy, protocol, x_root, y_root,
action, possible_actions, evtime);
}
static gboolean
-gdk_dnd_handle_motion_event (GdkDragContext *context,
+gdk_dnd_handle_motion_event (GdkDrag *drag,
const GdkEventMotion *event)
{
GdkModifierType state;
@@ -2291,16 +2291,16 @@ gdk_dnd_handle_motion_event (GdkDragContext *context,
if (!gdk_event_get_state ((GdkEvent *) event, &state))
return FALSE;
- gdk_drag_update (context, event->x_root, event->y_root, state,
+ gdk_drag_update (drag, event->x_root, event->y_root, state,
gdk_event_get_time ((GdkEvent *) event));
return TRUE;
}
static gboolean
-gdk_dnd_handle_key_event (GdkDragContext *context,
+gdk_dnd_handle_key_event (GdkDrag *drag,
const GdkEventKey *event)
{
- GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context);
+ GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
GdkModifierType state;
GdkDevice *pointer;
gint dx, dy;
@@ -2314,7 +2314,7 @@ gdk_dnd_handle_key_event (GdkDragContext *context,
switch (event->keyval)
{
case GDK_KEY_Escape:
- gdk_drag_context_cancel (context, GDK_DRAG_CANCEL_USER_CANCELLED);
+ gdk_drag_cancel (drag, GDK_DRAG_CANCEL_USER_CANCELLED);
return TRUE;
case GDK_KEY_space:
@@ -2322,13 +2322,13 @@ gdk_dnd_handle_key_event (GdkDragContext *context,
case GDK_KEY_ISO_Enter:
case GDK_KEY_KP_Enter:
case GDK_KEY_KP_Space:
- if ((gdk_drag_context_get_selected_action (context) != 0) &&
- (x11_context->proxy_xid != None))
+ if ((gdk_drag_get_selected_action (drag) != 0) &&
+ (x11_drag->proxy_xid != None))
{
- g_signal_emit_by_name (context, "drop-performed");
+ g_signal_emit_by_name (drag, "drop-performed");
}
else
- gdk_drag_context_cancel (context, GDK_DRAG_CANCEL_NO_TARGET);
+ gdk_drag_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET);
return TRUE;
@@ -2365,83 +2365,83 @@ gdk_dnd_handle_key_event (GdkDragContext *context,
if (dx != 0 || dy != 0)
{
- x11_context->last_x += dx;
- x11_context->last_y += dy;
- gdk_device_warp (pointer, x11_context->last_x, x11_context->last_y);
+ x11_drag->last_x += dx;
+ x11_drag->last_y += dy;
+ gdk_device_warp (pointer, x11_drag->last_x, x11_drag->last_y);
}
- gdk_drag_update (context, x11_context->last_x, x11_context->last_y, state,
+ gdk_drag_update (drag, x11_drag->last_x, x11_drag->last_y, state,
gdk_event_get_time ((GdkEvent *) event));
return TRUE;
}
static gboolean
-gdk_dnd_handle_grab_broken_event (GdkDragContext *context,
+gdk_dnd_handle_grab_broken_event (GdkDrag *drag,
const GdkEventGrabBroken *event)
{
- GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context);
+ GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
/* Don't cancel if we break the implicit grab from the initial button_press.
* Also, don't cancel if we re-grab on the widget or on our IPC window, for
* example, when changing the drag cursor.
*/
if (event->implicit ||
- event->grab_surface == x11_context->drag_surface ||
- event->grab_surface == x11_context->ipc_surface)
+ event->grab_surface == x11_drag->drag_surface ||
+ event->grab_surface == x11_drag->ipc_surface)
return FALSE;
if (gdk_event_get_device ((GdkEvent *) event) !=
- gdk_drag_context_get_device (context))
+ gdk_drag_get_device (drag))
return FALSE;
- gdk_drag_context_cancel (context, GDK_DRAG_CANCEL_ERROR);
+ gdk_drag_cancel (drag, GDK_DRAG_CANCEL_ERROR);
return TRUE;
}
static gboolean
-gdk_dnd_handle_button_event (GdkDragContext *context,
+gdk_dnd_handle_button_event (GdkDrag *drag,
const GdkEventButton *event)
{
- GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context);
+ GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
#if 0
/* FIXME: Check the button matches */
- if (event->button != x11_context->button)
+ if (event->button != x11_drag->button)
return FALSE;
#endif
- if ((gdk_drag_context_get_selected_action (context) != 0) &&
- (x11_context->proxy_xid != None))
+ if ((gdk_drag_get_selected_action (drag) != 0) &&
+ (x11_drag->proxy_xid != None))
{
- g_signal_emit_by_name (context, "drop-performed");
+ g_signal_emit_by_name (drag, "drop-performed");
}
else
- gdk_drag_context_cancel (context, GDK_DRAG_CANCEL_NO_TARGET);
+ gdk_drag_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET);
return TRUE;
}
gboolean
-gdk_x11_drag_context_handle_event (GdkDragContext *context,
- const GdkEvent *event)
+gdk_x11_drag_handle_event (GdkDrag *drag,
+ const GdkEvent *event)
{
- GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context);
+ GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
- if (!x11_context->grab_seat)
+ if (!x11_drag->grab_seat)
return FALSE;
switch ((guint) event->any.type)
{
case GDK_MOTION_NOTIFY:
- return gdk_dnd_handle_motion_event (context, &event->motion);
+ return gdk_dnd_handle_motion_event (drag, &event->motion);
case GDK_BUTTON_RELEASE:
- return gdk_dnd_handle_button_event (context, &event->button);
+ return gdk_dnd_handle_button_event (drag, &event->button);
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
- return gdk_dnd_handle_key_event (context, &event->key);
+ return gdk_dnd_handle_key_event (drag, &event->key);
case GDK_GRAB_BROKEN:
- return gdk_dnd_handle_grab_broken_event (context, &event->grab_broken);
+ return gdk_dnd_handle_grab_broken_event (drag, &event->grab_broken);
default:
break;
}
@@ -2450,11 +2450,11 @@ gdk_x11_drag_context_handle_event (GdkDragContext *context,
}
void
-gdk_x11_drag_context_action_changed (GdkDragContext *context,
- GdkDragAction action)
-{
+gdk_x11_drag_action_changed (GdkDrag *drag,
+ GdkDragAction action)
+{
GdkCursor *cursor;
- cursor = gdk_drag_get_cursor (context, action);
- gdk_drag_context_set_cursor (context, cursor);
+ cursor = gdk_drag_get_cursor (drag, action);
+ gdk_drag_set_cursor (drag, cursor);
}
diff --git a/gdk/x11/gdkdrop-x11.c b/gdk/x11/gdkdrop-x11.c
index add5c98cd4..6a71b55cf3 100644
--- a/gdk/x11/gdkdrop-x11.c
+++ b/gdk/x11/gdkdrop-x11.c
@@ -32,7 +32,7 @@
#include "gdkclipboard-x11.h"
#include "gdkdeviceprivate.h"
#include "gdkdisplay-x11.h"
-#include "gdkdndprivate.h"
+#include "gdkdragprivate.h"
#include "gdkinternals.h"
#include "gdkintl.h"
#include "gdkproperty.h"
@@ -336,7 +336,7 @@ gdk_x11_drop_read_actions (GdkDrop *drop)
{
GdkX11Drop *drop_x11 = GDK_X11_DROP (drop);
GdkDisplay *display = gdk_drop_get_display (drop);
- GdkDragContext *drag;
+ GdkDrag *drag;
GdkDragAction actions = GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_ASK;
Atom type;
int format;
@@ -398,7 +398,7 @@ gdk_x11_drop_read_actions (GdkDrop *drop)
}
else
{
- actions = gdk_drag_context_get_actions (drag);
+ actions = gdk_drag_get_actions (drag);
drop_x11->xdnd_have_actions = TRUE;
}
@@ -468,7 +468,7 @@ xdnd_enter_filter (GdkSurface *surface,
GdkX11Display *display_x11;
GdkDrop *drop;
GdkX11Drop *drop_x11;
- GdkDragContext *drag;
+ GdkDrag *drag;
GdkSeat *seat;
gint i;
Atom type;
@@ -548,7 +548,7 @@ xdnd_enter_filter (GdkSurface *surface,
print_target_list (content_formats);
#endif /* G_ENABLE_DEBUG */
- drag = gdk_x11_drag_context_find (display, source_window, GDK_SURFACE_XID (surface));
+ drag = gdk_x11_drag_find (display, source_window, GDK_SURFACE_XID (surface));
drop_x11 = g_object_new (GDK_TYPE_X11_DROP,
"device", gdk_seat_get_pointer (seat),
@@ -768,7 +768,7 @@ gdk_x11_drop_status (GdkDrop *drop,
if (gdk_drop_get_drag (drop))
{
- gdk_x11_drag_context_handle_status (display, &xev);
+ gdk_x11_drag_handle_status (display, &xev);
}
else
{
@@ -821,7 +821,7 @@ gdk_x11_drop_finish (GdkDrop *drop,
if (gdk_drop_get_drag (drop))
{
- gdk_x11_drag_context_handle_status (display, &xev);
+ gdk_x11_drag_handle_status (display, &xev);
}
else
{
@@ -849,7 +849,7 @@ gdk_x11_drop_class_init (GdkX11DropClass *klass)
}
static void
-gdk_x11_drop_init (GdkX11Drop *context)
+gdk_x11_drop_init (GdkX11Drop *drag)
{
}
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index 6af2811756..a609c4b93e 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -196,16 +196,16 @@ Atom _gdk_x11_get_xatom_for_display_printf (GdkDisplay *display,
const gchar *format,
...) G_GNUC_PRINTF (2, 3);
-GdkDragContext *gdk_x11_drag_context_find (GdkDisplay *display,
- Window source_xid,
- Window dest_xid);
-void gdk_x11_drag_context_handle_status (GdkDisplay *display,
- const XEvent *xevent);
-void gdk_x11_drag_context_handle_finished (GdkDisplay *display,
- const XEvent *xevent);
-void gdk_x11_drop_read_actions (GdkDrop *drop);
-gboolean gdk_x11_drop_filter (GdkSurface *surface,
- const XEvent *xevent);
+GdkDrag *gdk_x11_drag_find (GdkDisplay *display,
+ Window source_xid,
+ Window dest_xid);
+void gdk_x11_drag_handle_status (GdkDisplay *display,
+ const XEvent *xevent);
+void gdk_x11_drag_handle_finished (GdkDisplay *display,
+ const XEvent *xevent);
+void gdk_x11_drop_read_actions (GdkDrop *drop);
+gboolean gdk_x11_drop_filter (GdkSurface *surface,
+ const XEvent *xevent);
typedef struct _GdkSurfaceCache GdkSurfaceCache;
@@ -225,7 +225,7 @@ void _gdk_x11_cursor_display_finalize (GdkDisplay *display);
void _gdk_x11_surface_register_dnd (GdkSurface *window);
-GdkDragContext * _gdk_x11_surface_drag_begin (GdkSurface *window,
+GdkDrag * _gdk_x11_surface_drag_begin (GdkSurface *window,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
diff --git a/gdk/x11/gdkx-autocleanups.h b/gdk/x11/gdkx-autocleanups.h
index ff3d5a43a9..a6e6e1c024 100644
--- a/gdk/x11/gdkx-autocleanups.h
+++ b/gdk/x11/gdkx-autocleanups.h
@@ -27,7 +27,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DeviceManagerCore, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DeviceManagerXI2, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DeviceXI2, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Display, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DragContext, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Drag, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11GLContext, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Keymap, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Screen, g_object_unref)
diff --git a/gdk/x11/gdkx11dnd.h b/gdk/x11/gdkx11dnd.h
index a676314219..dfe60500c6 100644
--- a/gdk/x11/gdkx11dnd.h
+++ b/gdk/x11/gdkx11dnd.h
@@ -26,23 +26,23 @@
G_BEGIN_DECLS
-#define GDK_TYPE_X11_DRAG_CONTEXT (gdk_x11_drag_context_get_type ())
-#define GDK_X11_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_X11_DRAG_CONTEXT, GdkX11DragContext))
-#define GDK_X11_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_X11_DRAG_CONTEXT, GdkX11DragContextClass))
-#define GDK_IS_X11_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_X11_DRAG_CONTEXT))
-#define GDK_IS_X11_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_X11_DRAG_CONTEXT))
-#define GDK_X11_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_X11_DRAG_CONTEXT, GdkX11DragContextClass))
+#define GDK_TYPE_X11_DRAG (gdk_x11_drag_get_type ())
+#define GDK_X11_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_X11_DRAG, GdkX11Drag))
+#define GDK_X11_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_X11_DRAG, GdkX11DragClass))
+#define GDK_IS_X11_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_X11_DRAG))
+#define GDK_IS_X11_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_X11_DRAG))
+#define GDK_X11_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_X11_DRAG, GdkX11DragClass))
#ifdef GDK_COMPILATION
-typedef struct _GdkX11DragContext GdkX11DragContext;
+typedef struct _GdkX11Drag GdkX11Drag;
#else
-typedef GdkDragContext GdkX11DragContext;
+typedef GdkDrag GdkX11Drag;
#endif
-typedef struct _GdkX11DragContextClass GdkX11DragContextClass;
+typedef struct _GdkX11DragClass GdkX11DragClass;
GDK_AVAILABLE_IN_ALL
-GType gdk_x11_drag_context_get_type (void);
+GType gdk_x11_drag_get_type (void);
G_END_DECLS
-#endif /* __GDK_X11_DRAG_CONTEXT_H__ */
+#endif /* __GDK_X11_DRAG_H__ */