[mutter/wip/carlosg/selection-fixes: 4/8] wayland: Emit wl/primary offer after changing selection



commit 466818a35b0dcc8e8f831e9de953d436712acafe
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Oct 11 12:27:56 2019 +0200

    wayland: Emit wl/primary offer after changing selection
    
    We are still poking the mimetypes from the previous selection when creating
    the new offer. This may come out wrong between changes of the copied
    mimetypes.
    
    Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/789

 src/wayland/meta-wayland-data-device.c | 48 +++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 7948fe912..24e97222a 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -1660,18 +1660,6 @@ meta_wayland_data_device_set_selection (MetaWaylandDataDevice *data_device,
   data_device->selection_data_source = source;
   data_device->selection_serial = serial;
 
-  focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard);
-  if (focus_client)
-    {
-      data_device_resource = wl_resource_find_for_client (&data_device->resource_list, focus_client);
-      if (data_device_resource)
-        {
-          struct wl_resource *offer;
-          offer = create_and_send_clipboard_offer (data_device, data_device_resource);
-          wl_data_device_send_selection (data_device_resource, offer);
-        }
-    }
-
   if (source)
     {
       MetaWaylandDataSourceWayland *source_wayland =
@@ -1700,6 +1688,18 @@ meta_wayland_data_device_set_selection (MetaWaylandDataDevice *data_device,
       unset_selection_source (data_device, META_SELECTION_CLIPBOARD);
     }
 
+  focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard);
+  if (focus_client)
+    {
+      data_device_resource = wl_resource_find_for_client (&data_device->resource_list, focus_client);
+      if (data_device_resource)
+        {
+          struct wl_resource *offer;
+          offer = create_and_send_clipboard_offer (data_device, data_device_resource);
+          wl_data_device_send_selection (data_device_resource, offer);
+        }
+    }
+
   wl_signal_emit (&data_device->selection_ownership_signal, source);
 }
 
@@ -1800,18 +1800,6 @@ meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device,
   data_device->primary_data_source = source;
   data_device->primary_serial = serial;
 
-  focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard);
-  if (focus_client)
-    {
-      data_device_resource = wl_resource_find_for_client (&data_device->primary_resource_list, focus_client);
-      if (data_device_resource)
-        {
-          struct wl_resource *offer;
-          offer = create_and_send_primary_offer (data_device, data_device_resource);
-          gtk_primary_selection_device_send_selection (data_device_resource, offer);
-        }
-    }
-
   if (source)
     {
       MetaSelectionSource *selection_source;
@@ -1838,6 +1826,18 @@ meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device,
       unset_selection_source (data_device, META_SELECTION_PRIMARY);
     }
 
+  focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard);
+  if (focus_client)
+    {
+      data_device_resource = wl_resource_find_for_client (&data_device->primary_resource_list, focus_client);
+      if (data_device_resource)
+        {
+          struct wl_resource *offer;
+          offer = create_and_send_primary_offer (data_device, data_device_resource);
+          gtk_primary_selection_device_send_selection (data_device_resource, offer);
+        }
+    }
+
   wl_signal_emit (&data_device->primary_ownership_signal, source);
 }
 


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