From 9f071fdc87e398d87bb958d2c75e94742f8a8abe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 21 Sep 2016 14:30:15 +0800 Subject: [PATCH] wayland/pointer: Use grab helper that doesn't focus when disabling Instead of using meta_wayland_pointer_end_grab() which focuses the new grab, add a new helper mean to be used to reset the grab state without changing the pointer focus. When using this function, the call site is supposed to explicitly manage focus. https://bugzilla.gnome.org/show_bug.cgi?id=771646 --- src/wayland/meta-wayland-pointer.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c index bb9455796..55fcb068b 100644 --- a/src/wayland/meta-wayland-pointer.c +++ b/src/wayland/meta-wayland-pointer.c @@ -86,6 +86,9 @@ static guint signals[LAST_SIGNAL]; G_DEFINE_TYPE (MetaWaylandPointer, meta_wayland_pointer, META_TYPE_WAYLAND_INPUT_DEVICE) +static void +meta_wayland_pointer_reset_grab (MetaWaylandPointer *pointer); + static MetaWaylandPointerClient * meta_wayland_pointer_client_new (void) { @@ -495,7 +498,7 @@ meta_wayland_pointer_disable (MetaWaylandPointer *pointer) pointer->cursor_surface_destroy_id); } - meta_wayland_pointer_end_grab (pointer); + meta_wayland_pointer_reset_grab (pointer); meta_wayland_pointer_set_focus (pointer, NULL); g_clear_pointer (&pointer->pointer_clients, g_hash_table_unref); @@ -866,6 +869,12 @@ meta_wayland_pointer_start_grab (MetaWaylandPointer *pointer, interface->focus (pointer->grab, pointer->current); } +static void +meta_wayland_pointer_reset_grab (MetaWaylandPointer *pointer) +{ + pointer->grab = &pointer->default_grab; +} + void meta_wayland_pointer_end_grab (MetaWaylandPointer *pointer) {