diff --git a/packages/wm/src/common/events/handle_window_location_changed.rs b/packages/wm/src/common/events/handle_window_location_changed.rs index 62a7487a2..af0c085cb 100644 --- a/packages/wm/src/common/events/handle_window_location_changed.rs +++ b/packages/wm/src/common/events/handle_window_location_changed.rs @@ -12,10 +12,8 @@ use crate::{ }, user_config::{FloatingStateConfig, FullscreenStateConfig, UserConfig}, windows::{ - commands::update_window_state, - traits::WindowGetters, - window_operation::{Operation, WindowOperation}, - TilingWindow, WindowState, + commands::update_window_state, traits::WindowGetters, + window_operation::WindowOperation, TilingWindow, WindowState, }, wm_state::WmState, }; @@ -150,8 +148,9 @@ pub fn handle_window_location_changed( /// Updates the window operation based on changes in frame position. /// -/// This function determines whether a window is being moved or resized and updates its -/// operation state accordingly. If the window is being moved, it's set to floating mode. +/// This function determines whether a window is being moved or resized and +/// updates its operation state accordingly. If the window is being moved, +/// it's set to floating mode. fn update_window_operation( state: &mut WmState, config: &UserConfig, @@ -161,35 +160,26 @@ fn update_window_operation( ) -> anyhow::Result<()> { if let Some(tiling_window) = window.as_tiling_window() { let window_operation = window.window_operation(); - if matches!( - window_operation, - WindowOperation { - operation: Operation::Waiting, - } - ) { + if window_operation == WindowOperation::Waiting { if frame_position.height() == old_frame_position.height() && frame_position.width() == old_frame_position.width() { - window.set_window_operation(WindowOperation { - operation: Operation::Moving, - ..window_operation - }); + window.set_window_operation(WindowOperation::Moving); set_into_floating(tiling_window.clone(), state, config)?; } else { - window.set_window_operation(WindowOperation { - operation: Operation::Resizing, - ..window_operation - }); + window.set_window_operation(WindowOperation::Resizing); } } } Ok(()) } -/// Converts a tiling window to a floating window and updates the window hierarchy. +/// Converts a tiling window to a floating window and updates the window +/// hierarchy. /// -/// This function handles the process of transitioning a tiling window to a floating state, -/// including necessary adjustments to the window hierarchy and updating the window's state. +/// This function handles the process of transitioning a tiling window to a +/// floating state, including necessary adjustments to the window hierarchy +/// and updating the window's state. fn set_into_floating( moved_window: TilingWindow, state: &mut WmState, diff --git a/packages/wm/src/common/events/handle_window_moved_end.rs b/packages/wm/src/common/events/handle_window_moved_end.rs index d36768027..138ec493b 100644 --- a/packages/wm/src/common/events/handle_window_moved_end.rs +++ b/packages/wm/src/common/events/handle_window_moved_end.rs @@ -15,7 +15,7 @@ use crate::{ windows::{ commands::update_window_state, traits::WindowGetters, - window_operation::{Operation, WindowOperation}, + window_operation::{WindowOperation}, NonTilingWindow, TilingWindow, WindowState, }, wm_state::WmState, @@ -35,7 +35,7 @@ pub fn window_moved_end( is_tiling_drag: false, .. }) - ) || moved_window.window_operation().operation != Operation::Moving + ) || moved_window.window_operation() != WindowOperation::Moving { moved_window.set_window_operation(WindowOperation::default()); return Ok(()); diff --git a/packages/wm/src/common/events/handle_window_moved_or_resized_start.rs b/packages/wm/src/common/events/handle_window_moved_or_resized_start.rs index bf3ba699f..69f12803c 100644 --- a/packages/wm/src/common/events/handle_window_moved_or_resized_start.rs +++ b/packages/wm/src/common/events/handle_window_moved_or_resized_start.rs @@ -3,7 +3,7 @@ use crate::{ containers::WindowContainer, windows::{ traits::WindowGetters, - window_operation::{Operation, WindowOperation}, + window_operation::{WindowOperation}, }, wm_state::WmState, }; @@ -17,9 +17,7 @@ pub fn handle_window_moved_or_resized_start( let found_window = state.window_from_native(&native_window); if let Some(WindowContainer::TilingWindow(moved_window)) = found_window { - moved_window.set_window_operation(WindowOperation { - operation: Operation::Waiting, - }); + moved_window.set_window_operation(WindowOperation::Waiting); } Ok(()) diff --git a/packages/wm/src/windows/window_operation.rs b/packages/wm/src/windows/window_operation.rs index 66b405cc8..cc469b5b0 100644 --- a/packages/wm/src/windows/window_operation.rs +++ b/packages/wm/src/windows/window_operation.rs @@ -1,11 +1,5 @@ -#[derive(Debug, Clone, Default)] -pub struct WindowOperation{ - pub operation: Operation, - -} - #[derive(Debug, Copy, Clone, Default, PartialEq)] -pub enum Operation{ +pub enum WindowOperation{ #[default] None, Waiting,