weston-desktop: Match desktop-shell view mapping semantics
Preserve the same order as desktop-shell for handling view (un)mapping, so we can move these into a shared helper. These should have no functional effect but provide a helpful bisect point. Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
4b3e09fa71
commit
07103d1842
@ -1712,31 +1712,12 @@ shell_surface_update_child_surface_layers (struct shell_surface *shsurf)
|
||||
static void
|
||||
shell_surface_update_layer(struct shell_surface *shsurf)
|
||||
{
|
||||
struct weston_surface *surface =
|
||||
weston_desktop_surface_get_surface(shsurf->desktop_surface);
|
||||
struct weston_layer_entry *new_layer_link;
|
||||
|
||||
new_layer_link = shell_surface_calculate_layer_link(shsurf);
|
||||
assert(new_layer_link);
|
||||
|
||||
if (new_layer_link == &shsurf->view->layer_link)
|
||||
return;
|
||||
|
||||
/* Dirty the view's old region, and remove it from the layer. */
|
||||
if (weston_view_is_mapped(shsurf->view)) {
|
||||
weston_view_damage_below(shsurf->view);
|
||||
weston_view_geometry_dirty(shsurf->view);
|
||||
}
|
||||
|
||||
weston_layer_entry_remove(&shsurf->view->layer_link);
|
||||
|
||||
/* Add the surface to the new layer and dirty its new region. */
|
||||
weston_layer_entry_insert(new_layer_link, &shsurf->view->layer_link);
|
||||
shsurf->view->is_mapped = true;
|
||||
weston_view_geometry_dirty(shsurf->view);
|
||||
weston_view_update_transform(shsurf->view); /* XXX: unnecessary? */
|
||||
weston_surface_damage(surface);
|
||||
|
||||
weston_view_move_to_layer(shsurf->view, new_layer_link);
|
||||
shell_surface_update_child_surface_layers(shsurf);
|
||||
}
|
||||
|
||||
|
@ -2018,6 +2018,10 @@ weston_view_activate_input(struct weston_view *view,
|
||||
void
|
||||
notify_modifiers(struct weston_seat *seat, uint32_t serial);
|
||||
|
||||
void
|
||||
weston_view_move_to_layer(struct weston_view *view,
|
||||
struct weston_layer_entry *layer);
|
||||
|
||||
void
|
||||
weston_layer_entry_insert(struct weston_layer_entry *list,
|
||||
struct weston_layer_entry *entry);
|
||||
|
@ -3516,6 +3516,42 @@ weston_layer_entry_insert(struct weston_layer_entry *list,
|
||||
entry->layer = list->layer;
|
||||
}
|
||||
|
||||
/** Move a weston_view to a layer
|
||||
*
|
||||
* This moves a view to a given point within a layer, identified by a
|
||||
* weston_layer_entry.
|
||||
*
|
||||
* \param view View to move
|
||||
* \param layer The target layer entry, or NULL to remove from the scene graph
|
||||
*/
|
||||
WL_EXPORT void
|
||||
weston_view_move_to_layer(struct weston_view *view,
|
||||
struct weston_layer_entry *layer)
|
||||
{
|
||||
if (layer == &view->layer_link)
|
||||
return;
|
||||
|
||||
/* Damage the view's old region, and remove it from the layer. */
|
||||
if (weston_view_is_mapped(view)) {
|
||||
weston_view_damage_below(view);
|
||||
weston_view_geometry_dirty(view);
|
||||
}
|
||||
|
||||
weston_layer_entry_remove(&view->layer_link);
|
||||
|
||||
if (!layer) {
|
||||
weston_view_unmap(view);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Add the view to the new layer and damage its new region. */
|
||||
weston_layer_entry_insert(layer, &view->layer_link);
|
||||
view->is_mapped = true;
|
||||
weston_view_geometry_dirty(view);
|
||||
weston_view_update_transform(view);
|
||||
weston_surface_damage(view->surface);
|
||||
}
|
||||
|
||||
WL_EXPORT void
|
||||
weston_layer_entry_remove(struct weston_layer_entry *entry)
|
||||
{
|
||||
|
@ -442,24 +442,15 @@ static void
|
||||
weston_desktop_view_propagate_layer(struct weston_desktop_view *view)
|
||||
{
|
||||
struct weston_desktop_view *child;
|
||||
struct wl_list *link = &view->view->layer_link.link;
|
||||
struct wl_list *parent_pos = &view->view->layer_link.link;
|
||||
|
||||
/* Move each child to the same layer, immediately in front of its
|
||||
* parent. */
|
||||
wl_list_for_each_reverse(child, &view->children_list, children_link) {
|
||||
struct weston_layer_entry *prev =
|
||||
wl_container_of(link->prev, prev, link);
|
||||
|
||||
if (prev == &child->view->layer_link)
|
||||
continue;
|
||||
|
||||
child->view->is_mapped = true;
|
||||
weston_view_damage_below(child->view);
|
||||
weston_view_geometry_dirty(child->view);
|
||||
weston_layer_entry_remove(&child->view->layer_link);
|
||||
weston_layer_entry_insert(prev, &child->view->layer_link);
|
||||
weston_view_geometry_dirty(child->view);
|
||||
weston_surface_damage(child->view->surface);
|
||||
weston_view_update_transform(child->view);
|
||||
struct weston_layer_entry *child_pos =
|
||||
wl_container_of(parent_pos->prev, child_pos, link);
|
||||
|
||||
weston_view_move_to_layer(child->view, child_pos);
|
||||
weston_desktop_view_propagate_layer(child);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user