layout: Rename update_interactive_resize() to on_commit()
Browse files at this commit38350935e6f92c2db90faaf059b851f8158e32c2Parent: 421cd895 changed files +11 -10
- niri-visual-tests/src/test_window.rs +1 -1
- src/layout/floating.rs +1 -1
- src/layout/mod.rs +3 -2
- src/layout/scrolling.rs +1 -1
- src/window/mapped.rs +5 -5
niri-visual-tests/src/test_window.rsmodified+1 -1
| @@ -263,7 +263,7 @@ impl LayoutElement for TestWindow { | |||
| 263 | 263 | ||
| 264 | fn cancel_interactive_resize(&mut self) {} | 264 | fn cancel_interactive_resize(&mut self) {} |
| 265 | 265 | ||
| 266 | - fn update_interactive_resize(&mut self, _serial: Serial) {} | 266 | + fn on_commit(&mut self, _serial: Serial) {} |
| 267 | 267 | ||
| 268 | fn interactive_resize_data(&self) -> Option<InteractiveResizeData> { | 268 | fn interactive_resize_data(&self) -> Option<InteractiveResizeData> { |
| 269 | None | 269 | None |
src/layout/floating.rsmodified+1 -1
| @@ -752,7 +752,7 @@ impl<W: LayoutElement> FloatingSpace<W> { | |||
| 752 | 752 | ||
| 753 | // Do this before calling update_window() so it can get up-to-date info. | 753 | // Do this before calling update_window() so it can get up-to-date info. |
| 754 | if let Some(serial) = serial { | 754 | if let Some(serial) = serial { |
| 755 | - tile.window_mut().update_interactive_resize(serial); | 755 | + tile.window_mut().on_commit(serial); |
| 756 | } | 756 | } |
| 757 | 757 | ||
| 758 | let prev_size = data.size; | 758 | let prev_size = data.size; |
src/layout/mod.rsmodified+3 -2
| @@ -198,8 +198,9 @@ pub trait LayoutElement { | |||
| 198 | 198 | ||
| 199 | fn set_interactive_resize(&mut self, data: Option<InteractiveResizeData>); | 199 | fn set_interactive_resize(&mut self, data: Option<InteractiveResizeData>); |
| 200 | fn cancel_interactive_resize(&mut self); | 200 | fn cancel_interactive_resize(&mut self); |
| 201 | - fn update_interactive_resize(&mut self, serial: Serial); | ||
| 202 | fn interactive_resize_data(&self) -> Option<InteractiveResizeData>; | 201 | fn interactive_resize_data(&self) -> Option<InteractiveResizeData>; |
| 202 | + | ||
| 203 | + fn on_commit(&mut self, serial: Serial); | ||
| 203 | } | 204 | } |
| 204 | 205 | ||
| 205 | #[derive(Debug)] | 206 | #[derive(Debug)] |
| @@ -4076,7 +4077,7 @@ mod tests { | |||
| 4076 | 4077 | ||
| 4077 | fn cancel_interactive_resize(&mut self) {} | 4078 | fn cancel_interactive_resize(&mut self) {} |
| 4078 | 4079 | ||
| 4079 | - fn update_interactive_resize(&mut self, _serial: Serial) {} | 4080 | + fn on_commit(&mut self, _serial: Serial) {} |
| 4080 | 4081 | ||
| 4081 | fn interactive_resize_data(&self) -> Option<InteractiveResizeData> { | 4082 | fn interactive_resize_data(&self) -> Option<InteractiveResizeData> { |
| 4082 | None | 4083 | None |
src/layout/scrolling.rsmodified+1 -1
| @@ -1071,7 +1071,7 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 1071 | 1071 | ||
| 1072 | // Do this before calling update_window() so it can get up-to-date info. | 1072 | // Do this before calling update_window() so it can get up-to-date info. |
| 1073 | if let Some(serial) = serial { | 1073 | if let Some(serial) = serial { |
| 1074 | - tile.window_mut().update_interactive_resize(serial); | 1074 | + tile.window_mut().on_commit(serial); |
| 1075 | } | 1075 | } |
| 1076 | 1076 | ||
| 1077 | let prev_width = self.data[col_idx].width; | 1077 | let prev_width = self.data[col_idx].width; |
src/window/mapped.rsmodified+5 -5
| @@ -766,7 +766,11 @@ impl LayoutElement for Mapped { | |||
| 766 | self.interactive_resize = None; | 766 | self.interactive_resize = None; |
| 767 | } | 767 | } |
| 768 | 768 | ||
| 769 | - fn update_interactive_resize(&mut self, commit_serial: Serial) { | 769 | + fn interactive_resize_data(&self) -> Option<InteractiveResizeData> { |
| 770 | + Some(self.interactive_resize.as_ref()?.data()) | ||
| 771 | + } | ||
| 772 | + | ||
| 773 | + fn on_commit(&mut self, commit_serial: Serial) { | ||
| 770 | if let Some(InteractiveResize::WaitingForLastCommit { serial, .. }) = | 774 | if let Some(InteractiveResize::WaitingForLastCommit { serial, .. }) = |
| 771 | &self.interactive_resize | 775 | &self.interactive_resize |
| 772 | { | 776 | { |
| @@ -775,8 +779,4 @@ impl LayoutElement for Mapped { | |||
| 775 | } | 779 | } |
| 776 | } | 780 | } |
| 777 | } | 781 | } |
| 778 | - | ||
| 779 | - fn interactive_resize_data(&self) -> Option<InteractiveResizeData> { | ||
| 780 | - Some(self.interactive_resize.as_ref()?.data()) | ||
| 781 | - } | ||
| 782 | } | 782 | } |