kiosk-shell: Introduce surface tree lists to the kiosk shell

The following patchset implements proper z-order for xdg surfaces in the kiosk
shell. For this it introduces to the kiosk shell the concept of a "surface
tree": a list of kiosk shell surface structures having a common ancestor (in
the xdg protocol sense).

The design is based on the following assumptions that the kiosk shell currently
makes:

- A kiosk surface with no parent must be fullscreen.
- If a parent is set on a kiosk surface, that surface is assigned the output of
  the root kiosk surface. This means that all kiosk surfaces in a surface tree
  will always have the same output.
- There is no possibility to minimize a kiosk surface.

With these in mind, the following design decisions were deemed convenient:

- For every output, at most one surface tree list will be active. This means
  that, for a given output, only views belonging to surfaces of the same
  surface tree will be in the normal layer. Moreover, all such views will be in
  the normal layer if the surface tree list is active.
- The z-order of surface trees (the weston views' relative placement in the
  normal layer) is determined by the placement of their corresponding kiosk
  surface in the surface tree list.

Each kiosk shell surface begins its life as root of its own surface tree list.
Whenever a parent is set on a surface, that surface is linked to the surface
tree list of the root surface of the parent. If a parent kiosk shell surface is
destroyed, its children will keep the link to the root surface's surface tree
list. If the destroyed parent is also the root surface of the surface tree,
each child is unlinked from this root and they become the root of a new surface
tree.

This commit introduces to the kiosk_shell_surface structure the fields
'surface_tree_list', representing the surface tree list to which the surface is
linked at creation as its root, and 'surface_tree_link', the link to the
surface tree list.

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
This commit is contained in:
Sergio Gómez 2023-05-25 18:54:03 -05:00 committed by Marius Vlad
parent 5c1adb1cab
commit a1c3c09959
2 changed files with 9 additions and 0 deletions

View File

@ -305,6 +305,7 @@ static void
kiosk_shell_surface_destroy(struct kiosk_shell_surface *shsurf)
{
wl_signal_emit(&shsurf->destroy_signal, shsurf);
wl_list_remove(&shsurf->surface_tree_link);
weston_desktop_surface_set_user_data(shsurf->desktop_surface, NULL);
shsurf->desktop_surface = NULL;
@ -360,6 +361,11 @@ kiosk_shell_surface_create(struct kiosk_shell *shell,
wl_signal_init(&shsurf->destroy_signal);
/* start life inserting itself as root of its own surface tree list */
wl_list_init(&shsurf->surface_tree_list);
wl_list_init(&shsurf->surface_tree_link);
wl_list_insert(&shsurf->surface_tree_list, &shsurf->surface_tree_link);
return shsurf;
}

View File

@ -63,6 +63,9 @@ struct kiosk_shell_surface {
struct wl_listener parent_destroy_listener;
struct kiosk_shell_surface *parent;
struct wl_list surface_tree_list;
struct wl_list surface_tree_link;
int focus_count;
int32_t last_width, last_height;