Place apps below the title bar, not behind it
A child webview is positioned against the window frame while the shell measures the hole it left from inside the content view. Borderless, those origins coincided and it never showed. With a title bar back they are a title bar apart, so every app was drawn that much too high - painting over the right-hand part of the bar, which read as the bar being tinted by whichever site was open, and leaving a strip of the same height along the bottom. Tauri cannot report that height. Both inner_position/outer_position and inner_size/outer_size come back identical on macOS - measured, both differences were zero against a window whose content is plainly a title bar shorter than its frame. NSWindow.contentLayoutRect knows, so it is asked once and cached. Also hides the window title, and centres the navigation row in its own strip rather than letting it crowd the bar above it.
This commit is contained in:
@@ -17,6 +17,9 @@ pub struct AppState {
|
||||
pub dir: PathBuf,
|
||||
/// Corner radius the window's inner frame is currently drawn with.
|
||||
pub radius: Mutex<f64>,
|
||||
/// Title bar height: how far a child webview's origin sits above the
|
||||
/// content the shell measures from.
|
||||
pub chrome: Mutex<f64>,
|
||||
pub config: Mutex<Config>,
|
||||
pub active: Mutex<Option<String>>,
|
||||
pub stage: Mutex<Stage>,
|
||||
@@ -72,7 +75,8 @@ pub fn build_state(handle: &AppHandle) -> Result<AppState, String> {
|
||||
let config = config::load(&dir)?;
|
||||
Ok(AppState {
|
||||
dir,
|
||||
radius: Mutex::new(12.0),
|
||||
radius: Mutex::new(0.0),
|
||||
chrome: Mutex::new(0.0),
|
||||
config: Mutex::new(config),
|
||||
active: Mutex::new(None),
|
||||
stage: Mutex::new((240.0, 38.0, 800.0, 600.0)),
|
||||
@@ -524,9 +528,15 @@ pub fn notification_status(app: AppHandle) -> String {
|
||||
let app_state = app.state::<AppState>();
|
||||
let last = app_state.last_notification.lock().unwrap().clone();
|
||||
let from_page = if last.is_empty() { "none yet".into() } else { last };
|
||||
let stage = *app_state.stage.lock().unwrap();
|
||||
let offset = webviews::chrome_offset(&app);
|
||||
let shot = app_state.last_snapshot.lock().unwrap().clone();
|
||||
let shot = if shot.is_empty() { "not taken".into() } else { shot };
|
||||
format!("permission: {state} · direct: {raised} · from page: {from_page} · backdrop: {shot}")
|
||||
format!(
|
||||
"permission: {state} · direct: {raised} · from page: {from_page} · backdrop: {shot} \
|
||||
· stage: {:.0},{:.0} {:.0}×{:.0} · chrome offset: {offset:.1}",
|
||||
stage.0, stage.1, stage.2, stage.3
|
||||
)
|
||||
}
|
||||
|
||||
/// Asks macOS for notification permission, and claims this app's identity.
|
||||
|
||||
Reference in New Issue
Block a user