shell: Don't refresh inactive workspaces

This commit is contained in:
Victoria Brekenfeld 2022-03-31 18:36:43 +02:00
parent 3bc58ec02a
commit 31510b8d42

View file

@ -369,7 +369,19 @@ impl Shell {
} }
pub fn refresh(&mut self) { pub fn refresh(&mut self) {
for workspace in &mut self.spaces { for output in self.outputs.iter() {
let workspace = match &self.mode {
Mode::OutputBound => {
let active = output
.user_data()
.get::<ActiveWorkspace>()
.unwrap()
.get()
.unwrap();
&mut self.spaces[active]
}
Mode::Global { active } => &mut self.spaces[*active],
};
workspace.refresh(); workspace.refresh();
} }
} }
@ -485,7 +497,8 @@ impl Shell {
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
for workspace in &self.spaces { for output in self.outputs() {
let workspace = self.active_space(output);
for window in workspace.space.windows() { for window in workspace.space.windows() {
window.set_activated(focused_windows.contains(window)); window.set_activated(focused_windows.contains(window));
window.configure(); window.configure();
@ -551,11 +564,11 @@ impl Common {
let workspace = self.shell.active_space(&output); let workspace = self.shell.active_space(&output);
if let Some(window) = workspace.space.window_for_surface(&surface) { if let Some(window) = workspace.space.window_for_surface(&surface) {
let focus_stack = workspace.focus_stack(&seat); let focus_stack = workspace.focus_stack(&seat);
if focus_stack.last().map(|w| &w == window).unwrap_or(false) { if focus_stack.last().map(|w| &w != window).unwrap_or(true) {
continue;
} else {
fixup = true; fixup = true;
} }
} else {
fixup = true;
} }
} else { } else {
fixup = true; fixup = true;