Skip to content

Commit

Permalink
fix(animation): set pos for all container windows
Browse files Browse the repository at this point in the history
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
  • Loading branch information
thearturca authored and LGUG2Z committed Nov 10, 2024
1 parent fd8cd4b commit b1726af
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions komorebi/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)?;
}
}
}

Expand Down

0 comments on commit b1726af

Please sign in to comment.