[mutter/gnome-3-22] xwayland: Use timestamp from XdndPosition/Drop on XConvertSelection



commit 68b4d1e462cce1b7066ce229972e39a84be40802
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Mar 8 19:14:21 2017 +0100

    xwayland: Use timestamp from XdndPosition/Drop on XConvertSelection
    
    QT apps reject DnD if the timestamp received in the SelectionRequest
    event isn't the same it gave in XdndPosition/Drop client messages.
    Bookkeeping and using it in XConvertSelection makes it happy again.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779757

 src/wayland/meta-xwayland-selection.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/meta-xwayland-selection.c b/src/wayland/meta-xwayland-selection.c
index af24586..59aac32 100644
--- a/src/wayland/meta-xwayland-selection.c
+++ b/src/wayland/meta-xwayland-selection.c
@@ -67,6 +67,7 @@ typedef struct {
   Window window;
   Window owner;
   Time timestamp;
+  Time client_message_timestamp;
   MetaWaylandDataSource *source; /* owned by MetaWaylandDataDevice */
   WaylandSelectionData *wayland_selection;
   X11SelectionData *x11_selection;
@@ -834,7 +835,7 @@ meta_x11_source_send (MetaWaylandDataSource *source,
                      selection->selection_atom, type_atom,
                      gdk_x11_get_xatom_by_name ("_META_SELECTION"),
                      selection->window,
-                     CurrentTime);
+                     selection->client_message_timestamp);
   XFlush (xdisplay);
 }
 
@@ -1533,6 +1534,8 @@ meta_xwayland_selection_handle_client_message (MetaWaylandCompositor *compositor
           ClutterPoint pos;
           uint32_t action = 0;
 
+          dnd->selection.client_message_timestamp = event->data.l[3];
+
           motion = clutter_event_new (CLUTTER_MOTION);
           clutter_input_device_get_coords (seat->pointer->device, NULL, &pos);
           clutter_event_set_coords (motion, pos.x, pos.y);
@@ -1558,6 +1561,7 @@ meta_xwayland_selection_handle_client_message (MetaWaylandCompositor *compositor
         }
       else if (event->message_type == xdnd_atoms[ATOM_DND_DROP])
         {
+          dnd->selection.client_message_timestamp = event->data.l[2];
           meta_wayland_surface_drag_dest_drop (drag_focus);
           meta_xwayland_end_dnd_grab (&seat->data_device);
           return TRUE;
@@ -1627,6 +1631,7 @@ meta_xwayland_selection_handle_xfixes_selection_notify (MetaWaylandCompositor *c
       if (event->owner != None && event->owner != selection->window &&
           focus && meta_xwayland_is_xwayland_surface (focus))
         {
+          selection->client_message_timestamp = CurrentTime;
           selection->source = meta_wayland_data_source_xwayland_new (selection);
           meta_wayland_data_device_set_dnd_source (&compositor->seat->data_device,
                                                    selection->source);


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