mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
apprt: can pass options through to Windows
This commit is contained in:
@ -31,6 +31,7 @@ typedef struct {
|
||||
// Opaque types
|
||||
typedef void *ghostty_app_t;
|
||||
typedef void *ghostty_config_t;
|
||||
typedef void *ghostty_surface_t;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Published API
|
||||
|
@ -189,7 +189,11 @@ fn drainMailbox(self: *App) !void {
|
||||
|
||||
/// Create a new window
|
||||
fn newWindow(self: *App, msg: Message.NewWindow) !*Window {
|
||||
var window = try Window.create(self.alloc, self, self.config);
|
||||
if (comptime build_config.artifact != .exe) {
|
||||
@panic("newWindow is not supported for embedded ghostty");
|
||||
}
|
||||
|
||||
var window = try Window.create(self.alloc, self, self.config, .{});
|
||||
errdefer window.destroy();
|
||||
try self.windows.append(self.alloc, window);
|
||||
errdefer _ = self.windows.pop();
|
||||
|
@ -128,12 +128,17 @@ const Mouse = struct {
|
||||
/// Create a new window. This allocates and returns a pointer because we
|
||||
/// need a stable pointer for user data callbacks. Therefore, a stack-only
|
||||
/// initialization is not currently possible.
|
||||
pub fn create(alloc: Allocator, app: *App, config: *const Config) !*Window {
|
||||
pub fn create(
|
||||
alloc: Allocator,
|
||||
app: *App,
|
||||
config: *const Config,
|
||||
rt_opts: apprt.runtime.Window.Options,
|
||||
) !*Window {
|
||||
var self = try alloc.create(Window);
|
||||
errdefer alloc.destroy(self);
|
||||
|
||||
// Create the windowing system
|
||||
var window = try apprt.runtime.Window.init(app, self);
|
||||
var window = try apprt.runtime.Window.init(app, self, rt_opts);
|
||||
errdefer window.deinit();
|
||||
|
||||
// Initialize our renderer with our initialized windowing system.
|
||||
|
@ -45,16 +45,21 @@ pub const App = struct {
|
||||
};
|
||||
|
||||
pub const Window = struct {
|
||||
pub fn deinit(self: *Window) void {
|
||||
_ = self;
|
||||
}
|
||||
pub const Options = extern struct {
|
||||
id: usize,
|
||||
};
|
||||
|
||||
pub fn init(app: *const CoreApp, core_win: *CoreWindow) !Window {
|
||||
pub fn init(app: *const CoreApp, core_win: *CoreWindow, opts: Options) !Window {
|
||||
_ = app;
|
||||
_ = core_win;
|
||||
_ = opts;
|
||||
return .{};
|
||||
}
|
||||
|
||||
pub fn deinit(self: *Window) void {
|
||||
_ = self;
|
||||
}
|
||||
|
||||
pub fn getContentScale(self: *const Window) !apprt.ContentScale {
|
||||
_ = self;
|
||||
return apprt.ContentScale{ .x = 1, .y = 1 };
|
||||
|
@ -58,7 +58,11 @@ pub const Window = struct {
|
||||
/// The glfw mouse cursor handle.
|
||||
cursor: glfw.Cursor,
|
||||
|
||||
pub fn init(app: *const CoreApp, core_win: *CoreWindow) !Window {
|
||||
pub const Options = struct {};
|
||||
|
||||
pub fn init(app: *const CoreApp, core_win: *CoreWindow, opts: Options) !Window {
|
||||
_ = opts;
|
||||
|
||||
// Create our window
|
||||
const win = glfw.Window.create(
|
||||
640,
|
||||
|
Reference in New Issue
Block a user