deps: Replace cosmic-time with keyframe

This commit is contained in:
Victoria Brekenfeld 2023-07-11 17:12:56 +02:00
parent a683b7cd63
commit 4ee5aaf741
6 changed files with 66 additions and 80 deletions

69
Cargo.lock generated
View file

@ -482,7 +482,6 @@ dependencies = [
"bytemuck",
"calloop",
"cosmic-protocols",
"cosmic-time",
"edid-rs",
"egui",
"glow 0.11.2",
@ -491,6 +490,7 @@ dependencies = [
"iced_tiny_skia",
"id_tree",
"indexmap 1.9.3",
"keyframe",
"lazy_static",
"libcosmic",
"libsystemd",
@ -524,7 +524,7 @@ dependencies = [
[[package]]
name = "cosmic-config"
version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic//?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
source = "git+https://github.com/pop-os/libcosmic/?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
dependencies = [
"atomicwrites",
"cosmic-config-derive",
@ -538,7 +538,7 @@ dependencies = [
[[package]]
name = "cosmic-config-derive"
version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic//?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
source = "git+https://github.com/pop-os/libcosmic/?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
dependencies = [
"quote",
"syn 1.0.109",
@ -578,7 +578,7 @@ dependencies = [
[[package]]
name = "cosmic-theme"
version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic//?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
source = "git+https://github.com/pop-os/libcosmic/?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
dependencies = [
"anyhow",
"cosmic-config",
@ -590,14 +590,6 @@ dependencies = [
"serde",
]
[[package]]
name = "cosmic-time"
version = "0.2.0"
source = "git+https://github.com/pop-os/cosmic-time?rev=39c96ac#39c96ac8b3c11aeb5a4fe8bc962a89013f3f27b7"
dependencies = [
"libcosmic",
]
[[package]]
name = "cpufeatures"
version = "0.2.8"
@ -1761,7 +1753,7 @@ dependencies = [
[[package]]
name = "iced"
version = "0.9.0"
source = "git+https://github.com/pop-os/libcosmic//?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
source = "git+https://github.com/pop-os/libcosmic/?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
dependencies = [
"iced_core",
"iced_futures",
@ -1774,7 +1766,7 @@ dependencies = [
[[package]]
name = "iced_core"
version = "0.9.0"
source = "git+https://github.com/pop-os/libcosmic//?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
source = "git+https://github.com/pop-os/libcosmic/?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
dependencies = [
"bitflags 1.3.2",
"instant",
@ -1787,12 +1779,11 @@ dependencies = [
[[package]]
name = "iced_futures"
version = "0.6.0"
source = "git+https://github.com/pop-os/libcosmic//?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
source = "git+https://github.com/pop-os/libcosmic/?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
dependencies = [
"futures",
"iced_core",
"log",
"tokio",
"wasm-bindgen-futures",
"wasm-timer",
]
@ -1800,7 +1791,7 @@ dependencies = [
[[package]]
name = "iced_graphics"
version = "0.8.0"
source = "git+https://github.com/pop-os/libcosmic//?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
source = "git+https://github.com/pop-os/libcosmic/?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
dependencies = [
"bitflags 1.3.2",
"bytemuck",
@ -1817,7 +1808,7 @@ dependencies = [
[[package]]
name = "iced_renderer"
version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic//?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
source = "git+https://github.com/pop-os/libcosmic/?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
dependencies = [
"iced_graphics",
"iced_tiny_skia",
@ -1829,7 +1820,7 @@ dependencies = [
[[package]]
name = "iced_runtime"
version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic//?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
source = "git+https://github.com/pop-os/libcosmic/?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
dependencies = [
"iced_core",
"iced_futures",
@ -1839,7 +1830,7 @@ dependencies = [
[[package]]
name = "iced_style"
version = "0.8.0"
source = "git+https://github.com/pop-os/libcosmic//?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
source = "git+https://github.com/pop-os/libcosmic/?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
dependencies = [
"iced_core",
"once_cell",
@ -1849,7 +1840,7 @@ dependencies = [
[[package]]
name = "iced_tiny_skia"
version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic//?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
source = "git+https://github.com/pop-os/libcosmic/?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
dependencies = [
"bytemuck",
"cosmic-text",
@ -1867,7 +1858,7 @@ dependencies = [
[[package]]
name = "iced_wgpu"
version = "0.10.0"
source = "git+https://github.com/pop-os/libcosmic//?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
source = "git+https://github.com/pop-os/libcosmic/?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
dependencies = [
"bitflags 1.3.2",
"bytemuck",
@ -1888,7 +1879,7 @@ dependencies = [
[[package]]
name = "iced_widget"
version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic//?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
source = "git+https://github.com/pop-os/libcosmic/?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
dependencies = [
"iced_renderer",
"iced_runtime",
@ -2097,6 +2088,16 @@ dependencies = [
"mutate_once",
]
[[package]]
name = "keyframe"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60708bf7981518d09095d6f5673ce5cf6a64f1e0d9708b554f670e6d9d2bd9a9"
dependencies = [
"mint",
"num-traits",
]
[[package]]
name = "khronos-egl"
version = "4.1.0"
@ -2173,7 +2174,7 @@ checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]]
name = "libcosmic"
version = "0.1.0"
source = "git+https://github.com/pop-os/libcosmic//?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
source = "git+https://github.com/pop-os/libcosmic/?rev=42d7baf#42d7baf0d5cb14ab476120be9dfcaea9bd1d0be4"
dependencies = [
"apply",
"cosmic-config",
@ -2192,7 +2193,6 @@ dependencies = [
"lazy_static",
"palette",
"slotmap",
"tokio",
"tracing",
]
@ -2432,6 +2432,12 @@ dependencies = [
"simd-adler32",
]
[[package]]
name = "mint"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e53debba6bda7a793e5f99b8dacf19e626084f525f7829104ba9898f367d85ff"
[[package]]
name = "mio"
version = "0.8.8"
@ -2684,6 +2690,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
dependencies = [
"autocfg",
"libm",
]
[[package]]
@ -4106,18 +4113,6 @@ dependencies = [
"displaydoc",
]
[[package]]
name = "tokio"
version = "1.28.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2"
dependencies = [
"autocfg",
"num_cpus",
"pin-project-lite",
"windows-sys 0.48.0",
]
[[package]]
name = "toml"
version = "0.5.11"

View file

@ -31,8 +31,8 @@ libsystemd = { version = "0.5", optional = true }
wayland-backend = "0.1.0"
wayland-scanner = "0.30.0"
cosmic-protocols = { git = "https://github.com/pop-os/cosmic-protocols", branch = "main", default-features = false, features = ["server"] }
libcosmic = { git = "https://github.com/pop-os/libcosmic//", rev = "42d7baf", default-features = false }
iced_tiny_skia = { git = "https://github.com/pop-os/libcosmic//", rev = "42d7baf" }
libcosmic = { git = "https://github.com/pop-os/libcosmic/", rev = "42d7baf", default-features = false }
iced_tiny_skia = { git = "https://github.com/pop-os/libcosmic/", rev = "42d7baf" }
tiny-skia = "0.9"
ordered-float = "3.0"
glow = "0.11.2"
@ -41,7 +41,7 @@ tracing-journald = "0.3.0"
tracing = { version = "0.1.37", features = ["max_level_debug", "release_max_level_info"] }
puffin = { version = "0.14.3", optional = true }
puffin_egui = { version = "0.21.0", optional = true }
cosmic-time = { git = "https://github.com/pop-os/cosmic-time", rev = "39c96ac", default-features = false, features = ["libcosmic"] }
keyframe = "1.1.1"
once_cell = "1.18.0"
i18n-embed = { version = "0.13", features = ["fluent-system", "desktop-requester"] }
i18n-embed-fl = "0.6"
@ -81,6 +81,3 @@ lto = "fat"
[patch."https://github.com/Smithay/smithay.git"]
smithay = { git = "https://github.com/smithay//smithay", rev = "8d239c79ae" }
[patch."https://github.com/pop-os/libcosmic/"]
libcosmic = { git = "https://github.com/pop-os/libcosmic//", rev = "42d7baf" }

View file

@ -37,7 +37,7 @@ use crate::{
};
use cosmic_protocols::screencopy::v1::server::zcosmic_screencopy_session_v1::FailureReason;
use cosmic_time::{Cubic, Ease, Tween};
use keyframe::{ease, functions::EaseInOutCubic};
use smithay::{
backend::{
allocator::dmabuf::Dmabuf,
@ -517,7 +517,7 @@ where
let percentage = {
let percentage = Instant::now().duration_since(*start).as_millis() as f32
/ ANIMATION_DURATION.as_millis() as f32;
Ease::Cubic(Cubic::InOut).tween(percentage)
ease(EaseInOutCubic, 0.0, 1.0, percentage)
};
let offset = Point::<i32, Logical>::from(match (layout, *previous_idx < current.1) {
(WorkspaceLayout::Vertical, true) => {

View file

@ -26,7 +26,10 @@ use cosmic::{
theme,
widget::{icon, Icon},
};
use cosmic_time::{Cubic, Ease, Tween};
use keyframe::{
ease,
functions::{EaseInOutCubic, EaseOutCubic},
};
use std::{
collections::{HashMap, HashSet, VecDeque},
time::{Duration, Instant},
@ -246,13 +249,12 @@ impl State {
pub fn offset(&self, bounds: Rectangle, content_bounds: Size) -> Vector {
if let Some(animation) = self.scroll_animation {
let percentage = {
let percentage = (Instant::now()
let percentage = Instant::now()
.duration_since(animation.start_time)
.as_millis() as f32
/ SCROLL_ANIMATION_DURATION.as_millis() as f32)
.min(1.0);
/ SCROLL_ANIMATION_DURATION.as_millis() as f32;
Ease::Cubic(Cubic::InOut).tween(percentage)
ease(EaseInOutCubic, 0.0, 1.0, percentage)
};
Vector::new(
@ -528,12 +530,11 @@ where
renderer.with_layer(bounds, |renderer| {
renderer.with_translation(Vector::new(-offset.x, -offset.y), |renderer| {
let percentage = if let Some(animation) = state.tab_animations.front() {
let percentage = (Instant::now()
let percentage = Instant::now()
.duration_since(animation.start_time)
.as_millis() as f32
/ TAB_ANIMATION_DURATION.as_millis() as f32)
.min(1.0);
Ease::Cubic(Cubic::Out).tween(percentage)
/ TAB_ANIMATION_DURATION.as_millis() as f32;
ease(EaseOutCubic, 0.0, 1.0, percentage)
} else {
1.0
};

View file

@ -23,8 +23,8 @@ use crate::{
},
};
use cosmic_time::{Cubic, Ease, Tween};
use id_tree::{InsertBehavior, MoveBehavior, Node, NodeId, NodeIdError, RemoveBehavior, Tree};
use keyframe::{ease, functions::EaseInOutCubic};
use smithay::{
backend::renderer::{
element::{
@ -2006,10 +2006,9 @@ impl TilingLayout {
.then(|| &queue.trees.front().unwrap().0);
let percentage = if let Some(animation_start) = queue.animation_start {
let percentage = (Instant::now().duration_since(animation_start).as_millis() as f32
/ duration.as_millis() as f32)
.min(1.0);
Ease::Cubic(Cubic::Out).tween(percentage)
let percentage = Instant::now().duration_since(animation_start).as_millis() as f32
/ duration.as_millis() as f32;
ease(EaseInOutCubic, 0.0, 1.0, percentage)
} else {
1.0
};

View file

@ -10,7 +10,7 @@ use tracing::warn;
use wayland_backend::server::ClientId;
use cosmic_protocols::workspace::v1::server::zcosmic_workspace_handle_v1::State as WState;
use cosmic_time::{Cubic, Ease, Tween};
use keyframe::{ease, functions::EaseInOutCubic};
use smithay::{
desktop::{
layer_map_for_output, space::SpaceElement, LayerSurface, PopupManager, WindowSurfaceType,
@ -81,18 +81,15 @@ impl OverviewMode {
pub fn alpha(&self) -> Option<f32> {
match self {
OverviewMode::Started(_, start) => {
let percentage = (Instant::now().duration_since(*start).as_millis() as f32
/ ANIMATION_DURATION.as_millis() as f32)
.min(1.0);
Some(Ease::Cubic(Cubic::Out).tween(percentage))
let percentage = Instant::now().duration_since(*start).as_millis() as f32
/ ANIMATION_DURATION.as_millis() as f32;
Some(ease(EaseInOutCubic, 0.0, 1.0, percentage))
}
OverviewMode::Ended(end) => {
let percentage = (1.0
- Instant::now().duration_since(*end).as_millis() as f32
/ ANIMATION_DURATION.as_millis() as f32)
.max(0.0);
if percentage > 0.0 {
Some(Ease::Cubic(Cubic::Out).tween(percentage))
let percentage = Instant::now().duration_since(*end).as_millis() as f32
/ ANIMATION_DURATION.as_millis() as f32;
if percentage < 1.0 {
Some(ease(EaseInOutCubic, 1.0, 0.0, percentage))
} else {
None
}
@ -119,18 +116,15 @@ impl ResizeMode {
pub fn alpha(&self) -> Option<f32> {
match self {
ResizeMode::Started(_, start, _) => {
let percentage = (Instant::now().duration_since(*start).as_millis() as f32
/ ANIMATION_DURATION.as_millis() as f32)
.min(1.0);
Some(Ease::Cubic(Cubic::Out).tween(percentage))
let percentage = Instant::now().duration_since(*start).as_millis() as f32
/ ANIMATION_DURATION.as_millis() as f32;
Some(ease(EaseInOutCubic, 0.0, 1.0, percentage))
}
ResizeMode::Ended(end, _) => {
let percentage = (1.0
- Instant::now().duration_since(*end).as_millis() as f32
/ ANIMATION_DURATION.as_millis() as f32)
.max(0.0);
if percentage > 0.0 {
Some(Ease::Cubic(Cubic::Out).tween(percentage))
let percentage = Instant::now().duration_since(*end).as_millis() as f32
/ ANIMATION_DURATION.as_millis() as f32;
if percentage < 1.0 {
Some(ease(EaseInOutCubic, 1.0, 0.0, percentage))
} else {
None
}