forge
Explore
Log in

Don't you dare go Hollow

Fix panic when interactively moving to invisible workspace

Browse files at this commit

d2a1cf53b496a24457986061f4d2f9e22ab4cd7eIvan MolodetskikhParent: 62d47d7
Introduced in the interactive move between workspaces commit.
src/layout/mod.rsmodified+3 -2
@@ -4444,7 +4444,8 @@ impl<W: LayoutElement> Layout<W> {
4444 let mon = &mut monitors[*active_monitor_idx];4444 let mon = &mut monitors[*active_monitor_idx];
4445 let zoom = mon.overview_zoom();4445 let zoom = mon.overview_zoom();
4446 // No point in trying to use the pointer position on the wrong output.4446 // No point in trying to use the pointer position on the wrong output.
4447- let (ws, ws_geo) = mon.workspaces_with_render_geo().next().unwrap();4447+ let ws = &mon.workspaces[0];
4448+ let ws_geo = mon.workspaces_render_geo().next().unwrap();
4448 4449
4449 let position = if move_.is_floating {4450 let position = if move_.is_floating {
4450 InsertPosition::Floating4451 InsertPosition::Floating
@@ -4552,7 +4553,7 @@ impl<W: LayoutElement> Layout<W> {
4552 4553
4553 // needed because empty_workspace_above_first could have modified the idx4554 // needed because empty_workspace_above_first could have modified the idx
4554 let (tile, tile_render_loc, ws_geo) = mon4555 let (tile, tile_render_loc, ws_geo) = mon
4555- .workspaces_with_render_geo_mut()4556+ .workspaces_with_render_geo_mut(false)
4556 .find_map(|(ws, geo)| {4557 .find_map(|(ws, geo)| {
4557 ws.tiles_with_render_positions_mut(false)4558 ws.tiles_with_render_positions_mut(false)
4558 .find(|(tile, _)| tile.window().id() == &win_id)4559 .find(|(tile, _)| tile.window().id() == &win_id)
src/layout/monitor.rsmodified+3 -2
@@ -906,7 +906,7 @@ impl<W: LayoutElement> Monitor<W> {
906 .as_ref()906 .as_ref()
907 .and_then(|hint| hint.workspace.existing_id());907 .and_then(|hint| hint.workspace.existing_id());
908 908
909- for (ws, geo) in self.workspaces_with_render_geo_mut() {909+ for (ws, geo) in self.workspaces_with_render_geo_mut(true) {
910 ws.update_render_elements(is_active);910 ws.update_render_elements(is_active);
911 911
912 if Some(ws.id()) == insert_hint_ws_id {912 if Some(ws.id()) == insert_hint_ws_id {
@@ -1308,13 +1308,14 @@ impl<W: LayoutElement> Monitor<W> {
1308 1308
1309 pub fn workspaces_with_render_geo_mut(1309 pub fn workspaces_with_render_geo_mut(
1310 &mut self,1310 &mut self,
1311+ cull: bool,
1311 ) -> impl Iterator<Item = (&mut Workspace<W>, Rectangle<f64, Logical>)> {1312 ) -> impl Iterator<Item = (&mut Workspace<W>, Rectangle<f64, Logical>)> {
1312 let output_geo = Rectangle::from_size(self.view_size);1313 let output_geo = Rectangle::from_size(self.view_size);
1313 1314
1314 let geo = self.workspaces_render_geo();1315 let geo = self.workspaces_render_geo();
1315 zip(self.workspaces.iter_mut(), geo)1316 zip(self.workspaces.iter_mut(), geo)
1316 // Cull out workspaces outside the output.1317 // Cull out workspaces outside the output.
1317- .filter(move |(_ws, geo)| geo.intersection(output_geo).is_some())1318+ .filter(move |(_ws, geo)| !cull || geo.intersection(output_geo).is_some())
1318 }1319 }
1319 1320
1320 pub fn workspace_under(1321 pub fn workspace_under(