feat: unify window chrome and managed workspace tabs
This commit is contained in:
+19
-3
@@ -1,4 +1,5 @@
|
||||
//! Tessera's native visual protocols over Aster's managed object graph.
|
||||
mod developer_pages;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use anyhow::{Result, bail};
|
||||
@@ -1832,6 +1833,10 @@ fn project_tabs(
|
||||
tabs.push(crate::tabs::Tab {
|
||||
id,
|
||||
title,
|
||||
developer_tool: match vm.get_attr(page, "_tesseraTool") {
|
||||
Ok(Value::Text(name)) => Some(name),
|
||||
_ => None,
|
||||
},
|
||||
active: active == Some(page),
|
||||
});
|
||||
}
|
||||
@@ -2276,6 +2281,12 @@ impl UiBridge {
|
||||
vm.release_value(result?)?;
|
||||
return Ok(());
|
||||
}
|
||||
if let Some(name) = input.kind.strip_prefix("developer-open:") {
|
||||
let function = object(Some(&vm.get_attr(self.ui, "developerTools")?))?;
|
||||
let page = vm.call(function, &[Value::Text(name.into())])?;
|
||||
vm.release_value(page)?;
|
||||
return Ok(());
|
||||
}
|
||||
if matches!(
|
||||
input.kind.as_str(),
|
||||
"tab-activate" | "tab-close" | "tab-detach" | "tab-drop"
|
||||
@@ -2299,8 +2310,11 @@ impl UiBridge {
|
||||
state.desktop,
|
||||
state.mounts.ordered(),
|
||||
state.layout.viewport.map(|size| crate::layout::Size {
|
||||
width: size.width,
|
||||
height: (size.height - crate::tabs::height(&state.last_tabs)).max(0.0),
|
||||
width: (size.width - crate::tabs::RAIL - crate::tabs::INSET).max(0.0),
|
||||
height: (size.height
|
||||
- crate::tabs::INSET
|
||||
- crate::tabs::height(&state.last_tabs))
|
||||
.max(0.0),
|
||||
}),
|
||||
)
|
||||
};
|
||||
@@ -2734,7 +2748,8 @@ impl UiBridge {
|
||||
};
|
||||
let full_viewport = layout.viewport;
|
||||
if let Some(size) = &mut layout.viewport {
|
||||
size.height = (size.height - crate::tabs::height(&tabs)).max(0.0);
|
||||
size.width = (size.width - crate::tabs::RAIL - crate::tabs::INSET).max(0.0);
|
||||
size.height = (size.height - crate::tabs::height(&tabs) - crate::tabs::INSET).max(0.0);
|
||||
}
|
||||
{
|
||||
let state = self
|
||||
@@ -3391,6 +3406,7 @@ pub fn install(vm: &mut Vm, roots: &mut Vec<ObjectRef>) -> Result<UiBridge> {
|
||||
crate::event_dispatch::install(vm, roots, event_type, token_type, function_type)?;
|
||||
crate::protocols::install(vm, roots, desktop, ui)?;
|
||||
let tasks = crate::tasks::install(vm, roots, ui, desktop)?;
|
||||
developer_pages::install(vm, ui, &session)?;
|
||||
Ok(UiBridge { ui, session, tasks })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user