]> git.mdlowis.com Git - proto/labwc.git/commitdiff
edges: only snap to neighbors on outputs containing the changing view
authorAndrew J. Hesford <ajh@sideband.org>
Thu, 1 Feb 2024 14:44:44 +0000 (09:44 -0500)
committerJohan Malm <johanmalm@users.noreply.github.com>
Thu, 1 Feb 2024 21:05:20 +0000 (21:05 +0000)
src/edges.c

index ad087bf4b1923b3c64f9d6b2caa7f9ee1a1aff1c..66325b1448d6a7b3bc64af22c9385596dede8ddb 100644 (file)
@@ -137,8 +137,10 @@ edges_find_neighbors(struct border *nearest_edges, struct view *view,
        struct border view_edges = { 0 };
        struct border target_edges = { 0 };
 
-       edges_for_target_geometry(&view_edges, view,
-               use_pending ? view->pending : view->current);
+       struct wlr_box *view_geom =
+               use_pending ? &view->pending : &view->current;
+
+       edges_for_target_geometry(&view_edges, view, *view_geom);
        edges_for_target_geometry(&target_edges, view, target);
 
        struct view *v;
@@ -151,6 +153,20 @@ edges_find_neighbors(struct border *nearest_edges, struct view *view,
                        continue;
                }
 
+               /*
+                * If view and v are on different outputs, make sure part of
+                * view is actually in the usable area of the output of v.
+                */
+               if (view->output != v->output) {
+                       struct wlr_box usable =
+                               output_usable_area_in_layout_coords(v->output);
+
+                       struct wlr_box ol;
+                       if (!wlr_box_intersection(&ol, view_geom, &usable)) {
+                               continue;
+                       }
+               }
+
                struct border border = ssd_get_margin(v->ssd);
 
                struct border win_edges = {