LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Top bar: in full screen the left buttons move into the traffic lights' space (fixes #1763)
Marco Arnulfo2df471b14299
diff --git a/crates/ui-egui/src/panels/topbar.rs b/crates/ui-egui/src/panels/topbar.rsindex 03810aca9..939668ac2 100644--- a/crates/ui-egui/src/panels/topbar.rs+++ b/crates/ui-egui/src/panels/topbar.rs@@ -44,7 +44,13 @@ fn window_handle(app: &LightcraftApp, ui: &mut egui::Ui, content: Rect, margin_lpub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {let t = Tokens::get(ui.ctx());- let left = if app.integrated_titlebar { 78 } else { 10 };+ // room for the traffic lights; in full screen they are gone, and the sidebar button sits as far+ // from the left edge as the Discord button from the right (12 margin + 4)+ let left = match (app.integrated_titlebar, app.window_is_fullscreen) {+ (true, false) => 78,+ (true, true) => 16,+ (false, _) => 10,+ };egui::Panel::top("top_bar").exact_size(t.top_bar_h).frame(egui::Frame::NONE.fill(t.chrome).inner_margin(egui::Margin { left, right: 12, top: 0, bottom: 0 }))diff --git a/crates/ui-egui/src/tests_titlebar.rs b/crates/ui-egui/src/tests_titlebar.rsindex 40eba4b13..8e44b19ec 100644--- a/crates/ui-egui/src/tests_titlebar.rs+++ b/crates/ui-egui/src/tests_titlebar.rs@@ -115,3 +115,21 @@ fn without_the_integrated_title_bar_the_bar_is_not_a_window_handle() {let bar = h.app.widgets.iter().find(|(w, _)| w == "region:titlebar");assert!(bar.is_none());}++// Scenario: in full screen the traffic lights are gone, so the bar's buttons move into their space+#[test]+fn full_screen_moves_the_left_buttons_into_the_traffic_lights_space() {+ let mut h = integrated();+ let window_right = 1200.0;+ let windowed = widget(&h, "icon:sidebar").left();+ assert_eq!(windowed, 78.0, "windowed, the bar leaves room for the traffic lights");+ h.request("ui.key", json!({"key": "f", "cmd": true, "shift": true}), T);+ play(&mut h);+ assert!(h.app.window_is_fullscreen);+ let right_padding = window_right - widget(&h, "icon:discord").right();+ assert_eq!(widget(&h, "icon:sidebar").left(), right_padding, "My Photos as far from the left edge as Discord is from the right");+ h.request("ui.key", json!({"key": "f", "cmd": true, "shift": true}), T);+ play(&mut h);+ assert!(!h.app.window_is_fullscreen);+ assert_eq!(widget(&h, "icon:sidebar").left(), windowed, "leaving full screen restores the room for the traffic lights");+}diff --git a/docs/parity-checklist.md b/docs/parity-checklist.mdindex 7bb187811..cd2ca3d86 100644--- a/docs/parity-checklist.md+++ b/docs/parity-checklist.md@@ -480,7 +480,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts).| LR-BEHAV-LEARN | Tutorials | OOS | 🚫 | | || LR-BEHAV-WHATSNEW | What's new | P2 | ✅ | `cmd:app.whatsNew`, `docs/whats-new.md` | Help ▸ What's New: release highlights || LR-BEHAV-AI-EA | Early-access badges | P2 | ⬜ | | |-| LR-BEHAV-TITLEBAR | Title bar drag and double-click zoom (macOS) | P2 | 🟡 | `crates/ui-egui/src/titlebar.rs`, `crates/ui-egui/src/panels/topbar.rs`, `crates/ui-egui/src/tests_titlebar.rs` | the native title bar is hidden on macOS, so the top bar's empty space (including the traffic-light margin) moves the window and a double-click zooms or restores it; buttons and the search field keep their clicks; ignored in full screen. Zoom is winit's `Maximized`: it does not follow System Settings › “Double-click a window's title bar to” (Fill / Minimize). a press that starts on a button or the search field never moves the window. Known gap: egui-winit reads the zoomed state only at start-up and after our own `Maximized` command, so a window zoomed another way (green button, Window ▸ Zoom, snapping) makes the first double-click a no-op before the toggle catches up. Checked by hand on a real macOS window (drag, zoom, restore) |+| LR-BEHAV-TITLEBAR | Title bar drag and double-click zoom (macOS) | P2 | 🟡 | `crates/ui-egui/src/titlebar.rs`, `crates/ui-egui/src/panels/topbar.rs`, `crates/ui-egui/src/tests_titlebar.rs` | the native title bar is hidden on macOS, so the top bar's empty space (including the traffic-light margin) moves the window and a double-click zooms or restores it; buttons and the search field keep their clicks; ignored in full screen, where the traffic lights are gone and the bar's left buttons move into their space (#1763). Zoom is winit's `Maximized`: it does not follow System Settings › “Double-click a window's title bar to” (Fill / Minimize). a press that starts on a button or the search field never moves the window. Known gap: egui-winit reads the zoomed state only at start-up and after our own `Maximized` command, so a window zoomed another way (green button, Window ▸ Zoom, snapping) makes the first double-click a no-op before the toggle catches up. Checked by hand on a real macOS window (drag, zoom, restore) |## Y. Menus