Add cancel function to grab interfaces
A grab can potentially allocate memory and would normally end the grab
itself, freeing the allocated memory in the process. However at in some
situations the compositor may want to abort a grab. The grab owner still
needs to free some memory and abort the grab properly. To do this a new
function 'cancel' is introduced in all the grab interfaces instructing
the grabs owner to abort the grab.
This patch also hooks up grab cancelling to seat device releasing and
when the compositor looses focus, which would potentially leak memory
before.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
diff --git a/src/text-backend.c b/src/text-backend.c
index 37dfb75..107ccd6 100644
--- a/src/text-backend.c
+++ b/src/text-backend.c
@@ -570,9 +570,16 @@
mods_locked, group);
}
+static void
+input_method_context_grab_cancel(struct weston_keyboard_grab *grab)
+{
+ weston_keyboard_end_grab(grab->keyboard);
+}
+
static const struct weston_keyboard_grab_interface input_method_context_grab = {
input_method_context_grab_key,
input_method_context_grab_modifier,
+ input_method_context_grab_cancel,
};
static void