mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
Fix panic when interactively moving to invisible workspace
Introduced in the interactive move between workspaces commit.
This commit is contained in:
+3
-2
@@ -4444,7 +4444,8 @@ impl<W: LayoutElement> Layout<W> {
|
||||
let mon = &mut monitors[*active_monitor_idx];
|
||||
let zoom = mon.overview_zoom();
|
||||
// No point in trying to use the pointer position on the wrong output.
|
||||
let (ws, ws_geo) = mon.workspaces_with_render_geo().next().unwrap();
|
||||
let ws = &mon.workspaces[0];
|
||||
let ws_geo = mon.workspaces_render_geo().next().unwrap();
|
||||
|
||||
let position = if move_.is_floating {
|
||||
InsertPosition::Floating
|
||||
@@ -4552,7 +4553,7 @@ impl<W: LayoutElement> Layout<W> {
|
||||
|
||||
// needed because empty_workspace_above_first could have modified the idx
|
||||
let (tile, tile_render_loc, ws_geo) = mon
|
||||
.workspaces_with_render_geo_mut()
|
||||
.workspaces_with_render_geo_mut(false)
|
||||
.find_map(|(ws, geo)| {
|
||||
ws.tiles_with_render_positions_mut(false)
|
||||
.find(|(tile, _)| tile.window().id() == &win_id)
|
||||
|
||||
@@ -906,7 +906,7 @@ impl<W: LayoutElement> Monitor<W> {
|
||||
.as_ref()
|
||||
.and_then(|hint| hint.workspace.existing_id());
|
||||
|
||||
for (ws, geo) in self.workspaces_with_render_geo_mut() {
|
||||
for (ws, geo) in self.workspaces_with_render_geo_mut(true) {
|
||||
ws.update_render_elements(is_active);
|
||||
|
||||
if Some(ws.id()) == insert_hint_ws_id {
|
||||
@@ -1308,13 +1308,14 @@ impl<W: LayoutElement> Monitor<W> {
|
||||
|
||||
pub fn workspaces_with_render_geo_mut(
|
||||
&mut self,
|
||||
cull: bool,
|
||||
) -> impl Iterator<Item = (&mut Workspace<W>, Rectangle<f64, Logical>)> {
|
||||
let output_geo = Rectangle::from_size(self.view_size);
|
||||
|
||||
let geo = self.workspaces_render_geo();
|
||||
zip(self.workspaces.iter_mut(), geo)
|
||||
// Cull out workspaces outside the output.
|
||||
.filter(move |(_ws, geo)| geo.intersection(output_geo).is_some())
|
||||
.filter(move |(_ws, geo)| !cull || geo.intersection(output_geo).is_some())
|
||||
}
|
||||
|
||||
pub fn workspace_under(
|
||||
|
||||
Reference in New Issue
Block a user