render: whole-window transparency when unfocused

This adds a new option, colors.unfocused-alpha. When set to a value <
1.0, the entire window (*everything* - all bg/fg colors, images etc)
are made transparent while the window does not have keyboard focus.

The way this is implemented (trying to keep the patch small), we need
to do full-screen repaints while in this mode.

That is, all screen updates result in full-screen repaints when:

* The window does not have keyboard focus
* The window *just* gained keyboard focus (i.e. last frame was
  rendered with transparency)

As such, one can expect a fairly large performance impact when there’s
large amount of output while the window is unfocused.

Focused windows are unaffected, as are unfocused windows when
colors.unfocused-alpha == 1.0.
This commit is contained in:
Daniel Eklöf 2021-08-11 17:36:42 +02:00
parent 2fbc336eb9
commit 9013a810f1
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
7 changed files with 57 additions and 0 deletions

View file

@ -509,6 +509,26 @@ _alpha_ option.
Background translucency. A value in the range 0.0-1.0, where 0.0
means completely transparent, and 1.0 is opaque. Default: _1.0_.
*unfocused-alpha*
Window translucency applied when window does not have keyboard
focus. Unlike *alpha*, this option affects everything (all
background colors, foreground colors, images etc).
Note that *alpha* is also applied.
Be aware that there is a performance penalty of using this, as
damage tracking is disabled while the window is
unfocused. I.e. all screen updates will result in fullscreen
repaints. This is not an issue when the window content is static,
or updates at a slow pace (e.g. top), but can be noticeable with
high amounts of output. Performance is unaffected in focused
windows.
Valid values are in the range 0.0-1.0, where 0.0 means completely
transparent, and 1.0 is opaque.
Default: _1.0_
*selection-foreground*, *selection-background*
Foreground (text) and background color to use in selected
text. Note that *both* options must be set, or the default will be