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 <charmitro@posteo.net>
This commit is contained in:
Charalampos Mitrodimas 2025-10-02 00:29:34 +03:00 committed by Daniel Eklöf
parent 299186a654
commit fd88c6c61c
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -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);