From 60170cff70292adf9e83aabb6fd08a213d779c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 27 May 2019 17:10:56 -0500 Subject: [PATCH] compositor: Emit 'grab-op-end' signal after ungrab happened We're currently emitting the 'grab-op-end' signal when the grab prerequisites are met, but when display->grab_op is still set to a not-NONE value and thus meta_display_get_grab_op() would return that in the signal callback. And more importantly when this is emitted, devices are still grabbed. Instead, emit this signal as soon as we've unset all the grab properties and released the devices. Helps with https://gitlab.gnome.org/GNOME/gnome-shell/issues/1326 https://gitlab.gnome.org/GNOME/mutter/merge_requests/596 --- src/compositor/compositor.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index f015c92f4..c8153cb3d 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -431,13 +431,11 @@ meta_end_modal_for_plugin (MetaCompositor *compositor, { MetaDisplay *display = compositor->display; MetaBackend *backend = meta_get_backend (); + MetaWindow *grab_window = display->grab_window; + MetaGrabOp grab_op = display->grab_op; g_return_if_fail (is_modal (display)); - g_signal_emit_by_name (display, "grab-op-end", - meta_plugin_get_display (plugin), - display->grab_window, display->grab_op); - display->grab_op = META_GRAB_OP_NONE; display->event_route = META_EVENT_ROUTE_NORMAL; display->grab_window = NULL; @@ -454,6 +452,10 @@ meta_end_modal_for_plugin (MetaCompositor *compositor, meta_display_sync_wayland_input_focus (display); } #endif + + g_signal_emit_by_name (display, "grab-op-end", + meta_plugin_get_display (plugin), + grab_window, grab_op); } static void