aboutsummaryrefslogtreecommitdiff
path: root/src/layout
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-05-11 08:26:49 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-05-11 08:26:49 +0400
commit34bcc6ea9369fda19f4fb776e59f37e5dafc0051 (patch)
tree01a93ed2c0e8e95ca3bad020dece55c45e71065d /src/layout
parent9dfa121b8e31082314d1c9347a60ef2e596494cb (diff)
downloadniri-34bcc6ea9369fda19f4fb776e59f37e5dafc0051.tar.gz
niri-34bcc6ea9369fda19f4fb776e59f37e5dafc0051.tar.bz2
niri-34bcc6ea9369fda19f4fb776e59f37e5dafc0051.zip
Split get resize data from update
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/mod.rs7
-rw-r--r--src/layout/workspace.rs10
2 files changed, 11 insertions, 6 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index ad241d94..22aaa7fa 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -176,7 +176,8 @@ pub trait LayoutElement {
fn set_interactive_resize(&mut self, data: Option<InteractiveResizeData>);
fn cancel_interactive_resize(&mut self);
- fn interactive_resize_data(&mut self, serial: Serial) -> Option<InteractiveResizeData>;
+ fn update_interactive_resize(&mut self, serial: Serial);
+ fn interactive_resize_data(&self) -> Option<InteractiveResizeData>;
}
#[derive(Debug)]
@@ -2209,7 +2210,9 @@ mod tests {
fn cancel_interactive_resize(&mut self) {}
- fn interactive_resize_data(&mut self, _serial: Serial) -> Option<InteractiveResizeData> {
+ fn update_interactive_resize(&mut self, _serial: Serial) {}
+
+ fn interactive_resize_data(&self) -> Option<InteractiveResizeData> {
None
}
}
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs
index 1b6b14ff..a069abbf 100644
--- a/src/layout/workspace.rs
+++ b/src/layout/workspace.rs
@@ -1189,13 +1189,15 @@ impl<W: LayoutElement> Workspace<W> {
let tile = &mut col.tiles[tile_idx];
let window = tile.window_mut();
- let resize = serial.and_then(|serial| window.interactive_resize_data(serial));
+ let resize = window.interactive_resize_data();
+
+ if let Some(serial) = serial {
+ window.update_interactive_resize(serial);
+ }
// If this was the last resize commit, this function will now return None. This way we
// can animate the window into view after the last resize commit.
- let resize_still_ongoing = serial
- .and_then(|serial| window.interactive_resize_data(serial))
- .is_some();
+ let resize_still_ongoing = window.interactive_resize_data().is_some();
if let Some(resize) = resize {
// If this is an interactive resize commit of an active window, then we need to