@native-sdk/cli 0.8.3 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/app.zig +905 -61
- package/build.zig +674 -373
- package/build.zig.zon +1 -0
- package/native-sdk.d.ts +6 -0
- package/package.json +12 -11
- package/packages/core/compile-surface/core.ts +455 -3
- package/packages/core/package-lock.json +11 -11
- package/packages/core/package.json +2 -2
- package/packages/core/scripts/compiler_typecheck.mjs +116 -15
- package/packages/core/scripts/gen_service_surface.mjs +268 -0
- package/packages/core/scripts/npm_static_spike.mjs +64 -0
- package/packages/core/scripts/run_external_core_compiler.mjs +77 -6
- package/packages/core/scripts/run_external_service_compiler.mjs +240 -0
- package/packages/core/scripts/stage_external_core.mjs +9 -1
- package/packages/core/scripts/stage_external_services.mjs +172 -0
- package/packages/core/scripts/surface_manifest_diff.mjs +253 -0
- package/packages/core/scripts/vendor_service_packages.mjs +189 -0
- package/packages/core/sdk/core.d.ts +214 -2
- package/packages/core/sdk/core.ts +715 -42
- package/packages/core/sdk/events.d.ts +50 -0
- package/packages/core/sdk/events.ts +75 -0
- package/packages/core/src/checker.ts +528 -15
- package/packages/core/src/cli.ts +143 -3
- package/packages/core/src/contract.ts +26 -5
- package/packages/core/src/devhost.ts +1849 -18
- package/packages/core/src/devhost_journal.mjs +181 -0
- package/packages/core/src/devhost_resolver.mjs +17 -1
- package/packages/core/src/devhost_service_worker.mjs +90 -0
- package/packages/core/src/diagnostics.ts +84 -18
- package/packages/core/src/frontend.ts +204 -34
- package/packages/core/src/modules.ts +129 -80
- package/packages/core/src/service_contract.ts +597 -0
- package/packages/core/src/sqlite_cli.ts +93 -0
- package/packages/core/src/sqlite_codegen.ts +806 -0
- package/packages/core/src/sqlite_runtime_policy.ts +364 -0
- package/packages/core/src/typed_ast.ts +36 -8
- package/skill-data/core/SKILL.md +4 -2
- package/skill-data/core/references/project-anatomy.md +3 -2
- package/skill-data/core/references/web-engines-packaging-debugging.md +3 -1
- package/skill-data/native-ui/SKILL.md +55 -8
- package/skill-data/ts-core/SKILL.md +92 -40
- package/skill-data/ts-services/SKILL.md +126 -0
- package/skill-data/ts-services/references/service-surface.md +603 -0
- package/skill-data/zig/SKILL.md +1 -1
- package/skills/native-sdk/SKILL.md +1 -1
- package/src/app_runner/no_migrations.zig +3 -0
- package/src/app_runner/no_services.zig +20 -0
- package/src/app_runner/root.zig +104 -4
- package/src/app_runner/ts_core_main.zig +268 -4
- package/src/automation/snapshot.zig +23 -5
- package/src/embed/app_exports.zig +11 -1
- package/src/embed/c_api.zig +48 -2
- package/src/embed/conversions.zig +4 -5
- package/src/embed/host.zig +115 -1
- package/src/embed/root.zig +7 -0
- package/src/embed/tests.zig +213 -0
- package/src/embed/types.zig +51 -0
- package/src/embed/ui_host.zig +121 -5
- package/src/platform/android/NativeSdkActivity.java +131 -0
- package/src/platform/android/android_host.c +182 -1
- package/src/platform/android/native_sdk_app.h +17 -0
- package/src/platform/ios/native_sdk_app.h +17 -0
- package/src/platform/ios/uikit_host.m +115 -0
- package/src/platform/linux/cef_host.cpp +1 -1
- package/src/platform/linux/gtk_host.c +89 -17
- package/src/platform/linux/gtk_host.h +3 -0
- package/src/platform/linux/root.zig +41 -18
- package/src/platform/macos/appkit_host.h +26 -3
- package/src/platform/macos/appkit_host.m +1051 -129
- package/src/platform/macos/capture_info_plist.c +25 -0
- package/src/platform/macos/cef_host.mm +270 -36
- package/src/platform/macos/root.zig +312 -34
- package/src/platform/null_platform.zig +281 -19
- package/src/platform/null_platform_tests.zig +74 -0
- package/src/platform/root.zig +16 -0
- package/src/platform/types.zig +279 -15
- package/src/platform/windows/root.zig +243 -21
- package/src/platform/windows/webview2_host.cpp +464 -46
- package/src/primitives/app_manifest/comptime_scene.zig +2 -0
- package/src/primitives/app_manifest/root.zig +4 -0
- package/src/primitives/app_manifest/tests.zig +3 -0
- package/src/primitives/app_manifest/types.zig +34 -0
- package/src/primitives/app_manifest/validation.zig +19 -1
- package/src/primitives/canvas/code_tests.zig +9 -9
- package/src/primitives/canvas/events.zig +12 -11
- package/src/primitives/canvas/frame.zig +44 -9
- package/src/primitives/canvas/icons/mic.svg +1 -0
- package/src/primitives/canvas/icons.zig +2 -0
- package/src/primitives/canvas/root.zig +8 -0
- package/src/primitives/canvas/text_span_tests.zig +39 -0
- package/src/primitives/canvas/ui.zig +23 -4
- package/src/primitives/canvas/ui_markup.zig +15 -0
- package/src/primitives/canvas/ui_markup_compiled.zig +9 -0
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +1 -1
- package/src/primitives/canvas/ui_markup_tests.zig +5 -0
- package/src/primitives/canvas/ui_markup_view.zig +9 -0
- package/src/primitives/canvas/ui_markup_view_tests.zig +9 -6
- package/src/primitives/canvas/ui_schema.zig +19 -10
- package/src/primitives/canvas/ui_schema_tests.zig +5 -3
- package/src/primitives/canvas/ui_tests.zig +18 -4
- package/src/primitives/canvas/widget_invalidation.zig +9 -2
- package/src/primitives/canvas/widget_render.zig +296 -114
- package/src/primitives/canvas/widget_runtime_tests.zig +133 -0
- package/src/primitives/canvas/widget_text_input.zig +10 -10
- package/src/primitives/canvas/widget_tree.zig +1 -1
- package/src/primitives/canvas/widgets.zig +29 -5
- package/src/root.zig +56 -0
- package/src/runtime/api.zig +11 -0
- package/src/runtime/automation_snapshot.zig +4 -0
- package/src/runtime/automation_widget_dispatch.zig +1 -0
- package/src/runtime/bridge_payload.zig +2 -0
- package/src/runtime/bridge_permission_tests.zig +23 -2
- package/src/runtime/bridge_responses.zig +3 -1
- package/src/runtime/canvas_frame.zig +31 -13
- package/src/runtime/canvas_frame_animation_tests.zig +4 -0
- package/src/runtime/canvas_frame_invalidation_tests.zig +35 -10
- package/src/runtime/canvas_widget_anchored_tests.zig +83 -0
- package/src/runtime/canvas_widget_events.zig +69 -24
- package/src/runtime/canvas_widget_runtime.zig +101 -6
- package/src/runtime/canvas_widget_scroll_driver_tests.zig +47 -4
- package/src/runtime/canvas_widget_scroll_drivers.zig +3 -3
- package/src/runtime/canvas_widget_semantics_tests.zig +2 -0
- package/src/runtime/canvas_widget_split_tree_tests.zig +228 -0
- package/src/runtime/canvas_widget_state.zig +6 -1
- package/src/runtime/canvas_widget_text_tests.zig +112 -3
- package/src/runtime/clock.zig +13 -1
- package/src/runtime/core.zig +133 -1
- package/src/runtime/credentials_store.zig +115 -0
- package/src/runtime/effects.zig +2568 -75
- package/src/runtime/effects_audio_capture_tests.zig +251 -0
- package/src/runtime/effects_credentials_tests.zig +332 -0
- package/src/runtime/effects_host_tests.zig +208 -1
- package/src/runtime/effects_relational_tests.zig +314 -0
- package/src/runtime/effects_store_tests.zig +211 -0
- package/src/runtime/flow.zig +14 -1
- package/src/runtime/gpu_surface_events.zig +6 -1
- package/src/runtime/native_command_event_tests.zig +42 -0
- package/src/runtime/persist_store.zig +666 -0
- package/src/runtime/record_store.zig +788 -0
- package/src/runtime/relational_store.zig +854 -0
- package/src/runtime/root.zig +52 -0
- package/src/runtime/runtime_event_tests.zig +70 -0
- package/src/runtime/service_host.zig +711 -0
- package/src/runtime/service_pool.zig +1314 -0
- package/src/runtime/session_blobs.zig +1 -1
- package/src/runtime/session_journal.zig +102 -0
- package/src/runtime/session_record.zig +177 -0
- package/src/runtime/session_replay.zig +109 -4
- package/src/runtime/shell_layout.zig +1 -0
- package/src/runtime/shell_layout_tests.zig +120 -0
- package/src/runtime/sqlite_engine.zig +474 -0
- package/src/runtime/state.zig +6 -0
- package/src/runtime/system_services.zig +49 -10
- package/src/runtime/tests.zig +5 -0
- package/src/runtime/ts_core_host.zig +1189 -118
- package/src/runtime/ts_core_host_tests.zig +638 -11
- package/src/runtime/ts_ui_app.zig +537 -1
- package/src/runtime/ui_app.zig +160 -19
- package/src/runtime/ui_app_tests.zig +203 -5
- package/src/runtime/validation.zig +22 -0
- package/src/runtime/view.zig +11 -0
- package/src/runtime/view_widget_scroll.zig +56 -5
- package/src/runtime/view_widget_text.zig +24 -5
- package/src/runtime/view_widget_tree.zig +1 -1
- package/src/runtime/window_storage.zig +1 -0
- package/src/runtime/window_view_runtime.zig +2 -3
- package/src/runtime/window_views.zig +19 -0
- package/src/tooling/android.zig +21 -16
- package/src/tooling/db.zig +160 -0
- package/src/tooling/ios.zig +7 -1
- package/src/tooling/manifest.zig +1248 -2
- package/src/tooling/package.zig +953 -6
- package/src/tooling/raw_manifest.zig +65 -0
- package/src/tooling/root.zig +1 -0
- package/src/tooling/templates.zig +216 -4
- package/src/tooling/ts_core.zig +283 -17
- package/src/tooling/verbs.zig +7 -0
- package/third_party/sqlite/README.md +13 -0
- package/third_party/sqlite/sqlite3.c +269649 -0
- package/third_party/sqlite/sqlite3.h +14349 -0
- package/tools/corewire/core_abi.zig +14 -2
- package/tools/corewire/emit.zig +98 -29
- package/tools/corewire/emit_facade.zig +414 -23
- package/tools/corewire/emit_profile.zig +6 -2
- package/tools/corewire/emit_service.zig +924 -0
- package/tools/corewire/main.zig +122 -0
- package/tools/corewire/service_contract.zig +250 -0
- package/tools/corewire/sidecar.zig +26 -15
|
@@ -358,6 +358,7 @@ typedef struct native_sdk_gtk_window {
|
|
|
358
358
|
int click_through;
|
|
359
359
|
int activate_on_show;
|
|
360
360
|
int show_on_first_present;
|
|
361
|
+
int policy_hidden;
|
|
361
362
|
int shown;
|
|
362
363
|
/* One-second safety reveal for a canvas window whose first present
|
|
363
364
|
* never arrives. Zero once cancelled/fired. */
|
|
@@ -2518,6 +2519,7 @@ static void native_sdk_emit_window_frame(native_sdk_gtk_host_t *host, native_sdk
|
|
|
2518
2519
|
.scale = scale,
|
|
2519
2520
|
.open = open,
|
|
2520
2521
|
.focused = focused,
|
|
2522
|
+
.hidden = open ? win->policy_hidden : 0,
|
|
2521
2523
|
.label = win->label ? win->label : "",
|
|
2522
2524
|
.label_len = win->label ? strlen(win->label) : 0,
|
|
2523
2525
|
.title = win->title ? win->title : "",
|
|
@@ -3076,6 +3078,7 @@ static native_sdk_gtk_window_t *native_sdk_create_window_internal(native_sdk_gtk
|
|
|
3076
3078
|
win->click_through = (window_flags & (1u << 2)) != 0;
|
|
3077
3079
|
win->activate_on_show = (window_flags & (1u << 3)) == 0;
|
|
3078
3080
|
win->show_on_first_present = show_policy == 1;
|
|
3081
|
+
win->policy_hidden = show_policy == 2;
|
|
3079
3082
|
if (!win->label || !win->title) {
|
|
3080
3083
|
free(win->label);
|
|
3081
3084
|
free(win->title);
|
|
@@ -3201,7 +3204,7 @@ static void on_activate(GtkApplication *app, gpointer data) {
|
|
|
3201
3204
|
host->init_show_policy, host->init_window_flags);
|
|
3202
3205
|
if (!win) return;
|
|
3203
3206
|
|
|
3204
|
-
if (!win->show_on_first_present) native_sdk_show_window_implicit(win);
|
|
3207
|
+
if (!win->show_on_first_present && !win->policy_hidden) native_sdk_show_window_implicit(win);
|
|
3205
3208
|
native_sdk_emit_app_active_if_changed(host);
|
|
3206
3209
|
|
|
3207
3210
|
native_sdk_emit(host, (native_sdk_gtk_event_t){ .kind = NATIVE_SDK_GTK_EVENT_START });
|
|
@@ -3772,7 +3775,7 @@ int native_sdk_gtk_create_window(native_sdk_gtk_host_t *host, uint64_t window_id
|
|
|
3772
3775
|
free(label);
|
|
3773
3776
|
if (!win) return 0;
|
|
3774
3777
|
|
|
3775
|
-
if (!win->show_on_first_present) native_sdk_show_window_implicit(win);
|
|
3778
|
+
if (!win->show_on_first_present && !win->policy_hidden) native_sdk_show_window_implicit(win);
|
|
3776
3779
|
return 1;
|
|
3777
3780
|
}
|
|
3778
3781
|
|
|
@@ -3943,6 +3946,7 @@ int native_sdk_gtk_focus_window(native_sdk_gtk_host_t *host, uint64_t window_id)
|
|
|
3943
3946
|
native_sdk_gtk_window_t *win = native_sdk_find_window(host, window_id);
|
|
3944
3947
|
if (!win || !win->gtk_window) return 0;
|
|
3945
3948
|
native_sdk_cancel_deferred_show(win);
|
|
3949
|
+
win->policy_hidden = 0;
|
|
3946
3950
|
gtk_window_present(win->gtk_window);
|
|
3947
3951
|
win->shown = 1;
|
|
3948
3952
|
native_sdk_emit_window_frame(host, win, 1);
|
|
@@ -3953,12 +3957,24 @@ int native_sdk_gtk_show_window(native_sdk_gtk_host_t *host, uint64_t window_id)
|
|
|
3953
3957
|
native_sdk_gtk_window_t *win = native_sdk_find_window(host, window_id);
|
|
3954
3958
|
if (!win || !win->gtk_window) return 0;
|
|
3955
3959
|
native_sdk_cancel_deferred_show(win);
|
|
3960
|
+
win->policy_hidden = 0;
|
|
3956
3961
|
if (!win->activate_on_show) gtk_window_unminimize(win->gtk_window);
|
|
3957
3962
|
native_sdk_show_window_implicit(win);
|
|
3958
3963
|
native_sdk_emit_window_frame(host, win, 1);
|
|
3959
3964
|
return 1;
|
|
3960
3965
|
}
|
|
3961
3966
|
|
|
3967
|
+
int native_sdk_gtk_hide_window(native_sdk_gtk_host_t *host, uint64_t window_id) {
|
|
3968
|
+
native_sdk_gtk_window_t *win = native_sdk_find_window(host, window_id);
|
|
3969
|
+
if (!win || !win->gtk_window) return 0;
|
|
3970
|
+
native_sdk_cancel_deferred_show(win);
|
|
3971
|
+
win->policy_hidden = 1;
|
|
3972
|
+
win->shown = 0;
|
|
3973
|
+
gtk_widget_set_visible(GTK_WIDGET(win->gtk_window), FALSE);
|
|
3974
|
+
native_sdk_emit_window_frame(host, win, 1);
|
|
3975
|
+
return 1;
|
|
3976
|
+
}
|
|
3977
|
+
|
|
3962
3978
|
int native_sdk_gtk_close_window(native_sdk_gtk_host_t *host, uint64_t window_id) {
|
|
3963
3979
|
native_sdk_gtk_window_t *win = native_sdk_find_window(host, window_id);
|
|
3964
3980
|
if (!win || !win->gtk_window) return 0;
|
|
@@ -4381,7 +4397,7 @@ int native_sdk_gtk_present_gpu_surface_pixels(native_sdk_gtk_host_t *host, uint6
|
|
|
4381
4397
|
* placeholder pump — from here on frames exist only on demand. */
|
|
4382
4398
|
const int first_present = !view->gpu_presented;
|
|
4383
4399
|
view->gpu_presented = 1;
|
|
4384
|
-
if (first_present && win && !win->shown) {
|
|
4400
|
+
if (first_present && win && !win->shown && !win->policy_hidden) {
|
|
4385
4401
|
native_sdk_cancel_deferred_show(win);
|
|
4386
4402
|
native_sdk_show_window_implicit(win);
|
|
4387
4403
|
native_sdk_emit_window_frame(host, win, 1);
|
|
@@ -4966,11 +4982,26 @@ static native_sdk_secret_api_t *native_sdk_load_secret_api(void) {
|
|
|
4966
4982
|
return &native_sdk_secret_api;
|
|
4967
4983
|
}
|
|
4968
4984
|
|
|
4969
|
-
static void
|
|
4985
|
+
static void native_sdk_secure_gfree(char *bytes, size_t len) {
|
|
4970
4986
|
if (!bytes) return;
|
|
4971
4987
|
volatile char *cursor = bytes;
|
|
4972
4988
|
for (size_t i = 0; i < len; i++) cursor[i] = 0;
|
|
4973
|
-
|
|
4989
|
+
g_free(bytes);
|
|
4990
|
+
}
|
|
4991
|
+
|
|
4992
|
+
static const char native_sdk_credential_bytes_prefix[] = "native-sdk:bytes:v1:";
|
|
4993
|
+
|
|
4994
|
+
/* libsecret reports a locked collection through GError rather than a
|
|
4995
|
+
* dedicated return value. Keep that condition distinct at the C seam so the
|
|
4996
|
+
* core effect can deliver its closed `locked` outcome instead of flattening
|
|
4997
|
+
* it into `io_failed`. */
|
|
4998
|
+
static int native_sdk_secret_error_locked(const GError *error) {
|
|
4999
|
+
if (!error || !error->message) return 0;
|
|
5000
|
+
char *lower = g_ascii_strdown(error->message, -1);
|
|
5001
|
+
if (!lower) return 0;
|
|
5002
|
+
int locked = strstr(lower, "locked") != NULL;
|
|
5003
|
+
g_free(lower);
|
|
5004
|
+
return locked;
|
|
4974
5005
|
}
|
|
4975
5006
|
|
|
4976
5007
|
int native_sdk_gtk_credentials_available(native_sdk_gtk_host_t *host) {
|
|
@@ -4981,15 +5012,17 @@ int native_sdk_gtk_credentials_available(native_sdk_gtk_host_t *host) {
|
|
|
4981
5012
|
int native_sdk_gtk_set_credential(native_sdk_gtk_host_t *host, const char *service, size_t service_len, const char *account, size_t account_len, const char *secret, size_t secret_len) {
|
|
4982
5013
|
(void)host;
|
|
4983
5014
|
native_sdk_secret_api_t *api = native_sdk_load_secret_api();
|
|
4984
|
-
if (!api || !service || service_len == 0 || !account || account_len == 0 || !secret
|
|
5015
|
+
if (!api || !service || service_len == 0 || !account || account_len == 0 || (!secret && secret_len > 0)) return 0;
|
|
4985
5016
|
|
|
4986
5017
|
char *service_copy = native_sdk_strndup(service, service_len);
|
|
4987
5018
|
char *account_copy = native_sdk_strndup(account, account_len);
|
|
4988
|
-
|
|
5019
|
+
gchar *encoded = g_base64_encode((const guchar *)(secret ? secret : ""), secret_len);
|
|
5020
|
+
char *secret_copy = encoded ? g_strdup_printf("%s%s", native_sdk_credential_bytes_prefix, encoded) : NULL;
|
|
4989
5021
|
if (!service_copy || !account_copy || !secret_copy) {
|
|
4990
5022
|
free(service_copy);
|
|
4991
5023
|
free(account_copy);
|
|
4992
|
-
|
|
5024
|
+
if (encoded) native_sdk_secure_gfree(encoded, strlen(encoded));
|
|
5025
|
+
if (secret_copy) native_sdk_secure_gfree(secret_copy, strlen(secret_copy));
|
|
4993
5026
|
return 0;
|
|
4994
5027
|
}
|
|
4995
5028
|
|
|
@@ -4997,32 +5030,35 @@ int native_sdk_gtk_set_credential(native_sdk_gtk_host_t *host, const char *servi
|
|
|
4997
5030
|
if (!label) {
|
|
4998
5031
|
free(service_copy);
|
|
4999
5032
|
free(account_copy);
|
|
5000
|
-
|
|
5033
|
+
native_sdk_secure_gfree(encoded, strlen(encoded));
|
|
5034
|
+
native_sdk_secure_gfree(secret_copy, strlen(secret_copy));
|
|
5001
5035
|
return 0;
|
|
5002
5036
|
}
|
|
5003
5037
|
|
|
5004
5038
|
GError *error = NULL;
|
|
5005
5039
|
gboolean ok = api->store_sync(&native_sdk_credential_schema, "default", label, secret_copy, NULL, &error, "service", service_copy, "account", account_copy, NULL);
|
|
5040
|
+
int locked = native_sdk_secret_error_locked(error);
|
|
5006
5041
|
if (error) g_error_free(error);
|
|
5007
5042
|
|
|
5008
5043
|
g_free(label);
|
|
5009
5044
|
free(service_copy);
|
|
5010
5045
|
free(account_copy);
|
|
5011
|
-
|
|
5012
|
-
|
|
5046
|
+
native_sdk_secure_gfree(encoded, strlen(encoded));
|
|
5047
|
+
native_sdk_secure_gfree(secret_copy, strlen(secret_copy));
|
|
5048
|
+
return locked ? -2 : (ok ? 1 : 0);
|
|
5013
5049
|
}
|
|
5014
5050
|
|
|
5015
5051
|
size_t native_sdk_gtk_get_credential(native_sdk_gtk_host_t *host, const char *service, size_t service_len, const char *account, size_t account_len, char *buffer, size_t buffer_len) {
|
|
5016
5052
|
(void)host;
|
|
5017
5053
|
native_sdk_secret_api_t *api = native_sdk_load_secret_api();
|
|
5018
|
-
if (!api || !service || service_len == 0 || !account || account_len == 0 || !buffer) return
|
|
5054
|
+
if (!api || !service || service_len == 0 || !account || account_len == 0 || (!buffer && buffer_len > 0)) return SIZE_MAX - 1;
|
|
5019
5055
|
|
|
5020
5056
|
char *service_copy = native_sdk_strndup(service, service_len);
|
|
5021
5057
|
char *account_copy = native_sdk_strndup(account, account_len);
|
|
5022
5058
|
if (!service_copy || !account_copy) {
|
|
5023
5059
|
free(service_copy);
|
|
5024
5060
|
free(account_copy);
|
|
5025
|
-
return
|
|
5061
|
+
return SIZE_MAX - 1;
|
|
5026
5062
|
}
|
|
5027
5063
|
|
|
5028
5064
|
GError *error = NULL;
|
|
@@ -5030,14 +5066,28 @@ size_t native_sdk_gtk_get_credential(native_sdk_gtk_host_t *host, const char *se
|
|
|
5030
5066
|
free(service_copy);
|
|
5031
5067
|
free(account_copy);
|
|
5032
5068
|
if (error) {
|
|
5069
|
+
int locked = native_sdk_secret_error_locked(error);
|
|
5033
5070
|
g_error_free(error);
|
|
5034
|
-
return
|
|
5071
|
+
return locked ? SIZE_MAX - 2 : SIZE_MAX - 1;
|
|
5035
5072
|
}
|
|
5036
|
-
if (!password) return
|
|
5073
|
+
if (!password) return SIZE_MAX;
|
|
5037
5074
|
|
|
5038
5075
|
size_t password_len = strlen(password);
|
|
5076
|
+
const size_t prefix_len = sizeof(native_sdk_credential_bytes_prefix) - 1;
|
|
5077
|
+
if (password_len >= prefix_len && memcmp(password, native_sdk_credential_bytes_prefix, prefix_len) == 0) {
|
|
5078
|
+
gsize decoded_len = 0;
|
|
5079
|
+
guchar *decoded = g_base64_decode(password + prefix_len, &decoded_len);
|
|
5080
|
+
if (!decoded && decoded_len != 0) {
|
|
5081
|
+
native_sdk_secure_gfree(password, password_len);
|
|
5082
|
+
return SIZE_MAX - 1;
|
|
5083
|
+
}
|
|
5084
|
+
if (decoded_len <= buffer_len && decoded_len > 0) memcpy(buffer, decoded, decoded_len);
|
|
5085
|
+
if (decoded) native_sdk_secure_gfree((char *)decoded, decoded_len);
|
|
5086
|
+
native_sdk_secure_gfree(password, password_len);
|
|
5087
|
+
return decoded_len;
|
|
5088
|
+
}
|
|
5039
5089
|
if (password_len <= buffer_len && password_len > 0) memcpy(buffer, password, password_len);
|
|
5040
|
-
|
|
5090
|
+
native_sdk_secure_gfree(password, password_len);
|
|
5041
5091
|
return password_len;
|
|
5042
5092
|
}
|
|
5043
5093
|
|
|
@@ -5059,12 +5109,34 @@ int native_sdk_gtk_delete_credential(native_sdk_gtk_host_t *host, const char *se
|
|
|
5059
5109
|
free(service_copy);
|
|
5060
5110
|
free(account_copy);
|
|
5061
5111
|
if (error) {
|
|
5112
|
+
int locked = native_sdk_secret_error_locked(error);
|
|
5062
5113
|
g_error_free(error);
|
|
5063
|
-
return -1;
|
|
5114
|
+
return locked ? -2 : -1;
|
|
5064
5115
|
}
|
|
5065
5116
|
return ok ? 1 : 0;
|
|
5066
5117
|
}
|
|
5067
5118
|
|
|
5119
|
+
size_t native_sdk_gtk_format_local_time(native_sdk_gtk_host_t *host, int64_t timestamp_ms, int style, char *buffer, size_t buffer_len) {
|
|
5120
|
+
(void)host;
|
|
5121
|
+
if (!buffer || buffer_len == 0 || style < 0 || style > 2) return 0;
|
|
5122
|
+
gint64 seconds = timestamp_ms / 1000;
|
|
5123
|
+
if (timestamp_ms < 0 && timestamp_ms % 1000 != 0) seconds -= 1;
|
|
5124
|
+
GDateTime *date = g_date_time_new_from_unix_local(seconds);
|
|
5125
|
+
if (!date) return 0;
|
|
5126
|
+
const char *pattern = style == 0 ? "%x" : (style == 1 ? "%X" : "%x %X");
|
|
5127
|
+
char *text = g_date_time_format(date, pattern);
|
|
5128
|
+
g_date_time_unref(date);
|
|
5129
|
+
if (!text) return 0;
|
|
5130
|
+
size_t len = strlen(text);
|
|
5131
|
+
if (len == 0 || len > buffer_len) {
|
|
5132
|
+
g_free(text);
|
|
5133
|
+
return 0;
|
|
5134
|
+
}
|
|
5135
|
+
memcpy(buffer, text, len);
|
|
5136
|
+
g_free(text);
|
|
5137
|
+
return len;
|
|
5138
|
+
}
|
|
5139
|
+
|
|
5068
5140
|
/* ---------------------------------------------------------------- audio
|
|
5069
5141
|
*
|
|
5070
5142
|
* Backend: the GStreamer PLAYBIN pipeline (gst-1.0). One in-box element
|
|
@@ -43,6 +43,7 @@ typedef struct {
|
|
|
43
43
|
double y;
|
|
44
44
|
int open;
|
|
45
45
|
int focused;
|
|
46
|
+
int hidden;
|
|
46
47
|
const char *label;
|
|
47
48
|
size_t label_len;
|
|
48
49
|
const char *title;
|
|
@@ -217,6 +218,7 @@ void native_sdk_gtk_start_timer(native_sdk_gtk_host_t *host, uint64_t timer_id,
|
|
|
217
218
|
void native_sdk_gtk_cancel_timer(native_sdk_gtk_host_t *host, uint64_t timer_id);
|
|
218
219
|
int native_sdk_gtk_focus_window(native_sdk_gtk_host_t *host, uint64_t window_id);
|
|
219
220
|
int native_sdk_gtk_show_window(native_sdk_gtk_host_t *host, uint64_t window_id);
|
|
221
|
+
int native_sdk_gtk_hide_window(native_sdk_gtk_host_t *host, uint64_t window_id);
|
|
220
222
|
int native_sdk_gtk_close_window(native_sdk_gtk_host_t *host, uint64_t window_id);
|
|
221
223
|
/* The real OS minimize verb (gtk_window_minimize), for app-drawn window
|
|
222
224
|
* controls on chromeless windows. Returns 0 when the window id is
|
|
@@ -253,6 +255,7 @@ int native_sdk_gtk_credentials_available(native_sdk_gtk_host_t *host);
|
|
|
253
255
|
int native_sdk_gtk_set_credential(native_sdk_gtk_host_t *host, const char *service, size_t service_len, const char *account, size_t account_len, const char *secret, size_t secret_len);
|
|
254
256
|
size_t native_sdk_gtk_get_credential(native_sdk_gtk_host_t *host, const char *service, size_t service_len, const char *account, size_t account_len, char *buffer, size_t buffer_len);
|
|
255
257
|
int native_sdk_gtk_delete_credential(native_sdk_gtk_host_t *host, const char *service, size_t service_len, const char *account, size_t account_len);
|
|
258
|
+
size_t native_sdk_gtk_format_local_time(native_sdk_gtk_host_t *host, int64_t timestamp_ms, int style, char *buffer, size_t buffer_len);
|
|
256
259
|
/* Audio playback (GStreamer playbin, runtime-loaded like libsecret).
|
|
257
260
|
* native_sdk_gtk_audio_available answers whether the library resolved
|
|
258
261
|
* at runtime; when it did not, every load below answers 3 (no backend)
|
|
@@ -47,6 +47,7 @@ const GtkEvent = extern struct {
|
|
|
47
47
|
y: f64,
|
|
48
48
|
open: c_int,
|
|
49
49
|
focused: c_int,
|
|
50
|
+
hidden: c_int,
|
|
50
51
|
label: [*]const u8,
|
|
51
52
|
label_len: usize,
|
|
52
53
|
title: [*]const u8,
|
|
@@ -136,6 +137,7 @@ extern fn native_sdk_gtk_start_timer(host: *GtkHost, timer_id: u64, interval_ns:
|
|
|
136
137
|
extern fn native_sdk_gtk_cancel_timer(host: *GtkHost, timer_id: u64) void;
|
|
137
138
|
extern fn native_sdk_gtk_focus_window(host: *GtkHost, window_id: u64) c_int;
|
|
138
139
|
extern fn native_sdk_gtk_show_window(host: *GtkHost, window_id: u64) c_int;
|
|
140
|
+
extern fn native_sdk_gtk_hide_window(host: *GtkHost, window_id: u64) c_int;
|
|
139
141
|
extern fn native_sdk_gtk_close_window(host: *GtkHost, window_id: u64) c_int;
|
|
140
142
|
extern fn native_sdk_gtk_minimize_window(host: *GtkHost, window_id: u64) c_int;
|
|
141
143
|
extern fn native_sdk_gtk_create_view(host: *GtkHost, window_id: u64, label: [*]const u8, label_len: usize, kind: c_int, parent: [*]const u8, parent_len: usize, x: f64, y: f64, width: f64, height: f64, layer: c_int, visible: c_int, enabled: c_int, role: [*]const u8, role_len: usize, accessibility_label: [*]const u8, accessibility_label_len: usize, text: [*]const u8, text_len: usize, command: [*]const u8, command_len: usize) c_int;
|
|
@@ -161,6 +163,7 @@ extern fn native_sdk_gtk_credentials_available(host: *GtkHost) c_int;
|
|
|
161
163
|
extern fn native_sdk_gtk_set_credential(host: *GtkHost, service: [*]const u8, service_len: usize, account: [*]const u8, account_len: usize, secret: [*]const u8, secret_len: usize) c_int;
|
|
162
164
|
extern fn native_sdk_gtk_get_credential(host: *GtkHost, service: [*]const u8, service_len: usize, account: [*]const u8, account_len: usize, buffer: [*]u8, buffer_len: usize) usize;
|
|
163
165
|
extern fn native_sdk_gtk_delete_credential(host: *GtkHost, service: [*]const u8, service_len: usize, account: [*]const u8, account_len: usize) c_int;
|
|
166
|
+
extern fn native_sdk_gtk_format_local_time(host: *GtkHost, timestamp_ms: i64, style: c_int, buffer: [*]u8, buffer_len: usize) usize;
|
|
164
167
|
extern fn native_sdk_gtk_audio_available(host: *GtkHost) c_int;
|
|
165
168
|
extern fn native_sdk_gtk_audio_spectrum_available(host: *GtkHost) c_int;
|
|
166
169
|
extern fn native_sdk_gtk_audio_load(host: *GtkHost, path: [*]const u8, path_len: usize) c_int;
|
|
@@ -254,9 +257,8 @@ pub const LinuxPlatform = struct {
|
|
|
254
257
|
app_info: platform_mod.AppInfo,
|
|
255
258
|
surface_value: platform_mod.Surface,
|
|
256
259
|
state: RunState = .{},
|
|
257
|
-
/// Latched when
|
|
258
|
-
///
|
|
259
|
-
/// `PlatformServices.note_channel_wake_abandoned_fn`): the stale
|
|
260
|
+
/// Latched when effects teardown abandons an in-flight platform call
|
|
261
|
+
/// (a channel wake or blocking credential operation): the stale
|
|
260
262
|
/// call still holds this platform as its context and may execute
|
|
261
263
|
/// into it at any later time, so `deinit` must skip destruction
|
|
262
264
|
/// and leak the host, process-lived — and the wrapper struct the
|
|
@@ -329,13 +331,13 @@ pub const LinuxPlatform = struct {
|
|
|
329
331
|
}
|
|
330
332
|
|
|
331
333
|
pub fn deinit(self: *LinuxPlatform) void {
|
|
332
|
-
// An abandoned
|
|
334
|
+
// An abandoned platform call may still enter this host at
|
|
333
335
|
// any later time (see `channel_wake_abandoned`): destroying it
|
|
334
336
|
// would turn that stale call into a use-after-free, so the
|
|
335
337
|
// host is deliberately leaked, process-lived — the
|
|
336
338
|
// abandoned-worker idiom, applied to the platform itself.
|
|
337
339
|
if (self.channel_wake_abandoned.load(.seq_cst)) {
|
|
338
|
-
std.debug.print("linux platform teardown: an abandoned
|
|
340
|
+
std.debug.print("linux platform teardown: an abandoned platform call may still enter this host; skipping destruction and leaking it (and the wrapper it enters through), process-lived, so the stale call stays safe\n", .{});
|
|
339
341
|
return;
|
|
340
342
|
}
|
|
341
343
|
native_sdk_gtk_destroy(self.host);
|
|
@@ -363,6 +365,7 @@ pub const LinuxPlatform = struct {
|
|
|
363
365
|
.focus_window_fn = focusWindow,
|
|
364
366
|
.close_window_fn = closeWindow,
|
|
365
367
|
.minimize_window_fn = minimizeWindow,
|
|
368
|
+
.hide_window_fn = hideWindow,
|
|
366
369
|
.show_window_fn = showWindow,
|
|
367
370
|
.quit_app_fn = quitApp,
|
|
368
371
|
.start_window_drag_fn = startWindowDrag,
|
|
@@ -394,6 +397,8 @@ pub const LinuxPlatform = struct {
|
|
|
394
397
|
.set_credential_fn = setCredential,
|
|
395
398
|
.get_credential_fn = getCredential,
|
|
396
399
|
.delete_credential_fn = deleteCredential,
|
|
400
|
+
.note_blocking_call_abandoned_fn = noteChannelWakeAbandoned,
|
|
401
|
+
.format_local_time_fn = formatLocalTime,
|
|
397
402
|
.audio_load_fn = audioLoad,
|
|
398
403
|
.audio_load_url_fn = audioLoadUrl,
|
|
399
404
|
.audio_play_fn = audioPlay,
|
|
@@ -444,7 +449,7 @@ pub const LinuxPlatform = struct {
|
|
|
444
449
|
.app_activation_events,
|
|
445
450
|
.gpu_surfaces,
|
|
446
451
|
=> self.web_engine == .system,
|
|
447
|
-
.credentials =>
|
|
452
|
+
.credentials => credentialsAvailable(self.host),
|
|
448
453
|
// Audio rides GStreamer (playbin), runtime-loaded like
|
|
449
454
|
// libsecret: the report is a live probe, so a host without
|
|
450
455
|
// the library honestly answers false and playback degrades
|
|
@@ -456,6 +461,7 @@ pub const LinuxPlatform = struct {
|
|
|
456
461
|
// a host whose plugin set lacks it answers false and the
|
|
457
462
|
// deck's glass rests honestly instead of dancing on fakes.
|
|
458
463
|
.audio_spectrum => self.web_engine == .system and audioSpectrumAvailable(self.host),
|
|
464
|
+
.microphone_capture, .system_audio_capture => false,
|
|
459
465
|
.tray => false,
|
|
460
466
|
// No tray means no affordance to bring a policy-hidden
|
|
461
467
|
// window back — reporting support would strand windows, so
|
|
@@ -571,6 +577,7 @@ fn gtkCallback(context: ?*anyopaque, event: *const GtkEvent) callconv(.c) void {
|
|
|
571
577
|
.scale_factor = @floatCast(event.scale),
|
|
572
578
|
.open = event.open != 0,
|
|
573
579
|
.focused = event.focused != 0,
|
|
580
|
+
.hidden = event.hidden != 0,
|
|
574
581
|
} });
|
|
575
582
|
},
|
|
576
583
|
.view_focused => state.emit(.{ .view_focused = .{
|
|
@@ -853,6 +860,7 @@ fn showModeInt(mode: platform_mod.WindowShowMode) c_int {
|
|
|
853
860
|
return switch (mode) {
|
|
854
861
|
.immediate => 0,
|
|
855
862
|
.on_first_present => 1,
|
|
863
|
+
.hidden => 2,
|
|
856
864
|
};
|
|
857
865
|
}
|
|
858
866
|
|
|
@@ -862,6 +870,7 @@ fn windowFlags(options: platform_mod.WindowOptions) u32 {
|
|
|
862
870
|
if (options.always_on_top) flags |= 1 << 1;
|
|
863
871
|
if (options.click_through) flags |= 1 << 2;
|
|
864
872
|
if (!options.activate_on_show) flags |= 1 << 3;
|
|
873
|
+
if (!options.allows_fullscreen) flags |= 1 << 4;
|
|
865
874
|
return flags;
|
|
866
875
|
}
|
|
867
876
|
|
|
@@ -884,6 +893,7 @@ fn createWindow(context: ?*anyopaque, options: platform_mod.WindowOptions) anyer
|
|
|
884
893
|
.scale_factor = 1,
|
|
885
894
|
.open = true,
|
|
886
895
|
.focused = options.activate_on_show and options.show == .immediate,
|
|
896
|
+
.hidden = options.show == .hidden,
|
|
887
897
|
};
|
|
888
898
|
}
|
|
889
899
|
|
|
@@ -902,6 +912,11 @@ fn minimizeWindow(context: ?*anyopaque, window_id: platform_mod.WindowId) anyerr
|
|
|
902
912
|
if (native_sdk_gtk_minimize_window(self.host, window_id) == 0) return error.WindowNotFound;
|
|
903
913
|
}
|
|
904
914
|
|
|
915
|
+
fn hideWindow(context: ?*anyopaque, window_id: platform_mod.WindowId) anyerror!void {
|
|
916
|
+
const self: *LinuxPlatform = @ptrCast(@alignCast(context.?));
|
|
917
|
+
if (native_sdk_gtk_hide_window(self.host, window_id) == 0) return error.WindowNotFound;
|
|
918
|
+
}
|
|
919
|
+
|
|
905
920
|
/// GTK has no hide-on-close, but show is still distinct from explicit
|
|
906
921
|
/// focus for passive overlay windows.
|
|
907
922
|
fn showWindow(context: ?*anyopaque, window_id: platform_mod.WindowId) anyerror!void {
|
|
@@ -1332,9 +1347,8 @@ fn clearRecentDocuments(context: ?*anyopaque) anyerror!void {
|
|
|
1332
1347
|
|
|
1333
1348
|
fn setCredential(context: ?*anyopaque, credential: platform_mod.Credential) anyerror!void {
|
|
1334
1349
|
const self: *LinuxPlatform = @ptrCast(@alignCast(context.?));
|
|
1335
|
-
if (self.
|
|
1336
|
-
|
|
1337
|
-
if (native_sdk_gtk_set_credential(
|
|
1350
|
+
if (native_sdk_gtk_credentials_available(self.host) == 0) return error.CredentialStoreLocked;
|
|
1351
|
+
const result = native_sdk_gtk_set_credential(
|
|
1338
1352
|
self.host,
|
|
1339
1353
|
credential.service.ptr,
|
|
1340
1354
|
credential.service.len,
|
|
@@ -1342,13 +1356,14 @@ fn setCredential(context: ?*anyopaque, credential: platform_mod.Credential) anye
|
|
|
1342
1356
|
credential.account.len,
|
|
1343
1357
|
credential.secret.ptr,
|
|
1344
1358
|
credential.secret.len,
|
|
1345
|
-
)
|
|
1359
|
+
);
|
|
1360
|
+
if (result == -2) return error.CredentialStoreLocked;
|
|
1361
|
+
if (result <= 0) return error.CredentialStoreFailed;
|
|
1346
1362
|
}
|
|
1347
1363
|
|
|
1348
1364
|
fn getCredential(context: ?*anyopaque, key: platform_mod.CredentialKey, buffer: []u8) anyerror![]const u8 {
|
|
1349
1365
|
const self: *LinuxPlatform = @ptrCast(@alignCast(context.?));
|
|
1350
|
-
if (self.
|
|
1351
|
-
if (native_sdk_gtk_credentials_available(self.host) == 0) return error.UnsupportedService;
|
|
1366
|
+
if (native_sdk_gtk_credentials_available(self.host) == 0) return error.CredentialStoreLocked;
|
|
1352
1367
|
const len = native_sdk_gtk_get_credential(
|
|
1353
1368
|
self.host,
|
|
1354
1369
|
key.service.ptr,
|
|
@@ -1358,16 +1373,16 @@ fn getCredential(context: ?*anyopaque, key: platform_mod.CredentialKey, buffer:
|
|
|
1358
1373
|
buffer.ptr,
|
|
1359
1374
|
buffer.len,
|
|
1360
1375
|
);
|
|
1361
|
-
if (len == std.math.maxInt(usize)) return error.
|
|
1362
|
-
if (len ==
|
|
1376
|
+
if (len == std.math.maxInt(usize)) return error.CredentialNotFound;
|
|
1377
|
+
if (len == std.math.maxInt(usize) - 2) return error.CredentialStoreLocked;
|
|
1378
|
+
if (len == std.math.maxInt(usize) - 1) return error.CredentialStoreFailed;
|
|
1363
1379
|
if (len > buffer.len) return error.NoSpaceLeft;
|
|
1364
1380
|
return buffer[0..len];
|
|
1365
1381
|
}
|
|
1366
1382
|
|
|
1367
1383
|
fn deleteCredential(context: ?*anyopaque, key: platform_mod.CredentialKey) anyerror!void {
|
|
1368
1384
|
const self: *LinuxPlatform = @ptrCast(@alignCast(context.?));
|
|
1369
|
-
if (self.
|
|
1370
|
-
if (native_sdk_gtk_credentials_available(self.host) == 0) return error.UnsupportedService;
|
|
1385
|
+
if (native_sdk_gtk_credentials_available(self.host) == 0) return error.CredentialStoreLocked;
|
|
1371
1386
|
const result = native_sdk_gtk_delete_credential(
|
|
1372
1387
|
self.host,
|
|
1373
1388
|
key.service.ptr,
|
|
@@ -1375,10 +1390,18 @@ fn deleteCredential(context: ?*anyopaque, key: platform_mod.CredentialKey) anyer
|
|
|
1375
1390
|
key.account.ptr,
|
|
1376
1391
|
key.account.len,
|
|
1377
1392
|
);
|
|
1378
|
-
if (result
|
|
1393
|
+
if (result == -2) return error.CredentialStoreLocked;
|
|
1394
|
+
if (result < 0) return error.CredentialStoreFailed;
|
|
1379
1395
|
if (result == 0) return error.CredentialNotFound;
|
|
1380
1396
|
}
|
|
1381
1397
|
|
|
1398
|
+
fn formatLocalTime(context: ?*anyopaque, timestamp_ms: i64, style: platform_mod.LocalTimeStyle, buffer: []u8) anyerror![]const u8 {
|
|
1399
|
+
const self: *LinuxPlatform = @ptrCast(@alignCast(context.?));
|
|
1400
|
+
const len = native_sdk_gtk_format_local_time(self.host, timestamp_ms, @intFromEnum(style), buffer.ptr, buffer.len);
|
|
1401
|
+
if (len == 0 or len > buffer.len) return error.LocalTimeFormatFailed;
|
|
1402
|
+
return buffer[0..len];
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1382
1405
|
/// Map the audio host's synchronous load result: 0 loading (the
|
|
1383
1406
|
/// asynchronous `.loaded` acknowledgment with the decoded duration
|
|
1384
1407
|
/// follows on the main loop), 1 the file is missing, 2 an unusable
|
|
@@ -2016,7 +2039,7 @@ test "linux first-present windows stay unmapped until present with a cancellable
|
|
|
2016
2039
|
const first_present_at = std.mem.indexOf(
|
|
2017
2040
|
u8,
|
|
2018
2041
|
host_source,
|
|
2019
|
-
"if (first_present && win && !win->shown)",
|
|
2042
|
+
"if (first_present && win && !win->shown && !win->policy_hidden)",
|
|
2020
2043
|
) orelse return error.TestExpectedEqual;
|
|
2021
2044
|
const first_present_tail = host_source[first_present_at..];
|
|
2022
2045
|
const cancel_at = std.mem.indexOf(
|
|
@@ -34,6 +34,7 @@ typedef enum {
|
|
|
34
34
|
NATIVE_SDK_APPKIT_EVENT_AUDIO = 20,
|
|
35
35
|
NATIVE_SDK_APPKIT_EVENT_VIDEO = 21,
|
|
36
36
|
NATIVE_SDK_APPKIT_EVENT_VIEW_FOCUSED = 22,
|
|
37
|
+
NATIVE_SDK_APPKIT_EVENT_TRAY_COMMAND = 23,
|
|
37
38
|
} native_sdk_appkit_event_kind_t;
|
|
38
39
|
|
|
39
40
|
/* Audio player reports (EVENT_AUDIO payloads). LOADED acknowledges a
|
|
@@ -365,7 +366,8 @@ typedef void (*native_sdk_appkit_bridge_callback_t)(void *context, uint64_t wind
|
|
|
365
366
|
// the first canvas present (present-before-show: the window is created
|
|
366
367
|
// ordered-out and `makeKeyAndOrderFront` runs after the first
|
|
367
368
|
// gpu-surface present lands, with a short fallback deadline so a wedged
|
|
368
|
-
// first frame cannot leave the window invisible)
|
|
369
|
+
// first frame cannot leave the window invisible), 2 = explicitly hidden
|
|
370
|
+
// until a show/focus request.
|
|
369
371
|
//
|
|
370
372
|
// display_name is the human-facing app name (empty = fall back to
|
|
371
373
|
// app_name): it drives the application menu title and its About/Hide/
|
|
@@ -424,11 +426,20 @@ int native_sdk_appkit_close_window(native_sdk_appkit_host_t *host, uint64_t wind
|
|
|
424
426
|
// window controls on chromeless windows. Returns 0 when the window id
|
|
425
427
|
// is unknown.
|
|
426
428
|
int native_sdk_appkit_minimize_window(native_sdk_appkit_host_t *host, uint64_t window_id);
|
|
429
|
+
// Order a live window out without closing it. `show_window` is the inverse.
|
|
430
|
+
int native_sdk_appkit_hide_window(native_sdk_appkit_host_t *host, uint64_t window_id);
|
|
427
431
|
// The show verb: bring the window back to the glass and activate the
|
|
428
432
|
// app (deminiaturize + makeKeyAndOrderFront) — the counterpart to a
|
|
429
433
|
// close_policy .hide hide, and the tray-menu "Open" consequence.
|
|
430
434
|
// Returns 0 when the window id is unknown.
|
|
431
435
|
int native_sdk_appkit_show_window(native_sdk_appkit_host_t *host, uint64_t window_id);
|
|
436
|
+
// Change the process activation policy: visible = regular (Dock/app
|
|
437
|
+
// switcher), hidden = accessory. Returns 1 when applied.
|
|
438
|
+
int native_sdk_appkit_set_dock_presence(native_sdk_appkit_host_t *host, int visible);
|
|
439
|
+
// SMAppService.mainApp status values: 0 not registered, 1 enabled,
|
|
440
|
+
// 2 requires approval, 3 not found; -1 when unavailable.
|
|
441
|
+
int native_sdk_appkit_launch_at_login_status(native_sdk_appkit_host_t *host);
|
|
442
|
+
int native_sdk_appkit_set_launch_at_login(native_sdk_appkit_host_t *host, int enabled);
|
|
432
443
|
// What the user's close affordance does to this window: 0 = quit (the
|
|
433
444
|
// default: really close; last close follows app exit semantics),
|
|
434
445
|
// 1 = hide (order out and keep running — the menu-bar-app shape).
|
|
@@ -531,6 +542,16 @@ int native_sdk_appkit_audio_stop(native_sdk_appkit_host_t *host);
|
|
|
531
542
|
int native_sdk_appkit_audio_seek(native_sdk_appkit_host_t *host, uint64_t position_ms);
|
|
532
543
|
int native_sdk_appkit_audio_set_volume(native_sdk_appkit_host_t *host, double volume);
|
|
533
544
|
|
|
545
|
+
/* Microphone/system-output capture. Source: 0 microphone, 1 system;
|
|
546
|
+
* event kind: 0 started, 1 PCM data, 2 failed. PCM is interleaved signed
|
|
547
|
+
* 16-bit little-endian in the exact requested format. The callback returns
|
|
548
|
+
* 0 accepted, 1 closed (the producer must exit), or a drop code. Stop is a
|
|
549
|
+
* synchronous quiescence fence: the callback is never entered afterward. */
|
|
550
|
+
typedef int (*native_sdk_appkit_audio_capture_push_t)(void *context, int kind, int source, uint32_t sample_rate, uint8_t channels, uint64_t timestamp_ns, uint32_t frames, const uint8_t *pcm, size_t pcm_len);
|
|
551
|
+
int native_sdk_appkit_audio_capture_start(native_sdk_appkit_host_t *host, int source, uint32_t sample_rate, uint8_t channels, native_sdk_appkit_audio_capture_push_t push_fn, void *push_context);
|
|
552
|
+
int native_sdk_appkit_audio_capture_stop(native_sdk_appkit_host_t *host, int source);
|
|
553
|
+
int native_sdk_appkit_audio_capture_supported(native_sdk_appkit_host_t *host, int source);
|
|
554
|
+
|
|
534
555
|
/* Where the video player delivers decoded frames: one tightly packed,
|
|
535
556
|
* row-major, straight-alpha RGBA8 frame per call (len = width * height
|
|
536
557
|
* * 4), copied before return. Returns 0 when the frame was accepted, 1
|
|
@@ -631,6 +652,7 @@ int native_sdk_appkit_clear_recent_documents(native_sdk_appkit_host_t *host);
|
|
|
631
652
|
int native_sdk_appkit_set_credential(native_sdk_appkit_host_t *host, const char *service, size_t service_len, const char *account, size_t account_len, const char *secret, size_t secret_len);
|
|
632
653
|
size_t native_sdk_appkit_get_credential(native_sdk_appkit_host_t *host, const char *service, size_t service_len, const char *account, size_t account_len, char *buffer, size_t buffer_len);
|
|
633
654
|
int native_sdk_appkit_delete_credential(native_sdk_appkit_host_t *host, const char *service, size_t service_len, const char *account, size_t account_len);
|
|
655
|
+
size_t native_sdk_appkit_format_local_time(native_sdk_appkit_host_t *host, int64_t timestamp_ms, int style, char *buffer, size_t buffer_len);
|
|
634
656
|
|
|
635
657
|
typedef struct {
|
|
636
658
|
const char *title;
|
|
@@ -744,13 +766,14 @@ int native_sdk_appkit_show_context_menu(native_sdk_appkit_host_t *host, uint64_t
|
|
|
744
766
|
native_sdk_appkit_open_dialog_result_t native_sdk_appkit_show_open_dialog(native_sdk_appkit_host_t *host, const native_sdk_appkit_open_dialog_opts_t *opts, char *buffer, size_t buffer_len);
|
|
745
767
|
size_t native_sdk_appkit_show_save_dialog(native_sdk_appkit_host_t *host, const native_sdk_appkit_save_dialog_opts_t *opts, char *buffer, size_t buffer_len);
|
|
746
768
|
int native_sdk_appkit_show_message_dialog(native_sdk_appkit_host_t *host, const native_sdk_appkit_message_dialog_opts_t *opts);
|
|
747
|
-
void native_sdk_appkit_create_tray(native_sdk_appkit_host_t *host, const char *icon_path, size_t icon_path_len, const char *title, size_t title_len, const char *tooltip, size_t tooltip_len);
|
|
748
|
-
void native_sdk_appkit_update_tray_menu(native_sdk_appkit_host_t *host, const uint32_t *item_ids, const char *const *labels, const size_t *label_lens, const int *separators, const int *enabled_flags, size_t count);
|
|
769
|
+
void native_sdk_appkit_create_tray(native_sdk_appkit_host_t *host, const char *icon_path, size_t icon_path_len, const char *title, size_t title_len, const char *tooltip, size_t tooltip_len, double width, int tone, double icon_opacity, int monospaced, const char *activation_command, size_t activation_command_len, const char *alternate_activation_command, size_t alternate_activation_command_len, const char *open_command, size_t open_command_len);
|
|
770
|
+
void native_sdk_appkit_update_tray_menu(native_sdk_appkit_host_t *host, const uint32_t *item_ids, const char *const *labels, const size_t *label_lens, const int *separators, const int *enabled_flags, const char *const *details, const size_t *detail_lens, const int *roles, const char *const *keys, const size_t *key_lens, const uint32_t *modifiers, size_t count);
|
|
749
771
|
/* Retitle the live status item's button without re-creating it (create
|
|
750
772
|
* would flicker and reshuffle the menu bar). Empty title falls back to
|
|
751
773
|
* the icon-only square well, or the app-name initial when there is no
|
|
752
774
|
* icon either — the same fallbacks as create. */
|
|
753
775
|
void native_sdk_appkit_update_tray_title(native_sdk_appkit_host_t *host, const char *title, size_t title_len);
|
|
776
|
+
void native_sdk_appkit_update_tray_presentation(native_sdk_appkit_host_t *host, const char *title, size_t title_len, double width, int tone, double icon_opacity, int monospaced);
|
|
754
777
|
void native_sdk_appkit_remove_tray(native_sdk_appkit_host_t *host);
|
|
755
778
|
void native_sdk_appkit_set_tray_callback(native_sdk_appkit_host_t *host, native_sdk_appkit_tray_callback_t callback, void *context);
|
|
756
779
|
|