This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch reproducible-widget-previews
in repository efl.
View the commit online.
commit 1de4b959298886ec9f94ed5f621696d67df840e3
Author: Cedric BAIL <[email protected]>
AuthorDate: Wed Mar 25 17:34:07 2026 -0600
feat(ecore_cocoa): add URL open callback for custom URL scheme handling
Add ecore_cocoa_url_open_cb_set() so EFL applications can receive macOS
URL open events from registered custom URL schemes (CFBundleURLTypes).
Implements application:openURLs: on Ecore_Cocoa_AppDelegate, which
iterates the received NSURL array and invokes the registered C callback
once per URL. Follows the same pattern as the existing reopen and
terminate callbacks.
Works for both cold launch (URL triggers app start) and warm launch
(app already running). The callback receives a caller-owned UTF-8
string of the full URL.
---
src/lib/ecore_cocoa/Ecore_Cocoa.h | 26 ++++++++++++++++++++++++++
src/lib/ecore_cocoa/ecore_cocoa.m | 6 ++++++
src/lib/ecore_cocoa/ecore_cocoa_app.h | 7 +++++--
src/lib/ecore_cocoa/ecore_cocoa_app.m | 22 ++++++++++++++++++++++
4 files changed, 59 insertions(+), 2 deletions(-)
diff --git a/src/lib/ecore_cocoa/Ecore_Cocoa.h b/src/lib/ecore_cocoa/Ecore_Cocoa.h
index 31c2fdee17..3474c6cc87 100644
--- a/src/lib/ecore_cocoa/Ecore_Cocoa.h
+++ b/src/lib/ecore_cocoa/Ecore_Cocoa.h
@@ -107,6 +107,20 @@ typedef Eina_Bool (*Ecore_Cocoa_Terminate_Cb)(Ecore_Cocoa_Object *sender);
*/
typedef Eina_Bool (*Ecore_Cocoa_Reopen_Cb)(Eina_Bool has_visible);
+/**
+ * @typedef Ecore_Cocoa_URL_Open_Cb
+ * Callback called when macOS asks the application to open a URL. This occurs
+ * when the user clicks a link using a custom URL scheme registered in the
+ * application's Info.plist (CFBundleURLTypes), e.g. @c terminology://tmux/work.
+ * This corresponds to the @c application:openURLs: NSApplicationDelegate method.
+ * The callback is invoked once per URL. Return EINA_TRUE to indicate the URL
+ * was handled, EINA_FALSE otherwise.
+ * @param url The URL string to open (UTF-8 encoded, caller-owned — the
+ * callback must copy it if it needs to persist beyond the call).
+ * @since 1.28
+ */
+typedef Eina_Bool (*Ecore_Cocoa_URL_Open_Cb)(const char *url);
+
/**
* @typedef Ecore_Cocoa_Cursor
* Values of the Cocoa cursors handled by Ecore_Cocoa
@@ -577,6 +591,18 @@ EAPI Eina_Bool ecore_cocoa_app_icon_set(const char *path)
*/
EAPI void ecore_cocoa_reopen_cb_set(Ecore_Cocoa_Reopen_Cb cb);
+/**
+ * Registers a callback to be invoked when macOS asks the application to open
+ * a URL via a registered custom URL scheme (CFBundleURLTypes in Info.plist).
+ * The callback fires for each URL, both on cold launch (URL triggers app
+ * start) and warm launch (app already running).
+ * If @c cb is NULL, incoming URL open requests are silently ignored.
+ * @param cb The URL open callback to set, or NULL to clear it.
+ * @see Ecore_Cocoa_URL_Open_Cb
+ * @since 1.28
+ */
+EAPI void ecore_cocoa_url_open_cb_set(Ecore_Cocoa_URL_Open_Cb cb);
+
/*
* The clipboard API is still BETA
diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m
index 336718da9c..6b81ea0908 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa.m
+++ b/src/lib/ecore_cocoa/ecore_cocoa.m
@@ -522,3 +522,9 @@ ecore_cocoa_reopen_cb_set(Ecore_Cocoa_Reopen_Cb cb)
{
[(Ecore_Cocoa_Application *)NSApp setReopenCb:cb];
}
+
+EAPI void
+ecore_cocoa_url_open_cb_set(Ecore_Cocoa_URL_Open_Cb cb)
+{
+ [(Ecore_Cocoa_Application *)NSApp setUrlOpenCb:cb];
+}
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_app.h b/src/lib/ecore_cocoa/ecore_cocoa_app.h
index 338170075a..4a058aa6ca 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa_app.h
+++ b/src/lib/ecore_cocoa/ecore_cocoa_app.h
@@ -8,8 +8,9 @@
{
Ecore_Timer *_timer;
NSDate *_expiration;
- Ecore_Cocoa_Terminate_Cb _terminate_cb;
- Ecore_Cocoa_Reopen_Cb _reopen_cb;
+ Ecore_Cocoa_Terminate_Cb _terminate_cb;
+ Ecore_Cocoa_Reopen_Cb _reopen_cb;
+ Ecore_Cocoa_URL_Open_Cb _url_open_cb;
BOOL _is_running;
}
@@ -24,6 +25,8 @@
- (Ecore_Cocoa_Terminate_Cb)terminateCb;
- (void)setReopenCb:(Ecore_Cocoa_Reopen_Cb)cb;
- (Ecore_Cocoa_Reopen_Cb)reopenCb;
+- (void)setUrlOpenCb:(Ecore_Cocoa_URL_Open_Cb)cb;
+- (Ecore_Cocoa_URL_Open_Cb)urlOpenCb;
- (void) pauseNSRunLoopMonitoring;
- (void) resumeNSRunLoopMonitoring;
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_app.m b/src/lib/ecore_cocoa/ecore_cocoa_app.m
index 105e9bc668..f928347a23 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa_app.m
+++ b/src/lib/ecore_cocoa/ecore_cocoa_app.m
@@ -141,6 +141,16 @@ _ecore_cocoa_run_loop_cb(void *data EINA_UNUSED)
return _reopen_cb;
}
+- (void)setUrlOpenCb:(Ecore_Cocoa_URL_Open_Cb)cb
+{
+ _url_open_cb = cb;
+}
+
+- (Ecore_Cocoa_URL_Open_Cb)urlOpenCb
+{
+ return _url_open_cb;
+}
+
@end
@@ -206,4 +216,16 @@ static Ecore_Cocoa_AppDelegate *_appDelegate = nil;
return NO;
}
+- (void)application:(NSApplication *)sender openURLs:(NSArray<NSURL *> *)urls
+{
+ Ecore_Cocoa_URL_Open_Cb cb = [(Ecore_Cocoa_Application *)sender urlOpenCb];
+ if (!cb) return;
+
+ for (NSURL *url in urls)
+ {
+ const char *s = [[url absoluteString] UTF8String];
+ if (s) cb(s);
+ }
+}
+
@end
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.