shell: Don't consider active overviews animations
This commit is contained in:
parent
3277435ff9
commit
c506d94ac8
6 changed files with 139 additions and 53 deletions
|
|
@ -545,7 +545,7 @@ where
|
||||||
let overview = shell.overview_mode();
|
let overview = shell.overview_mode();
|
||||||
let (resize_mode, resize_indicator) = shell.resize_mode();
|
let (resize_mode, resize_indicator) = shell.resize_mode();
|
||||||
let resize_indicator = resize_indicator.map(|indicator| (resize_mode, indicator));
|
let resize_indicator = resize_indicator.map(|indicator| (resize_mode, indicator));
|
||||||
let swap_tree = if let OverviewMode::Started(Trigger::KeyboardSwap(_, desc), _) = &overview.0 {
|
let swap_tree = if let Some(Trigger::KeyboardSwap(_, desc)) = overview.0.active_trigger() {
|
||||||
if current.0 != desc.handle {
|
if current.0 != desc.handle {
|
||||||
shell
|
shell
|
||||||
.workspaces
|
.workspaces
|
||||||
|
|
@ -657,6 +657,7 @@ where
|
||||||
* 0.4
|
* 0.4
|
||||||
+ 0.6
|
+ 0.6
|
||||||
}
|
}
|
||||||
|
OverviewMode::Active(_) => 0.6,
|
||||||
OverviewMode::None => 1.0,
|
OverviewMode::None => 1.0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@ use crate::{
|
||||||
floating::ResizeGrabMarker,
|
floating::ResizeGrabMarker,
|
||||||
tiling::{SwapWindowGrab, TilingLayout},
|
tiling::{SwapWindowGrab, TilingLayout},
|
||||||
},
|
},
|
||||||
FocusResult, InvalidWorkspaceIndex, MoveResult, OverviewMode, ResizeMode, SeatExt, Trigger,
|
FocusResult, InvalidWorkspaceIndex, MoveResult, SeatExt, Trigger, WorkspaceDelta,
|
||||||
WorkspaceDelta,
|
|
||||||
},
|
},
|
||||||
utils::prelude::*,
|
utils::prelude::*,
|
||||||
wayland::{
|
wayland::{
|
||||||
|
|
@ -229,8 +228,8 @@ impl State {
|
||||||
time,
|
time,
|
||||||
|data, modifiers, handle| {
|
|data, modifiers, handle| {
|
||||||
// Leave move overview mode, if any modifier was released
|
// Leave move overview mode, if any modifier was released
|
||||||
if let OverviewMode::Started(Trigger::KeyboardMove(action_modifiers), _) =
|
if let Some(Trigger::KeyboardMove(action_modifiers)) =
|
||||||
shell.overview_mode().0
|
shell.overview_mode().0.active_trigger()
|
||||||
{
|
{
|
||||||
if (action_modifiers.ctrl && !modifiers.ctrl)
|
if (action_modifiers.ctrl && !modifiers.ctrl)
|
||||||
|| (action_modifiers.alt && !modifiers.alt)
|
|| (action_modifiers.alt && !modifiers.alt)
|
||||||
|
|
@ -241,8 +240,8 @@ impl State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Leave swap overview mode, if any key was released
|
// Leave swap overview mode, if any key was released
|
||||||
if let OverviewMode::Started(Trigger::KeyboardSwap(action_pattern, old_descriptor), _) =
|
if let Some(Trigger::KeyboardSwap(action_pattern, old_descriptor)) =
|
||||||
shell.overview_mode().0
|
shell.overview_mode().0.active_trigger()
|
||||||
{
|
{
|
||||||
if (action_pattern.modifiers.ctrl && !modifiers.ctrl)
|
if (action_pattern.modifiers.ctrl && !modifiers.ctrl)
|
||||||
|| (action_pattern.modifiers.alt && !modifiers.alt)
|
|| (action_pattern.modifiers.alt && !modifiers.alt)
|
||||||
|
|
@ -290,7 +289,7 @@ impl State {
|
||||||
if let Some(old_workspace) = old_w.get_mut(0) {
|
if let Some(old_workspace) = old_w.get_mut(0) {
|
||||||
if let Some(new_workspace) = other_w.iter_mut().find(|w| w.handle == new_workspace) {
|
if let Some(new_workspace) = other_w.iter_mut().find(|w| w.handle == new_workspace) {
|
||||||
if new_workspace.tiling_layer.windows().next().is_none() {
|
if new_workspace.tiling_layer.windows().next().is_none() {
|
||||||
if let Some(focus) = TilingLayout::move_tree(&mut old_workspace.tiling_layer, &mut new_workspace.tiling_layer, &new_workspace.handle, &seat, new_workspace.focus_stack.get(&seat).iter(), old_descriptor) {
|
if let Some(focus) = TilingLayout::move_tree(&mut old_workspace.tiling_layer, &mut new_workspace.tiling_layer, &new_workspace.handle, &seat, new_workspace.focus_stack.get(&seat).iter(), old_descriptor.clone()) {
|
||||||
let seat = seat.clone();
|
let seat = seat.clone();
|
||||||
data.common.event_loop_handle.insert_idle(move |state| {
|
data.common.event_loop_handle.insert_idle(move |state| {
|
||||||
Shell::set_focus(state, Some(&focus), &seat, None);
|
Shell::set_focus(state, Some(&focus), &seat, None);
|
||||||
|
|
@ -306,8 +305,8 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Leave or update resize mode, if modifiers changed or initial key was released
|
// Leave or update resize mode, if modifiers changed or initial key was released
|
||||||
if let (ResizeMode::Started(action_pattern, _, _), _) =
|
if let Some(action_pattern) =
|
||||||
shell.resize_mode()
|
shell.resize_mode().0.active_binding()
|
||||||
{
|
{
|
||||||
if action_pattern.key.is_some() && state == KeyState::Released
|
if action_pattern.key.is_some() && state == KeyState::Released
|
||||||
&& handle.raw_syms().contains(&action_pattern.key.unwrap())
|
&& handle.raw_syms().contains(&action_pattern.key.unwrap())
|
||||||
|
|
@ -336,8 +335,8 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special case resizing with regards to arrow keys
|
// Special case resizing with regards to arrow keys
|
||||||
if let (ResizeMode::Started(_, _, direction), _) =
|
if let Some(direction) =
|
||||||
shell.resize_mode()
|
shell.resize_mode().0.active_direction()
|
||||||
{
|
{
|
||||||
let resize_edge = match handle.modified_sym() {
|
let resize_edge = match handle.modified_sym() {
|
||||||
Keysym::Left | Keysym::h | Keysym::H => Some(ResizeEdge::LEFT),
|
Keysym::Left | Keysym::h | Keysym::H => Some(ResizeEdge::LEFT),
|
||||||
|
|
@ -913,10 +912,10 @@ impl State {
|
||||||
std::mem::drop(shell);
|
std::mem::drop(shell);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if let OverviewMode::Started(Trigger::Pointer(action_button), _) =
|
if let Some(Trigger::Pointer(action_button)) =
|
||||||
shell.overview_mode().0
|
shell.overview_mode().0.active_trigger()
|
||||||
{
|
{
|
||||||
if action_button == button {
|
if *action_button == button {
|
||||||
shell
|
shell
|
||||||
.set_overview_mode(None, self.common.event_loop_handle.clone());
|
.set_overview_mode(None, self.common.event_loop_handle.clone());
|
||||||
}
|
}
|
||||||
|
|
@ -1341,8 +1340,8 @@ impl State {
|
||||||
}
|
}
|
||||||
InputEvent::TouchUp { event, .. } => {
|
InputEvent::TouchUp { event, .. } => {
|
||||||
let mut shell = self.common.shell.write().unwrap();
|
let mut shell = self.common.shell.write().unwrap();
|
||||||
if let OverviewMode::Started(Trigger::Touch(slot), _) = shell.overview_mode().0 {
|
if let Some(Trigger::Touch(slot)) = shell.overview_mode().0.active_trigger() {
|
||||||
if slot == event.slot() {
|
if *slot == event.slot() {
|
||||||
shell.set_overview_mode(None, self.common.event_loop_handle.clone());
|
shell.set_overview_mode(None, self.common.event_loop_handle.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use xkbcommon::xkb::Keysym;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
config::key_bindings::cosmic_modifiers_from_smithay,
|
config::key_bindings::cosmic_modifiers_from_smithay,
|
||||||
shell::{layout::tiling::NodeDesc, OverviewMode, Trigger},
|
shell::{layout::tiling::NodeDesc, Trigger},
|
||||||
state::State,
|
state::State,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -40,7 +40,7 @@ impl KeyboardGrab<State> for SwapWindowGrab {
|
||||||
serial: Serial,
|
serial: Serial,
|
||||||
time: u32,
|
time: u32,
|
||||||
) {
|
) {
|
||||||
if !matches!(&data.common.shell.read().unwrap().overview_mode, OverviewMode::Started(Trigger::KeyboardSwap(_, d), _) if d == &self.desc)
|
if !matches!(&data.common.shell.read().unwrap().overview_mode.active_trigger(), Some(Trigger::KeyboardSwap(_, d)) if d == &self.desc)
|
||||||
{
|
{
|
||||||
handle.unset_grab(self, data, serial, false);
|
handle.unset_grab(self, data, serial, false);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -3137,7 +3137,10 @@ impl TilingLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !matches!(overview, OverviewMode::Started(_, _)) {
|
if !matches!(
|
||||||
|
overview,
|
||||||
|
OverviewMode::Started(_, _) | OverviewMode::Active(_)
|
||||||
|
) {
|
||||||
last_overview_hover.take();
|
last_overview_hover.take();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3249,8 +3252,8 @@ impl TilingLayout {
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
} else if matches!(
|
} else if matches!(
|
||||||
overview,
|
overview.active_trigger(),
|
||||||
OverviewMode::Started(Trigger::Pointer(_) | Trigger::Touch(_), _)
|
Some(Trigger::Pointer(_) | Trigger::Touch(_))
|
||||||
) {
|
) {
|
||||||
let non_exclusive_zone = layer_map_for_output(&self.output)
|
let non_exclusive_zone = layer_map_for_output(&self.output)
|
||||||
.non_exclusive_zone()
|
.non_exclusive_zone()
|
||||||
|
|
@ -3889,12 +3892,12 @@ impl TilingLayout {
|
||||||
let mut popup_elements = Vec::new();
|
let mut popup_elements = Vec::new();
|
||||||
|
|
||||||
let is_overview = !matches!(overview.0, OverviewMode::None);
|
let is_overview = !matches!(overview.0, OverviewMode::None);
|
||||||
let is_mouse_tiling = (matches!(overview.0, OverviewMode::Started(Trigger::Pointer(_), _)))
|
let is_mouse_tiling = (matches!(overview.0.trigger(), Some(Trigger::Pointer(_))))
|
||||||
.then(|| self.last_overview_hover.as_ref().map(|x| &x.1));
|
.then(|| self.last_overview_hover.as_ref().map(|x| &x.1));
|
||||||
let swap_desc = match &overview.0 {
|
let swap_desc = if let Some(Trigger::KeyboardSwap(_, desc)) = overview.0.trigger() {
|
||||||
OverviewMode::Started(Trigger::KeyboardSwap(_, desc), _)
|
Some(desc.clone())
|
||||||
| OverviewMode::Ended(Some(Trigger::KeyboardSwap(_, desc)), _) => Some(desc.clone()),
|
} else {
|
||||||
_ => None,
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
// all gone windows and fade them out
|
// all gone windows and fade them out
|
||||||
|
|
|
||||||
131
src/shell/mod.rs
131
src/shell/mod.rs
|
|
@ -116,6 +116,7 @@ pub enum Trigger {
|
||||||
pub enum OverviewMode {
|
pub enum OverviewMode {
|
||||||
None,
|
None,
|
||||||
Started(Trigger, Instant),
|
Started(Trigger, Instant),
|
||||||
|
Active(Trigger),
|
||||||
Ended(Option<Trigger>, Instant),
|
Ended(Option<Trigger>, Instant),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,6 +128,7 @@ impl OverviewMode {
|
||||||
/ ANIMATION_DURATION.as_millis() as f32;
|
/ ANIMATION_DURATION.as_millis() as f32;
|
||||||
Some(ease(EaseInOutCubic, 0.0, 1.0, percentage))
|
Some(ease(EaseInOutCubic, 0.0, 1.0, percentage))
|
||||||
}
|
}
|
||||||
|
OverviewMode::Active(_) => Some(1.0),
|
||||||
OverviewMode::Ended(_, end) => {
|
OverviewMode::Ended(_, end) => {
|
||||||
let percentage = Instant::now().duration_since(*end).as_millis() as f32
|
let percentage = Instant::now().duration_since(*end).as_millis() as f32
|
||||||
/ ANIMATION_DURATION.as_millis() as f32;
|
/ ANIMATION_DURATION.as_millis() as f32;
|
||||||
|
|
@ -139,12 +141,31 @@ impl OverviewMode {
|
||||||
OverviewMode::None => None,
|
OverviewMode::None => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn active_trigger(&self) -> Option<&Trigger> {
|
||||||
|
if let OverviewMode::Started(trigger, _) | OverviewMode::Active(trigger) = self {
|
||||||
|
Some(trigger)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn trigger(&self) -> Option<&Trigger> {
|
||||||
|
self.active_trigger().or_else(|| {
|
||||||
|
if let OverviewMode::Ended(trigger, _) = self {
|
||||||
|
trigger.as_ref()
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum ResizeMode {
|
pub enum ResizeMode {
|
||||||
None,
|
None,
|
||||||
Started(shortcuts::Binding, Instant, ResizeDirection),
|
Started(shortcuts::Binding, Instant, ResizeDirection),
|
||||||
|
Active(shortcuts::Binding, ResizeDirection),
|
||||||
Ended(Instant, ResizeDirection),
|
Ended(Instant, ResizeDirection),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,6 +177,7 @@ impl ResizeMode {
|
||||||
/ ANIMATION_DURATION.as_millis() as f32;
|
/ ANIMATION_DURATION.as_millis() as f32;
|
||||||
Some(ease(EaseInOutCubic, 0.0, 1.0, percentage))
|
Some(ease(EaseInOutCubic, 0.0, 1.0, percentage))
|
||||||
}
|
}
|
||||||
|
ResizeMode::Active(_, _) => Some(1.0),
|
||||||
ResizeMode::Ended(end, _) => {
|
ResizeMode::Ended(end, _) => {
|
||||||
let percentage = Instant::now().duration_since(*end).as_millis() as f32
|
let percentage = Instant::now().duration_since(*end).as_millis() as f32
|
||||||
/ ANIMATION_DURATION.as_millis() as f32;
|
/ ANIMATION_DURATION.as_millis() as f32;
|
||||||
|
|
@ -168,6 +190,22 @@ impl ResizeMode {
|
||||||
ResizeMode::None => None,
|
ResizeMode::None => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn active_binding(&self) -> Option<&shortcuts::Binding> {
|
||||||
|
if let ResizeMode::Started(binding, _, _) | ResizeMode::Active(binding, _) = self {
|
||||||
|
Some(binding)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn active_direction(&self) -> Option<ResizeDirection> {
|
||||||
|
if let ResizeMode::Started(_, _, direction) | ResizeMode::Active(_, direction) = self {
|
||||||
|
Some(*direction)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
|
|
@ -1190,8 +1228,8 @@ impl Shell {
|
||||||
WorkspaceMode::OutputBound => {
|
WorkspaceMode::OutputBound => {
|
||||||
if let Some(set) = self.workspaces.sets.get_mut(output) {
|
if let Some(set) = self.workspaces.sets.get_mut(output) {
|
||||||
if matches!(
|
if matches!(
|
||||||
self.overview_mode,
|
self.overview_mode.active_trigger(),
|
||||||
OverviewMode::Started(Trigger::Pointer(_) | Trigger::Touch(_), _)
|
Some(Trigger::Pointer(_) | Trigger::Touch(_))
|
||||||
) {
|
) {
|
||||||
set.workspaces[set.active].tiling_layer.cleanup_drag();
|
set.workspaces[set.active].tiling_layer.cleanup_drag();
|
||||||
}
|
}
|
||||||
|
|
@ -1240,8 +1278,8 @@ impl Shell {
|
||||||
WorkspaceMode::OutputBound => {
|
WorkspaceMode::OutputBound => {
|
||||||
if let Some(set) = self.workspaces.sets.get_mut(output) {
|
if let Some(set) = self.workspaces.sets.get_mut(output) {
|
||||||
if matches!(
|
if matches!(
|
||||||
self.overview_mode,
|
self.overview_mode.active_trigger(),
|
||||||
OverviewMode::Started(Trigger::Pointer(_) | Trigger::Touch(_), _)
|
Some(Trigger::Pointer(_) | Trigger::Touch(_))
|
||||||
) {
|
) {
|
||||||
set.workspaces[set.active].tiling_layer.cleanup_drag();
|
set.workspaces[set.active].tiling_layer.cleanup_drag();
|
||||||
}
|
}
|
||||||
|
|
@ -1526,12 +1564,16 @@ impl Shell {
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.is_some_and(|(_, delta)| delta.is_animating())
|
.is_some_and(|(_, delta)| delta.is_animating())
|
||||||
|| set.sticky_layer.animations_going()
|
|| set.sticky_layer.animations_going()
|
||||||
}) || !matches!(self.overview_mode, OverviewMode::None)
|
}) || !matches!(
|
||||||
|| !matches!(self.resize_mode, ResizeMode::None)
|
self.overview_mode,
|
||||||
|| self
|
OverviewMode::None | OverviewMode::Active(_)
|
||||||
.workspaces
|
) || !matches!(
|
||||||
.spaces()
|
self.resize_mode,
|
||||||
.any(|workspace| workspace.animations_going())
|
ResizeMode::None | ResizeMode::Active(_, _)
|
||||||
|
) || self
|
||||||
|
.workspaces
|
||||||
|
.spaces()
|
||||||
|
.any(|workspace| workspace.animations_going())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_animations(&mut self) -> HashMap<ClientId, Client> {
|
pub fn update_animations(&mut self) -> HashMap<ClientId, Client> {
|
||||||
|
|
@ -1551,14 +1593,20 @@ impl Shell {
|
||||||
evlh: LoopHandle<'static, crate::state::State>,
|
evlh: LoopHandle<'static, crate::state::State>,
|
||||||
) {
|
) {
|
||||||
if let Some(trigger) = enabled {
|
if let Some(trigger) = enabled {
|
||||||
if !matches!(self.overview_mode, OverviewMode::Started(_, _)) {
|
if !matches!(
|
||||||
|
self.overview_mode,
|
||||||
|
OverviewMode::Started(_, _) | OverviewMode::Active(_)
|
||||||
|
) {
|
||||||
if matches!(trigger, Trigger::KeyboardSwap(_, _)) {
|
if matches!(trigger, Trigger::KeyboardSwap(_, _)) {
|
||||||
self.swap_indicator = Some(swap_indicator(evlh, self.theme.clone()));
|
self.swap_indicator = Some(swap_indicator(evlh, self.theme.clone()));
|
||||||
}
|
}
|
||||||
self.overview_mode = OverviewMode::Started(trigger, Instant::now());
|
self.overview_mode = OverviewMode::Started(trigger, Instant::now());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if matches!(self.overview_mode, OverviewMode::Started(_, _)) {
|
if matches!(
|
||||||
|
self.overview_mode,
|
||||||
|
OverviewMode::Started(_, _) | OverviewMode::Active(_)
|
||||||
|
) {
|
||||||
let (reverse_duration, trigger) =
|
let (reverse_duration, trigger) =
|
||||||
if let OverviewMode::Started(trigger, start) = self.overview_mode.clone() {
|
if let OverviewMode::Started(trigger, start) = self.overview_mode.clone() {
|
||||||
(
|
(
|
||||||
|
|
@ -1567,7 +1615,7 @@ impl Shell {
|
||||||
Some(trigger),
|
Some(trigger),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
(Duration::ZERO, None)
|
(Duration::ZERO, self.overview_mode.active_trigger().cloned())
|
||||||
};
|
};
|
||||||
self.overview_mode =
|
self.overview_mode =
|
||||||
OverviewMode::Ended(trigger, Instant::now() - reverse_duration);
|
OverviewMode::Ended(trigger, Instant::now() - reverse_duration);
|
||||||
|
|
@ -1576,8 +1624,16 @@ impl Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn overview_mode(&self) -> (OverviewMode, Option<SwapIndicator>) {
|
pub fn overview_mode(&self) -> (OverviewMode, Option<SwapIndicator>) {
|
||||||
if let OverviewMode::Ended(_, timestamp) = self.overview_mode {
|
if let OverviewMode::Started(trigger, timestamp) = &self.overview_mode {
|
||||||
if Instant::now().duration_since(timestamp) > ANIMATION_DURATION {
|
if Instant::now().duration_since(*timestamp) > ANIMATION_DURATION {
|
||||||
|
return (
|
||||||
|
OverviewMode::Active(trigger.clone()),
|
||||||
|
self.swap_indicator.clone(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let OverviewMode::Ended(_, timestamp) = &self.overview_mode {
|
||||||
|
if Instant::now().duration_since(*timestamp) > ANIMATION_DURATION {
|
||||||
return (OverviewMode::None, None);
|
return (OverviewMode::None, None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1605,8 +1661,8 @@ impl Shell {
|
||||||
self.theme.clone(),
|
self.theme.clone(),
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
if let ResizeMode::Started(_, _, direction) = &self.resize_mode {
|
if let Some(direction) = self.resize_mode.active_direction() {
|
||||||
self.resize_mode = ResizeMode::Ended(Instant::now(), *direction);
|
self.resize_mode = ResizeMode::Ended(Instant::now(), direction);
|
||||||
if let Some((_, direction, edge, _, _, _)) = self.resize_state.as_ref() {
|
if let Some((_, direction, edge, _, _, _)) = self.resize_state.as_ref() {
|
||||||
self.finish_resize(*direction, *edge);
|
self.finish_resize(*direction, *edge);
|
||||||
}
|
}
|
||||||
|
|
@ -1615,6 +1671,14 @@ impl Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn resize_mode(&self) -> (ResizeMode, Option<ResizeIndicator>) {
|
pub fn resize_mode(&self) -> (ResizeMode, Option<ResizeIndicator>) {
|
||||||
|
if let ResizeMode::Started(binding, timestamp, direction) = &self.resize_mode {
|
||||||
|
if Instant::now().duration_since(*timestamp) > ANIMATION_DURATION {
|
||||||
|
return (
|
||||||
|
ResizeMode::Active(binding.clone(), *direction),
|
||||||
|
self.resize_indicator.clone(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
if let ResizeMode::Ended(timestamp, _) = self.resize_mode {
|
if let ResizeMode::Ended(timestamp, _) = self.resize_mode {
|
||||||
if Instant::now().duration_since(timestamp) > ANIMATION_DURATION {
|
if Instant::now().duration_since(timestamp) > ANIMATION_DURATION {
|
||||||
return (ResizeMode::None, None);
|
return (ResizeMode::None, None);
|
||||||
|
|
@ -1648,17 +1712,34 @@ impl Shell {
|
||||||
xdg_activation_state: &XdgActivationState,
|
xdg_activation_state: &XdgActivationState,
|
||||||
workspace_state: &mut WorkspaceUpdateGuard<'_, State>,
|
workspace_state: &mut WorkspaceUpdateGuard<'_, State>,
|
||||||
) {
|
) {
|
||||||
if let OverviewMode::Ended(_, timestamp) = self.overview_mode {
|
match &self.overview_mode {
|
||||||
if Instant::now().duration_since(timestamp) > ANIMATION_DURATION {
|
OverviewMode::Started(trigger, timestamp)
|
||||||
|
if Instant::now().duration_since(*timestamp) > ANIMATION_DURATION =>
|
||||||
|
{
|
||||||
|
self.overview_mode = OverviewMode::Active(trigger.clone());
|
||||||
|
}
|
||||||
|
OverviewMode::Ended(_, timestamp)
|
||||||
|
if Instant::now().duration_since(*timestamp) > ANIMATION_DURATION =>
|
||||||
|
{
|
||||||
self.overview_mode = OverviewMode::None;
|
self.overview_mode = OverviewMode::None;
|
||||||
self.swap_indicator = None;
|
self.swap_indicator = None;
|
||||||
}
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
if let ResizeMode::Ended(timestamp, _) = self.resize_mode {
|
|
||||||
if Instant::now().duration_since(timestamp) > ANIMATION_DURATION {
|
match &self.resize_mode {
|
||||||
|
ResizeMode::Started(binding, timestamp, direction)
|
||||||
|
if Instant::now().duration_since(*timestamp) > ANIMATION_DURATION =>
|
||||||
|
{
|
||||||
|
self.resize_mode = ResizeMode::Active(binding.clone(), *direction);
|
||||||
|
}
|
||||||
|
ResizeMode::Ended(timestamp, _)
|
||||||
|
if Instant::now().duration_since(*timestamp) > ANIMATION_DURATION =>
|
||||||
|
{
|
||||||
self.resize_mode = ResizeMode::None;
|
self.resize_mode = ResizeMode::None;
|
||||||
self.resize_indicator = None;
|
self.resize_indicator = None;
|
||||||
}
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.workspaces
|
self.workspaces
|
||||||
|
|
@ -2559,8 +2640,8 @@ impl Shell {
|
||||||
.find(|e| *e == &elem),
|
.find(|e| *e == &elem),
|
||||||
KeyboardFocusTarget::Group { .. } => {
|
KeyboardFocusTarget::Group { .. } => {
|
||||||
let focus_stack = workspace.focus_stack.get(seat);
|
let focus_stack = workspace.focus_stack.get(seat);
|
||||||
let swap_desc = match overview {
|
let swap_desc = match overview.active_trigger() {
|
||||||
OverviewMode::Started(Trigger::KeyboardSwap(_, desc), _) => Some(desc),
|
Some(Trigger::KeyboardSwap(_, desc)) => Some(desc.clone()),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -2583,8 +2664,8 @@ impl Shell {
|
||||||
|
|
||||||
if workspace.is_tiled(&focused) {
|
if workspace.is_tiled(&focused) {
|
||||||
let focus_stack = workspace.focus_stack.get(seat);
|
let focus_stack = workspace.focus_stack.get(seat);
|
||||||
let swap_desc = match overview {
|
let swap_desc = match overview.active_trigger() {
|
||||||
OverviewMode::Started(Trigger::KeyboardSwap(_, desc), _) => Some(desc),
|
Some(Trigger::KeyboardSwap(_, desc)) => Some(desc.clone()),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1146,6 +1146,7 @@ impl Workspace {
|
||||||
* 0.4
|
* 0.4
|
||||||
+ 0.6
|
+ 0.6
|
||||||
}
|
}
|
||||||
|
OverviewMode::Active(_) => 0.6,
|
||||||
OverviewMode::None => 1.0,
|
OverviewMode::None => 1.0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1165,11 +1166,12 @@ impl Workspace {
|
||||||
(Instant::now().duration_since(*start).as_millis() as f64 / 100.0).min(1.0)
|
(Instant::now().duration_since(*start).as_millis() as f64 / 100.0).min(1.0)
|
||||||
as f32,
|
as f32,
|
||||||
),
|
),
|
||||||
|
OverviewMode::Active(_) => Some(1.0),
|
||||||
OverviewMode::Ended(_, ended) => Some(
|
OverviewMode::Ended(_, ended) => Some(
|
||||||
1.0 - (Instant::now().duration_since(*ended).as_millis() as f64 / 100.0)
|
1.0 - (Instant::now().duration_since(*ended).as_millis() as f64 / 100.0)
|
||||||
.min(1.0) as f32,
|
.min(1.0) as f32,
|
||||||
),
|
),
|
||||||
_ => None,
|
OverviewMode::None => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
//tiling surfaces
|
//tiling surfaces
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue