Skip to content

Commit

Permalink
gtk: don't use gtk_window_set_titlebar if adwaita is enabled but it's…
Browse files Browse the repository at this point in the history
… older than 1.4.0
  • Loading branch information
jcollie committed Dec 30, 2024
1 parent 2f6860f commit 298ed83
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/apprt/gtk/Window.zig
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,14 @@ pub fn init(self: *Window, app: *App) !void {
}
}

// If Adwaita is older than 1.4.0 we don't have the tab overview and so we
// need to stick the headerbar into the content box.
if (comptime !adwaita.versionAtLeast(1, 4, 0)) {
if (self.header) |h| {
c.gtk_box_append(@ptrCast(box), h.asWidget());
}
}

// In debug we show a warning and apply the 'devel' class to the window.
// This is a really common issue where people build from source in debug and performance is really bad.
if (comptime std.debug.runtime_safety) {
Expand Down Expand Up @@ -364,7 +372,12 @@ pub fn init(self: *Window, app: *App) !void {

// The box is our main child
c.gtk_window_set_child(gtk_window, box);
if (self.header) |h| c.gtk_window_set_titlebar(gtk_window, h.asWidget());
if (self.header) |h| {
switch (h) {
.adw => {},
.gtk => c.gtk_window_set_titlebar(gtk_window, h.asWidget()),
}
}
}

// Show the window
Expand Down

0 comments on commit 298ed83

Please sign in to comment.