Commit Graph

12 Commits

Author SHA1 Message Date
Sergio Gómez d53efc6cc3 kiosk-shell: Distinguish between 'destroy_signal' and 'parent_destroy_signal'
Currently, the 'parent_destroy_listener' is being paired with
'destroy_signal'. The signal is emitted from kiosk_shell_surface_destroy(),
which is the appropriate place to emit this general-purpose surface destruction
signal.

However, we need to inform the children of the surface destruction before
finding the focus successor and activating it, that is, before calling
find_focus_successor() and kiosk_shell_surface_activate(), which happen before
kiosk_shell_surface_destroy().
Since there are currently other uses for 'destroy_signal' (e.g. in
kiosk-shell-grab.c), don't mess with it and simply add a new
'parent_destroy_signal', placing its emition where we need it.

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-07-27 10:13:48 +03:00
Sergio Gómez 1077a8ed9b kiosk-shell: Introduce an "active surface tree" for each kiosk shell output
This commit introduces to the kiosk shell output structure a pointer to a
surface tree list. This pointer will reference the surface tree list currently
active on the output. (Surface tree lists were introduced in the previous
commit)

Each output will have at most one active surface tree. A surface tree being
active on an output means that all views for this output belonging to that
surface tree, and only those views, are in the normal layer.

kiosk_shell_output_set_active_surface_tree() sets the current active surface
tree for the specified output, replacing the previous one.

Set the new active surface tree when first mapping a surface

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-07-27 10:13:48 +03:00
Sergio Gómez a1c3c09959 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>
2023-07-27 10:13:48 +03:00
Marius Vlad 1b4def3c48 libweston/desktop: Migrate libweston-desktop/libweston-desktop.h
With commit 'Move libweston-desktop into libweston' we've moved out
libweston-desktop DSO into libweston.  Move also the header to
libweston/desktop.

This removes removes the libweston-desktop pc file and bumps libweston
major version to 12.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-09-23 13:57:26 +03:00
Daniel Stone dc0f73bcac shell: Encapsulate weston_curtain in its own struct
This will allow us to create a solid weston_buffer as well, since we
need to store that separately.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Marius Vlad 8a1849db8a kiosk-shell: Check if app_ids have been set after initial commit
Some applications would set-up the app_id after the initial commit
(without a buffer) which is too late to correctly assign the application
to the corresponding output set-up in the configuration file.

This patch fixes that by checking one more time, after a buffer has been
attached, if indeed there's an output with an app_id set.

Fixes: #469

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-02-03 15:37:03 +00:00
Marius Vlad f676a8f54e kiosk-shell: Add a border fill to non-fullscreen views
According to xdg-shell spec, if the surface doesn't cover the whole
output we should center it and install a border fill covering the rest
of the output.

While we center out the surface we never got around installing the
border fill. This patch re-uses the activation of a surface to control
this bit as well, by making use of an new layer to place the
surface while not being active.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-12-08 17:35:26 +02:00
Marius Vlad 4b23aa11ae kiosk-shell: Remove keyboard_focus and seat_caps listeners
The seat_cap listener was to register a signal for keyboard_focus, which
we no longer use. Remove it entirely to avoid dead code.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Derek Foreman <derek.foreman@collabora.com>
2021-11-12 15:58:46 +02:00
Marius Vlad 73aaf14ebe kiosk-shell: Read background-color from ini file
desktop-shell's client is able to read-up from the config file, [shell]
section the background, but for kiosk-shell we don't actually have
client that does that, so instead allow the shell do that directly.
Seems to be a useful thing to have, as a default background color.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-04-04 19:00:31 +03:00
Marius Vlad bf3e200169 kiosk-shell: Add transform_handler to correctly position xwayland surfaces
When using xwayland surfaces and multiple outputs we need to notify
xwayland surface that the surface position has changed, otherwise we're
going to end up with pop-ups being displayed on other outputs rather
than the one were the main surface resides.

Stolen from desktop-shell.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2021-04-04 18:45:33 +03:00
Marius Vlad 092130c4bf kiosk-shell: Keep track of seats created and destroy them at end
kiosk_shell_destroy() will free up weston_desktop, but still keeping
listeners set-up (keyboard/seat/caps), which will fire
when the the compositor is stopped/shutdown by clients still connected.

This patch maintains a list of seats and uses it to remove any listeners
when calling kiosk_shell_destroy(). desktop-shell and ivi-shell do not
appear to be using weston_desktop_destroy() in their respective destroy
parts.

This avoids an illegal access happening when calling one of the
listeners, after weston_desktop has been free'ed, like the following:

==2002==    at 0x10F3F8FD: weston_desktop_get_display (libweston-desktop.c:125)
==2002==    by 0x10F450A7: weston_desktop_xdg_surface_schedule_configure (xdg-shell.c:1022)
==2002==    by 0x10F44793: weston_desktop_xdg_toplevel_set_activated (xdg-shell.c:643)
==2002==    by 0x10F41AA5: weston_desktop_surface_set_activated (surface.c:468)
==2002==    by 0x10F32E7E: kiosk_shell_seat_handle_keyboard_focus (kiosk-shell.c:329)
==2002==    by 0x4A726A7: wl_signal_emit (wayland-server-core.h:478)
==2002==    by 0x4A75BD1: weston_keyboard_set_focus (input.c:1586)
==2002==    by 0x4A776FE: notify_keyboard_focus_out (input.c:2314)
==2002==    by 0x5902BC1: udev_seat_destroy (libinput-seat.c:469)
==2002==    by 0x59028C5: udev_input_destroy (libinput-seat.c:375)
==2002==    by 0x58F0449: drm_destroy (drm.c:2571)
==2002==    by 0x4A6EE39: weston_compositor_destroy (compositor.c:7814)
==2002==  Address 0x10bd1780 is 0 bytes inside a block of size 152 free'd
==2002==    at 0x48399AB: free (vg_replace_malloc.c:538)
==2002==    by 0x10F3F8DA: weston_desktop_destroy (libweston-desktop.c:112)
==2002==    by 0x10F34357: kiosk_shell_destroy (kiosk-shell.c:1009)
==2002==    by 0x4A5F618: wl_signal_emit (wayland-server-core.h:478)
==2002==    by 0x4A6EE06: weston_compositor_destroy (compositor.c:7809)
==2002==    by 0x4855548: wet_main (main.c:3420)
==2002==    by 0x109154: main (executable.c:33)
==2002==  Block was alloc'd at
==2002==    at 0x483AB65: calloc (vg_replace_malloc.c:760)
==2002==    by 0x10F3F681: zalloc (zalloc.h:38)
==2002==    by 0x10F3F724: weston_desktop_create (libweston-desktop.c:65)
==2002==    by 0x10F34458: wet_shell_init (kiosk-shell.c:1045)
==2002==    by 0x484F83D: wet_load_shell (main.c:924)
==2002==    by 0x48552D3: wet_main (main.c:3361)
==2002==    by 0x109154: main (executable.c:33)

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2020-11-04 14:34:30 +02:00
Alexandros Frantzis 87c1679a0a kiosk-shell: Introduce kiosk/fullscreen shell for desktop apps
kiosk-shell is fullscreen shell for apps that use the xdg-shell
protocol. The goal is to make life easier for people shipping embedded
devices with simple fullscreen shell requirements, and reduce the
proliferation of desktop-shell hacks.

Top level surfaces are made fullscreen, whereas dialogs are placed on
top in the center of the output and retain their natural sizes. Dialogs
can be moved and (un)maximized, but resizing is currently not supported.

An app can be directed to a particular output by populating the
"app-ids" field with the app's XDG app id, in the relevant
"[output]" section in the weston config file.

Fixes: #277

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2020-07-30 14:38:49 +00:00