summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGiulio Camuffo <giuliocamuffo@gmail.com>2014-07-09 22:12:56 +0300
committerJason Ekstrand <jason.ekstrand@intel.com>2014-07-23 12:34:33 -0700
commit412e6a59eb90da5b29226e0b32f4a1a8e21c6500 (patch)
tree656c515d17dcc9308bc6100719a320a60c55b5ac /src
parentcfff3122046b346f0b47b6f7dfbbdf62352cfe61 (diff)
downloadweston-412e6a59eb90da5b29226e0b32f4a1a8e21c6500.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/compositor.c33
-rw-r--r--src/compositor.h14
-rw-r--r--src/data-device.c6
-rw-r--r--src/input.c4
4 files changed, 42 insertions, 15 deletions
diff --git a/src/compositor.c b/src/compositor.c
index 17fce8d1..1d8d00e6 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -345,9 +345,10 @@ weston_view_create(struct weston_surface *surface)
wl_signal_init(&view->destroy_signal);
wl_list_init(&view->link);
- wl_list_init(&view->layer_link);
+ wl_list_init(&view->layer_link.link);
view->plane = NULL;
+ view->layer_link.layer = NULL;
pixman_region32_init(&view->clip);
@@ -1366,8 +1367,7 @@ weston_view_unmap(struct weston_view *view)
weston_view_damage_below(view);
view->output = NULL;
view->plane = NULL;
- wl_list_remove(&view->layer_link);
- wl_list_init(&view->layer_link);
+ weston_layer_entry_remove(&view->layer_link);
wl_list_remove(&view->link);
wl_list_init(&view->link);
view->output_mask = 0;
@@ -1422,7 +1422,7 @@ weston_view_destroy(struct weston_view *view)
}
wl_list_remove(&view->link);
- wl_list_remove(&view->layer_link);
+ weston_layer_entry_remove(&view->layer_link);
pixman_region32_fini(&view->clip);
pixman_region32_fini(&view->transform.boundingbox);
@@ -1783,18 +1783,18 @@ weston_compositor_build_view_list(struct weston_compositor *compositor)
struct weston_layer *layer;
wl_list_for_each(layer, &compositor->layer_list, link)
- wl_list_for_each(view, &layer->view_list, layer_link)
+ wl_list_for_each(view, &layer->view_list.link, layer_link.link)
surface_stash_subsurface_views(view->surface);
wl_list_init(&compositor->view_list);
wl_list_for_each(layer, &compositor->layer_list, link) {
- wl_list_for_each(view, &layer->view_list, layer_link) {
+ wl_list_for_each(view, &layer->view_list.link, layer_link.link) {
view_list_add(compositor, view);
}
}
wl_list_for_each(layer, &compositor->layer_list, link)
- wl_list_for_each(view, &layer->view_list, layer_link)
+ wl_list_for_each(view, &layer->view_list.link, layer_link.link)
surface_free_unused_subsurface_views(view->surface);
}
@@ -1913,9 +1913,26 @@ idle_repaint(void *data)
}
WL_EXPORT void
+weston_layer_entry_insert(struct weston_layer_entry *list,
+ struct weston_layer_entry *entry)
+{
+ wl_list_insert(&list->link, &entry->link);
+ entry->layer = list->layer;
+}
+
+WL_EXPORT void
+weston_layer_entry_remove(struct weston_layer_entry *entry)
+{
+ wl_list_remove(&entry->link);
+ wl_list_init(&entry->link);
+ entry->layer = NULL;
+}
+
+WL_EXPORT void
weston_layer_init(struct weston_layer *layer, struct wl_list *below)
{
- wl_list_init(&layer->view_list);
+ wl_list_init(&layer->view_list.link);
+ layer->view_list.layer = layer;
if (below != NULL)
wl_list_insert(below, &layer->link);
}
diff --git a/src/compositor.h b/src/compositor.h
index d4a2dbb7..9bbd8440 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -526,8 +526,13 @@ enum {
* 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 weston_view {
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 @@ void
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
diff --git a/src/data-device.c b/src/data-device.c
index a069b3c0..75fc60cb 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -180,7 +180,7 @@ drag_surface_configure(struct weston_drag *drag,
struct weston_surface *es,
int32_t sx, int32_t sy)
{
- struct wl_list *list;
+ struct weston_layer_entry *list;
float fx, fy;
assert((pointer != NULL && touch == NULL) ||
@@ -193,8 +193,8 @@ drag_surface_configure(struct weston_drag *drag,
else
list = &es->compositor->cursor_layer.view_list;
- wl_list_remove(&drag->icon->layer_link);
- wl_list_insert(list, &drag->icon->layer_link);
+ weston_layer_entry_remove(&drag->icon->layer_link);
+ weston_layer_entry_insert(list, &drag->icon->layer_link);
weston_view_update_transform(drag->icon);
pixman_region32_clear(&es->pending.input);
}
diff --git a/src/input.c b/src/input.c
index 2c799f43..4aa8ca78 100644
--- a/src/input.c
+++ b/src/input.c
@@ -1555,8 +1555,8 @@ pointer_cursor_surface_configure(struct weston_surface *es,
empty_region(&es->input);
if (!weston_surface_is_mapped(es)) {
- wl_list_insert(&es->compositor->cursor_layer.view_list,
- &pointer->sprite->layer_link);
+ weston_layer_entry_insert(&es->compositor->cursor_layer.view_list,
+ &pointer->sprite->layer_link);
weston_view_update_transform(pointer->sprite);
}
}