mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-13 08:32:44 +02:00
fix(animation): disable on cross-monitor ops
There are quite a lot of janky animation bugs when moving window containers across monitor and workspace boundaries. This commit disables animation on all of the main cross-border window container operations, meaning that animations should now only happen within the context of a single workspace. fix #912
This commit is contained in:
@@ -228,6 +228,7 @@ pub static SESSION_ID: AtomicU32 = AtomicU32::new(0);
|
|||||||
|
|
||||||
pub static REMOVE_TITLEBARS: AtomicBool = AtomicBool::new(false);
|
pub static REMOVE_TITLEBARS: AtomicBool = AtomicBool::new(false);
|
||||||
pub static ANIMATION_ENABLED: AtomicBool = AtomicBool::new(false);
|
pub static ANIMATION_ENABLED: AtomicBool = AtomicBool::new(false);
|
||||||
|
pub static ANIMATION_TEMPORARY_DISABLED: AtomicBool = AtomicBool::new(false);
|
||||||
pub static ANIMATION_DURATION: AtomicU64 = AtomicU64::new(250);
|
pub static ANIMATION_DURATION: AtomicU64 = AtomicU64::new(250);
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use crate::stackbar_manager;
|
|||||||
use crate::ANIMATIONS_IN_PROGRESS;
|
use crate::ANIMATIONS_IN_PROGRESS;
|
||||||
use crate::ANIMATION_DURATION;
|
use crate::ANIMATION_DURATION;
|
||||||
use crate::ANIMATION_ENABLED;
|
use crate::ANIMATION_ENABLED;
|
||||||
|
use crate::ANIMATION_TEMPORARY_DISABLED;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
@@ -223,7 +224,9 @@ impl Window {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ANIMATION_ENABLED.load(Ordering::SeqCst) {
|
if ANIMATION_ENABLED.load(Ordering::SeqCst)
|
||||||
|
&& !ANIMATION_TEMPORARY_DISABLED.load(Ordering::SeqCst)
|
||||||
|
{
|
||||||
self.animate_position(layout, top)
|
self.animate_position(layout, top)
|
||||||
} else {
|
} else {
|
||||||
WindowsApi::position_window(self.hwnd(), layout, top)
|
WindowsApi::position_window(self.hwnd(), layout, top)
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ use crate::BorderColours;
|
|||||||
use crate::Colour;
|
use crate::Colour;
|
||||||
use crate::Rgb;
|
use crate::Rgb;
|
||||||
use crate::WorkspaceRule;
|
use crate::WorkspaceRule;
|
||||||
|
use crate::ANIMATION_TEMPORARY_DISABLED;
|
||||||
use crate::CUSTOM_FFM;
|
use crate::CUSTOM_FFM;
|
||||||
use crate::DATA_DIR;
|
use crate::DATA_DIR;
|
||||||
use crate::DISPLAY_INDEX_PREFERENCES;
|
use crate::DISPLAY_INDEX_PREFERENCES;
|
||||||
@@ -1108,6 +1109,7 @@ impl WindowManager {
|
|||||||
follow: bool,
|
follow: bool,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
self.handle_unmanaged_window_behaviour()?;
|
self.handle_unmanaged_window_behaviour()?;
|
||||||
|
ANIMATION_TEMPORARY_DISABLED.store(true, Ordering::SeqCst);
|
||||||
|
|
||||||
tracing::info!("moving container");
|
tracing::info!("moving container");
|
||||||
|
|
||||||
@@ -1177,12 +1179,17 @@ impl WindowManager {
|
|||||||
self.focus_monitor(monitor_idx)?;
|
self.focus_monitor(monitor_idx)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.update_focused_workspace(self.mouse_follows_focus, true)
|
self.update_focused_workspace(self.mouse_follows_focus, true)?;
|
||||||
|
|
||||||
|
ANIMATION_TEMPORARY_DISABLED.store(false, Ordering::SeqCst);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(self))]
|
#[tracing::instrument(skip(self))]
|
||||||
pub fn move_container_to_workspace(&mut self, idx: usize, follow: bool) -> Result<()> {
|
pub fn move_container_to_workspace(&mut self, idx: usize, follow: bool) -> Result<()> {
|
||||||
self.handle_unmanaged_window_behaviour()?;
|
self.handle_unmanaged_window_behaviour()?;
|
||||||
|
ANIMATION_TEMPORARY_DISABLED.store(true, Ordering::SeqCst);
|
||||||
|
|
||||||
tracing::info!("moving container");
|
tracing::info!("moving container");
|
||||||
|
|
||||||
@@ -1194,7 +1201,11 @@ impl WindowManager {
|
|||||||
monitor.move_container_to_workspace(idx, follow)?;
|
monitor.move_container_to_workspace(idx, follow)?;
|
||||||
monitor.load_focused_workspace(mouse_follows_focus)?;
|
monitor.load_focused_workspace(mouse_follows_focus)?;
|
||||||
|
|
||||||
self.update_focused_workspace(mouse_follows_focus, true)
|
self.update_focused_workspace(mouse_follows_focus, true)?;
|
||||||
|
|
||||||
|
ANIMATION_TEMPORARY_DISABLED.store(false, Ordering::SeqCst);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove_focused_workspace(&mut self) -> Option<Workspace> {
|
pub fn remove_focused_workspace(&mut self) -> Option<Workspace> {
|
||||||
@@ -1297,6 +1308,13 @@ impl WindowManager {
|
|||||||
let origin_monitor_idx = self.focused_monitor_idx();
|
let origin_monitor_idx = self.focused_monitor_idx();
|
||||||
let target_container_idx = workspace.new_idx_for_direction(direction);
|
let target_container_idx = workspace.new_idx_for_direction(direction);
|
||||||
|
|
||||||
|
let animation_temporarily_disabled = if target_container_idx.is_none() {
|
||||||
|
ANIMATION_TEMPORARY_DISABLED.store(true, Ordering::SeqCst);
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
match target_container_idx {
|
match target_container_idx {
|
||||||
// If there is nowhere to move on the current workspace, try to move it onto the monitor
|
// If there is nowhere to move on the current workspace, try to move it onto the monitor
|
||||||
// in that direction if there is one
|
// in that direction if there is one
|
||||||
@@ -1421,7 +1439,13 @@ impl WindowManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.update_focused_workspace(self.mouse_follows_focus, true)
|
self.update_focused_workspace(self.mouse_follows_focus, true)?;
|
||||||
|
|
||||||
|
if animation_temporarily_disabled {
|
||||||
|
ANIMATION_TEMPORARY_DISABLED.store(false, Ordering::SeqCst);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(self))]
|
#[tracing::instrument(skip(self))]
|
||||||
|
|||||||
Reference in New Issue
Block a user