Add managed Window resource and native shell operations
Verify Tessera GUI / verify (push) Failing after 7m25s

This commit is contained in:
2026-10-21 17:12:55 +08:00
parent 3ea4bac48c
commit 76e293d3b8
11 changed files with 681 additions and 41 deletions
+56
View File
@@ -19,6 +19,8 @@ pub struct NamespaceState {
pub submission: u64,
pub document: RenderDocument,
pub viewport: Option<crate::layout::Size>,
pub runtime_session: u64,
pub window_commands: Vec<crate::window::Envelope>,
}
impl Default for NamespaceState {
@@ -29,11 +31,32 @@ impl Default for NamespaceState {
submission: 0,
document: RenderDocument::default(),
viewport: None,
runtime_session: 0,
window_commands: Vec::new(),
}
}
}
impl NamespaceState {
pub fn publish_window_commands(&mut self, session: u64, commands: Vec<crate::window::Command>) {
if self.runtime_session != session {
self.window_commands.clear();
}
self.runtime_session = session;
if session == 0 {
self.window_commands.clear();
return;
}
for command in commands {
self.window_commands
.retain(|old| !old.command.same_kind(&command));
self.window_commands
.push(crate::window::Envelope { session, command });
}
self.window_commands
.sort_by_key(|command| command.command.sequence);
}
pub fn next_submission(&self) -> Result<u64> {
self.submission
.checked_add(1)
@@ -61,6 +84,8 @@ impl NamespaceState {
.context("revision counter exhausted")?;
self.submission = submission;
self.document = RenderDocument::default();
self.runtime_session = 0;
self.window_commands.clear();
self.revision = revision;
Ok(revision)
}
@@ -477,3 +502,34 @@ mod tests {
);
}
}
#[cfg(test)]
mod window_projection_tests {
use super::*;
#[test]
fn replacement_and_reset_discard_old_window_projections() {
let mut state = NamespaceState::default();
let command = crate::window::Command {
window: 1,
sequence: 1,
action: crate::window::Action::Focus,
};
state.publish_window_commands(1, vec![command.clone()]);
let resize = crate::window::Command {
window: 1,
sequence: 2,
action: crate::window::Action::Resize {
width: 900.0,
height: 600.0,
},
};
state.publish_window_commands(1, vec![resize.clone()]);
assert_eq!(state.window_commands.len(), 2);
state.publish_window_commands(2, vec![resize]);
assert_eq!(state.window_commands.len(), 1);
assert_eq!(state.window_commands[0].session, 2);
state.clear().unwrap();
assert_eq!(state.runtime_session, 0);
assert!(state.window_commands.is_empty());
}
}