1
0
Fork 0
forked from wry/wry

Add linear tiled window animations

This commit is contained in:
atagen 2026-05-21 15:20:46 +10:00
parent a29937ebe8
commit 3540cdc4be
17 changed files with 913 additions and 64 deletions

View file

@ -1023,6 +1023,18 @@ 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_color_management_enabled(&self, enabled: bool) {
self.send(&ClientMessage::SetColorManagementEnabled { enabled });
}

View file

@ -545,6 +545,15 @@ pub enum ClientMessage<'a> {
SetUiDragThreshold {
threshold: i32,
},
SetAnimationsEnabled {
enabled: bool,
},
SetAnimationDurationMs {
duration_ms: u32,
},
SetAnimationCurve {
curve: u32,
},
SetXScalingMode {
mode: XScalingMode,
},

View file

@ -103,6 +103,18 @@ 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);
}
/// Exits the compositor.
pub fn quit() {
get!().quit()
@ -287,6 +299,27 @@ 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);
}
/// Enables or disables the color-management protocol.
///
/// The default is `false`.