layout: Move toggle_fullscreen() impl to Workspace
Browse files at this commit965619d0964973966bbd1d9d8087d1e8e8ff4867Parent: 9f017e82 changed files +6 -14
- src/layout/scrolling.rs +0 -10
- src/layout/workspace.rs +6 -4
src/layout/scrolling.rsmodified+0 -10
| @@ -2140,16 +2140,6 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 2140 | } | 2140 | } |
| 2141 | } | 2141 | } |
| 2142 | 2142 | ||
| 2143 | - pub fn toggle_fullscreen(&mut self, window: &W::Id) { | ||
| 2144 | - let col = self | ||
| 2145 | - .columns | ||
| 2146 | - .iter_mut() | ||
| 2147 | - .find(|col| col.contains(window)) | ||
| 2148 | - .unwrap(); | ||
| 2149 | - let value = !col.is_fullscreen; | ||
| 2150 | - self.set_fullscreen(window, value); | ||
| 2151 | - } | ||
| 2152 | - | ||
| 2153 | pub fn render_above_top_layer(&self) -> bool { | 2143 | pub fn render_above_top_layer(&self) -> bool { |
| 2154 | // Render above the top layer if we're on a fullscreen window and the view is stationary. | 2144 | // Render above the top layer if we're on a fullscreen window and the view is stationary. |
| 2155 | if self.columns.is_empty() { | 2145 | if self.columns.is_empty() { |
src/layout/workspace.rsmodified+6 -4
| @@ -985,10 +985,12 @@ impl<W: LayoutElement> Workspace<W> { | |||
| 985 | } | 985 | } |
| 986 | 986 | ||
| 987 | pub fn toggle_fullscreen(&mut self, window: &W::Id) { | 987 | pub fn toggle_fullscreen(&mut self, window: &W::Id) { |
| 988 | - if self.floating.has_window(window) { | 988 | + let tile = self |
| 989 | - self.toggle_window_floating(Some(window)); | 989 | + .tiles() |
| 990 | - } | 990 | + .find(|tile| tile.window().id() == window) |
| 991 | - self.scrolling.toggle_fullscreen(window); | 991 | + .unwrap(); |
| 992 | + let current = tile.window().is_pending_fullscreen(); | ||
| 993 | + self.set_fullscreen(window, !current); | ||
| 992 | } | 994 | } |
| 993 | 995 | ||
| 994 | pub fn toggle_window_floating(&mut self, id: Option<&W::Id>) { | 996 | pub fn toggle_window_floating(&mut self, id: Option<&W::Id>) { |