mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-24 09:38:32 +02:00
refactor(animation): remove ANIMATION_TEMPORARILY_DISABLED global vars
Global variable removed due to previous fix commit
This commit is contained in:
@@ -225,7 +225,6 @@ 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_TEMPORARILY_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]
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ use crate::workspace_reconciliator::ALT_TAB_HWND;
|
|||||||
use crate::workspace_reconciliator::ALT_TAB_HWND_INSTANT;
|
use crate::workspace_reconciliator::ALT_TAB_HWND_INSTANT;
|
||||||
use crate::Notification;
|
use crate::Notification;
|
||||||
use crate::NotificationEvent;
|
use crate::NotificationEvent;
|
||||||
use crate::ANIMATION_TEMPORARILY_DISABLED;
|
|
||||||
use crate::DATA_DIR;
|
use crate::DATA_DIR;
|
||||||
use crate::HIDDEN_HWNDS;
|
use crate::HIDDEN_HWNDS;
|
||||||
use crate::REGEX_IDENTIFIERS;
|
use crate::REGEX_IDENTIFIERS;
|
||||||
@@ -478,8 +477,6 @@ impl WindowManager {
|
|||||||
origin_container_idx,
|
origin_container_idx,
|
||||||
)) = pending
|
)) = pending
|
||||||
{
|
{
|
||||||
ANIMATION_TEMPORARILY_DISABLED.store(true, Ordering::SeqCst);
|
|
||||||
|
|
||||||
let target_workspace_idx = self
|
let target_workspace_idx = self
|
||||||
.monitors()
|
.monitors()
|
||||||
.get(target_monitor_idx)
|
.get(target_monitor_idx)
|
||||||
@@ -521,8 +518,6 @@ impl WindowManager {
|
|||||||
self.focus_monitor(target_monitor_idx)?;
|
self.focus_monitor(target_monitor_idx)?;
|
||||||
self.focus_workspace(target_workspace_idx)?;
|
self.focus_workspace(target_workspace_idx)?;
|
||||||
self.update_focused_workspace(false, false)?;
|
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
|
// Here we handle a simple move on the same monitor which is treated as
|
||||||
// a container swap
|
// a container swap
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ 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_TEMPORARILY_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;
|
||||||
@@ -225,9 +224,7 @@ impl Window {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ANIMATION_ENABLED.load(Ordering::SeqCst)
|
if ANIMATION_ENABLED.load(Ordering::SeqCst) {
|
||||||
&& !ANIMATION_TEMPORARILY_DISABLED.load(Ordering::SeqCst)
|
|
||||||
{
|
|
||||||
self.animate_position(&window_rect, layout, top)
|
self.animate_position(&window_rect, layout, top)
|
||||||
} else {
|
} else {
|
||||||
WindowsApi::position_window(self.hwnd(), layout, top)
|
WindowsApi::position_window(self.hwnd(), layout, top)
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ use crate::BorderColours;
|
|||||||
use crate::Colour;
|
use crate::Colour;
|
||||||
use crate::Rgb;
|
use crate::Rgb;
|
||||||
use crate::WorkspaceRule;
|
use crate::WorkspaceRule;
|
||||||
use crate::ANIMATION_TEMPORARILY_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;
|
||||||
@@ -1109,7 +1108,6 @@ impl WindowManager {
|
|||||||
follow: bool,
|
follow: bool,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
self.handle_unmanaged_window_behaviour()?;
|
self.handle_unmanaged_window_behaviour()?;
|
||||||
ANIMATION_TEMPORARILY_DISABLED.store(true, Ordering::SeqCst);
|
|
||||||
|
|
||||||
tracing::info!("moving container");
|
tracing::info!("moving container");
|
||||||
|
|
||||||
@@ -1181,15 +1179,12 @@ impl WindowManager {
|
|||||||
|
|
||||||
self.update_focused_workspace(self.mouse_follows_focus, true)?;
|
self.update_focused_workspace(self.mouse_follows_focus, true)?;
|
||||||
|
|
||||||
ANIMATION_TEMPORARILY_DISABLED.store(false, Ordering::SeqCst);
|
|
||||||
|
|
||||||
Ok(())
|
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_TEMPORARILY_DISABLED.store(true, Ordering::SeqCst);
|
|
||||||
|
|
||||||
tracing::info!("moving container");
|
tracing::info!("moving container");
|
||||||
|
|
||||||
@@ -1203,8 +1198,6 @@ impl WindowManager {
|
|||||||
|
|
||||||
self.update_focused_workspace(mouse_follows_focus, true)?;
|
self.update_focused_workspace(mouse_follows_focus, true)?;
|
||||||
|
|
||||||
ANIMATION_TEMPORARILY_DISABLED.store(false, Ordering::SeqCst);
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1308,13 +1301,6 @@ 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_TEMPORARILY_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
|
||||||
@@ -1441,10 +1427,6 @@ 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_TEMPORARILY_DISABLED.store(false, Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user