apprt/gtk: remove tab option from surface

This commit is contained in:
Mitchell Hashimoto
2023-11-01 22:17:26 -07:00
parent 14570b8a6c
commit 97b9708dd1
2 changed files with 10 additions and 5 deletions

View File

@ -28,9 +28,6 @@ const log = std.log.scoped(.gtk_surface);
pub const opengl_single_threaded_draw = true; pub const opengl_single_threaded_draw = true;
pub const Options = struct { pub const Options = struct {
/// The tab that this surface is attached to.
tab: *Tab,
/// The parent this surface is created under. /// The parent this surface is created under.
parent: Parent, parent: Parent,
@ -190,7 +187,7 @@ pub fn init(self: *Surface, app: *App, opts: Options) !void {
// Build our result // Build our result
self.* = .{ self.* = .{
.app = app, .app = app,
.container = .{ .tab_ = opts.tab }, .container = .{ .none = {} },
.parent = opts.parent, .parent = opts.parent,
.gl_area = opts.gl_area, .gl_area = opts.gl_area,
.title_text_buf = undefined, .title_text_buf = undefined,
@ -290,6 +287,14 @@ pub fn deinit(self: *Surface) void {
if (self.cursor) |cursor| c.g_object_unref(cursor); 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 { fn render(self: *Surface) !void {
try self.core_surface.renderer.drawFrame(self); try self.core_surface.renderer.drawFrame(self);
} }

View File

@ -168,7 +168,6 @@ pub fn newSurface(self: *Tab, parent_: ?*CoreSurface) !*Surface {
c.gtk_widget_set_vexpand(gl_area, 1); c.gtk_widget_set_vexpand(gl_area, 1);
try surface.init(self.window.app, .{ try surface.init(self.window.app, .{
.tab = self,
.parent = .{ .parent = .{
.tab = self, .tab = self,
}, },
@ -176,6 +175,7 @@ pub fn newSurface(self: *Tab, parent_: ?*CoreSurface) !*Surface {
.gl_area = @ptrCast(gl_area), .gl_area = @ptrCast(gl_area),
.font_size = font_size, .font_size = font_size,
}); });
surface.setContainer(.{ .tab_ = self });
return surface; return surface;
} }