gtk: hide titlebar if fullscreened

Partially addresses #3381
This commit is contained in:
Jeffrey C. Ollie
2025-01-12 19:34:20 -06:00
parent a2445359c4
commit 7ac017b154

View File

@ -204,6 +204,7 @@ pub fn init(self: *Window, app: *App) !void {
}
_ = c.g_signal_connect_data(gtk_window, "notify::decorated", c.G_CALLBACK(&gtkWindowNotifyDecorated), self, null, c.G_CONNECT_DEFAULT);
_ = c.g_signal_connect_data(gtk_window, "notify::fullscreened", c.G_CALLBACK(&gtkWindowNotifyFullscreened), self, null, c.G_CONNECT_DEFAULT);
// If we are disabling decorations then disable them right away.
if (!app.config.@"window-decoration") {
@ -606,6 +607,15 @@ fn gtkWindowNotifyDecorated(
}
}
fn gtkWindowNotifyFullscreened(
object: *c.GObject,
_: *c.GParamSpec,
ud: ?*anyopaque,
) callconv(.C) void {
const self = userdataSelf(ud orelse return);
self.headerbar.setVisible(c.gtk_window_is_fullscreen(@ptrCast(object)) == 0);
}
// Note: we MUST NOT use the GtkButton parameter because gtkActionNewTab
// sends an undefined value.
fn gtkTabNewClick(_: *c.GtkButton, ud: ?*anyopaque) callconv(.C) void {