Merge branch 'main' into fix/view_filters

This commit is contained in:
github-actions[bot]
2026-05-14 10:42:50 +00:00
committed by GitHub
2 changed files with 57 additions and 4 deletions

View File

@@ -227,7 +227,7 @@ flowchart TD
Panels are separated by `ResizeHandle` components that support drag-to-resize. `useLayoutPanels` clamps the sidebar, note-list, and inspector widths before applying them, keeps the side panes from flex-shrinking below their protected widths, and persists the last chosen widths in installation-local localStorage under `tolaria:layout-panels`.
The main Tauri window derives its minimum width from the visible panes instead of a single fixed floor. `useMainWindowSizeConstraints` treats the editor-only shell as the 480px baseline, adds the current sidebar / note-list / expanded-inspector widths on top with minimum floors, and calls the native `update_current_window_min_size` command whenever view mode, inspector visibility, or restored pane widths change. That same native command can grow the current window back out when a wider pane combination is restored, but Windows keeps grow-to-fit disabled so opening or closing the Properties panel does not unmaximize or reposition the main window. Note windows skip this path and keep their dedicated 800×700 initial sizing.
The main Tauri window derives its minimum width from the visible panes instead of a single fixed floor. `useMainWindowSizeConstraints` treats the editor-only shell as the 480px baseline, adds the current sidebar / note-list / expanded-inspector widths on top with minimum floors, and calls the native `update_current_window_min_size` command whenever view mode, inspector visibility, or restored pane widths change. That same native command can grow the current window back out when a wider pane combination is restored, but Windows keeps grow-to-fit disabled and skips min-size mutation while fullscreen or maximized so navigation/sidebar interactions do not unfullscreen or reposition the main window. Note windows skip this path and keep their dedicated 800×700 initial sizing.
The main Tauri window also persists its last normal size and screen position in the app config directory as `window-state.json`. The state stores logical window points, while `window_state.rs` migrates older physical-pixel state on read so Retina and non-Retina launches restore the same user-facing bounds. On startup, the restored frame applies only to the main window and clamps to the currently available monitor work areas, so stale coordinates from a disconnected display fall back to a visible placement. Maximized, fullscreen, minimized, and detached note-window frames are not written as the restore baseline.

View File

@@ -384,9 +384,33 @@ pub fn trigger_menu_command(_app_handle: tauri::AppHandle, _id: String) -> Resul
}
#[cfg(desktop)]
#[tauri::command]
pub fn update_current_window_min_size(
window: Window,
fn should_apply_window_min_size_constraints(
is_windows: bool,
is_fullscreen: bool,
is_maximized: bool,
) -> bool {
!(is_windows && (is_fullscreen || is_maximized))
}
#[cfg(desktop)]
fn should_skip_window_min_size_update(window: &Window) -> Result<bool, String> {
if !cfg!(target_os = "windows") {
return Ok(false);
}
let is_fullscreen = window.is_fullscreen().map_err(|e| e.to_string())?;
let is_maximized = window.is_maximized().map_err(|e| e.to_string())?;
Ok(!should_apply_window_min_size_constraints(
true,
is_fullscreen,
is_maximized,
))
}
#[cfg(desktop)]
fn apply_window_min_size_update(
window: &Window,
min_width: f64,
min_height: f64,
grow_to_fit: bool,
@@ -416,6 +440,21 @@ pub fn update_current_window_min_size(
.map_err(|e| e.to_string())
}
#[cfg(desktop)]
#[tauri::command]
pub fn update_current_window_min_size(
window: Window,
min_width: f64,
min_height: f64,
grow_to_fit: bool,
) -> Result<(), String> {
if should_skip_window_min_size_update(&window)? {
return Ok(());
}
apply_window_min_size_update(&window, min_width, min_height, grow_to_fit)
}
#[cfg(desktop)]
#[tauri::command]
pub fn perform_current_window_titlebar_double_click(window: Window) -> Result<(), String> {
@@ -623,6 +662,20 @@ mod tests {
}
}
#[test]
fn skips_min_size_updates_for_windows_fullscreen_or_maximized_windows() {
for (is_fullscreen, is_maximized) in [(true, false), (false, true), (true, true)] {
assert!(!should_apply_window_min_size_constraints(
true,
is_fullscreen,
is_maximized
));
}
assert!(should_apply_window_min_size_constraints(true, false, false));
assert!(should_apply_window_min_size_constraints(false, true, true));
}
#[test]
fn propagates_title_bar_action_errors() {
for (state, maximize, unmaximize, expected) in [