From 3b2668272eab40a3560ce9a15dd2d07b3b5263df Mon Sep 17 00:00:00 2001 From: lars-berger Date: Tue, 3 Dec 2024 02:21:44 +0800 Subject: [PATCH] fix: prevent moving tiling windows with mouse from affecting hidden workspaces --- .../common/events/handle_window_moved_or_resized_end.rs | 2 +- packages/wm/src/wm_state.rs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/wm/src/common/events/handle_window_moved_or_resized_end.rs b/packages/wm/src/common/events/handle_window_moved_or_resized_end.rs index ee482662..cb5f73c6 100644 --- a/packages/wm/src/common/events/handle_window_moved_or_resized_end.rs +++ b/packages/wm/src/common/events/handle_window_moved_or_resized_end.rs @@ -107,7 +107,7 @@ fn drop_as_tiling_window( // Get the workspace, split containers, and other windows under the // dragged window. let containers_at_pos = state - .containers_at_point(&mouse_pos) + .containers_at_point(workspace.clone().into(), &mouse_pos) .into_iter() .filter(|container| container.id() != moved_window.id()); diff --git a/packages/wm/src/wm_state.rs b/packages/wm/src/wm_state.rs index 85e0a0f9..9e8f7562 100644 --- a/packages/wm/src/wm_state.rs +++ b/packages/wm/src/wm_state.rs @@ -502,9 +502,12 @@ impl WmState { .or(Some(workspace.into())) } - pub fn containers_at_point(&self, point: &Point) -> Vec { - self - .root_container + pub fn containers_at_point( + &self, + origin_container: Container, + point: &Point, + ) -> Vec { + origin_container .descendants() .filter(|descendant| { descendant