diff --git a/crates/ui-egui/src/menus/native_menu.rs b/crates/ui-egui/src/menus/native_menu.rs index f728cd13b9..793776e391 100644 --- a/crates/ui-egui/src/menus/native_menu.rs +++ b/crates/ui-egui/src/menus/native_menu.rs @@ -98,6 +98,10 @@ pub(crate) fn state_hash(app: &PhotocraftApp, input: Option) -> u64 { (&ui.recent_files, &app.workspaces.set.current, app.ui.palette.open, ui.transform.is_some(), ui.text_edit.is_some(), app.dialog_count()).hash(&mut h); // Cut and Copy are enabled while the typed text has a selection. ui.text_edit.as_ref().map(|e| e.anchor != e.caret).hash(&mut h); + // The Window bars' ticks; the Contextual Task Bar's Hide bar and `ui.set` change them without a menu click (#15489). + // Not the task bar's place, which moves every frame of a drag. + let p = &ui.panels; + (p.options_bar, p.status_bar, p.menu_bar, p.context_task_bar).hash(&mut h); (app.discard.is_some(), crate::distort_ui::modal_workspace(app)).hash(&mut h); crate::prefs_ui::recording(app).hash(&mut h); // The rows show the keymap's chords; the keymap follows these from the frame they change. diff --git a/crates/ui-egui/src/menus/native_menu/tests.rs b/crates/ui-egui/src/menus/native_menu/tests.rs index 1f9a22c56c..24defb62cc 100644 --- a/crates/ui-egui/src/menus/native_menu/tests.rs +++ b/crates/ui-egui/src/menus/native_menu/tests.rs @@ -219,3 +219,21 @@ fn opening_or_closing_a_workspace_without_input_rebuilds_the_menus() { app.framework.dialogs.cancel_by_id(&ctx, id); assert_eq!(state_hash(&app, None), closed, "and come back when it is cancelled"); } + +/// The Contextual Task Bar's tick follows the bar when its Hide bar or `ui.set` turns it off without a menu click +/// (#15489). +#[test] +fn the_task_bar_tick_follows_the_bar_hidden_without_a_menu_click() { + let (mut h, synced, _) = harness(true); + let ticked = |synced: &Synced| { + let bar = synced.borrow().last().cloned().expect("menus synced"); + bar.find(&CommandRef::new("window.panel.contextualTaskBar")).and_then(|it| it.kind.checked()) + }; + assert_eq!(ticked(&synced), Some(true)); + h.state_mut().ui.panels.context_task_bar = false; + h.run_steps(2); + assert_eq!(ticked(&synced), Some(false), "unticked once the bar is hidden"); + h.state_mut().ui.panels.context_task_bar = true; + h.run_steps(2); + assert_eq!(ticked(&synced), Some(true), "ticked again once it shows"); +}