Remove clones from active_window
Browse files at this commit85cb4b42f6f0f1b445957381f8ec65571ece2ad5Parent: be2e5512 changed files +3 -6
- src/input.rs +1 -1
- src/layout/mod.rs +2 -5
src/input.rsmodified+1 -1
| @@ -294,7 +294,7 @@ impl State { | |||
| 294 | let active = self.niri.layout.active_window(); | 294 | let active = self.niri.layout.active_window(); |
| 295 | if let Some((window, output)) = active { | 295 | if let Some((window, output)) = active { |
| 296 | if let Some(renderer) = self.backend.renderer() { | 296 | if let Some(renderer) = self.backend.renderer() { |
| 297 | - if let Err(err) = self.niri.screenshot_window(renderer, &output, &window) { | 297 | + if let Err(err) = self.niri.screenshot_window(renderer, output, window) { |
| 298 | warn!("error taking screenshot: {err:?}"); | 298 | warn!("error taking screenshot: {err:?}"); |
| 299 | } | 299 | } |
| 300 | } | 300 | } |
src/layout/mod.rsmodified+2 -5
| @@ -608,7 +608,7 @@ impl<W: LayoutElement> Layout<W> { | |||
| 608 | Some(&mon.workspaces[mon.active_workspace_idx]) | 608 | Some(&mon.workspaces[mon.active_workspace_idx]) |
| 609 | } | 609 | } |
| 610 | 610 | ||
| 611 | - pub fn active_window(&self) -> Option<(W, Output)> { | 611 | + pub fn active_window(&self) -> Option<(&W, &Output)> { |
| 612 | let MonitorSet::Normal { | 612 | let MonitorSet::Normal { |
| 613 | monitors, | 613 | monitors, |
| 614 | active_monitor_idx, | 614 | active_monitor_idx, |
| @@ -626,10 +626,7 @@ impl<W: LayoutElement> Layout<W> { | |||
| 626 | } | 626 | } |
| 627 | 627 | ||
| 628 | let col = &ws.columns[ws.active_column_idx]; | 628 | let col = &ws.columns[ws.active_column_idx]; |
| 629 | - Some(( | 629 | + Some((&col.windows[col.active_window_idx], &mon.output)) |
| 630 | - col.windows[col.active_window_idx].clone(), | ||
| 631 | - mon.output.clone(), | ||
| 632 | - )) | ||
| 633 | } | 630 | } |
| 634 | 631 | ||
| 635 | pub fn windows_for_output(&self, output: &Output) -> impl Iterator<Item = &W> + '_ { | 632 | pub fn windows_for_output(&self, output: &Output) -> impl Iterator<Item = &W> + '_ { |