[gtk+] dnd: Remove gdk_drag_get_selection()



commit b49a9b9933490dc717894fbef4cae0df0775453c
Author: Benjamin Otte <otte redhat com>
Date:   Thu Dec 14 04:34:33 2017 +0100

    dnd: Remove gdk_drag_get_selection()
    
    Without selections, drags can't have them either.
    
    Also included is removing the selection from GtkSelectionData.
    
    Includes a bunch of crude cleanups to Wayland code that no longer has to
    care about selection atoms.

 docs/reference/gdk/gdk4-sections.txt |    1 -
 docs/reference/gtk/gtk4-sections.txt |    1 -
 gdk/broadway/gdkdnd-broadway.c       |    9 ---
 gdk/gdkdnd.c                         |   16 -----
 gdk/gdkdnd.h                         |    2 -
 gdk/gdkdndprivate.h                  |    1 -
 gdk/quartz/gdkdnd-quartz.c           |    8 ---
 gdk/wayland/gdkdevice-wayland.c      |    7 +--
 gdk/wayland/gdkdnd-wayland.c         |   28 ++-------
 gdk/wayland/gdkprivate-wayland.h     |   14 ++---
 gdk/wayland/gdkselection-wayland.c   |  107 ++++++----------------------------
 gdk/win32/gdkdnd-win32.c             |    1 -
 gdk/x11/gdkdnd-x11.c                 |   15 +----
 gtk/gtkdnd.c                         |    2 -
 gtk/gtkselection.c                   |   18 ------
 gtk/gtkselection.h                   |    2 -
 gtk/gtkselectionprivate.h            |    1 -
 17 files changed, 33 insertions(+), 200 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index 04b333b..fd40deb 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -805,7 +805,6 @@ gdk_cursor_get_type
 <FILE>dnd</FILE>
 GdkDragContext
 GdkDragCancelReason
-gdk_drag_get_selection
 gdk_drop_reply
 gdk_drag_drop_done
 gdk_drag_begin
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 81bcf7a..bea54de 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -5200,7 +5200,6 @@ gtk_selection_data_get_targets
 gtk_selection_data_targets_include_image
 gtk_selection_data_targets_include_text
 gtk_selection_data_targets_include_uri
-gtk_selection_data_get_selection
 gtk_selection_data_get_data
 gtk_selection_data_get_length
 gtk_selection_data_get_data_with_length
diff --git a/gdk/broadway/gdkdnd-broadway.c b/gdk/broadway/gdkdnd-broadway.c
index 3747ca1..4c78b06 100644
--- a/gdk/broadway/gdkdnd-broadway.c
+++ b/gdk/broadway/gdkdnd-broadway.c
@@ -176,14 +176,6 @@ _gdk_broadway_window_register_dnd (GdkWindow      *window)
 {
 }
 
-static GdkAtom
-gdk_broadway_drag_context_get_selection (GdkDragContext *context)
-{
-  g_return_val_if_fail (context != NULL, NULL);
-
-  return NULL;
-}
-
 static gboolean
 gdk_broadway_drag_context_drop_status (GdkDragContext *context)
 {
@@ -213,5 +205,4 @@ gdk_broadway_drag_context_class_init (GdkBroadwayDragContextClass *klass)
   context_class->drop_reply = gdk_broadway_drag_context_drop_reply;
   context_class->drop_finish = gdk_broadway_drag_context_drop_finish;
   context_class->drop_status = gdk_broadway_drag_context_drop_status;
-  context_class->get_selection = gdk_broadway_drag_context_get_selection;
 }
diff --git a/gdk/gdkdnd.c b/gdk/gdkdnd.c
index e0e0c3e..44de31c 100644
--- a/gdk/gdkdnd.c
+++ b/gdk/gdkdnd.c
@@ -693,22 +693,6 @@ gdk_drag_drop_succeeded (GdkDragContext *context)
   return GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_status (context);
 }
 
-/**
- * gdk_drag_get_selection:
- * @context: a #GdkDragContext.
- *
- * Returns the selection atom for the current source window.
- *
- * Returns: (transfer none): the selection atom, or %NULL
- */
-GdkAtom
-gdk_drag_get_selection (GdkDragContext *context)
-{
-  g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
-
-  return GDK_DRAG_CONTEXT_GET_CLASS (context)->get_selection (context);
-}
-
 static void
 gdk_drag_context_write_done (GObject      *content,
                              GAsyncResult *result,
diff --git a/gdk/gdkdnd.h b/gdk/gdkdnd.h
index 8f75a7d..683b508 100644
--- a/gdk/gdkdnd.h
+++ b/gdk/gdkdnd.h
@@ -115,8 +115,6 @@ GDK_AVAILABLE_IN_ALL
 void             gdk_drop_finish        (GdkDragContext   *context,
                                          gboolean          success,
                                          guint32           time_);
-GDK_AVAILABLE_IN_ALL
-GdkAtom          gdk_drag_get_selection (GdkDragContext   *context);
 
 GDK_AVAILABLE_IN_3_94
 void                    gdk_drop_read_async             (GdkDragContext        *context,
diff --git a/gdk/gdkdndprivate.h b/gdk/gdkdndprivate.h
index 127b514..05f1043 100644
--- a/gdk/gdkdndprivate.h
+++ b/gdk/gdkdndprivate.h
@@ -65,7 +65,6 @@ struct _GdkDragContextClass {
                                 gint             x_root,
                                 gint             y_root,
                                 GdkDragProtocol *protocol);
-  GdkAtom     (*get_selection) (GdkDragContext  *context);
   gboolean    (*drag_motion)   (GdkDragContext  *context,
                                 GdkWindow       *dest_window,
                                 GdkDragProtocol  protocol,
diff --git a/gdk/quartz/gdkdnd-quartz.c b/gdk/quartz/gdkdnd-quartz.c
index 2143848..65412b0 100644
--- a/gdk/quartz/gdkdnd-quartz.c
+++ b/gdk/quartz/gdkdnd-quartz.c
@@ -126,13 +126,6 @@ _gdk_quartz_window_register_dnd (GdkWindow *window)
   /* FIXME: Implement */
 }
 
-static GdkAtom
-gdk_quartz_drag_context_get_selection (GdkDragContext *context)
-{
-  /* FIXME: Implement */
-  return NULL;
-}
-
 static gboolean
 gdk_quartz_drag_context_drop_status (GdkDragContext *context)
 {
@@ -173,5 +166,4 @@ gdk_quartz_drag_context_class_init (GdkQuartzDragContextClass *klass)
   context_class->drop_reply = gdk_quartz_drag_context_drop_reply;
   context_class->drop_finish = gdk_quartz_drag_context_drop_finish;
   context_class->drop_status = gdk_quartz_drag_context_drop_status;
-  context_class->get_selection = gdk_quartz_drag_context_get_selection;
 }
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 9d5b8d5..c170325 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -1080,7 +1080,6 @@ data_device_enter (void                  *data,
 {
   GdkWaylandSeat *seat = data;
   GdkWindow *dest_window, *dnd_owner;
-  GdkAtom selection;
 
   dest_window = wl_surface_get_user_data (surface);
 
@@ -1098,8 +1097,6 @@ data_device_enter (void                  *data,
 
   gdk_wayland_drop_context_update_targets (seat->drop_context);
 
-  selection = gdk_drag_get_selection (seat->drop_context);
-
   dnd_owner = seat->foreign_dnd_window;
 
   _gdk_wayland_drag_context_set_source_window (seat->drop_context, dnd_owner);
@@ -1112,9 +1109,7 @@ data_device_enter (void                  *data,
   _gdk_wayland_drag_context_emit_event (seat->drop_context, GDK_DRAG_ENTER,
                                         GDK_CURRENT_TIME);
 
-  gdk_wayland_selection_set_offer (seat->display, selection, offer);
-
-  /* emit_selection_owner_change (dest_window, selection); */
+  gdk_wayland_selection_set_offer (seat->display, offer);
 }
 
 static void
diff --git a/gdk/wayland/gdkdnd-wayland.c b/gdk/wayland/gdkdnd-wayland.c
index 05947c5..a7f0aa8 100644
--- a/gdk/wayland/gdkdnd-wayland.c
+++ b/gdk/wayland/gdkdnd-wayland.c
@@ -227,8 +227,7 @@ gdk_wayland_drop_context_set_status (GdkDragContext *context,
   context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
 
   display = gdk_device_get_display (gdk_drag_context_get_device (context));
-  wl_offer = gdk_wayland_selection_get_offer (display,
-                                              gdk_drag_get_selection (context));
+  wl_offer = gdk_wayland_selection_get_offer (display);
 
   if (!wl_offer)
     return;
@@ -300,11 +299,9 @@ gdk_wayland_drag_context_drop_finish (GdkDragContext *context,
   GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
   GdkWaylandDragContext *wayland_context;
   struct wl_data_offer *wl_offer;
-  GdkAtom selection;
 
   wayland_context = GDK_WAYLAND_DRAG_CONTEXT (context);
-  selection = gdk_drag_get_selection (context);
-  wl_offer = gdk_wayland_selection_get_offer (display, selection);
+  wl_offer = gdk_wayland_selection_get_offer (display);
 
   if (wl_offer && success && wayland_context->selected_action &&
       wayland_context->selected_action != GDK_ACTION_ASK)
@@ -316,7 +313,7 @@ gdk_wayland_drag_context_drop_finish (GdkDragContext *context,
         wl_data_offer_finish (wl_offer);
     }
 
-  gdk_wayland_selection_set_offer (display, selection, NULL);
+  gdk_wayland_selection_set_offer (display, NULL);
 }
 
 static void
@@ -344,8 +341,7 @@ gdk_wayland_drag_context_read_async (GdkDragContext      *context,
   GDK_NOTE (DND, char *s = gdk_content_formats_to_string (formats);
                  g_printerr ("%p: read for %s\n", context, s);
                  g_free (s); );
-  dnd_formats = gdk_wayland_selection_get_targets (display,
-                                                   gdk_drag_get_selection (context));                      
+  dnd_formats = gdk_wayland_selection_get_targets (display);
   mime_type = gdk_content_formats_match_mime_type (formats, dnd_formats);
   if (mime_type == NULL)
     {
@@ -354,8 +350,7 @@ gdk_wayland_drag_context_read_async (GdkDragContext      *context,
       return;
     }
   /* offer formats should be empty if we have no offer */
-  offer = gdk_wayland_selection_get_offer (display,
-                                           gdk_drag_get_selection (context));
+  offer = gdk_wayland_selection_get_offer (display);
   g_assert (offer);
 
   g_task_set_task_data (task, (gpointer) mime_type, NULL);
@@ -399,12 +394,6 @@ gdk_wayland_drag_context_drop_status (GdkDragContext *context)
   return FALSE;
 }
 
-static GdkAtom
-gdk_wayland_drag_context_get_selection (GdkDragContext *context)
-{
-  return gdk_atom_intern_static_string ("GdkWaylandSelection");
-}
-
 static void
 gdk_wayland_drag_context_init (GdkWaylandDragContext *context_wayland)
 {
@@ -510,7 +499,6 @@ gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
   context_class->read_async = gdk_wayland_drag_context_read_async;
   context_class->read_finish = gdk_wayland_drag_context_read_finish;
   context_class->drop_status = gdk_wayland_drag_context_drop_status;
-  context_class->get_selection = gdk_wayland_drag_context_get_selection;
   context_class->get_drag_window = gdk_wayland_drag_context_get_drag_window;
   context_class->set_hotspot = gdk_wayland_drag_context_set_hotspot;
   context_class->drop_done = gdk_wayland_drag_context_drop_done;
@@ -568,8 +556,7 @@ _gdk_wayland_window_drag_begin (GdkWindow          *window,
   context_wayland->dnd_window = create_dnd_window (gdk_window_get_display (window));
   context_wayland->dnd_surface = gdk_wayland_window_get_wl_surface (context_wayland->dnd_window);
   context_wayland->data_source =
-  gdk_wayland_selection_get_data_source (window,
-                                         gdk_wayland_drag_context_get_selection (context));
+  gdk_wayland_selection_get_data_source (window);
 
   mimetypes = gdk_content_formats_get_mime_types (context->formats, &n_mimetypes);
   for (i = 0; i < n_mimetypes; i++)
@@ -624,8 +611,7 @@ gdk_wayland_drop_context_update_targets (GdkDragContext *context)
   device = gdk_drag_context_get_device (context);
   display = gdk_device_get_display (device);
   gdk_content_formats_unref (context->formats);
-  context->formats = gdk_wayland_selection_get_targets (display,
-                                                        gdk_drag_get_selection (context));
+  context->formats = gdk_wayland_selection_get_targets (display);
   if (context->formats)
     gdk_content_formats_ref (context->formats);
   else
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index afd2a2b..39d6cfe 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -201,16 +201,12 @@ void gdk_wayland_selection_ensure_primary_offer (GdkDisplay
 GdkContentFormats *gdk_wayland_selection_steal_offer (GdkDisplay *display, gpointer wl_offer);
 
 void gdk_wayland_selection_set_offer (GdkDisplay           *display,
-                                      GdkAtom               selection,
                                       gpointer              offer);
-gpointer gdk_wayland_selection_get_offer (GdkDisplay *display,
-                                          GdkAtom     selection);
-GdkContentFormats *gdk_wayland_selection_get_targets (GdkDisplay *display,
-                                                      GdkAtom     selection);
-
-struct wl_data_source * gdk_wayland_selection_get_data_source (GdkWindow *owner,
-                                                               GdkAtom    selection);
-void gdk_wayland_selection_unset_data_source (GdkDisplay *display, GdkAtom selection);
+gpointer gdk_wayland_selection_get_offer (GdkDisplay *display);
+GdkContentFormats *gdk_wayland_selection_get_targets (GdkDisplay *display);
+
+struct wl_data_source * gdk_wayland_selection_get_data_source (GdkWindow *owner);
+void gdk_wayland_selection_unset_data_source (GdkDisplay *display);
 gboolean gdk_wayland_selection_set_current_offer_actions (GdkDisplay *display,
                                                           uint32_t    actions);
 
diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c
index 97482af..e89102d 100644
--- a/gdk/wayland/gdkselection-wayland.c
+++ b/gdk/wayland/gdkselection-wayland.c
@@ -33,32 +33,9 @@
 
 #include <string.h>
 
-typedef struct _SelectionBuffer SelectionBuffer;
 typedef struct _SelectionData SelectionData;
-typedef struct _StoredSelection StoredSelection;
 typedef struct _DataOfferData DataOfferData;
 
-struct _SelectionBuffer
-{
-  GInputStream *stream;
-  GCancellable *cancellable;
-  GByteArray *data;
-  GList *requestors;
-  GdkAtom selection;
-  GdkAtom target;
-  gint ref_count;
-};
-
-struct _StoredSelection
-{
-  GdkWindow *source;
-  GCancellable *cancellable;
-  guchar *data;
-  gsize data_len;
-  GdkAtom type;
-  gint fd;
-};
-
 struct _DataOfferData
 {
   GDestroyNotify destroy_notify;
@@ -71,22 +48,12 @@ struct _SelectionData
   DataOfferData *offer;
 };
 
-enum {
-  ATOM_DND,
-  N_ATOMS
-};
-
-static GdkAtom atoms[N_ATOMS] = { 0 };
-
 struct _GdkWaylandSelection
 {
   /* Destination-side data */
-  SelectionData selections[N_ATOMS];
+  SelectionData selection;
   GHashTable *offers; /* Currently alive offers, Hashtable of wl_data_offer->DataOfferData */
 
-  /* Source-side data */
-  StoredSelection stored_selection;
-
   struct wl_data_source *dnd_source; /* Owned by the GdkDragContext */
 };
 
@@ -117,15 +84,11 @@ gdk_wayland_selection_new (void)
 {
   GdkWaylandSelection *selection;
 
-  /* init atoms */
-  atoms[ATOM_DND] = gdk_atom_intern_static_string ("GdkWaylandSelection");
-
   selection = g_new0 (GdkWaylandSelection, 1);
 
   selection->offers =
     g_hash_table_new_full (NULL, NULL, NULL,
                            (GDestroyNotify) data_offer_data_free);
-  selection->stored_selection.fd = -1;
   return selection;
 }
 
@@ -133,16 +96,6 @@ void
 gdk_wayland_selection_free (GdkWaylandSelection *selection)
 {
   g_hash_table_destroy (selection->offers);
-  g_free (selection->stored_selection.data);
-
-  if (selection->stored_selection.cancellable)
-    {
-      g_cancellable_cancel (selection->stored_selection.cancellable);
-      g_object_unref (selection->stored_selection.cancellable);
-    }
-
-  if (selection->stored_selection.fd > 0)
-    close (selection->stored_selection.fd);
 
   if (selection->dnd_source)
     wl_data_source_destroy (selection->dnd_source);
@@ -243,13 +196,9 @@ static const struct wl_data_offer_listener data_offer_listener = {
 };
 
 static SelectionData *
-selection_lookup_offer_by_atom (GdkWaylandSelection *selection,
-                                GdkAtom              selection_atom)
+selection_lookup_offer_by_atom (GdkWaylandSelection *selection)
 {
-  if (selection_atom == atoms[ATOM_DND])
-    return &selection->selections[ATOM_DND];
-  else
-    return NULL;
+  return &selection->selection;
 }
 
 void
@@ -293,7 +242,6 @@ gdk_wayland_selection_steal_offer (GdkDisplay *display,
 
 void
 gdk_wayland_selection_set_offer (GdkDisplay *display,
-                                 GdkAtom     selection_atom,
                                  gpointer    wl_offer)
 {
   GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
@@ -303,12 +251,12 @@ gdk_wayland_selection_set_offer (GdkDisplay *display,
 
   info = g_hash_table_lookup (selection->offers, wl_offer);
 
-  prev_offer = gdk_wayland_selection_get_offer (display, selection_atom);
+  prev_offer = gdk_wayland_selection_get_offer (display);
 
   if (prev_offer)
     g_hash_table_remove (selection->offers, prev_offer);
 
-  selection_data = selection_lookup_offer_by_atom (selection, selection_atom);
+  selection_data = selection_lookup_offer_by_atom (selection);
 
   if (selection_data)
     {
@@ -317,13 +265,12 @@ gdk_wayland_selection_set_offer (GdkDisplay *display,
 }
 
 gpointer
-gdk_wayland_selection_get_offer (GdkDisplay *display,
-                                 GdkAtom     selection_atom)
+gdk_wayland_selection_get_offer (GdkDisplay *display)
 {
   GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
   const SelectionData *data;
 
-  data = selection_lookup_offer_by_atom (selection, selection_atom);
+  data = selection_lookup_offer_by_atom (selection);
 
   if (data && data->offer)
     return data->offer->offer_data;
@@ -332,13 +279,12 @@ gdk_wayland_selection_get_offer (GdkDisplay *display,
 }
 
 GdkContentFormats *
-gdk_wayland_selection_get_targets (GdkDisplay *display,
-                                   GdkAtom     selection_atom)
+gdk_wayland_selection_get_targets (GdkDisplay *display)
 {
   GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
   const SelectionData *data;
 
-  data = selection_lookup_offer_by_atom (selection, selection_atom);
+  data = selection_lookup_offer_by_atom (selection);
 
   if (data && data->offer)
     return data->offer->targets;
@@ -407,16 +353,13 @@ data_source_cancelled (void                  *data,
   GdkWaylandSelection *wayland_selection = data;
   GdkDragContext *context;
   GdkDisplay *display;
-  GdkAtom atom;
 
   GDK_NOTE (EVENTS,
             g_message ("data source cancelled, source = %p", source));
 
   display = gdk_display_get_default ();
 
-  if (source == wayland_selection->dnd_source)
-    atom = atoms[ATOM_DND];
-  else
+  if (source != wayland_selection->dnd_source)
     return;
 
   context = gdk_wayland_drag_context_lookup_by_data_source (source);
@@ -424,7 +367,7 @@ data_source_cancelled (void                  *data,
   if (context)
     gdk_drag_context_cancel (context, GDK_DRAG_CANCEL_ERROR);
 
-  gdk_wayland_selection_unset_data_source (display, atom);
+  gdk_wayland_selection_unset_data_source (display);
 }
 
 static void
@@ -485,24 +428,15 @@ static const struct wl_data_source_listener data_source_listener = {
 };
 
 struct wl_data_source *
-gdk_wayland_selection_get_data_source (GdkWindow *owner,
-                                       GdkAtom    selection)
+gdk_wayland_selection_get_data_source (GdkWindow *owner)
 {
   GdkDisplay *display = gdk_window_get_display (owner);
   GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
   gpointer source = NULL;
   GdkWaylandDisplay *display_wayland;
 
-  if (selection == atoms[ATOM_DND])
-    {
-      if (wayland_selection->dnd_source)
-        return wayland_selection->dnd_source;
-    }
-  else
-    return NULL;
-
-  if (!owner)
-    return NULL;
+  if (wayland_selection->dnd_source)
+    return wayland_selection->dnd_source;
 
   display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (owner));
 
@@ -511,22 +445,17 @@ gdk_wayland_selection_get_data_source (GdkWindow *owner,
                                &data_source_listener,
                                wayland_selection);
 
-  if (selection == atoms[ATOM_DND])
-    wayland_selection->dnd_source = source;
+  wayland_selection->dnd_source = source;
 
   return source;
 }
 
 void
-gdk_wayland_selection_unset_data_source (GdkDisplay *display,
-                                         GdkAtom     selection)
+gdk_wayland_selection_unset_data_source (GdkDisplay *display)
 {
   GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
 
-  if (selection == atoms[ATOM_DND])
-    {
-      wayland_selection->dnd_source = NULL;
-    }
+  wayland_selection->dnd_source = NULL;
 }
 
 gint
@@ -643,7 +572,7 @@ gdk_wayland_selection_set_current_offer_actions (GdkDisplay *display,
   struct wl_data_offer *offer;
   uint32_t all_actions = 0;
 
-  offer = gdk_wayland_selection_get_offer (display, atoms[ATOM_DND]);
+  offer = gdk_wayland_selection_get_offer (display);
 
   if (!offer)
     return FALSE;
diff --git a/gdk/win32/gdkdnd-win32.c b/gdk/win32/gdkdnd-win32.c
index 6952807..b05cced 100644
--- a/gdk/win32/gdkdnd-win32.c
+++ b/gdk/win32/gdkdnd-win32.c
@@ -3266,7 +3266,6 @@ gdk_win32_drag_context_class_init (GdkWin32DragContextClass *klass)
   context_class->drop_reply = gdk_win32_drag_context_drop_reply;
   context_class->drop_finish = gdk_win32_drag_context_drop_finish;
   context_class->drop_status = gdk_win32_drag_context_drop_status;
-  context_class->get_selection = gdk_win32_drag_context_get_selection;
 
   context_class->get_drag_window = gdk_win32_drag_context_get_drag_window;
   context_class->set_hotspot = gdk_win32_drag_context_set_hotspot;
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index 369d928..50ac824 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -231,7 +231,6 @@ static void        gdk_x11_drag_context_drop_finish (GdkDragContext  *context,
                                                      gboolean         success,
                                                      guint32          time_);
 static gboolean    gdk_x11_drag_context_drop_status (GdkDragContext  *context);
-static GdkAtom     gdk_x11_drag_context_get_selection (GdkDragContext  *context);
 static GdkWindow * gdk_x11_drag_context_get_drag_window (GdkDragContext *context);
 static void        gdk_x11_drag_context_set_hotspot (GdkDragContext  *context,
                                                      gint             hot_x,
@@ -272,7 +271,7 @@ gdk_x11_drag_context_read_got_stream (GObject      *source,
           targets->next = NULL;
           g_task_set_task_data (task, next, (GDestroyNotify) g_slist_free);
           gdk_x11_selection_input_stream_new_async (gdk_drag_context_get_display (context),
-                                                    gdk_drag_get_selection (context),
+                                                    "XdndSelection",
                                                     next->data,
                                                     CurrentTime,
                                                     g_task_get_priority (task),
@@ -342,7 +341,7 @@ gdk_x11_drag_context_read_async (GdkDragContext      *context,
   GDK_NOTE(DND, g_printerr ("new read for %s (%u other options)\n",
                             (char *) targets->data, g_slist_length (targets->next)));
   gdk_x11_selection_input_stream_new_async (gdk_drag_context_get_display (context),
-                                            gdk_drag_get_selection (context),
+                                            "XdndSelection",
                                             targets->data,
                                             CurrentTime,
                                             io_priority,
@@ -392,7 +391,6 @@ gdk_x11_drag_context_class_init (GdkX11DragContextClass *klass)
   context_class->drop_status = gdk_x11_drag_context_drop_status;
   context_class->read_async = gdk_x11_drag_context_read_async;
   context_class->read_finish = gdk_x11_drag_context_read_finish;
-  context_class->get_selection = gdk_x11_drag_context_get_selection;
   context_class->get_drag_window = gdk_x11_drag_context_get_drag_window;
   context_class->set_hotspot = gdk_x11_drag_context_set_hotspot;
   context_class->drop_done = gdk_x11_drag_context_drop_done;
@@ -2588,15 +2586,6 @@ _gdk_x11_window_register_dnd (GdkWindow *window)
                    (guchar *)&xdnd_version, 1);
 }
 
-static GdkAtom
-gdk_x11_drag_context_get_selection (GdkDragContext *context)
-{
-  if (context->protocol == GDK_DRAG_PROTO_XDND)
-    return gdk_atom_intern_static_string ("XdndSelection");
-  else
-    return NULL;
-}
-
 static gboolean
 gdk_x11_drag_context_drop_status (GdkDragContext *context)
 {
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index d9ec023..165b7c3 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -261,7 +261,6 @@ gtk_drag_get_data_finish (GtkDragGetData *data,
 
   site = g_object_get_data (G_OBJECT (data->widget), "gtk-drag-dest");
 
-  sdata.selection = gdk_drag_get_selection (data->context);
   sdata.target = data->mime_type;
   sdata.type = data->mime_type;
   sdata.format = 8;
@@ -1015,7 +1014,6 @@ gtk_drag_content_write_mime_type_async (GdkContentProvider  *provider,
   g_task_set_priority (task, io_priority);
   g_task_set_source_tag (task, gtk_drag_content_write_mime_type_async);
 
-  sdata.selection = gdk_drag_get_selection (content->context);
   sdata.target = gdk_atom_intern (mime_type, FALSE);
   sdata.length = -1;
   sdata.display = gtk_widget_get_display (content->widget);
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index 25c3b0a..b2d4c8b 100644
--- a/gtk/gtkselection.c
+++ b/gtk/gtkselection.c
@@ -274,24 +274,6 @@ gtk_content_formats_add_uri_targets (GdkContentFormats *list)
 }
 
 /**
- * gtk_selection_data_get_selection:
- * @selection_data: a pointer to a #GtkSelectionData-struct.
- *
- * Retrieves the selection #GdkAtom of the selection data.
- *
- * Returns: (transfer none): the selection #GdkAtom of the selection data.
- *
- * Since: 2.16
- **/
-GdkAtom
-gtk_selection_data_get_selection (const GtkSelectionData *selection_data)
-{
-  g_return_val_if_fail (selection_data != NULL, 0);
-
-  return selection_data->selection;
-}
-
-/**
  * gtk_selection_data_get_target:
  * @selection_data: a pointer to a #GtkSelectionData-struct.
  *
diff --git a/gtk/gtkselection.h b/gtk/gtkselection.h
index 7e6b6a9..a855e04 100644
--- a/gtk/gtkselection.h
+++ b/gtk/gtkselection.h
@@ -45,8 +45,6 @@ GDK_AVAILABLE_IN_ALL
 GdkContentFormats *     gtk_content_formats_add_uri_targets       (GdkContentFormats *list) 
G_GNUC_WARN_UNUSED_RESULT;
 
 GDK_AVAILABLE_IN_ALL
-GdkAtom       gtk_selection_data_get_selection (const GtkSelectionData *selection_data);
-GDK_AVAILABLE_IN_ALL
 GdkAtom       gtk_selection_data_get_target    (const GtkSelectionData *selection_data);
 GDK_AVAILABLE_IN_ALL
 GdkAtom       gtk_selection_data_get_data_type (const GtkSelectionData *selection_data);
diff --git a/gtk/gtkselectionprivate.h b/gtk/gtkselectionprivate.h
index 896fcd0..f31b646 100644
--- a/gtk/gtkselectionprivate.h
+++ b/gtk/gtkselectionprivate.h
@@ -38,7 +38,6 @@ G_BEGIN_DECLS
 struct _GtkSelectionData
 {
   /*< private >*/
-  GdkAtom       selection;
   GdkAtom       target;
   GdkAtom       type;
   gint          format;


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