apprt/embedded: fix initialization on macOS

This commit is contained in:
Mitchell Hashimoto
2024-01-18 08:55:03 -08:00
parent df09c21103
commit 01afa293c8
4 changed files with 27 additions and 9 deletions

View File

@@ -283,14 +283,14 @@ pub const Surface = struct {
inspector: ?*Inspector = null,
pub const Options = extern struct {
/// Userdata passed to some of the callbacks.
userdata: ?*anyopaque = null,
/// The platform that this surface is being initialized for and
/// the associated platform-specific configuration.
platform_tag: c_int = 0,
platform: Platform.C = undefined,
/// Userdata passed to some of the callbacks.
userdata: ?*anyopaque = null,
/// The scale factor of the screen.
scale_factor: f64 = 1,

View File

@@ -466,7 +466,9 @@ pub fn finalizeSurfaceInit(self: *const Metal, surface: *apprt.Surface) !void {
},
apprt.embedded => .{
.view = surface.nsview,
.view = switch (surface.platform) {
.macos => |v| v.nsview,
},
.scaleFactor = @floatCast(surface.content_scale.x),
},