compositor: keep track of the weston_layer a weston_view is in

This introduces a new struct, weston_layer_entry, which is now used
in place of wl_list to keep the link for the layer list in weston_view
and the head of the list in weston_layer.
weston_layer_entry also has a weston_layer*, which points to the layer
the view is in or, in the case the entry it's the head of the list, to
the layer itself.
diff --git a/src/compositor.h b/src/compositor.h
index d4a2dbb..9bbd844 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -526,8 +526,13 @@
                                          * to off */
 };
 
+struct weston_layer_entry {
+	struct wl_list link;
+	struct weston_layer *layer;
+};
+
 struct weston_layer {
-	struct wl_list view_list;
+	struct weston_layer_entry view_list;
 	struct wl_list link;
 };
 
@@ -731,7 +736,7 @@
 	struct wl_signal destroy_signal;
 
 	struct wl_list link;
-	struct wl_list layer_link;
+	struct weston_layer_entry layer_link;
 	struct weston_plane *plane;
 
 	pixman_region32_t clip;
@@ -997,6 +1002,11 @@
 notify_touch_frame(struct weston_seat *seat);
 
 void
+weston_layer_entry_insert(struct weston_layer_entry *list,
+			  struct weston_layer_entry *entry);
+void
+weston_layer_entry_remove(struct weston_layer_entry *entry);
+void
 weston_layer_init(struct weston_layer *layer, struct wl_list *below);
 
 void