Fennec OS 0.3.2: one app at a time, Raspberry Pi shell packages
- sf-core: only one app runs. Home, another app or a cast closes the app
on screen (after the switch animation) instead of freezing it in the
background. A frozen app that held a sound stream stalled PipeWire, so
the next app could not play at all ("Failed to connect stream: No such
entity" in Netflex after YouTube was sent home mid-video). The
background limit and the low-memory watcher go with the freezing.
- Raspberry Pi: image/pi (installer on Raspberry Pi OS), aarch64 shell
packages (sf-shell-<v>-aarch64, arch in pkg.toml, sf-update installs only
its own architecture), CI builds the aarch64 shell too.
- sf-compositor: volume OSD, screencopy for remote view, blank cursor.
- SDK v0.1.2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(unix), allow(dead_code))]
|
||||
//! Connection to sf-core. On the TV sf-core starts, freezes and closes apps;
|
||||
//! Connection to sf-core. On the TV sf-core starts and closes apps;
|
||||
//! without it (desktop testing) the launcher starts apps itself.
|
||||
|
||||
use sf_ipc::{CoreEvent, LauncherRequest};
|
||||
|
||||
@@ -86,6 +86,11 @@ pub fn setup(ui: &App) -> Snapshot {
|
||||
}
|
||||
|
||||
impl Snapshot {
|
||||
/// A snapshot is still to be taken: keep frames coming until then.
|
||||
pub fn pending(&self) -> bool {
|
||||
self.path.is_some()
|
||||
}
|
||||
|
||||
pub fn capture_if_due(&self, ui: &App, r: &GlassRenderer) {
|
||||
if !self.due.get() {
|
||||
return;
|
||||
|
||||
@@ -24,7 +24,7 @@ use std::time::{Duration, Instant};
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use chrono::{Datelike, Local, Timelike};
|
||||
use sf_ui::render::{Frame, GlassRenderer, Panel};
|
||||
use sf_ui::render::{Frame, GlassRenderer, Panel, Quality};
|
||||
use sf_ipc::{AppKind, AppManifest, Settings};
|
||||
use slint::{ComponentHandle, Model, ModelRc, SharedString, VecModel};
|
||||
|
||||
@@ -572,8 +572,8 @@ fn main() -> Result<()> {
|
||||
});
|
||||
}
|
||||
|
||||
// Launching. On the TV sf-core starts apps (and keeps them frozen in the
|
||||
// background on Home); without it the launcher starts them itself.
|
||||
// Launching. On the TV sf-core starts apps (and closes them on Home);
|
||||
// without it the launcher starts them itself.
|
||||
let toast_timer = Rc::new(slint::Timer::default());
|
||||
let running: Rc<RefCell<Option<(String, std::process::Child)>>> = Rc::default();
|
||||
let core = {
|
||||
@@ -676,8 +676,8 @@ fn main() -> Result<()> {
|
||||
}
|
||||
});
|
||||
}
|
||||
// Global "home" (remote's TV button): the foreground app goes to the
|
||||
// background (sf-core) or closes, and the reverse morph plays.
|
||||
// Global "home" (remote's TV button): the foreground app closes and
|
||||
// the reverse morph plays.
|
||||
{
|
||||
let weak = ui.as_weak();
|
||||
let core = core.clone();
|
||||
@@ -753,6 +753,10 @@ fn main() -> Result<()> {
|
||||
let backdrop = Rc::new(RefCell::new(Backdrop { palette: palettes.first().copied().unwrap_or([0.0; 9]), last: 0.0 }));
|
||||
let renderer: Rc<RefCell<Option<GlassRenderer>>> = Rc::default();
|
||||
let frames = Rc::new(RefCell::new((Instant::now(), 0u32)));
|
||||
// Glass quality, measured on the GPU for the window size (sf-ui), and
|
||||
// whether the last frame left anything still easing.
|
||||
let quality: Rc<std::cell::Cell<Option<(Quality, (u32, u32))>>> = Rc::default();
|
||||
let easing = Rc::new(std::cell::Cell::new(true));
|
||||
|
||||
let weak = ui.as_weak();
|
||||
ui.window()
|
||||
@@ -777,13 +781,26 @@ fn main() -> Result<()> {
|
||||
let size = ui.window().size();
|
||||
let scale = ui.window().scale_factor();
|
||||
|
||||
let q = match quality.get() {
|
||||
Some((q, at)) if at == (size.width, size.height) => q,
|
||||
_ => {
|
||||
// SAFETY: the rendering notifier runs with the GL context current.
|
||||
let q = unsafe { r.choose_quality(size.width, size.height) };
|
||||
log::info!("glass quality: {}", q.name());
|
||||
quality.set(Some((q, (size.width, size.height))));
|
||||
q
|
||||
}
|
||||
};
|
||||
|
||||
let mut bd = backdrop.borrow_mut();
|
||||
let focus = ui.get_focus_index().max(0) as usize;
|
||||
easing.set(false);
|
||||
if let Some(target) = palettes.get(focus) {
|
||||
let k = 1.0 - (-(time - bd.last).max(0.0) / CROSSFADE).exp();
|
||||
for (c, t) in bd.palette.iter_mut().zip(target) {
|
||||
*c += (t - *c) * k;
|
||||
}
|
||||
easing.set(bd.palette.iter().zip(target).any(|(c, t)| (c - t).abs() > 0.002));
|
||||
}
|
||||
bd.last = time;
|
||||
|
||||
@@ -811,7 +828,7 @@ fn main() -> Result<()> {
|
||||
images: &[],
|
||||
video: None,
|
||||
rects,
|
||||
quality: Default::default(),
|
||||
quality: q,
|
||||
};
|
||||
drop(bd);
|
||||
// SAFETY: called on the UI thread with the Slint GL context current.
|
||||
@@ -825,12 +842,17 @@ fn main() -> Result<()> {
|
||||
}
|
||||
}
|
||||
slint::RenderingState::AfterRendering => {
|
||||
// The backdrop is animated, so keep frames coming (vsync-limited).
|
||||
// The glass backdrop is animated, so keep frames coming
|
||||
// (vsync-limited). Material is still: frames only while the
|
||||
// colours ease; Slint asks for its own animations.
|
||||
if let Some(ui) = weak.upgrade() {
|
||||
if let Some(r) = renderer.borrow().as_ref() {
|
||||
snapshot.capture_if_due(&ui, r);
|
||||
}
|
||||
ui.window().request_redraw();
|
||||
let still = matches!(quality.get(), Some((Quality::Material, _)));
|
||||
if !still || easing.get() || snapshot.pending() {
|
||||
ui.window().request_redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
slint::RenderingState::RenderingTeardown => {
|
||||
|
||||
Reference in New Issue
Block a user