tiling: Animate tree changes

This commit is contained in:
Victoria Brekenfeld 2023-05-12 20:01:37 +02:00
parent ea1b976076
commit 331b884f1e
23 changed files with 1641 additions and 395 deletions

View file

@ -0,0 +1,65 @@
use crate::{
shell::element::CosmicSurface, state::Data,
wayland::handlers::compositor::client_compositor_state,
};
use calloop::LoopHandle;
use smithay::{
reexports::wayland_server::{backend::ClientId, Client, Resource},
utils::Serial,
wayland::{
compositor::{Blocker, BlockerState},
seat::WaylandFocus,
},
};
use std::{
collections::HashMap,
time::{Duration, Instant},
};
#[derive(Debug, Clone)]
pub struct TilingBlocker {
pub necessary_acks: Vec<(CosmicSurface, Serial)>,
start: Instant,
}
impl Blocker for TilingBlocker {
fn state(&self) -> BlockerState {
if self.is_ready() {
BlockerState::Released
} else {
BlockerState::Pending
}
}
}
impl TilingBlocker {
pub fn new(configures: impl IntoIterator<Item = (CosmicSurface, Serial)>) -> Self {
TilingBlocker {
necessary_acks: configures.into_iter().collect(),
start: Instant::now(),
}
}
pub fn is_ready(&self) -> bool {
Instant::now().duration_since(self.start) >= Duration::from_millis(200)
|| self
.necessary_acks
.iter()
.all(|(surf, serial)| surf.serial_acked(serial))
}
pub fn signal_ready(&self, handle: &LoopHandle<'static, Data>) {
let clients = self
.necessary_acks
.iter()
.flat_map(|(surface, _)| surface.wl_surface().and_then(|s| s.client()))
.map(|client| (client.id(), client))
.collect::<HashMap<ClientId, Client>>();
handle.insert_idle(move |data| {
let dh = data.display.handle();
for client in clients.values() {
client_compositor_state(&client).blocker_cleared(&mut data.state, &dh);
}
});
}
}

View file

@ -64,7 +64,8 @@ impl PointerGrab<State> for ResizeForkGrab {
if let Some(output) = self.output.upgrade() {
let tiling_layer = &mut data.common.shell.active_space_mut(&output).tiling_layer;
if let Some(tree) = tiling_layer.trees.get_mut(&output) {
if let Some(queue) = tiling_layer.queues.get_mut(&output) {
let tree = &mut queue.trees.back_mut().unwrap().0;
if tree.get(&self.node).is_ok() {
let orientation = tree.get(&self.node).unwrap().data().orientation();
let delta = match orientation {

File diff suppressed because it is too large Load diff