chore: remove window level toggle and utilize std.math.clamp in opengl

This commit is contained in:
Adam Wolf
2025-03-12 22:11:50 -05:00
parent 7dd8cb54c8
commit 4823524477
2 changed files with 1 additions and 11 deletions

View File

@ -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;

View File

@ -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.