Add clip-shadow-above configuration and wintype option
Added the new `clip-shadow-above` configuration and wintype option. These allow the user to select windows to clip from the shadow region of other windows, i.e. don't paint shadows on top of them. This should provide a more useful and userfriendly alternative to the deprecated `shadow-exclude-reg` option — especially for docks and bars.
This commit is contained in:
22
src/render.c
22
src/render.c
@@ -1046,6 +1046,10 @@ void paint_all(session_t *ps, struct managed_win *t, bool ignore_damage) {
|
||||
reg_paint = ®ion;
|
||||
}
|
||||
|
||||
// Region on screen we don't want any shadows on
|
||||
region_t reg_shadow_clip;
|
||||
pixman_region32_init(®_shadow_clip);
|
||||
|
||||
set_tgt_clip(ps, reg_paint);
|
||||
paint_root(ps, reg_paint);
|
||||
|
||||
@@ -1074,6 +1078,9 @@ void paint_all(session_t *ps, struct managed_win *t, bool ignore_damage) {
|
||||
if (pixman_region32_not_empty(&ps->shadow_exclude_reg))
|
||||
pixman_region32_subtract(®_tmp, ®_tmp,
|
||||
&ps->shadow_exclude_reg);
|
||||
if (pixman_region32_not_empty(®_shadow_clip)) {
|
||||
pixman_region32_subtract(®_tmp, ®_tmp, ®_shadow_clip);
|
||||
}
|
||||
|
||||
// Might be worth while to crop the region to shadow
|
||||
// border
|
||||
@@ -1109,6 +1116,20 @@ void paint_all(session_t *ps, struct managed_win *t, bool ignore_damage) {
|
||||
}
|
||||
}
|
||||
|
||||
// Only clip shadows above visible windows
|
||||
if (w->opacity * MAX_ALPHA >= 1) {
|
||||
if (w->clip_shadow_above) {
|
||||
// Add window bounds to shadow-clip region
|
||||
pixman_region32_union(®_shadow_clip, ®_shadow_clip,
|
||||
&bshape_corners);
|
||||
} else {
|
||||
// Remove overlapping window bounds from shadow-clip
|
||||
// region
|
||||
pixman_region32_subtract(
|
||||
®_shadow_clip, ®_shadow_clip, &bshape_corners);
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate the paint region based on the reg_ignore of the current
|
||||
// window and its bounding region.
|
||||
// Remember, reg_ignore is the union of all windows above the current
|
||||
@@ -1160,6 +1181,7 @@ void paint_all(session_t *ps, struct managed_win *t, bool ignore_damage) {
|
||||
|
||||
// Free up all temporary regions
|
||||
pixman_region32_fini(®_tmp);
|
||||
pixman_region32_fini(®_shadow_clip);
|
||||
|
||||
// Move the head of the damage ring
|
||||
ps->damage = ps->damage - 1;
|
||||
|
||||
Reference in New Issue
Block a user