]> git.mdlowis.com Git - proto/labwc.git/commitdiff
view: Set output prior to view_apply_tiled_geometry()
authorJohn Lindgren <john@jlindgren.net>
Mon, 20 Feb 2023 21:14:27 +0000 (16:14 -0500)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sun, 5 Mar 2023 08:44:03 +0000 (08:44 +0000)
src/view.c

index 182402fcc8d1d37d058dd61b5ee71b5b019a3b73..bcf8e20c586348b9a27c8e700e988100214392f0 100644 (file)
@@ -432,13 +432,11 @@ view_apply_region_geometry(struct view *view)
 }
 
 static void
-view_apply_tiled_geometry(struct view *view, struct output *output)
+view_apply_tiled_geometry(struct view *view)
 {
        assert(view->tiled);
-       if (!output) {
-               output = view_output(view);
-       }
-       if (!output) {
+       struct output *output = view_output(view);
+       if (!output_is_usable(output)) {
                wlr_log(WLR_ERROR, "Can't tile: no output");
                return;
        }
@@ -506,7 +504,7 @@ view_apply_special_geometry(struct view *view)
        } else if (view->maximized) {
                view_apply_maximized_geometry(view);
        } else if (view->tiled) {
-               view_apply_tiled_geometry(view, NULL);
+               view_apply_tiled_geometry(view);
        } else if (view->tiled_region || view->tiled_region_evacuate) {
                view_apply_region_geometry(view);
        } else {
@@ -879,7 +877,7 @@ view_snap_to_edge(struct view *view, const char *direction,
                return;
        }
        struct output *output = view_output(view);
-       if (!output) {
+       if (output_is_usable(output)) {
                wlr_log(WLR_ERROR, "no output");
                return;
        }
@@ -918,6 +916,10 @@ view_snap_to_edge(struct view *view, const char *direction,
                        /* Move to next output */
                        edge = view_edge_invert(edge);
                        output = output_from_wlr_output(view->server, new_output);
+                       if (!output_is_usable(output)) {
+                               wlr_log(WLR_ERROR, "invalid output in layout");
+                               return;
+                       }
                } else {
                        /*
                         * No more output to move to
@@ -934,7 +936,7 @@ view_snap_to_edge(struct view *view, const char *direction,
                         *       caused by a keybind but doesn't make sense
                         *       when caused by mouse movement.
                         */
-                       view_apply_tiled_geometry(view, output);
+                       view_apply_tiled_geometry(view);
                        return;
                }
        }
@@ -947,8 +949,9 @@ view_snap_to_edge(struct view *view, const char *direction,
                view_store_natural_geometry(view);
        }
        view_set_untiled(view);
+       view->output = output;
        view->tiled = edge;
-       view_apply_tiled_geometry(view, output);
+       view_apply_tiled_geometry(view);
 }
 
 void