Keep track of the number of elements/indices for the normal blur rects
as well as the resized ones and use the correct number when drawing.
The number of rects can change if resized rects overlap and are reduced
into a single rect.
Fixes#440
* src/event.c: expose_root: region is not freed
* backend/xrender/xrender.c:
* bind_pixmap: the reply `r` is not freed
* blur: reg_op_resized is not freed
Spotted-by: Samuel Hand <samuel.d.hand@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This replaces single quotes for double quotes in the configuration
comments that refer to strings.
This was misleading since someone could took that comment as a valid
config entry, which is not. One notable example was `backend = 'glx'`
which is not accepted by libconfig.
This also adds `;` for each default config values for consistency.
Partially revert 32754b0262.
We start with mapping the window (`win_process_update_flags()`). Then check
if focus has changed and process focus updates. Finally refresh stale images
(`win_process_image_flags`) because rules based on focus may have invalidated
them or require them to be created.
Fixes#465 with the following rule:
```
shadow-exclude = [
"focused" != 1"
]
```
Implement the dual-filter kawase blur algorithm for the new OpenGL backend
as seen in kwin [1]. Use with `--blur-method dual_kawase` and set the
desired strength with `--blur-strength level` (1-20).
The dual-filter kawase algorithm produces results close to a traditional
gaussian blur with higher performace, especially at high blur radii. The
supported strength levels provide an effect similar to gauss-radii between
4 and 500 pixels.
As this algorithm relies heavily on the texture-filtering units of a
GPU, there is no support for the xrender backend — at least for now.
[1](https://kwin.kde.narkive.com/aSqRYYw7/d9848-updated-the-blur-method-to-use-the-more-efficient-dual-kawase-blur-algorithm)
**Work-in-Progress**
Split-off kernel-blur specific initialization and rendering from common
OpenGL setup. Add stub functions for dual_kawase-blur initialization and
rendering.
**Work-in-Progress**
Generate suitable parameters for dual-filter kawase blur based on the
selected `blur-strength` or approximate a gauss blur with the selected
`blur-size` and std-deviation.
**Work-in-Progress**
Add `dual_kawase` to configuration and argument parsing. Allow `kawase`
for backward compatibility. Add `--blur-strength` parameter for
blur-method `dual_kawase`.
Update documentation to reflect the new blur-method and parameters.
All names start with underscore are reserved in C.
Also just testing out the language server's renaming feature.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
We currently don't use it for anything. We could add a CI pass in the
future.
We don't enable clang-analyzer checks. The checks enabled here should
mostly be syntax/style linting only, and should be cheap to run.
clang-analyzer checks are usually compute-intensive, and can easily be run
separately anyway, with scan-build and such.
The list of checks definitely isn't final.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This is a workaround for #301. This doesn't fix the bug, but by
allocating X resources much less frequently, this should make the
bug almost never happen.
Also, it might generally be a good idea to not create/destroy X
resources so often. (XFixes Region accounts for >99% of the resource
creations/destructions)
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Two problems:
1) the regex used to match the wid in the window tree can match the wid
appearing in window titles as well.
2) instead of picking the parent window of the target window to set
transparency, a random window which is listed just below the target
window will be chosen. not sure why was there a + 1.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Create pictures used for bluring with REPEAT attribute set to PAD (same logic
as GL_CLAMP_TO_EDGE in OpenGL). Fixes darkening at the screen edges with
larger blur radii caused by sampling out of texture bounds.
Related: 4b0ff37b36
Make use of hardware linear interpolation in a GPU to sample 2 pixels
with a single texture access inside the blur shaders by sampling between
both pixels based on their relative weight.
This is significantly easier for a single dimension as 2D bilinear
filtering would raise additional constraints on the kernels (not single
zero-entries, no zero-diagonals, ...) which require additional checks
with limited improvements. Therfore, only use interpolation along the
larger dimension should be a sufficient improvement.
Using this will effectively half the number of texture accesses and
additions needed for a kernel. E.g. a 1D-pass of the gaussian blur
with radius 15 will only need 16 samples instead of 31.
Create texture with GL_LINEAR filtering and GL_CLAMP_TO_EDGE wrapping. Change
`texelFetch()`-call in fragement shader to `texture2D()` to be taken into
account. This requires supplying the size of a pixel in normalized texture
coordinates via an additional uniform.
Fixes darkening at the screen edges with larger blur radii caused by
sampling coordinates being out of texture bounds. This is undefined behaviour
unless the context has set the flag *GL_ARB_robust_buffer_access_behaviour*,
in which case "zero"-pixels are returned (i.e. black). Current behaviour
seems to depend on the driver.