mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 08:16:13 +03:00
gtk: get closing of tabs working again (closing windows still broken)
This commit is contained in:

committed by
Mitchell Hashimoto

parent
8cf9d97ac3
commit
0065bae0d4
@ -90,6 +90,18 @@ pub fn init(
|
||||
surface.grabFocus();
|
||||
}
|
||||
|
||||
pub fn destroy(self: *Split) void {
|
||||
const window = self.container.window() orelse return;
|
||||
|
||||
self.top_left.destroy();
|
||||
self.bottom_right.destroy();
|
||||
|
||||
self.removeChildren();
|
||||
|
||||
// TODO: this is the same as in removeChild?
|
||||
window.app.core_app.alloc.destroy(self);
|
||||
}
|
||||
|
||||
/// Remove the top left child.
|
||||
pub fn removeTopLeft(self: *Split) void {
|
||||
self.removeChild(self.top_left, self.bottom_right);
|
||||
@ -120,7 +132,7 @@ inline fn removeChild(self: *Split, remove: Surface.Container.Elem, keep: Surfac
|
||||
self.container.replace(keep);
|
||||
|
||||
// TODO: is this correct?
|
||||
remove.shutdown();
|
||||
remove.destroy();
|
||||
window.app.core_app.alloc.destroy(self);
|
||||
}
|
||||
|
||||
|
@ -79,12 +79,10 @@ pub const Container = union(enum) {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn shutdown(self: Elem) void {
|
||||
pub fn destroy(self: Elem) void {
|
||||
switch (self) {
|
||||
.surface => |s| s.shutdown(),
|
||||
.split => {
|
||||
@panic("TODO: shutdownsplit");
|
||||
},
|
||||
.surface => |s| s.unref(),
|
||||
.split => |s| s.destroy(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -416,9 +414,9 @@ pub fn deinit(self: *Surface) void {
|
||||
if (self.cursor) |cursor| c.g_object_unref(cursor);
|
||||
}
|
||||
|
||||
// shutdown removes the long-held reference to the gl_area and kicks off the
|
||||
// unref removes the long-held reference to the gl_area and kicks off the
|
||||
// deinit/destroy process for this surface.
|
||||
pub fn shutdown(self: *Surface) void {
|
||||
pub fn unref(self: *Surface) void {
|
||||
c.g_object_unref(self.gl_area);
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ pub fn init(self: *Tab, window: *Window, parent_: ?*CoreSurface) !void {
|
||||
|
||||
/// Deinits tab by deiniting child elem.
|
||||
pub fn deinit(self: *Tab) void {
|
||||
self.elem.shutdown();
|
||||
self.elem.destroy();
|
||||
}
|
||||
|
||||
// TODO: move this
|
||||
|
Reference in New Issue
Block a user