]> git.mdlowis.com Git - proto/labwc.git/commitdiff
region: Add output pointer to struct region
authorJohn Lindgren <john@jlindgren.net>
Thu, 16 Feb 2023 17:01:23 +0000 (12:01 -0500)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Fri, 17 Feb 2023 03:47:15 +0000 (04:47 +0100)
include/regions.h
src/regions.c

index 7324255206eb6e4a93551b1a78effa83e6136fd8..3b294a99e36b82e494308d03002876ea98a79016 100644 (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;
index 8587055a6d40d805bd7a8c71682bda3a0036f1cb..2f19e09e1ac687a6bc4c9d7da50a786d55119acf 100644 (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) {
-                               view_evacuate_region(view);
-                               break;
-                       }
+               if (view->tiled_region && view->tiled_region->output == output) {
+                       view_evacuate_region(view);
                }
        }
 }