From 9a579666068d62b9354a39941e1ac8c1f4a58093 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Thu, 18 Jan 2024 10:04:26 -0500 Subject: scene_graph: Port ext_session_v1 --- include/sway/output.h | 1 + include/sway/server.h | 25 ++++++++++++++++++------- include/sway/tree/root.h | 1 + 3 files changed, 20 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/sway/output.h b/include/sway/output.h index 28240819..8405f78d 100644 --- a/include/sway/output.h +++ b/include/sway/output.h @@ -24,6 +24,7 @@ struct sway_output { struct { struct wlr_scene_tree *tiling; struct wlr_scene_tree *fullscreen; + struct wlr_scene_tree *session_lock; } layers; // when a container is fullscreen, in case the fullscreen surface is diff --git a/include/sway/server.h b/include/sway/server.h index f3d25980..33ffbf09 100644 --- a/include/sway/server.h +++ b/include/sway/server.h @@ -28,6 +28,19 @@ struct sway_transaction; +struct sway_session_lock { + struct wlr_session_lock_v1 *lock; + struct wlr_surface *focused; + bool abandoned; + + struct wl_list outputs; // struct sway_session_lock_output + + // invalid if the session is abandoned + struct wl_listener new_surface; + struct wl_listener unlock; + struct wl_listener destroy; +}; + struct sway_server { struct wl_display *wl_display; struct wl_event_loop *wl_event_loop; @@ -92,15 +105,9 @@ struct sway_server { struct wl_listener gamma_control_set_gamma; struct { - bool locked; + struct sway_session_lock *lock; struct wlr_session_lock_manager_v1 *manager; - struct wlr_session_lock_v1 *lock; - struct wlr_surface *focused; - struct wl_listener lock_new_surface; - struct wl_listener lock_unlock; - struct wl_listener lock_destroy; - struct wl_listener new_lock; struct wl_listener manager_destroy; } session_lock; @@ -174,6 +181,10 @@ void handle_new_output(struct wl_listener *listener, void *data); void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); void handle_layer_shell_surface(struct wl_listener *listener, void *data); void sway_session_lock_init(void); +void sway_session_lock_add_output(struct sway_session_lock *lock, + struct sway_output *output); +bool sway_session_lock_has_surface(struct sway_session_lock *lock, + struct wlr_surface *surface); void handle_xdg_shell_toplevel(struct wl_listener *listener, void *data); #if HAVE_XWAYLAND void handle_xwayland_surface(struct wl_listener *listener, void *data); diff --git a/include/sway/tree/root.h b/include/sway/tree/root.h index 4b48a651..0aae8938 100644 --- a/include/sway/tree/root.h +++ b/include/sway/tree/root.h @@ -41,6 +41,7 @@ struct sway_root { struct wlr_scene_tree *fullscreen; struct wlr_scene_tree *fullscreen_global; struct wlr_scene_tree *seat; + struct wlr_scene_tree *session_lock; } layers; #if HAVE_XWAYLAND -- cgit v1.2.3