diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-11 08:26:49 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-11 08:26:49 +0400 |
| commit | 34bcc6ea9369fda19f4fb776e59f37e5dafc0051 (patch) | |
| tree | 01a93ed2c0e8e95ca3bad020dece55c45e71065d /src/window | |
| parent | 9dfa121b8e31082314d1c9347a60ef2e596494cb (diff) | |
| download | niri-34bcc6ea9369fda19f4fb776e59f37e5dafc0051.tar.gz niri-34bcc6ea9369fda19f4fb776e59f37e5dafc0051.tar.bz2 niri-34bcc6ea9369fda19f4fb776e59f37e5dafc0051.zip | |
Split get resize data from update
Diffstat (limited to 'src/window')
| -rw-r--r-- | src/window/mapped.rs | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/window/mapped.rs b/src/window/mapped.rs index e863e2ca..952a2bf3 100644 --- a/src/window/mapped.rs +++ b/src/window/mapped.rs @@ -77,6 +77,16 @@ enum InteractiveResize { }, } +impl InteractiveResize { + fn data(&self) -> InteractiveResizeData { + match self { + InteractiveResize::Ongoing(data) => *data, + InteractiveResize::WaitingForLastConfigure(data) => *data, + InteractiveResize::WaitingForLastCommit { data, .. } => *data, + } + } +} + impl Mapped { pub fn new(window: Window, rules: ResolvedWindowRules, hook: HookId) -> Self { Self { @@ -520,19 +530,17 @@ impl LayoutElement for Mapped { self.interactive_resize = None; } - fn interactive_resize_data(&mut self, commit_serial: Serial) -> Option<InteractiveResizeData> { - let resize = self.interactive_resize.as_ref()?; - match resize { - InteractiveResize::Ongoing(data) | InteractiveResize::WaitingForLastConfigure(data) => { - Some(*data) - } - InteractiveResize::WaitingForLastCommit { data, serial } => { - let rv = Some(*data); - if commit_serial.is_no_older_than(serial) { - self.interactive_resize = None; - } - rv + fn update_interactive_resize(&mut self, commit_serial: Serial) { + if let Some(InteractiveResize::WaitingForLastCommit { serial, .. }) = + &self.interactive_resize + { + if commit_serial.is_no_older_than(serial) { + self.interactive_resize = None; } } } + + fn interactive_resize_data(&self) -> Option<InteractiveResizeData> { + Some(self.interactive_resize.as_ref()?.data()) + } } |
