@native-sdk/cli 0.6.1 → 0.6.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 (40) hide show
  1. package/native-sdk.d.ts +16 -0
  2. package/package.json +9 -9
  3. package/packages/core/package-lock.json +2 -2
  4. package/packages/core/package.json +1 -1
  5. package/src/app_runner/root.zig +19 -0
  6. package/src/platform/linux/gtk_host.c +167 -8
  7. package/src/platform/linux/gtk_host.h +3 -2
  8. package/src/platform/linux/root.zig +198 -9
  9. package/src/platform/macos/appkit_host.h +2 -2
  10. package/src/platform/macos/appkit_host.m +101 -28
  11. package/src/platform/macos/cef_host.mm +46 -11
  12. package/src/platform/macos/root.zig +143 -5
  13. package/src/platform/null_platform.zig +32 -4
  14. package/src/platform/types.zig +29 -4
  15. package/src/platform/windows/root.zig +220 -10
  16. package/src/platform/windows/webview2_host.cpp +330 -31
  17. package/src/primitives/app_manifest/comptime_scene.zig +4 -0
  18. package/src/primitives/app_manifest/types.zig +16 -0
  19. package/src/primitives/canvas/widget_render.zig +21 -2
  20. package/src/primitives/canvas/widget_runtime_tests.zig +51 -0
  21. package/src/runtime/bridge_payload.zig +9 -0
  22. package/src/runtime/bridge_responses.zig +2 -0
  23. package/src/runtime/builtin_bridge.zig +10 -0
  24. package/src/runtime/canvas_widget_floating_tests.zig +3 -3
  25. package/src/runtime/effects.zig +5 -6
  26. package/src/runtime/flow.zig +45 -7
  27. package/src/runtime/gpu_surface_events.zig +8 -1
  28. package/src/runtime/runtime_event_tests.zig +9 -6
  29. package/src/runtime/shell_layout.zig +25 -11
  30. package/src/runtime/shell_layout_tests.zig +184 -0
  31. package/src/runtime/shell_view_tests.zig +9 -7
  32. package/src/runtime/state.zig +6 -0
  33. package/src/runtime/ui_app.zig +61 -14
  34. package/src/runtime/ui_app_window_tests.zig +107 -2
  35. package/src/runtime/window_command_bridge_tests.zig +82 -6
  36. package/src/runtime/window_storage.zig +14 -3
  37. package/src/runtime/window_views.zig +12 -11
  38. package/src/tooling/manifest.zig +38 -2
  39. package/src/tooling/raw_manifest.zig +8 -0
  40. package/src/tooling/templates.zig +17 -0
@@ -79,6 +79,13 @@ test "runtime creates lists focuses and closes windows" {
79
79
 
80
80
  const info = try harness.runtime.createWindow(.{ .label = "tools", .title = "Tools" });
81
81
  try std.testing.expectEqual(@as(platform.WindowId, 2), info.id);
82
+ try std.testing.expect(info.focused);
83
+ try std.testing.expect(!harness.runtime.windows[0].info.focused);
84
+ try std.testing.expect(harness.runtime.windows[1].info.focused);
85
+ // Ordinary source-less options keep the established inheritance:
86
+ // this secondary window hosts the app's loaded WebView source.
87
+ try std.testing.expect(harness.runtime.windows[1].source != null);
88
+ try std.testing.expect(harness.null_platform.window_sources[1] != null);
82
89
  var output: [platform.max_windows]platform.WindowInfo = undefined;
83
90
  const windows = harness.runtime.listWindows(&output);
84
91
  try std.testing.expectEqual(@as(usize, 2), windows.len);
@@ -89,6 +96,51 @@ test "runtime creates lists focuses and closes windows" {
89
96
  try std.testing.expect(!harness.runtime.windows[1].info.open);
90
97
  }
91
98
 
99
+ test "transparent imperative window without explicit source stays canvas-only" {
100
+ const TestApp = struct {
101
+ fn app(self: *@This()) App {
102
+ return .{ .context = self, .name = "imperative-overlay", .source = platform.WebViewSource.html("<p>Main</p>") };
103
+ }
104
+ };
105
+
106
+ const harness = try TestHarness().create(std.testing.allocator, .{});
107
+ defer harness.destroy(std.testing.allocator);
108
+ harness.null_platform.gpu_surfaces = true;
109
+ var app_state: TestApp = .{};
110
+ const app = app_state.app();
111
+ try harness.start(app);
112
+
113
+ const overlay = try harness.runtime.createWindow(.{
114
+ .label = "overlay",
115
+ .title = "Overlay",
116
+ .default_frame = geometry.RectF.init(0, 0, 320, 180),
117
+ .titlebar = .chromeless,
118
+ .transparent = true,
119
+ .always_on_top = true,
120
+ .click_through = true,
121
+ .activate_on_show = false,
122
+ });
123
+ try std.testing.expect(harness.runtime.windows[1].source == null);
124
+ try std.testing.expectEqual(.never_source, harness.runtime.windows[1].source_policy);
125
+ try std.testing.expect(harness.null_platform.window_sources[1] == null);
126
+
127
+ const canvas_view = try harness.runtime.createView(.{
128
+ .window_id = overlay.id,
129
+ .label = "overlay-canvas",
130
+ .kind = .gpu_surface,
131
+ .frame = geometry.RectF.init(0, 0, 320, 180),
132
+ .gpu_surface = .{ .alpha_mode = .premultiplied },
133
+ });
134
+ try std.testing.expectEqual(platform.ViewKind.gpu_surface, canvas_view.kind);
135
+ try std.testing.expectEqual(platform.GpuSurfaceAlphaMode.premultiplied, canvas_view.gpu_alpha_mode);
136
+
137
+ // Reloading the app source must not materialize a main WebView into
138
+ // the deliberately canvas-only overlay.
139
+ try reloadWindows(&harness.runtime, app);
140
+ try std.testing.expect(harness.runtime.windows[1].source == null);
141
+ try std.testing.expect(harness.null_platform.window_sources[1] == null);
142
+ }
143
+
92
144
  test "runtime handles built-in JavaScript window bridge commands" {
93
145
  const TestApp = struct {
94
146
  fn app(self: *@This()) App {
@@ -105,13 +157,28 @@ test "runtime handles built-in JavaScript window bridge commands" {
105
157
  try harness.start(app_state.app());
106
158
 
107
159
  try harness.runtime.dispatchPlatformEvent(app_state.app(), .{ .bridge_message = .{
108
- .bytes = "{\"id\":\"1\",\"command\":\"native-sdk.window.create\",\"payload\":{\"label\":\"palette\",\"title\":\"Palette\",\"width\":320,\"height\":240}}",
160
+ .bytes = "{\"id\":\"1\",\"command\":\"native-sdk.window.create\",\"payload\":{\"label\":\"palette\",\"title\":\"Palette\",\"width\":320,\"height\":240,\"titlebar\":\"chromeless\",\"transparent\":true,\"alwaysOnTop\":true,\"clickThrough\":true,\"activateOnShow\":false}}",
109
161
  .origin = "zero://inline",
110
162
  .window_id = 1,
111
163
  } });
112
164
  try std.testing.expect(std.mem.indexOf(u8, harness.null_platform.lastBridgeResponse(), "\"ok\":true") != null);
113
165
  try std.testing.expect(std.mem.indexOf(u8, harness.null_platform.lastBridgeResponse(), "\"label\":\"palette\"") != null);
114
166
  try std.testing.expectEqual(@as(platform.WindowId, 1), harness.null_platform.lastBridgeResponseWindowId());
167
+ try std.testing.expect(harness.null_platform.window_transparent[1]);
168
+ try std.testing.expect(harness.null_platform.window_always_on_top[1]);
169
+ try std.testing.expect(harness.null_platform.window_click_through[1]);
170
+ try std.testing.expect(!harness.null_platform.window_activate_on_show[1]);
171
+ try std.testing.expectEqual(platform.WindowTitlebarStyle.chromeless, harness.null_platform.window_titlebar[1]);
172
+ try std.testing.expect(harness.runtime.windows[1].source == null);
173
+ try std.testing.expectEqual(.never_source, harness.runtime.windows[1].source_policy);
174
+ try std.testing.expect(harness.null_platform.window_sources[1] == null);
175
+
176
+ // The bridge-created overlay is protected from later app-source
177
+ // reloads by the same never-source policy as a declarative canvas
178
+ // overlay.
179
+ try reloadWindows(&harness.runtime, app_state.app());
180
+ try std.testing.expect(harness.runtime.windows[1].source == null);
181
+ try std.testing.expect(harness.null_platform.window_sources[1] == null);
115
182
 
116
183
  try harness.runtime.dispatchPlatformEvent(app_state.app(), .{ .bridge_message = .{
117
184
  .bytes = "{\"id\":\"duplicate\",\"command\":\"native-sdk.window.create\",\"payload\":{\"label\":\"palette\"}}",
@@ -131,6 +198,16 @@ test "runtime handles built-in JavaScript window bridge commands" {
131
198
  var invalid_frame_windows: [platform.max_windows]platform.WindowInfo = undefined;
132
199
  try std.testing.expectEqual(@as(usize, 2), harness.runtime.listWindows(&invalid_frame_windows).len);
133
200
 
201
+ try harness.runtime.dispatchPlatformEvent(app_state.app(), .{ .bridge_message = .{
202
+ .bytes = "{\"id\":\"bad-titlebar\",\"command\":\"native-sdk.window.create\",\"payload\":{\"label\":\"bad-titlebar\",\"titlebar\":\"glass\"}}",
203
+ .origin = "zero://inline",
204
+ .window_id = 1,
205
+ } });
206
+ try std.testing.expect(std.mem.indexOf(u8, harness.null_platform.lastBridgeResponse(), "\"invalid_request\"") != null);
207
+ try std.testing.expect(std.mem.indexOf(u8, harness.null_platform.lastBridgeResponse(), "Window options are invalid") != null);
208
+ var invalid_titlebar_windows: [platform.max_windows]platform.WindowInfo = undefined;
209
+ try std.testing.expectEqual(@as(usize, 2), harness.runtime.listWindows(&invalid_titlebar_windows).len);
210
+
134
211
  try harness.runtime.dispatchPlatformEvent(app_state.app(), .{ .bridge_message = .{
135
212
  .bytes = "{\"id\":\"2\",\"command\":\"native-sdk.window.list\",\"payload\":null}",
136
213
  .origin = "zero://inline",
@@ -191,10 +268,9 @@ test "runtime handles built-in JavaScript window bridge commands" {
191
268
  try std.testing.expect(std.mem.indexOf(u8, harness.null_platform.lastBridgeResponse(), "\"hidden\":false") != null);
192
269
  try std.testing.expectEqual(@as(u32, 1), harness.null_platform.showCountForWindow(2));
193
270
 
194
- // The runtime's show verb (a tray "Open", Cmd.showWindow) is show
195
- // AND activate: after showing a policy-hidden window, the bridge's
196
- // window JSON — served from the same runtime table — reports it
197
- // focused, not merely un-hidden.
271
+ // This window opted out of implicit activation, so a runtime show
272
+ // (a tray "Open", Cmd.showWindow) makes it visible without moving
273
+ // focus. Explicit focus above still activates it.
198
274
  try harness.runtime.dispatchPlatformEvent(app_state.app(), .{ .window_frame_changed = .{
199
275
  .id = 2,
200
276
  .label = "palette",
@@ -211,7 +287,7 @@ test "runtime handles built-in JavaScript window bridge commands" {
211
287
  .origin = "zero://inline",
212
288
  .window_id = 1,
213
289
  } });
214
- try std.testing.expect(std.mem.indexOf(u8, harness.null_platform.lastBridgeResponse(), "\"label\":\"palette\",\"title\":\"Palette\",\"open\":true,\"focused\":true,\"hidden\":false") != null);
290
+ try std.testing.expect(std.mem.indexOf(u8, harness.null_platform.lastBridgeResponse(), "\"label\":\"palette\",\"title\":\"Palette\",\"open\":true,\"focused\":false,\"hidden\":false") != null);
215
291
 
216
292
  // Closing a POLICY-HIDDEN window through the bridge answers with
217
293
  // the post-close table state: hidden clears with open (a closed
@@ -24,6 +24,15 @@ pub fn RuntimeWindowStorage(comptime Runtime: type) type {
24
24
  const Self = @This();
25
25
 
26
26
  pub fn createWindow(self: *Runtime, options: platform.WindowCreateOptions) anyerror!platform.WindowInfo {
27
+ // A transparent imperative window with no EXPLICIT source is
28
+ // the canvas-overlay shape. Do not inherit the app's loaded
29
+ // WebView source: Windows layered windows cannot host that
30
+ // child HWND, and hot reload must not materialize one later.
31
+ // Explicit sources keep the established WebView-window path
32
+ // on backends that can composite them.
33
+ if (options.transparent and options.source == null) {
34
+ return Self.createWindowWithSourceMode(self, options, false, .never_source);
35
+ }
27
36
  return Self.createWindowWithSourceMode(self, options, options.source == null, .require_source);
28
37
  }
29
38
 
@@ -97,7 +106,8 @@ pub fn RuntimeWindowStorage(comptime Runtime: type) type {
97
106
  }
98
107
  if (Self.findWindowIndexById(self, id) != null) return error.DuplicateWindowId;
99
108
  if (Self.findWindowIndexByLabel(self, label) != null) return error.DuplicateWindowLabel;
100
- const index = try Self.reserveWindow(self, id, label, options.title, source, source_reloads_from_app);
109
+ const index = try Self.reserveWindow(self, id, label, options.title, source, source_reloads_from_app, source_policy);
110
+ self.windows[index].activate_on_show = options.activate_on_show;
101
111
  var native_created = false;
102
112
  errdefer Self.removeWindowAt(self, index);
103
113
  errdefer if (native_created) self.options.platform.services.closeWindow(id) catch {};
@@ -118,7 +128,7 @@ pub fn RuntimeWindowStorage(comptime Runtime: type) type {
118
128
  return self.windows[index].info;
119
129
  }
120
130
 
121
- pub fn reserveWindow(self: *Runtime, id: platform.WindowId, label: []const u8, title: []const u8, source: ?platform.WebViewSource, source_reloads_from_app: bool) !usize {
131
+ pub fn reserveWindow(self: *Runtime, id: platform.WindowId, label: []const u8, title: []const u8, source: ?platform.WebViewSource, source_reloads_from_app: bool, source_policy: WindowSourcePolicy) !usize {
122
132
  if (self.window_count >= platform.max_windows) return error.WindowLimitReached;
123
133
  if (label.len == 0) return error.InvalidWindowOptions;
124
134
  const index = self.window_count;
@@ -135,6 +145,7 @@ pub fn RuntimeWindowStorage(comptime Runtime: type) type {
135
145
  self.windows[index].main_view_id = Self.allocateViewId(self);
136
146
  self.windows[index].source = if (source) |source_value| try Self.copySource(self, index, source_value) else null;
137
147
  self.windows[index].source_reloads_from_app = source_reloads_from_app;
148
+ self.windows[index].source_policy = source_policy;
138
149
  self.windows[index].main_frame = geometry.RectF.init(0, 0, self.windows[index].info.frame.width, self.windows[index].info.frame.height);
139
150
  self.windows[index].main_frame_set = false;
140
151
  self.windows[index].main_layer = 0;
@@ -178,7 +189,7 @@ pub fn RuntimeWindowStorage(comptime Runtime: type) type {
178
189
 
179
190
  pub fn updateWindowState(self: *Runtime, state: platform.WindowState) !void {
180
191
  const existing_index = Self.findWindowIndexById(self, state.id);
181
- const index = existing_index orelse try Self.reserveWindow(self, state.id, state.label, state.title, null, true);
192
+ const index = existing_index orelse try Self.reserveWindow(self, state.id, state.label, state.title, null, true, .allow_source_less);
182
193
  self.windows[index].info.frame = state.frame;
183
194
  self.windows[index].info.scale_factor = state.scale_factor;
184
195
  self.windows[index].info.open = state.open;
@@ -146,7 +146,7 @@ pub fn RuntimeWindowViews(comptime Runtime: type) type {
146
146
  try self.options.platform.services.minimizeWindow(window_id);
147
147
  }
148
148
 
149
- /// The real OS show verb: unhide + activate — the counterpart
149
+ /// The real OS show verb: unhide and order front — the counterpart
150
150
  /// to a `close_policy = .hide` hide, and what a tray "Open"
151
151
  /// action resolves to. Like `closeWindow`, the runtime flag
152
152
  /// flips BEFORE the platform call (hosts that emit the frame
@@ -170,16 +170,13 @@ pub fn RuntimeWindowViews(comptime Runtime: type) type {
170
170
  self.windows[index].info.hidden = was_hidden;
171
171
  return err;
172
172
  };
173
- // The contract is show AND activate: every host's show verb
174
- // makes the window key (makeKeyAndOrderFront / activate), so
175
- // the runtime table must move focus with it or listWindows
176
- // and the JS bridge report the shown window unfocused while
177
- // it stands frontmost on the glass. Same post-success flow
178
- // as focusWindow — through the setFocusedIndex seam, so the
179
- // dethroned window's key-loss consequence fires — and only
180
- // AFTER the platform accepted: a refused show rolls back
181
- // hidden above and moves no focus.
182
- try Self.setFocusedIndex(self, index);
173
+ // Active windows use the classic show+activate contract.
174
+ // Passive overlay windows order front without changing the
175
+ // user's current app or our focus table; an explicit
176
+ // focusWindow remains the deliberate activation path.
177
+ if (self.windows[index].activate_on_show) {
178
+ try Self.setFocusedIndex(self, index);
179
+ }
183
180
  self.invalidated = true;
184
181
  }
185
182
 
@@ -231,6 +228,10 @@ pub fn RuntimeWindowViews(comptime Runtime: type) type {
231
228
  .restore_policy = shellRestorePolicy(shell_window.restore_policy),
232
229
  .titlebar = shell_layout.shellTitlebarStyle(shell_window.titlebar),
233
230
  .show = shell_layout.shellWindowShowMode(shell_window),
231
+ .transparent = shell_window.transparent,
232
+ .always_on_top = shell_window.always_on_top,
233
+ .click_through = shell_window.click_through,
234
+ .activate_on_show = shell_window.activate_on_show,
234
235
  .min_width = shell_window.min_width,
235
236
  .min_height = shell_window.min_height,
236
237
  .close_policy = shell_layout.shellClosePolicy(shell_window.close_policy),
@@ -200,6 +200,10 @@ pub const WindowMetadata = struct {
200
200
  resizable: bool = true,
201
201
  restore_state: bool = true,
202
202
  titlebar: []const u8 = "standard",
203
+ transparent: bool = false,
204
+ always_on_top: bool = false,
205
+ click_through: bool = false,
206
+ activate_on_show: bool = true,
203
207
  min_width: f32 = 0,
204
208
  min_height: f32 = 0,
205
209
  close_policy: []const u8 = "quit",
@@ -238,6 +242,10 @@ pub const ShellWindowMetadata = struct {
238
242
  restore_state: bool = true,
239
243
  restore_policy: []const u8 = "clamp_to_visible_screen",
240
244
  titlebar: []const u8 = "standard",
245
+ transparent: bool = false,
246
+ always_on_top: bool = false,
247
+ click_through: bool = false,
248
+ activate_on_show: bool = true,
241
249
  min_width: f32 = 0,
242
250
  min_height: f32 = 0,
243
251
  close_policy: []const u8 = "quit",
@@ -594,6 +602,10 @@ fn convertRawWindows(allocator: std.mem.Allocator, windows: []const RawWindow) !
594
602
  .resizable = window.resizable,
595
603
  .restore_state = window.restore_state,
596
604
  .titlebar = try allocator.dupe(u8, window.titlebar),
605
+ .transparent = window.transparent,
606
+ .always_on_top = window.always_on_top,
607
+ .click_through = window.click_through,
608
+ .activate_on_show = window.activate_on_show,
597
609
  .min_width = window.min_width,
598
610
  .min_height = window.min_height,
599
611
  .close_policy = try allocator.dupe(u8, window.close_policy),
@@ -647,6 +659,10 @@ fn convertRawShellWindows(allocator: std.mem.Allocator, windows: []const RawShel
647
659
  .restore_state = window.restore_state,
648
660
  .restore_policy = try allocator.dupe(u8, window.restore_policy),
649
661
  .titlebar = try allocator.dupe(u8, window.titlebar),
662
+ .transparent = window.transparent,
663
+ .always_on_top = window.always_on_top,
664
+ .click_through = window.click_through,
665
+ .activate_on_show = window.activate_on_show,
650
666
  .min_width = window.min_width,
651
667
  .min_height = window.min_height,
652
668
  .close_policy = try allocator.dupe(u8, window.close_policy),
@@ -847,6 +863,10 @@ fn convertWindows(allocator: std.mem.Allocator, windows: []const WindowMetadata)
847
863
  .resizable = window.resizable,
848
864
  .restore_state = window.restore_state,
849
865
  .titlebar = try parseTitlebarStyle(window.titlebar),
866
+ .transparent = window.transparent,
867
+ .always_on_top = window.always_on_top,
868
+ .click_through = window.click_through,
869
+ .activate_on_show = window.activate_on_show,
850
870
  .min_width = try parseWindowMinSize(window.min_width),
851
871
  .min_height = try parseWindowMinSize(window.min_height),
852
872
  .close_policy = try parseClosePolicy(window.close_policy),
@@ -887,6 +907,10 @@ fn parseShell(allocator: std.mem.Allocator, shell: ShellMetadata) !app_manifest.
887
907
  .restore_state = window.restore_state,
888
908
  .restore_policy = restore_policy,
889
909
  .titlebar = titlebar,
910
+ .transparent = window.transparent,
911
+ .always_on_top = window.always_on_top,
912
+ .click_through = window.click_through,
913
+ .activate_on_show = window.activate_on_show,
890
914
  .min_width = min_width,
891
915
  .min_height = min_height,
892
916
  .close_policy = close_policy,
@@ -1789,13 +1813,13 @@ test "manifest parser reads window titlebar styles" {
1789
1813
  \\ .name = "example",
1790
1814
  \\ .version = "1.2.3",
1791
1815
  \\ .windows = .{
1792
- \\ .{ .label = "main", .resizable = false, .titlebar = "hidden_inset" },
1816
+ \\ .{ .label = "main", .resizable = false, .titlebar = "hidden_inset", .transparent = true, .always_on_top = true, .click_through = true, .activate_on_show = false },
1793
1817
  \\ .{ .label = "tall", .titlebar = "hidden_inset_tall" },
1794
1818
  \\ .{ .label = "skinned", .titlebar = "chromeless" },
1795
1819
  \\ },
1796
1820
  \\ .shell = .{
1797
1821
  \\ .windows = .{
1798
- \\ .{ .label = "scene", .titlebar = "hidden_inset_tall", .views = .{ .{ .label = "content", .kind = "webview", .url = "zero://app/index.html" } } },
1822
+ \\ .{ .label = "scene", .titlebar = "hidden_inset_tall", .transparent = true, .always_on_top = true, .click_through = true, .activate_on_show = false, .views = .{ .{ .label = "content", .kind = "webview", .url = "zero://app/index.html" } } },
1799
1823
  \\ },
1800
1824
  \\ },
1801
1825
  \\}
@@ -1804,6 +1828,10 @@ test "manifest parser reads window titlebar styles" {
1804
1828
 
1805
1829
  try std.testing.expectEqualStrings("hidden_inset", metadata.windows[0].titlebar);
1806
1830
  try std.testing.expect(!metadata.windows[0].resizable);
1831
+ try std.testing.expect(metadata.windows[0].transparent);
1832
+ try std.testing.expect(metadata.windows[0].always_on_top);
1833
+ try std.testing.expect(metadata.windows[0].click_through);
1834
+ try std.testing.expect(!metadata.windows[0].activate_on_show);
1807
1835
  try std.testing.expectEqualStrings("hidden_inset_tall", metadata.windows[1].titlebar);
1808
1836
  try std.testing.expectEqualStrings("chromeless", metadata.windows[2].titlebar);
1809
1837
  try std.testing.expectEqualStrings("hidden_inset_tall", metadata.shell.windows[0].titlebar);
@@ -1812,12 +1840,20 @@ test "manifest parser reads window titlebar styles" {
1812
1840
  defer std.testing.allocator.free(windows);
1813
1841
  try std.testing.expectEqual(app_manifest.WindowTitlebarStyle.hidden_inset, windows[0].titlebar);
1814
1842
  try std.testing.expect(!windows[0].resizable);
1843
+ try std.testing.expect(windows[0].transparent);
1844
+ try std.testing.expect(windows[0].always_on_top);
1845
+ try std.testing.expect(windows[0].click_through);
1846
+ try std.testing.expect(!windows[0].activate_on_show);
1815
1847
  try std.testing.expectEqual(app_manifest.WindowTitlebarStyle.hidden_inset_tall, windows[1].titlebar);
1816
1848
  try std.testing.expectEqual(app_manifest.WindowTitlebarStyle.chromeless, windows[2].titlebar);
1817
1849
 
1818
1850
  const shell = try parseShell(std.testing.allocator, metadata.shell);
1819
1851
  defer deinitParsedShell(std.testing.allocator, shell);
1820
1852
  try std.testing.expectEqual(app_manifest.WindowTitlebarStyle.hidden_inset_tall, shell.windows[0].titlebar);
1853
+ try std.testing.expect(shell.windows[0].transparent);
1854
+ try std.testing.expect(shell.windows[0].always_on_top);
1855
+ try std.testing.expect(shell.windows[0].click_through);
1856
+ try std.testing.expect(!shell.windows[0].activate_on_show);
1821
1857
  }
1822
1858
 
1823
1859
  test "manifest parser reads window min sizes" {
@@ -94,6 +94,10 @@ pub const RawWindow = struct {
94
94
  resizable: bool = true,
95
95
  restore_state: bool = true,
96
96
  titlebar: []const u8 = "standard",
97
+ transparent: bool = false,
98
+ always_on_top: bool = false,
99
+ click_through: bool = false,
100
+ activate_on_show: bool = true,
97
101
  min_width: f32 = 0,
98
102
  min_height: f32 = 0,
99
103
  close_policy: []const u8 = "quit",
@@ -132,6 +136,10 @@ pub const RawShellWindow = struct {
132
136
  restore_state: bool = true,
133
137
  restore_policy: []const u8 = "clamp_to_visible_screen",
134
138
  titlebar: []const u8 = "standard",
139
+ transparent: bool = false,
140
+ always_on_top: bool = false,
141
+ click_through: bool = false,
142
+ activate_on_show: bool = true,
135
143
  min_width: f32 = 0,
136
144
  min_height: f32 = 0,
137
145
  close_policy: []const u8 = "quit",
@@ -2243,6 +2243,10 @@ fn runnerZig() []const u8 {
2243
2243
  \\ info.main_window.titlebar = manifestShellStartupTitlebar();
2244
2244
  \\ info.main_window.resizable = manifestShellStartupResizable();
2245
2245
  \\ info.main_window.show = manifestShellStartupShowMode();
2246
+ \\ info.main_window.transparent = manifestShellStartupBool("transparent", false);
2247
+ \\ info.main_window.always_on_top = manifestShellStartupBool("always_on_top", false);
2248
+ \\ info.main_window.click_through = manifestShellStartupBool("click_through", false);
2249
+ \\ info.main_window.activate_on_show = manifestShellStartupBool("activate_on_show", true);
2246
2250
  \\ // Min-size floors ride the create call like the titlebar:
2247
2251
  \\ // the scene re-applies size/title later, but the window's
2248
2252
  \\ // enforced floor is host state from the first frame on.
@@ -2375,6 +2379,10 @@ fn runnerZig() []const u8 {
2375
2379
  \\ .restore_state = windowBool(window, "restore_state", true),
2376
2380
  \\ .restore_policy = windowRestorePolicy(window),
2377
2381
  \\ .titlebar = windowTitlebarStyle(window),
2382
+ \\ .transparent = windowBool(window, "transparent", false),
2383
+ \\ .always_on_top = windowBool(window, "always_on_top", false),
2384
+ \\ .click_through = windowBool(window, "click_through", false),
2385
+ \\ .activate_on_show = windowBool(window, "activate_on_show", true),
2378
2386
  \\ .min_width = windowMinSize(window, "min_width"),
2379
2387
  \\ .min_height = windowMinSize(window, "min_height"),
2380
2388
  \\ .close_policy = windowClosePolicy(window),
@@ -2454,6 +2462,15 @@ fn runnerZig() []const u8 {
2454
2462
  \\ return windowBool(shell.windows[0], "resizable", true);
2455
2463
  \\}
2456
2464
  \\
2465
+ \\/// One creation-time boolean from app.zon's first shell window.
2466
+ \\fn manifestShellStartupBool(comptime field: []const u8, comptime default_value: bool) bool {
2467
+ \\ if (comptime !@hasField(@TypeOf(app_manifest), "shell")) return default_value;
2468
+ \\ const shell = app_manifest.shell;
2469
+ \\ if (comptime !@hasField(@TypeOf(shell), "windows")) return default_value;
2470
+ \\ if (comptime shell.windows.len == 0) return default_value;
2471
+ \\ return windowBool(shell.windows[0], field, default_value);
2472
+ \\}
2473
+ \\
2457
2474
  \\/// The startup window's close policy for scene-first apps: app.zon's
2458
2475
  \\/// `.shell.windows[0].close_policy`. Like the titlebar, close handling
2459
2476
  \\/// is host window state fixed at create time.