@native-sdk/cli 0.9.0 → 0.9.2

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.
Files changed (181) hide show
  1. package/build/app.zig +357 -33
  2. package/build.zig +234 -11
  3. package/native-sdk.d.ts +8 -0
  4. package/package.json +10 -10
  5. package/packages/core/compile-surface/core.ts +70 -1
  6. package/packages/core/package-lock.json +11 -11
  7. package/packages/core/package.json +2 -2
  8. package/packages/core/scripts/merge_static_archives.mjs +78 -0
  9. package/packages/core/scripts/run_external_core_compiler.mjs +52 -7
  10. package/packages/core/scripts/run_external_service_compiler.mjs +53 -13
  11. package/packages/core/scripts/stage_external_services.mjs +1 -1
  12. package/packages/core/sdk/core.d.ts +75 -0
  13. package/packages/core/sdk/core.ts +170 -13
  14. package/packages/core/sdk/events.d.ts +53 -0
  15. package/packages/core/sdk/events.ts +78 -7
  16. package/packages/core/src/checker.ts +470 -2
  17. package/packages/core/src/cli.ts +13 -0
  18. package/packages/core/src/contract.ts +3 -1
  19. package/packages/core/src/devhost.ts +30 -1
  20. package/packages/core/src/devhost_journal.mjs +10 -8
  21. package/packages/core/src/diagnostics.ts +99 -8
  22. package/packages/core/src/frontend.ts +6 -0
  23. package/packages/core/src/infer.ts +24 -0
  24. package/skill-data/automation/SKILL.md +1 -1
  25. package/skill-data/native-ui/SKILL.md +18 -12
  26. package/skill-data/ts-core/SKILL.md +54 -21
  27. package/skill-data/ts-services/SKILL.md +4 -4
  28. package/skill-data/ts-services/references/service-surface.md +2 -1
  29. package/skill-data/zig/SKILL.md +1 -1
  30. package/src/app_runner/root.zig +122 -6
  31. package/src/app_runner/ts_core_main.zig +9 -4
  32. package/src/app_runner/ts_core_mobile.zig +241 -0
  33. package/src/app_runner/window_placement.zig +63 -0
  34. package/src/automation/protocol.zig +5 -1
  35. package/src/automation/snapshot.zig +8 -6
  36. package/src/embed/app_exports.zig +3 -1
  37. package/src/embed/conversions.zig +1 -0
  38. package/src/embed/host.zig +10 -3
  39. package/src/embed/root.zig +2 -0
  40. package/src/embed/tests.zig +41 -1
  41. package/src/embed/types.zig +2 -0
  42. package/src/embed/ui_host.zig +94 -4
  43. package/src/platform/android/NativeSdkActivity.java +49 -4
  44. package/src/platform/android/android_host.c +3 -3
  45. package/src/platform/android/native_sdk_app.h +1 -1
  46. package/src/platform/ios/apple_image_fit.h +38 -0
  47. package/src/platform/ios/files.zig +1 -0
  48. package/src/platform/ios/native_sdk_app.h +1 -1
  49. package/src/platform/ios/uikit_host.m +28 -5
  50. package/src/platform/linux/cef_host.cpp +17 -3
  51. package/src/platform/linux/gtk_host.c +243 -15
  52. package/src/platform/linux/gtk_host.h +5 -4
  53. package/src/platform/linux/root.zig +91 -11
  54. package/src/platform/macos/appkit_host.h +18 -11
  55. package/src/platform/macos/appkit_host.m +402 -128
  56. package/src/platform/macos/cef_host.mm +342 -122
  57. package/src/platform/macos/image_fit_test.m +44 -0
  58. package/src/platform/macos/root.zig +231 -39
  59. package/src/platform/null_platform.zig +251 -54
  60. package/src/platform/null_platform_tests.zig +97 -4
  61. package/src/platform/root.zig +12 -0
  62. package/src/platform/types.zig +174 -35
  63. package/src/platform/windows/root.zig +42 -13
  64. package/src/platform/windows/webview2_host.cpp +72 -11
  65. package/src/primitives/app_manifest/root.zig +3 -0
  66. package/src/primitives/app_manifest/tests.zig +24 -0
  67. package/src/primitives/app_manifest/types.zig +13 -0
  68. package/src/primitives/app_manifest/validation.zig +24 -0
  69. package/src/primitives/canvas/a11y_audit.zig +9 -7
  70. package/src/primitives/canvas/a11y_audit_tests.zig +24 -0
  71. package/src/primitives/canvas/events.zig +50 -0
  72. package/src/primitives/canvas/layout_audit.zig +6 -6
  73. package/src/primitives/canvas/markdown.zig +4 -0
  74. package/src/primitives/canvas/markdown_tests.zig +1 -0
  75. package/src/primitives/canvas/png.zig +138 -0
  76. package/src/primitives/canvas/root.zig +13 -2
  77. package/src/primitives/canvas/text_span_tests.zig +5 -3
  78. package/src/primitives/canvas/text_spans.zig +2 -0
  79. package/src/primitives/canvas/text_tests.zig +20 -0
  80. package/src/primitives/canvas/ui.zig +55 -2
  81. package/src/primitives/canvas/ui_markup.zig +40 -13
  82. package/src/primitives/canvas/ui_markup_binary.zig +8 -6
  83. package/src/primitives/canvas/ui_markup_binary_tests.zig +14 -4
  84. package/src/primitives/canvas/ui_markup_compiled.zig +5 -1
  85. package/src/primitives/canvas/ui_markup_compiled_tests.zig +52 -0
  86. package/src/primitives/canvas/ui_markup_tests.zig +11 -2
  87. package/src/primitives/canvas/ui_markup_view.zig +8 -2
  88. package/src/primitives/canvas/ui_markup_view_tests.zig +49 -4
  89. package/src/primitives/canvas/ui_schema.zig +17 -13
  90. package/src/primitives/canvas/ui_tests.zig +47 -0
  91. package/src/primitives/canvas/widget_access.zig +3 -3
  92. package/src/primitives/canvas/widget_anchored_tests.zig +106 -0
  93. package/src/primitives/canvas/widget_builtin_tests.zig +580 -32
  94. package/src/primitives/canvas/widget_invalidation.zig +33 -6
  95. package/src/primitives/canvas/widget_layout.zig +333 -126
  96. package/src/primitives/canvas/widget_layout_tests.zig +169 -0
  97. package/src/primitives/canvas/widget_metrics.zig +7 -8
  98. package/src/primitives/canvas/widget_render.zig +76 -44
  99. package/src/primitives/canvas/widget_render_controls.zig +110 -32
  100. package/src/primitives/canvas/widget_render_style.zig +58 -18
  101. package/src/primitives/canvas/widget_render_surfaces.zig +45 -14
  102. package/src/primitives/canvas/widget_routing.zig +40 -34
  103. package/src/primitives/canvas/widget_runtime.zig +11 -2
  104. package/src/primitives/canvas/widget_runtime_tests.zig +10 -14
  105. package/src/primitives/canvas/widget_semantics.zig +8 -3
  106. package/src/primitives/canvas/widget_semantics_tests.zig +6 -2
  107. package/src/primitives/canvas/widget_tree.zig +99 -5
  108. package/src/primitives/canvas/widgets.zig +20 -7
  109. package/src/root.zig +10 -0
  110. package/src/runtime/api.zig +14 -0
  111. package/src/runtime/automation_commands.zig +35 -2
  112. package/src/runtime/automation_snapshot.zig +32 -24
  113. package/src/runtime/automation_widget_dispatch.zig +48 -6
  114. package/src/runtime/bridge_permission_tests.zig +35 -1
  115. package/src/runtime/bridge_responses.zig +1 -1
  116. package/src/runtime/builtin_bridge.zig +16 -3
  117. package/src/runtime/canvas_frame_packet_tests.zig +22 -13
  118. package/src/runtime/canvas_image_tests.zig +146 -2
  119. package/src/runtime/canvas_images.zig +35 -16
  120. package/src/runtime/canvas_limits.zig +13 -3
  121. package/src/runtime/canvas_widget_accessibility_tests.zig +279 -4
  122. package/src/runtime/canvas_widget_anchored_tests.zig +54 -0
  123. package/src/runtime/canvas_widget_control_tests.zig +31 -1
  124. package/src/runtime/canvas_widget_events.zig +151 -26
  125. package/src/runtime/canvas_widget_floating_tests.zig +48 -0
  126. package/src/runtime/canvas_widget_runtime.zig +322 -102
  127. package/src/runtime/canvas_widget_scroll_driver_tests.zig +34 -0
  128. package/src/runtime/canvas_widget_scroll_drivers.zig +12 -10
  129. package/src/runtime/canvas_widget_scroll_tests.zig +193 -2
  130. package/src/runtime/canvas_widget_semantics_tests.zig +337 -3
  131. package/src/runtime/canvas_widget_split_tree_tests.zig +55 -0
  132. package/src/runtime/canvas_widget_state.zig +33 -7
  133. package/src/runtime/core.zig +28 -6
  134. package/src/runtime/effects.zig +1337 -49
  135. package/src/runtime/effects_file_tests.zig +587 -0
  136. package/src/runtime/effects_image_tests.zig +91 -0
  137. package/src/runtime/effects_notification_tests.zig +11 -0
  138. package/src/runtime/file_access.zig +400 -0
  139. package/src/runtime/file_effect_crash_helper.zig +28 -0
  140. package/src/runtime/file_effect_crash_tests.zig +37 -0
  141. package/src/runtime/flow.zig +21 -9
  142. package/src/runtime/gpu_surface_events.zig +25 -2
  143. package/src/runtime/native_command_event_tests.zig +44 -2
  144. package/src/runtime/pty.zig +5 -2
  145. package/src/runtime/root.zig +7 -0
  146. package/src/runtime/session_blobs.zig +4 -1
  147. package/src/runtime/session_journal.zig +56 -5
  148. package/src/runtime/session_record.zig +38 -0
  149. package/src/runtime/session_replay.zig +110 -15
  150. package/src/runtime/session_tests.zig +192 -4
  151. package/src/runtime/shell_layout_tests.zig +12 -0
  152. package/src/runtime/state.zig +10 -0
  153. package/src/runtime/system_services.zig +129 -36
  154. package/src/runtime/ts_core_host.zig +281 -11
  155. package/src/runtime/ts_core_host_tests.zig +142 -1
  156. package/src/runtime/ts_ui_app.zig +461 -8
  157. package/src/runtime/ui_app.zig +330 -112
  158. package/src/runtime/ui_app_tests.zig +251 -25
  159. package/src/runtime/ui_app_window_tests.zig +74 -8
  160. package/src/runtime/validation.zig +20 -0
  161. package/src/runtime/view.zig +3 -0
  162. package/src/runtime/view_widget_control.zig +18 -0
  163. package/src/runtime/view_widget_scroll.zig +112 -18
  164. package/src/runtime/view_widget_tree.zig +110 -13
  165. package/src/runtime/widget_bridge.zig +2 -0
  166. package/src/runtime/window_command_bridge_tests.zig +86 -0
  167. package/src/runtime/window_storage.zig +16 -1
  168. package/src/runtime/window_views.zig +1 -0
  169. package/src/tooling/ios.zig +3 -0
  170. package/src/tooling/manifest.zig +90 -2
  171. package/src/tooling/package.zig +67 -2
  172. package/src/tooling/raw_manifest.zig +10 -0
  173. package/src/tooling/templates.zig +156 -18
  174. package/src/tooling/ts_core.zig +83 -0
  175. package/src/tooling/web_engine.zig +1 -1
  176. package/tools/corewire/emit.zig +3 -3
  177. package/tools/corewire/emit_facade.zig +65 -5
  178. package/tools/corewire/emit_profile.zig +2 -2
  179. package/tools/corewire/emit_service.zig +2 -2
  180. package/tools/corewire/service_contract.zig +4 -4
  181. package/tools/corewire/sidecar.zig +4 -4
@@ -102,11 +102,13 @@
102
102
  #import <Security/Security.h>
103
103
 
104
104
  #include <dlfcn.h>
105
+ #include <math.h>
105
106
  #include <mach-o/dyld.h>
106
107
  #include <stdlib.h>
107
108
  #include <string.h>
108
109
 
109
110
  #include "native_sdk_app.h"
111
+ #include "apple_image_fit.h"
110
112
 
111
113
  // ----------------------------------------------------------- credentials
112
114
  // Generic-password Keychain entries shared by the WebView bridge and core
@@ -956,29 +958,50 @@ static int NativeSdkAudioServiceSetVolume(void *context, double volume) {
956
958
  // because the canvas image pipeline expects straight alpha. Returns 1
957
959
  // decoded, -1 when the decoded pixels do not fit `pixels_len`, 0 for
958
960
  // undecodable bytes.
959
- static int NativeSdkImageServiceDecode(void *context, const uint8_t *bytes, uintptr_t bytes_len, uint8_t *pixels, uintptr_t pixels_len, uintptr_t *out_width, uintptr_t *out_height) {
961
+ static int NativeSdkImageServiceDecode(void *context, const uint8_t *bytes, uintptr_t bytes_len, uint8_t *pixels, uintptr_t pixels_len, uintptr_t max_pixels, uintptr_t *out_width, uintptr_t *out_height) {
960
962
  (void)context;
961
963
  if (out_width) *out_width = 0;
962
964
  if (out_height) *out_height = 0;
963
- if (!bytes || bytes_len == 0 || !pixels) return 0;
965
+ if (!bytes || bytes_len == 0 || !pixels || max_pixels == 0) return 0;
964
966
  @autoreleasepool {
965
967
  NSData *data = [NSData dataWithBytesNoCopy:(void *)bytes length:bytes_len freeWhenDone:NO];
966
968
  CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL);
967
969
  if (!source) return 0;
968
- CGImageRef image = CGImageSourceCreateImageAtIndex(source, 0, NULL);
970
+ CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(source, 0, NULL);
971
+ int64_t source_width_value = 0;
972
+ int64_t source_height_value = 0;
973
+ if (properties) {
974
+ CFNumberRef width_value = CFDictionaryGetValue(properties, kCGImagePropertyPixelWidth);
975
+ CFNumberRef height_value = CFDictionaryGetValue(properties, kCGImagePropertyPixelHeight);
976
+ if (width_value) CFNumberGetValue(width_value, kCFNumberSInt64Type, &source_width_value);
977
+ if (height_value) CFNumberGetValue(height_value, kCFNumberSInt64Type, &source_height_value);
978
+ CFRelease(properties);
979
+ }
980
+ size_t source_width = source_width_value > 0 ? (size_t)source_width_value : 0;
981
+ size_t source_height = source_height_value > 0 ? (size_t)source_height_value : 0;
982
+ CGImageRef image = NULL;
983
+ if (source_width > 0 && source_height > 0) {
984
+ const size_t max_dimension = native_sdk_apple_image_thumbnail_max_dimension(source_width, source_height, max_pixels);
985
+ NSDictionary *thumbnail_options = @{
986
+ (NSString *)kCGImageSourceCreateThumbnailFromImageAlways: @YES,
987
+ (NSString *)kCGImageSourceThumbnailMaxPixelSize: @(max_dimension),
988
+ (NSString *)kCGImageSourceCreateThumbnailWithTransform: @YES,
989
+ };
990
+ image = CGImageSourceCreateThumbnailAtIndex(source, 0, (__bridge CFDictionaryRef)thumbnail_options);
991
+ }
969
992
  CFRelease(source);
970
993
  if (!image) return 0;
971
994
 
972
995
  size_t width = CGImageGetWidth(image);
973
996
  size_t height = CGImageGetHeight(image);
974
- if (width == 0 || height == 0 || width > 8192 || height > 8192) {
997
+ if (width == 0 || height == 0 || width > NATIVE_SDK_MAX_DECODED_IMAGE_DIMENSION || height > NATIVE_SDK_MAX_DECODED_IMAGE_DIMENSION) {
975
998
  CGImageRelease(image);
976
999
  return 0;
977
1000
  }
978
1001
  if (out_width) *out_width = width;
979
1002
  if (out_height) *out_height = height;
980
1003
  size_t byte_len = width * height * 4;
981
- if (byte_len / 4 / height != width || pixels_len < byte_len) {
1004
+ if (width > max_pixels / height || byte_len / 4 / height != width || pixels_len < byte_len) {
982
1005
  CGImageRelease(image);
983
1006
  return -1;
984
1007
  }
@@ -120,16 +120,20 @@ static void destroyChildWebViewsForWindow(Host *host, uint64_t window_id) {
120
120
 
121
121
  extern "C" {
122
122
 
123
- Host *native_sdk_gtk_create(const char *app_name, size_t app_name_len, const char *window_title, size_t window_title_len, const char *bundle_id, size_t bundle_id_len, const char *icon_path, size_t icon_path_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int resizable, int titlebar_style, double min_width, double min_height) {
123
+ Host *native_sdk_gtk_create(const char *app_name, size_t app_name_len, const char *window_title, size_t window_title_len, const char *bundle_id, size_t bundle_id_len, const char *icon_path, size_t icon_path_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int initial_placement, int restore_policy, int resizable, int titlebar_style, double min_width, double min_height, int show_policy, uint32_t window_flags) {
124
124
  (void)bundle_id;
125
125
  (void)bundle_id_len;
126
126
  (void)icon_path;
127
127
  (void)icon_path_len;
128
128
  (void)restore_frame;
129
+ (void)initial_placement;
130
+ (void)restore_policy;
129
131
  (void)resizable;
130
132
  (void)titlebar_style;
131
133
  (void)min_width;
132
134
  (void)min_height;
135
+ (void)show_policy;
136
+ (void)window_flags;
133
137
  Host *host = new Host();
134
138
  host->app_name = slice(app_name, app_name_len);
135
139
  host->window_title = slice(window_title, window_title_len);
@@ -250,12 +254,16 @@ void native_sdk_gtk_set_shortcuts(Host *host, const char *const *ids, const size
250
254
  (void)count;
251
255
  }
252
256
 
253
- int native_sdk_gtk_create_window(Host *host, uint64_t window_id, const char *window_title, size_t window_title_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int resizable, int titlebar_style, double min_width, double min_height) {
257
+ int native_sdk_gtk_create_window(Host *host, uint64_t window_id, const char *window_title, size_t window_title_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int initial_placement, int restore_policy, int resizable, int titlebar_style, double min_width, double min_height, int show_policy, uint32_t window_flags) {
254
258
  (void)restore_frame;
259
+ (void)initial_placement;
260
+ (void)restore_policy;
255
261
  (void)resizable;
256
262
  (void)titlebar_style;
257
263
  (void)min_width;
258
264
  (void)min_height;
265
+ (void)show_policy;
266
+ (void)window_flags;
259
267
  if (!host || host->windows.find(window_id) != host->windows.end()) return 0;
260
268
  Window window;
261
269
  window.id = window_id;
@@ -484,7 +492,7 @@ int native_sdk_gtk_reveal_path(Host *host, const char *path, size_t path_len) {
484
492
  return 0;
485
493
  }
486
494
 
487
- int native_sdk_gtk_show_notification(Host *host, const char *title, size_t title_len, const char *subtitle, size_t subtitle_len, const char *body, size_t body_len) {
495
+ int native_sdk_gtk_show_notification(Host *host, const char *title, size_t title_len, const char *subtitle, size_t subtitle_len, const char *body, size_t body_len, const char *notification_id, size_t notification_id_len, const char *action_label, size_t action_label_len, const char *action_command, size_t action_command_len) {
488
496
  (void)host;
489
497
  (void)title;
490
498
  (void)title_len;
@@ -492,6 +500,12 @@ int native_sdk_gtk_show_notification(Host *host, const char *title, size_t title
492
500
  (void)subtitle_len;
493
501
  (void)body;
494
502
  (void)body_len;
503
+ (void)notification_id;
504
+ (void)notification_id_len;
505
+ (void)action_label;
506
+ (void)action_label_len;
507
+ (void)action_command;
508
+ (void)action_command_len;
495
509
  return 0;
496
510
  }
497
511
 
@@ -3,12 +3,15 @@
3
3
  #include <gtk/gtk.h>
4
4
  #include <glib/gstdio.h>
5
5
  #include <dlfcn.h>
6
+ #include <errno.h>
7
+ #include <fcntl.h>
6
8
  #include <limits.h>
7
9
  #include <math.h>
8
10
  #include <stdint.h>
9
11
  #include <string.h>
10
12
  #include <stdlib.h>
11
13
  #include <stdio.h>
14
+ #include <unistd.h>
12
15
 
13
16
  /* NATIVE_SDK_ALLOW_WEBKITGTK_STUB is the build graph's declaration that
14
17
  * this app uses no web layer, and it wins over header visibility: on a
@@ -383,6 +386,13 @@ typedef struct native_sdk_gtk_window {
383
386
  int native_view_count;
384
387
  } native_sdk_gtk_window_t;
385
388
 
389
+ typedef struct native_sdk_gtk_notification_action {
390
+ char *command;
391
+ char *notification_id;
392
+ } native_sdk_gtk_notification_action_t;
393
+
394
+ static const char native_sdk_notification_action_name[] = "native-sdk-notification-action";
395
+
386
396
  struct native_sdk_gtk_host {
387
397
  GtkApplication *app;
388
398
  /* Display providers are global and the display retains them until
@@ -398,6 +408,8 @@ struct native_sdk_gtk_host {
398
408
  char *window_label;
399
409
  double init_x, init_y, init_width, init_height;
400
410
  int restore_frame;
411
+ int initial_placement;
412
+ int restore_policy;
401
413
  /* Startup-window options applied when on_activate creates @w1 (the
402
414
  * window does not exist yet when the host is created). */
403
415
  int init_resizable;
@@ -452,6 +464,14 @@ struct native_sdk_gtk_host {
452
464
  native_sdk_gtk_context_menu_t *context_menu_teardowns;
453
465
  /* Feeds each context menu's per-invocation action-group name. */
454
466
  uint64_t context_menu_serial;
467
+ /* Notification buttons carry only an unguessable, process-scoped
468
+ * token across the exported GApplication action. The command stays
469
+ * private to this host, so another session-bus client cannot supply
470
+ * an arbitrary command name and notifications from an earlier app
471
+ * execution cannot dispatch into this one. The id map invalidates a
472
+ * superseded same-id notification's token before replacement. */
473
+ GHashTable *notification_actions;
474
+ GHashTable *notification_action_tokens_by_id;
455
475
  native_sdk_gtk_audio_t audio;
456
476
  };
457
477
 
@@ -471,6 +491,46 @@ static char *native_sdk_strndup(const char *s, size_t len) {
471
491
  return out;
472
492
  }
473
493
 
494
+ static void native_sdk_notification_action_free(gpointer data) {
495
+ native_sdk_gtk_notification_action_t *notification_action = data;
496
+ if (!notification_action) return;
497
+ free(notification_action->command);
498
+ free(notification_action->notification_id);
499
+ free(notification_action);
500
+ }
501
+
502
+ static char *native_sdk_random_notification_action_token(void) {
503
+ uint8_t random_bytes[16];
504
+ int random_fd;
505
+ do {
506
+ random_fd = open("/dev/urandom", O_RDONLY | O_CLOEXEC);
507
+ } while (random_fd < 0 && errno == EINTR);
508
+ if (random_fd < 0) return NULL;
509
+
510
+ size_t offset = 0;
511
+ while (offset < sizeof(random_bytes)) {
512
+ const ssize_t count = read(
513
+ random_fd, random_bytes + offset, sizeof(random_bytes) - offset);
514
+ if (count > 0) {
515
+ offset += (size_t)count;
516
+ continue;
517
+ }
518
+ if (count < 0 && errno == EINTR) continue;
519
+ close(random_fd);
520
+ return NULL;
521
+ }
522
+ close(random_fd);
523
+
524
+ static const char hex[] = "0123456789abcdef";
525
+ char *token = g_malloc(sizeof(random_bytes) * 2 + 1);
526
+ for (size_t i = 0; i < sizeof(random_bytes); i++) {
527
+ token[i * 2] = hex[random_bytes[i] >> 4];
528
+ token[i * 2 + 1] = hex[random_bytes[i] & 0x0f];
529
+ }
530
+ token[sizeof(random_bytes) * 2] = '\0';
531
+ return token;
532
+ }
533
+
474
534
  static void native_sdk_free_string_list(char **list, int count) {
475
535
  if (!list) return;
476
536
  for (int i = 0; i < count; i++) free(list[i]);
@@ -2026,7 +2086,7 @@ static const char *native_sdk_bridge_script(void) {
2026
2086
  "});"
2027
2087
  "var os=Object.freeze({"
2028
2088
  "openUrl:function(value){var options=typeof value==='string'?{url:value}:(value||{});return invoke('native-sdk.os.openUrl',{url:ensureString(options.url,'url')});},"
2029
- "showNotification:function(value){var options=typeof value==='string'?{title:value}:(value||{});var payload={title:ensureString(options.title,'title')};if(options.subtitle!=null){payload.subtitle=ensureString(options.subtitle,'subtitle');}if(options.body!=null){payload.body=ensureString(options.body,'body');}return invoke('native-sdk.os.showNotification',payload);},"
2089
+ "showNotification:function(value){var options=typeof value==='string'?{title:value}:(value||{});var payload={title:ensureString(options.title,'title')};if(options.id!=null){payload.id=ensureString(options.id,'id');}if(options.subtitle!=null){payload.subtitle=ensureString(options.subtitle,'subtitle');}if(options.body!=null){payload.body=ensureString(options.body,'body');}if(options.actionLabel!=null){payload.actionLabel=ensureString(options.actionLabel,'actionLabel');}if(options.actionCommand!=null){payload.actionCommand=ensureString(options.actionCommand,'actionCommand');}return invoke('native-sdk.os.showNotification',payload);},"
2030
2090
  "revealPath:function(value){var options=typeof value==='string'?{path:value}:(value||{});return invoke('native-sdk.os.revealPath',{path:ensureString(options.path,'path')});},"
2031
2091
  "addRecentDocument:function(value){var options=typeof value==='string'?{path:value}:(value||{});return invoke('native-sdk.os.addRecentDocument',{path:ensureString(options.path,'path')});},"
2032
2092
  "clearRecentDocuments:function(){return invoke('native-sdk.os.clearRecentDocuments',{});}"
@@ -3050,7 +3110,7 @@ static void native_sdk_ensure_transparent_css(native_sdk_gtk_host_t *host) {
3050
3110
  host->transparent_css_provider = provider;
3051
3111
  }
3052
3112
 
3053
- static native_sdk_gtk_window_t *native_sdk_create_window_internal(native_sdk_gtk_host_t *host, uint64_t window_id, const char *title, const char *label, double x, double y, double width, double height, int restore_frame, int resizable, int titlebar_style, double min_width, double min_height, int show_policy, uint32_t window_flags) {
3113
+ static native_sdk_gtk_window_t *native_sdk_create_window_internal(native_sdk_gtk_host_t *host, uint64_t window_id, const char *title, const char *label, double x, double y, double width, double height, int restore_frame, int initial_placement, int restore_policy, int resizable, int titlebar_style, double min_width, double min_height, int show_policy, uint32_t window_flags) {
3054
3114
  if (native_sdk_find_window(host, window_id)) return NULL;
3055
3115
 
3056
3116
  int slot = -1;
@@ -3069,8 +3129,10 @@ static native_sdk_gtk_window_t *native_sdk_create_window_internal(native_sdk_gtk
3069
3129
  memset(win, 0, sizeof(*win));
3070
3130
  win->id = window_id;
3071
3131
  win->host = host;
3072
- win->x = restore_frame ? x : 0;
3073
- win->y = restore_frame ? y : 0;
3132
+ (void)restore_frame;
3133
+ (void)restore_policy;
3134
+ win->x = initial_placement != 2 ? x : 0;
3135
+ win->y = initial_placement != 2 ? y : 0;
3074
3136
  win->label = native_sdk_strndup(label && label[0] ? label : "main", strlen(label && label[0] ? label : "main"));
3075
3137
  win->title = native_sdk_strndup(title && title[0] ? title : host->app_name, strlen(title && title[0] ? title : host->app_name));
3076
3138
  win->transparent = (window_flags & (1u << 0)) != 0;
@@ -3199,7 +3261,8 @@ static void on_activate(GtkApplication *app, gpointer data) {
3199
3261
  host->init_x, host->init_y,
3200
3262
  host->init_width > 0 ? host->init_width : 720,
3201
3263
  host->init_height > 0 ? host->init_height : 480,
3202
- host->restore_frame, host->init_resizable, host->init_titlebar_style,
3264
+ host->restore_frame, host->initial_placement, host->restore_policy,
3265
+ host->init_resizable, host->init_titlebar_style,
3203
3266
  host->init_min_width, host->init_min_height,
3204
3267
  host->init_show_policy, host->init_window_flags);
3205
3268
  if (!win) return;
@@ -3223,7 +3286,8 @@ native_sdk_gtk_host_t *native_sdk_gtk_create(
3223
3286
  const char *icon_path, size_t icon_path_len,
3224
3287
  const char *window_label, size_t window_label_len,
3225
3288
  double x, double y, double width, double height,
3226
- int restore_frame, int resizable, int titlebar_style,
3289
+ int restore_frame, int initial_placement, int restore_policy,
3290
+ int resizable, int titlebar_style,
3227
3291
  double min_width, double min_height, int show_policy,
3228
3292
  uint32_t window_flags)
3229
3293
  {
@@ -3240,6 +3304,8 @@ native_sdk_gtk_host_t *native_sdk_gtk_create(
3240
3304
  host->init_width = width;
3241
3305
  host->init_height = height;
3242
3306
  host->restore_frame = restore_frame;
3307
+ host->initial_placement = initial_placement;
3308
+ host->restore_policy = restore_policy;
3243
3309
  host->init_resizable = resizable;
3244
3310
  host->init_titlebar_style = titlebar_style;
3245
3311
  host->init_min_width = min_width;
@@ -3253,6 +3319,10 @@ native_sdk_gtk_host_t *native_sdk_gtk_create(
3253
3319
  host->allowed_external_urls_count = 0;
3254
3320
 
3255
3321
  host->app = gtk_application_new(host->bundle_id, G_APPLICATION_DEFAULT_FLAGS);
3322
+ host->notification_actions = g_hash_table_new_full(
3323
+ g_str_hash, g_str_equal, g_free, native_sdk_notification_action_free);
3324
+ host->notification_action_tokens_by_id = g_hash_table_new_full(
3325
+ g_str_hash, g_str_equal, g_free, g_free);
3256
3326
 
3257
3327
  return host;
3258
3328
  }
@@ -3295,6 +3365,15 @@ void native_sdk_gtk_destroy(native_sdk_gtk_host_t *host) {
3295
3365
  g_object_unref(host->transparent_css_provider);
3296
3366
  g_object_unref(host->transparent_css_display);
3297
3367
  }
3368
+ if (host->app && g_action_map_lookup_action(
3369
+ G_ACTION_MAP(host->app), native_sdk_notification_action_name)) {
3370
+ g_action_map_remove_action(
3371
+ G_ACTION_MAP(host->app), native_sdk_notification_action_name);
3372
+ }
3373
+ if (host->notification_action_tokens_by_id) {
3374
+ g_hash_table_destroy(host->notification_action_tokens_by_id);
3375
+ }
3376
+ if (host->notification_actions) g_hash_table_destroy(host->notification_actions);
3298
3377
  g_object_unref(host->app);
3299
3378
  free(host->app_name);
3300
3379
  free(host->window_title);
@@ -3404,13 +3483,38 @@ void native_sdk_gtk_request_frame(native_sdk_gtk_host_t *host) {
3404
3483
  * codec its loaders ship — the framework bundles none. Decoded rows are
3405
3484
  * repacked tightly (gdk-pixbuf rowstride may pad) as straight-alpha RGBA8,
3406
3485
  * the layout the canvas image pipeline expects. */
3407
- int native_sdk_gtk_decode_image(const uint8_t *bytes, size_t bytes_len, uint8_t *pixels, size_t pixels_len, size_t *out_width, size_t *out_height) {
3486
+ typedef struct {
3487
+ size_t max_pixels;
3488
+ } native_sdk_image_fit_t;
3489
+
3490
+ #define NATIVE_SDK_MAX_DECODED_IMAGE_DIMENSION 8192
3491
+
3492
+ static void native_sdk_gtk_image_size_prepared(GdkPixbufLoader *loader, int width, int height, gpointer user_data) {
3493
+ native_sdk_image_fit_t *fit = user_data;
3494
+ if (!fit || fit->max_pixels == 0 || width <= 0 || height <= 0) return;
3495
+ double source_pixels = (double)width * (double)height;
3496
+ if (source_pixels <= (double)fit->max_pixels && width <= NATIVE_SDK_MAX_DECODED_IMAGE_DIMENSION && height <= NATIVE_SDK_MAX_DECODED_IMAGE_DIMENSION) return;
3497
+ double area_scale = sqrt((double)fit->max_pixels / source_pixels);
3498
+ double axis_scale = (double)NATIVE_SDK_MAX_DECODED_IMAGE_DIMENSION / (double)MAX(width, height);
3499
+ double scale = MIN(1.0, MIN(area_scale, axis_scale));
3500
+ int fitted_width = MAX(1, (int)floor((double)width * scale));
3501
+ int fitted_height = MAX(1, (int)floor((double)height * scale));
3502
+ while ((size_t)fitted_width * (size_t)fitted_height > fit->max_pixels) {
3503
+ if (fitted_width > 1 && (fitted_height == 1 || fitted_width > fitted_height)) fitted_width -= 1;
3504
+ else fitted_height -= 1;
3505
+ }
3506
+ gdk_pixbuf_loader_set_size(loader, fitted_width, fitted_height);
3507
+ }
3508
+
3509
+ int native_sdk_gtk_decode_image(const uint8_t *bytes, size_t bytes_len, uint8_t *pixels, size_t pixels_len, size_t max_pixels, size_t *out_width, size_t *out_height) {
3408
3510
  if (out_width) *out_width = 0;
3409
3511
  if (out_height) *out_height = 0;
3410
- if (!bytes || bytes_len == 0 || !pixels) return 0;
3512
+ if (!bytes || bytes_len == 0 || !pixels || max_pixels == 0) return 0;
3411
3513
 
3412
3514
  GdkPixbufLoader *loader = gdk_pixbuf_loader_new();
3413
3515
  if (!loader) return 0;
3516
+ native_sdk_image_fit_t fit = { .max_pixels = max_pixels };
3517
+ g_signal_connect(loader, "size-prepared", G_CALLBACK(native_sdk_gtk_image_size_prepared), &fit);
3414
3518
  gboolean ok = gdk_pixbuf_loader_write(loader, bytes, bytes_len, NULL);
3415
3519
  ok = gdk_pixbuf_loader_close(loader, NULL) && ok;
3416
3520
  GdkPixbuf *decoded = ok ? gdk_pixbuf_loader_get_pixbuf(loader) : NULL;
@@ -3432,7 +3536,7 @@ int native_sdk_gtk_decode_image(const uint8_t *bytes, size_t bytes_len, uint8_t
3432
3536
 
3433
3537
  int width_px = gdk_pixbuf_get_width(rgba);
3434
3538
  int height_px = gdk_pixbuf_get_height(rgba);
3435
- if (width_px <= 0 || height_px <= 0 || width_px > 8192 || height_px > 8192) {
3539
+ if (width_px <= 0 || height_px <= 0 || width_px > NATIVE_SDK_MAX_DECODED_IMAGE_DIMENSION || height_px > NATIVE_SDK_MAX_DECODED_IMAGE_DIMENSION) {
3436
3540
  g_object_unref(rgba);
3437
3541
  g_object_unref(loader);
3438
3542
  return 0;
@@ -3767,10 +3871,10 @@ void native_sdk_gtk_set_shortcuts(native_sdk_gtk_host_t *host, const char *const
3767
3871
  }
3768
3872
  }
3769
3873
 
3770
- int native_sdk_gtk_create_window(native_sdk_gtk_host_t *host, uint64_t window_id, const char *window_title, size_t window_title_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int resizable, int titlebar_style, double min_width, double min_height, int show_policy, uint32_t window_flags) {
3874
+ int native_sdk_gtk_create_window(native_sdk_gtk_host_t *host, uint64_t window_id, const char *window_title, size_t window_title_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int initial_placement, int restore_policy, int resizable, int titlebar_style, double min_width, double min_height, int show_policy, uint32_t window_flags) {
3771
3875
  char *title = window_title_len > 0 ? native_sdk_strndup(window_title, window_title_len) : NULL;
3772
3876
  char *label = window_label_len > 0 ? native_sdk_strndup(window_label, window_label_len) : NULL;
3773
- native_sdk_gtk_window_t *win = native_sdk_create_window_internal(host, window_id, title, label, x, y, width, height, restore_frame, resizable, titlebar_style, min_width, min_height, show_policy, window_flags);
3877
+ native_sdk_gtk_window_t *win = native_sdk_create_window_internal(host, window_id, title, label, x, y, width, height, restore_frame, initial_placement, restore_policy, resizable, titlebar_style, min_width, min_height, show_policy, window_flags);
3774
3878
  free(title);
3775
3879
  free(label);
3776
3880
  if (!win) return 0;
@@ -4755,9 +4859,80 @@ int native_sdk_gtk_reveal_path(native_sdk_gtk_host_t *host, const char *path, si
4755
4859
  return 1;
4756
4860
  }
4757
4861
 
4758
- int native_sdk_gtk_show_notification(native_sdk_gtk_host_t *host, const char *title, size_t title_len, const char *subtitle, size_t subtitle_len, const char *body, size_t body_len) {
4862
+ static void native_sdk_forget_notification_action_for_id(native_sdk_gtk_host_t *host, const char *notification_id) {
4863
+ if (!host || !host->notification_actions ||
4864
+ !host->notification_action_tokens_by_id || !notification_id) return;
4865
+ const char *token = g_hash_table_lookup(
4866
+ host->notification_action_tokens_by_id, notification_id);
4867
+ if (token) g_hash_table_remove(host->notification_actions, token);
4868
+ g_hash_table_remove(host->notification_action_tokens_by_id, notification_id);
4869
+ }
4870
+
4871
+ static char *native_sdk_take_notification_action_command(
4872
+ native_sdk_gtk_host_t *host, const char *token, size_t token_len)
4873
+ {
4874
+ if (!host || !host->notification_actions || !token || token_len == 0) return NULL;
4875
+ native_sdk_gtk_notification_action_t *notification_action =
4876
+ g_hash_table_lookup(host->notification_actions, token);
4877
+ if (!notification_action || !notification_action->command) return NULL;
4878
+
4879
+ char *command = native_sdk_strndup(
4880
+ notification_action->command, strlen(notification_action->command));
4881
+ if (!command) return NULL;
4882
+ if (notification_action->notification_id &&
4883
+ host->notification_action_tokens_by_id) {
4884
+ const char *current_token = g_hash_table_lookup(
4885
+ host->notification_action_tokens_by_id,
4886
+ notification_action->notification_id);
4887
+ if (current_token && strcmp(current_token, token) == 0) {
4888
+ g_hash_table_remove(
4889
+ host->notification_action_tokens_by_id,
4890
+ notification_action->notification_id);
4891
+ }
4892
+ }
4893
+ /* One click consumes the capability before app code runs. App code
4894
+ * may synchronously show or replace another notification. */
4895
+ g_hash_table_remove(host->notification_actions, token);
4896
+ return command;
4897
+ }
4898
+
4899
+ static void native_sdk_notification_action_activated(GSimpleAction *action, GVariant *parameter, gpointer data) {
4900
+ (void)action;
4901
+ native_sdk_gtk_host_t *host = data;
4902
+ if (!host || !parameter || !g_variant_is_of_type(parameter, G_VARIANT_TYPE_STRING)) return;
4903
+ gsize token_len = 0;
4904
+ const char *token = g_variant_get_string(parameter, &token_len);
4905
+ char *command = native_sdk_take_notification_action_command(host, token, token_len);
4906
+ if (!command) return;
4907
+ const size_t command_len = strlen(command);
4908
+ native_sdk_emit(host, (native_sdk_gtk_event_t){
4909
+ .kind = NATIVE_SDK_GTK_EVENT_NOTIFICATION_COMMAND,
4910
+ .window_id = 1,
4911
+ .command_name = command,
4912
+ .command_name_len = command_len,
4913
+ });
4914
+ free(command);
4915
+ }
4916
+
4917
+ static int native_sdk_ensure_notification_action(native_sdk_gtk_host_t *host) {
4918
+ GActionMap *map = G_ACTION_MAP(host->app);
4919
+ if (g_action_map_lookup_action(map, native_sdk_notification_action_name)) return 1;
4920
+ GSimpleAction *action = g_simple_action_new(
4921
+ native_sdk_notification_action_name, G_VARIANT_TYPE_STRING);
4922
+ if (!action) return 0;
4923
+ g_signal_connect(action, "activate", G_CALLBACK(native_sdk_notification_action_activated), host);
4924
+ g_action_map_add_action(map, G_ACTION(action));
4925
+ g_object_unref(action);
4926
+ return 1;
4927
+ }
4928
+
4929
+ int native_sdk_gtk_show_notification(native_sdk_gtk_host_t *host, const char *title, size_t title_len, const char *subtitle, size_t subtitle_len, const char *body, size_t body_len, const char *notification_id, size_t notification_id_len, const char *action_label, size_t action_label_len, const char *action_command, size_t action_command_len) {
4759
4930
  if (!host || !host->app || !title || title_len == 0) return 0;
4760
- if ((subtitle_len > 0 && !subtitle) || (body_len > 0 && !body)) return 0;
4931
+ if ((subtitle_len > 0 && !subtitle) || (body_len > 0 && !body) ||
4932
+ (notification_id_len > 0 && !notification_id) ||
4933
+ (action_label_len > 0 && !action_label) ||
4934
+ (action_command_len > 0 && !action_command) ||
4935
+ ((action_label_len == 0) != (action_command_len == 0))) return 0;
4761
4936
  char *title_copy = native_sdk_strndup(title, title_len);
4762
4937
  if (!title_copy) return 0;
4763
4938
 
@@ -4787,7 +4962,59 @@ int native_sdk_gtk_show_notification(native_sdk_gtk_host_t *host, const char *ti
4787
4962
  free(message);
4788
4963
  }
4789
4964
 
4790
- g_application_send_notification(G_APPLICATION(host->app), NULL, notification);
4965
+ char *id_copy = notification_id_len > 0 ? native_sdk_strndup(notification_id, notification_id_len) : NULL;
4966
+ if (notification_id_len > 0 && !id_copy) {
4967
+ g_object_unref(notification);
4968
+ return 0;
4969
+ }
4970
+ if (id_copy) native_sdk_forget_notification_action_for_id(host, id_copy);
4971
+
4972
+ if (action_command_len > 0) {
4973
+ if (!native_sdk_ensure_notification_action(host)) {
4974
+ free(id_copy);
4975
+ g_object_unref(notification);
4976
+ return 0;
4977
+ }
4978
+ char *label_copy = native_sdk_strndup(action_label, action_label_len);
4979
+ char *command_copy = native_sdk_strndup(action_command, action_command_len);
4980
+ char *action_token = native_sdk_random_notification_action_token();
4981
+ native_sdk_gtk_notification_action_t *notification_action =
4982
+ calloc(1, sizeof(native_sdk_gtk_notification_action_t));
4983
+ if (!label_copy || !command_copy || !action_token || !notification_action) {
4984
+ free(label_copy);
4985
+ free(command_copy);
4986
+ g_free(action_token);
4987
+ free(notification_action);
4988
+ free(id_copy);
4989
+ g_object_unref(notification);
4990
+ return 0;
4991
+ }
4992
+ notification_action->command = command_copy;
4993
+ notification_action->notification_id = id_copy
4994
+ ? native_sdk_strndup(id_copy, strlen(id_copy))
4995
+ : NULL;
4996
+ if (id_copy && !notification_action->notification_id) {
4997
+ free(label_copy);
4998
+ g_free(action_token);
4999
+ native_sdk_notification_action_free(notification_action);
5000
+ free(id_copy);
5001
+ g_object_unref(notification);
5002
+ return 0;
5003
+ }
5004
+ g_notification_add_button_with_target_value(notification, label_copy,
5005
+ "app.native-sdk-notification-action", g_variant_new_string(action_token));
5006
+ g_hash_table_insert(host->notification_actions, action_token, notification_action);
5007
+ if (id_copy) {
5008
+ g_hash_table_replace(
5009
+ host->notification_action_tokens_by_id,
5010
+ g_strdup(id_copy),
5011
+ g_strdup(action_token));
5012
+ }
5013
+ free(label_copy);
5014
+ }
5015
+
5016
+ g_application_send_notification(G_APPLICATION(host->app), id_copy, notification);
5017
+ free(id_copy);
4791
5018
  g_object_unref(notification);
4792
5019
  return 1;
4793
5020
  }
@@ -6389,7 +6616,8 @@ static void native_sdk_alert_done(GObject *source, GAsyncResult *result, gpointe
6389
6616
  }
6390
6617
 
6391
6618
  int native_sdk_gtk_show_message_dialog(native_sdk_gtk_host_t *host, const native_sdk_gtk_message_dialog_opts_t *opts) {
6392
- GtkAlertDialog *dialog = gtk_alert_dialog_new(NULL);
6619
+ /* The constructor requires a non-NULL printf-style format string. */
6620
+ GtkAlertDialog *dialog = gtk_alert_dialog_new("");
6393
6621
  char *title = native_sdk_bytes_to_string(opts->title, opts->title_len);
6394
6622
  char *message = native_sdk_bytes_to_string(opts->message, opts->message_len);
6395
6623
  char *informative = native_sdk_bytes_to_string(opts->informative_text, opts->informative_text_len);
@@ -31,6 +31,7 @@ typedef enum {
31
31
  NATIVE_SDK_GTK_EVENT_AUDIO = 17,
32
32
  NATIVE_SDK_GTK_EVENT_CONTEXT_MENU_ACTION = 18,
33
33
  NATIVE_SDK_GTK_EVENT_VIEW_FOCUSED = 19,
34
+ NATIVE_SDK_GTK_EVENT_NOTIFICATION_COMMAND = 20,
34
35
  } native_sdk_gtk_event_kind_t;
35
36
 
36
37
  typedef struct {
@@ -161,7 +162,7 @@ typedef struct {
161
162
  * window with client-side decorations — a header bar carrying the
162
163
  * desktop-themed window controls and system drag behavior, no title
163
164
  * text); min_width/min_height <= 0 leave that axis unfloored. */
164
- native_sdk_gtk_host_t *native_sdk_gtk_create(const char *app_name, size_t app_name_len, const char *window_title, size_t window_title_len, const char *bundle_id, size_t bundle_id_len, const char *icon_path, size_t icon_path_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int resizable, int titlebar_style, double min_width, double min_height, int show_policy, uint32_t window_flags);
165
+ native_sdk_gtk_host_t *native_sdk_gtk_create(const char *app_name, size_t app_name_len, const char *window_title, size_t window_title_len, const char *bundle_id, size_t bundle_id_len, const char *icon_path, size_t icon_path_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int initial_placement, int restore_policy, int resizable, int titlebar_style, double min_width, double min_height, int show_policy, uint32_t window_flags);
165
166
  void native_sdk_gtk_destroy(native_sdk_gtk_host_t *host);
166
167
  void native_sdk_gtk_run(native_sdk_gtk_host_t *host, native_sdk_gtk_event_callback_t callback, void *context);
167
168
  void native_sdk_gtk_stop(native_sdk_gtk_host_t *host);
@@ -178,7 +179,7 @@ void native_sdk_gtk_request_frame(native_sdk_gtk_host_t *host);
178
179
  * `out_height` set), 0 when the bytes cannot be decoded, and -1 when the
179
180
  * decoded pixels do not fit `pixels_len` (`out_width`/`out_height` still
180
181
  * report the decoded dimensions). */
181
- int native_sdk_gtk_decode_image(const uint8_t *bytes, size_t bytes_len, uint8_t *pixels, size_t pixels_len, size_t *out_width, size_t *out_height);
182
+ int native_sdk_gtk_decode_image(const uint8_t *bytes, size_t bytes_len, uint8_t *pixels, size_t pixels_len, size_t max_pixels, size_t *out_width, size_t *out_height);
182
183
  void native_sdk_gtk_load_webview(native_sdk_gtk_host_t *host, const char *source, size_t source_len, int source_kind, const char *asset_root, size_t asset_root_len, const char *asset_entry, size_t asset_entry_len, const char *asset_origin, size_t asset_origin_len, int spa_fallback);
183
184
  void native_sdk_gtk_load_window_webview(native_sdk_gtk_host_t *host, uint64_t window_id, const char *source, size_t source_len, int source_kind, const char *asset_root, size_t asset_root_len, const char *asset_entry, size_t asset_entry_len, const char *asset_origin, size_t asset_origin_len, int spa_fallback);
184
185
  void native_sdk_gtk_set_bridge_callback(native_sdk_gtk_host_t *host, native_sdk_gtk_bridge_callback_t callback, void *context);
@@ -189,7 +190,7 @@ void native_sdk_gtk_emit_window_event(native_sdk_gtk_host_t *host, uint64_t wind
189
190
  void native_sdk_gtk_set_security_policy(native_sdk_gtk_host_t *host, const char *allowed_origins, size_t allowed_origins_len, const char *external_urls, size_t external_urls_len, int external_action);
190
191
  void native_sdk_gtk_set_menus(native_sdk_gtk_host_t *host, const char *const *menu_titles, const size_t *menu_title_lens, size_t menu_count, const uint32_t *item_menu_indices, const char *const *item_labels, const size_t *item_label_lens, const char *const *item_commands, const size_t *item_command_lens, const char *const *item_keys, const size_t *item_key_lens, const uint32_t *item_modifiers, const int *item_separators, const int *item_enabled, const int *item_checked, size_t item_count);
191
192
  void native_sdk_gtk_set_shortcuts(native_sdk_gtk_host_t *host, const char *const *ids, const size_t *id_lens, const char *const *keys, const size_t *key_lens, const uint32_t *modifiers, size_t count);
192
- int native_sdk_gtk_create_window(native_sdk_gtk_host_t *host, uint64_t window_id, const char *window_title, size_t window_title_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int resizable, int titlebar_style, double min_width, double min_height, int show_policy, uint32_t window_flags);
193
+ int native_sdk_gtk_create_window(native_sdk_gtk_host_t *host, uint64_t window_id, const char *window_title, size_t window_title_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int initial_placement, int restore_policy, int resizable, int titlebar_style, double min_width, double min_height, int show_policy, uint32_t window_flags);
193
194
  /* Ask the windowing system to start an interactive move from the last
194
195
  * pointer press (the widget `window_drag` channel). Returns 0 when the
195
196
  * window is unknown or no press has been recorded yet. */
@@ -248,7 +249,7 @@ int native_sdk_gtk_set_webview_layer(native_sdk_gtk_host_t *host, uint64_t windo
248
249
  int native_sdk_gtk_close_webview(native_sdk_gtk_host_t *host, uint64_t window_id, const char *label, size_t label_len);
249
250
  int native_sdk_gtk_open_external_url(native_sdk_gtk_host_t *host, const char *url, size_t url_len);
250
251
  int native_sdk_gtk_reveal_path(native_sdk_gtk_host_t *host, const char *path, size_t path_len);
251
- int native_sdk_gtk_show_notification(native_sdk_gtk_host_t *host, const char *title, size_t title_len, const char *subtitle, size_t subtitle_len, const char *body, size_t body_len);
252
+ int native_sdk_gtk_show_notification(native_sdk_gtk_host_t *host, const char *title, size_t title_len, const char *subtitle, size_t subtitle_len, const char *body, size_t body_len, const char *notification_id, size_t notification_id_len, const char *action_label, size_t action_label_len, const char *action_command, size_t action_command_len);
252
253
  int native_sdk_gtk_add_recent_document(native_sdk_gtk_host_t *host, const char *path, size_t path_len);
253
254
  int native_sdk_gtk_clear_recent_documents(native_sdk_gtk_host_t *host);
254
255
  int native_sdk_gtk_credentials_available(native_sdk_gtk_host_t *host);