From c51050a9bc16b231de964156cd3ffd20ee12569e Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 25 May 2023 18:39:32 +0200 Subject: osc: update font subpixel mode, and window opaque compositor hint, on alpha changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When background alpha is changed at runtime (using OSC-11), we (may) have to update the opaque hint we send to the compositor. We must also update the subpixel mode used when rendering font glyphs. Why? When the window is fully opaque, we use wl_surface_set_opaque_region() on the entire surface, to hint to the compositor that it doesn’t have to blend the window content with whatever is behind the window. Obviously, if alpha is changed from opaque, to transparent (or semi-transparent), that hint must be removed. Sub-pixel mode is harder to explain, but in short, we can’t do subpixel hinting with a (semi-)transparent background. Thus, similar to the opaque hint, subpixel antialiasing must be enabled/disabled when background alpha is changed. --- osc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'osc.c') diff --git a/osc.c b/osc.c index 55cfcf84..45d114de 100644 --- a/osc.c +++ b/osc.c @@ -729,8 +729,15 @@ osc_dispatch(struct terminal *term) case 11: term->colors.bg = color; - if (have_alpha) + if (have_alpha) { + const bool changed = term->colors.alpha != alpha; term->colors.alpha = alpha; + + if (changed) { + wayl_win_alpha_changed(term->window); + term_font_subpixel_changed(term); + } + } break; case 17: -- cgit v1.3