forked from AuroraMiddleware/gtk
dnd: Make drag-data-received use a GdkDrop
This commit is contained in:
parent
a862ca41c5
commit
6d7cb2b781
@ -150,9 +150,8 @@ drag_data_get (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data,
|
||||
guint32 time,
|
||||
gpointer data)
|
||||
{
|
||||
if (gtk_selection_data_get_length (selection_data) > 0)
|
||||
|
@ -312,9 +312,8 @@ static void gtk_calendar_drag_data_get (GtkWidget *widget,
|
||||
GtkSelectionData *selection_data,
|
||||
guint time);
|
||||
static void gtk_calendar_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
guint time);
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data);
|
||||
static gboolean gtk_calendar_drag_motion (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
@ -2926,18 +2925,18 @@ gtk_calendar_drag_data_get (GtkWidget *widget,
|
||||
* since the data doesn’t result from a drop.
|
||||
*/
|
||||
static void
|
||||
set_status_pending (GdkDragContext *context,
|
||||
GdkDragAction suggested_action)
|
||||
set_status_pending (GdkDrop *drop,
|
||||
GdkDragAction suggested_action)
|
||||
{
|
||||
g_object_set_data (G_OBJECT (context),
|
||||
g_object_set_data (G_OBJECT (drop),
|
||||
I_("gtk-calendar-status-pending"),
|
||||
GINT_TO_POINTER (suggested_action));
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
get_status_pending (GdkDragContext *context)
|
||||
get_status_pending (GdkDrop *drop)
|
||||
{
|
||||
return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (context),
|
||||
return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (drop),
|
||||
"gtk-calendar-status-pending"));
|
||||
}
|
||||
|
||||
@ -2970,9 +2969,9 @@ gtk_calendar_drag_motion (GtkWidget *widget,
|
||||
target = gtk_drag_dest_find_target (widget, context, NULL);
|
||||
if (target == NULL || gdk_drag_context_get_suggested_action (context) == 0)
|
||||
gdk_drag_status (context, 0, time);
|
||||
else if (get_status_pending (context) == 0)
|
||||
else if (get_status_pending (GDK_DROP (context)) == 0)
|
||||
{
|
||||
set_status_pending (context, gdk_drag_context_get_suggested_action (context));
|
||||
set_status_pending (GDK_DROP (context), gdk_drag_context_get_suggested_action (context));
|
||||
gtk_drag_get_data (widget, context, target, time);
|
||||
}
|
||||
|
||||
@ -3002,9 +3001,8 @@ gtk_calendar_drag_drop (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_calendar_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
guint time)
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
||||
GtkCalendarPrivate *priv = calendar->priv;
|
||||
@ -3013,11 +3011,11 @@ gtk_calendar_drag_data_received (GtkWidget *widget,
|
||||
GDate *date;
|
||||
GdkDragAction suggested_action;
|
||||
|
||||
suggested_action = get_status_pending (context);
|
||||
suggested_action = get_status_pending (drop);
|
||||
|
||||
if (suggested_action)
|
||||
{
|
||||
set_status_pending (context, 0);
|
||||
set_status_pending (drop, 0);
|
||||
|
||||
/* We are getting this data due to a request in drag_motion,
|
||||
* rather than due to a request in drag_drop, so we are just
|
||||
@ -3038,7 +3036,7 @@ gtk_calendar_drag_data_received (GtkWidget *widget,
|
||||
else
|
||||
suggested_action = 0;
|
||||
|
||||
gdk_drag_status (context, suggested_action, time);
|
||||
gdk_drop_status (drop, suggested_action);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -3055,7 +3053,7 @@ gtk_calendar_drag_data_received (GtkWidget *widget,
|
||||
{
|
||||
g_warning ("Received invalid date data");
|
||||
g_date_free (date);
|
||||
gdk_drag_finish (context, FALSE, time);
|
||||
gdk_drop_finish (drop, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3064,7 +3062,7 @@ gtk_calendar_drag_data_received (GtkWidget *widget,
|
||||
year = g_date_get_year (date);
|
||||
g_date_free (date);
|
||||
|
||||
gdk_drag_finish (context, TRUE, time);
|
||||
gdk_drop_finish (drop, suggested_action);
|
||||
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (calendar));
|
||||
|
@ -120,11 +120,8 @@ static void gtk_color_button_drag_data_get (GtkWidget *widget,
|
||||
|
||||
/* target side drag signals */
|
||||
static void gtk_color_button_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data,
|
||||
guint32 time,
|
||||
GtkColorButton *button);
|
||||
|
||||
|
||||
@ -276,11 +273,8 @@ gtk_color_button_class_init (GtkColorButtonClass *klass)
|
||||
|
||||
static void
|
||||
gtk_color_button_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data,
|
||||
guint32 time,
|
||||
GtkColorButton *button)
|
||||
{
|
||||
GtkColorButtonPrivate *priv = gtk_color_button_get_instance_private (button);
|
||||
|
@ -208,9 +208,8 @@ swatch_drag_data_get (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
swatch_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
guint time)
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
gint length;
|
||||
guint16 *vals;
|
||||
|
@ -186,8 +186,7 @@ gtk_drag_get_data_finish (GtkDragGetData *data,
|
||||
g_signal_emit_by_name (data->widget,
|
||||
"drag-data-received",
|
||||
data->context,
|
||||
&sdata,
|
||||
data->time);
|
||||
&sdata);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -195,8 +194,7 @@ gtk_drag_get_data_finish (GtkDragGetData *data,
|
||||
g_signal_emit_by_name (data->widget,
|
||||
"drag-data-received",
|
||||
data->context,
|
||||
&sdata,
|
||||
data->time);
|
||||
&sdata);
|
||||
}
|
||||
|
||||
if (site && site->flags & GTK_DEST_DEFAULT_DROP)
|
||||
|
@ -449,9 +449,8 @@ static gboolean gtk_entry_drag_motion (GtkWidget *widget,
|
||||
static void gtk_entry_drag_leave (GtkWidget *widget,
|
||||
GdkDrop *drop);
|
||||
static void gtk_entry_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
guint time);
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data);
|
||||
static void gtk_entry_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
@ -8635,7 +8634,6 @@ gtk_entry_drag_motion (GtkWidget *widget,
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
GtkWidget *source_widget;
|
||||
GdkDragAction suggested_action;
|
||||
gint new_position, old_position;
|
||||
gint sel1, sel2;
|
||||
@ -8646,28 +8644,15 @@ gtk_entry_drag_motion (GtkWidget *widget,
|
||||
if (priv->editable &&
|
||||
gtk_drag_dest_find_target (widget, context, NULL) != NULL)
|
||||
{
|
||||
source_widget = gtk_drag_get_source_widget (context);
|
||||
suggested_action = gdk_drag_context_get_suggested_action (context);
|
||||
suggested_action = GDK_ACTION_COPY | GDK_ACTION_MOVE;
|
||||
|
||||
if (!gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &sel1, &sel2) ||
|
||||
new_position < sel1 || new_position > sel2)
|
||||
{
|
||||
if (source_widget == widget)
|
||||
{
|
||||
/* Default to MOVE, unless the user has
|
||||
* pressed ctrl or alt to affect available actions
|
||||
*/
|
||||
if ((gdk_drag_context_get_actions (context) & GDK_ACTION_MOVE) != 0)
|
||||
suggested_action = GDK_ACTION_MOVE;
|
||||
}
|
||||
|
||||
priv->dnd_position = new_position;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (source_widget == widget)
|
||||
suggested_action = 0; /* Can't drop in selection where drag started */
|
||||
|
||||
priv->dnd_position = -1;
|
||||
}
|
||||
}
|
||||
@ -8693,20 +8678,45 @@ gtk_entry_drag_motion (GtkWidget *widget,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
gtk_entry_get_action (GtkEntry *entry,
|
||||
GdkDrop *drop)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (entry);
|
||||
GdkDragContext *drag = gdk_drop_get_drag (drop);
|
||||
GtkWidget *source_widget = gtk_drag_get_source_widget (drag);
|
||||
GdkDragAction actions;
|
||||
|
||||
actions = gdk_drop_get_actions (drop);
|
||||
|
||||
if (source_widget == widget &&
|
||||
actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
if (actions & GDK_ACTION_COPY)
|
||||
return GDK_ACTION_COPY;
|
||||
|
||||
if (actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_entry_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
guint time)
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
GtkEditable *editable = GTK_EDITABLE (widget);
|
||||
GdkDragAction action;
|
||||
gchar *str;
|
||||
|
||||
str = (gchar *) gtk_selection_data_get_text (selection_data);
|
||||
action = gtk_entry_get_action (entry, drop);
|
||||
|
||||
if (str && priv->editable)
|
||||
if (action && str && priv->editable)
|
||||
{
|
||||
gint sel1, sel2;
|
||||
gint length = -1;
|
||||
@ -8728,12 +8738,12 @@ gtk_entry_drag_data_received (GtkWidget *widget,
|
||||
end_change (entry);
|
||||
}
|
||||
|
||||
gdk_drag_finish (context, TRUE, time);
|
||||
gdk_drop_finish (drop, action);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Drag and drop didn't happen! */
|
||||
gdk_drag_finish (context, FALSE, time);
|
||||
gdk_drop_finish (drop, 0);
|
||||
}
|
||||
|
||||
g_free (str);
|
||||
|
@ -252,9 +252,8 @@ static void gtk_file_chooser_button_finalize (GObject *ob
|
||||
/* GtkWidget Functions */
|
||||
static void gtk_file_chooser_button_destroy (GtkWidget *widget);
|
||||
static void gtk_file_chooser_button_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *data,
|
||||
guint drag_time);
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *data);
|
||||
static void gtk_file_chooser_button_show (GtkWidget *widget);
|
||||
static void gtk_file_chooser_button_hide (GtkWidget *widget);
|
||||
static void gtk_file_chooser_button_map (GtkWidget *widget);
|
||||
@ -1199,9 +1198,8 @@ dnd_select_folder_get_info_cb (GCancellable *cancellable,
|
||||
|
||||
static void
|
||||
gtk_file_chooser_button_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *data,
|
||||
guint drag_time)
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *data)
|
||||
{
|
||||
GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (widget);
|
||||
GtkFileChooserButtonPrivate *priv = gtk_file_chooser_button_get_instance_private (button);
|
||||
@ -1210,11 +1208,10 @@ gtk_file_chooser_button_drag_data_received (GtkWidget *widget,
|
||||
|
||||
if (GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->drag_data_received != NULL)
|
||||
GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->drag_data_received (widget,
|
||||
context,
|
||||
data,
|
||||
drag_time);
|
||||
drop,
|
||||
data);
|
||||
|
||||
if (widget == NULL || context == NULL || data == NULL || gtk_selection_data_get_length (data) < 0)
|
||||
if (widget == NULL || gtk_selection_data_get_length (data) < 0)
|
||||
return;
|
||||
|
||||
if (gtk_selection_data_targets_include_uri (data))
|
||||
@ -1255,7 +1252,7 @@ gtk_file_chooser_button_drag_data_received (GtkWidget *widget,
|
||||
g_signal_emit (button, file_chooser_button_signals[FILE_SET], 0);
|
||||
}
|
||||
|
||||
gdk_drag_finish (context, TRUE, drag_time);
|
||||
gdk_drop_finish (drop, GDK_ACTION_COPY);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1932,9 +1932,8 @@ out:
|
||||
|
||||
static void
|
||||
file_list_drag_data_received_cb (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data,
|
||||
guint time_,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (user_data);
|
||||
@ -1944,12 +1943,14 @@ file_list_drag_data_received_cb (GtkWidget *widget,
|
||||
GFile *file;
|
||||
|
||||
/* Allow only drags from other widgets; see bug #533891. */
|
||||
if (gtk_drag_get_source_widget (context) == widget)
|
||||
if (gdk_drop_get_drag (drop) &&
|
||||
gtk_drag_get_source_widget (gdk_drop_get_drag (drop)) == widget)
|
||||
{
|
||||
g_signal_stop_emission_by_name (widget, "drag-data-received");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Parse the text/uri-list string, navigate to the first one */
|
||||
uris = gtk_selection_data_get_uris (selection_data);
|
||||
if (uris && uris[0])
|
||||
|
@ -301,9 +301,8 @@ static gboolean gtk_icon_view_drag_drop (GtkWidget *widget,
|
||||
gint y,
|
||||
guint time);
|
||||
static void gtk_icon_view_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
guint time);
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data);
|
||||
static gboolean gtk_icon_view_maybe_begin_drag (GtkIconView *icon_view,
|
||||
double x,
|
||||
double y,
|
||||
@ -5680,18 +5679,18 @@ gtk_icon_view_get_item_padding (GtkIconView *icon_view)
|
||||
* since the data doesn’t result from a drop.
|
||||
*/
|
||||
static void
|
||||
set_status_pending (GdkDragContext *context,
|
||||
set_status_pending (GdkDrop *drop,
|
||||
GdkDragAction suggested_action)
|
||||
{
|
||||
g_object_set_data (G_OBJECT (context),
|
||||
g_object_set_data (G_OBJECT (drop),
|
||||
I_("gtk-icon-view-status-pending"),
|
||||
GINT_TO_POINTER (suggested_action));
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
get_status_pending (GdkDragContext *context)
|
||||
get_status_pending (GdkDrop *drop)
|
||||
{
|
||||
return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (context),
|
||||
return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (drop),
|
||||
"gtk-icon-view-status-pending"));
|
||||
}
|
||||
|
||||
@ -5751,7 +5750,7 @@ dest_row_free (gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
set_dest_row (GdkDragContext *context,
|
||||
set_dest_row (GdkDrop *drop,
|
||||
GtkTreeModel *model,
|
||||
GtkTreePath *dest_row,
|
||||
gboolean empty_view_drop,
|
||||
@ -5761,7 +5760,7 @@ set_dest_row (GdkDragContext *context,
|
||||
|
||||
if (!dest_row)
|
||||
{
|
||||
g_object_set_data_full (G_OBJECT (context),
|
||||
g_object_set_data_full (G_OBJECT (drop),
|
||||
I_("gtk-icon-view-dest-row"),
|
||||
NULL, NULL);
|
||||
return;
|
||||
@ -5772,17 +5771,17 @@ set_dest_row (GdkDragContext *context,
|
||||
dr->dest_row = gtk_tree_row_reference_new (model, dest_row);
|
||||
dr->empty_view_drop = empty_view_drop;
|
||||
dr->drop_append_mode = drop_append_mode;
|
||||
g_object_set_data_full (G_OBJECT (context),
|
||||
g_object_set_data_full (G_OBJECT (drop),
|
||||
I_("gtk-icon-view-dest-row"),
|
||||
dr, (GDestroyNotify) dest_row_free);
|
||||
}
|
||||
|
||||
static GtkTreePath*
|
||||
get_dest_row (GdkDragContext *context)
|
||||
get_dest_row (GdkDrop *drop)
|
||||
{
|
||||
DestRow *dr;
|
||||
|
||||
dr = g_object_get_data (G_OBJECT (context), "gtk-icon-view-dest-row");
|
||||
dr = g_object_get_data (G_OBJECT (drop), "gtk-icon-view-dest-row");
|
||||
|
||||
if (dr)
|
||||
{
|
||||
@ -6277,12 +6276,12 @@ gtk_icon_view_drag_motion (GtkWidget *widget,
|
||||
/* Request data so we can use the source row when
|
||||
* determining whether to accept the drop
|
||||
*/
|
||||
set_status_pending (context, suggested_action);
|
||||
set_status_pending (GDK_DROP (context), suggested_action);
|
||||
gtk_drag_get_data (widget, context, target, time);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_status_pending (context, 0);
|
||||
set_status_pending (GDK_DROP (context), 0);
|
||||
gdk_drag_status (context, suggested_action, time);
|
||||
}
|
||||
}
|
||||
@ -6328,8 +6327,8 @@ gtk_icon_view_drag_drop (GtkWidget *widget,
|
||||
/* in case a motion had requested drag data, change things so we
|
||||
* treat drag data receives as a drop.
|
||||
*/
|
||||
set_status_pending (context, 0);
|
||||
set_dest_row (context, model, path,
|
||||
set_status_pending (GDK_DROP (context), 0);
|
||||
set_dest_row (GDK_DROP (context), model, path,
|
||||
icon_view->priv->empty_view_drop, drop_append_mode);
|
||||
}
|
||||
|
||||
@ -6350,9 +6349,8 @@ gtk_icon_view_drag_drop (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_icon_view_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
guint time)
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
gboolean accepted = FALSE;
|
||||
@ -6371,7 +6369,7 @@ gtk_icon_view_drag_data_received (GtkWidget *widget,
|
||||
if (!icon_view->priv->dest_set)
|
||||
return;
|
||||
|
||||
suggested_action = get_status_pending (context);
|
||||
suggested_action = get_status_pending (drop);
|
||||
|
||||
if (suggested_action)
|
||||
{
|
||||
@ -6393,7 +6391,7 @@ gtk_icon_view_drag_data_received (GtkWidget *widget,
|
||||
suggested_action = 0;
|
||||
}
|
||||
|
||||
gdk_drag_status (context, suggested_action, time);
|
||||
gdk_drop_status (drop, suggested_action);
|
||||
|
||||
if (path)
|
||||
gtk_tree_path_free (path);
|
||||
@ -6407,7 +6405,7 @@ gtk_icon_view_drag_data_received (GtkWidget *widget,
|
||||
}
|
||||
|
||||
|
||||
dest_row = get_dest_row (context);
|
||||
dest_row = get_dest_row (drop);
|
||||
|
||||
if (dest_row == NULL)
|
||||
return;
|
||||
@ -6420,14 +6418,12 @@ gtk_icon_view_drag_data_received (GtkWidget *widget,
|
||||
accepted = TRUE;
|
||||
}
|
||||
|
||||
gdk_drag_finish (context,
|
||||
accepted,
|
||||
time);
|
||||
gdk_drop_finish (drop, accepted ? suggested_action : 0);
|
||||
|
||||
gtk_tree_path_free (dest_row);
|
||||
|
||||
/* drop dest_row */
|
||||
set_dest_row (context, NULL, NULL, FALSE, FALSE);
|
||||
set_dest_row (drop, NULL, NULL, FALSE, FALSE);
|
||||
}
|
||||
|
||||
/* Drag-and-Drop support */
|
||||
|
@ -73,6 +73,7 @@ VOID:INT,INT
|
||||
VOID:INT,INT,BOXED
|
||||
VOID:INT,INT,INT
|
||||
VOID:OBJECT,BOOLEAN
|
||||
VOID:OBJECT,BOXED
|
||||
VOID:OBJECT,BOXED,BOXED
|
||||
VOID:OBJECT,BOXED,UINT
|
||||
VOID:OBJECT,BOXED,BOOLEAN,BOOLEAN
|
||||
|
@ -408,9 +408,8 @@ static void gtk_notebook_drag_data_get (GtkWidget *widget,
|
||||
GtkSelectionData *data,
|
||||
guint time);
|
||||
static void gtk_notebook_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *data,
|
||||
guint time);
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *data);
|
||||
|
||||
/*** GtkContainer Methods ***/
|
||||
static void gtk_notebook_set_child_property (GtkContainer *container,
|
||||
@ -3246,27 +3245,29 @@ gtk_notebook_drag_data_get (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_notebook_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *data,
|
||||
guint time)
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *data)
|
||||
{
|
||||
GtkNotebook *notebook;
|
||||
GdkDragContext *drag;
|
||||
GtkWidget *source_widget;
|
||||
GtkWidget **child;
|
||||
|
||||
notebook = GTK_NOTEBOOK (widget);
|
||||
source_widget = gtk_drag_get_source_widget (context);
|
||||
drag = gdk_drop_get_drag (drop);
|
||||
source_widget = gtk_drag_get_source_widget (drag);
|
||||
|
||||
if (source_widget &&
|
||||
(gdk_drop_get_actions (drop) & GDK_ACTION_MOVE) &&
|
||||
gtk_selection_data_get_target (data) == g_intern_static_string ("GTK_NOTEBOOK_TAB"))
|
||||
{
|
||||
child = (void*) gtk_selection_data_get_data (data);
|
||||
|
||||
do_detach_tab (GTK_NOTEBOOK (source_widget), notebook, *child);
|
||||
gdk_drag_finish (context, TRUE, time);
|
||||
gdk_drop_finish (drop, GDK_ACTION_MOVE);
|
||||
}
|
||||
else
|
||||
gdk_drag_finish (context, FALSE, time);
|
||||
gdk_drop_finish (drop, 0);
|
||||
}
|
||||
|
||||
/* Private GtkContainer Methods :
|
||||
|
@ -1621,6 +1621,7 @@ update_possible_drop_targets (GtkPlacesSidebar *sidebar,
|
||||
static gboolean
|
||||
get_drag_data (GtkWidget *list_box,
|
||||
GdkDragContext *context,
|
||||
GtkListBoxRow *row,
|
||||
guint time)
|
||||
{
|
||||
GdkAtom target;
|
||||
@ -1630,6 +1631,8 @@ get_drag_data (GtkWidget *list_box,
|
||||
if (target == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (row)
|
||||
g_object_set_data_full (G_OBJECT (context), "places-sidebar-row", g_object_ref (row), g_object_unref);
|
||||
gtk_drag_get_data (list_box, context, target, time);
|
||||
|
||||
return TRUE;
|
||||
@ -1787,7 +1790,7 @@ drag_motion_callback (GtkWidget *widget,
|
||||
|
||||
/* Nothing to do if no drag data */
|
||||
if (!sidebar->drag_data_received &&
|
||||
!get_drag_data (sidebar->list_box, context, time))
|
||||
!get_drag_data (sidebar->list_box, context, row, time))
|
||||
goto out;
|
||||
|
||||
/* Nothing to do if the target is not valid drop destination */
|
||||
@ -1982,20 +1985,17 @@ drag_data_get_callback (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
drag_data_received_callback (GtkWidget *list_box,
|
||||
GdkDragContext *context,
|
||||
int x,
|
||||
int y,
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data,
|
||||
guint time,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint target_order_index;
|
||||
GtkPlacesSidebarPlaceType target_place_type;
|
||||
GtkPlacesSidebarSectionType target_section_type;
|
||||
gchar *target_uri;
|
||||
gboolean success;
|
||||
GtkPlacesSidebar *sidebar = GTK_PLACES_SIDEBAR (user_data);
|
||||
GtkListBoxRow *target_row;
|
||||
GdkDragAction real_action;
|
||||
|
||||
if (!sidebar->drag_data_received)
|
||||
{
|
||||
@ -2025,8 +2025,7 @@ drag_data_received_callback (GtkWidget *list_box,
|
||||
if (!sidebar->drop_occurred)
|
||||
return;
|
||||
|
||||
target_row = gtk_list_box_get_row_at_y (GTK_LIST_BOX (sidebar->list_box), y);
|
||||
|
||||
target_row = g_object_get_data (G_OBJECT (drop), "places-sidebar-row");
|
||||
if (target_row == NULL)
|
||||
return;
|
||||
|
||||
@ -2037,9 +2036,9 @@ drag_data_received_callback (GtkWidget *list_box,
|
||||
"uri", &target_uri,
|
||||
NULL);
|
||||
|
||||
success = FALSE;
|
||||
real_action = 0;
|
||||
|
||||
if (!check_valid_drop_target (sidebar, GTK_SIDEBAR_ROW (target_row), GDK_DROP (context)))
|
||||
if (!check_valid_drop_target (sidebar, GTK_SIDEBAR_ROW (target_row), drop))
|
||||
goto out;
|
||||
|
||||
if (sidebar->drag_data_info == DND_GTK_SIDEBAR_ROW)
|
||||
@ -2052,20 +2051,19 @@ drag_data_received_callback (GtkWidget *list_box,
|
||||
source_row = (void*) gtk_selection_data_get_data (selection_data);
|
||||
|
||||
reorder_bookmarks (sidebar, GTK_SIDEBAR_ROW (*source_row), target_order_index);
|
||||
success = TRUE;
|
||||
real_action = GDK_ACTION_MOVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Dropping URIs! */
|
||||
GdkDragAction real_action;
|
||||
gchar **uris;
|
||||
GList *source_file_list;
|
||||
|
||||
/* file transfer requested */
|
||||
real_action = gdk_drag_context_get_selected_action (context);
|
||||
real_action = gdk_drop_get_actions (drop);
|
||||
|
||||
if (real_action == GDK_ACTION_ASK)
|
||||
real_action = emit_drag_action_ask (sidebar, gdk_drag_context_get_actions (context));
|
||||
if (!gdk_drag_action_is_unique (real_action))
|
||||
real_action = emit_drag_action_ask (sidebar, real_action);
|
||||
|
||||
if (real_action > 0)
|
||||
{
|
||||
@ -2087,7 +2085,6 @@ drag_data_received_callback (GtkWidget *list_box,
|
||||
g_object_unref (dest_file);
|
||||
}
|
||||
|
||||
success = TRUE;
|
||||
g_list_free_full (source_file_list, g_object_unref);
|
||||
g_strfreev (uris);
|
||||
}
|
||||
@ -2095,7 +2092,8 @@ drag_data_received_callback (GtkWidget *list_box,
|
||||
|
||||
out:
|
||||
sidebar->drop_occurred = FALSE;
|
||||
gdk_drag_finish (context, success, time);
|
||||
g_object_set_data (G_OBJECT (drop), "places-sidebar-row", NULL);
|
||||
gdk_drop_finish (drop, real_action);
|
||||
stop_drop_feedback (sidebar);
|
||||
g_free (target_uri);
|
||||
}
|
||||
@ -2155,9 +2153,11 @@ drag_drop_callback (GtkWidget *list_box,
|
||||
{
|
||||
gboolean retval = FALSE;
|
||||
GtkPlacesSidebar *sidebar = GTK_PLACES_SIDEBAR (user_data);
|
||||
GtkListBoxRow *row;
|
||||
|
||||
row = gtk_list_box_get_row_at_y (GTK_LIST_BOX (sidebar->list_box), y);
|
||||
sidebar->drop_occurred = TRUE;
|
||||
retval = get_drag_data (sidebar->list_box, context, time);
|
||||
retval = get_drag_data (sidebar->list_box, context, row, time);
|
||||
g_signal_stop_emission_by_name (sidebar->list_box, "drag-drop");
|
||||
|
||||
return retval;
|
||||
|
@ -441,9 +441,8 @@ static gboolean gtk_text_view_drag_drop (GtkWidget *widget,
|
||||
gint y,
|
||||
guint time);
|
||||
static void gtk_text_view_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
guint time);
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data);
|
||||
|
||||
static gboolean gtk_text_view_popup_menu (GtkWidget *widget);
|
||||
|
||||
@ -7733,7 +7732,7 @@ gtk_text_view_drag_motion (GtkWidget *widget,
|
||||
GdkRectangle target_rect;
|
||||
gint bx, by;
|
||||
GdkAtom target;
|
||||
GdkDragAction suggested_action = 0;
|
||||
gboolean can_accept = FALSE;
|
||||
|
||||
text_view = GTK_TEXT_VIEW (widget);
|
||||
priv = text_view->priv;
|
||||
@ -7771,33 +7770,13 @@ gtk_text_view_drag_motion (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gtk_text_iter_can_insert (&newplace, priv->editable))
|
||||
{
|
||||
GtkWidget *source_widget;
|
||||
|
||||
suggested_action = gdk_drag_context_get_suggested_action (context);
|
||||
|
||||
source_widget = gtk_drag_get_source_widget (context);
|
||||
|
||||
if (source_widget == widget)
|
||||
{
|
||||
/* Default to MOVE, unless the user has
|
||||
* pressed ctrl or alt to affect available actions
|
||||
*/
|
||||
if ((gdk_drag_context_get_actions (context) & GDK_ACTION_MOVE) != 0)
|
||||
suggested_action = GDK_ACTION_MOVE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Can't drop here. */
|
||||
}
|
||||
can_accept = gtk_text_iter_can_insert (&newplace, priv->editable);
|
||||
}
|
||||
|
||||
if (suggested_action != 0)
|
||||
if (can_accept)
|
||||
{
|
||||
gtk_text_mark_set_visible (priv->dnd_mark, cursor_visible (text_view));
|
||||
gdk_drag_status (context, suggested_action, time);
|
||||
gdk_drag_status (context, GDK_ACTION_COPY | GDK_ACTION_MOVE, time);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -7884,17 +7863,39 @@ insert_text_data (GtkTextView *text_view,
|
||||
}
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
gtk_text_view_get_action (GtkWidget *textview,
|
||||
GdkDrop *drop)
|
||||
{
|
||||
GdkDragContext *drag = gdk_drop_get_drag (drop);
|
||||
GtkWidget *source_widget = gtk_drag_get_source_widget (drag);
|
||||
GdkDragAction actions;
|
||||
|
||||
actions = gdk_drop_get_actions (drop);
|
||||
|
||||
if (source_widget == textview &&
|
||||
actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
if (actions & GDK_ACTION_COPY)
|
||||
return GDK_ACTION_COPY;
|
||||
|
||||
if (actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
guint time)
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkTextIter drop_point;
|
||||
GtkTextView *text_view;
|
||||
GtkTextViewPrivate *priv;
|
||||
gboolean success = FALSE;
|
||||
GtkTextBuffer *buffer = NULL;
|
||||
GdkDragAction action = 0;
|
||||
|
||||
text_view = GTK_TEXT_VIEW (widget);
|
||||
priv = text_view->priv;
|
||||
@ -7911,7 +7912,9 @@ gtk_text_view_drag_data_received (GtkWidget *widget,
|
||||
if (!gtk_text_iter_can_insert (&drop_point, priv->editable))
|
||||
goto done;
|
||||
|
||||
success = TRUE;
|
||||
action = gtk_text_view_get_action (widget, drop);
|
||||
if (action == 0)
|
||||
goto done;
|
||||
|
||||
gtk_text_buffer_begin_user_action (buffer);
|
||||
|
||||
@ -7963,9 +7966,9 @@ gtk_text_view_drag_data_received (GtkWidget *widget,
|
||||
insert_text_data (text_view, &drop_point, selection_data);
|
||||
|
||||
done:
|
||||
gdk_drag_finish (context, success, time);
|
||||
gdk_drop_finish (drop, action);
|
||||
|
||||
if (success)
|
||||
if (action)
|
||||
{
|
||||
gtk_text_buffer_get_iter_at_mark (buffer,
|
||||
&drop_point,
|
||||
|
@ -642,9 +642,8 @@ static gboolean gtk_tree_view_drag_drop (GtkWidget *widget,
|
||||
gint y,
|
||||
guint time);
|
||||
static void gtk_tree_view_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
guint time);
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data);
|
||||
|
||||
/* tree_model signals */
|
||||
static gboolean gtk_tree_view_real_move_cursor (GtkTreeView *tree_view,
|
||||
@ -6862,18 +6861,18 @@ dest_row_free (gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
set_dest_row (GdkDragContext *context,
|
||||
GtkTreeModel *model,
|
||||
GtkTreePath *dest_row,
|
||||
gboolean path_down_mode,
|
||||
gboolean empty_view_drop,
|
||||
gboolean drop_append_mode)
|
||||
set_dest_row (GdkDrop *drop,
|
||||
GtkTreeModel *model,
|
||||
GtkTreePath *dest_row,
|
||||
gboolean path_down_mode,
|
||||
gboolean empty_view_drop,
|
||||
gboolean drop_append_mode)
|
||||
{
|
||||
DestRow *dr;
|
||||
|
||||
if (!dest_row)
|
||||
{
|
||||
g_object_set_data_full (G_OBJECT (context), I_("gtk-tree-view-dest-row"),
|
||||
g_object_set_data_full (G_OBJECT (drop), I_("gtk-tree-view-dest-row"),
|
||||
NULL, NULL);
|
||||
return;
|
||||
}
|
||||
@ -6885,16 +6884,16 @@ set_dest_row (GdkDragContext *context,
|
||||
dr->empty_view_drop = empty_view_drop != FALSE;
|
||||
dr->drop_append_mode = drop_append_mode != FALSE;
|
||||
|
||||
g_object_set_data_full (G_OBJECT (context), I_("gtk-tree-view-dest-row"),
|
||||
g_object_set_data_full (G_OBJECT (drop), I_("gtk-tree-view-dest-row"),
|
||||
dr, (GDestroyNotify) dest_row_free);
|
||||
}
|
||||
|
||||
static GtkTreePath*
|
||||
get_dest_row (GdkDragContext *context,
|
||||
gboolean *path_down_mode)
|
||||
get_dest_row (GdkDrop *drop,
|
||||
gboolean *path_down_mode)
|
||||
{
|
||||
DestRow *dr =
|
||||
g_object_get_data (G_OBJECT (context), "gtk-tree-view-dest-row");
|
||||
g_object_get_data (G_OBJECT (drop), "gtk-tree-view-dest-row");
|
||||
|
||||
if (dr)
|
||||
{
|
||||
@ -6924,18 +6923,18 @@ get_dest_row (GdkDragContext *context,
|
||||
* since the data doesn’t result from a drop.
|
||||
*/
|
||||
static void
|
||||
set_status_pending (GdkDragContext *context,
|
||||
GdkDragAction suggested_action)
|
||||
set_status_pending (GdkDrop *drop,
|
||||
GdkDragAction suggested_action)
|
||||
{
|
||||
g_object_set_data (G_OBJECT (context),
|
||||
g_object_set_data (G_OBJECT (drop),
|
||||
I_("gtk-tree-view-status-pending"),
|
||||
GINT_TO_POINTER (suggested_action));
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
get_status_pending (GdkDragContext *context)
|
||||
get_status_pending (GdkDrop *drop)
|
||||
{
|
||||
return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (context),
|
||||
return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (drop),
|
||||
"gtk-tree-view-status-pending"));
|
||||
}
|
||||
|
||||
@ -7237,19 +7236,7 @@ set_destination_row (GtkTreeView *tree_view,
|
||||
out:
|
||||
if (can_drop)
|
||||
{
|
||||
GtkWidget *source_widget;
|
||||
|
||||
*suggested_action = gdk_drag_context_get_suggested_action (context);
|
||||
source_widget = gtk_drag_get_source_widget (context);
|
||||
|
||||
if (source_widget == widget)
|
||||
{
|
||||
/* Default to MOVE, unless the user has
|
||||
* pressed ctrl or shift to affect available actions
|
||||
*/
|
||||
if ((gdk_drag_context_get_actions (context) & GDK_ACTION_MOVE) != 0)
|
||||
*suggested_action = GDK_ACTION_MOVE;
|
||||
}
|
||||
*suggested_action = GDK_ACTION_COPY | GDK_ACTION_MOVE;
|
||||
|
||||
gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget),
|
||||
path, pos);
|
||||
@ -7605,12 +7592,12 @@ gtk_tree_view_drag_motion (GtkWidget *widget,
|
||||
/* Request data so we can use the source row when
|
||||
* determining whether to accept the drop
|
||||
*/
|
||||
set_status_pending (context, suggested_action);
|
||||
set_status_pending (GDK_DROP (context), suggested_action);
|
||||
gtk_drag_get_data (widget, context, target, time);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_status_pending (context, 0);
|
||||
set_status_pending (GDK_DROP (context), 0);
|
||||
gdk_drag_status (context, suggested_action, time);
|
||||
}
|
||||
}
|
||||
@ -7664,8 +7651,8 @@ gtk_tree_view_drag_drop (GtkWidget *widget,
|
||||
/* in case a motion had requested drag data, change things so we
|
||||
* treat drag data receives as a drop.
|
||||
*/
|
||||
set_status_pending (context, 0);
|
||||
set_dest_row (context, model, path,
|
||||
set_status_pending (GDK_DROP (context), 0);
|
||||
set_dest_row (GDK_DROP (context), model, path,
|
||||
path_down_mode, tree_view->priv->empty_view_drop,
|
||||
drop_append_mode);
|
||||
}
|
||||
@ -7687,15 +7674,36 @@ gtk_tree_view_drag_drop (GtkWidget *widget,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GdkDragAction
|
||||
gtk_tree_view_get_action (GtkWidget *treeview,
|
||||
GdkDrop *drop)
|
||||
{
|
||||
GdkDragContext *drag = gdk_drop_get_drag (drop);
|
||||
GtkWidget *source_widget = gtk_drag_get_source_widget (drag);
|
||||
GdkDragAction actions;
|
||||
|
||||
actions = gdk_drop_get_actions (drop);
|
||||
|
||||
if (source_widget == treeview &&
|
||||
actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
if (actions & GDK_ACTION_COPY)
|
||||
return GDK_ACTION_COPY;
|
||||
|
||||
if (actions & GDK_ACTION_MOVE)
|
||||
return GDK_ACTION_MOVE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_view_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
guint time)
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
TreeViewDragInfo *di;
|
||||
gboolean accepted = FALSE;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeView *tree_view;
|
||||
GtkTreePath *dest_row;
|
||||
@ -7715,7 +7723,7 @@ gtk_tree_view_drag_data_received (GtkWidget *widget,
|
||||
if (di == NULL)
|
||||
return;
|
||||
|
||||
suggested_action = get_status_pending (context);
|
||||
suggested_action = get_status_pending (drop);
|
||||
|
||||
if (suggested_action)
|
||||
{
|
||||
@ -7753,7 +7761,7 @@ gtk_tree_view_drag_data_received (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
gdk_drag_status (context, suggested_action, time);
|
||||
gdk_drop_status (drop, suggested_action);
|
||||
|
||||
if (path)
|
||||
gtk_tree_path_free (path);
|
||||
@ -7767,7 +7775,7 @@ gtk_tree_view_drag_data_received (GtkWidget *widget,
|
||||
return;
|
||||
}
|
||||
|
||||
dest_row = get_dest_row (context, &path_down_mode);
|
||||
dest_row = get_dest_row (drop, &path_down_mode);
|
||||
|
||||
if (dest_row == NULL)
|
||||
return;
|
||||
@ -7785,13 +7793,16 @@ gtk_tree_view_drag_data_received (GtkWidget *widget,
|
||||
|
||||
if (gtk_selection_data_get_length (selection_data) >= 0)
|
||||
{
|
||||
if (gtk_tree_drag_dest_drag_data_received (GTK_TREE_DRAG_DEST (model),
|
||||
dest_row,
|
||||
selection_data))
|
||||
accepted = TRUE;
|
||||
suggested_action = gtk_tree_view_get_action (widget, drop);
|
||||
|
||||
if (suggested_action &&
|
||||
!gtk_tree_drag_dest_drag_data_received (GTK_TREE_DRAG_DEST (model),
|
||||
dest_row,
|
||||
selection_data))
|
||||
suggested_action = 0;
|
||||
}
|
||||
|
||||
gdk_drag_finish (context, accepted, time);
|
||||
gdk_drop_finish (drop, suggested_action);
|
||||
|
||||
if (gtk_tree_path_get_depth (dest_row) == 1 &&
|
||||
gtk_tree_path_get_indices (dest_row)[0] == 0 &&
|
||||
@ -7805,11 +7816,10 @@ gtk_tree_view_drag_data_received (GtkWidget *widget,
|
||||
gtk_tree_path_free (dest_row);
|
||||
|
||||
/* drop dest_row */
|
||||
set_dest_row (context, NULL, NULL, FALSE, FALSE, FALSE);
|
||||
set_dest_row (drop, NULL, NULL, FALSE, FALSE, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* GtkContainer Methods
|
||||
*/
|
||||
|
||||
|
@ -2001,11 +2001,10 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
/**
|
||||
* GtkWidget::drag-data-received:
|
||||
* @widget: the object which received the signal
|
||||
* @context: the drag context
|
||||
* @drop: the #GdkDrop
|
||||
* @x: where the drop happened
|
||||
* @y: where the drop happened
|
||||
* @data: the received data
|
||||
* @time: the timestamp at which the data was received
|
||||
*
|
||||
* The ::drag-data-received signal is emitted on the drop site when the
|
||||
* dragged data has been received. If the data was received in order to
|
||||
@ -2027,12 +2026,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
* |[<!-- language="C" -->
|
||||
* void
|
||||
* drag_data_received (GtkWidget *widget,
|
||||
* GdkDragContext *context,
|
||||
* gint x,
|
||||
* gint y,
|
||||
* GtkSelectionData *data,
|
||||
* guint info,
|
||||
* guint time)
|
||||
* GdkDrop *drop,
|
||||
* GtkSelectionData *data)
|
||||
* {
|
||||
* if ((data->length >= 0) && (data->format == 8))
|
||||
* {
|
||||
@ -2040,8 +2035,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
*
|
||||
* // handle data here
|
||||
*
|
||||
* action = gdk_drag_context_get_selected_action (context);
|
||||
* if (action == GDK_ACTION_ASK)
|
||||
* action = gdk_drop_get_actions (drop);
|
||||
* if (!gdk_drag_action_is_unique (action))
|
||||
* {
|
||||
* GtkWidget *dialog;
|
||||
* gint response;
|
||||
@ -2061,10 +2056,10 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
* action = GDK_ACTION_COPY;
|
||||
* }
|
||||
*
|
||||
* gdk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
|
||||
* gdk_drop_finish (context, action);
|
||||
* }
|
||||
* else
|
||||
* gdk_drag_finish (context, FALSE, FALSE, time);
|
||||
* gdk_drop_finish (context, 0);
|
||||
* }
|
||||
* ]|
|
||||
*/
|
||||
@ -2074,11 +2069,10 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkWidgetClass, drag_data_received),
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__OBJECT_BOXED_UINT,
|
||||
G_TYPE_NONE, 3,
|
||||
GDK_TYPE_DRAG_CONTEXT,
|
||||
GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE,
|
||||
G_TYPE_UINT);
|
||||
_gtk_marshal_VOID__OBJECT_BOXED,
|
||||
G_TYPE_NONE, 2,
|
||||
GDK_TYPE_DROP,
|
||||
GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||
|
||||
/**
|
||||
* GtkWidget::query-tooltip:
|
||||
|
@ -318,9 +318,8 @@ struct _GtkWidgetClass
|
||||
gint y,
|
||||
guint time_);
|
||||
void (* drag_data_received) (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
guint time_);
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data);
|
||||
gboolean (* drag_failed) (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkDragResult result);
|
||||
|
@ -186,9 +186,8 @@ image_drag_data_get (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
image_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data,
|
||||
guint32 time,
|
||||
gpointer data)
|
||||
{
|
||||
gchar *text;
|
||||
|
@ -42,9 +42,8 @@ drag_data_get (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data,
|
||||
guint32 time,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *target;
|
||||
|
@ -122,9 +122,8 @@ remove_in_idle (gpointer data)
|
||||
|
||||
static void
|
||||
on_button_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *data,
|
||||
guint time,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget **child;
|
||||
|
@ -90,9 +90,8 @@ get_dragsource (void)
|
||||
|
||||
static void
|
||||
drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selda,
|
||||
guint time,
|
||||
gpointer dada)
|
||||
{
|
||||
gchar *text;
|
||||
|
Loading…
Reference in New Issue
Block a user