apprt/gtk: we should only show the headerbar again if csd

This commit is contained in:
Mitchell Hashimoto
2025-01-23 15:04:39 -08:00
parent 1be89cb146
commit 078ee42be3

View File

@ -639,16 +639,20 @@ fn gtkWindowNotifyMaximized(
ud: ?*anyopaque, ud: ?*anyopaque,
) callconv(.C) void { ) callconv(.C) void {
const self = userdataSelf(ud orelse return); const self = userdataSelf(ud orelse return);
const maximized = c.gtk_window_is_maximized(self.window) != 0;
// Only toggle visibility of the header bar when we're using CSDs, // Only toggle visibility of the header bar when we're using CSDs,
// and actually intend on displaying the header bar // and actually intend on displaying the header bar
if (!self.winproto.clientSideDecorationEnabled()) return; if (!self.winproto.clientSideDecorationEnabled()) return;
// If we aren't maximized, we should show the headerbar again
// if it was originally visible.
const maximized = c.gtk_window_is_maximized(self.window) != 0;
if (!maximized) { if (!maximized) {
self.headerbar.setVisible(self.app.config.@"gtk-titlebar"); self.headerbar.setVisible(self.app.config.@"gtk-titlebar");
return; return;
} }
// If we are maximized, we should hide the headerbar if requested.
if (self.app.config.@"gtk-titlebar-hide-when-maximized") { if (self.app.config.@"gtk-titlebar-hide-when-maximized") {
self.headerbar.setVisible(false); self.headerbar.setVisible(false);
} }
@ -677,7 +681,8 @@ fn gtkWindowNotifyFullscreened(
const self = userdataSelf(ud orelse return); const self = userdataSelf(ud orelse return);
const fullscreened = c.gtk_window_is_fullscreen(@ptrCast(object)) != 0; const fullscreened = c.gtk_window_is_fullscreen(@ptrCast(object)) != 0;
if (!fullscreened) { if (!fullscreened) {
self.headerbar.setVisible(self.app.config.@"gtk-titlebar"); const csd_enabled = self.winproto.clientSideDecorationEnabled();
self.headerbar.setVisible(self.app.config.@"gtk-titlebar" and csd_enabled);
return; return;
} }