summaryrefslogtreecommitdiff
path: root/gui-wm/wayfire/files/wayfire-0.11.0-r86-fill-monitor.patch
blob: 5dabef126052d7cb2b224a2918d4c03864c43a85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Pyr r86: when a monitor reservation changes (a drawer opens or closes), grid also re-fits a floating window that
exactly fills that monitor's area (placed or sized to fill it rather than maximized), keeping it floating; smaller
floating windows stay where they are. Grid only; WAYFIRE_ABI unchanged.

diff --git a/plugins/grid/grid.cpp b/plugins/grid/grid.cpp
index 4653bc0..7f6fef2 100644
--- a/plugins/grid/grid.cpp
+++ b/plugins/grid/grid.cpp
@@ -645,6 +645,8 @@ class wayfire_grid : public wf::plugin_interface_t, public wf::per_output_tracke
             }
 
             int slot = data ? data->slot : 0;
+            wf::pointf_t delta{std::floor(1.0 * wm.x / screen.width) * screen.width,
+                std::floor(1.0 * wm.y / screen.height) * screen.height};
             /* Maximized outside the grid plugin (for example when it opened maximized). */
             if (!slot && (view->pending_tiled_edges() == wf::TILED_EDGES_ALL) &&
                 (wm.width == ev->old_workarea.width) && (wm.height == ev->old_workarea.height))
@@ -652,9 +654,20 @@ class wayfire_grid : public wf::plugin_interface_t, public wf::per_output_tracke
                 slot = wf::grid::SLOT_CENTER;
             }
 
+            /* A floating window that exactly fills the monitor's area (placed or sized to fill it, not
+             * maximized) keeps filling it, and stays floating. */
+            if (!slot && !view->pending_tiled_edges() && (wm - delta == ev->old_workarea))
+            {
+                auto target = wf::monitor_workarea(output, ev->monitor) + delta;
+                if (target != wm)
+                {
+                    ensure_grid_view(view)->adjust_target_geometry(target, -1);
+                }
+
+                continue;
+            }
+
             if (!slot) continue;
-            wf::pointf_t delta{std::floor(1.0 * wm.x / screen.width) * screen.width,
-                std::floor(1.0 * wm.y / screen.height) * screen.height};
             if (slot_dimensions(view, slot) + delta != wm)
             {
                 handle_slot(view, slot, delta);