Remove clones from active_window

This commit is contained in:
Ivan Molodetskikh
2023-12-24 17:40:30 +04:00
parent be2e551a89
commit 85cb4b42f6
2 changed files with 3 additions and 6 deletions
+1 -1
View File
@@ -294,7 +294,7 @@ impl State {
let active = self.niri.layout.active_window();
if let Some((window, output)) = active {
if let Some(renderer) = self.backend.renderer() {
if let Err(err) = self.niri.screenshot_window(renderer, &output, &window) {
if let Err(err) = self.niri.screenshot_window(renderer, output, window) {
warn!("error taking screenshot: {err:?}");
}
}
+2 -5
View File
@@ -608,7 +608,7 @@ impl<W: LayoutElement> Layout<W> {
Some(&mon.workspaces[mon.active_workspace_idx])
}
pub fn active_window(&self) -> Option<(W, Output)> {
pub fn active_window(&self) -> Option<(&W, &Output)> {
let MonitorSet::Normal {
monitors,
active_monitor_idx,
@@ -626,10 +626,7 @@ impl<W: LayoutElement> Layout<W> {
}
let col = &ws.columns[ws.active_column_idx];
Some((
col.windows[col.active_window_idx].clone(),
mon.output.clone(),
))
Some((&col.windows[col.active_window_idx], &mon.output))
}
pub fn windows_for_output(&self, output: &Output) -> impl Iterator<Item = &W> + '_ {