mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-24 02:01:18 +07:00
closing_window: Remove starting_alpha/scale
This commit is contained in:
@@ -49,12 +49,6 @@ pub struct ClosingWindow {
|
|||||||
|
|
||||||
/// The closing animation.
|
/// The closing animation.
|
||||||
anim: Animation,
|
anim: Animation,
|
||||||
|
|
||||||
/// Alpha the animation should start from.
|
|
||||||
starting_alpha: f32,
|
|
||||||
|
|
||||||
/// Scale the animation should start from.
|
|
||||||
starting_scale: f64,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
niri_render_elements! {
|
niri_render_elements! {
|
||||||
@@ -64,7 +58,6 @@ niri_render_elements! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ClosingWindow {
|
impl ClosingWindow {
|
||||||
#[allow(clippy::too_many_arguments)]
|
|
||||||
pub fn new<E: RenderElement<GlesRenderer>>(
|
pub fn new<E: RenderElement<GlesRenderer>>(
|
||||||
renderer: &mut GlesRenderer,
|
renderer: &mut GlesRenderer,
|
||||||
snapshot: RenderSnapshot<E, E>,
|
snapshot: RenderSnapshot<E, E>,
|
||||||
@@ -72,8 +65,6 @@ impl ClosingWindow {
|
|||||||
center: Point<i32, Logical>,
|
center: Point<i32, Logical>,
|
||||||
pos: Point<i32, Logical>,
|
pos: Point<i32, Logical>,
|
||||||
anim: Animation,
|
anim: Animation,
|
||||||
starting_alpha: f32,
|
|
||||||
starting_scale: f64,
|
|
||||||
) -> anyhow::Result<Self> {
|
) -> anyhow::Result<Self> {
|
||||||
let _span = tracy_client::span!("ClosingWindow::new");
|
let _span = tracy_client::span!("ClosingWindow::new");
|
||||||
|
|
||||||
@@ -109,8 +100,6 @@ impl ClosingWindow {
|
|||||||
texture_offset,
|
texture_offset,
|
||||||
blocked_out_texture_offset,
|
blocked_out_texture_offset,
|
||||||
anim,
|
anim,
|
||||||
starting_alpha,
|
|
||||||
starting_scale,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +132,7 @@ impl ClosingWindow {
|
|||||||
texture.clone(),
|
texture.clone(),
|
||||||
self.texture_scale.x as i32,
|
self.texture_scale.x as i32,
|
||||||
Transform::Normal,
|
Transform::Normal,
|
||||||
Some(val.clamp(0., 1.) as f32 * self.starting_alpha),
|
Some(val.clamp(0., 1.) as f32),
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
@@ -155,7 +144,7 @@ impl ClosingWindow {
|
|||||||
let elem = RescaleRenderElement::from_element(
|
let elem = RescaleRenderElement::from_element(
|
||||||
elem,
|
elem,
|
||||||
(self.center.to_f64() - offset).to_physical_precise_round(scale),
|
(self.center.to_f64() - offset).to_physical_precise_round(scale),
|
||||||
((val / 5. + 0.8) * self.starting_scale).max(0.),
|
(val / 5. + 0.8).max(0.),
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut location = self.pos.to_f64() + offset;
|
let mut location = self.pos.to_f64() + offset;
|
||||||
|
|||||||
+2
-2
@@ -854,7 +854,7 @@ impl<W: LayoutElement> Tile<W> {
|
|||||||
) -> TileRenderSnapshot {
|
) -> TileRenderSnapshot {
|
||||||
let _span = tracy_client::span!("Tile::render_snapshot");
|
let _span = tracy_client::span!("Tile::render_snapshot");
|
||||||
|
|
||||||
let contents = self.render_inner(
|
let contents = self.render(
|
||||||
renderer,
|
renderer,
|
||||||
Point::from((0, 0)),
|
Point::from((0, 0)),
|
||||||
scale,
|
scale,
|
||||||
@@ -863,7 +863,7 @@ impl<W: LayoutElement> Tile<W> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// A bit of a hack to render blocked out as for screencast, but I think it's fine here.
|
// A bit of a hack to render blocked out as for screencast, but I think it's fine here.
|
||||||
let blocked_out_contents = self.render_inner(
|
let blocked_out_contents = self.render(
|
||||||
renderer,
|
renderer,
|
||||||
Point::from((0, 0)),
|
Point::from((0, 0)),
|
||||||
scale,
|
scale,
|
||||||
|
|||||||
@@ -1348,16 +1348,6 @@ impl<W: LayoutElement> Workspace<W> {
|
|||||||
tile_pos.x -= offset;
|
tile_pos.x -= offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: this is a bit cursed since it's relying on Tile's internal details.
|
|
||||||
let (starting_alpha, starting_scale) = if let Some(anim) = tile.open_animation() {
|
|
||||||
(
|
|
||||||
anim.clamped_value().clamp(0., 1.) as f32,
|
|
||||||
(anim.value() / 2. + 0.5).max(0.),
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
(1., 1.)
|
|
||||||
};
|
|
||||||
|
|
||||||
let anim = Animation::new(1., 0., 0., self.options.animations.window_close.0);
|
let anim = Animation::new(1., 0., 0., self.options.animations.window_close.0);
|
||||||
|
|
||||||
let res = ClosingWindow::new(
|
let res = ClosingWindow::new(
|
||||||
@@ -1367,8 +1357,6 @@ impl<W: LayoutElement> Workspace<W> {
|
|||||||
center,
|
center,
|
||||||
tile_pos,
|
tile_pos,
|
||||||
anim,
|
anim,
|
||||||
starting_alpha,
|
|
||||||
starting_scale,
|
|
||||||
);
|
);
|
||||||
match res {
|
match res {
|
||||||
Ok(closing) => {
|
Ok(closing) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user