This is an automated email from the git hooks/post-receive script.
git pushed a commit to reference refs/pull/121/head
in repository efl.
View the commit online.
commit cb8ac2a16bd3770f36f58d8ba710e12e4e414e62
Author: Cedric BAIL <[email protected]>
AuthorDate: Wed Apr 29 17:29:18 2026 -0600
feat(ecore_cocoa): add ecore_cocoa_menu_item_key_equivalent_set
Lets the Cocoa menu bridge attach Cmd+key shortcuts to NSMenuItems.
Used by the upcoming default menu auto-population (Cmd+Q for Quit,
Cmd+N for New Window). Defaults the modifier to Command since that's
the only modifier currently needed.
---
src/lib/ecore_cocoa/Ecore_Cocoa.h | 18 ++++++++++++++++++
src/lib/ecore_cocoa/ecore_cocoa_menu.m | 21 +++++++++++++++++++++
2 files changed, 39 insertions(+)
diff --git a/src/lib/ecore_cocoa/Ecore_Cocoa.h b/src/lib/ecore_cocoa/Ecore_Cocoa.h
index ccdcce21f6..c51d0b37e1 100644
--- a/src/lib/ecore_cocoa/Ecore_Cocoa.h
+++ b/src/lib/ecore_cocoa/Ecore_Cocoa.h
@@ -727,6 +727,24 @@ EAPI void ecore_cocoa_menu_item_label_set(Ecore_Cocoa_Menu *menu,
const char *label)
EINA_ARG_NONNULL(1);
+/**
+ * Sets the keyboard equivalent for an existing menu item.
+ *
+ * On macOS this maps to NSMenuItem.keyEquivalent. The string is a single
+ * character (lowercase) — Cocoa interprets it with the Command modifier
+ * by default. Pass NULL or "" to clear.
+ *
+ * @param menu The menu.
+ * @param idx Item index returned by ecore_cocoa_menu_item_add().
+ * @param key Single-character UTF-8 string, or NULL/"" to clear.
+ *
+ * @since 1.28
+ */
+EAPI void ecore_cocoa_menu_item_key_equivalent_set(Ecore_Cocoa_Menu *menu,
+ int idx,
+ const char *key)
+ EINA_ARG_NONNULL(1);
+
/**
* Attaches a sub-menu to an existing menu item.
* @param menu The parent menu.
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_menu.m b/src/lib/ecore_cocoa/ecore_cocoa_menu.m
index dc5600e855..004e7c6aa9 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa_menu.m
+++ b/src/lib/ecore_cocoa/ecore_cocoa_menu.m
@@ -280,6 +280,27 @@ ecore_cocoa_menu_item_label_set(Ecore_Cocoa_Menu *menu, int idx, const char *lab
[item setTitle:label ? [NSString stringWithUTF8String:label] : @""];
}
+EAPI void
+ecore_cocoa_menu_item_key_equivalent_set(Ecore_Cocoa_Menu *menu,
+ int idx,
+ const char *key)
+{
+ NSMenuItem *item;
+
+ EINA_SAFETY_ON_NULL_RETURN(menu);
+ if (idx < 0 || idx >= [menu->ns_menu numberOfItems]) return;
+
+ item = [menu->ns_menu itemAtIndex:idx];
+ if (!key || !key[0])
+ {
+ [item setKeyEquivalent:@""];
+ return;
+ }
+ [item setKeyEquivalent:[NSString stringWithUTF8String:key]];
+ /* Default modifier is Command — explicit for clarity */
+ [item setKeyEquivalentModifierMask:NSEventModifierFlagCommand];
+}
+
EAPI void
ecore_cocoa_menu_submenu_set(Ecore_Cocoa_Menu *menu, int idx,
Ecore_Cocoa_Menu *submenu)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.