mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
chore: remove window level toggle and utilize std.math.clamp in opengl
This commit is contained in:
@ -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;
|
||||
|
@ -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.
|
||||
|
Reference in New Issue
Block a user