dnd: Remove button argument from drag_begin()

It was unused.
This commit is contained in:
Benjamin Otte 2017-12-11 22:26:26 +01:00
parent 1e4aeb2efb
commit 756b276070
12 changed files with 8 additions and 108 deletions

View File

@ -2667,7 +2667,6 @@ gtk_calendar_drag_update (GtkGestureDrag *gesture,
GdkContentFormats *targets;
GdkEventSequence *sequence;
GdkEvent *last_event;
guint button;
if (!priv->in_drag)
return;
@ -2680,13 +2679,12 @@ gtk_calendar_drag_update (GtkGestureDrag *gesture,
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
last_event = gdk_event_copy (gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence));
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
targets = gdk_content_formats_new (NULL, 0);
targets = gtk_content_formats_add_text_targets (targets);
context = gtk_drag_begin_with_coordinates (widget, targets, GDK_ACTION_COPY,
button, last_event,
last_event,
start_x, start_y);
priv->in_drag = 0;

View File

@ -94,11 +94,6 @@ typedef gboolean (* GtkDragDestCallback) (GtkWidget *widget,
guint32 time);
/* Forward declarations */
static void gtk_drag_get_event_actions (const GdkEvent *event,
gint button,
GdkDragAction actions,
GdkDragAction *suggested_action,
GdkDragAction *possible_actions);
static GtkWidget *gtk_drag_get_ipc_widget (GtkWidget *widget);
static GtkWidget *gtk_drag_get_ipc_widget_for_display(GdkDisplay*display);
static void gtk_drag_release_ipc_widget (GtkWidget *widget);
@ -247,81 +242,6 @@ gtk_drag_release_ipc_widget (GtkWidget *widget)
drag_widgets);
}
static void
gtk_drag_get_event_actions (const GdkEvent *event,
gint button,
GdkDragAction actions,
GdkDragAction *suggested_action,
GdkDragAction *possible_actions)
{
*suggested_action = 0;
*possible_actions = 0;
if (event)
{
GdkModifierType state = 0;
gdk_event_get_state (event, &state);
if ((button == GDK_BUTTON_MIDDLE || button == GDK_BUTTON_SECONDARY) && (actions & GDK_ACTION_ASK))
{
*suggested_action = GDK_ACTION_ASK;
*possible_actions = actions;
}
else if (state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK))
{
if ((state & GDK_SHIFT_MASK) && (state & GDK_CONTROL_MASK))
{
if (actions & GDK_ACTION_LINK)
{
*suggested_action = GDK_ACTION_LINK;
*possible_actions = GDK_ACTION_LINK;
}
}
else if (state & GDK_CONTROL_MASK)
{
if (actions & GDK_ACTION_COPY)
{
*suggested_action = GDK_ACTION_COPY;
*possible_actions = GDK_ACTION_COPY;
}
}
else
{
if (actions & GDK_ACTION_MOVE)
{
*suggested_action = GDK_ACTION_MOVE;
*possible_actions = GDK_ACTION_MOVE;
}
}
}
else
{
*possible_actions = actions;
if ((state & (GDK_MOD1_MASK)) && (actions & GDK_ACTION_ASK))
*suggested_action = GDK_ACTION_ASK;
else if (actions & GDK_ACTION_COPY)
*suggested_action = GDK_ACTION_COPY;
else if (actions & GDK_ACTION_MOVE)
*suggested_action = GDK_ACTION_MOVE;
else if (actions & GDK_ACTION_LINK)
*suggested_action = GDK_ACTION_LINK;
}
}
else
{
*possible_actions = actions;
if (actions & GDK_ACTION_COPY)
*suggested_action = GDK_ACTION_COPY;
else if (actions & GDK_ACTION_MOVE)
*suggested_action = GDK_ACTION_MOVE;
else if (actions & GDK_ACTION_LINK)
*suggested_action = GDK_ACTION_LINK;
}
}
/********************
* Destination side *
********************/
@ -1048,14 +968,12 @@ gtk_drag_begin_internal (GtkWidget *widget,
GtkImageDefinition *icon,
GdkContentFormats *target_list,
GdkDragAction actions,
gint button,
const GdkEvent *event,
int x,
int y)
{
GtkDragSourceInfo *info;
guint32 time = GDK_CURRENT_TIME;
GdkDragAction possible_actions, suggested_action;
GdkDragContext *context;
GtkWidget *ipc_widget;
GdkDevice *pointer;
@ -1065,9 +983,6 @@ gtk_drag_begin_internal (GtkWidget *widget,
ipc_widget = gtk_drag_get_ipc_widget (widget);
gtk_drag_get_event_actions (event, button, actions,
&suggested_action, &possible_actions);
if (event)
{
time = gdk_event_get_time (event);
@ -1208,7 +1123,6 @@ gtk_drag_begin_internal (GtkWidget *widget,
* @targets: The targets (data formats) in which the
* source can provide the data
* @actions: A bitmask of the allowed drag actions for this drag
* @button: The button the user clicked to start the drag
* @event: (nullable): The event that triggered the start of the drag,
* or %NULL if none can be obtained.
* @x: The initial x coordinate to start dragging from, in the coordinate space
@ -1252,7 +1166,6 @@ GdkDragContext *
gtk_drag_begin_with_coordinates (GtkWidget *widget,
GdkContentFormats *targets,
GdkDragAction actions,
gint button,
GdkEvent *event,
gint x,
gint y)
@ -1262,7 +1175,7 @@ gtk_drag_begin_with_coordinates (GtkWidget *widget,
g_return_val_if_fail (targets != NULL, NULL);
return gtk_drag_begin_internal (widget, NULL, targets,
actions, button, event, x, y);
actions, event, x, y);
}
static void

View File

@ -63,7 +63,6 @@ GDK_AVAILABLE_IN_3_10
GdkDragContext *gtk_drag_begin_with_coordinates (GtkWidget *widget,
GdkContentFormats *targets,
GdkDragAction actions,
gint button,
GdkEvent *event,
gint x,
gint y);

View File

@ -44,7 +44,6 @@ GdkDragContext * gtk_drag_begin_internal (GtkWidget
GtkImageDefinition *icon,
GdkContentFormats *target_list,
GdkDragAction actions,
gint button,
const GdkEvent *event,
int x,
int y);

View File

@ -87,16 +87,14 @@ gtk_drag_source_event_cb (GtkWidget *widget,
{
GdkEventSequence *sequence;
GdkEvent *last_event;
guint button;
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (site->drag_gesture));
last_event = gdk_event_copy (gtk_gesture_get_last_event (site->drag_gesture, sequence));
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (site->drag_gesture));
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (site->drag_gesture));
gtk_drag_begin_internal (widget, site->image_def, site->target_list,
site->actions, button, last_event,
site->actions, last_event,
start_x, start_y);
gdk_event_free (last_event);

View File

@ -3679,7 +3679,6 @@ gtk_entry_event (GtkWidget *widget,
gtk_drag_begin_with_coordinates (widget,
icon_info->target_list,
icon_info->actions,
1,
event,
priv->start_x,
priv->start_y);
@ -3998,15 +3997,13 @@ gtk_entry_drag_gesture_update (GtkGestureDrag *gesture,
gint n_ranges;
GdkContentFormats *target_list = gdk_content_formats_new (NULL, 0);
guint actions = priv->editable ? GDK_ACTION_COPY | GDK_ACTION_MOVE : GDK_ACTION_COPY;
guint button;
target_list = gtk_content_formats_add_text_targets (target_list);
gtk_entry_get_pixel_ranges (entry, &ranges, &n_ranges);
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
gtk_drag_begin_with_coordinates (widget, target_list, actions,
button, (GdkEvent*) event,
(GdkEvent*) event,
priv->drag_start_x + ranges[0],
priv->drag_start_y);
g_free (ranges);

View File

@ -6146,7 +6146,6 @@ gtk_icon_view_maybe_begin_drag (GtkIconView *icon_view,
GtkWidget *widget = GTK_WIDGET (icon_view);
GdkDragContext *context;
GtkTreePath *path = NULL;
gint button;
GtkTreeModel *model;
gboolean retval = FALSE;
gdouble x, y;
@ -6169,7 +6168,6 @@ gtk_icon_view_maybe_begin_drag (GtkIconView *icon_view,
if (model == NULL)
goto out;
button = icon_view->priv->pressed_button;
icon_view->priv->pressed_button = -1;
path = gtk_icon_view_get_path_at_pos (icon_view,
@ -6195,7 +6193,6 @@ gtk_icon_view_maybe_begin_drag (GtkIconView *icon_view,
context = gtk_drag_begin_with_coordinates (widget,
gtk_drag_source_get_target_list (widget),
icon_view->priv->source_actions,
button,
(GdkEvent*)event,
icon_view->priv->press_start_x,
icon_view->priv->press_start_y);

View File

@ -4778,7 +4778,7 @@ gtk_label_drag_gesture_update (GtkGestureDrag *gesture,
G_CALLBACK (drag_begin_cb), NULL);
gtk_drag_begin_with_coordinates (widget, target_list,
GDK_ACTION_COPY,
1, (GdkEvent*) event,
(GdkEvent*) event,
info->drag_start_x,
info->drag_start_y);

View File

@ -2713,7 +2713,7 @@ gtk_notebook_motion_notify (GtkWidget *widget,
priv->detached_tab = priv->cur_page;
gtk_drag_begin_with_coordinates (widget, priv->source_targets, GDK_ACTION_MOVE,
priv->pressed_button, (GdkEvent*) event,
(GdkEvent*) event,
priv->drag_begin_x, priv->drag_begin_y);
return TRUE;
}

View File

@ -1726,7 +1726,7 @@ on_motion_notify_event (GtkWidget *widget,
sidebar->dragging_over = TRUE;
gtk_drag_begin_with_coordinates (widget, sidebar->source_targets, GDK_ACTION_MOVE,
GDK_BUTTON_PRIMARY, (GdkEvent*)event,
(GdkEvent*)event,
-1, -1);
}

View File

@ -7821,7 +7821,7 @@ gtk_text_view_start_selection_dnd (GtkTextView *text_view,
G_CALLBACK (drag_begin_cb), NULL);
gtk_drag_begin_with_coordinates (GTK_WIDGET (text_view), formats,
GDK_ACTION_COPY | GDK_ACTION_MOVE,
1, (GdkEvent*) event, x, y);
(GdkEvent*) event, x, y);
}
static void

View File

@ -7485,7 +7485,6 @@ gtk_tree_view_maybe_begin_dragging_row (GtkTreeView *tree_view)
context = gtk_drag_begin_with_coordinates (widget,
gtk_drag_source_get_target_list (widget),
di->source_actions,
button,
(GdkEvent*)event,
start_x, start_y);