mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-13 04:27:47 -05:00
render: disable transparency when we’re fullscreened
The wayland protocol recommends (or mandates?) that compositors render a black background behind fullscreened transparent windows. I.e. you never see what’s _actually_ behind the window. So, if you have a white, but semi-transparent background in foot, it’ll be rendered in a shade of gray. Given this, it’s better to simply disable transparency while we’re fullscreened. That way, we at least get the "correct" background color. Closes #1416
This commit is contained in:
parent
648f6016e3
commit
899b768b74
2 changed files with 32 additions and 2 deletions
|
|
@ -51,8 +51,11 @@
|
||||||
configuration) from the monitor we were most recently mapped on,
|
configuration) from the monitor we were most recently mapped on,
|
||||||
instead of the one least recently.
|
instead of the one least recently.
|
||||||
* Starlight theme (the default theme) updated to [V4][starlight-v4]
|
* Starlight theme (the default theme) updated to [V4][starlight-v4]
|
||||||
|
* Background transparency (alpha) is now disabled in fullscreened
|
||||||
|
windows ([#1416][1416]).
|
||||||
|
|
||||||
[starlight-v4]: https://github.com/CosmicToast/starlight/blob/v4/CHANGELOG.md#v4
|
[starlight-v4]: https://github.com/CosmicToast/starlight/blob/v4/CHANGELOG.md#v4
|
||||||
|
[1416]: https://codeberg.org/dnkl/foot/issues/1416
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
|
||||||
31
render.c
31
render.c
|
|
@ -526,8 +526,35 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
||||||
uint32_t swap = _fg;
|
uint32_t swap = _fg;
|
||||||
_fg = _bg;
|
_fg = _bg;
|
||||||
_bg = swap;
|
_bg = swap;
|
||||||
} else if (cell->attrs.bg_src == COLOR_DEFAULT)
|
}
|
||||||
alpha = term->colors.alpha;
|
|
||||||
|
else if (cell->attrs.bg_src == COLOR_DEFAULT) {
|
||||||
|
if (term->window->is_fullscreen) {
|
||||||
|
/*
|
||||||
|
* Note: disable transparency when fullscreened.
|
||||||
|
*
|
||||||
|
* This is because the wayland protocol recommends
|
||||||
|
* (mandates even?) the compositor render a black
|
||||||
|
* background behind fullscreened transparent windows.
|
||||||
|
*
|
||||||
|
* In other words, transparency does not work when
|
||||||
|
* fullscreened, in the sense that you don't see
|
||||||
|
* what's behind the window.
|
||||||
|
*
|
||||||
|
* And if we keep our alpha channel, the background
|
||||||
|
* color will just look weird. For example, if the
|
||||||
|
* background color is white, and alpha is 0.5, then
|
||||||
|
* the window will be drawn in a shade of gray while
|
||||||
|
* fullscreened.
|
||||||
|
*
|
||||||
|
* By disabling the alpha channel, the window will at
|
||||||
|
* least be rendered in the intended background color.
|
||||||
|
*/
|
||||||
|
xassert(alpha == 0xffff);
|
||||||
|
} else {
|
||||||
|
alpha = term->colors.alpha;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(is_selected && _fg == _bg)) {
|
if (unlikely(is_selected && _fg == _bg)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue