[gtk+/gtk-3-18] wayland: Store requested target on GdkWaylandSelection



commit c52c4f94d5ba5fb87ddfa9dbd453fc5913368741
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Dec 1 13:58:21 2015 +0100

    wayland: Store requested target on GdkWaylandSelection
    
    It doesn't make a lot of sense to have this stored as data offer data,
    rather together with the source_targets array, which is what we're
    poking here in the end.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758713

 gdk/wayland/gdkselection-wayland.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c
index b167c0c..e5b6a59 100644
--- a/gdk/wayland/gdkselection-wayland.c
+++ b/gdk/wayland/gdkselection-wayland.c
@@ -69,7 +69,6 @@ struct _DataOfferData
 {
   struct wl_data_offer *offer;
   GList *targets; /* List of GdkAtom */
-  GdkAtom requested_target;
 };
 
 struct _AsyncWriteData
@@ -97,6 +96,7 @@ struct _GdkWaylandSelection
   /* Source-side data */
   StoredSelection stored_selection;
   GArray *source_targets;
+  GdkAtom requested_target;
 
   struct wl_data_source *clipboard_source;
   GdkWindow *clipboard_owner;
@@ -657,7 +657,6 @@ gdk_wayland_selection_request_target (GdkWaylandSelection *wayland_selection,
                                       GdkAtom              target,
                                       gint                 fd)
 {
-  DataOfferData *offer;
   GdkAtom selection;
 
   if (wayland_selection->clipboard_owner == window)
@@ -667,10 +666,8 @@ gdk_wayland_selection_request_target (GdkWaylandSelection *wayland_selection,
   else
     return FALSE;
 
-  offer = selection_lookup_offer_by_atom (wayland_selection, selection);
-
   if (wayland_selection->stored_selection.fd == fd &&
-      offer->requested_target == target)
+      wayland_selection->requested_target == target)
     return FALSE;
 
   /* If we didn't issue gdk_wayland_selection_check_write() yet
@@ -681,7 +678,7 @@ gdk_wayland_selection_request_target (GdkWaylandSelection *wayland_selection,
     close (wayland_selection->stored_selection.fd);
 
   wayland_selection->stored_selection.fd = fd;
-  offer->requested_target = target;
+  wayland_selection->requested_target = target;
 
   if (window &&
       gdk_wayland_selection_source_handles_target (wayland_selection, target))
@@ -1188,6 +1185,7 @@ gdk_wayland_selection_clear_targets (GdkDisplay *display,
 {
   GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
 
+  wayland_selection->requested_target = GDK_NONE;
   g_array_set_size (wayland_selection->source_targets, 0);
   gdk_wayland_selection_unset_data_source (display, selection);
 }


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