apprt/gtk-ng: tab bar top/bottom

This commit is contained in:
Mitchell Hashimoto
2025-07-28 07:32:19 -07:00
parent e7cab27c38
commit d7e42e6614
3 changed files with 41 additions and 1 deletions

View File

@ -187,6 +187,8 @@ pub const Window = extern struct {
// Template bindings
surface: *Surface,
tab_bar: *adw.TabBar,
toolbar: *adw.ToolbarView,
toast_overlay: *adw.ToastOverlay,
pub var offset: c_int = 0;
@ -287,6 +289,17 @@ pub const Window = extern struct {
@field(properties, key).impl.param_spec,
);
}
// Remainder uses the config
const priv = self.private();
const config = if (priv.config) |v| v.get() else return;
// Move the tab bar to the proper location.
priv.toolbar.remove(priv.tab_bar.as(gtk.Widget));
switch (config.@"gtk-tabs-location") {
.top => priv.toolbar.addTopBar(priv.tab_bar.as(gtk.Widget)),
.bottom => priv.toolbar.addBottomBar(priv.tab_bar.as(gtk.Widget)),
}
}
fn toggleCssClass(self: *Window, class: [:0]const u8, value: bool) void {
@ -712,6 +725,8 @@ pub const Window = extern struct {
// Bindings
class.bindTemplateChildPrivate("surface", .{});
class.bindTemplateChildPrivate("tab_bar", .{});
class.bindTemplateChildPrivate("toolbar", .{});
class.bindTemplateChildPrivate("toast_overlay", .{});
// Template Callbacks

View File

@ -23,7 +23,7 @@ template $GhosttyWindow: Adw.ApplicationWindow {
enable-new-tab: true;
view: tab_view;
Adw.ToolbarView {
Adw.ToolbarView toolbar {
top-bar-style: raised;
bottom-bar-style: raised;

View File

@ -142,6 +142,31 @@
...
}
{
GDK GLArea
Memcheck:Leak
match-leak-kinds: possible
fun:malloc
fun:g_malloc
fun:gdk_memory_texture_from_texture
fun:gdk_gl_texture_release
fun:delete_one_texture
fun:g_list_foreach
fun:g_list_free_full
fun:gtk_gl_area_unrealize
...
}
{
GDK GLArea Snapshot
Memcheck:Leak
match-leak-kinds: definite
fun:*alloc
...
fun:gtk_gl_area_snapshot
...
}
{
GSK GPU Rendering
Memcheck:Leak