@native-sdk/cli 0.6.0 → 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.
- package/build.zig +58 -33
- package/native-sdk.d.ts +16 -0
- package/package.json +9 -9
- package/packages/core/package-lock.json +2 -2
- package/packages/core/package.json +1 -1
- package/src/app_runner/root.zig +19 -0
- package/src/platform/linux/gtk_host.c +167 -8
- package/src/platform/linux/gtk_host.h +3 -2
- package/src/platform/linux/root.zig +198 -9
- package/src/platform/macos/appkit_host.h +2 -2
- package/src/platform/macos/appkit_host.m +186 -36
- package/src/platform/macos/cef_host.mm +46 -11
- package/src/platform/macos/root.zig +143 -5
- package/src/platform/null_platform.zig +32 -4
- package/src/platform/types.zig +29 -4
- package/src/platform/windows/root.zig +220 -10
- package/src/platform/windows/webview2_host.cpp +330 -31
- package/src/primitives/app_manifest/comptime_scene.zig +4 -0
- package/src/primitives/app_manifest/types.zig +16 -0
- package/src/primitives/canvas/widget_render.zig +21 -2
- package/src/primitives/canvas/widget_runtime_tests.zig +51 -0
- package/src/runtime/api.zig +6 -5
- package/src/runtime/bridge_payload.zig +9 -0
- package/src/runtime/bridge_responses.zig +2 -0
- package/src/runtime/builtin_bridge.zig +10 -0
- package/src/runtime/canvas_widget_events.zig +28 -2
- package/src/runtime/canvas_widget_floating_tests.zig +3 -3
- package/src/runtime/effects.zig +5 -6
- package/src/runtime/flow.zig +45 -7
- package/src/runtime/gpu_surface_events.zig +10 -3
- package/src/runtime/runtime_event_tests.zig +9 -6
- package/src/runtime/session_tests.zig +5 -4
- package/src/runtime/shell_layout.zig +25 -11
- package/src/runtime/shell_layout_tests.zig +184 -0
- package/src/runtime/shell_view_tests.zig +9 -7
- package/src/runtime/state.zig +6 -0
- package/src/runtime/ui_app.zig +66 -18
- package/src/runtime/ui_app_window_tests.zig +107 -2
- package/src/runtime/window_command_bridge_tests.zig +82 -6
- package/src/runtime/window_storage.zig +14 -3
- package/src/runtime/window_views.zig +12 -11
- package/src/tooling/manifest.zig +38 -2
- package/src/tooling/raw_manifest.zig +8 -0
- package/src/tooling/templates.zig +17 -0
|
@@ -111,7 +111,7 @@ const shortcut_modifier_control: u32 = 1 << 2;
|
|
|
111
111
|
const shortcut_modifier_option: u32 = 1 << 3;
|
|
112
112
|
const shortcut_modifier_shift: u32 = 1 << 4;
|
|
113
113
|
|
|
114
|
-
extern fn native_sdk_gtk_create(app_name: [*]const u8, app_name_len: usize, window_title: [*]const u8, window_title_len: usize, bundle_id: [*]const u8, bundle_id_len: usize, icon_path: [*]const u8, icon_path_len: usize, window_label: [*]const u8, window_label_len: usize, x: f64, y: f64, width: f64, height: f64, restore_frame: c_int, resizable: c_int, titlebar_style: c_int, min_width: f64, min_height: f64) ?*GtkHost;
|
|
114
|
+
extern fn native_sdk_gtk_create(app_name: [*]const u8, app_name_len: usize, window_title: [*]const u8, window_title_len: usize, bundle_id: [*]const u8, bundle_id_len: usize, icon_path: [*]const u8, icon_path_len: usize, window_label: [*]const u8, window_label_len: usize, x: f64, y: f64, width: f64, height: f64, restore_frame: c_int, resizable: c_int, titlebar_style: c_int, min_width: f64, min_height: f64, show_policy: c_int, window_flags: u32) ?*GtkHost;
|
|
115
115
|
extern fn native_sdk_gtk_destroy(host: *GtkHost) void;
|
|
116
116
|
extern fn native_sdk_gtk_run(host: *GtkHost, callback: GtkCallback, context: ?*anyopaque) void;
|
|
117
117
|
extern fn native_sdk_gtk_stop(host: *GtkHost) void;
|
|
@@ -128,13 +128,14 @@ extern fn native_sdk_gtk_emit_window_event(host: *GtkHost, window_id: u64, name:
|
|
|
128
128
|
extern fn native_sdk_gtk_set_security_policy(host: *GtkHost, allowed_origins: [*]const u8, allowed_origins_len: usize, external_urls: [*]const u8, external_urls_len: usize, external_action: c_int) void;
|
|
129
129
|
extern fn native_sdk_gtk_set_menus(host: *GtkHost, menu_titles: [*]const [*]const u8, menu_title_lens: [*]const usize, menu_count: usize, item_menu_indices: [*]const u32, item_labels: [*]const [*]const u8, item_label_lens: [*]const usize, item_commands: [*]const [*]const u8, item_command_lens: [*]const usize, item_keys: [*]const [*]const u8, item_key_lens: [*]const usize, item_modifiers: [*]const u32, item_separators: [*]const c_int, item_enabled: [*]const c_int, item_checked: [*]const c_int, item_count: usize) void;
|
|
130
130
|
extern fn native_sdk_gtk_set_shortcuts(host: *GtkHost, ids: [*]const [*]const u8, id_lens: [*]const usize, keys: [*]const [*]const u8, key_lens: [*]const usize, modifiers: [*]const u32, count: usize) void;
|
|
131
|
-
extern fn native_sdk_gtk_create_window(host: *GtkHost, window_id: u64, window_title: [*]const u8, window_title_len: usize, window_label: [*]const u8, window_label_len: usize, x: f64, y: f64, width: f64, height: f64, restore_frame: c_int, resizable: c_int, titlebar_style: c_int, min_width: f64, min_height: f64) c_int;
|
|
131
|
+
extern fn native_sdk_gtk_create_window(host: *GtkHost, window_id: u64, window_title: [*]const u8, window_title_len: usize, window_label: [*]const u8, window_label_len: usize, x: f64, y: f64, width: f64, height: f64, restore_frame: c_int, resizable: c_int, titlebar_style: c_int, min_width: f64, min_height: f64, show_policy: c_int, window_flags: u32) c_int;
|
|
132
132
|
extern fn native_sdk_gtk_start_window_drag(host: *GtkHost, window_id: u64) c_int;
|
|
133
133
|
extern fn native_sdk_gtk_set_window_drag_regions(host: *GtkHost, window_id: u64, label: [*]const u8, label_len: usize, rects: [*]const f64, exclusions: [*]const c_int, count: usize) c_int;
|
|
134
134
|
extern fn native_sdk_gtk_window_chrome(host: *GtkHost, window_id: u64, top: *f64, left: *f64, bottom: *f64, right: *f64, buttons_x: *f64, buttons_y: *f64, buttons_width: *f64, buttons_height: *f64) c_int;
|
|
135
135
|
extern fn native_sdk_gtk_start_timer(host: *GtkHost, timer_id: u64, interval_ns: u64, repeats: c_int) void;
|
|
136
136
|
extern fn native_sdk_gtk_cancel_timer(host: *GtkHost, timer_id: u64) void;
|
|
137
137
|
extern fn native_sdk_gtk_focus_window(host: *GtkHost, window_id: u64) c_int;
|
|
138
|
+
extern fn native_sdk_gtk_show_window(host: *GtkHost, window_id: u64) c_int;
|
|
138
139
|
extern fn native_sdk_gtk_close_window(host: *GtkHost, window_id: u64) c_int;
|
|
139
140
|
extern fn native_sdk_gtk_minimize_window(host: *GtkHost, window_id: u64) c_int;
|
|
140
141
|
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;
|
|
@@ -286,7 +287,7 @@ pub const LinuxPlatform = struct {
|
|
|
286
287
|
try refuseUnsupportedMainWindowClosePolicy(window_options);
|
|
287
288
|
const window_title = window_options.resolvedTitle(app_info.app_name);
|
|
288
289
|
const frame = window_options.default_frame;
|
|
289
|
-
const host = native_sdk_gtk_create(app_info.app_name.ptr, app_info.app_name.len, window_title.ptr, window_title.len, app_info.bundle_id.ptr, app_info.bundle_id.len, app_info.icon_path.ptr, app_info.icon_path.len, window_options.label.ptr, window_options.label.len, frame.x, frame.y, frame.width, frame.height, if (window_options.restore_state) 1 else 0, if (window_options.resizable) 1 else 0, titlebarStyleInt(window_options.titlebar), minSizeFloor(window_options.min_width), minSizeFloor(window_options.min_height)) orelse return error.CreateFailed;
|
|
290
|
+
const host = native_sdk_gtk_create(app_info.app_name.ptr, app_info.app_name.len, window_title.ptr, window_title.len, app_info.bundle_id.ptr, app_info.bundle_id.len, app_info.icon_path.ptr, app_info.icon_path.len, window_options.label.ptr, window_options.label.len, frame.x, frame.y, frame.width, frame.height, if (window_options.restore_state) 1 else 0, if (window_options.resizable) 1 else 0, titlebarStyleInt(window_options.titlebar), minSizeFloor(window_options.min_width), minSizeFloor(window_options.min_height), showModeInt(window_options.show), windowFlags(window_options)) orelse return error.CreateFailed;
|
|
290
291
|
return .{
|
|
291
292
|
.host = host,
|
|
292
293
|
.web_engine = web_engine,
|
|
@@ -848,6 +849,22 @@ fn titlebarStyleInt(style: platform_mod.WindowTitlebarStyle) c_int {
|
|
|
848
849
|
};
|
|
849
850
|
}
|
|
850
851
|
|
|
852
|
+
fn showModeInt(mode: platform_mod.WindowShowMode) c_int {
|
|
853
|
+
return switch (mode) {
|
|
854
|
+
.immediate => 0,
|
|
855
|
+
.on_first_present => 1,
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
fn windowFlags(options: platform_mod.WindowOptions) u32 {
|
|
860
|
+
var flags: u32 = 0;
|
|
861
|
+
if (options.transparent) flags |= 1 << 0;
|
|
862
|
+
if (options.always_on_top) flags |= 1 << 1;
|
|
863
|
+
if (options.click_through) flags |= 1 << 2;
|
|
864
|
+
if (!options.activate_on_show) flags |= 1 << 3;
|
|
865
|
+
return flags;
|
|
866
|
+
}
|
|
867
|
+
|
|
851
868
|
/// Zero/negative/non-finite floors are the "no floor" sentinel (the
|
|
852
869
|
/// host leaves that axis at its natural minimum).
|
|
853
870
|
fn minSizeFloor(value: f32) f64 {
|
|
@@ -858,7 +875,7 @@ fn createWindow(context: ?*anyopaque, options: platform_mod.WindowOptions) anyer
|
|
|
858
875
|
const self: *LinuxPlatform = @ptrCast(@alignCast(context.?));
|
|
859
876
|
const title = options.resolvedTitle(self.app_info.app_name);
|
|
860
877
|
const frame = options.default_frame;
|
|
861
|
-
if (native_sdk_gtk_create_window(self.host, options.id, title.ptr, title.len, options.label.ptr, options.label.len, frame.x, frame.y, frame.width, frame.height, if (options.restore_state) 1 else 0, if (options.resizable) 1 else 0, titlebarStyleInt(options.titlebar), minSizeFloor(options.min_width), minSizeFloor(options.min_height)) == 0) return error.CreateFailed;
|
|
878
|
+
if (native_sdk_gtk_create_window(self.host, options.id, title.ptr, title.len, options.label.ptr, options.label.len, frame.x, frame.y, frame.width, frame.height, if (options.restore_state) 1 else 0, if (options.resizable) 1 else 0, titlebarStyleInt(options.titlebar), minSizeFloor(options.min_width), minSizeFloor(options.min_height), showModeInt(options.show), windowFlags(options)) == 0) return error.CreateFailed;
|
|
862
879
|
return .{
|
|
863
880
|
.id = options.id,
|
|
864
881
|
.label = options.label,
|
|
@@ -866,7 +883,7 @@ fn createWindow(context: ?*anyopaque, options: platform_mod.WindowOptions) anyer
|
|
|
866
883
|
.frame = frame,
|
|
867
884
|
.scale_factor = 1,
|
|
868
885
|
.open = true,
|
|
869
|
-
.focused =
|
|
886
|
+
.focused = options.activate_on_show and options.show == .immediate,
|
|
870
887
|
};
|
|
871
888
|
}
|
|
872
889
|
|
|
@@ -885,12 +902,11 @@ fn minimizeWindow(context: ?*anyopaque, window_id: platform_mod.WindowId) anyerr
|
|
|
885
902
|
if (native_sdk_gtk_minimize_window(self.host, window_id) == 0) return error.WindowNotFound;
|
|
886
903
|
}
|
|
887
904
|
|
|
888
|
-
/// GTK has no hide-on-close
|
|
889
|
-
///
|
|
890
|
-
/// it focus — the same call the focus service makes.
|
|
905
|
+
/// GTK has no hide-on-close, but show is still distinct from explicit
|
|
906
|
+
/// focus for passive overlay windows.
|
|
891
907
|
fn showWindow(context: ?*anyopaque, window_id: platform_mod.WindowId) anyerror!void {
|
|
892
908
|
const self: *LinuxPlatform = @ptrCast(@alignCast(context.?));
|
|
893
|
-
if (
|
|
909
|
+
if (native_sdk_gtk_show_window(self.host, window_id) == 0) return error.WindowNotFound;
|
|
894
910
|
}
|
|
895
911
|
|
|
896
912
|
/// The graceful quit: the same emitShutdown + g_application_quit the
|
|
@@ -1839,6 +1855,137 @@ test "linux platform module exports type" {
|
|
|
1839
1855
|
_ = LinuxPlatform;
|
|
1840
1856
|
}
|
|
1841
1857
|
|
|
1858
|
+
test "linux transparent windows clear the main webview background" {
|
|
1859
|
+
const host_source = @embedFile("gtk_host.c");
|
|
1860
|
+
const ensure_at = std.mem.indexOf(
|
|
1861
|
+
u8,
|
|
1862
|
+
host_source,
|
|
1863
|
+
"static WebKitWebView *native_sdk_ensure_main_webview",
|
|
1864
|
+
) orelse return error.TestExpectedEqual;
|
|
1865
|
+
const create_at = std.mem.indexOfPos(
|
|
1866
|
+
u8,
|
|
1867
|
+
host_source,
|
|
1868
|
+
ensure_at,
|
|
1869
|
+
"WebKitWebView *wv = WEBKIT_WEB_VIEW(",
|
|
1870
|
+
) orelse return error.TestExpectedEqual;
|
|
1871
|
+
const assign_at = std.mem.indexOfPos(
|
|
1872
|
+
u8,
|
|
1873
|
+
host_source,
|
|
1874
|
+
create_at,
|
|
1875
|
+
"win->web_view = wv;",
|
|
1876
|
+
) orelse return error.TestExpectedEqual;
|
|
1877
|
+
const create_slice = host_source[create_at..assign_at];
|
|
1878
|
+
try std.testing.expect(std.mem.indexOf(
|
|
1879
|
+
u8,
|
|
1880
|
+
create_slice,
|
|
1881
|
+
"if (win->transparent)",
|
|
1882
|
+
) != null);
|
|
1883
|
+
try std.testing.expect(std.mem.indexOf(
|
|
1884
|
+
u8,
|
|
1885
|
+
create_slice,
|
|
1886
|
+
"webkit_web_view_set_background_color(wv, &transparent_color);",
|
|
1887
|
+
) != null);
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
test "linux transparent window stylesheet is host-owned and removed" {
|
|
1891
|
+
const host_source = @embedFile("gtk_host.c");
|
|
1892
|
+
try std.testing.expectEqual(
|
|
1893
|
+
@as(usize, 1),
|
|
1894
|
+
std.mem.count(u8, host_source, "gtk_style_context_add_provider_for_display("),
|
|
1895
|
+
);
|
|
1896
|
+
try std.testing.expectEqual(
|
|
1897
|
+
@as(usize, 1),
|
|
1898
|
+
std.mem.count(u8, host_source, "gtk_style_context_remove_provider_for_display("),
|
|
1899
|
+
);
|
|
1900
|
+
|
|
1901
|
+
const ensure_at = std.mem.indexOf(
|
|
1902
|
+
u8,
|
|
1903
|
+
host_source,
|
|
1904
|
+
"static void native_sdk_ensure_transparent_css",
|
|
1905
|
+
) orelse return error.TestExpectedEqual;
|
|
1906
|
+
const create_at = std.mem.indexOfPos(
|
|
1907
|
+
u8,
|
|
1908
|
+
host_source,
|
|
1909
|
+
ensure_at,
|
|
1910
|
+
"static native_sdk_gtk_window_t *native_sdk_create_window_internal",
|
|
1911
|
+
) orelse return error.TestExpectedEqual;
|
|
1912
|
+
const ensure = host_source[ensure_at..create_at];
|
|
1913
|
+
try std.testing.expect(std.mem.indexOf(
|
|
1914
|
+
u8,
|
|
1915
|
+
ensure,
|
|
1916
|
+
"if (!host || host->transparent_css_provider) return;",
|
|
1917
|
+
) != null);
|
|
1918
|
+
const create_end = std.mem.indexOfPos(
|
|
1919
|
+
u8,
|
|
1920
|
+
host_source,
|
|
1921
|
+
create_at,
|
|
1922
|
+
"static void on_activate",
|
|
1923
|
+
) orelse return error.TestExpectedEqual;
|
|
1924
|
+
const create = host_source[create_at..create_end];
|
|
1925
|
+
try std.testing.expect(std.mem.indexOf(
|
|
1926
|
+
u8,
|
|
1927
|
+
create,
|
|
1928
|
+
"native_sdk_ensure_transparent_css(host);",
|
|
1929
|
+
) != null);
|
|
1930
|
+
|
|
1931
|
+
const destroy_at = std.mem.indexOf(
|
|
1932
|
+
u8,
|
|
1933
|
+
host_source,
|
|
1934
|
+
"void native_sdk_gtk_destroy",
|
|
1935
|
+
) orelse return error.TestExpectedEqual;
|
|
1936
|
+
const destroy = host_source[destroy_at..];
|
|
1937
|
+
const remove_at = std.mem.indexOf(
|
|
1938
|
+
u8,
|
|
1939
|
+
destroy,
|
|
1940
|
+
"gtk_style_context_remove_provider_for_display(",
|
|
1941
|
+
) orelse return error.TestExpectedEqual;
|
|
1942
|
+
const provider_unref_at = std.mem.indexOf(
|
|
1943
|
+
u8,
|
|
1944
|
+
destroy,
|
|
1945
|
+
"g_object_unref(host->transparent_css_provider);",
|
|
1946
|
+
) orelse return error.TestExpectedEqual;
|
|
1947
|
+
const display_unref_at = std.mem.indexOf(
|
|
1948
|
+
u8,
|
|
1949
|
+
destroy,
|
|
1950
|
+
"g_object_unref(host->transparent_css_display);",
|
|
1951
|
+
) orelse return error.TestExpectedEqual;
|
|
1952
|
+
const app_unref_at = std.mem.indexOf(
|
|
1953
|
+
u8,
|
|
1954
|
+
destroy,
|
|
1955
|
+
"g_object_unref(host->app);",
|
|
1956
|
+
) orelse return error.TestExpectedEqual;
|
|
1957
|
+
try std.testing.expect(remove_at < provider_unref_at);
|
|
1958
|
+
try std.testing.expect(remove_at < display_unref_at);
|
|
1959
|
+
try std.testing.expect(remove_at < app_unref_at);
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
test "linux passive show restores minimized windows without presenting them" {
|
|
1963
|
+
const host_source = @embedFile("gtk_host.c");
|
|
1964
|
+
const show_at = std.mem.indexOf(
|
|
1965
|
+
u8,
|
|
1966
|
+
host_source,
|
|
1967
|
+
"int native_sdk_gtk_show_window",
|
|
1968
|
+
) orelse return error.TestExpectedEqual;
|
|
1969
|
+
const show_end = std.mem.indexOfPos(
|
|
1970
|
+
u8,
|
|
1971
|
+
host_source,
|
|
1972
|
+
show_at,
|
|
1973
|
+
"int native_sdk_gtk_minimize_window",
|
|
1974
|
+
) orelse return error.TestExpectedEqual;
|
|
1975
|
+
const show = host_source[show_at..show_end];
|
|
1976
|
+
const unminimize_at = std.mem.indexOf(
|
|
1977
|
+
u8,
|
|
1978
|
+
show,
|
|
1979
|
+
"if (!win->activate_on_show) gtk_window_unminimize(win->gtk_window);",
|
|
1980
|
+
) orelse return error.TestExpectedEqual;
|
|
1981
|
+
const present_at = std.mem.indexOf(
|
|
1982
|
+
u8,
|
|
1983
|
+
show,
|
|
1984
|
+
"native_sdk_show_window_implicit(win);",
|
|
1985
|
+
) orelse return error.TestExpectedEqual;
|
|
1986
|
+
try std.testing.expect(unminimize_at < present_at);
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1842
1989
|
test "linux webview presses report the focused child label" {
|
|
1843
1990
|
// The capture-phase observer watches without claiming WebKit's
|
|
1844
1991
|
// gesture; it exists solely to mirror the focus edge into runtime
|
|
@@ -1849,6 +1996,48 @@ test "linux webview presses report the focused child label" {
|
|
|
1849
1996
|
try std.testing.expect(std.mem.indexOf(u8, host_source, "native_sdk_watch_webview_pointer_focus(win, web_view);") != null);
|
|
1850
1997
|
}
|
|
1851
1998
|
|
|
1999
|
+
test "linux first-present windows stay unmapped until present with a cancellable fallback" {
|
|
2000
|
+
const host_source = @embedFile("gtk_host.c");
|
|
2001
|
+
try std.testing.expect(std.mem.indexOf(
|
|
2002
|
+
u8,
|
|
2003
|
+
host_source,
|
|
2004
|
+
"g_timeout_add(1000, native_sdk_deferred_show_timeout, win)",
|
|
2005
|
+
) != null);
|
|
2006
|
+
try std.testing.expect(std.mem.indexOf(
|
|
2007
|
+
u8,
|
|
2008
|
+
host_source,
|
|
2009
|
+
"native_sdk_cancel_deferred_show(win);",
|
|
2010
|
+
) != null);
|
|
2011
|
+
try std.testing.expect(std.mem.indexOf(
|
|
2012
|
+
u8,
|
|
2013
|
+
host_source,
|
|
2014
|
+
"gtk_widget_set_opacity(GTK_WIDGET(win->gtk_window), 0)",
|
|
2015
|
+
) == null);
|
|
2016
|
+
const first_present_at = std.mem.indexOf(
|
|
2017
|
+
u8,
|
|
2018
|
+
host_source,
|
|
2019
|
+
"if (first_present && win && !win->shown)",
|
|
2020
|
+
) orelse return error.TestExpectedEqual;
|
|
2021
|
+
const first_present_tail = host_source[first_present_at..];
|
|
2022
|
+
const cancel_at = std.mem.indexOf(
|
|
2023
|
+
u8,
|
|
2024
|
+
first_present_tail,
|
|
2025
|
+
"native_sdk_cancel_deferred_show(win);",
|
|
2026
|
+
) orelse return error.TestExpectedEqual;
|
|
2027
|
+
const show_at = std.mem.indexOf(
|
|
2028
|
+
u8,
|
|
2029
|
+
first_present_tail,
|
|
2030
|
+
"native_sdk_show_window_implicit(win);",
|
|
2031
|
+
) orelse return error.TestExpectedEqual;
|
|
2032
|
+
const queue_draw_at = std.mem.indexOf(
|
|
2033
|
+
u8,
|
|
2034
|
+
first_present_tail,
|
|
2035
|
+
"gtk_widget_queue_draw(view->widget);",
|
|
2036
|
+
) orelse return error.TestExpectedEqual;
|
|
2037
|
+
try std.testing.expect(cancel_at < show_at);
|
|
2038
|
+
try std.testing.expect(show_at < queue_draw_at);
|
|
2039
|
+
}
|
|
2040
|
+
|
|
1852
2041
|
test "linux refuses a .hide main window at platform init instead of a silent quit-on-close" {
|
|
1853
2042
|
// The pre-created MAIN window never passes through the runtime's
|
|
1854
2043
|
// create gate, so the platform's init gate must hold the same
|
|
@@ -372,7 +372,7 @@ typedef void (*native_sdk_appkit_bridge_callback_t)(void *context, uint64_t wind
|
|
|
372
372
|
// non-empty. has_web_content declares whether the app hosts a webview;
|
|
373
373
|
// web-only default menu items (Reload, Toggle Web Inspector, Undo/Redo)
|
|
374
374
|
// exist only when it is set.
|
|
375
|
-
native_sdk_appkit_host_t *native_sdk_appkit_create(const char *app_name, size_t app_name_len, const char *display_name, size_t display_name_len, const char *version, size_t version_len, const char *about_description, size_t about_description_len, int has_web_content, 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, int show_policy);
|
|
375
|
+
native_sdk_appkit_host_t *native_sdk_appkit_create(const char *app_name, size_t app_name_len, const char *display_name, size_t display_name_len, const char *version, size_t version_len, const char *about_description, size_t about_description_len, int has_web_content, 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, int show_policy, uint32_t window_flags);
|
|
376
376
|
void native_sdk_appkit_destroy(native_sdk_appkit_host_t *host);
|
|
377
377
|
// Adopt pre-rendered straight-alpha RGBA8 pixels as the Dock icon (and
|
|
378
378
|
// the About panel copy). The pixels are copied before return, so the
|
|
@@ -411,7 +411,7 @@ void native_sdk_appkit_emit_window_event(native_sdk_appkit_host_t *host, uint64_
|
|
|
411
411
|
void native_sdk_appkit_set_security_policy(native_sdk_appkit_host_t *host, const char *allowed_origins, size_t allowed_origins_len, const char *external_urls, size_t external_urls_len, int external_action);
|
|
412
412
|
void native_sdk_appkit_set_menus(native_sdk_appkit_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);
|
|
413
413
|
void native_sdk_appkit_set_shortcuts(native_sdk_appkit_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);
|
|
414
|
-
int native_sdk_appkit_create_window(native_sdk_appkit_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, int show_policy);
|
|
414
|
+
int native_sdk_appkit_create_window(native_sdk_appkit_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, int show_policy, uint32_t window_flags);
|
|
415
415
|
// Content min-size floor for a created window (NSWindow contentMinSize):
|
|
416
416
|
// the user's resize stops at the floor. Values <= 0 leave that axis at
|
|
417
417
|
// AppKit's default minimum. Returns 0 when the window id is unknown.
|