| 44 | } |
| 45 | |
| 46 | pub fn remove(&mut self, window: &Window) { |
| 47 | match self { |
| 48 | Dwindle::Empty => {} |
| 49 | Dwindle::Window(w) => { |
| 50 | if w.borrow().smithay_window == *window { |
| 51 | *self = Dwindle::Empty; |
| 52 | } |
| 53 | } |
| 54 | Dwindle::Split { left, right, split: _, ratio: _ } => { |
| 55 | if let Dwindle::Window(w) = left.as_ref() { |
| 56 | if w.borrow().smithay_window == *window { |
| 57 | *self = *right.clone(); |
| 58 | return; |
| 59 | } |
| 60 | } |
| 61 | if let Dwindle::Window(w) = right.as_ref() { |
| 62 | if w.borrow().smithay_window == *window { |
| 63 | *self = *left.clone(); |
| 64 | return; |
| 65 | } |
| 66 | } |
| 67 | left.remove(window); |
| 68 | right.remove(window); |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | pub fn next_split(&self) -> HorizontalOrVertical { |
| 74 | match self { |