mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 16:26:08 +03:00
apprt: all implement close surface
This commit is contained in:
@ -482,9 +482,9 @@ pub fn deinit(self: *Surface) void {
|
||||
/// Close this surface. This will trigger the runtime to start the
|
||||
/// close process, which should ultimately deinitialize this surface.
|
||||
pub fn close(self: *Surface) void {
|
||||
if (@hasDecl(apprt.Surface, "closeSurface")) {
|
||||
try self.rt_surface.closeSurface();
|
||||
} else log.warn("runtime doesn't implement closeSurface", .{});
|
||||
if (@hasDecl(apprt.Surface, "close")) {
|
||||
self.rt_surface.close();
|
||||
} else log.warn("runtime doesn't implement close", .{});
|
||||
}
|
||||
|
||||
/// Called from the app thread to handle mailbox messages to our specific
|
||||
|
@ -167,7 +167,7 @@ pub const Surface = struct {
|
||||
func(self.opts.userdata, direction);
|
||||
}
|
||||
|
||||
pub fn closeSurface(self: *const Surface) !void {
|
||||
pub fn close(self: *const Surface) void {
|
||||
const func = self.app.opts.close_surface orelse {
|
||||
log.info("runtime embedder does not support closing a surface", .{});
|
||||
return;
|
||||
|
@ -378,6 +378,11 @@ pub const Surface = struct {
|
||||
try self.app.newTab(&self.core_surface);
|
||||
}
|
||||
|
||||
/// Close this surface.
|
||||
pub fn close(self: *const Surface) void {
|
||||
self.window.setShouldClose(true);
|
||||
}
|
||||
|
||||
/// Set the size limits of the window.
|
||||
/// Note: this interface is not good, we should redo it if we plan
|
||||
/// to use this more. i.e. you can't set max width but no max height,
|
||||
|
@ -614,7 +614,7 @@ pub const Surface = struct {
|
||||
}
|
||||
|
||||
/// Close this surface.
|
||||
fn close(self: *Surface) void {
|
||||
pub fn close(self: *Surface) void {
|
||||
self.window.closeSurface(self);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user