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
This commit is contained in:
Carlos Garnacho 2017-11-16 17:22:50 +01:00
parent 4eb8d71311
commit 229c148896
3 changed files with 29 additions and 13 deletions

View File

@ -29,6 +29,7 @@ gboolean meta_dnd_handle_xdnd_event (MetaBackend *backend,
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
void meta_dnd_wayland_handle_begin_modal (MetaCompositor *compositor); void meta_dnd_wayland_handle_begin_modal (MetaCompositor *compositor);
void meta_dnd_wayland_handle_end_modal (MetaCompositor *compositor);
#endif #endif
#endif /* META_DND_PRIVATE_H */ #endif /* META_DND_PRIVATE_H */

View File

@ -420,7 +420,10 @@ meta_end_modal_for_plugin (MetaCompositor *compositor,
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID, timestamp); meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID, timestamp);
if (meta_is_wayland_compositor ()) 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 static void

View File

@ -218,20 +218,9 @@ meta_dnd_wayland_end_notify (ClutterActor *actor,
MetaDnd *dnd) MetaDnd *dnd)
{ {
MetaDndPrivate *priv = meta_dnd_get_instance_private (dnd); MetaDndPrivate *priv = meta_dnd_get_instance_private (dnd);
unsigned int i;
meta_wayland_data_device_end_drag (&priv->wl_compositor->seat->data_device); meta_wayland_data_device_end_drag (&priv->wl_compositor->seat->data_device);
meta_dnd_wayland_handle_end_modal (priv->compositor);
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);
} }
static void static void
@ -286,4 +275,27 @@ meta_dnd_wayland_handle_begin_modal (MetaCompositor *compositor)
meta_dnd_notify_dnd_enter (dnd); 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 #endif