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/compositor.h b/src/compositor.h
index 1b94764..297d227 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -240,6 +240,7 @@
 	void (*motion)(struct weston_pointer_grab *grab, uint32_t time);
 	void (*button)(struct weston_pointer_grab *grab,
 		       uint32_t time, uint32_t button, uint32_t state);
+	void (*cancel)(struct weston_pointer_grab *grab);
 };
 
 struct weston_pointer_grab {
@@ -254,6 +255,7 @@
 	void (*modifiers)(struct weston_keyboard_grab *grab, uint32_t serial,
 			  uint32_t mods_depressed, uint32_t mods_latched,
 			  uint32_t mods_locked, uint32_t group);
+	void (*cancel)(struct weston_keyboard_grab *grab);
 };
 
 struct weston_keyboard_grab {
@@ -276,6 +278,7 @@
 			int touch_id,
 			wl_fixed_t sx,
 			wl_fixed_t sy);
+	void (*cancel)(struct weston_touch_grab *grab);
 };
 
 struct weston_touch_grab {