diff --git a/src/apprt/gtk/Surface.zig b/src/apprt/gtk/Surface.zig index 36daae687..ed485d06b 100644 --- a/src/apprt/gtk/Surface.zig +++ b/src/apprt/gtk/Surface.zig @@ -28,9 +28,6 @@ const log = std.log.scoped(.gtk_surface); pub const opengl_single_threaded_draw = true; pub const Options = struct { - /// The tab that this surface is attached to. - tab: *Tab, - /// The parent this surface is created under. parent: Parent, @@ -190,7 +187,7 @@ pub fn init(self: *Surface, app: *App, opts: Options) !void { // Build our result self.* = .{ .app = app, - .container = .{ .tab_ = opts.tab }, + .container = .{ .none = {} }, .parent = opts.parent, .gl_area = opts.gl_area, .title_text_buf = undefined, @@ -290,6 +287,14 @@ pub fn deinit(self: *Surface) void { if (self.cursor) |cursor| c.g_object_unref(cursor); } +// TODO: move this +/// Change the container for the surface to `container`. +pub fn setContainer(self: *Surface, container: Container) void { + self.container = container; + + // TODO: do we need to ever update our title or anything here? +} + fn render(self: *Surface) !void { try self.core_surface.renderer.drawFrame(self); } diff --git a/src/apprt/gtk/Tab.zig b/src/apprt/gtk/Tab.zig index 495ec8991..a16f9f061 100644 --- a/src/apprt/gtk/Tab.zig +++ b/src/apprt/gtk/Tab.zig @@ -168,7 +168,6 @@ pub fn newSurface(self: *Tab, parent_: ?*CoreSurface) !*Surface { c.gtk_widget_set_vexpand(gl_area, 1); try surface.init(self.window.app, .{ - .tab = self, .parent = .{ .tab = self, }, @@ -176,6 +175,7 @@ pub fn newSurface(self: *Tab, parent_: ?*CoreSurface) !*Surface { .gl_area = @ptrCast(gl_area), .font_size = font_size, }); + surface.setContainer(.{ .tab_ = self }); return surface; }