mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 07:46:12 +03:00
fix: gtk titlebar being restored if it shouldn't be (#5090)
I feel like we should be respecting the value of `gtk-titlebar` in the `gtkWindowNotifyMaximized` callback as mentioned in discord (https://discord.com/channels/1005603569187160125/1005603569711452192/1328976978094723163) Would close https://github.com/ghostty-org/ghostty/issues/5262
This commit is contained in:
@ -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(true);
|
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);
|
||||||
}
|
}
|
||||||
@ -675,7 +679,14 @@ fn gtkWindowNotifyFullscreened(
|
|||||||
ud: ?*anyopaque,
|
ud: ?*anyopaque,
|
||||||
) callconv(.C) void {
|
) callconv(.C) void {
|
||||||
const self = userdataSelf(ud orelse return);
|
const self = userdataSelf(ud orelse return);
|
||||||
self.headerbar.setVisible(c.gtk_window_is_fullscreen(@ptrCast(object)) == 0);
|
const fullscreened = c.gtk_window_is_fullscreen(@ptrCast(object)) != 0;
|
||||||
|
if (!fullscreened) {
|
||||||
|
const csd_enabled = self.winproto.clientSideDecorationEnabled();
|
||||||
|
self.headerbar.setVisible(self.app.config.@"gtk-titlebar" and csd_enabled);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.headerbar.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: we MUST NOT use the GtkButton parameter because gtkActionNewTab
|
// Note: we MUST NOT use the GtkButton parameter because gtkActionNewTab
|
||||||
|
Reference in New Issue
Block a user