Skip to content

Commit

Permalink
Fix a regression when tinting of background images was introduced tha…
Browse files Browse the repository at this point in the history
…t caused window borders to have background_opacity applied to them

Fixes #7850
  • Loading branch information
kovidgoyal committed Sep 12, 2024
1 parent 41308a0 commit 33e4a0f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
5 changes: 2 additions & 3 deletions kitty/border_vertex.glsl
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
}
7 changes: 2 additions & 5 deletions kitty/shaders.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
Expand Down

0 comments on commit 33e4a0f

Please sign in to comment.