forked from AuroraMiddleware/gtk
gdk: Rename GdkDragContext to GdkDrag
This is to go along with the newly introduced GdkDrop. This commit includes the necessary updates to the X11, Wayland and Broadway backends. Other backends have to be updated separately.
This commit is contained in:
parent
88b4076fe5
commit
7733f646d6
@ -120,7 +120,7 @@ get_image_paintable (GtkImage *image)
|
||||
|
||||
static void
|
||||
drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
@ -128,14 +128,14 @@ drag_begin (GtkWidget *widget,
|
||||
paintable = get_image_paintable (GTK_IMAGE (widget));
|
||||
if (paintable)
|
||||
{
|
||||
gtk_drag_set_icon_paintable (context, paintable, -2, -2);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, -2, -2);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
gpointer data)
|
||||
|
@ -376,7 +376,7 @@ search_mode_toggled (GObject *searchbar, GParamSpec *pspec, IconBrowserWindow *w
|
||||
|
||||
static void
|
||||
get_image_data (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection,
|
||||
guint target_info,
|
||||
gpointer data)
|
||||
@ -398,7 +398,7 @@ get_image_data (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
get_scalable_image_data (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection,
|
||||
guint target_info,
|
||||
gpointer data)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
363
gdk/gdkdnd.c
363
gdk/gdkdnd.c
@ -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;
|
||||
|
||||
|
50
gdk/gdkdnd.h
50
gdk/gdkdnd.h
@ -35,9 +35,9 @@
|
||||
|
||||
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))
|
||||
#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:
|
||||
@ -45,7 +45,7 @@ G_BEGIN_DECLS
|
||||
* @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.
|
||||
* Used in #GdkDrag to the reason of a cancelled DND operation.
|
||||
*/
|
||||
typedef enum {
|
||||
GDK_DRAG_CANCEL_NO_TARGET,
|
||||
@ -54,46 +54,44 @@ typedef enum {
|
||||
} GdkDragCancelReason;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_drag_context_get_type (void) G_GNUC_CONST;
|
||||
GType gdk_drag_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDisplay * gdk_drag_context_get_display (GdkDragContext *context);
|
||||
GdkDisplay * gdk_drag_get_display (GdkDrag *drag);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDevice * gdk_drag_context_get_device (GdkDragContext *context);
|
||||
GdkDevice * gdk_drag_get_device (GdkDrag *drag);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkContentFormats *gdk_drag_context_get_formats (GdkDragContext *context);
|
||||
GdkContentFormats *gdk_drag_get_formats (GdkDrag *drag);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drag_context_get_actions (GdkDragContext *context);
|
||||
GdkDragAction gdk_drag_get_actions (GdkDrag *drag);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drag_context_get_suggested_action (GdkDragContext *context);
|
||||
GdkDragAction gdk_drag_get_suggested_action (GdkDrag *drag);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drag_context_get_selected_action (GdkDragContext *context);
|
||||
GdkDragAction gdk_drag_get_selected_action (GdkDrag *drag);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_drag_action_is_unique (GdkDragAction action);
|
||||
|
||||
/* Source side */
|
||||
gboolean gdk_drag_action_is_unique (GdkDragAction action);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragContext * gdk_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy);
|
||||
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 (GdkDragContext *context,
|
||||
gboolean success);
|
||||
void gdk_drag_drop_done (GdkDrag *drag,
|
||||
gboolean success);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface *gdk_drag_context_get_drag_surface (GdkDragContext *context);
|
||||
GdkSurface *gdk_drag_get_drag_surface (GdkDrag *drag);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_drag_context_set_hotspot (GdkDragContext *context,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
void gdk_drag_set_hotspot (GdkDrag *drag,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -23,42 +23,42 @@
|
||||
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))
|
||||
#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 _GdkDragContextClass GdkDragContextClass;
|
||||
typedef struct _GdkDragClass GdkDragClass;
|
||||
|
||||
|
||||
struct _GdkDragContextClass {
|
||||
struct _GdkDragClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (*drag_abort) (GdkDragContext *context,
|
||||
void (*drag_abort) (GdkDrag *drag,
|
||||
guint32 time_);
|
||||
void (*drag_drop) (GdkDragContext *context,
|
||||
void (*drag_drop) (GdkDrag *drag,
|
||||
guint32 time_);
|
||||
GdkSurface* (*get_drag_surface) (GdkDragContext *context);
|
||||
void (*set_hotspot) (GdkDragContext *context,
|
||||
GdkSurface* (*get_drag_surface) (GdkDrag *drag);
|
||||
void (*set_hotspot) (GdkDrag *drag,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
void (*drop_done) (GdkDragContext *context,
|
||||
void (*drop_done) (GdkDrag *drag,
|
||||
gboolean success);
|
||||
|
||||
void (*set_cursor) (GdkDragContext *context,
|
||||
void (*set_cursor) (GdkDrag *drag,
|
||||
GdkCursor *cursor);
|
||||
void (*cancel) (GdkDragContext *context,
|
||||
void (*cancel) (GdkDrag *drag,
|
||||
GdkDragCancelReason reason);
|
||||
void (*drop_performed) (GdkDragContext *context,
|
||||
void (*drop_performed) (GdkDrag *drag,
|
||||
guint32 time);
|
||||
void (*dnd_finished) (GdkDragContext *context);
|
||||
void (*dnd_finished) (GdkDrag *drag);
|
||||
|
||||
gboolean (*handle_event) (GdkDragContext *context,
|
||||
gboolean (*handle_event) (GdkDrag *drag,
|
||||
const GdkEvent *event);
|
||||
void (*action_changed) (GdkDragContext *context,
|
||||
void (*action_changed) (GdkDrag *drag,
|
||||
GdkDragAction action);
|
||||
};
|
||||
|
||||
struct _GdkDragContext {
|
||||
struct _GdkDrag {
|
||||
GObject parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
@ -71,33 +71,33 @@ struct _GdkDragContext {
|
||||
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_set_cursor (GdkDrag *drag,
|
||||
GdkCursor *cursor);
|
||||
void gdk_drag_set_actions (GdkDrag *drag,
|
||||
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_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 (GdkDragContext *context,
|
||||
guint32 time_);
|
||||
void gdk_drag_drop (GdkDragContext *context,
|
||||
guint32 time_);
|
||||
void gdk_drag_abort (GdkDrag *drag,
|
||||
guint32 time_);
|
||||
void gdk_drag_drop (GdkDrag *drag,
|
||||
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);
|
||||
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
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
@ -5133,12 +5133,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 *
|
||||
|
@ -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);
|
||||
GdkDragClass *drag_class = GDK_DRAG_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_wayland_drag_context_finalize;
|
||||
object_class->finalize = gdk_wayland_drag_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;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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__ */
|
||||
|
@ -308,7 +308,7 @@ static gboolean gtk_calendar_query_tooltip (GtkWidget *widget,
|
||||
GtkTooltip *tooltip);
|
||||
|
||||
static void gtk_calendar_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data);
|
||||
static void gtk_calendar_drag_data_received (GtkWidget *widget,
|
||||
GdkDrop *drop,
|
||||
@ -2660,7 +2660,7 @@ gtk_calendar_drag_update (GtkGestureDrag *gesture,
|
||||
GtkWidget *widget = data;
|
||||
GtkCalendarPrivate *priv = GTK_CALENDAR (widget)->priv;
|
||||
gdouble start_x, start_y;
|
||||
GdkDragContext *context;
|
||||
GdkDrag *drag;
|
||||
GdkContentFormats *targets;
|
||||
|
||||
if (!priv->in_drag)
|
||||
@ -2675,15 +2675,15 @@ gtk_calendar_drag_update (GtkGestureDrag *gesture,
|
||||
|
||||
targets = gdk_content_formats_new (NULL, 0);
|
||||
targets = gtk_content_formats_add_text_targets (targets);
|
||||
context = gtk_drag_begin_with_coordinates (widget,
|
||||
gtk_gesture_get_device (GTK_GESTURE (gesture)),
|
||||
targets, GDK_ACTION_COPY,
|
||||
start_x, start_y);
|
||||
drag = gtk_drag_begin_with_coordinates (widget,
|
||||
gtk_gesture_get_device (GTK_GESTURE (gesture)),
|
||||
targets, GDK_ACTION_COPY,
|
||||
start_x, start_y);
|
||||
|
||||
priv->in_drag = 0;
|
||||
gdk_content_formats_unref (targets);
|
||||
|
||||
gtk_drag_set_icon_default (context);
|
||||
gtk_drag_set_icon_default (drag);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2900,7 +2900,7 @@ gtk_calendar_grab_notify (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_calendar_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
||||
|
@ -110,10 +110,10 @@ static void gtk_color_button_clicked (GtkButton *button,
|
||||
|
||||
/* source side drag signals */
|
||||
static void gtk_color_button_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data);
|
||||
static void gtk_color_button_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
GtkColorButton *button);
|
||||
|
||||
@ -312,7 +312,7 @@ gtk_color_button_drag_data_received (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
set_color_icon (GdkDragContext *context,
|
||||
set_color_icon (GdkDrag *drag,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
GtkSnapshot *snapshot;
|
||||
@ -324,24 +324,24 @@ set_color_icon (GdkDragContext *context,
|
||||
&GRAPHENE_RECT_INIT(0, 0, 48, 32));
|
||||
paintable = gtk_snapshot_free_to_paintable (snapshot, NULL);
|
||||
|
||||
gtk_drag_set_icon_paintable (context, paintable, 0, 0);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, 0, 0);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_color_button_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkColorButton *button = data;
|
||||
GtkColorButtonPrivate *priv = gtk_color_button_get_instance_private (button);
|
||||
|
||||
set_color_icon (context, &priv->rgba);
|
||||
set_color_icon (drag, &priv->rgba);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_color_button_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
GtkColorButton *button)
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ swatch_snapshot (GtkWidget *widget,
|
||||
|
||||
|
||||
static void
|
||||
drag_set_color_icon (GdkDragContext *context,
|
||||
drag_set_color_icon (GdkDrag *drag,
|
||||
const GdkRGBA *color)
|
||||
{
|
||||
GtkSnapshot *snapshot;
|
||||
@ -169,24 +169,24 @@ drag_set_color_icon (GdkDragContext *context,
|
||||
&GRAPHENE_RECT_INIT(0, 0, 48, 32));
|
||||
paintable = gtk_snapshot_free_to_paintable (snapshot, NULL);
|
||||
|
||||
gtk_drag_set_icon_paintable (context, paintable, 4, 4);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, 4, 4);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
|
||||
static void
|
||||
swatch_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
|
||||
GdkRGBA color;
|
||||
|
||||
gtk_color_swatch_get_rgba (swatch, &color);
|
||||
drag_set_color_icon (context, &color);
|
||||
drag_set_color_icon (drag, &color);
|
||||
}
|
||||
|
||||
static void
|
||||
swatch_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
|
||||
|
203
gtk/gtkdnd.c
203
gtk/gtkdnd.c
@ -67,7 +67,7 @@ struct _GtkDragSourceInfo
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GdkContentFormats *target_list; /* Targets for drag data */
|
||||
GdkDragContext *context; /* drag context */
|
||||
GdkDrag *drag; /* drag context */
|
||||
GtkWidget *icon_window; /* Window for drag */
|
||||
GtkWidget *icon_widget; /* Widget for drag */
|
||||
|
||||
@ -115,9 +115,9 @@ static void gtk_drag_dest_set_widget (GtkDragDestInfo *info,
|
||||
|
||||
static GtkDragDestInfo * gtk_drag_get_dest_info (GdkDrop *drop,
|
||||
gboolean create);
|
||||
static GtkDragSourceInfo *gtk_drag_get_source_info (GdkDragContext *context,
|
||||
static GtkDragSourceInfo *gtk_drag_get_source_info (GdkDrag *drag,
|
||||
gboolean create);
|
||||
static void gtk_drag_clear_source_info (GdkDragContext *context);
|
||||
static void gtk_drag_clear_source_info (GdkDrag *drag);
|
||||
|
||||
static void gtk_drag_drop (GtkDragSourceInfo *info);
|
||||
static void gtk_drag_drop_finished (GtkDragSourceInfo *info,
|
||||
@ -128,20 +128,20 @@ static void gtk_drag_cancel_internal (GtkDragSourceInfo *info,
|
||||
static void gtk_drag_remove_icon (GtkDragSourceInfo *info);
|
||||
static void gtk_drag_source_info_destroy (GtkDragSourceInfo *info);
|
||||
|
||||
static void gtk_drag_context_drop_performed_cb (GdkDragContext *context,
|
||||
GtkDragSourceInfo *info);
|
||||
static void gtk_drag_context_cancel_cb (GdkDragContext *context,
|
||||
GdkDragCancelReason reason,
|
||||
GtkDragSourceInfo *info);
|
||||
static void gtk_drag_context_dnd_finished_cb (GdkDragContext *context,
|
||||
GtkDragSourceInfo *info);
|
||||
static void gtk_drag_drop_performed_cb (GdkDrag *drag,
|
||||
GtkDragSourceInfo *info);
|
||||
static void gtk_drag_cancel_cb (GdkDrag *drag,
|
||||
GdkDragCancelReason reason,
|
||||
GtkDragSourceInfo *info);
|
||||
static void gtk_drag_dnd_finished_cb (GdkDrag *drag,
|
||||
GtkDragSourceInfo *info);
|
||||
|
||||
static gboolean gtk_drag_abort_timeout (gpointer data);
|
||||
|
||||
static void set_icon_helper (GdkDragContext *context,
|
||||
GtkImageDefinition*def,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
static void set_icon_helper (GdkDrag *drag,
|
||||
GtkImageDefinition *def,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
|
||||
|
||||
/********************
|
||||
@ -304,7 +304,7 @@ gtk_drag_get_data (GtkWidget *widget,
|
||||
|
||||
/**
|
||||
* gtk_drag_get_source_widget:
|
||||
* @context: a (destination side) drag context
|
||||
* @drag: a drag context
|
||||
*
|
||||
* Determines the source widget for a drag.
|
||||
*
|
||||
@ -313,13 +313,13 @@ gtk_drag_get_data (GtkWidget *widget,
|
||||
* Otherwise, %NULL.
|
||||
*/
|
||||
GtkWidget *
|
||||
gtk_drag_get_source_widget (GdkDragContext *context)
|
||||
gtk_drag_get_source_widget (GdkDrag *drag)
|
||||
{
|
||||
GtkDragSourceInfo *info;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
|
||||
|
||||
info = gtk_drag_get_source_info (context, FALSE);
|
||||
info = gtk_drag_get_source_info (drag, FALSE);
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
|
||||
@ -594,28 +594,28 @@ gtk_drag_get_dest_info (GdkDrop *drop,
|
||||
static GQuark dest_info_quark = 0;
|
||||
|
||||
static GtkDragSourceInfo *
|
||||
gtk_drag_get_source_info (GdkDragContext *context,
|
||||
gboolean create)
|
||||
gtk_drag_get_source_info (GdkDrag *drag,
|
||||
gboolean create)
|
||||
{
|
||||
GtkDragSourceInfo *info;
|
||||
if (!dest_info_quark)
|
||||
dest_info_quark = g_quark_from_static_string ("gtk-source-info");
|
||||
|
||||
info = g_object_get_qdata (G_OBJECT (context), dest_info_quark);
|
||||
info = g_object_get_qdata (G_OBJECT (drag), dest_info_quark);
|
||||
if (!info && create)
|
||||
{
|
||||
info = g_new0 (GtkDragSourceInfo, 1);
|
||||
info->context = context;
|
||||
g_object_set_qdata (G_OBJECT (context), dest_info_quark, info);
|
||||
info->drag = drag;
|
||||
g_object_set_qdata (G_OBJECT (drag), dest_info_quark, info);
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_drag_clear_source_info (GdkDragContext *context)
|
||||
gtk_drag_clear_source_info (GdkDrag *drag)
|
||||
{
|
||||
g_object_set_qdata (G_OBJECT (context), dest_info_quark, NULL);
|
||||
g_object_set_qdata (G_OBJECT (drag), dest_info_quark, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -743,7 +743,7 @@ struct _GtkDragContent
|
||||
GdkContentProvider parent;
|
||||
|
||||
GtkWidget *widget;
|
||||
GdkDragContext *context;
|
||||
GdkDrag *drag;
|
||||
GdkContentFormats *formats;
|
||||
guint32 time;
|
||||
};
|
||||
@ -809,7 +809,7 @@ gtk_drag_content_write_mime_type_async (GdkContentProvider *provider,
|
||||
sdata.display = gtk_widget_get_display (content->widget);
|
||||
|
||||
g_signal_emit_by_name (content->widget, "drag-data-get",
|
||||
content->context,
|
||||
content->drag,
|
||||
&sdata);
|
||||
|
||||
if (sdata.length == -1)
|
||||
@ -873,7 +873,7 @@ gtk_drag_content_init (GtkDragContent *content)
|
||||
/* Like gtk_drag_begin(), but also takes a GtkImageDefinition
|
||||
* so that we can set the icon from the source site information
|
||||
*/
|
||||
GdkDragContext *
|
||||
GdkDrag *
|
||||
gtk_drag_begin_internal (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GtkImageDefinition *icon,
|
||||
@ -884,7 +884,7 @@ gtk_drag_begin_internal (GtkWidget *widget,
|
||||
{
|
||||
GtkDragSourceInfo *info;
|
||||
GtkWidget *toplevel;
|
||||
GdkDragContext *context;
|
||||
GdkDrag *drag;
|
||||
int dx, dy;
|
||||
GtkDragContent *content;
|
||||
|
||||
@ -905,17 +905,17 @@ gtk_drag_begin_internal (GtkWidget *widget,
|
||||
content->widget = g_object_ref (widget);
|
||||
content->formats = gdk_content_formats_ref (target_list);
|
||||
|
||||
context = gdk_drag_begin (gtk_widget_get_surface (toplevel), device, GDK_CONTENT_PROVIDER (content), actions, dx, dy);
|
||||
if (context == NULL)
|
||||
drag = gdk_drag_begin (gtk_widget_get_surface (toplevel), device, GDK_CONTENT_PROVIDER (content), actions, dx, dy);
|
||||
if (drag == NULL)
|
||||
{
|
||||
g_object_unref (content);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content->context = context;
|
||||
content->drag = drag;
|
||||
g_object_unref (content);
|
||||
|
||||
info = gtk_drag_get_source_info (context, TRUE);
|
||||
info = gtk_drag_get_source_info (drag, TRUE);
|
||||
|
||||
g_object_set_data (G_OBJECT (widget), I_("gtk-info"), info);
|
||||
|
||||
@ -930,7 +930,7 @@ gtk_drag_begin_internal (GtkWidget *widget,
|
||||
|
||||
gtk_widget_reset_controllers (widget);
|
||||
|
||||
g_signal_emit_by_name (widget, "drag-begin", info->context);
|
||||
g_signal_emit_by_name (widget, "drag-begin", info->drag);
|
||||
|
||||
/* Ensure that we have an icon before we start the drag; the
|
||||
* application may have set one in ::drag_begin, or it may
|
||||
@ -940,24 +940,24 @@ gtk_drag_begin_internal (GtkWidget *widget,
|
||||
{
|
||||
if (icon)
|
||||
{
|
||||
set_icon_helper (info->context, icon, 0, 0);
|
||||
set_icon_helper (info->drag, icon, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = gtk_image_definition_new_icon_name ("text-x-generic");
|
||||
set_icon_helper (info->context, icon, 0, 0);
|
||||
set_icon_helper (info->drag, icon, 0, 0);
|
||||
gtk_image_definition_unref (icon);
|
||||
}
|
||||
}
|
||||
|
||||
g_signal_connect (context, "drop-performed",
|
||||
G_CALLBACK (gtk_drag_context_drop_performed_cb), info);
|
||||
g_signal_connect (context, "dnd-finished",
|
||||
G_CALLBACK (gtk_drag_context_dnd_finished_cb), info);
|
||||
g_signal_connect (context, "cancel",
|
||||
G_CALLBACK (gtk_drag_context_cancel_cb), info);
|
||||
g_signal_connect (drag, "drop-performed",
|
||||
G_CALLBACK (gtk_drag_drop_performed_cb), info);
|
||||
g_signal_connect (drag, "dnd-finished",
|
||||
G_CALLBACK (gtk_drag_dnd_finished_cb), info);
|
||||
g_signal_connect (drag, "cancel",
|
||||
G_CALLBACK (gtk_drag_cancel_cb), info);
|
||||
|
||||
return info->context;
|
||||
return info->drag;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -979,7 +979,7 @@ gtk_drag_begin_internal (GtkWidget *widget,
|
||||
*
|
||||
* Returns: (transfer none): the context for this drag
|
||||
*/
|
||||
GdkDragContext *
|
||||
GdkDrag *
|
||||
gtk_drag_begin_with_coordinates (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GdkContentFormats *targets,
|
||||
@ -1016,7 +1016,7 @@ icon_widget_destroyed (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_drag_set_icon_widget_internal (GdkDragContext *context,
|
||||
gtk_drag_set_icon_widget_internal (GdkDrag *drag,
|
||||
GtkWidget *widget,
|
||||
gint hot_x,
|
||||
gint hot_y,
|
||||
@ -1026,7 +1026,7 @@ gtk_drag_set_icon_widget_internal (GdkDragContext *context,
|
||||
|
||||
g_return_if_fail (!GTK_IS_WINDOW (widget));
|
||||
|
||||
info = gtk_drag_get_source_info (context, FALSE);
|
||||
info = gtk_drag_get_source_info (drag, FALSE);
|
||||
if (info == NULL)
|
||||
{
|
||||
if (destroy_on_release)
|
||||
@ -1047,13 +1047,13 @@ gtk_drag_set_icon_widget_internal (GdkDragContext *context,
|
||||
|
||||
g_signal_connect (widget, "destroy", G_CALLBACK (icon_widget_destroyed), info);
|
||||
|
||||
gdk_drag_context_set_hotspot (context, hot_x, hot_y);
|
||||
gdk_drag_set_hotspot (drag, hot_x, hot_y);
|
||||
|
||||
if (!info->icon_window)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
|
||||
display = gdk_drag_context_get_display (context);
|
||||
display = gdk_drag_get_display (drag);
|
||||
|
||||
info->icon_window = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
gtk_window_set_type_hint (GTK_WINDOW (info->icon_window), GDK_SURFACE_TYPE_HINT_DND);
|
||||
@ -1062,7 +1062,7 @@ gtk_drag_set_icon_widget_internal (GdkDragContext *context,
|
||||
gtk_style_context_remove_class (gtk_widget_get_style_context (info->icon_window), "background");
|
||||
|
||||
gtk_window_set_hardcoded_surface (GTK_WINDOW (info->icon_window),
|
||||
gdk_drag_context_get_drag_surface (context));
|
||||
gdk_drag_get_drag_surface (drag));
|
||||
gtk_widget_show (info->icon_window);
|
||||
}
|
||||
|
||||
@ -1073,8 +1073,7 @@ gtk_drag_set_icon_widget_internal (GdkDragContext *context,
|
||||
|
||||
/**
|
||||
* gtk_drag_set_icon_widget:
|
||||
* @context: the context for a drag. (This must be called
|
||||
with a context for the source side of a drag)
|
||||
* @drag: the context for a drag
|
||||
* @widget: a widget to use as an icon
|
||||
* @hot_x: the X offset within @widget of the hotspot
|
||||
* @hot_y: the Y offset within @widget of the hotspot
|
||||
@ -1085,19 +1084,19 @@ gtk_drag_set_icon_widget_internal (GdkDragContext *context,
|
||||
* signal and destroy it yourself.
|
||||
*/
|
||||
void
|
||||
gtk_drag_set_icon_widget (GdkDragContext *context,
|
||||
gtk_drag_set_icon_widget (GdkDrag *drag,
|
||||
GtkWidget *widget,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
gtk_drag_set_icon_widget_internal (context, widget, hot_x, hot_y, FALSE);
|
||||
gtk_drag_set_icon_widget_internal (drag, widget, hot_x, hot_y, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
set_icon_helper (GdkDragContext *context,
|
||||
set_icon_helper (GdkDrag *drag,
|
||||
GtkImageDefinition *def,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
@ -1107,25 +1106,24 @@ set_icon_helper (GdkDragContext *context,
|
||||
widget = gtk_image_new ();
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "drag-icon");
|
||||
gtk_image_set_from_definition (GTK_IMAGE (widget), def);
|
||||
gtk_drag_set_icon_widget_internal (context, widget, hot_x, hot_y, TRUE);
|
||||
gtk_drag_set_icon_widget_internal (drag, widget, hot_x, hot_y, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_drag_set_icon_definition (GdkDragContext *context,
|
||||
gtk_drag_set_icon_definition (GdkDrag *drag,
|
||||
GtkImageDefinition *def,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
g_return_if_fail (def != NULL);
|
||||
|
||||
set_icon_helper (context, def, hot_x, hot_y);
|
||||
set_icon_helper (drag, def, hot_x, hot_y);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_drag_set_icon_paintable:
|
||||
* @context: the context for a drag (This must be called
|
||||
* with a context for the source side of a drag)
|
||||
* @drag: the context for a drag
|
||||
* @paintable: the #GdkPaintable to use as icon
|
||||
* @hot_x: the X offset of the hotspot within the icon
|
||||
* @hot_y: the Y offset of the hotspot within the icon
|
||||
@ -1139,26 +1137,25 @@ gtk_drag_set_icon_definition (GdkDragContext *context,
|
||||
* mouse cursor.
|
||||
*/
|
||||
void
|
||||
gtk_drag_set_icon_paintable (GdkDragContext *context,
|
||||
gtk_drag_set_icon_paintable (GdkDrag *drag,
|
||||
GdkPaintable *paintable,
|
||||
int hot_x,
|
||||
int hot_y)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
g_return_if_fail (GDK_IS_PAINTABLE (paintable));
|
||||
|
||||
widget = gtk_picture_new_for_paintable (paintable);
|
||||
gtk_picture_set_can_shrink (GTK_PICTURE (widget), FALSE);
|
||||
|
||||
gtk_drag_set_icon_widget_internal (context, widget, hot_x, hot_y, TRUE);
|
||||
gtk_drag_set_icon_widget_internal (drag, widget, hot_x, hot_y, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_drag_set_icon_name:
|
||||
* @context: the context for a drag (This must be called
|
||||
* with a context for the source side of a drag)
|
||||
* @drag: the context for a drag
|
||||
* @icon_name: name of icon to use
|
||||
* @hot_x: the X offset of the hotspot within the icon
|
||||
* @hot_y: the Y offset of the hotspot within the icon
|
||||
@ -1170,26 +1167,25 @@ gtk_drag_set_icon_paintable (GdkDragContext *context,
|
||||
* @hot_x and @hot_y have to be used with care.
|
||||
*/
|
||||
void
|
||||
gtk_drag_set_icon_name (GdkDragContext *context,
|
||||
gtk_drag_set_icon_name (GdkDrag *drag,
|
||||
const gchar *icon_name,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
{
|
||||
GtkImageDefinition *def;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
g_return_if_fail (icon_name != NULL && icon_name[0] != '\0');
|
||||
|
||||
def = gtk_image_definition_new_icon_name (icon_name);
|
||||
set_icon_helper (context, def, hot_x, hot_y);
|
||||
set_icon_helper (drag, def, hot_x, hot_y);
|
||||
|
||||
gtk_image_definition_unref (def);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_drag_set_icon_gicon:
|
||||
* @context: the context for a drag (This must be called
|
||||
* with a context for the source side of a drag)
|
||||
* @drag: the context for a drag
|
||||
* @icon: a #GIcon
|
||||
* @hot_x: the X offset of the hotspot within the icon
|
||||
* @hot_y: the Y offset of the hotspot within the icon
|
||||
@ -1199,36 +1195,35 @@ gtk_drag_set_icon_name (GdkDragContext *context,
|
||||
* for more details about using icons in drag and drop.
|
||||
*/
|
||||
void
|
||||
gtk_drag_set_icon_gicon (GdkDragContext *context,
|
||||
gtk_drag_set_icon_gicon (GdkDrag *drag,
|
||||
GIcon *icon,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
{
|
||||
GtkImageDefinition *def;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
g_return_if_fail (icon != NULL);
|
||||
|
||||
def = gtk_image_definition_new_gicon (icon);
|
||||
set_icon_helper (context, def, hot_x, hot_y);
|
||||
set_icon_helper (drag, def, hot_x, hot_y);
|
||||
|
||||
gtk_image_definition_unref (def);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_drag_set_icon_default:
|
||||
* @context: the context for a drag (This must be called
|
||||
* with a context for the source side of a drag)
|
||||
* @drag: the context for a drag
|
||||
*
|
||||
* Sets the icon for a particular drag to the default
|
||||
* icon.
|
||||
*/
|
||||
void
|
||||
gtk_drag_set_icon_default (GdkDragContext *context)
|
||||
gtk_drag_set_icon_default (GdkDrag *drag)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
|
||||
gtk_drag_set_icon_name (context, "text-x-generic", -2, -2);
|
||||
gtk_drag_set_icon_name (drag, "text-x-generic", -2, -2);
|
||||
}
|
||||
|
||||
/* Clean up from the drag, and display snapback, if necessary. */
|
||||
@ -1242,9 +1237,9 @@ gtk_drag_drop_finished (GtkDragSourceInfo *info,
|
||||
|
||||
if (!success)
|
||||
g_signal_emit_by_name (info->widget, "drag-failed",
|
||||
info->context, result, &success);
|
||||
info->drag, result, &success);
|
||||
|
||||
gdk_drag_drop_done (info->context, success);
|
||||
gdk_drag_drop_done (info->drag, success);
|
||||
gtk_drag_source_info_destroy (info);
|
||||
}
|
||||
|
||||
@ -1296,17 +1291,11 @@ gtk_drag_source_info_free (GtkDragSourceInfo *info)
|
||||
static void
|
||||
gtk_drag_source_info_destroy (GtkDragSourceInfo *info)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (info->context,
|
||||
gtk_drag_context_drop_performed_cb,
|
||||
info);
|
||||
g_signal_handlers_disconnect_by_func (info->context,
|
||||
gtk_drag_context_dnd_finished_cb,
|
||||
info);
|
||||
g_signal_handlers_disconnect_by_func (info->context,
|
||||
gtk_drag_context_cancel_cb,
|
||||
info);
|
||||
g_signal_handlers_disconnect_by_func (info->drag, gtk_drag_drop_performed_cb, info);
|
||||
g_signal_handlers_disconnect_by_func (info->drag, gtk_drag_dnd_finished_cb, info);
|
||||
g_signal_handlers_disconnect_by_func (info->drag, gtk_drag_cancel_cb, info);
|
||||
|
||||
g_signal_emit_by_name (info->widget, "drag-end", info->context);
|
||||
g_signal_emit_by_name (info->widget, "drag-end", info->drag);
|
||||
|
||||
g_object_set_data (G_OBJECT (info->widget), I_("gtk-info"), NULL);
|
||||
|
||||
@ -1318,10 +1307,10 @@ gtk_drag_source_info_destroy (GtkDragSourceInfo *info)
|
||||
g_source_remove (info->drop_timeout);
|
||||
|
||||
/* keep the icon_window alive until the (possible) drag cancel animation is done */
|
||||
g_object_set_data_full (G_OBJECT (info->context), "former-gtk-source-info", info, (GDestroyNotify)gtk_drag_source_info_free);
|
||||
g_object_set_data_full (G_OBJECT (info->drag), "former-gtk-source-info", info, (GDestroyNotify)gtk_drag_source_info_free);
|
||||
|
||||
gtk_drag_clear_source_info (info->context);
|
||||
g_object_unref (info->context);
|
||||
gtk_drag_clear_source_info (info->drag);
|
||||
g_object_unref (info->drag);
|
||||
}
|
||||
|
||||
/* Called on cancellation of a drag, either by the user
|
||||
@ -1335,16 +1324,16 @@ gtk_drag_cancel_internal (GtkDragSourceInfo *info,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_drag_context_drop_performed_cb (GdkDragContext *context,
|
||||
GtkDragSourceInfo *info)
|
||||
gtk_drag_drop_performed_cb (GdkDrag *drag,
|
||||
GtkDragSourceInfo *info)
|
||||
{
|
||||
gtk_drag_drop (info);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_drag_context_cancel_cb (GdkDragContext *context,
|
||||
GdkDragCancelReason reason,
|
||||
GtkDragSourceInfo *info)
|
||||
gtk_drag_cancel_cb (GdkDrag *drag,
|
||||
GdkDragCancelReason reason,
|
||||
GtkDragSourceInfo *info)
|
||||
{
|
||||
GtkDragResult result;
|
||||
|
||||
@ -1365,14 +1354,14 @@ gtk_drag_context_cancel_cb (GdkDragContext *context,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_drag_context_dnd_finished_cb (GdkDragContext *context,
|
||||
GtkDragSourceInfo *info)
|
||||
gtk_drag_dnd_finished_cb (GdkDrag *drag,
|
||||
GtkDragSourceInfo *info)
|
||||
{
|
||||
if (gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE)
|
||||
if (gdk_drag_get_selected_action (drag) == GDK_ACTION_MOVE)
|
||||
{
|
||||
g_signal_emit_by_name (info->widget,
|
||||
"drag-data-delete",
|
||||
context);
|
||||
drag);
|
||||
}
|
||||
|
||||
gtk_drag_source_info_destroy (info);
|
||||
@ -1422,7 +1411,7 @@ gtk_drag_check_threshold (GtkWidget *widget,
|
||||
|
||||
/**
|
||||
* gtk_drag_cancel:
|
||||
* @context: a #GdkDragContext, as e.g. returned by gtk_drag_begin_with_coordinates()
|
||||
* @drag: a drag context, as e.g. returned by gtk_drag_begin_with_coordinates()
|
||||
*
|
||||
* Cancels an ongoing drag operation on the source side.
|
||||
*
|
||||
@ -1438,13 +1427,13 @@ gtk_drag_check_threshold (GtkWidget *widget,
|
||||
* #GtkWidget::drag-failed is set to @GTK_DRAG_RESULT_ERROR.
|
||||
*/
|
||||
void
|
||||
gtk_drag_cancel (GdkDragContext *context)
|
||||
gtk_drag_cancel (GdkDrag *drag)
|
||||
{
|
||||
GtkDragSourceInfo *info;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
|
||||
info = gtk_drag_get_source_info (context, FALSE);
|
||||
info = gtk_drag_get_source_info (drag, FALSE);
|
||||
if (info != NULL)
|
||||
gtk_drag_cancel_internal (info, GTK_DRAG_RESULT_ERROR);
|
||||
}
|
||||
|
26
gtk/gtkdnd.h
26
gtk/gtkdnd.h
@ -45,7 +45,7 @@ void gtk_drag_get_data (GtkWidget *widget,
|
||||
GdkAtom target);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget *gtk_drag_get_source_widget (GdkDragContext *context);
|
||||
GtkWidget *gtk_drag_get_source_widget (GdkDrag *drag);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_highlight (GtkWidget *widget);
|
||||
@ -55,39 +55,39 @@ void gtk_drag_unhighlight (GtkWidget *widget);
|
||||
/* Source side */
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragContext *gtk_drag_begin_with_coordinates (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GdkContentFormats *targets,
|
||||
GdkDragAction actions,
|
||||
gint x,
|
||||
gint y);
|
||||
GdkDrag *gtk_drag_begin_with_coordinates (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GdkContentFormats *targets,
|
||||
GdkDragAction actions,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_cancel (GdkDragContext *context);
|
||||
void gtk_drag_cancel (GdkDrag *drag);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_set_icon_widget (GdkDragContext *context,
|
||||
void gtk_drag_set_icon_widget (GdkDrag *drag,
|
||||
GtkWidget *widget,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_set_icon_paintable (GdkDragContext *context,
|
||||
void gtk_drag_set_icon_paintable (GdkDrag *drag,
|
||||
GdkPaintable *paintable,
|
||||
int hot_x,
|
||||
int hot_y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_set_icon_name (GdkDragContext *context,
|
||||
void gtk_drag_set_icon_name (GdkDrag *drag,
|
||||
const gchar *icon_name,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_set_icon_gicon (GdkDragContext *context,
|
||||
void gtk_drag_set_icon_gicon (GdkDrag *drag,
|
||||
GIcon *icon,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_drag_set_icon_default (GdkDragContext *context);
|
||||
void gtk_drag_set_icon_default (GdkDrag *drag);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_drag_check_threshold (GtkWidget *widget,
|
||||
|
@ -40,14 +40,14 @@ struct _GtkDragDestSite
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GdkDragContext * gtk_drag_begin_internal (GtkWidget *widget,
|
||||
GdkDrag * gtk_drag_begin_internal (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GtkImageDefinition *icon,
|
||||
GdkContentFormats *target_list,
|
||||
GdkDragAction actions,
|
||||
int x,
|
||||
int y);
|
||||
void gtk_drag_set_icon_definition (GdkDragContext *context,
|
||||
void gtk_drag_set_icon_definition (GdkDrag *drag,
|
||||
GtkImageDefinition *def,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
|
@ -125,7 +125,7 @@ gtk_drag_dest_set_internal (GtkWidget *widget,
|
||||
* |[<!-- language="C" -->
|
||||
* static void
|
||||
* drag_motion (GtkWidget *widget,
|
||||
* GdkDragContext *context,
|
||||
* GdkDrag *drag,
|
||||
* gint x,
|
||||
* gint y,
|
||||
* guint time)
|
||||
|
@ -445,14 +445,14 @@ static void gtk_entry_drag_data_received (GtkWidget *widget,
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data);
|
||||
static void gtk_entry_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data);
|
||||
static void gtk_entry_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_entry_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_entry_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
|
||||
|
||||
/* GtkEditable method implementations
|
||||
@ -8478,7 +8478,7 @@ gtk_entry_selection_bubble_popup_set (GtkEntry *entry)
|
||||
|
||||
static void
|
||||
gtk_entry_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
@ -8493,7 +8493,7 @@ gtk_entry_drag_begin (GtkWidget *widget,
|
||||
{
|
||||
if (icon_info->in_drag)
|
||||
{
|
||||
gtk_drag_set_icon_definition (context,
|
||||
gtk_drag_set_icon_definition (drag,
|
||||
gtk_image_get_definition (GTK_IMAGE (icon_info->widget)),
|
||||
-2, -2);
|
||||
return;
|
||||
@ -8511,7 +8511,7 @@ gtk_entry_drag_begin (GtkWidget *widget,
|
||||
paintable = gtk_text_util_create_drag_icon (widget, text, -1);
|
||||
gtk_entry_get_pixel_ranges (entry, &ranges, &n_ranges);
|
||||
|
||||
gtk_drag_set_icon_paintable (context,
|
||||
gtk_drag_set_icon_paintable (drag,
|
||||
paintable,
|
||||
priv->drag_start_x - ranges[0],
|
||||
priv->drag_start_y);
|
||||
@ -8524,7 +8524,7 @@ gtk_entry_drag_begin (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_entry_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
@ -8632,7 +8632,7 @@ gtk_entry_get_action (GtkEntry *entry,
|
||||
GdkDrop *drop)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (entry);
|
||||
GdkDragContext *drag = gdk_drop_get_drag (drop);
|
||||
GdkDrag *drag = gdk_drop_get_drag (drop);
|
||||
GtkWidget *source_widget = gtk_drag_get_source_widget (drag);
|
||||
GdkDragAction actions;
|
||||
|
||||
@ -8700,7 +8700,7 @@ gtk_entry_drag_data_received (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_entry_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
@ -8734,7 +8734,7 @@ gtk_entry_drag_data_get (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_entry_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
|
@ -277,14 +277,14 @@ static void update_pixbuf_cell (GtkIco
|
||||
|
||||
/* Source side drag signals */
|
||||
static void gtk_icon_view_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_icon_view_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_icon_view_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data);
|
||||
static void gtk_icon_view_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
|
||||
/* Target side drag signals */
|
||||
static void gtk_icon_view_drag_leave (GtkWidget *widget,
|
||||
@ -5702,27 +5702,27 @@ unset_reorderable (GtkIconView *icon_view)
|
||||
}
|
||||
|
||||
static void
|
||||
set_source_row (GdkDragContext *context,
|
||||
set_source_row (GdkDrag *drag,
|
||||
GtkTreeModel *model,
|
||||
GtkTreePath *source_row)
|
||||
{
|
||||
if (source_row)
|
||||
g_object_set_data_full (G_OBJECT (context),
|
||||
g_object_set_data_full (G_OBJECT (drag),
|
||||
I_("gtk-icon-view-source-row"),
|
||||
gtk_tree_row_reference_new (model, source_row),
|
||||
(GDestroyNotify) gtk_tree_row_reference_free);
|
||||
else
|
||||
g_object_set_data_full (G_OBJECT (context),
|
||||
g_object_set_data_full (G_OBJECT (drag),
|
||||
I_("gtk-icon-view-source-row"),
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
static GtkTreePath*
|
||||
get_source_row (GdkDragContext *context)
|
||||
get_source_row (GdkDrag *drag)
|
||||
{
|
||||
GtkTreeRowReference *ref;
|
||||
|
||||
ref = g_object_get_data (G_OBJECT (context), "gtk-icon-view-source-row");
|
||||
ref = g_object_get_data (G_OBJECT (drag), "gtk-icon-view-source-row");
|
||||
|
||||
if (ref)
|
||||
return gtk_tree_row_reference_get_path (ref);
|
||||
@ -6020,7 +6020,7 @@ gtk_icon_view_maybe_begin_drag (GtkIconView *icon_view,
|
||||
GdkDevice *device)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (icon_view);
|
||||
GdkDragContext *context;
|
||||
GdkDrag *drag;
|
||||
GtkTreePath *path = NULL;
|
||||
GtkTreeModel *model;
|
||||
gboolean retval = FALSE;
|
||||
@ -6064,14 +6064,14 @@ gtk_icon_view_maybe_begin_drag (GtkIconView *icon_view,
|
||||
|
||||
retval = TRUE;
|
||||
|
||||
context = gtk_drag_begin_with_coordinates (widget,
|
||||
device,
|
||||
gtk_drag_source_get_target_list (widget),
|
||||
icon_view->priv->source_actions,
|
||||
icon_view->priv->press_start_x,
|
||||
icon_view->priv->press_start_y);
|
||||
drag = gtk_drag_begin_with_coordinates (widget,
|
||||
device,
|
||||
gtk_drag_source_get_target_list (widget),
|
||||
icon_view->priv->source_actions,
|
||||
icon_view->priv->press_start_x,
|
||||
icon_view->priv->press_start_y);
|
||||
|
||||
set_source_row (context, model, path);
|
||||
set_source_row (drag, model, path);
|
||||
|
||||
out:
|
||||
if (path)
|
||||
@ -6083,7 +6083,7 @@ gtk_icon_view_maybe_begin_drag (GtkIconView *icon_view,
|
||||
/* Source side drag signals */
|
||||
static void
|
||||
gtk_icon_view_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkIconView *icon_view;
|
||||
GtkIconViewItem *item;
|
||||
@ -6112,21 +6112,21 @@ gtk_icon_view_drag_begin (GtkWidget *widget,
|
||||
icon = gtk_icon_view_create_drag_icon (icon_view, path);
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
gtk_drag_set_icon_paintable (context, icon, x, y);
|
||||
gtk_drag_set_icon_paintable (drag, icon, x, y);
|
||||
|
||||
g_object_unref (icon);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkIconView *icon_view;
|
||||
@ -6142,7 +6142,7 @@ gtk_icon_view_drag_data_get (GtkWidget *widget,
|
||||
if (!icon_view->priv->source_set)
|
||||
return;
|
||||
|
||||
source_row = get_source_row (context);
|
||||
source_row = get_source_row (drag);
|
||||
|
||||
if (source_row == NULL)
|
||||
return;
|
||||
@ -6170,7 +6170,7 @@ gtk_icon_view_drag_data_get (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_icon_view_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkIconView *icon_view;
|
||||
@ -6185,7 +6185,7 @@ gtk_icon_view_drag_data_delete (GtkWidget *widget,
|
||||
if (!icon_view->priv->source_set)
|
||||
return;
|
||||
|
||||
source_row = get_source_row (context);
|
||||
source_row = get_source_row (drag);
|
||||
|
||||
if (source_row == NULL)
|
||||
return;
|
||||
@ -6195,7 +6195,7 @@ gtk_icon_view_drag_data_delete (GtkWidget *widget,
|
||||
|
||||
gtk_tree_path_free (source_row);
|
||||
|
||||
set_source_row (context, NULL, NULL);
|
||||
set_source_row (drag, NULL, NULL);
|
||||
}
|
||||
|
||||
/* Target side drag signals */
|
||||
@ -6333,7 +6333,7 @@ static GdkDragAction
|
||||
gtk_icon_view_get_action (GtkWidget *treeview,
|
||||
GdkDrop *drop)
|
||||
{
|
||||
GdkDragContext *drag = gdk_drop_get_drag (drop);
|
||||
GdkDrag *drag = gdk_drop_get_drag (drop);
|
||||
GtkWidget *source_widget = gtk_drag_get_source_widget (drag);
|
||||
GdkDragAction actions;
|
||||
|
||||
|
@ -476,7 +476,7 @@ static gboolean gtk_label_mnemonic_activate (GtkWidget *widget,
|
||||
static void gtk_label_setup_mnemonic (GtkLabel *label,
|
||||
guint last_key);
|
||||
static void gtk_label_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data);
|
||||
|
||||
static void gtk_label_buildable_interface_init (GtkBuildableIface *iface);
|
||||
@ -4576,7 +4576,7 @@ connect_mnemonics_visible_notify (GtkLabel *label)
|
||||
|
||||
static void
|
||||
drag_begin_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL (widget);
|
||||
@ -4612,12 +4612,12 @@ drag_begin_cb (GtkWidget *widget,
|
||||
|
||||
if (paintable)
|
||||
{
|
||||
gtk_drag_set_icon_paintable (context, paintable, 0, 0);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, 0, 0);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_drag_set_icon_default (context);
|
||||
gtk_drag_set_icon_default (drag);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5169,7 +5169,7 @@ gtk_label_set_selection_text (GtkLabel *label,
|
||||
|
||||
static void
|
||||
gtk_label_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
gtk_label_set_selection_text (GTK_LABEL (widget), selection_data);
|
||||
|
@ -107,7 +107,7 @@ static void gtk_link_button_set_property (GObject *object,
|
||||
static void gtk_link_button_clicked (GtkButton *button);
|
||||
static gboolean gtk_link_button_popup_menu (GtkWidget *widget);
|
||||
static void gtk_link_button_drag_data_get_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection,
|
||||
gpointer user_data);
|
||||
static gboolean gtk_link_button_query_tooltip_cb (GtkWidget *widget,
|
||||
@ -433,7 +433,7 @@ gtk_link_button_popup_menu (GtkWidget *widget)
|
||||
|
||||
static void
|
||||
gtk_link_button_drag_data_get_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
@ -383,11 +383,11 @@ static gboolean gtk_notebook_focus (GtkWidget *widget,
|
||||
|
||||
/*** Drag and drop Methods ***/
|
||||
static void gtk_notebook_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_notebook_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static gboolean gtk_notebook_drag_failed (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkDragResult result);
|
||||
static gboolean gtk_notebook_drag_motion (GtkWidget *widget,
|
||||
GdkDrop *drop,
|
||||
@ -400,7 +400,7 @@ static gboolean gtk_notebook_drag_drop (GtkWidget *widget,
|
||||
gint x,
|
||||
gint y);
|
||||
static void gtk_notebook_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *data);
|
||||
static void gtk_notebook_drag_data_received (GtkWidget *widget,
|
||||
GdkDrop *drop,
|
||||
@ -2864,7 +2864,7 @@ update_arrow_nodes (GtkNotebook *notebook)
|
||||
|
||||
static void
|
||||
gtk_notebook_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
|
||||
GtkNotebookPrivate *priv = notebook->priv;
|
||||
@ -2895,14 +2895,14 @@ gtk_notebook_drag_begin (GtkWidget *widget,
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->dnd_child), "background");
|
||||
|
||||
gtk_drag_set_icon_widget (context, tab_label, -2, -2);
|
||||
g_object_set_data (G_OBJECT (priv->dnd_child), "drag-context", context);
|
||||
gtk_drag_set_icon_widget (drag, tab_label, -2, -2);
|
||||
g_object_set_data (G_OBJECT (priv->dnd_child), "drag-context", drag);
|
||||
g_object_unref (tab_label);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_notebook_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
|
||||
GtkNotebookPrivate *priv = notebook->priv;
|
||||
@ -2914,7 +2914,7 @@ gtk_notebook_drag_end (GtkWidget *widget,
|
||||
GtkNotebook *dest_notebook = NULL;
|
||||
gint x, y;
|
||||
|
||||
gdk_device_get_position (gdk_drag_context_get_device (context), &x, &y);
|
||||
gdk_device_get_position (gdk_drag_get_device (drag), &x, &y);
|
||||
g_signal_emit (notebook, notebook_signals[CREATE_WINDOW], 0,
|
||||
priv->detached_tab->child, x, y, &dest_notebook);
|
||||
|
||||
@ -2950,7 +2950,7 @@ gtk_notebook_create_window (GtkNotebook *notebook,
|
||||
|
||||
static gboolean
|
||||
gtk_notebook_drag_failed (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkDragResult result)
|
||||
{
|
||||
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
|
||||
@ -2963,7 +2963,7 @@ gtk_notebook_drag_failed (GtkWidget *widget,
|
||||
GtkNotebook *dest_notebook = NULL;
|
||||
gint x, y;
|
||||
|
||||
gdk_device_get_position (gdk_drag_context_get_device (context), &x, &y);
|
||||
gdk_device_get_position (gdk_drag_get_device (drag), &x, &y);
|
||||
|
||||
g_signal_emit (notebook, notebook_signals[CREATE_WINDOW], 0,
|
||||
priv->detached_tab->child, x, y, &dest_notebook);
|
||||
@ -3200,7 +3200,7 @@ do_detach_tab (GtkNotebook *from,
|
||||
|
||||
static void
|
||||
gtk_notebook_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *data)
|
||||
{
|
||||
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
|
||||
@ -3230,7 +3230,7 @@ gtk_notebook_drag_data_received (GtkWidget *widget,
|
||||
GtkSelectionData *data)
|
||||
{
|
||||
GtkNotebook *notebook;
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
GtkWidget *source_widget;
|
||||
GtkWidget **child;
|
||||
|
||||
@ -4162,10 +4162,10 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
|
||||
|
||||
if (priv->operation == DRAG_OPERATION_DETACH && !priv->remove_in_detach)
|
||||
{
|
||||
GdkDragContext *context;
|
||||
GdkDrag *drag;
|
||||
|
||||
context = (GdkDragContext *)g_object_get_data (G_OBJECT (priv->dnd_child), "drag-context");
|
||||
gtk_drag_cancel (context);
|
||||
drag = (GdkDrag *)g_object_get_data (G_OBJECT (priv->dnd_child), "drag-context");
|
||||
gtk_drag_cancel (drag);
|
||||
}
|
||||
}
|
||||
if (priv->switch_tab == list)
|
||||
@ -7038,7 +7038,7 @@ gtk_notebook_get_tab_detachable (GtkNotebook *notebook,
|
||||
* |[<!-- language="C" -->
|
||||
* static void
|
||||
* on_drag_data_received (GtkWidget *widget,
|
||||
* GdkDragContext *context,
|
||||
* GdkDrag *drag,
|
||||
* GtkSelectionData *data,
|
||||
* guint time,
|
||||
* gpointer user_data)
|
||||
@ -7046,7 +7046,7 @@ gtk_notebook_get_tab_detachable (GtkNotebook *notebook,
|
||||
* GtkWidget *notebook;
|
||||
* GtkWidget **child;
|
||||
*
|
||||
* notebook = gtk_drag_get_source_widget (context);
|
||||
* notebook = gtk_drag_get_source_widget (drag);
|
||||
* child = (void*) gtk_selection_data_get_data (data);
|
||||
*
|
||||
* // process_widget (*child);
|
||||
|
@ -1283,7 +1283,7 @@ find_button_type (GtkPathBar *path_bar,
|
||||
|
||||
static void
|
||||
button_drag_data_get_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data)
|
||||
{
|
||||
|
@ -203,7 +203,7 @@ struct _GtkPlacesSidebarClass {
|
||||
const gchar *primary,
|
||||
const gchar *secondary);
|
||||
GdkDragAction (* drag_action_requested) (GtkPlacesSidebar *sidebar,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GFile *dest_file,
|
||||
GList *source_file_list);
|
||||
GdkDragAction (* drag_action_ask) (GtkPlacesSidebar *sidebar,
|
||||
@ -1722,7 +1722,7 @@ stop_drop_feedback (GtkPlacesSidebar *sidebar)
|
||||
|
||||
static void
|
||||
drag_begin_callback (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkPlacesSidebar *sidebar = GTK_PLACES_SIDEBAR (user_data);
|
||||
@ -1738,7 +1738,7 @@ drag_begin_callback (GtkWidget *widget,
|
||||
|
||||
gtk_widget_set_opacity (drag_widget, 0.8);
|
||||
|
||||
gtk_drag_set_icon_widget (context,
|
||||
gtk_drag_set_icon_widget (drag,
|
||||
drag_widget,
|
||||
sidebar->drag_row_x,
|
||||
sidebar->drag_row_y);
|
||||
@ -1951,7 +1951,7 @@ drop_files_as_bookmarks (GtkPlacesSidebar *sidebar,
|
||||
|
||||
static void
|
||||
drag_data_get_callback (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *data,
|
||||
gpointer user_data)
|
||||
{
|
||||
@ -2085,7 +2085,7 @@ out:
|
||||
|
||||
static void
|
||||
drag_end_callback (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer user_data)
|
||||
{
|
||||
stop_drop_feedback (GTK_PLACES_SIDEBAR (user_data));
|
||||
|
@ -417,14 +417,14 @@ static GtkTextBuffer* gtk_text_view_create_buffer (GtkTextView *text_view);
|
||||
|
||||
/* Source side drag signals */
|
||||
static void gtk_text_view_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_text_view_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_text_view_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data);
|
||||
static void gtk_text_view_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
|
||||
/* Target side drag signals */
|
||||
static void gtk_text_view_drag_leave (GtkWidget *widget,
|
||||
@ -7585,7 +7585,7 @@ gtk_text_view_im_context_filter_keypress (GtkTextView *text_view,
|
||||
|
||||
static void
|
||||
drag_begin_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
|
||||
@ -7601,12 +7601,12 @@ drag_begin_cb (GtkWidget *widget,
|
||||
|
||||
if (paintable)
|
||||
{
|
||||
gtk_drag_set_icon_paintable (context, paintable, 0, 0);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, 0, 0);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_drag_set_icon_default (context);
|
||||
gtk_drag_set_icon_default (drag);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7632,14 +7632,14 @@ gtk_text_view_start_selection_dnd (GtkTextView *text_view,
|
||||
|
||||
static void
|
||||
gtk_text_view_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkTextView *text_view;
|
||||
|
||||
@ -7649,7 +7649,7 @@ gtk_text_view_drag_end (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_text_view_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
|
||||
@ -7685,7 +7685,7 @@ gtk_text_view_drag_data_get (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_text_view_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
gtk_text_buffer_delete_selection (GTK_TEXT_VIEW (widget)->priv->buffer,
|
||||
TRUE, GTK_TEXT_VIEW (widget)->priv->editable);
|
||||
@ -7861,7 +7861,7 @@ static GdkDragAction
|
||||
gtk_text_view_get_action (GtkWidget *textview,
|
||||
GdkDrop *drop)
|
||||
{
|
||||
GdkDragContext *drag = gdk_drop_get_drag (drop);
|
||||
GdkDrag *drag = gdk_drop_get_drag (drop);
|
||||
GtkWidget *source_widget = gtk_drag_get_source_widget (drag);
|
||||
GdkDragAction actions;
|
||||
|
||||
|
@ -618,14 +618,14 @@ static void gtk_tree_view_forall (GtkContainer *container,
|
||||
|
||||
/* Source side drag signals */
|
||||
static void gtk_tree_view_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_tree_view_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
static void gtk_tree_view_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data);
|
||||
static void gtk_tree_view_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
|
||||
/* Target side drag signals */
|
||||
static void gtk_tree_view_drag_leave (GtkWidget *widget,
|
||||
@ -6817,21 +6817,21 @@ _gtk_tree_view_column_autosize (GtkTreeView *tree_view,
|
||||
/* Drag-and-drop */
|
||||
|
||||
static void
|
||||
set_source_row (GdkDragContext *context,
|
||||
set_source_row (GdkDrag *drag,
|
||||
GtkTreeModel *model,
|
||||
GtkTreePath *source_row)
|
||||
{
|
||||
g_object_set_data_full (G_OBJECT (context),
|
||||
g_object_set_data_full (G_OBJECT (drag),
|
||||
I_("gtk-tree-view-source-row"),
|
||||
source_row ? gtk_tree_row_reference_new (model, source_row) : NULL,
|
||||
(GDestroyNotify) (source_row ? gtk_tree_row_reference_free : NULL));
|
||||
}
|
||||
|
||||
static GtkTreePath*
|
||||
get_source_row (GdkDragContext *context)
|
||||
get_source_row (GdkDrag *drag)
|
||||
{
|
||||
GtkTreeRowReference *ref =
|
||||
g_object_get_data (G_OBJECT (context), "gtk-tree-view-source-row");
|
||||
g_object_get_data (G_OBJECT (drag), "gtk-tree-view-source-row");
|
||||
|
||||
if (ref)
|
||||
return gtk_tree_row_reference_get_path (ref);
|
||||
@ -7304,7 +7304,7 @@ gtk_tree_view_maybe_begin_dragging_row (GtkTreeView *tree_view)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (tree_view);
|
||||
gdouble start_x, start_y, offset_x, offset_y;
|
||||
GdkDragContext *context;
|
||||
GdkDrag *drag;
|
||||
TreeViewDragInfo *di;
|
||||
GtkTreePath *path = NULL;
|
||||
gint button;
|
||||
@ -7361,13 +7361,13 @@ gtk_tree_view_maybe_begin_dragging_row (GtkTreeView *tree_view)
|
||||
gtk_gesture_set_state (GTK_GESTURE (tree_view->priv->drag_gesture),
|
||||
GTK_EVENT_SEQUENCE_CLAIMED);
|
||||
|
||||
context = gtk_drag_begin_with_coordinates (widget,
|
||||
gtk_gesture_get_device (GTK_GESTURE (tree_view->priv->drag_gesture)),
|
||||
gtk_drag_source_get_target_list (widget),
|
||||
di->source_actions,
|
||||
start_x, start_y);
|
||||
drag = gtk_drag_begin_with_coordinates (widget,
|
||||
gtk_gesture_get_device (GTK_GESTURE (tree_view->priv->drag_gesture)),
|
||||
gtk_drag_source_get_target_list (widget),
|
||||
di->source_actions,
|
||||
start_x, start_y);
|
||||
|
||||
set_source_row (context, model, path);
|
||||
set_source_row (drag, model, path);
|
||||
|
||||
out:
|
||||
if (path)
|
||||
@ -7379,7 +7379,7 @@ gtk_tree_view_maybe_begin_dragging_row (GtkTreeView *tree_view)
|
||||
|
||||
static void
|
||||
gtk_tree_view_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkTreeView *tree_view;
|
||||
GtkTreePath *path = NULL;
|
||||
@ -7412,10 +7412,9 @@ gtk_tree_view_drag_begin (GtkWidget *widget,
|
||||
if (!path)
|
||||
return;
|
||||
|
||||
row_pix = gtk_tree_view_create_row_drag_icon (tree_view,
|
||||
path);
|
||||
row_pix = gtk_tree_view_create_row_drag_icon (tree_view, path);
|
||||
|
||||
gtk_drag_set_icon_paintable (context, row_pix, tree_view->priv->press_start_x + 1, 1);
|
||||
gtk_drag_set_icon_paintable (drag, row_pix, tree_view->priv->press_start_x + 1, 1);
|
||||
|
||||
g_object_unref (row_pix);
|
||||
gtk_tree_path_free (path);
|
||||
@ -7423,7 +7422,7 @@ gtk_tree_view_drag_begin (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_tree_view_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
|
||||
|
||||
@ -7434,7 +7433,7 @@ gtk_tree_view_drag_end (GtkWidget *widget,
|
||||
/* Default signal implementations for the drag signals */
|
||||
static void
|
||||
gtk_tree_view_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkTreeView *tree_view;
|
||||
@ -7454,7 +7453,7 @@ gtk_tree_view_drag_data_get (GtkWidget *widget,
|
||||
if (di == NULL)
|
||||
return;
|
||||
|
||||
source_row = get_source_row (context);
|
||||
source_row = get_source_row (drag);
|
||||
|
||||
if (source_row == NULL)
|
||||
return;
|
||||
@ -7485,7 +7484,7 @@ gtk_tree_view_drag_data_get (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_tree_view_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context)
|
||||
GdkDrag *drag)
|
||||
{
|
||||
TreeViewDragInfo *di;
|
||||
GtkTreeModel *model;
|
||||
@ -7503,17 +7502,16 @@ gtk_tree_view_drag_data_delete (GtkWidget *widget,
|
||||
if (di == NULL)
|
||||
return;
|
||||
|
||||
source_row = get_source_row (context);
|
||||
source_row = get_source_row (drag);
|
||||
|
||||
if (source_row == NULL)
|
||||
return;
|
||||
|
||||
gtk_tree_drag_source_drag_data_delete (GTK_TREE_DRAG_SOURCE (model),
|
||||
source_row);
|
||||
gtk_tree_drag_source_drag_data_delete (GTK_TREE_DRAG_SOURCE (model), source_row);
|
||||
|
||||
gtk_tree_path_free (source_row);
|
||||
|
||||
set_source_row (context, NULL, NULL);
|
||||
set_source_row (drag, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -7670,7 +7668,7 @@ static GdkDragAction
|
||||
gtk_tree_view_get_action (GtkWidget *treeview,
|
||||
GdkDrop *drop)
|
||||
{
|
||||
GdkDragContext *drag = gdk_drop_get_drag (drop);
|
||||
GdkDrag *drag = gdk_drop_get_drag (drop);
|
||||
GtkWidget *source_widget = gtk_drag_get_source_widget (drag);
|
||||
GdkDragAction actions;
|
||||
|
||||
|
@ -1743,7 +1743,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
/**
|
||||
* GtkWidget::drag-begin:
|
||||
* @widget: the object which received the signal
|
||||
* @context: the drag context
|
||||
* @context: the drag context
|
||||
*
|
||||
* The ::drag-begin signal is emitted on the drag source when a drag is
|
||||
* started. A typical reason to connect to this signal is to set up a
|
||||
@ -1761,7 +1761,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
GDK_TYPE_DRAG_CONTEXT);
|
||||
GDK_TYPE_DRAG);
|
||||
|
||||
/**
|
||||
* GtkWidget::drag-end:
|
||||
@ -1780,7 +1780,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
GDK_TYPE_DRAG_CONTEXT);
|
||||
GDK_TYPE_DRAG);
|
||||
|
||||
/**
|
||||
* GtkWidget::drag-data-delete:
|
||||
@ -1800,7 +1800,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
GDK_TYPE_DRAG_CONTEXT);
|
||||
GDK_TYPE_DRAG);
|
||||
|
||||
/**
|
||||
* GtkWidget::drag-failed:
|
||||
@ -1824,7 +1824,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
_gtk_boolean_handled_accumulator, NULL,
|
||||
_gtk_marshal_BOOLEAN__OBJECT_ENUM,
|
||||
G_TYPE_BOOLEAN, 2,
|
||||
GDK_TYPE_DRAG_CONTEXT,
|
||||
GDK_TYPE_DRAG,
|
||||
GTK_TYPE_DRAG_RESULT);
|
||||
|
||||
/**
|
||||
@ -1982,7 +1982,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__OBJECT_BOXED,
|
||||
G_TYPE_NONE, 2,
|
||||
GDK_TYPE_DRAG_CONTEXT,
|
||||
GDK_TYPE_DRAG,
|
||||
GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||
|
||||
/**
|
||||
|
@ -293,15 +293,15 @@ struct _GtkWidgetClass
|
||||
GdkEvent *event);
|
||||
|
||||
/* Source side drag signals */
|
||||
void (* drag_begin) (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
void (* drag_begin) (GtkWidget *widget,
|
||||
GdkDrag *drag);
|
||||
void (* drag_end) (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
void (* drag_data_get) (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data);
|
||||
void (* drag_data_delete) (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
GdkDrag *drag);
|
||||
|
||||
/* Target side drag signals */
|
||||
void (* drag_leave) (GtkWidget *widget,
|
||||
@ -318,7 +318,7 @@ struct _GtkWidgetClass
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data);
|
||||
gboolean (* drag_failed) (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkDragResult result);
|
||||
|
||||
/* Signals used only for keybindings */
|
||||
|
@ -314,7 +314,7 @@ target_drag_motion (GtkWidget *widget,
|
||||
gint y)
|
||||
{
|
||||
GtkWidget *source_widget;
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
char *s;
|
||||
|
||||
if (!have_drag)
|
||||
@ -418,7 +418,7 @@ label_drag_data_received (GtkWidget *widget,
|
||||
|
||||
void
|
||||
source_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data)
|
||||
{
|
||||
@ -565,7 +565,7 @@ popsite_leave (GtkWidget *widget,
|
||||
|
||||
void
|
||||
source_drag_data_delete (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
g_print ("Delete the data!\n");
|
||||
|
@ -39,7 +39,7 @@ enum {
|
||||
|
||||
static void
|
||||
image_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
@ -65,7 +65,7 @@ image_drag_begin (GtkWidget *widget,
|
||||
hot_y = size;
|
||||
break;
|
||||
}
|
||||
gtk_drag_set_icon_paintable (context, paintable, hot_x, hot_y);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, hot_x, hot_y);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
|
||||
@ -80,7 +80,9 @@ drag_widget_destroyed (GtkWidget *image, gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
window_drag_end (GtkWidget *widget, GdkDragContext *context, gpointer data)
|
||||
window_drag_end (GtkWidget *widget,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *window = data;
|
||||
|
||||
@ -90,7 +92,7 @@ window_drag_end (GtkWidget *widget, GdkDragContext *context, gpointer data)
|
||||
|
||||
static void
|
||||
window_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
@ -114,7 +116,7 @@ window_drag_begin (GtkWidget *widget,
|
||||
else
|
||||
g_print ("reusing drag widget\n");
|
||||
|
||||
gtk_drag_set_icon_widget (context, image, 0, 0);
|
||||
gtk_drag_set_icon_widget (drag, image, 0, 0);
|
||||
|
||||
if (hotspot == CENTER)
|
||||
g_signal_connect (widget, "drag-end", G_CALLBACK (window_drag_end), image);
|
||||
@ -153,7 +155,7 @@ update_dest_target_list (GtkWidget *image)
|
||||
|
||||
void
|
||||
image_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data)
|
||||
{
|
||||
@ -264,7 +266,7 @@ make_image2 (const gchar *icon_name, int hotspot)
|
||||
|
||||
static void
|
||||
spinner_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *spinner;
|
||||
@ -274,25 +276,25 @@ spinner_drag_begin (GtkWidget *widget,
|
||||
"visible", TRUE,
|
||||
"active", TRUE,
|
||||
NULL);
|
||||
gtk_drag_set_icon_widget (context, spinner, 0, 0);
|
||||
g_object_set_data (G_OBJECT (context), "spinner", spinner);
|
||||
gtk_drag_set_icon_widget (drag, spinner, 0, 0);
|
||||
g_object_set_data (G_OBJECT (drag), "spinner", spinner);
|
||||
}
|
||||
|
||||
static void
|
||||
spinner_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *spinner;
|
||||
|
||||
g_print ("GtkWidget::drag-end\n");
|
||||
spinner = g_object_get_data (G_OBJECT (context), "spinner");
|
||||
spinner = g_object_get_data (G_OBJECT (drag), "spinner");
|
||||
gtk_widget_destroy (spinner);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
spinner_drag_failed (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkDragResult result,
|
||||
gpointer data)
|
||||
{
|
||||
@ -309,7 +311,7 @@ spinner_drag_failed (GtkWidget *widget,
|
||||
|
||||
void
|
||||
spinner_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data)
|
||||
{
|
||||
|
@ -10,19 +10,19 @@ clear_pressed (GtkEntry *entry, gint icon, gpointer data)
|
||||
|
||||
static void
|
||||
drag_begin_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint pos;
|
||||
|
||||
pos = gtk_entry_get_current_icon_drag_source (GTK_ENTRY (widget));
|
||||
if (pos != -1)
|
||||
gtk_drag_set_icon_name (context, "dialog-information", 2, 2);
|
||||
gtk_drag_set_icon_name (drag, "dialog-information", 2, 2);
|
||||
}
|
||||
|
||||
static void
|
||||
drag_data_get_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *data,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
@ -20,19 +20,19 @@
|
||||
|
||||
static void
|
||||
drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *image = GTK_WIDGET (data);
|
||||
GdkPaintable *paintable;
|
||||
|
||||
paintable = gtk_image_get_paintable (GTK_IMAGE (image));
|
||||
gtk_drag_set_icon_paintable (context, paintable, -2, -2);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, -2, -2);
|
||||
}
|
||||
|
||||
void
|
||||
drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data)
|
||||
{
|
||||
@ -46,7 +46,7 @@ drag_data_get (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
guint32 time,
|
||||
|
@ -6,7 +6,7 @@ static const char *entries[] = {
|
||||
|
||||
static void
|
||||
drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *row;
|
||||
@ -19,7 +19,7 @@ drag_begin (GtkWidget *widget,
|
||||
|
||||
paintable = gtk_widget_paintable_new (row);
|
||||
gtk_widget_translate_coordinates (widget, row, 0, 0, &x, &y);
|
||||
gtk_drag_set_icon_paintable (context, paintable, -x, -y);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, -x, -y);
|
||||
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
@ -27,7 +27,7 @@ drag_begin (GtkWidget *widget,
|
||||
|
||||
void
|
||||
drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data)
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ on_page_reordered (GtkNotebook *notebook, GtkWidget *child, guint page_num, gpoi
|
||||
|
||||
static void
|
||||
on_notebook_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
guint page_num;
|
||||
@ -101,7 +101,7 @@ on_notebook_drag_begin (GtkWidget *widget,
|
||||
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (widget));
|
||||
|
||||
if (page_num > 2)
|
||||
gtk_drag_set_icon_name (context,
|
||||
gtk_drag_set_icon_name (drag,
|
||||
(page_num % 2) ? "help-browser" : "process-stop",
|
||||
0, 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user