aboutsummaryrefslogtreecommitdiff
path: root/src/layout/floating.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-12-23 08:52:45 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-12-30 20:12:37 +0300
commit309bf1348c67a81b99e7b3feef461584ca7cd423 (patch)
tree1ed31277ec20ef0fe806d05e71bdd3018ba26283 /src/layout/floating.rs
parent76a56352980fc9a646034c45e6f02093cc72fdb6 (diff)
downloadniri-309bf1348c67a81b99e7b3feef461584ca7cd423.tar.gz
niri-309bf1348c67a81b99e7b3feef461584ca7cd423.tar.bz2
niri-309bf1348c67a81b99e7b3feef461584ca7cd423.zip
floating: Improve expected size requests to avoid (0, 0) and duplicates
Diffstat (limited to 'src/layout/floating.rs')
-rw-r--r--src/layout/floating.rs16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/layout/floating.rs b/src/layout/floating.rs
index 5c0eb121..8c1840d4 100644
--- a/src/layout/floating.rs
+++ b/src/layout/floating.rs
@@ -376,7 +376,7 @@ impl<W: LayoutElement> FloatingSpace<W> {
} else {
// If the window wasn't fullscreen without a floating size (e.g. it was tiled before),
// ask for the current size.
- floating_size.unwrap_or_else(|| win.size_to_request())
+ floating_size.unwrap_or_else(|| win.expected_size())
};
// Make sure fixed-size through window rules keeps working.
let min_size = win.min_size();
@@ -597,11 +597,7 @@ impl<W: LayoutElement> FloatingSpace<W> {
win_width = ensure_min_max_size(win_width, min_size.w, max_size.w);
win_width = max(1, win_width);
- let mut win_height = win.size_to_request().h;
- // If we requested height = 0, then switch to the current height.
- if win_height == 0 {
- win_height = win.size().h;
- }
+ let win_height = win.expected_size().h;
let win_height = ensure_min_max_size(win_height, min_size.h, max_size.h);
let win_size = Size::from((win_width, win_height));
@@ -630,11 +626,7 @@ impl<W: LayoutElement> FloatingSpace<W> {
win_height = ensure_min_max_size(win_height, min_size.h, max_size.h);
win_height = max(1, win_height);
- let mut win_width = win.size_to_request().w;
- // If we requested width = 0, then switch to the current width.
- if win_width == 0 {
- win_width = win.size().w;
- }
+ let win_width = win.expected_size().w;
let win_width = ensure_min_max_size(win_width, min_size.w, max_size.w);
let win_size = Size::from((win_width, win_height));
@@ -771,7 +763,7 @@ impl<W: LayoutElement> FloatingSpace<W> {
data.update(tile);
// Update the stored floating window size.
- let floating_size = tile.window().size_to_request();
+ let floating_size = tile.window().expected_size();
tile.set_floating_window_size(floating_size);
// When resizing by top/left edge, update the position accordingly.