region: Add output pointer to struct region

This commit is contained in:
John Lindgren 2023-02-16 12:01:23 -05:00 committed by Consolatis
parent e0388ba8bf
commit fe7edf82d9
2 changed files with 4 additions and 7 deletions

View file

@ -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;

View file

@ -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, &region_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) {
if (view->tiled_region && view->tiled_region->output == output) {
view_evacuate_region(view);
break;
}
}
}
}