diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 17:05:59 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 17:05:59 +0300 |
| commit | d4d13e616cb15ef22479d9cb97922af93317a01a (patch) | |
| tree | 17f812ae15c239ce7d6c2a50a292ebd91375db8e /src/platform/cocoa/window.m | |
| parent | 305a341022c8119b89b32420445bb38154073fc4 (diff) | |
Add desktop services: open URI, notify, appearance, bell, and paths
wsap_term keeps per-platform code for opening links, notifications, the
bell, high-contrast detection, the executable and bundle paths, and the
default locale. These now live behind <yasl/desktop.h>.
On Linux, src/platform/freedesktop serves both backends. Opening a URI
runs xdg-open from PATH through a double fork, so the opener gets default
signal dispositions, an empty mask, a new session, and none of the
application's descriptors. Notifications and the Settings portal use the
session bus through libdbus-1, an optional dependency behind -Ddbus.
Appearance falls back to GTK_THEME without a portal. The bell uses
xdg-system-bell on Wayland and the XKB bell on X11.
Cocoa implements the same calls with NSWorkspace, UserNotifications, the
effective appearance, NSBeep, the bundle, and CFLocale. That code is not
built or run here; it needs a macOS check.
The desktop test runs under dbus-run-session against a fake notification
server and portal, and uses a fake xdg-open to check argument passing,
signal state, and descriptor inheritance.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/platform/cocoa/window.m')
| -rw-r--r-- | src/platform/cocoa/window.m | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/platform/cocoa/window.m b/src/platform/cocoa/window.m index 811a7c6..75dce54 100644 --- a/src/platform/cocoa/window.m +++ b/src/platform/cocoa/window.m @@ -1366,6 +1366,7 @@ struct cocoa_display *cocoa_display_open(struct yasl_loop *loop, const struct ya darwin_ctx.cbs = &darwin_ctx.base.callbacks; darwin_ctx.ud = spec->ud; if (spec->app_id) darwin_ctx.app_id = strdup(spec->app_id); + darwin_ctx.base.app_id = darwin_ctx.app_id; } return &darwin_ctx; } @@ -2191,6 +2192,14 @@ static bool impl_surface_place_under_pointer(struct yasl_surface *s, struct yasl return cocoa_surface_place_under_pointer((struct cocoa_surface *)s, at); } +static bool impl_surface_bell(struct yasl_surface *s) +{ + assert([NSThread isMainThread]); + (void)s; + NSBeep(); + return true; +} + static void *impl_display_get_native_handle(struct yasl_display *d) { return d ? (void *)NSApp : NULL; @@ -2249,6 +2258,7 @@ const struct yasl_backend_ops yasl_cocoa_backend = { .surface_show_window_menu = impl_surface_show_window_menu, .surface_drag_carry = impl_surface_drag_carry, .surface_place_under_pointer = impl_surface_place_under_pointer, + .surface_bell = impl_surface_bell, .display_get_native_handle = impl_display_get_native_handle, .surface_get_native_handle = impl_surface_get_native_handle, .surface_get_native_frame = impl_surface_get_native_frame, |
