From 33e4a0f9cc13651ebc37ac820993062c23ac70a8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 12 Sep 2024 21:52:55 +0530 Subject: [PATCH] Fix a regression when tinting of background images was introduced that caused window borders to have background_opacity applied to them Fixes #7850 --- docs/changelog.rst | 2 ++ kitty/border_vertex.glsl | 5 ++--- kitty/shaders.c | 7 ++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 77656b7d500..521d9f7e432 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -83,6 +83,8 @@ Detailed list of changes - macOS: Fix :opt:`macos_option_as_alt` not working when :kbd:`caps lock` is engaged (:iss:`7836`) +- Fix a regression when tinting of background images was introduced that caused window borders to have :opt:`background_opacity` applied to them (:iss:`7850`) + 0.36.2 [2024-09-06] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/border_vertex.glsl b/kitty/border_vertex.glsl index 4a74b50b2a7..c394d8b86cd 100644 --- a/kitty/border_vertex.glsl +++ b/kitty/border_vertex.glsl @@ -1,6 +1,5 @@ uniform uvec2 viewport; uniform uint colors[9]; -uniform float background_opacity; uniform float tint_opacity, tint_premult; uniform float gamma_lut[256]; in vec4 rect; // left, top, right, bottom @@ -42,7 +41,7 @@ void main() { float is_window_bg = is_integer_value(rc, 3.); float is_default_bg = is_integer_value(rc, 0.); color3 = is_window_bg * window_bg + (1. - is_window_bg) * color3; - float final_opacity = is_default_bg * tint_opacity + (1. - is_default_bg) * background_opacity; - float final_premult_opacity = is_default_bg * tint_premult + (1. - is_default_bg) * background_opacity; + float final_opacity = is_default_bg * tint_opacity + (1. - is_default_bg); + float final_premult_opacity = is_default_bg * tint_premult + (1. - is_default_bg); color = vec4(color3 * final_premult_opacity, final_opacity); } diff --git a/kitty/shaders.c b/kitty/shaders.c index 7f758577d04..a2ce99bd044 100644 --- a/kitty/shaders.c +++ b/kitty/shaders.c @@ -1082,15 +1082,13 @@ create_border_vao(void) { void draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_buf, bool rect_data_is_dirty, uint32_t viewport_width, uint32_t viewport_height, color_type active_window_bg, unsigned int num_visible_windows, bool all_windows_have_same_bg, OSWindow *w) { - float background_opacity = w->is_semi_transparent ? w->background_opacity: 1.0f; - float tint_opacity = background_opacity; - float tint_premult = background_opacity; + float tint_opacity = w->is_semi_transparent ? w->background_opacity: 1.0f; + float tint_premult = tint_opacity; if (has_bgimage(w)) { glEnable(GL_BLEND); BLEND_ONTO_OPAQUE; draw_background_image(w); BLEND_ONTO_OPAQUE; - background_opacity = 1.0f; tint_opacity = OPT(background_tint) * OPT(background_tint_gaps); tint_premult = w->is_semi_transparent ? OPT(background_tint) : 1.0f; } @@ -1111,7 +1109,6 @@ draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_bu w->tab_bar_edge_color.left, w->tab_bar_edge_color.right }; glUniform1uiv(border_program_layout.uniforms.colors, arraysz(colors), colors); - glUniform1f(border_program_layout.uniforms.background_opacity, background_opacity); glUniform1f(border_program_layout.uniforms.tint_opacity, tint_opacity); glUniform1f(border_program_layout.uniforms.tint_premult, tint_premult); glUniform2ui(border_program_layout.uniforms.viewport, viewport_width, viewport_height);