From 77b8e3c95672bb68ac9035399d0ed12cd16c0c33 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Fri, 27 Oct 2023 06:08:49 +0200 Subject: [PATCH] gtk: move helper function around --- src/apprt/gtk/Paned.zig | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/apprt/gtk/Paned.zig b/src/apprt/gtk/Paned.zig index 5e8ccec39..731513e0d 100644 --- a/src/apprt/gtk/Paned.zig +++ b/src/apprt/gtk/Paned.zig @@ -203,6 +203,18 @@ fn addChild2(self: *Paned, child: Child) void { 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 { switch (self.child1) { .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, - }; -}