Merge branch 'dnd-cleanups' into 'master'

Dnd cleanups

See merge request GNOME/gtk!228
This commit is contained in:
Matthias Clasen 2018-07-13 07:45:57 +00:00
commit 986daa8225
22 changed files with 252 additions and 411 deletions

View File

@ -5012,6 +5012,7 @@ gtk_selection_data_get_type
<TITLE>Drag and Drop</TITLE>
GtkDestDefaults
GtkDragResult
<SUBSECTION Destination Side>
gtk_drag_dest_set
gtk_drag_dest_unset
@ -5027,8 +5028,9 @@ gtk_drag_get_data
gtk_drag_get_source_widget
gtk_drag_highlight
gtk_drag_unhighlight
<SUBSECTION Source Side>
gtk_drag_begin_with_coordinates
gtk_drag_begin
gtk_drag_cancel
gtk_drag_set_icon_widget
gtk_drag_set_icon_paintable

View File

@ -111,13 +111,6 @@ gdk_broadway_drag_drag_drop (GdkDrag *context,
g_return_if_fail (context != NULL);
}
static void
gdk_broadway_drag_drag_abort (GdkDrag *context,
guint32 time)
{
g_return_if_fail (context != NULL);
}
void
_gdk_broadway_surface_register_dnd (GdkSurface *surface)
{
@ -136,6 +129,5 @@ gdk_broadway_drag_class_init (GdkBroadwayDragClass *klass)
object_class->finalize = gdk_broadway_drag_finalize;
context_class->drag_abort = gdk_broadway_drag_drag_abort;
context_class->drag_drop = gdk_broadway_drag_drag_drop;
}

View File

@ -35,17 +35,6 @@
#include "gdkenumtypes.h"
#include "gdkeventsprivate.h"
typedef struct _GdkDragPrivate GdkDragPrivate;
struct _GdkDragPrivate
{
GdkDisplay *display;
GdkDevice *device;
GdkContentFormats *formats;
GdkDragAction actions;
GdkDragAction suggested_action;
};
static struct {
GdkDragAction action;
const gchar *name;
@ -64,6 +53,8 @@ enum {
PROP_DEVICE,
PROP_DISPLAY,
PROP_FORMATS,
PROP_SELECTED_ACTION,
PROP_ACTIONS,
N_PROPERTIES
};
@ -71,7 +62,6 @@ enum {
CANCEL,
DROP_PERFORMED,
DND_FINISHED,
ACTION_CHANGED,
N_SIGNALS
};
@ -79,7 +69,7 @@ static GParamSpec *properties[N_PROPERTIES] = { NULL, };
static guint signals[N_SIGNALS] = { 0 };
static GList *drags = NULL;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDrag, gdk_drag, G_TYPE_OBJECT)
G_DEFINE_ABSTRACT_TYPE (GdkDrag, gdk_drag, G_TYPE_OBJECT)
/**
* SECTION:dnd
@ -87,14 +77,17 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDrag, gdk_drag, G_TYPE_OBJECT)
* @short_description: Functions for controlling drag and drop handling
*
* These functions provide a low level interface for drag and drop.
* The X backend of GDK supports both the Xdnd and Motif drag and drop
* protocols transparently, the Win32 backend supports the WM_DROPFILES
* protocol.
*
* The GdkDrag object represents the source side of an ongoing DND operation.
* It is created when a drag is started, and stays alive for duration of
* the DND operation.
*
* The GdkDrop object represents the target side of an ongoing DND operation.
*
* GTK+ provides a higher level abstraction based on top of these functions,
* and so they are not normally needed in GTK+ applications.
* See the [Drag and Drop][gtk3-Drag-and-Drop] section of
* the GTK+ documentation for more information.
* and so they are not normally needed in GTK+ applications. See the
* [Drag and Drop][gtk4-Drag-and-Drop] section of the GTK+ documentation
* for more information.
*/
/**
@ -115,11 +108,9 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDrag, gdk_drag, G_TYPE_OBJECT)
GdkDisplay *
gdk_drag_get_display (GdkDrag *drag)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
return priv->display;
return drag->display;
}
/**
@ -133,48 +124,25 @@ gdk_drag_get_display (GdkDrag *drag)
GdkContentFormats *
gdk_drag_get_formats (GdkDrag *drag)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
return priv->formats;
return drag->formats;
}
/**
* gdk_drag_get_actions:
* @drag: a #GdkDrag
*
* Determines the bitmask of actions proposed by the source if
* gdk_drag_get_suggested_action() returns %GDK_ACTION_ASK.
* Determines the bitmask of possible actions proposed by the source.
*
* Returns: the #GdkDragAction flags
**/
GdkDragAction
gdk_drag_get_actions (GdkDrag *drag)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
g_return_val_if_fail (GDK_IS_DRAG (drag), 0);
return priv->actions;
}
/**
* gdk_drag_get_suggested_action:
* @drag: a #GdkDrag
*
* Determines the suggested drag action of the GdkDrag object.
*
* Returns: a #GdkDragAction value
**/
GdkDragAction
gdk_drag_get_suggested_action (GdkDrag *drag)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
g_return_val_if_fail (GDK_IS_DRAG (drag), 0);
return priv->suggested_action;
return drag->actions;
}
/**
@ -190,7 +158,7 @@ gdk_drag_get_selected_action (GdkDrag *drag)
{
g_return_val_if_fail (GDK_IS_DRAG (drag), 0);
return drag->action;
return drag->selected_action;
}
/**
@ -204,11 +172,9 @@ gdk_drag_get_selected_action (GdkDrag *drag)
GdkDevice *
gdk_drag_get_device (GdkDrag *drag)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
return priv->device;
return drag->device;
}
static void
@ -224,7 +190,6 @@ gdk_drag_set_property (GObject *gobject,
GParamSpec *pspec)
{
GdkDrag *drag = GDK_DRAG (gobject);
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
switch (prop_id)
{
@ -232,34 +197,48 @@ gdk_drag_set_property (GObject *gobject,
drag->content = g_value_dup_object (value);
if (drag->content)
{
g_assert (priv->formats == NULL);
priv->formats = gdk_content_provider_ref_formats (drag->content);
g_assert (drag->formats == NULL);
drag->formats = gdk_content_provider_ref_formats (drag->content);
}
break;
case PROP_DEVICE:
priv->device = g_value_dup_object (value);
g_assert (priv->device != NULL);
priv->display = gdk_device_get_display (priv->device);
drag->device = g_value_dup_object (value);
g_assert (drag->device != NULL);
drag->display = gdk_device_get_display (drag->device);
break;
case PROP_FORMATS:
if (priv->formats)
if (drag->formats)
{
GdkContentFormats *override = g_value_dup_boxed (value);
if (override)
{
gdk_content_formats_unref (priv->formats);
priv->formats = override;
gdk_content_formats_unref (drag->formats);
drag->formats = override;
}
}
else
{
priv->formats = g_value_dup_boxed (value);
g_assert (priv->formats != NULL);
drag->formats = g_value_dup_boxed (value);
g_assert (drag->formats != NULL);
}
break;
case PROP_SELECTED_ACTION:
{
GdkDragAction action = g_value_get_flags (value);
gdk_drag_set_selected_action (drag, action);
}
break;
case PROP_ACTIONS:
{
GdkDragAction actions = g_value_get_flags (value);
gdk_drag_set_actions (drag, actions);
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@ -273,7 +252,6 @@ gdk_drag_get_property (GObject *gobject,
GParamSpec *pspec)
{
GdkDrag *drag = GDK_DRAG (gobject);
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
switch (prop_id)
{
@ -282,15 +260,23 @@ gdk_drag_get_property (GObject *gobject,
break;
case PROP_DEVICE:
g_value_set_object (value, priv->device);
g_value_set_object (value, drag->device);
break;
case PROP_DISPLAY:
g_value_set_object (value, priv->display);
g_value_set_object (value, drag->display);
break;
case PROP_FORMATS:
g_value_set_boxed (value, priv->formats);
g_value_set_boxed (value, drag->formats);
break;
case PROP_SELECTED_ACTION:
g_value_set_flags (value, drag->selected_action);
break;
case PROP_ACTIONS:
g_value_set_flags (value, drag->actions);
break;
default:
@ -303,12 +289,11 @@ static void
gdk_drag_finalize (GObject *object)
{
GdkDrag *drag = GDK_DRAG (object);
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
drags = g_list_remove (drags, drag);
g_clear_object (&drag->content);
g_clear_pointer (&priv->formats, gdk_content_formats_unref);
g_clear_pointer (&drag->formats, gdk_content_formats_unref);
if (drag->source_surface)
g_object_unref (drag->source_surface);
@ -384,6 +369,25 @@ gdk_drag_class_init (GdkDragClass *klass)
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
properties[PROP_SELECTED_ACTION] =
g_param_spec_flags ("selected-action",
"Selected action",
"The currently selected action",
GDK_TYPE_DRAG_ACTION,
0,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
properties[PROP_ACTIONS] =
g_param_spec_flags ("actions",
"Actions",
"The possible actions",
GDK_TYPE_DRAG_ACTION,
0,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
/**
* GdkDrag::cancel:
* @drag: The object on which the signal is emitted
@ -432,43 +436,9 @@ gdk_drag_class_init (GdkDragClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* 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 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 (GdkDragClass, action_changed),
NULL, NULL,
g_cclosure_marshal_VOID__FLAGS,
G_TYPE_NONE, 1, GDK_TYPE_DRAG_ACTION);
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
}
/*
* gdk_drag_abort:
* @drag: a #GdkDrag
* @time_: the timestamp for this operation
*
* Aborts a drag without dropping.
*
* This function is called by the drag source.
*/
void
gdk_drag_abort (GdkDrag *drag,
guint32 time_)
{
g_return_if_fail (GDK_IS_DRAG (drag));
GDK_DRAG_GET_CLASS (drag)->drag_abort (drag, time_);
}
/*
* gdk_drag_drop:
* @drag: a #GdkDrag
@ -608,13 +578,31 @@ gdk_drag_write_finish (GdkDrag *drag,
void
gdk_drag_set_actions (GdkDrag *drag,
GdkDragAction actions,
GdkDragAction suggested_action)
GdkDragAction actions)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
if (drag->actions == actions)
return;
priv->actions = actions;
priv->suggested_action = suggested_action;
drag->actions = actions;
g_object_notify_by_pspec (G_OBJECT (drag), properties[PROP_ACTIONS]);
}
void
gdk_drag_set_selected_action (GdkDrag *drag,
GdkDragAction action)
{
GdkCursor *cursor;
if (drag->selected_action == action)
return;
drag->selected_action = action;
cursor = gdk_drag_get_cursor (drag, action);
gdk_drag_set_cursor (drag, cursor);
g_object_notify_by_pspec (G_OBJECT (drag), properties[PROP_SELECTED_ACTION]);
}
/**

View File

@ -66,8 +66,6 @@ GdkContentFormats *gdk_drag_get_formats (GdkDrag *drag);
GDK_AVAILABLE_IN_ALL
GdkDragAction gdk_drag_get_actions (GdkDrag *drag);
GDK_AVAILABLE_IN_ALL
GdkDragAction gdk_drag_get_suggested_action (GdkDrag *drag);
GDK_AVAILABLE_IN_ALL
GdkDragAction gdk_drag_get_selected_action (GdkDrag *drag);
GDK_AVAILABLE_IN_ALL

View File

@ -33,8 +33,6 @@ typedef struct _GdkDragClass GdkDragClass;
struct _GdkDragClass {
GObjectClass parent_class;
void (*drag_abort) (GdkDrag *drag,
guint32 time_);
void (*drag_drop) (GdkDrag *drag,
guint32 time_);
GdkSurface* (*get_drag_surface) (GdkDrag *drag);
@ -54,8 +52,6 @@ struct _GdkDragClass {
gboolean (*handle_event) (GdkDrag *drag,
const GdkEvent *event);
void (*action_changed) (GdkDrag *drag,
GdkDragAction action);
};
struct _GdkDrag {
@ -65,8 +61,13 @@ struct _GdkDrag {
GdkSurface *source_surface;
GdkSurface *drag_surface;
GdkDisplay *display;
GdkDevice *device;
GdkContentFormats *formats;
GdkContentProvider *content;
GdkDragAction action;
GdkDragAction actions;
GdkDragAction selected_action;
guint drop_done : 1; /* Whether gdk_drag_drop_done() was performed */
};
@ -74,8 +75,9 @@ struct _GdkDrag {
void gdk_drag_set_cursor (GdkDrag *drag,
GdkCursor *cursor);
void gdk_drag_set_actions (GdkDrag *drag,
GdkDragAction actions,
GdkDragAction suggested_action);
GdkDragAction actions);
void gdk_drag_set_selected_action (GdkDrag *drag,
GdkDragAction action);
void gdk_drag_cancel (GdkDrag *drag,
GdkDragCancelReason reason);
@ -83,8 +85,6 @@ gboolean gdk_drag_handle_source_event (GdkEvent *event);
GdkCursor * gdk_drag_get_cursor (GdkDrag *drag,
GdkDragAction action);
void gdk_drag_abort (GdkDrag *drag,
guint32 time_);
void gdk_drag_drop (GdkDrag *drag,
guint32 time_);

View File

@ -34,16 +34,6 @@
#include "gdkpipeiostreamprivate.h"
#include "gdksurface.h"
typedef struct _GdkDropPrivate GdkDropPrivate;
struct _GdkDropPrivate {
GdkDevice *device;
GdkDrag *drag;
GdkContentFormats *formats;
GdkSurface *surface;
GdkDragAction actions;
};
enum {
PROP_0,
PROP_ACTIONS,
@ -57,7 +47,7 @@ enum {
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDrop, gdk_drop, G_TYPE_OBJECT)
G_DEFINE_ABSTRACT_TYPE (GdkDrop, gdk_drop, G_TYPE_OBJECT)
/**
* GdkDrop:
@ -94,7 +84,6 @@ gdk_drop_read_local_async (GdkDrop *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
GdkContentFormats *content_formats;
const char *mime_type;
GTask *task;
@ -103,7 +92,7 @@ gdk_drop_read_local_async (GdkDrop *self,
g_task_set_priority (task, io_priority);
g_task_set_source_tag (task, gdk_drop_read_local_async);
if (priv->drag == NULL)
if (self->drag == NULL)
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("Drag'n'drop from other applications is not supported."));
@ -111,7 +100,7 @@ gdk_drop_read_local_async (GdkDrop *self,
return;
}
content_formats = gdk_content_provider_ref_formats (priv->drag->content);
content_formats = gdk_content_provider_ref_formats (self->drag->content);
content_formats = gdk_content_formats_union_serialize_mime_types (content_formats);
mime_type = gdk_content_formats_match_mime_type (content_formats, formats);
@ -122,7 +111,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_write_async (priv->drag,
gdk_drag_write_async (self->drag,
mime_type,
output_stream,
io_priority,
@ -166,7 +155,6 @@ gdk_drop_set_property (GObject *gobject,
GParamSpec *pspec)
{
GdkDrop *self = GDK_DROP (gobject);
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
switch (prop_id)
{
@ -175,26 +163,26 @@ gdk_drop_set_property (GObject *gobject,
break;
case PROP_DEVICE:
priv->device = g_value_dup_object (value);
g_assert (priv->device != NULL);
if (priv->surface)
g_assert (gdk_surface_get_display (priv->surface) == gdk_device_get_display (priv->device));
self->device = g_value_dup_object (value);
g_assert (self->device != NULL);
if (self->surface)
g_assert (gdk_surface_get_display (self->surface) == gdk_device_get_display (self->device));
break;
case PROP_DRAG:
priv->drag = g_value_dup_object (value);
self->drag = g_value_dup_object (value);
break;
case PROP_FORMATS:
priv->formats = g_value_dup_boxed (value);
g_assert (priv->formats != NULL);
self->formats = g_value_dup_boxed (value);
g_assert (self->formats != NULL);
break;
case PROP_SURFACE:
priv->surface = g_value_dup_object (value);
g_assert (priv->surface != NULL);
if (priv->device)
g_assert (gdk_surface_get_display (priv->surface) == gdk_device_get_display (priv->device));
self->surface = g_value_dup_object (value);
g_assert (self->surface != NULL);
if (self->device)
g_assert (gdk_surface_get_display (self->surface) == gdk_device_get_display (self->device));
break;
default:
@ -210,32 +198,31 @@ gdk_drop_get_property (GObject *gobject,
GParamSpec *pspec)
{
GdkDrop *self = GDK_DROP (gobject);
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
switch (prop_id)
{
case PROP_ACTIONS:
g_value_set_flags (value, priv->actions);
g_value_set_flags (value, self->actions);
break;
case PROP_DEVICE:
g_value_set_object (value, priv->device);
g_value_set_object (value, self->device);
break;
case PROP_DISPLAY:
g_value_set_object (value, gdk_device_get_display (priv->device));
g_value_set_object (value, gdk_device_get_display (self->device));
break;
case PROP_DRAG:
g_value_set_object (value, priv->drag);
g_value_set_object (value, self->drag);
break;
case PROP_FORMATS:
g_value_set_boxed (value, priv->formats);
g_value_set_boxed (value, self->formats);
break;
case PROP_SURFACE:
g_value_set_object (value, priv->surface);
g_value_set_object (value, self->surface);
break;
default:
@ -248,10 +235,9 @@ static void
gdk_drop_finalize (GObject *object)
{
GdkDrop *self = GDK_DROP (object);
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
g_clear_object (&priv->device);
g_clear_object (&priv->drag);
g_clear_object (&self->device);
g_clear_object (&self->drag);
G_OBJECT_CLASS (gdk_drop_parent_class)->finalize (object);
}
@ -376,11 +362,9 @@ gdk_drop_init (GdkDrop *self)
GdkDisplay *
gdk_drop_get_display (GdkDrop *self)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
g_return_val_if_fail (GDK_IS_DROP (self), NULL);
return gdk_device_get_display (priv->device);
return gdk_device_get_display (self->device);
}
/**
@ -394,11 +378,9 @@ gdk_drop_get_display (GdkDrop *self)
GdkDevice *
gdk_drop_get_device (GdkDrop *self)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
g_return_val_if_fail (GDK_IS_DROP (self), NULL);
return priv->device;
return self->device;
}
/**
@ -413,11 +395,9 @@ gdk_drop_get_device (GdkDrop *self)
GdkContentFormats *
gdk_drop_get_formats (GdkDrop *self)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
g_return_val_if_fail (GDK_IS_DROP (self), NULL);
return priv->formats;
return self->formats;
}
/**
@ -431,11 +411,9 @@ gdk_drop_get_formats (GdkDrop *self)
GdkSurface *
gdk_drop_get_surface (GdkDrop *self)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
g_return_val_if_fail (GDK_IS_DROP (self), NULL);
return priv->surface;
return self->surface;
}
/**
@ -457,26 +435,22 @@ gdk_drop_get_surface (GdkDrop *self)
GdkDragAction
gdk_drop_get_actions (GdkDrop *self)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
g_return_val_if_fail (GDK_IS_DROP (self), 0);
return priv->actions;
return self->actions;
}
void
gdk_drop_set_actions (GdkDrop *self,
GdkDragAction actions)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
g_return_if_fail (GDK_IS_DROP (self));
g_return_if_fail ((actions & GDK_ACTION_ASK) == 0);
if (priv->actions == actions)
if (self->actions == actions)
return;
priv->actions = actions;
self->actions = actions;
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ACTIONS]);
}
@ -495,11 +469,9 @@ gdk_drop_set_actions (GdkDrop *self,
GdkDrag *
gdk_drop_get_drag (GdkDrop *self)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
g_return_val_if_fail (GDK_IS_DROP (self), 0);
return priv->drag;
return self->drag;
}
/**
@ -557,9 +529,7 @@ gdk_drop_read_internal (GdkDrop *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
if (priv->drag)
if (self->drag)
{
gdk_drop_read_local_async (self,
formats,
@ -708,7 +678,6 @@ gdk_drop_read_value_internal (GdkDrop *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
GdkContentFormatsBuilder *builder;
GdkContentFormats *formats;
GValue *value;
@ -721,11 +690,11 @@ gdk_drop_read_value_internal (GdkDrop *self,
g_value_init (value, type);
g_task_set_task_data (task, value, free_value);
if (priv->drag)
if (self->drag)
{
GError *error = NULL;
if (gdk_content_provider_get_value (priv->drag->content, value, &error))
if (gdk_content_provider_get_value (self->drag->content, value, &error))
{
g_task_return_pointer (task, value, NULL);
g_object_unref (task);
@ -906,14 +875,13 @@ gdk_drop_emit_enter_event (GdkDrop *self,
gboolean dont_queue,
guint32 time)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
GdkEvent *event;
event = gdk_event_new (GDK_DRAG_ENTER);
event->any.surface = g_object_ref (priv->surface);
event->any.surface = g_object_ref (self->surface);
event->dnd.drop = g_object_ref (self);
event->dnd.time = time;
gdk_event_set_device (event, priv->device);
gdk_event_set_device (event, self->device);
gdk_drop_do_emit_event (event, dont_queue);
}
@ -925,16 +893,15 @@ gdk_drop_emit_motion_event (GdkDrop *self,
double y_root,
guint32 time)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
GdkEvent *event;
event = gdk_event_new (GDK_DRAG_MOTION);
event->any.surface = g_object_ref (priv->surface);
event->any.surface = g_object_ref (self->surface);
event->dnd.drop = g_object_ref (self);
event->dnd.time = time;
event->dnd.x_root = x_root;
event->dnd.y_root = y_root;
gdk_event_set_device (event, priv->device);
gdk_event_set_device (event, self->device);
gdk_drop_do_emit_event (event, dont_queue);
}
@ -944,14 +911,13 @@ gdk_drop_emit_leave_event (GdkDrop *self,
gboolean dont_queue,
guint32 time)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
GdkEvent *event;
event = gdk_event_new (GDK_DRAG_LEAVE);
event->any.surface = g_object_ref (priv->surface);
event->any.surface = g_object_ref (self->surface);
event->dnd.drop = g_object_ref (self);
event->dnd.time = time;
gdk_event_set_device (event, priv->device);
gdk_event_set_device (event, self->device);
gdk_drop_do_emit_event (event, dont_queue);
}
@ -963,16 +929,15 @@ gdk_drop_emit_drop_event (GdkDrop *self,
double y_root,
guint32 time)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
GdkEvent *event;
event = gdk_event_new (GDK_DROP_START);
event->any.surface = g_object_ref (priv->surface);
event->any.surface = g_object_ref (self->surface);
event->dnd.drop = g_object_ref (self);
event->dnd.time = time;
event->dnd.x_root = x_root;
event->dnd.y_root = y_root;
gdk_event_set_device (event, priv->device);
gdk_event_set_device (event, self->device);
gdk_drop_do_emit_event (event, dont_queue);
}

View File

@ -34,6 +34,12 @@ typedef struct _GdkDropClass GdkDropClass;
struct _GdkDrop {
GObject parent_instance;
GdkDevice *device;
GdkDrag *drag;
GdkContentFormats *formats;
GdkSurface *surface;
GdkDragAction actions;
};
struct _GdkDropClass {

View File

@ -250,9 +250,6 @@ struct _GdkWaylandSeat
GdkDrag *drag;
GdkDrop *drop;
/* Source/dest for non-local dnd */
GdkSurface *foreign_dnd_surface;
/* Some tracking on gesture events */
guint gesture_n_fingers;
gdouble gesture_scale;
@ -4562,12 +4559,6 @@ static const struct wl_surface_listener pointer_surface_listener = {
pointer_surface_leave
};
static GdkSurface *
create_foreign_dnd_surface (GdkDisplay *display)
{
return gdk_surface_new_popup (display, &(GdkRectangle) { 0, 0, 1, 1 });
}
static void
gdk_wayland_pointer_data_finalize (GdkWaylandPointerData *pointer)
{
@ -4602,7 +4593,6 @@ gdk_wayland_seat_finalize (GObject *object)
g_clear_object (&seat->clipboard);
g_clear_object (&seat->primary_clipboard);
g_hash_table_destroy (seat->touches);
gdk_surface_destroy (seat->foreign_dnd_surface);
zwp_tablet_seat_v2_destroy (seat->wp_tablet_seat);
stop_key_repeat (seat);
@ -4944,7 +4934,6 @@ _gdk_wayland_display_create_seat (GdkWaylandDisplay *display_wayland,
seat->keymap = _gdk_wayland_keymap_new (display);
seat->display = display;
seat->touches = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) g_free);
seat->foreign_dnd_surface = create_foreign_dnd_surface (display);
seat->wl_seat = wl_seat;
wl_seat_add_listener (seat->wl_seat, &seat_listener, seat);

View File

@ -51,7 +51,6 @@ struct _GdkWaylandDrag
struct wl_surface *dnd_wl_surface;
struct wl_data_source *data_source;
struct wl_data_offer *offer;
GdkDragAction selected_action;
uint32_t serial;
gint hot_x;
gint hot_y;
@ -105,12 +104,6 @@ gdk_to_wl_actions (GdkDragAction action)
return dnd_actions;
}
static void
gdk_wayland_drag_drag_abort (GdkDrag *drag,
guint32 time)
{
}
static void
gdk_wayland_drag_drag_drop (GdkDrag *drag,
guint32 time)
@ -125,7 +118,7 @@ gdk_wayland_drag_init (GdkWaylandDrag *drag_wayland)
drag = GDK_DRAG (drag_wayland);
drags = g_list_prepend (drags, drag);
drag->action = GDK_ACTION_COPY;
gdk_drag_set_selected_action (drag, GDK_ACTION_COPY);
}
static GdkSurface *
@ -161,17 +154,8 @@ gdk_wayland_drag_set_cursor (GdkDrag *drag,
{
GdkDevice *device = gdk_drag_get_device (drag);
gdk_wayland_seat_set_global_cursor (gdk_device_get_seat (device), cursor);
}
static void
gdk_wayland_drag_action_changed (GdkDrag *drag,
GdkDragAction action)
{
GdkCursor *cursor;
cursor = gdk_drag_get_cursor (drag, action);
gdk_drag_set_cursor (drag, cursor);
if (device != NULL)
gdk_wayland_seat_set_global_cursor (gdk_device_get_seat (device), cursor);
}
static void
@ -212,13 +196,11 @@ gdk_wayland_drag_class_init (GdkWaylandDragClass *klass)
object_class->finalize = gdk_wayland_drag_finalize;
drag_class->drag_abort = gdk_wayland_drag_drag_abort;
drag_class->drag_drop = gdk_wayland_drag_drag_drop;
drag_class->get_drag_surface = gdk_wayland_drag_get_drag_surface;
drag_class->set_hotspot = gdk_wayland_drag_set_hotspot;
drag_class->drop_done = gdk_wayland_drag_drop_done;
drag_class->set_cursor = gdk_wayland_drag_set_cursor;
drag_class->action_changed = gdk_wayland_drag_action_changed;
drag_class->drop_performed = gdk_wayland_drag_drop_performed;
drag_class->cancel = gdk_wayland_drag_cancel;
}
@ -346,8 +328,7 @@ data_source_action (void *data,
g_message ("data source action, source = %p action=%x",
source, action));
drag->action = _wl_to_gdk_actions (action);
g_signal_emit_by_name (drag, "action-changed", drag->action);
gdk_drag_set_selected_action (drag, _wl_to_gdk_actions (action));
}
static const struct wl_data_source_listener data_source_listener = {
@ -392,6 +373,7 @@ _gdk_wayland_surface_drag_begin (GdkSurface *surface,
GdkDrag *drag;
GdkSeat *seat;
GdkWaylandDisplay *display_wayland;
GdkCursor *cursor;
display_wayland = GDK_WAYLAND_DISPLAY (gdk_device_get_display (device));
seat = gdk_device_get_seat (device);
@ -423,6 +405,9 @@ _gdk_wayland_surface_drag_begin (GdkSurface *surface,
drag_wayland->dnd_wl_surface,
_gdk_wayland_display_get_serial (display_wayland));
cursor = gdk_drag_get_cursor (drag, gdk_drag_get_selected_action (drag));
gdk_drag_set_cursor (drag, cursor);
gdk_seat_ungrab (seat);
return drag;

View File

@ -5,7 +5,7 @@ gdk_wayland_sources = files([
'gdkcursor-wayland.c',
'gdkdevice-wayland.c',
'gdkdisplay-wayland.c',
'gdkdnd-wayland.c',
'gdkdrag-wayland.c',
'gdkdrop-wayland.c',
'gdkeventsource.c',
'gdkglcontext-wayland.c',

View File

@ -806,7 +806,7 @@ gdk_drag_new (GdkDisplay *display,
else
drag_win32->scale = _gdk_win32_display_get_monitor_scale_factor (win32_display, NULL, NULL, NULL);
gdk_drag_set_actions (drag, actions, actions);
gdk_drag_set_actions (drag, actions);
drag_win32->protocol = protocol;
return drag;
@ -1072,7 +1072,7 @@ maybe_emit_action_changed (GdkWin32Drag *drag_win32,
if (actions != drag_win32->current_action)
{
drag_win32->current_action = actions;
g_signal_emit_by_name (GDK_DRAG (drag_win32), "action-changed", actions);
gdk_drag_set_selected_action (GDK_DRAG (drag_win32), actions);
}
}
@ -1088,7 +1088,6 @@ _gdk_win32_local_drag_give_feedback (GdkDrag *drag,
GDK_NOTE (DND, g_print ("_gdk_win32_local_drag_give_feedback: 0x%p\n",
drag));
drag->action = actions;
maybe_emit_action_changed (drag_win32, actions);
}
@ -1107,8 +1106,7 @@ give_feedback (gpointer user_data)
GDK_NOTE (DND, g_print ("gdk_dnd_handle_drag_status: 0x%p\n",
drag));
drag->action = action_for_drop_effect (feedback->received_drop_effect);
maybe_emit_action_changed (drag_win32, drag->action);
maybe_emit_action_changed (drag_win32, action_for_drop_effect (feedback->received_drop_effect));
}
free_queue_item (&feedback->base);
@ -1923,13 +1921,12 @@ gdk_win32_local_drag_motion (GdkDrag *drag,
actions = gdk_drag_get_actions (drag);
GDK_NOTE (DND, g_print ("gdk_win32_local_drag_motion: @ %+d:%+d possible=%s\n"
" dest=%p (current %p) drop=%p drag=%p:{actions=%s,suggested=%s,action=%s}\n",
" dest=%p (current %p) drop=%p drag=%p:{actions=%s,action=%s}\n",
x_root, y_root,
_gdk_win32_drag_action_to_string (possible_actions),
dest_window, drag_win32->dest_window, drop, drag,
_gdk_win32_drag_action_to_string (actions),
_gdk_win32_drag_action_to_string (gdk_drag_get_suggested_action (drag)),
_gdk_win32_drag_action_to_string (drag->action)));
_gdk_win32_drag_action_to_string (gdk_drag_get_selected_action (drag))));
if (drag_win32->dest_window != dest_window)
{
@ -1970,12 +1967,11 @@ gdk_win32_local_drag_motion (GdkDrag *drag,
}
GDK_NOTE (DND, g_print (" returning %s\n"
" drag=%p:{actions=%s,suggested=%s,action=%s}\n",
" drag=%p:{actions=%s,action=%s}\n",
(drop != NULL && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG) ? "TRUE" : "FALSE",
drag,
_gdk_win32_drag_action_to_string (gdk_drag_get_actions (drag)),
_gdk_win32_drag_action_to_string (gdk_drag_get_suggested_action (drag)),
_gdk_win32_drag_action_to_string (drag->action)));
_gdk_win32_drag_action_to_string (gdk_drag_get_selected_action (drag))));
return (drop != NULL && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG);
}
@ -2032,31 +2028,6 @@ gdk_win32_drag_drop (GdkDrag *drag,
}
}
static void
gdk_win32_drag_abort (GdkDrag *drag,
guint32 time_)
{
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
g_assert (_win32_main_thread == NULL ||
_win32_main_thread == g_thread_self ());
g_return_if_fail (drag != NULL);
GDK_NOTE (DND, g_print ("gdk_win32_drag_abort\n"));
if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2)
{
gpointer ddd = g_hash_table_lookup (clipdrop->active_source_drags, drag);
drag_win32->util_data.state = GDK_WIN32_DND_NONE;
if (ddd)
send_source_state_update (clipdrop, drag_win32, ddd);
}
}
static void
gdk_win32_drag_set_cursor (GdkDrag *drag,
GdkCursor *cursor)
@ -2558,16 +2529,6 @@ gdk_win32_drag_handle_event (GdkDrag *drag,
return FALSE;
}
void
gdk_win32_drag_action_changed (GdkDrag *drag,
GdkDragAction action)
{
GdkCursor *cursor;
cursor = gdk_drag_get_cursor (drag, action);
gdk_drag_set_cursor (drag, cursor);
}
static GdkSurface *
gdk_win32_drag_get_drag_surface (GdkDrag *drag)
{
@ -2603,7 +2564,6 @@ gdk_win32_drag_class_init (GdkWin32DragClass *klass)
object_class->finalize = gdk_win32_drag_finalize;
drag_class->drag_abort = gdk_win32_drag_abort;
drag_class->drag_drop = gdk_win32_drag_drop;
drag_class->get_drag_surface = gdk_win32_drag_get_drag_surface;
@ -2613,5 +2573,4 @@ gdk_win32_drag_class_init (GdkWin32DragClass *klass)
drag_class->cancel = gdk_win32_drag_cancel;
drag_class->drop_performed = gdk_win32_drag_drop_performed;
drag_class->handle_event = gdk_win32_drag_handle_event;
drag_class->action_changed = gdk_win32_drag_action_changed;
}

View File

@ -170,8 +170,6 @@ static void gdk_surface_cache_unref (GdkSurfaceCache *cache);
gboolean gdk_x11_drag_handle_event (GdkDrag *drag,
const GdkEvent *event);
void gdk_x11_drag_action_changed (GdkDrag *drag,
GdkDragAction action);
static GList *drags;
static GSList *window_caches;
@ -198,8 +196,6 @@ static gboolean gdk_x11_drag_drag_motion (GdkDrag *drag,
GdkDragAction suggested_action,
GdkDragAction possible_actions,
guint32 time);
static void gdk_x11_drag_drag_abort (GdkDrag *drag,
guint32 time_);
static void gdk_x11_drag_drag_drop (GdkDrag *drag,
guint32 time_);
static GdkSurface * gdk_x11_drag_get_drag_surface (GdkDrag *drag);
@ -223,7 +219,6 @@ gdk_x11_drag_class_init (GdkX11DragClass *klass)
object_class->finalize = gdk_x11_drag_finalize;
drag_class->drag_abort = gdk_x11_drag_drag_abort;
drag_class->drag_drop = gdk_x11_drag_drag_drop;
drag_class->get_drag_surface = gdk_x11_drag_get_drag_surface;
drag_class->set_hotspot = gdk_x11_drag_set_hotspot;
@ -232,7 +227,6 @@ gdk_x11_drag_class_init (GdkX11DragClass *klass)
drag_class->cancel = gdk_x11_drag_cancel;
drag_class->drop_performed = gdk_x11_drag_drop_performed;
drag_class->handle_event = gdk_x11_drag_handle_event;
drag_class->action_changed = gdk_x11_drag_action_changed;
}
static void
@ -882,13 +876,8 @@ gdk_x11_drag_handle_status (GdkDisplay *display,
action = 0;
}
drag->action = xdnd_action_from_atom (display, action);
if (drag->action != drag_x11->current_action)
{
drag_x11->current_action = drag->action;
g_signal_emit_by_name (drag, "action-changed", drag->action);
}
gdk_drag_set_selected_action (drag, xdnd_action_from_atom (display, action));
drag_x11->current_action = action;
}
}
@ -1010,12 +999,8 @@ send_client_message_async_cb (Window window,
window == drag_x11->proxy_xid)
{
drag_x11->proxy_xid = None;
drag->action = 0;
if (drag->action != drag_x11->current_action)
{
drag_x11->current_action = 0;
g_signal_emit_by_name (drag, "action-changed", 0);
}
gdk_drag_set_selected_action (drag, 0);
drag_x11->current_action = 0;
drag_x11->drag_status = GDK_DRAG_STATUS_DRAG;
}
@ -1489,7 +1474,7 @@ gdk_x11_drag_drag_motion (GdkDrag *drag,
if (drag_x11->drag_surface)
move_drag_surface (drag, x_root, y_root);
gdk_drag_set_actions (drag, possible_actions, suggested_action);
gdk_drag_set_actions (drag, possible_actions);
if (protocol == GDK_DRAG_PROTO_XDND && drag_x11->version == 0)
{
@ -1558,17 +1543,13 @@ gdk_x11_drag_drag_motion (GdkDrag *drag,
{
drag_x11->proxy_xid = None;
drag_x11->drop_xid = None;
drag->action = 0;
gdk_drag_set_selected_action (drag, 0);
}
/* Push a status event, to let the client know that
* the drag changed
*/
if (drag->action != drag_x11->current_action)
{
drag_x11->current_action = drag->action;
g_signal_emit_by_name (drag, "action-changed", drag->action);
}
drag_x11->current_action = gdk_drag_get_selected_action (drag);
}
/* Send a drag-motion event */
@ -1597,15 +1578,11 @@ gdk_x11_drag_drag_motion (GdkDrag *drag,
*/
if (gdk_content_formats_contain_mime_type (formats, "application/x-rootwindow-drop") ||
gdk_content_formats_contain_mime_type (formats, "application/x-rootwin-drop"))
drag->action = gdk_drag_get_suggested_action (drag);
gdk_drag_set_selected_action (drag, suggested_action);
else
drag->action = 0;
gdk_drag_set_selected_action (drag, 0);
if (drag->action != drag_x11->current_action)
{
drag_x11->current_action = drag->action;
g_signal_emit_by_name (drag, "action-changed", drag->action);
}
drag_x11->current_action = gdk_drag_get_selected_action (drag);
}
break;
case GDK_DRAG_PROTO_NONE:
@ -1622,13 +1599,6 @@ gdk_x11_drag_drag_motion (GdkDrag *drag,
return FALSE;
}
static void
gdk_x11_drag_drag_abort (GdkDrag *drag,
guint32 time)
{
gdk_drag_do_leave (GDK_X11_DRAG (drag), time);
}
static void
gdk_x11_drag_drag_drop (GdkDrag *drag,
guint32 time)
@ -2267,19 +2237,20 @@ gdk_drag_update (GdkDrag *drag,
guint32 evtime)
{
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
GdkDragAction action, possible_actions;
GdkDragAction suggested_action;
GdkDragAction possible_actions;
GdkDragProtocol protocol;
Window proxy;
gdk_drag_get_current_actions (mods, GDK_BUTTON_PRIMARY, x11_drag->actions,
&action, &possible_actions);
&suggested_action, &possible_actions);
proxy = gdk_x11_drag_find_surface (drag,
x11_drag->drag_surface,
x_root, y_root, &protocol);
x11_drag->drag_surface,
x_root, y_root, &protocol);
gdk_x11_drag_drag_motion (drag, proxy, protocol, x_root, y_root,
action, possible_actions, evtime);
suggested_action, possible_actions, evtime);
}
static gboolean
@ -2448,13 +2419,3 @@ gdk_x11_drag_handle_event (GdkDrag *drag,
return FALSE;
}
void
gdk_x11_drag_action_changed (GdkDrag *drag,
GdkDragAction action)
{
GdkCursor *cursor;
cursor = gdk_drag_get_cursor (drag, action);
gdk_drag_set_cursor (drag, cursor);
}

View File

@ -2675,10 +2675,10 @@ gtk_calendar_drag_update (GtkGestureDrag *gesture,
targets = gdk_content_formats_new (NULL, 0);
targets = gtk_content_formats_add_text_targets (targets);
drag = 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 (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);

View File

@ -961,17 +961,13 @@ gtk_drag_begin_internal (GtkWidget *widget,
}
/**
* gtk_drag_begin_with_coordinates: (method)
* gtk_drag_begin: (method)
* @widget: the source widget
* @device: (nullable): the device that starts the drag or %NULL to use the default
* pointer.
* @targets: The targets (data formats) in which the
* source can provide the data
* @device: (nullable): the device that starts the drag or %NULL to use the default pointer
* @targets: The targets (data formats) in which the source can provide the data
* @actions: A bitmask of the allowed drag actions for this drag
* @x: The initial x coordinate to start dragging from, in the coordinate space
* of @widget.
* @y: The initial y coordinate to start dragging from, in the coordinate space
* of @widget.
* @x: The initial x coordinate to start dragging from, in the coordinate space of @widget.
* @y: The initial y coordinate to start dragging from, in the coordinate space of @widget.
*
* Initiates a drag on the source side. The function only needs to be used
* when the application is starting drags itself, and is not needed when
@ -980,12 +976,12 @@ gtk_drag_begin_internal (GtkWidget *widget,
* Returns: (transfer none): the context for this drag
*/
GdkDrag *
gtk_drag_begin_with_coordinates (GtkWidget *widget,
GdkDevice *device,
GdkContentFormats *targets,
GdkDragAction actions,
gint x,
gint y)
gtk_drag_begin (GtkWidget *widget,
GdkDevice *device,
GdkContentFormats *targets,
GdkDragAction actions,
gint x,
gint y)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
g_return_val_if_fail (device == NULL || GDK_IS_DEVICE (device), NULL);
@ -1411,14 +1407,14 @@ gtk_drag_check_threshold (GtkWidget *widget,
/**
* gtk_drag_cancel:
* @drag: a drag context, as e.g. returned by gtk_drag_begin_with_coordinates()
* @drag: a drag context, as e.g. returned by gtk_drag_begin()
*
* Cancels an ongoing drag operation on the source side.
*
* If you want to be able to cancel a drag operation in this way,
* you need to keep a pointer to the drag context, either from an
* explicit call to gtk_drag_begin_with_coordinates(), or by
* connecting to #GtkWidget::drag-begin.
* explicit call to gtk_drag_begin(), or by connecting to
* #GtkWidget::drag-begin.
*
* If @context does not refer to an ongoing drag operation, this
* function does nothing.

View File

@ -55,12 +55,12 @@ void gtk_drag_unhighlight (GtkWidget *widget);
/* Source side */
GDK_AVAILABLE_IN_ALL
GdkDrag *gtk_drag_begin_with_coordinates (GtkWidget *widget,
GdkDevice *device,
GdkContentFormats *targets,
GdkDragAction actions,
gint x,
gint y);
GdkDrag *gtk_drag_begin (GtkWidget *widget,
GdkDevice *device,
GdkContentFormats *targets,
GdkDragAction actions,
gint x,
gint y);
GDK_AVAILABLE_IN_ALL
void gtk_drag_cancel (GdkDrag *drag);

View File

@ -3029,11 +3029,11 @@ icon_drag_update_cb (GtkGestureDrag *gesture,
x, y))
{
icon_info->in_drag = TRUE;
gtk_drag_begin_with_coordinates (GTK_WIDGET (entry),
gtk_gesture_get_device (GTK_GESTURE (gesture)),
icon_info->target_list,
icon_info->actions,
start_x, start_y);
gtk_drag_begin (GTK_WIDGET (entry),
gtk_gesture_get_device (GTK_GESTURE (gesture)),
icon_info->target_list,
icon_info->actions,
start_x, start_y);
}
}
@ -3893,11 +3893,11 @@ gtk_entry_drag_gesture_update (GtkGestureDrag *gesture,
gtk_entry_get_pixel_ranges (entry, &ranges, &n_ranges);
gtk_drag_begin_with_coordinates (widget,
gdk_event_get_device ((GdkEvent*) event),
target_list, actions,
priv->drag_start_x + ranges[0],
priv->drag_start_y);
gtk_drag_begin (widget,
gdk_event_get_device ((GdkEvent*) event),
target_list, actions,
priv->drag_start_x + ranges[0],
priv->drag_start_y);
g_free (ranges);
priv->in_drag = FALSE;

View File

@ -6064,12 +6064,12 @@ gtk_icon_view_maybe_begin_drag (GtkIconView *icon_view,
retval = TRUE;
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);
drag = gtk_drag_begin (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 (drag, model, path);

View File

@ -4722,12 +4722,12 @@ gtk_label_drag_gesture_update (GtkGestureDrag *gesture,
g_signal_connect (widget, "drag-begin",
G_CALLBACK (drag_begin_cb), NULL);
gtk_drag_begin_with_coordinates (widget,
gtk_gesture_get_device (GTK_GESTURE (gesture)),
target_list,
GDK_ACTION_COPY,
info->drag_start_x,
info->drag_start_y);
gtk_drag_begin (widget,
gtk_gesture_get_device (GTK_GESTURE (gesture)),
target_list,
GDK_ACTION_COPY,
info->drag_start_x,
info->drag_start_y);
info->in_drag = FALSE;

View File

@ -2654,10 +2654,10 @@ gtk_notebook_motion (GtkEventController *controller,
{
priv->detached_tab = priv->cur_page;
gtk_drag_begin_with_coordinates (widget,
gtk_get_current_event_device (),
priv->source_targets, GDK_ACTION_MOVE,
priv->drag_begin_x, priv->drag_begin_y);
gtk_drag_begin (widget,
gtk_get_current_event_device (),
priv->source_targets, GDK_ACTION_MOVE,
priv->drag_begin_x, priv->drag_begin_y);
return;
}

View File

@ -3793,10 +3793,10 @@ on_row_dragged (GtkGestureDrag *gesture,
sidebar->dragging_over = TRUE;
gtk_drag_begin_with_coordinates (GTK_WIDGET (sidebar),
gtk_gesture_get_device (GTK_GESTURE (gesture)),
sidebar->source_targets, GDK_ACTION_MOVE,
drag_x, drag_y);
gtk_drag_begin (GTK_WIDGET (sidebar),
gtk_gesture_get_device (GTK_GESTURE (gesture)),
sidebar->source_targets, GDK_ACTION_MOVE,
drag_x, drag_y);
}
g_object_unref (sidebar);

View File

@ -7623,11 +7623,11 @@ gtk_text_view_start_selection_dnd (GtkTextView *text_view,
g_signal_connect (text_view, "drag-begin",
G_CALLBACK (drag_begin_cb), NULL);
gtk_drag_begin_with_coordinates (GTK_WIDGET (text_view),
gdk_event_get_device (event),
formats,
GDK_ACTION_COPY | GDK_ACTION_MOVE,
x, y);
gtk_drag_begin (GTK_WIDGET (text_view),
gdk_event_get_device (event),
formats,
GDK_ACTION_COPY | GDK_ACTION_MOVE,
x, y);
}
static void

View File

@ -7385,11 +7385,11 @@ 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);
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);
drag = gtk_drag_begin (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 (drag, model, path);