mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-09-05 19:08:17 +00:00
gtk-ng: fix toggle_window_decoration (#8286)
When window-decoration=none, setting the window decoration to null would just mean it would default to none again, creating a cycle of torment none can break out of... that sounds a bit too dramatic doesn't it Fixes #8274
This commit is contained in:
@@ -2216,7 +2216,7 @@ const Action = struct {
|
||||
Window,
|
||||
surface.as(gtk.Widget),
|
||||
) orelse {
|
||||
log.warn("surface is not in a window, ignoring new_tab", .{});
|
||||
log.warn("surface is not in a window, ignoring toggle_window_decorations", .{});
|
||||
return false;
|
||||
};
|
||||
|
||||
|
@@ -810,9 +810,18 @@ pub const Window = extern struct {
|
||||
|
||||
/// Toggle the window decorations for this window.
|
||||
pub fn toggleWindowDecorations(self: *Self) void {
|
||||
self.setWindowDecoration(switch (self.getWindowDecoration()) {
|
||||
// Null will force using the central config
|
||||
.none => null,
|
||||
const priv = self.private();
|
||||
|
||||
if (priv.window_decoration) |_| {
|
||||
// Unset any previously set window decoration settings
|
||||
self.setWindowDecoration(null);
|
||||
return;
|
||||
}
|
||||
|
||||
const config = if (priv.config) |v| v.get() else return;
|
||||
self.setWindowDecoration(switch (config.@"window-decoration") {
|
||||
// Use auto when the decoration is initially none
|
||||
.none => .auto,
|
||||
|
||||
// Anything non-none to none
|
||||
.auto, .client, .server => .none,
|
||||
|
Reference in New Issue
Block a user