Commit 412e6a59 authored by Giulio Camuffo's avatar Giulio Camuffo Committed by Jason Ekstrand

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.
parent cfff3122
......@@ -219,7 +219,7 @@ exposay_layout(struct desktop_shell *shell, struct shell_output *shell_output)
int last_row_removed = 0;
eoutput->num_surfaces = 0;
wl_list_for_each(view, &workspace->layer.view_list, layer_link) {
wl_list_for_each(view, &workspace->layer.view_list.link, layer_link.link) {
if (!get_shell_surface(view->surface))
continue;
if (view->output != output)
......@@ -272,7 +272,7 @@ exposay_layout(struct desktop_shell *shell, struct shell_output *shell_output)
eoutput->surface_size = output->height / 2;
i = 0;
wl_list_for_each(view, &workspace->layer.view_list, layer_link) {
wl_list_for_each(view, &workspace->layer.view_list.link, layer_link.link) {
int pad;
pad = eoutput->surface_size + eoutput->padding_inner;
......
......@@ -75,8 +75,8 @@ show_input_panel_surface(struct input_panel_surface *ipsurf)
weston_view_set_position(ipsurf->view, x, y);
}
wl_list_insert(&shell->input_panel_layer.view_list,
&ipsurf->view->layer_link);
weston_layer_entry_insert(&shell->input_panel_layer.view_list,
&ipsurf->view->layer_link);
weston_view_geometry_dirty(ipsurf->view);
weston_view_update_transform(ipsurf->view);
weston_surface_damage(ipsurf->surface);
......@@ -135,7 +135,8 @@ hide_input_panels(struct wl_listener *listener, void *data)
wl_list_remove(&shell->input_panel_layer.link);
wl_list_for_each_safe(view, next,
&shell->input_panel_layer.view_list, layer_link)
&shell->input_panel_layer.view_list.link,
layer_link.link)
weston_view_unmap(view);
}
......
This diff is collapsed.
......@@ -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);
}
......@@ -1912,10 +1912,27 @@ idle_repaint(void *data)
output->start_repaint_loop(output);
}
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);
}
......
......@@ -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;
......@@ -996,6 +1001,11 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
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);
......
......@@ -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);
}
......
......@@ -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);
}
}
......
......@@ -93,9 +93,9 @@ test_surface_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
struct weston_test_surface *test_surface = surface->configure_private;
struct weston_test *test = test_surface->test;
if (wl_list_empty(&test_surface->view->layer_link))
wl_list_insert(&test->layer.view_list,
&test_surface->view->layer_link);
if (wl_list_empty(&test_surface->view->layer_link.link))
weston_layer_entry_insert(&test->layer.view_list,
&test_surface->view->layer_link);
weston_view_set_position(test_surface->view,
test_surface->x, test_surface->y);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment