From fd88c6c61c52b75789c7f9d723815b67aed2984f Mon Sep 17 00:00:00 2001 From: Charalampos Mitrodimas Date: Thu, 2 Oct 2025 00:29:34 +0300 Subject: [PATCH] wayland: restore opacity after exiting fullscreen When exiting fullscreen mode, the window's transparency was not being restored, leaving it opaque until another window was fullscreened. This occurred because the Wayland opaque region was set based only on the configured alpha value, without considering the fullscreen state. Since commit 899b768b74 ("render: disable transparency when we're fullscreened") transparency is disabled during fullscreen to avoid compositor-mandated black backgrounds affecting the intended colors. However, the opaque region was not being updated when the fullscreen state changed. Fixes: https://codeberg.org/dnkl/foot/issues/2180 Signed-off-by: Charalampos Mitrodimas --- wayland.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/wayland.c b/wayland.c index 5f68ecf7..59b2a33e 100644 --- a/wayland.c +++ b/wayland.c @@ -1064,6 +1064,7 @@ xdg_surface_configure(void *data, struct xdg_surface *xdg_surface, bool wasnt_configured = !win->is_configured; bool was_resizing = win->is_resizing; + bool was_fullscreen = win->is_fullscreen; bool csd_was_enabled = win->csd_mode == CSD_YES && !win->is_fullscreen; int new_width = win->configure.width; int new_height = win->configure.height; @@ -1096,6 +1097,10 @@ xdg_surface_configure(void *data, struct xdg_surface *xdg_surface, else if (csd_was_enabled && !enable_csd) csd_destroy(win); + /* Update opaque region if fullscreen state changed */ + if (was_fullscreen != win->is_fullscreen) + wayl_win_alpha_changed(win); + if (enable_csd && new_width > 0 && new_height > 0) { if (wayl_win_csd_titlebar_visible(win)) new_height -= win->term->conf->csd.title_height; @@ -2401,7 +2406,13 @@ wayl_win_alpha_changed(struct wl_window *win) { struct terminal *term = win->term; - if (term->colors.alpha == 0xffff) { + /* + * When fullscreened, transparency is disabled (see render.c). + * Update the opaque region to match. + */ + bool is_opaque = term->colors.alpha == 0xffff || win->is_fullscreen; + + if (is_opaque) { struct wl_region *region = wl_compositor_create_region( term->wl->compositor);