aboutsummaryrefslogtreecommitdiff
path: root/niri-visual-tests/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-04-13 11:07:23 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-04-13 11:07:23 +0400
commit71be19b234d58f4ec447e921633506beb81a52c0 (patch)
treea6b69d57a3e2edc9d8dac4c969548f227cbf341a /niri-visual-tests/src
parent4fd9300bdb07e90c26df28461f9bd6591c3d1d41 (diff)
downloadniri-71be19b234d58f4ec447e921633506beb81a52c0.tar.gz
niri-71be19b234d58f4ec447e921633506beb81a52c0.tar.bz2
niri-71be19b234d58f4ec447e921633506beb81a52c0.zip
Implement window resize animations
Diffstat (limited to 'niri-visual-tests/src')
-rw-r--r--niri-visual-tests/src/cases/tile.rs9
-rw-r--r--niri-visual-tests/src/cases/window.rs14
-rw-r--r--niri-visual-tests/src/smithay_view.rs3
-rw-r--r--niri-visual-tests/src/test_window.rs16
4 files changed, 27 insertions, 15 deletions
diff --git a/niri-visual-tests/src/cases/tile.rs b/niri-visual-tests/src/cases/tile.rs
index 5b2f7cb8..93aa38a0 100644
--- a/niri-visual-tests/src/cases/tile.rs
+++ b/niri-visual-tests/src/cases/tile.rs
@@ -20,7 +20,7 @@ impl Tile {
pub fn freeform(size: Size<i32, Logical>) -> Self {
let window = TestWindow::freeform(0);
let mut rv = Self::with_window(window);
- rv.tile.request_tile_size(size);
+ rv.tile.request_tile_size(size, false);
rv.window.communicate();
rv
}
@@ -28,7 +28,7 @@ impl Tile {
pub fn fixed_size(size: Size<i32, Logical>) -> Self {
let window = TestWindow::fixed_size(0);
let mut rv = Self::with_window(window);
- rv.tile.request_tile_size(size);
+ rv.tile.request_tile_size(size, false);
rv.window.communicate();
rv
}
@@ -37,7 +37,7 @@ impl Tile {
let window = TestWindow::fixed_size(0);
window.set_csd_shadow_width(64);
let mut rv = Self::with_window(window);
- rv.tile.request_tile_size(size);
+ rv.tile.request_tile_size(size, false);
rv.window.communicate();
rv
}
@@ -84,7 +84,8 @@ impl Tile {
impl TestCase for Tile {
fn resize(&mut self, width: i32, height: i32) {
- self.tile.request_tile_size(Size::from((width, height)));
+ self.tile
+ .request_tile_size(Size::from((width, height)), false);
self.window.communicate();
}
diff --git a/niri-visual-tests/src/cases/window.rs b/niri-visual-tests/src/cases/window.rs
index 3cd4c0b8..f19ec5ba 100644
--- a/niri-visual-tests/src/cases/window.rs
+++ b/niri-visual-tests/src/cases/window.rs
@@ -13,23 +13,23 @@ pub struct Window {
impl Window {
pub fn freeform(size: Size<i32, Logical>) -> Self {
- let window = TestWindow::freeform(0);
- window.request_size(size);
+ let mut window = TestWindow::freeform(0);
+ window.request_size(size, false);
window.communicate();
Self { window }
}
pub fn fixed_size(size: Size<i32, Logical>) -> Self {
- let window = TestWindow::fixed_size(0);
- window.request_size(size);
+ let mut window = TestWindow::fixed_size(0);
+ window.request_size(size, false);
window.communicate();
Self { window }
}
pub fn fixed_size_with_csd_shadow(size: Size<i32, Logical>) -> Self {
- let window = TestWindow::fixed_size(0);
+ let mut window = TestWindow::fixed_size(0);
window.set_csd_shadow_width(64);
- window.request_size(size);
+ window.request_size(size, false);
window.communicate();
Self { window }
}
@@ -37,7 +37,7 @@ impl Window {
impl TestCase for Window {
fn resize(&mut self, width: i32, height: i32) {
- self.window.request_size(Size::from((width, height)));
+ self.window.request_size(Size::from((width, height)), false);
self.window.communicate();
}
diff --git a/niri-visual-tests/src/smithay_view.rs b/niri-visual-tests/src/smithay_view.rs
index 0dcd3935..91a8929a 100644
--- a/niri-visual-tests/src/smithay_view.rs
+++ b/niri-visual-tests/src/smithay_view.rs
@@ -11,7 +11,7 @@ mod imp {
use anyhow::{ensure, Context};
use gtk::gdk;
use gtk::prelude::*;
- use niri::render_helpers::shaders;
+ use niri::render_helpers::{resources, shaders};
use niri::utils::get_monotonic_time;
use smithay::backend::egl::ffi::egl;
use smithay::backend::egl::EGLContext;
@@ -194,6 +194,7 @@ mod imp {
let mut renderer = GlesRenderer::with_capabilities(egl_context, capabilities)
.context("error creating GlesRenderer")?;
+ resources::init(&mut renderer);
shaders::init(&mut renderer);
Ok(renderer)
diff --git a/niri-visual-tests/src/test_window.rs b/niri-visual-tests/src/test_window.rs
index 9b8b80a2..ce325534 100644
--- a/niri-visual-tests/src/test_window.rs
+++ b/niri-visual-tests/src/test_window.rs
@@ -2,7 +2,9 @@ use std::cell::RefCell;
use std::cmp::{max, min};
use std::rc::Rc;
-use niri::layout::{LayoutElement, LayoutElementRenderElement, LayoutElementRenderSnapshot};
+use niri::layout::{
+ AnimationSnapshot, LayoutElement, LayoutElementRenderElement, LayoutElementRenderSnapshot,
+};
use niri::render_helpers::renderer::NiriRenderer;
use niri::render_helpers::{RenderSnapshot, RenderTarget};
use niri::window::ResolvedWindowRules;
@@ -177,7 +179,7 @@ impl LayoutElement for TestWindow {
RenderSnapshot::default()
}
- fn request_size(&self, size: Size<i32, Logical>) {
+ fn request_size(&mut self, size: Size<i32, Logical>, _animate: bool) {
self.inner.borrow_mut().requested_size = Some(size);
self.inner.borrow_mut().pending_fullscreen = false;
}
@@ -214,7 +216,7 @@ impl LayoutElement for TestWindow {
fn set_bounds(&self, _bounds: Size<i32, Logical>) {}
- fn send_pending_configure(&self) {}
+ fn send_pending_configure(&mut self) {}
fn is_fullscreen(&self) -> bool {
false
@@ -230,4 +232,12 @@ impl LayoutElement for TestWindow {
static EMPTY: ResolvedWindowRules = ResolvedWindowRules::empty();
&EMPTY
}
+
+ fn animation_snapshot(&self) -> Option<&AnimationSnapshot> {
+ None
+ }
+
+ fn take_animation_snapshot(&mut self) -> Option<AnimationSnapshot> {
+ None
+ }
}