GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
fix: prevent reparenting floating windows unnecessarily
Lars Berger35ed9dfa72cf
diff --git a/packages/wm/src/common/events/handle_window_location_changed.rs b/packages/wm/src/common/events/handle_window_location_changed.rsindex 0b1812d6..19e773a2 100644--- a/packages/wm/src/common/events/handle_window_location_changed.rs+++ b/packages/wm/src/common/events/handle_window_location_changed.rs@@ -87,6 +87,10 @@ pub fn handle_window_location_changed(state,config,)?;++ // A floating window that gets minimized can hit this arm, so+ // ignore such events and let it be handled by the handler for+ // `PlatformEvent::WindowMinimized` instead.} else if !is_minimized&& matches!(window.state(), WindowState::Floating(_)){@@ -94,17 +98,19 @@ pub fn handle_window_location_changed(info!("Updating floating window position.");window.set_floating_placement(frame_position);- let workspace = window.workspace().context("No workspace.")?;-- // Get workspace that encompasses most of the window after moving.- let updated_workspace = nearest_monitor- .displayed_workspace()- .context("Failed to get workspace of nearest monitor.")?;+ let monitor = window.monitor().context("No monitor.")?;// Update the window's workspace if it goes out of bounds of its// current workspace.- if workspace.id() != updated_workspace.id() {- info!("Window moved to new workspace.");+ if monitor.id() != nearest_monitor.id() {+ let updated_workspace = nearest_monitor+ .displayed_workspace()+ .context("Failed to get workspace of nearest monitor.")?;++ info!(+ "Floating window moved to new workspace: '{}'.",+ updated_workspace.config().name+ );move_container_within_tree(window.into(),diff --git a/packages/wm/src/windows/commands/move_window_in_direction.rs b/packages/wm/src/windows/commands/move_window_in_direction.rsindex db82f0f9..84af6c83 100644--- a/packages/wm/src/windows/commands/move_window_in_direction.rs+++ b/packages/wm/src/windows/commands/move_window_in_direction.rs@@ -427,23 +427,13 @@ fn move_floating_window(if let Some((position_rect, target_monitor)) = new_position {let monitor = window_to_move.monitor().context("No monitor.")?;- // Update the window's workspace if it goes out of bounds of its- // current workspace.- if monitor.id() != target_monitor.id() {- let target_workspace = target_monitor- .displayed_workspace()- .context("Failed to get workspace of target monitor.")?;-- move_container_within_tree(- window_to_move.clone().into(),- target_workspace.clone().into(),- target_workspace.child_count(),- state,- )?;-- if monitor.has_dpi_difference(&target_monitor.into())? {- window_to_move.set_has_pending_dpi_adjustment(true);- }+ // Mark window as needing DPI adjustment if it crosses monitors. The+ // handler for `PlatformEvent::LocationChanged` will update the+ // window's workspace if it goes out of bounds of its current workspace.+ if monitor.id() != target_monitor.id()+ && monitor.has_dpi_difference(&target_monitor.into())?+ {+ window_to_move.set_has_pending_dpi_adjustment(true);}window_to_move.set_floating_placement(position_rect);