From e7a5c9e316dd43943a5e76fd003c8f7060ba4526 Mon Sep 17 00:00:00 2001 From: NaufalDzz Date: Tue, 17 Nov 2026 21:06:01 +0000 Subject: [PATCH] =?UTF-8?q?Menus:=20Window=20=E2=80=BA=20Contextual=20Task?= =?UTF-8?q?=20Bar=20tick=20follows=20the=20bar=20(#15489)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The menus are rebuilt only when `state_hash` changes or input arrives, and the hash left out the Window bars' flags. Hiding the contextual task bar with its Hide bar or `ui.set` therefore kept a stale tick. Hash the bars' on/off flags (not the task bar's place, which moves during a drag). Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com> --- crates/ui-egui/src/menus/native_menu.rs | 4 ++++ crates/ui-egui/src/menus/native_menu/tests.rs | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) 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 fbe2d2b5fe..870ea9661f 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"); +}