diff --git a/src/apprt/gtk/Window.zig b/src/apprt/gtk/Window.zig index 16fcb70e7..6af20118b 100644 --- a/src/apprt/gtk/Window.zig +++ b/src/apprt/gtk/Window.zig @@ -661,16 +661,6 @@ pub fn toggleWindowDecorations(self: *Window) void { }; } -/// Toggle the background opacity for this window. -pub fn toggleBackgroundOpacity(self: *Window) !f64 { - if (self.app.config.@"background-opacity" >= 1) return self.app.config.@"background-opacity"; - - self.config.background_opacity = if (self.config.background_opacity == 1.0) self.app.config.@"background-opacity" else 1.0; - try self.syncAppearance(); - - return self.config.background_opacity; -} - /// Grabs focus on the currently selected tab. pub fn focusCurrentTab(self: *Window) void { const tab = self.notebook.currentTab() orelse return; diff --git a/src/renderer/OpenGL.zig b/src/renderer/OpenGL.zig index 30e5a2efe..63103d6d4 100644 --- a/src/renderer/OpenGL.zig +++ b/src/renderer/OpenGL.zig @@ -661,7 +661,7 @@ pub fn setBackgroundOpacity(self: *OpenGL, opacity: f64) void { defer if (single_threaded_draw) self.draw_mutex.unlock(); // We don't want to go below 0 or above 1 - self.config.background_opacity = @max(0, @min(1, opacity)); + self.config.background_opacity = std.math.clamp(opacity, 0, 1); } /// Set the new font grid.