mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-03 23:24:34 +00:00
Fix unused type warnings in i-slint-backend-linukxms build with default features
When no features are enabled, the TimerBasedAnimationDriver would be unused.
This commit is contained in:
parent
dbde3c2f9e
commit
6d14f5ca15
3 changed files with 61 additions and 57 deletions
|
@ -1,9 +1,6 @@
|
||||||
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
||||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
||||||
|
|
||||||
use std::cell::Cell;
|
|
||||||
use std::rc::{Rc, Weak};
|
|
||||||
|
|
||||||
use i_slint_core::api::PhysicalSize;
|
use i_slint_core::api::PhysicalSize;
|
||||||
use i_slint_core::platform::PlatformError;
|
use i_slint_core::platform::PlatformError;
|
||||||
|
|
||||||
|
@ -101,13 +98,19 @@ impl RenderingRotation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TimerBasedAnimationDriver {
|
#[cfg(any(feature = "renderer-skia-vulkan", feature = "renderer-software"))]
|
||||||
|
pub(crate) mod timeranimations {
|
||||||
|
use i_slint_core::platform::PlatformError;
|
||||||
|
use std::cell::Cell;
|
||||||
|
use std::rc::{Rc, Weak};
|
||||||
|
|
||||||
|
pub(crate) struct TimerBasedAnimationDriver {
|
||||||
timer: i_slint_core::timers::Timer,
|
timer: i_slint_core::timers::Timer,
|
||||||
next_animation_frame_callback: Cell<Option<Box<dyn FnOnce()>>>,
|
next_animation_frame_callback: Cell<Option<Box<dyn FnOnce()>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TimerBasedAnimationDriver {
|
impl TimerBasedAnimationDriver {
|
||||||
fn new() -> Rc<Self> {
|
pub(crate) fn new() -> Rc<Self> {
|
||||||
Rc::new_cyclic(|self_weak: &Weak<Self>| {
|
Rc::new_cyclic(|self_weak: &Weak<Self>| {
|
||||||
let self_weak = self_weak.clone();
|
let self_weak = self_weak.clone();
|
||||||
let timer = i_slint_core::timers::Timer::default();
|
let timer = i_slint_core::timers::Timer::default();
|
||||||
|
@ -133,9 +136,9 @@ impl TimerBasedAnimationDriver {
|
||||||
Self { timer, next_animation_frame_callback: Default::default() }
|
Self { timer, next_animation_frame_callback: Default::default() }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl crate::display::Presenter for TimerBasedAnimationDriver {
|
impl crate::display::Presenter for TimerBasedAnimationDriver {
|
||||||
fn is_ready_to_present(&self) -> bool {
|
fn is_ready_to_present(&self) -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
@ -155,4 +158,5 @@ impl crate::display::Presenter for TimerBasedAnimationDriver {
|
||||||
self.timer.restart();
|
self.timer.restart();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ pub struct LinuxFBDisplay {
|
||||||
back_buffer: RefCell<Box<[u8]>>,
|
back_buffer: RefCell<Box<[u8]>>,
|
||||||
width: u32,
|
width: u32,
|
||||||
height: u32,
|
height: u32,
|
||||||
presenter: Rc<crate::display::TimerBasedAnimationDriver>,
|
presenter: Rc<crate::display::timeranimations::TimerBasedAnimationDriver>,
|
||||||
first_frame: Cell<bool>,
|
first_frame: Cell<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ impl LinuxFBDisplay {
|
||||||
back_buffer,
|
back_buffer,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
presenter: crate::display::TimerBasedAnimationDriver::new(),
|
presenter: crate::display::timeranimations::TimerBasedAnimationDriver::new(),
|
||||||
first_frame: Cell::new(true),
|
first_frame: Cell::new(true),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,6 +173,6 @@ pub fn create_vulkan_display() -> Result<VulkanDisplay, PlatformError> {
|
||||||
queue_family_index,
|
queue_family_index,
|
||||||
surface: vulkan_surface,
|
surface: vulkan_surface,
|
||||||
size,
|
size,
|
||||||
presenter: crate::display::TimerBasedAnimationDriver::new(),
|
presenter: crate::display::timeranimations::TimerBasedAnimationDriver::new(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue