From 3a60fd65507dcba8a1df7a9cdfc4285aef356451 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 12 Sep 2024 15:53:29 -0700 Subject: [PATCH] apprt/gtk: use GtkWidget so there is a common ancestor --- src/apprt/gtk/Window.zig | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/apprt/gtk/Window.zig b/src/apprt/gtk/Window.zig index f1e0752e6..b4aad87fb 100644 --- a/src/apprt/gtk/Window.zig +++ b/src/apprt/gtk/Window.zig @@ -23,8 +23,6 @@ const c = @import("c.zig").c; const adwaita = @import("adwaita.zig"); const Notebook = @import("./notebook.zig").Notebook; -const HeaderBar = if (adwaita.versionAtLeast(0, 0, 0)) c.AdwHeaderBar else c.GtkHeaderBar; - const log = std.log.scoped(.gtk); app: *App, @@ -33,8 +31,9 @@ app: *App, window: *c.GtkWindow, /// The header bar for the window. This is possibly null since it can be -/// disabled using gtk-titlebar. -header: ?*HeaderBar, +/// disabled using gtk-titlebar. This is either an AdwHeaderBar or +/// GtkHeaderBar depending on if adw is enabled and linked. +header: ?*c.GtkWidget, /// The notebook (tab grouping) for this window. /// can be either c.GtkNotebook or c.AdwTabView. @@ -103,7 +102,7 @@ pub fn init(self: *Window, app: *App) !void { // are decorated or not because we can have a keybind to toggle the // decorations. if (app.config.@"gtk-titlebar") { - const header: *HeaderBar = if (self.isAdwWindow()) + const header: *c.GtkWidget = if (self.isAdwWindow()) @ptrCast(c.adw_header_bar_new()) else @ptrCast(c.gtk_header_bar_new());