gtk-ng: fix toggle_window_decoration
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 #8274pull/8286/head
parent
0930b2daff
commit
f3d8aac1e9
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -780,9 +780,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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue