Backgrounds no longer clobber older backgrounds
@@ -8,8 +8,6 @@ use uuid::Uuid;
use rustwlc::{Point, ResizeEdge, WlcView, WlcOutput, ViewType};
use rustc_serialize::json::{Json, ToJson};
-use std::collections::HashSet;
-
pub type CommandResult = Result<(), TreeError>;
/* These commands are exported to take nothing and return nothing,
@@ -250,21 +248,16 @@ impl Tree {
/// If there was a previous background, it is removed and deallocated.
pub fn add_background(&mut self, view: WlcView) -> CommandResult {
let outputs = self.0.tree.children_of(self.0.tree.root_ix());
- let mut to_remove = HashSet::with_capacity(outputs.len());
for output_ix in outputs {
match self.0.tree[output_ix] {
Container::Output { ref mut background, .. } => {
- if let Some(view) = background.take() {
- to_remove.insert(view);
- }
+ if background.is_none() {
*background = Some(view);
+ }
},
_ => unreachable!()
}
}
- for view in to_remove {
- view.close();
- }
Ok(())
}
