[mutter/gnome-3-24] compositor: End MetaDnd grab on plugin grab end



commit 229c14889685864d214afc566837a43917048b6a
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Nov 16 17:22:50 2017 +0100

    compositor: End MetaDnd grab on plugin grab end
    
    We must emit ::dnd-leave to pair the ::dnd-enter that shall be
    emitted whenever the plugin grab begins, otherwise we leave
    listeners unable to clean up if the plugin begins and ends a
    grab while there is an ongoing DnD operation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784545

 src/backends/meta-dnd-private.h |    1 +
 src/compositor/compositor.c     |    5 ++++-
 src/compositor/meta-dnd.c       |   36 ++++++++++++++++++++++++------------
 3 files changed, 29 insertions(+), 13 deletions(-)
---
diff --git a/src/backends/meta-dnd-private.h b/src/backends/meta-dnd-private.h
index 3026d65..6fb17f2 100644
--- a/src/backends/meta-dnd-private.h
+++ b/src/backends/meta-dnd-private.h
@@ -29,6 +29,7 @@ gboolean meta_dnd_handle_xdnd_event (MetaBackend    *backend,
 
 #ifdef HAVE_WAYLAND
 void meta_dnd_wayland_handle_begin_modal (MetaCompositor *compositor);
+void meta_dnd_wayland_handle_end_modal   (MetaCompositor *compositor);
 #endif
 
 #endif /* META_DND_PRIVATE_H */
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 9a69c66..62d1393 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -420,7 +420,10 @@ meta_end_modal_for_plugin (MetaCompositor *compositor,
   meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID, timestamp);
 
   if (meta_is_wayland_compositor ())
-    meta_display_sync_wayland_input_focus (display);
+    {
+      meta_dnd_wayland_handle_end_modal (compositor);
+      meta_display_sync_wayland_input_focus (display);
+    }
 }
 
 static void
diff --git a/src/compositor/meta-dnd.c b/src/compositor/meta-dnd.c
index 2ba69c4..9338553 100644
--- a/src/compositor/meta-dnd.c
+++ b/src/compositor/meta-dnd.c
@@ -218,20 +218,9 @@ meta_dnd_wayland_end_notify (ClutterActor *actor,
                              MetaDnd      *dnd)
 {
   MetaDndPrivate *priv = meta_dnd_get_instance_private (dnd);
-  unsigned int i;
 
   meta_wayland_data_device_end_drag (&priv->wl_compositor->seat->data_device);
-
-  for (i = 0; i < G_N_ELEMENTS (priv->handler_id); i++)
-    {
-      g_signal_handler_disconnect (priv->compositor->stage, priv->handler_id[i]);
-      priv->handler_id[i] = 0;
-    }
-
-  priv->compositor = NULL;
-  priv->wl_compositor = NULL;
-
-  meta_dnd_notify_dnd_leave (dnd);
+  meta_dnd_wayland_handle_end_modal (priv->compositor);
 }
 
 static void
@@ -286,4 +275,27 @@ meta_dnd_wayland_handle_begin_modal (MetaCompositor *compositor)
       meta_dnd_notify_dnd_enter (dnd);
     }
 }
+
+void
+meta_dnd_wayland_handle_end_modal (MetaCompositor *compositor)
+{
+  MetaWaylandCompositor *wl_compositor = meta_wayland_compositor_get_default ();
+  MetaDnd *dnd = meta_backend_get_dnd (meta_get_backend ());
+  MetaDndPrivate *priv = meta_dnd_get_instance_private (dnd);
+  unsigned int i;
+
+  if (!priv->compositor)
+    return;
+
+  for (i = 0; i < G_N_ELEMENTS (priv->handler_id); i++)
+    {
+      g_signal_handler_disconnect (priv->compositor->stage, priv->handler_id[i]);
+      priv->handler_id[i] = 0;
+    }
+
+  priv->compositor = NULL;
+  priv->wl_compositor = NULL;
+
+  meta_dnd_notify_dnd_leave (dnd);
+}
 #endif


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