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
|
// Opaque types
|
||||||
typedef void *ghostty_app_t;
|
typedef void *ghostty_app_t;
|
||||||
typedef void *ghostty_config_t;
|
typedef void *ghostty_config_t;
|
||||||
|
typedef void *ghostty_surface_t;
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Published API
|
// Published API
|
||||||
|
@ -189,7 +189,11 @@ fn drainMailbox(self: *App) !void {
|
|||||||
|
|
||||||
/// Create a new window
|
/// Create a new window
|
||||||
fn newWindow(self: *App, msg: Message.NewWindow) !*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();
|
errdefer window.destroy();
|
||||||
try self.windows.append(self.alloc, window);
|
try self.windows.append(self.alloc, window);
|
||||||
errdefer _ = self.windows.pop();
|
errdefer _ = self.windows.pop();
|
||||||
|
@ -128,12 +128,17 @@ const Mouse = struct {
|
|||||||
/// Create a new window. This allocates and returns a pointer because we
|
/// Create a new window. This allocates and returns a pointer because we
|
||||||
/// need a stable pointer for user data callbacks. Therefore, a stack-only
|
/// need a stable pointer for user data callbacks. Therefore, a stack-only
|
||||||
/// initialization is not currently possible.
|
/// 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);
|
var self = try alloc.create(Window);
|
||||||
errdefer alloc.destroy(self);
|
errdefer alloc.destroy(self);
|
||||||
|
|
||||||
// Create the windowing system
|
// 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();
|
errdefer window.deinit();
|
||||||
|
|
||||||
// Initialize our renderer with our initialized windowing system.
|
// Initialize our renderer with our initialized windowing system.
|
||||||
|
@ -45,16 +45,21 @@ pub const App = struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub const Window = struct {
|
pub const Window = struct {
|
||||||
pub fn deinit(self: *Window) void {
|
pub const Options = extern struct {
|
||||||
_ = self;
|
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;
|
_ = app;
|
||||||
_ = core_win;
|
_ = core_win;
|
||||||
|
_ = opts;
|
||||||
return .{};
|
return .{};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn deinit(self: *Window) void {
|
||||||
|
_ = self;
|
||||||
|
}
|
||||||
|
|
||||||
pub fn getContentScale(self: *const Window) !apprt.ContentScale {
|
pub fn getContentScale(self: *const Window) !apprt.ContentScale {
|
||||||
_ = self;
|
_ = self;
|
||||||
return apprt.ContentScale{ .x = 1, .y = 1 };
|
return apprt.ContentScale{ .x = 1, .y = 1 };
|
||||||
|
@ -58,7 +58,11 @@ pub const Window = struct {
|
|||||||
/// The glfw mouse cursor handle.
|
/// The glfw mouse cursor handle.
|
||||||
cursor: glfw.Cursor,
|
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
|
// Create our window
|
||||||
const win = glfw.Window.create(
|
const win = glfw.Window.create(
|
||||||
640,
|
640,
|
||||||
|
Reference in New Issue
Block a user