From e944e037517b79ae554157465fc1a601cfb1dd5b Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Mon, 26 Aug 2024 15:46:04 -0400 Subject: [PATCH] container: Assign container scene descriptor to view aswell We have to do with for fullscreen surfaces: Fullscreen surfaces technically aren't part of their container anymore visually (so the scene doesn't have it) but we want acknowledge the container it belongs to for input reasons. This will allow us to simplify node_at_coords later. --- sway/input/cursor.c | 8 -------- sway/tree/container.c | 1 + sway/tree/view.c | 2 ++ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index aeab558cb..c40a088bc 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -76,14 +76,6 @@ struct sway_node *node_at_coords( struct sway_container *con = scene_descriptor_try_get(current, SWAY_SCENE_DESC_CONTAINER); - if (!con) { - struct sway_view *view = scene_descriptor_try_get(current, - SWAY_SCENE_DESC_VIEW); - if (view) { - con = view->container; - } - } - if (!con) { struct sway_popup_desc *popup = scene_descriptor_try_get(current, SWAY_SCENE_DESC_POPUP); diff --git a/sway/tree/container.c b/sway/tree/container.c index af68e22fd..50a84c228 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -556,6 +556,7 @@ void container_destroy(struct sway_container *con) { if (con->view && con->view->container == con) { con->view->container = NULL; + scene_descriptor_destroy(&con->view->scene_tree->node, SWAY_SCENE_DESC_CONTAINER); wlr_scene_node_destroy(&con->output_handler->node); } diff --git a/sway/tree/view.c b/sway/tree/view.c index d4f72211b..4c026b045 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -750,6 +750,8 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, view->surface = wlr_surface; view_populate_pid(view); view->container = container_create(view); + scene_descriptor_assign(&view->scene_tree->node, + SWAY_SCENE_DESC_CONTAINER, view->container); if (view->ctx == NULL) { struct launcher_ctx *ctx = launcher_ctx_find_pid(view->pid);