2020-04-21 18:23:37 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2020 Collabora, Ltd.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WESTON_KIOSK_SHELL_H
|
|
|
|
#define WESTON_KIOSK_SHELL_H
|
|
|
|
|
2022-06-30 12:59:45 +03:00
|
|
|
#include <libweston/desktop.h>
|
2020-04-21 18:23:37 +03:00
|
|
|
#include <libweston/libweston.h>
|
2021-03-26 16:55:05 +03:00
|
|
|
#include <libweston/config-parser.h>
|
2020-04-21 18:23:37 +03:00
|
|
|
|
|
|
|
struct kiosk_shell {
|
|
|
|
struct weston_compositor *compositor;
|
|
|
|
struct weston_desktop *desktop;
|
|
|
|
|
|
|
|
struct wl_listener destroy_listener;
|
|
|
|
struct wl_listener output_created_listener;
|
|
|
|
struct wl_listener output_resized_listener;
|
|
|
|
struct wl_listener output_moved_listener;
|
|
|
|
struct wl_listener seat_created_listener;
|
2021-03-24 13:47:07 +03:00
|
|
|
struct wl_listener transform_listener;
|
2020-04-21 18:23:37 +03:00
|
|
|
|
|
|
|
struct weston_layer background_layer;
|
|
|
|
struct weston_layer normal_layer;
|
2021-11-09 20:25:46 +03:00
|
|
|
struct weston_layer inactive_layer;
|
2020-04-21 18:23:37 +03:00
|
|
|
|
|
|
|
struct wl_list output_list;
|
2020-10-24 16:26:59 +03:00
|
|
|
struct wl_list seat_list;
|
2021-03-24 13:47:07 +03:00
|
|
|
|
|
|
|
const struct weston_xwayland_surface_api *xwayland_surface_api;
|
2021-03-26 16:55:05 +03:00
|
|
|
struct weston_config *config;
|
2024-05-22 12:51:18 +03:00
|
|
|
struct wl_listener session_listener;
|
2020-04-21 18:23:37 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct kiosk_shell_surface {
|
|
|
|
struct weston_desktop_surface *desktop_surface;
|
|
|
|
struct weston_view *view;
|
|
|
|
|
|
|
|
struct kiosk_shell *shell;
|
|
|
|
|
|
|
|
struct weston_output *output;
|
|
|
|
struct wl_listener output_destroy_listener;
|
|
|
|
|
|
|
|
struct wl_signal destroy_signal;
|
2023-05-26 19:29:10 +03:00
|
|
|
|
|
|
|
struct wl_signal parent_destroy_signal;
|
2020-04-21 18:23:37 +03:00
|
|
|
struct wl_listener parent_destroy_listener;
|
|
|
|
struct kiosk_shell_surface *parent;
|
|
|
|
|
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-05-26 02:54:03 +03:00
|
|
|
struct wl_list surface_tree_list;
|
|
|
|
struct wl_list surface_tree_link;
|
|
|
|
|
2020-04-21 18:23:37 +03:00
|
|
|
int focus_count;
|
|
|
|
|
|
|
|
int32_t last_width, last_height;
|
|
|
|
bool grabbed;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
bool is_set;
|
2022-02-08 19:43:05 +03:00
|
|
|
struct weston_coord_global pos;
|
2020-04-21 18:23:37 +03:00
|
|
|
} xwayland;
|
2021-04-30 21:53:16 +03:00
|
|
|
|
|
|
|
bool appid_output_assigned;
|
2020-04-21 18:23:37 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct kiosk_shell_seat {
|
|
|
|
struct weston_seat *seat;
|
|
|
|
struct wl_listener seat_destroy_listener;
|
|
|
|
struct weston_surface *focused_surface;
|
|
|
|
|
2020-10-24 16:26:59 +03:00
|
|
|
struct wl_list link; /** kiosk_shell::seat_list */
|
2020-04-21 18:23:37 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct kiosk_shell_output {
|
|
|
|
struct weston_output *output;
|
|
|
|
struct wl_listener output_destroy_listener;
|
2022-01-17 17:24:03 +03:00
|
|
|
struct weston_curtain *curtain;
|
2020-04-21 18:23:37 +03:00
|
|
|
|
|
|
|
struct kiosk_shell *shell;
|
|
|
|
struct wl_list link;
|
|
|
|
|
|
|
|
char *app_ids;
|
2023-08-03 15:52:02 +03:00
|
|
|
char *x11_wm_name_app_ids;
|
|
|
|
char *x11_wm_class_app_ids;
|
2023-05-27 01:00:41 +03:00
|
|
|
|
|
|
|
struct wl_list *active_surface_tree;
|
2020-04-21 18:23:37 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* WESTON_KIOSK_SHELL_H */
|