Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion crates/ui-egui/src/panels/topbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ fn window_handle(app: &LightcraftApp, ui: &mut egui::Ui, content: Rect, margin_l

pub 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 }))
Expand Down
18 changes: 18 additions & 0 deletions crates/ui-egui/src/tests_titlebar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
2 changes: 1 addition & 1 deletion docs/parity-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down