From fe7edf82d916dd39a92cf3b16cc50b34c95b111f Mon Sep 17 00:00:00 2001 From: John Lindgren Date: Thu, 16 Feb 2023 12:01:23 -0500 Subject: [PATCH] region: Add output pointer to struct region --- include/regions.h | 1 + src/regions.c | 10 +++------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/include/regions.h b/include/regions.h index 73242552..3b294a99 100644 --- a/include/regions.h +++ b/include/regions.h @@ -15,6 +15,7 @@ struct multi_rect; /* Double use: rcxml.c for config and output.c for usage */ struct region { struct wl_list link; /* struct rcxml.regions, struct output.regions */ + struct output *output; char *name; struct wlr_box geo; struct wlr_box percentage; diff --git a/src/regions.c b/src/regions.c index 8587055a..2f19e09e 100644 --- a/src/regions.c +++ b/src/regions.c @@ -164,6 +164,7 @@ regions_reconfigure_output(struct output *output) wl_list_for_each(region, &rc.regions, link) { struct region *region_new = znew(*region_new); /* Create a copy */ + region_new->output = output; region_new->name = xstrdup(region->name); region_new->percentage = region->percentage; wl_list_append(&output->regions, ®ion_new->link); @@ -214,14 +215,9 @@ regions_evacuate_output(struct output *output) { assert(output); struct view *view; - struct region *region; - wl_list_for_each(view, &output->server->views, link) { - wl_list_for_each(region, &output->regions, link) { - if (view->tiled_region == region) { - view_evacuate_region(view); - break; - } + if (view->tiled_region && view->tiled_region->output == output) { + view_evacuate_region(view); } } }