mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
gtk: remove fields on Paned we don't need
This commit is contained in:

committed by
Mitchell Hashimoto

parent
09bbaa82b4
commit
ba2992d4d0
@ -17,13 +17,6 @@ const c = @import("c.zig");
|
||||
|
||||
const log = std.log.scoped(.gtk);
|
||||
|
||||
/// We'll need to keep a reference to the Window this belongs to for various reasons
|
||||
window: *Window,
|
||||
|
||||
// We keep track of the tab label's text so that if a child widget of this pane
|
||||
// gets focus (and is a Surface) we can reset the tab label appropriately
|
||||
label_text: *c.GtkWidget,
|
||||
|
||||
/// Our actual GtkPaned widget
|
||||
paned: *c.GtkPaned,
|
||||
|
||||
@ -36,17 +29,15 @@ child2: Child,
|
||||
// maximize the parent pane, or close the tab.
|
||||
parent: Parent,
|
||||
|
||||
pub fn create(alloc: Allocator, window: *Window, sibling: *Surface, direction: input.SplitDirection) !*Paned {
|
||||
pub fn create(alloc: Allocator, sibling: *Surface, direction: input.SplitDirection) !*Paned {
|
||||
var paned = try alloc.create(Paned);
|
||||
errdefer alloc.destroy(paned);
|
||||
try paned.init(window, sibling, direction);
|
||||
try paned.init(sibling, direction);
|
||||
return paned;
|
||||
}
|
||||
|
||||
pub fn init(self: *Paned, window: *Window, sibling: *Surface, direction: input.SplitDirection) !void {
|
||||
pub fn init(self: *Paned, sibling: *Surface, direction: input.SplitDirection) !void {
|
||||
self.* = .{
|
||||
.window = window,
|
||||
.label_text = undefined,
|
||||
.paned = undefined,
|
||||
.child1 = .none,
|
||||
.child2 = .none,
|
||||
@ -54,11 +45,6 @@ pub fn init(self: *Paned, window: *Window, sibling: *Surface, direction: input.S
|
||||
};
|
||||
errdefer self.* = undefined;
|
||||
|
||||
self.label_text = sibling.getTitleLabel() orelse {
|
||||
log.warn("sibling surface has no title label", .{});
|
||||
return;
|
||||
};
|
||||
|
||||
const orientation: c_uint = switch (direction) {
|
||||
.right => c.GTK_ORIENTATION_HORIZONTAL,
|
||||
.down => c.GTK_ORIENTATION_VERTICAL,
|
||||
@ -113,7 +99,7 @@ pub fn splitSurfaceInPosition(self: *Paned, position: Position, direction: input
|
||||
// Create new Paned
|
||||
// NOTE: We cannot use `replaceChildInPosition` here because we need to
|
||||
// first remove the surface before we create a new pane.
|
||||
const paned = try Paned.create(self.window.app.core_app.alloc, self.window, surface, direction);
|
||||
const paned = try Paned.create(surface.window.app.core_app.alloc, surface, direction);
|
||||
switch (position) {
|
||||
.start => self.addChild1(.{ .paned = paned }),
|
||||
.end => self.addChild2(.{ .paned = paned }),
|
||||
|
@ -180,7 +180,7 @@ pub fn splitSurface(self: *Tab, direction: input.SplitDirection) !void {
|
||||
self.removeChild();
|
||||
|
||||
// Create a Paned with two Surfaces.
|
||||
const paned = try Paned.create(self.window.app.core_app.alloc, self.window, surface, direction);
|
||||
const paned = try Paned.create(self.window.app.core_app.alloc, surface, direction);
|
||||
|
||||
// Add Paned to the Tab.
|
||||
self.setChild(.{ .paned = paned });
|
||||
|
Reference in New Issue
Block a user