diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-01 19:00:11 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-05-01 19:00:19 +0400 |
| commit | 365dbacae7ed9b6dcee2c9a9281e9a531b842007 (patch) | |
| tree | 5341d8e18b63f8ce30e721ef79c3524fc34b1834 /src/layout/mod.rs | |
| parent | af9caa1d9b176fe3606323a8c05c0c741c1f6c0a (diff) | |
| download | niri-365dbacae7ed9b6dcee2c9a9281e9a531b842007.tar.gz niri-365dbacae7ed9b6dcee2c9a9281e9a531b842007.tar.bz2 niri-365dbacae7ed9b6dcee2c9a9281e9a531b842007.zip | |
Move unmap snapshot from Mapped to Tile
Diffstat (limited to 'src/layout/mod.rs')
| -rw-r--r-- | src/layout/mod.rs | 54 |
1 files changed, 48 insertions, 6 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 4889e9a7..5ca48ad6 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -140,8 +140,6 @@ pub trait LayoutElement { /// Runs periodic clean-up tasks. fn refresh(&self); - fn take_unmap_snapshot(&self) -> Option<LayoutElementRenderSnapshot>; - fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot>; fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot>; } @@ -1749,6 +1747,54 @@ impl<W: LayoutElement> Layout<W> { } } + pub fn store_unmap_snapshot(&mut self, renderer: &mut GlesRenderer, window: &W::Id) { + let _span = tracy_client::span!("Layout::store_unmap_snapshot"); + + match &mut self.monitor_set { + MonitorSet::Normal { monitors, .. } => { + for mon in monitors { + for ws in &mut mon.workspaces { + if ws.has_window(window) { + ws.store_unmap_snapshot_if_empty(renderer, window); + return; + } + } + } + } + MonitorSet::NoOutputs { workspaces, .. } => { + for ws in workspaces { + if ws.has_window(window) { + ws.store_unmap_snapshot_if_empty(renderer, window); + return; + } + } + } + } + } + + pub fn clear_unmap_snapshot(&mut self, window: &W::Id) { + match &mut self.monitor_set { + MonitorSet::Normal { monitors, .. } => { + for mon in monitors { + for ws in &mut mon.workspaces { + if ws.has_window(window) { + ws.clear_unmap_snapshot(window); + return; + } + } + } + } + MonitorSet::NoOutputs { workspaces, .. } => { + for ws in workspaces { + if ws.has_window(window) { + ws.clear_unmap_snapshot(window); + return; + } + } + } + } + } + pub fn start_close_animation_for_window( &mut self, renderer: &mut GlesRenderer, @@ -1996,10 +2042,6 @@ mod tests { &EMPTY } - fn take_unmap_snapshot(&self) -> Option<LayoutElementRenderSnapshot> { - None - } - fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot> { None } |
