gpui: Flash menu in menubar on macOS when action is triggered (#38588)
On macOS, traditionally when a keyboard shortcut is activated, the menu in the menu bar flashes to indicate that the action was recognised. <img width="289" height="172" alt="image" src="https://github.com/user-attachments/assets/a03ecd2f-f159-4f82-b4fd-227f34393703" /> This PR adds this functionality to GPUI, where when a keybind is pressed that triggers an action in the menu, the menu flashes. Release Notes: - N/A
This commit is contained in:
@@ -4023,6 +4023,8 @@ impl Window {
|
||||
let any_action = action.as_any();
|
||||
if action_type == any_action.type_id() {
|
||||
cx.propagate_event = false; // Actions stop propagation by default during the bubble phase
|
||||
cx.platform.on_action_triggered(action);
|
||||
|
||||
listener(any_action, DispatchPhase::Bubble, self, cx);
|
||||
|
||||
if !cx.propagate_event {
|
||||
@@ -4040,6 +4042,7 @@ impl Window {
|
||||
for listener in global_listeners.iter().rev() {
|
||||
cx.propagate_event = false; // Actions stop propagation by default during the bubble phase
|
||||
|
||||
cx.platform.on_action_triggered(action);
|
||||
listener(action.as_any(), DispatchPhase::Bubble, cx);
|
||||
if !cx.propagate_event {
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user