fix(animation): disable on cross-monitor drag

This commit adds an edge case missed in
50a279239a.
This commit is contained in:
LGUG2Z
2024-07-15 17:30:28 -07:00
parent 81451cb17a
commit 6ea71834a1
4 changed files with 15 additions and 10 deletions

View File

@@ -225,7 +225,7 @@ pub static SESSION_ID: AtomicU32 = AtomicU32::new(0);
pub static REMOVE_TITLEBARS: AtomicBool = AtomicBool::new(false);
pub static ANIMATION_ENABLED: AtomicBool = AtomicBool::new(false);
pub static ANIMATION_TEMPORARY_DISABLED: AtomicBool = AtomicBool::new(false);
pub static ANIMATION_TEMPORARILY_DISABLED: AtomicBool = AtomicBool::new(false);
pub static ANIMATION_DURATION: AtomicU64 = AtomicU64::new(250);
#[must_use]

View File

@@ -32,6 +32,7 @@ use crate::workspace_reconciliator::ALT_TAB_HWND;
use crate::workspace_reconciliator::ALT_TAB_HWND_INSTANT;
use crate::Notification;
use crate::NotificationEvent;
use crate::ANIMATION_TEMPORARILY_DISABLED;
use crate::DATA_DIR;
use crate::HIDDEN_HWNDS;
use crate::REGEX_IDENTIFIERS;
@@ -477,6 +478,8 @@ impl WindowManager {
origin_container_idx,
)) = pending
{
ANIMATION_TEMPORARILY_DISABLED.store(true, Ordering::SeqCst);
let target_workspace_idx = self
.monitors()
.get(target_monitor_idx)
@@ -518,6 +521,8 @@ impl WindowManager {
self.focus_monitor(target_monitor_idx)?;
self.focus_workspace(target_workspace_idx)?;
self.update_focused_workspace(false, false)?;
ANIMATION_TEMPORARILY_DISABLED.store(false, Ordering::SeqCst);
}
// Here we handle a simple move on the same monitor which is treated as
// a container swap

View File

@@ -5,7 +5,7 @@ use crate::stackbar_manager;
use crate::ANIMATIONS_IN_PROGRESS;
use crate::ANIMATION_DURATION;
use crate::ANIMATION_ENABLED;
use crate::ANIMATION_TEMPORARY_DISABLED;
use crate::ANIMATION_TEMPORARILY_DISABLED;
use std::collections::HashMap;
use std::convert::TryFrom;
use std::fmt::Display;
@@ -226,7 +226,7 @@ impl Window {
}
if ANIMATION_ENABLED.load(Ordering::SeqCst)
&& !ANIMATION_TEMPORARY_DISABLED.load(Ordering::SeqCst)
&& !ANIMATION_TEMPORARILY_DISABLED.load(Ordering::SeqCst)
{
self.animate_position(layout, top)
} else {

View File

@@ -66,7 +66,7 @@ use crate::BorderColours;
use crate::Colour;
use crate::Rgb;
use crate::WorkspaceRule;
use crate::ANIMATION_TEMPORARY_DISABLED;
use crate::ANIMATION_TEMPORARILY_DISABLED;
use crate::CUSTOM_FFM;
use crate::DATA_DIR;
use crate::DISPLAY_INDEX_PREFERENCES;
@@ -1109,7 +1109,7 @@ impl WindowManager {
follow: bool,
) -> Result<()> {
self.handle_unmanaged_window_behaviour()?;
ANIMATION_TEMPORARY_DISABLED.store(true, Ordering::SeqCst);
ANIMATION_TEMPORARILY_DISABLED.store(true, Ordering::SeqCst);
tracing::info!("moving container");
@@ -1181,7 +1181,7 @@ impl WindowManager {
self.update_focused_workspace(self.mouse_follows_focus, true)?;
ANIMATION_TEMPORARY_DISABLED.store(false, Ordering::SeqCst);
ANIMATION_TEMPORARILY_DISABLED.store(false, Ordering::SeqCst);
Ok(())
}
@@ -1189,7 +1189,7 @@ impl WindowManager {
#[tracing::instrument(skip(self))]
pub fn move_container_to_workspace(&mut self, idx: usize, follow: bool) -> Result<()> {
self.handle_unmanaged_window_behaviour()?;
ANIMATION_TEMPORARY_DISABLED.store(true, Ordering::SeqCst);
ANIMATION_TEMPORARILY_DISABLED.store(true, Ordering::SeqCst);
tracing::info!("moving container");
@@ -1203,7 +1203,7 @@ impl WindowManager {
self.update_focused_workspace(mouse_follows_focus, true)?;
ANIMATION_TEMPORARY_DISABLED.store(false, Ordering::SeqCst);
ANIMATION_TEMPORARILY_DISABLED.store(false, Ordering::SeqCst);
Ok(())
}
@@ -1309,7 +1309,7 @@ impl WindowManager {
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);
ANIMATION_TEMPORARILY_DISABLED.store(true, Ordering::SeqCst);
true
} else {
false
@@ -1442,7 +1442,7 @@ impl WindowManager {
self.update_focused_workspace(self.mouse_follows_focus, true)?;
if animation_temporarily_disabled {
ANIMATION_TEMPORARY_DISABLED.store(false, Ordering::SeqCst);
ANIMATION_TEMPORARILY_DISABLED.store(false, Ordering::SeqCst);
}
Ok(())