Commit Graph

55 Commits

Author SHA1 Message Date
Sergio Gómez
beece0215f kiosk-shell: Handle relinking of surface trees when setting a parent
This commit adds code to maintain the correct order and linking of a surface in
its surface tree list for when a new parent is being set on it.

If the new parent is not NULL, the child might already belong to the same
surface tree as the new parent's root, in which case no relinking is necessary.
Check this by calling kiosk_shell_surface_is_surface_in_tree(shsurf, shroot),
to see if 'shsurf' is in the surface tree list represented by 'shroot', where
'shroot' is the new parent's root surface. In case 'shsurf' doesn't belong to
this surface tree, relink it there.

If parent is NULL, 'shsurf' will become root of a new surface tree list. In
this case 'shroot' is the root surface of shsurf's current surface tree list.
Iterate through the surface tree list of this 'shroot' to relink all
descendents of 'shsurf' into this new list and set it as the new active surface
tree for the output.

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
Daniel Stone
e743d56327 kiosk-shell: Use weston_view_move_to_layer() for view activation
When a new view gets activated, use weston_view_move_to_layer() for our
dance of moving views to the front.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone
a822d20701 kiosk-shell: Use weston_view_move_to_layer() for background
Use the new layer-move helper for our background.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Daniel Stone
8255c49a1f kiosk-shell: Use weston_view_move_to_layer() for activation
When we're switching between different active surfaces, use the new
weston_view_move_to_layer() helper.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-26 15:49:50 +00:00
Derek Foreman
aea5ca97ae kiosk-shell: Use weston_coord for grabs
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman
2ac566d281 libweston: Add more weston_coord arithmetic helpers
Until now we've only had the unadorned arithmetic functions, but they're
easy to abuse and tedious to use.

For now, we just add weston_coord_global_add/sub functions and use them
where appropriate.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman
d961e59d4a libweston: Add getters for view position/offset
This is stored as an unadorned weston_coord internally, but with getter
functions we can put together the appropriate global or surface
coordinate.

Use them where appropriate.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman
1f81c082b5 libweston: Add weston_coord_truncate()
Truncating a weston coord to integer values is something we do
frequently enough to warrant a helper function.

Use this in the kiosk and desktop shells where appropriate.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman
0bf2d82e0c libweston: Use weston_coord in struct weston_touch
Convert the grab coordinate to a weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:58:17 -05:00
Derek Foreman
e8208d21d7 libweston: Use weston_coord in struct weston_output
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:55:22 -05:00
Derek Foreman
244dc963b9 libweston: use weston_coord for weston_view_set_position
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:55:19 -05:00
Derek Foreman
5e353d523f libweston: Use weston_coord in struct weston_view
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman
583fbcda3b libweston: Use weston_coord in struct weston_pointer
Convert the bare x,y coordinates into struct weston_coord and update all
users.

We keep the surface position in wl_fixed_t for now so it still exactly
matches the position most recently sent to clients.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman
64d9270804 libweston: Use weston_coord space conversion functions
Update users of the old coordinate space conversion functions that take
x, y pairs to the new weston_coord versions.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Marius Vlad
6293ab1f90 libweston, shared: Move out weston_shell_get_binding_modifier
This doesn't really belong into shell-utils,  so better move it out to
shared/config-parser. Renamed to weston_config_get_binding_modifier
to maintain the same namespace.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-01-09 22:13:07 +00:00
Marius Vlad
19d32da742 shell-utils: Integrate shell-utils into libweston
These shell utils functions are potentially useful to other shells as
well, so make them widely available.

Renamed all functions to weston_shell_utils namespace.

No functional change, copied ad litteram.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-01-09 22:13:07 +00:00
Alexandros Frantzis
723709aa07 kiosk-shell: Don't use a modifier for surface activation bindings
The mouse button and touch bindings to activate a surface shouldn't
use the binding modifier.

Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/679

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2022-10-21 15:19:18 +03:00
Alexandros Frantzis
341d09d232 kiosk-shell: Update view transform after activation.
The activation of a view implies, among other things, a change in the
associated view layer which is initially unset. In order for this change
to be reflected in the corresponding surface's output mask, and hence
allow surface damage to trigger output repaints, we need to update the
view transform.

Fixes #674

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2022-10-11 14:04:42 +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
Marius Vlad
f7ba35f5fc kiosk-shell: Enable debug keybindings
We are missing debug keybinds in kiosk-shell so install them. Adds
the binding-modifier like in desktop-shell in a helper.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-08-08 14:22:31 +00:00
Derek Foreman
d615abdffd shells: Add libweston-desktop API to query position and add to shells
We're going to need this to properly send xwayland events later, so add
API to get the current x,y co-ordinates of a shell surface and add it to
the kiosk and desktop shells.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-29 11:44:48 +00:00
Daniel Stone
9336263d9b Move libweston-desktop into libweston
It's not really useful to have libweston without libweston-desktop. It's
also very little code.

Merging both into the same DSO will allow us to cut out a bunch of
indirection and pain.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-28 10:35:52 +00:00
Daniel Stone
3ed3700ca3 kiosk-shell: Don't link desktop-shell protocols
We don't need these.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-28 10:35:52 +00:00
Daniel Stone
19744a5207 weston-curtain: Always mark surface as mapped
The surface always has valid content, hence it can always be mapped.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-16 12:17:15 +03:00
Daniel Stone
0c69688aa2 libweston: Add weston_surface_map() wrapper
Change all instances of surface->is_mapped = true, to a specialised
function.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-16 12:17:15 +03:00
Daniel Stone
6cb2526b67 Move shell-utils to its own directory
shell-utils contains a number of helpers which are currently in use by
both desktop-shell and kiosk-shell. In order to extend this use to
fullscreen-shell as well (which can benefit from reusing the
weston_curtain infrastructure to be able to create solid-colour views
which may or may not be opaque, as well as one function within
fullscreen-shell which was copied wholesale to shell-utils), we need to
create a separate Meson dependency object, and avoid the existing
pattern of including the source from shared/ within the source list for
each shell.

This requires creating a new top-level directory for these shared helper
functions which are required by each shell, but are not part of
libweston in and of itself.

shell-utils depends on libweston-desktop; libweston-desktop depends on
libweston; libweston depends on shared.

Thus it is not possible to expose a dependency object from the shared/
directory which declares a dependency on the libweston-desktop
dependency, as Meson processes directories in order and resolves
variable references as they are parsed.

In order to break this deadlock, this commit creates a new top-level
directory called 'shell-utils' containing only this file, which can be
parsed by Meson after libweston-desktop (making the libweston-desktop
Meson dependency variable available to the build file to declare a
dependency on that), but before the shells (making the new Meson
depenendency object available to each shell which wishes to use it).

This commit contains no functional changes to any observable code.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00: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
Daniel Stone
bd9b0676dd shell: Make input capture optional for curtains
desktop-shell's focus surfaces want to reuse this, but they don't want
to capture the input, instead allowing it to fall through.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone
e81b8d7cc9 shell: Add alpha to weston_curtain_create
Not all solid-colour views want to be opaque: sometimes we use them with
non-opaque alpha values in order to shade views underneath them.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone
d21563360a shell: Move weston_curtain_create params into the struct
Given that we have a struct for argument params, we might as well use it
rather than have them split between the struct and native params. For
consistency between the implementations, this also includes a shift from
float to int positioning for the base offset within the compositor's
global co-ordinate space.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone
3a298b0b05 shell: Rename weston_solid_color_surface to weston_curtain_params
The name implied that it was a surface in and of itself, rather than
parameters used by a helper to create a surface and view.

Rename it now that we have weston_curtain as a name, and clean up
initialisers.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone
b77c2374ee shell: Rename solid_color_surface to weston_curtain
create_solid_color_surface actually returns a weston_view that it
creates internally. Since weston_solid_color_view is long and dull,
rename it to weston_curtain.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Marius Vlad
f3221832c5 kiosk-shell: Favor out views on same output
In multiple output cases, finding the succesor from the inactive layer
might result in picking the wrong view when there are multiple views
being stacked in the inactive layer. This adds two additional checks to
favor views on the same output as the one being destroyed/removed.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-02-03 15:37:03 +00:00
Marius Vlad
f3ad593925 kiosk-shell: Don't occlude shsurf on other outputs
This adds an additional check to make sure the current focus surface
is on the same output as the surface that is going to be activated.

This is necessary in order to avoid placing the currently focused one in
the inactive layer, which shouldn't happen in situations where the new
surface is going to be placed on a different output than the currently
focused one.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-02-03 15:37:03 +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
c3f7a496a6 kiosk-shell: Do not leave views on layers on shell destroy
Nothing special, but avoids hitting the warning about
terminating/finishing a layer with views on it.

Fixes #509.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-12-17 11:08:26 +02: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
f886311353 kiosk-shell: ignore additional seats
As kiosk-shell can't cope with multiple seat add a warning and avoid
creating any new seats. With it, this guards against potentially
receiving an invalid seat.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-12 15:58:43 +02:00
Marius Vlad
79cf52e556 kiosk-shell: Handle child top-level windows at destruction
With the seperation of surface activation and keyboard input, a special
corner case arose for child top-level windows when surfaces are being
destroyed. To make sure we never pick the wrong window to activate upon
destruction, we verify if the current focused surface is different than
the one being destroyed.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-12 15:22:53 +02:00
Marius Vlad
365f445eab kiosk-shell: Embed keyboard focus activation code
Just like desktop-shell, we shouldn't be dependent on having a keyboard
be present in order to activate a window/surface.

This adds a libweston helper to retrieve the first available seat, and
to use it in order to avoid going over the seat list.

We also encapsulate the activation of the surface in one place, and use
it on surface removal, when the surface has been committed, or for
touch/pointer events. With it we also deal with the keyboard focus and
shell activation in one place.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-12 15:22:50 +02:00
Marius Vlad
b5dbb7a7ab kiosk-shell: Allow to retrieve surface labels
Nothing special, but allows scene-graph to display surface labels.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-02 19:32:55 +02:00
Marius Vlad
2be09373b4 desktop-shell, kiosk-shell: Migrate helpers to create a view to shell-utils
Incidentally fixes #553

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-02 19:32:24 +02:00
Marius Vlad
d98c7e86fb shared/shell-utils: Create common helpers functions for shells
Group common functions found in both kiosk-shell and deskop-shell to
a shared utils file.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-02 19:29:50 +02:00
Marius Vlad
d6ccc8b025 libweston: Rename weston_view_activate() to weston_view_activate_input()
This way, we try to differentiate between input focus and window/surface
activation.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-02 19:04:33 +02:00
Marius Vlad
11bc0d0428 kiosk-shell: Swap green with blue for the background-color
Fix a trivial typo, where the green channel was swapped with the blue
channel, resulting in rbg instead of rgb.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-01 19:57:32 +02:00
Pekka Paalanen
91147c6e80 kiosk-shell: call weston_layer_fini()
This ensures the layers are torn down properly.

See commit: libweston: add weston_layer_fini()

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-28 13:38:28 +03: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