feat: add window animations
This commit is contained in:
parent
a29937ebe8
commit
ce14169d6b
29 changed files with 6957 additions and 114 deletions
|
|
@ -1023,6 +1023,26 @@ impl ConfigClient {
|
|||
self.send(&ClientMessage::SetUiDragThreshold { threshold });
|
||||
}
|
||||
|
||||
pub fn set_animations_enabled(&self, enabled: bool) {
|
||||
self.send(&ClientMessage::SetAnimationsEnabled { enabled });
|
||||
}
|
||||
|
||||
pub fn set_animation_duration_ms(&self, duration_ms: u32) {
|
||||
self.send(&ClientMessage::SetAnimationDurationMs { duration_ms });
|
||||
}
|
||||
|
||||
pub fn set_animation_curve(&self, curve: u32) {
|
||||
self.send(&ClientMessage::SetAnimationCurve { curve });
|
||||
}
|
||||
|
||||
pub fn set_animation_style(&self, style: u32) {
|
||||
self.send(&ClientMessage::SetAnimationStyle { style });
|
||||
}
|
||||
|
||||
pub fn set_animation_cubic_bezier(&self, x1: f32, y1: f32, x2: f32, y2: f32) {
|
||||
self.send(&ClientMessage::SetAnimationCubicBezier { x1, y1, x2, y2 });
|
||||
}
|
||||
|
||||
pub fn set_color_management_enabled(&self, enabled: bool) {
|
||||
self.send(&ClientMessage::SetColorManagementEnabled { enabled });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -545,6 +545,24 @@ pub enum ClientMessage<'a> {
|
|||
SetUiDragThreshold {
|
||||
threshold: i32,
|
||||
},
|
||||
SetAnimationsEnabled {
|
||||
enabled: bool,
|
||||
},
|
||||
SetAnimationDurationMs {
|
||||
duration_ms: u32,
|
||||
},
|
||||
SetAnimationCurve {
|
||||
curve: u32,
|
||||
},
|
||||
SetAnimationStyle {
|
||||
style: u32,
|
||||
},
|
||||
SetAnimationCubicBezier {
|
||||
x1: f32,
|
||||
y1: f32,
|
||||
x2: f32,
|
||||
y2: f32,
|
||||
},
|
||||
SetXScalingMode {
|
||||
mode: XScalingMode,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -103,6 +103,27 @@ impl Axis {
|
|||
}
|
||||
}
|
||||
|
||||
/// The curve used for tiled window animations.
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
pub struct AnimationCurve(pub u32);
|
||||
|
||||
impl AnimationCurve {
|
||||
pub const LINEAR: Self = Self(0);
|
||||
pub const EASE: Self = Self(1);
|
||||
pub const EASE_IN: Self = Self(2);
|
||||
pub const EASE_OUT: Self = Self(3);
|
||||
pub const EASE_IN_OUT: Self = Self(4);
|
||||
}
|
||||
|
||||
/// The presentation style used for tiled window movement animations.
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
pub struct AnimationStyle(pub u32);
|
||||
|
||||
impl AnimationStyle {
|
||||
pub const PLAIN: Self = Self(0);
|
||||
pub const MULTIPHASE: Self = Self(1);
|
||||
}
|
||||
|
||||
/// Exits the compositor.
|
||||
pub fn quit() {
|
||||
get!().quit()
|
||||
|
|
@ -287,6 +308,42 @@ pub fn set_ui_drag_threshold(threshold: i32) {
|
|||
get!().set_ui_drag_threshold(threshold);
|
||||
}
|
||||
|
||||
/// Enables or disables tiled window animations.
|
||||
///
|
||||
/// The default is `false`.
|
||||
pub fn set_animations_enabled(enabled: bool) {
|
||||
get!().set_animations_enabled(enabled);
|
||||
}
|
||||
|
||||
/// Sets the duration of tiled window animations in milliseconds.
|
||||
///
|
||||
/// The default is `160`.
|
||||
pub fn set_animation_duration_ms(duration_ms: u32) {
|
||||
get!().set_animation_duration_ms(duration_ms);
|
||||
}
|
||||
|
||||
/// Sets the curve used by tiled window animations.
|
||||
///
|
||||
/// The default is [`AnimationCurve::EASE_OUT`].
|
||||
pub fn set_animation_curve(curve: AnimationCurve) {
|
||||
get!().set_animation_curve(curve.0);
|
||||
}
|
||||
|
||||
/// Sets the presentation style used for tiled window movement animations.
|
||||
///
|
||||
/// The default is [`AnimationStyle::MULTIPHASE`].
|
||||
pub fn set_animation_style(style: AnimationStyle) {
|
||||
get!().set_animation_style(style.0);
|
||||
}
|
||||
|
||||
/// Sets a custom cubic-bezier curve used by tiled window animations.
|
||||
///
|
||||
/// `x1` and `x2` must be between `0.0` and `1.0`. The curve starts at `(0, 0)`
|
||||
/// and ends at `(1, 1)`.
|
||||
pub fn set_animation_cubic_bezier(x1: f32, y1: f32, x2: f32, y2: f32) {
|
||||
get!().set_animation_cubic_bezier(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
/// Enables or disables the color-management protocol.
|
||||
///
|
||||
/// The default is `false`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue