[gtk+] dnd: Remove button argument from drag_begin()



commit 756b276070679497937e5c62fe586e73d0e2e61e
Author: Benjamin Otte <otte redhat com>
Date:   Mon Dec 11 22:26:26 2017 +0100

    dnd: Remove button argument from drag_begin()
    
    It was unused.

 gtk/gtkcalendar.c      |    4 +--
 gtk/gtkdnd.c           |   89 +-----------------------------------------------
 gtk/gtkdnd.h           |    1 -
 gtk/gtkdndprivate.h    |    1 -
 gtk/gtkdragsource.c    |    4 +--
 gtk/gtkentry.c         |    5 +--
 gtk/gtkiconview.c      |    3 --
 gtk/gtklabel.c         |    2 +-
 gtk/gtknotebook.c      |    2 +-
 gtk/gtkplacessidebar.c |    2 +-
 gtk/gtktextview.c      |    2 +-
 gtk/gtktreeview.c      |    1 -
 12 files changed, 8 insertions(+), 108 deletions(-)
---
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index e7dc10c..f3e20a0 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -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;
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index 50ba608..246ace9 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -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
diff --git a/gtk/gtkdnd.h b/gtk/gtkdnd.h
index 6b9de95..82f2f78 100644
--- a/gtk/gtkdnd.h
+++ b/gtk/gtkdnd.h
@@ -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);
diff --git a/gtk/gtkdndprivate.h b/gtk/gtkdndprivate.h
index 9af7739..5bd6176 100644
--- a/gtk/gtkdndprivate.h
+++ b/gtk/gtkdndprivate.h
@@ -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);
diff --git a/gtk/gtkdragsource.c b/gtk/gtkdragsource.c
index 13f1c17..6fd0f82 100644
--- a/gtk/gtkdragsource.c
+++ b/gtk/gtkdragsource.c
@@ -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);
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 0ec3702..359496a 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -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);
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 771fdb5..8c248f8 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -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);
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index f66cefe..6c5165e 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -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);
 
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 494d20f..f9a1bfd 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -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;
     }
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index b15e7bf..56c392a 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -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);
     }
 
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index bf2480b..371f5f4 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -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
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 2e828d5..5cdc8a1 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]