mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +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 this surface. This will trigger the runtime to start the
|
||||||
/// close process, which should ultimately deinitialize this surface.
|
/// close process, which should ultimately deinitialize this surface.
|
||||||
pub fn close(self: *Surface) void {
|
pub fn close(self: *Surface) void {
|
||||||
if (@hasDecl(apprt.Surface, "closeSurface")) {
|
if (@hasDecl(apprt.Surface, "close")) {
|
||||||
try self.rt_surface.closeSurface();
|
self.rt_surface.close();
|
||||||
} else log.warn("runtime doesn't implement closeSurface", .{});
|
} else log.warn("runtime doesn't implement close", .{});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called from the app thread to handle mailbox messages to our specific
|
/// 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);
|
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 {
|
const func = self.app.opts.close_surface orelse {
|
||||||
log.info("runtime embedder does not support closing a surface", .{});
|
log.info("runtime embedder does not support closing a surface", .{});
|
||||||
return;
|
return;
|
||||||
|
@ -378,6 +378,11 @@ pub const Surface = struct {
|
|||||||
try self.app.newTab(&self.core_surface);
|
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.
|
/// Set the size limits of the window.
|
||||||
/// Note: this interface is not good, we should redo it if we plan
|
/// 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,
|
/// 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.
|
/// Close this surface.
|
||||||
fn close(self: *Surface) void {
|
pub fn close(self: *Surface) void {
|
||||||
self.window.closeSurface(self);
|
self.window.closeSurface(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user