From b1726af2ebecfa5614a0e9d994b70992306d6e90 Mon Sep 17 00:00:00 2001 From: thearturca Date: Sun, 10 Nov 2024 17:21:41 +0300 Subject: [PATCH] fix(animation): set pos for all container windows This change prevents the move animation from playing again for each window in the stack. Tested with all hiding behaviors. Looks good so far. resolve #1029 --- komorebi/src/workspace.rs | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/komorebi/src/workspace.rs b/komorebi/src/workspace.rs index 82fea5a1..d12de5dc 100644 --- a/komorebi/src/workspace.rs +++ b/komorebi/src/workspace.rs @@ -357,21 +357,7 @@ impl Workspace { for (i, container) in containers.iter_mut().enumerate() { let window_count = container.windows().len(); - if let (Some(window), Some(layout)) = - (container.focused_window_mut(), layouts.get_mut(i)) - { - if should_remove_titlebars && no_titlebar.contains(&window.exe()?) { - window.remove_title_bar()?; - } else if no_titlebar.contains(&window.exe()?) { - window.add_title_bar()?; - } - - // If a window has been unmaximized via toggle-maximize, this block - // will make sure that it is unmaximized via restore_window - if window.is_maximized() && !managed_maximized_window { - WindowsApi::restore_window(window.hwnd); - } - + if let Some(layout) = layouts.get_mut(i) { { let border_offset = BORDER_OFFSET.load(Ordering::SeqCst); layout.add_padding(border_offset); @@ -388,7 +374,25 @@ impl Workspace { layout.bottom -= total_height; } - window.set_position(layout, false)?; + for window in container.windows() { + if container + .focused_window() + .is_some_and(|w| w.hwnd == window.hwnd) + { + if should_remove_titlebars && no_titlebar.contains(&window.exe()?) { + window.remove_title_bar()?; + } else if no_titlebar.contains(&window.exe()?) { + window.add_title_bar()?; + } + + // If a window has been unmaximized via toggle-maximize, this block + // will make sure that it is unmaximized via restore_window + if window.is_maximized() && !managed_maximized_window { + WindowsApi::restore_window(window.hwnd); + } + } + window.set_position(layout, false)?; + } } }