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
+34 -1
View File
@@ -75,6 +75,33 @@ impl TesseraApp {
})
}
fn apply_window_commands(&self) {
let Some(window) = &self.window else {
return;
};
let Ok(mut namespace) = self.namespace.write() else {
return;
};
let commands = std::mem::take(&mut namespace.window_commands);
for envelope in commands {
if envelope.session == 0
|| envelope.session != namespace.runtime_session
|| envelope.command.window != crate::window::MAIN_WINDOW
{
continue;
}
match envelope.command.action {
crate::window::Action::Resize { width, height } => {
let _ = window.request_inner_size(LogicalSize::new(width, height));
}
crate::window::Action::SetTitle(title) => window.set_title(&title),
crate::window::Action::Focus => window.focus_window(),
}
}
drop(namespace);
self.publish_viewport();
}
fn publish_viewport(&self) {
let Some(window) = &self.window else {
return;
@@ -110,6 +137,7 @@ impl TesseraApp {
}
fn document_updated(&mut self) {
self.apply_window_commands();
if let Ok(namespace) = self.namespace.read() {
self.developer_tools.document_updated(&namespace.document);
let frame = &namespace.document.frame;
@@ -373,7 +401,11 @@ impl ApplicationHandler<AppEvent> for TesseraApp {
let attributes = WindowAttributes::default()
.with_title("Tessera")
.with_inner_size(LogicalSize::new(1_280.0, 800.0))
.with_min_inner_size(LogicalSize::new(720.0, 480.0));
.with_min_inner_size(LogicalSize::new(720.0, 480.0))
.with_max_inner_size(LogicalSize::new(
crate::window::MAX_WINDOW_DIMENSION,
crate::window::MAX_WINDOW_DIMENSION,
));
let window = Arc::new(
event_loop
.create_window(attributes)
@@ -387,6 +419,7 @@ impl ApplicationHandler<AppEvent> for TesseraApp {
self.window = Some(window.clone());
self.context = Some(context);
self.surface = Some(surface);
self.apply_window_commands();
self.publish_viewport();
window.request_redraw();
}