gtk: move helper function around

This commit is contained in:
Thorsten Ball
2023-10-27 06:08:49 +02:00
committed by Mitchell Hashimoto
parent aaa6ff8884
commit 77b8e3c956

View File

@ -203,6 +203,18 @@ fn addChild2(self: *Paned, child: Child) void {
child.setParent(.{ .paned = .{ self, .end } }); child.setParent(.{ .paned = .{ self, .end } });
} }
fn surfaceInPosition(self: *Paned, position: Position) ?*Surface {
const child = switch (position) {
.start => self.child1,
.end => self.child2,
};
return switch (child) {
.surface => |surface| surface,
else => null,
};
}
pub fn deinit(self: *Paned, alloc: Allocator) void { pub fn deinit(self: *Paned, alloc: Allocator) void {
switch (self.child1) { switch (self.child1) {
.none, .surface => {}, .none, .surface => {},
@ -220,15 +232,3 @@ pub fn deinit(self: *Paned, alloc: Allocator) void {
}, },
} }
} }
fn surfaceInPosition(self: *Paned, position: Position) ?*Surface {
const child = switch (position) {
.start => self.child1,
.end => self.child2,
};
return switch (child) {
.surface => |surface| surface,
else => null,
};
}