1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2024-11-11 13:51:02 -05:00

config: remove --shadow-exclude-reg

Deprecated in v2, and we added a better alternative to it.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-05-12 12:24:32 +01:00
parent 70c4327a4d
commit f510d8dd62
No known key found for this signature in database
GPG key ID: D3A4405BE6CC17F4
15 changed files with 27 additions and 170 deletions

View file

@ -31,6 +31,10 @@
* Marginally improve performance when resizing/opening/closing windows. (#1190) * Marginally improve performance when resizing/opening/closing windows. (#1190)
* Type and format specifiers are no longer used in rules. These specifiers are what you put after the colon (':') in rules, e.g. the `:32c` in `"_GTK_FRAME_EXTENTS@:32c"`. Now this information is ignored and the property is matched regardless of format or type. * Type and format specifiers are no longer used in rules. These specifiers are what you put after the colon (':') in rules, e.g. the `:32c` in `"_GTK_FRAME_EXTENTS@:32c"`. Now this information is ignored and the property is matched regardless of format or type.
## Deprecated features
* Setting `--shadow-exclude-reg` is now a hard error. It was deprecated almost since the start of `picom`. `--clip-shadow-above` is the better alternative. (#1254)
## Bug fixes ## Bug fixes
* Fix ghosting artifacts that sometimes occur when window manager is restarted (#1081) * Fix ghosting artifacts that sometimes occur when window manager is restarted (#1081)

View file

@ -217,9 +217,6 @@ May also be one of the predefined kernels: `3x3box` (default), `5x5box`, `7x7box
*--opacity-rule* 'OPACITY':'CONDITION':: *--opacity-rule* 'OPACITY':'CONDITION'::
Specify a list of opacity rules, in the format `PERCENT:PATTERN`, like `50:name *= "Firefox"`. picom-trans is recommended over this. Note we don't make any guarantee about possible conflicts with other programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows. Specify a list of opacity rules, in the format `PERCENT:PATTERN`, like `50:name *= "Firefox"`. picom-trans is recommended over this. Note we don't make any guarantee about possible conflicts with other programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows.
*--shadow-exclude-reg* 'GEOMETRY'::
Specify a X geometry that describes the region in which shadow should not be painted in, such as a dock window region. Use `--shadow-exclude-reg x10+0-0`, for example, if the 10 pixels on the bottom of the screen should not have shadows painted on.
*--crop-shadow-to-monitor*:: *--crop-shadow-to-monitor*::
Crop shadow of a window fully on a particular monitor to that monitor. This is currently implemented using the X RandR extension. Crop shadow of a window fully on a particular monitor to that monitor. This is currently implemented using the X RandR extension.

View file

@ -50,13 +50,6 @@ shadow-exclude = [
# Specify a list of conditions of windows that should have no shadow painted over, such as a dock window. # Specify a list of conditions of windows that should have no shadow painted over, such as a dock window.
# clip-shadow-above = [] # clip-shadow-above = []
# Specify a X geometry that describes the region in which shadow should not
# be painted in, such as a dock window region. Use
# shadow-exclude-reg = "x10+0+0"
# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on.
#
# shadow-exclude-reg = ""
# Crop shadow of a window fully on a particular monitor to that monitor. This is # Crop shadow of a window fully on a particular monitor to that monitor. This is
# currently implemented using the X RandR extension. # currently implemented using the X RandR extension.
# crop-shadow-to-monitor = false # crop-shadow-to-monitor = false

View file

@ -307,8 +307,6 @@ typedef struct session {
/// Backend shadow context. /// Backend shadow context.
struct backend_shadow_context *shadow_context; struct backend_shadow_context *shadow_context;
// for shadow precomputation // for shadow precomputation
/// A region in which shadow is not painted on.
region_t shadow_exclude_reg;
// === Software-optimization-related === // === Software-optimization-related ===
/// Nanosecond offset of the first painting. /// Nanosecond offset of the first painting.

View file

@ -412,107 +412,6 @@ struct conv **parse_blur_kern_lst(const char *src, bool *hasneg, int *count) {
return ret; return ret;
} }
/**
* Parse a X geometry.
*
* ps->root_width and ps->root_height must be valid
*/
bool parse_geometry(session_t *ps, const char *src, region_t *dest) {
pixman_region32_clear(dest);
if (!src) {
return true;
}
if (!ps->root_width || !ps->root_height) {
return true;
}
long x = 0, y = 0;
long width = ps->root_width, height = ps->root_height;
long val = 0L;
char *endptr = NULL;
src = skip_space(src);
if (!*src) {
goto parse_geometry_end;
}
// Parse width
// Must be base 10, because "0x0..." may appear
if (*src != '+' && *src != '-') {
val = strtol(src, &endptr, 10);
assert(endptr);
if (src != endptr) {
if (val < 0) {
log_error("Invalid width: %s", src);
return false;
}
width = val;
src = endptr;
}
src = skip_space(src);
}
// Parse height
if (*src == 'x') {
++src;
val = strtol(src, &endptr, 10);
assert(endptr);
if (src != endptr) {
if (val < 0) {
log_error("Invalid height: %s", src);
return false;
}
height = val;
src = endptr;
}
src = skip_space(src);
}
// Parse x
if (*src == '+' || *src == '-') {
val = strtol(src, &endptr, 10);
if (endptr && src != endptr) {
x = val;
if (*src == '-') {
x += ps->root_width - width;
}
src = endptr;
}
src = skip_space(src);
}
// Parse y
if (*src == '+' || *src == '-') {
val = strtol(src, &endptr, 10);
if (endptr && src != endptr) {
y = val;
if (*src == '-') {
y += ps->root_height - height;
}
src = endptr;
}
src = skip_space(src);
}
if (*src) {
log_error("Trailing characters: %s", src);
return false;
}
parse_geometry_end:
if (x < INT_MIN || x > INT_MAX || y < INT_MIN || y > INT_MAX) {
log_error("Geometry coordinates exceeded limits: %s", src);
return false;
}
if (width > UINT_MAX || height > UINT_MAX) {
// less than 0 is checked for earlier
log_error("Geometry size exceeded limits: %s", src);
return false;
}
pixman_region32_union_rect(dest, dest, (int)x, (int)y, (uint)width, (uint)height);
return true;
}
void *parse_numeric_prefix(const char *src, const char **end, void *user_data) { void *parse_numeric_prefix(const char *src, const char **end, void *user_data) {
int *minmax = user_data; int *minmax = user_data;
*end = NULL; *end = NULL;

View file

@ -176,8 +176,6 @@ typedef struct options {
int shadow_radius; int shadow_radius;
int shadow_offset_x, shadow_offset_y; int shadow_offset_x, shadow_offset_y;
double shadow_opacity; double shadow_opacity;
/// argument string to shadow-exclude-reg option
char *shadow_exclude_reg_str;
/// Shadow blacklist. A linked list of conditions. /// Shadow blacklist. A linked list of conditions.
c2_lptr_t *shadow_blacklist; c2_lptr_t *shadow_blacklist;
/// Whether bounding-shaped window should be ignored. /// Whether bounding-shaped window should be ignored.
@ -296,7 +294,6 @@ extern const char *const BACKEND_STRS[NUM_BKEND + 1];
bool must_use parse_long(const char *, long *); bool must_use parse_long(const char *, long *);
bool must_use parse_int(const char *, int *); bool must_use parse_int(const char *, int *);
struct conv **must_use parse_blur_kern_lst(const char *, bool *hasneg, int *count); struct conv **must_use parse_blur_kern_lst(const char *, bool *hasneg, int *count);
bool must_use parse_geometry(session_t *, const char *, region_t *);
void *parse_window_shader_prefix(const char *src, const char **end, void *user_data); void *parse_window_shader_prefix(const char *src, const char **end, void *user_data);
void *parse_numeric_prefix(const char *src, const char **end, void *user_data); void *parse_numeric_prefix(const char *src, const char **end, void *user_data);
char *must_use locate_auxiliary_file(const char *scope, const char *path, char *must_use locate_auxiliary_file(const char *scope, const char *path,

View file

@ -357,7 +357,9 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
} }
// --shadow-exclude-reg // --shadow-exclude-reg
if (config_lookup_string(&cfg, "shadow-exclude-reg", &sval)) { if (config_lookup_string(&cfg, "shadow-exclude-reg", &sval)) {
opt->shadow_exclude_reg_str = strdup(sval); log_error("shadow-exclude-reg is deprecated. Please use "
"clip-shadow-above for more flexible shadow exclusion.");
goto err;
} }
// --inactive-opacity-override // --inactive-opacity-override
lcfg_lookup_bool(&cfg, "inactive-opacity-override", &opt->inactive_opacity_override); lcfg_lookup_bool(&cfg, "inactive-opacity-override", &opt->inactive_opacity_override);

View file

@ -629,10 +629,9 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
break; break;
case 305: case 305:
// --shadow-exclude-reg // --shadow-exclude-reg
free(opt->shadow_exclude_reg_str); log_error("--shadow-exclude-reg is deprecated. You are likely "
opt->shadow_exclude_reg_str = strdup(optarg);
log_warn("--shadow-exclude-reg is deprecated. You are likely "
"better off using --clip-shadow-above anyway"); "better off using --clip-shadow-above anyway");
failed = true;
break; break;
case 306: case 306:
// --paint-exclude // --paint-exclude

View file

@ -594,16 +594,6 @@ static void rebuild_screen_reg(session_t *ps) {
get_screen_region(ps, &ps->screen_reg); get_screen_region(ps, &ps->screen_reg);
} }
/**
* Rebuild <code>shadow_exclude_reg</code>.
*/
static void rebuild_shadow_exclude_reg(session_t *ps) {
bool ret = parse_geometry(ps, ps->o.shadow_exclude_reg_str, &ps->shadow_exclude_reg);
if (!ret) {
exit(1);
}
}
/// Free up all the images and deinit the backend /// Free up all the images and deinit the backend
static void destroy_backend(session_t *ps) { static void destroy_backend(session_t *ps) {
win_stack_foreach_managed_safe(w, wm_stack_end(ps->wm)) { win_stack_foreach_managed_safe(w, wm_stack_end(ps->wm)) {
@ -808,7 +798,6 @@ static void configure_root(session_t *ps) {
free(r); free(r);
rebuild_screen_reg(ps); rebuild_screen_reg(ps);
rebuild_shadow_exclude_reg(ps);
// Invalidate reg_ignore from the top // Invalidate reg_ignore from the top
auto top_w = wm_stack_next_managed(ps->wm, wm_stack_end(ps->wm)); auto top_w = wm_stack_next_managed(ps->wm, wm_stack_end(ps->wm));
@ -1854,7 +1843,7 @@ static void draw_callback_impl(EV_P_ session_t *ps, int revents attr_unused) {
ps->backend_blur_context, render_start_us, ps->sync_fence, ps->backend_blur_context, render_start_us, ps->sync_fence,
ps->o.use_damage, ps->o.monitor_repaint, ps->o.force_win_blend, ps->o.use_damage, ps->o.monitor_repaint, ps->o.force_win_blend,
ps->o.blur_background_frame, ps->o.inactive_dim_fixed, ps->o.blur_background_frame, ps->o.inactive_dim_fixed,
ps->o.max_brightness, ps->o.inactive_dim, &ps->shadow_exclude_reg, ps->o.max_brightness, ps->o.inactive_dim,
ps->o.crop_shadow_to_monitor ? &ps->monitors : NULL, ps->o.crop_shadow_to_monitor ? &ps->monitors : NULL,
ps->o.wintype_option, &after_damage_us); ps->o.wintype_option, &after_damage_us);
if (!succeeded) { if (!succeeded) {
@ -2289,8 +2278,6 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
sum_kernel_preprocess((conv *)ps->shadow_context); sum_kernel_preprocess((conv *)ps->shadow_context);
} }
rebuild_shadow_exclude_reg(ps);
// Query X Shape // Query X Shape
ext_info = xcb_get_extension_data(ps->c.c, &xcb_shape_id); ext_info = xcb_get_extension_data(ps->c.c, &xcb_shape_id);
if (ext_info && ext_info->present) { if (ext_info && ext_info->present) {

View file

@ -1100,11 +1100,6 @@ void paint_all(session_t *ps, struct managed_win *t) {
// of the windows above. Because no one can see it // of the windows above. Because no one can see it
pixman_region32_subtract(&reg_tmp, &region, w->reg_ignore); pixman_region32_subtract(&reg_tmp, &region, w->reg_ignore);
// Mask out the region we don't want shadow on
if (pixman_region32_not_empty(&ps->shadow_exclude_reg)) {
pixman_region32_subtract(&reg_tmp, &reg_tmp,
&ps->shadow_exclude_reg);
}
if (pixman_region32_not_empty(&reg_shadow_clip)) { if (pixman_region32_not_empty(&reg_shadow_clip)) {
pixman_region32_subtract(&reg_tmp, &reg_tmp, &reg_shadow_clip); pixman_region32_subtract(&reg_tmp, &reg_tmp, &reg_shadow_clip);
} }

View file

@ -90,7 +90,7 @@ commands_for_window_body(struct layer *layer, struct backend_command *cmd,
/// @param[in] end the end of the commands generated for this `layer`. /// @param[in] end the end of the commands generated for this `layer`.
static inline unsigned static inline unsigned
command_for_shadow(struct layer *layer, struct backend_command *cmd, command_for_shadow(struct layer *layer, struct backend_command *cmd,
const struct win_option *wintype_options, const region_t *shadow_exclude, const struct win_option *wintype_options,
const struct x_monitors *monitors, const struct backend_command *end) { const struct x_monitors *monitors, const struct backend_command *end) {
auto w = layer->win; auto w = layer->win;
if (!w->shadow) { if (!w->shadow) {
@ -134,9 +134,6 @@ command_for_shadow(struct layer *layer, struct backend_command *cmd,
// Move mask region to screen coordinates for shadow exclusion // Move mask region to screen coordinates for shadow exclusion
// calculation // calculation
pixman_region32_translate(&cmd->mask.region, layer->origin.x, layer->origin.y); pixman_region32_translate(&cmd->mask.region, layer->origin.x, layer->origin.y);
if (shadow_exclude) {
pixman_region32_subtract(&cmd->mask.region, &cmd->mask.region, shadow_exclude);
}
if (monitors && w->randr_monitor >= 0 && w->randr_monitor < monitors->count) { if (monitors && w->randr_monitor >= 0 && w->randr_monitor < monitors->count) {
pixman_region32_intersect(&cmd->mask.region, &cmd->mask.region, pixman_region32_intersect(&cmd->mask.region, &cmd->mask.region,
&monitors->regions[w->randr_monitor]); &monitors->regions[w->randr_monitor]);
@ -362,10 +359,9 @@ void command_builder_free(struct command_builder *cb) {
// TODO(yshui) reduce the number of parameters by storing the final effective parameter // TODO(yshui) reduce the number of parameters by storing the final effective parameter
// value in `struct managed_win`. // value in `struct managed_win`.
void command_builder_build(struct command_builder *cb, struct layout *layout, void command_builder_build(struct command_builder *cb, struct layout *layout, bool force_blend,
bool force_blend, bool blur_frame, bool inactive_dim_fixed, bool blur_frame, bool inactive_dim_fixed, double max_brightness,
double max_brightness, double inactive_dim, double inactive_dim, const struct x_monitors *monitors,
const region_t *shadow_exclude, const struct x_monitors *monitors,
const struct win_option *wintype_options) { const struct win_option *wintype_options) {
unsigned ncmds = 1; unsigned ncmds = 1;
@ -402,8 +398,7 @@ void command_builder_build(struct command_builder *cb, struct layout *layout,
inactive_dim, max_brightness); inactive_dim, max_brightness);
// Add shadow // Add shadow
cmd -= command_for_shadow(layer, cmd, wintype_options, shadow_exclude, cmd -= command_for_shadow(layer, cmd, wintype_options, monitors, last + 1);
monitors, last + 1);
// Add blur // Add blur
cmd -= command_for_blur(layer, cmd, &frame_region, force_blend, blur_frame); cmd -= command_for_blur(layer, cmd, &frame_region, force_blend, blur_frame);

View file

@ -20,8 +20,7 @@ void command_builder_command_list_free(struct backend_command *cmds);
/// It is guaranteed that each of the command's region of operation (e.g. the mask.region /// It is guaranteed that each of the command's region of operation (e.g. the mask.region
/// argument of blit), will be store in `struct backend_command::mask`. This might not /// argument of blit), will be store in `struct backend_command::mask`. This might not
/// stay true after further passes. /// stay true after further passes.
void command_builder_build(struct command_builder *cb, struct layout *layout, void command_builder_build(struct command_builder *cb, struct layout *layout, bool force_blend,
bool force_blend, bool blur_frame, bool inactive_dim_fixed, bool blur_frame, bool inactive_dim_fixed, double max_brightness,
double max_brightness, double inactive_dim, double inactive_dim, const struct x_monitors *monitors,
const region_t *shadow_exclude, const struct x_monitors *monitors,
const struct win_option *wintype_options); const struct win_option *wintype_options);

View file

@ -450,10 +450,10 @@ void renderer_ensure_monitor_repaint_ready(struct renderer *r, struct backend_ba
bool renderer_render(struct renderer *r, struct backend_base *backend, bool renderer_render(struct renderer *r, struct backend_base *backend,
image_handle root_image, struct layout_manager *lm, image_handle root_image, struct layout_manager *lm,
struct command_builder *cb, void *blur_context, struct command_builder *cb, void *blur_context,
uint64_t render_start_us, xcb_sync_fence_t xsync_fence, bool use_damage, uint64_t render_start_us, xcb_sync_fence_t xsync_fence,
bool monitor_repaint, bool force_blend, bool blur_frame, bool use_damage, bool monitor_repaint, bool force_blend,
bool inactive_dim_fixed, double max_brightness, double inactive_dim, bool blur_frame, bool inactive_dim_fixed, double max_brightness,
const region_t *shadow_exclude, const struct x_monitors *monitors, double inactive_dim, const struct x_monitors *monitors,
const struct win_option *wintype_options, uint64_t *after_damage_us) { const struct win_option *wintype_options, uint64_t *after_damage_us) {
if (xsync_fence != XCB_NONE) { if (xsync_fence != XCB_NONE) {
// Trigger the fence but don't immediately wait on it. Let it run // Trigger the fence but don't immediately wait on it. Let it run
@ -477,8 +477,7 @@ bool renderer_render(struct renderer *r, struct backend_base *backend,
} }
command_builder_build(cb, layout, force_blend, blur_frame, inactive_dim_fixed, command_builder_build(cb, layout, force_blend, blur_frame, inactive_dim_fixed,
max_brightness, inactive_dim, shadow_exclude, monitors, max_brightness, inactive_dim, monitors, wintype_options);
wintype_options);
if (log_get_level_tls() <= LOG_LEVEL_TRACE) { if (log_get_level_tls() <= LOG_LEVEL_TRACE) {
auto layer = layout->layers - 1; auto layer = layout->layers - 1;
auto layer_end = &layout->commands[layout->first_layer_start]; auto layer_end = &layout->commands[layout->first_layer_start];

View file

@ -22,8 +22,8 @@ struct renderer *renderer_new(struct backend_base *backend, double shadow_radius
bool renderer_render(struct renderer *r, struct backend_base *backend, bool renderer_render(struct renderer *r, struct backend_base *backend,
image_handle root_image, struct layout_manager *lm, image_handle root_image, struct layout_manager *lm,
struct command_builder *cb, void *blur_context, struct command_builder *cb, void *blur_context,
uint64_t render_start_us, xcb_sync_fence_t xsync_fence, bool use_damage, uint64_t render_start_us, xcb_sync_fence_t xsync_fence,
bool monitor_repaint, bool force_blend, bool blur_frame, bool use_damage, bool monitor_repaint, bool force_blend,
bool inactive_dim_fixed, double max_brightness, double inactive_dim, bool blur_frame, bool inactive_dim_fixed, double max_brightness,
const region_t *shadow_exclude, const struct x_monitors *monitors, double inactive_dim, const struct x_monitors *monitors,
const struct win_option *wintype_options, uint64_t *after_damage_us); const struct win_option *wintype_options, uint64_t *after_damage_us);

View file

@ -57,13 +57,6 @@ shadow-exclude = [
# Specify a list of conditions of windows that should have no shadow painted over, such as a dock window. # Specify a list of conditions of windows that should have no shadow painted over, such as a dock window.
# clip-shadow-above = [] # clip-shadow-above = []
# Specify a X geometry that describes the region in which shadow should not
# be painted in, such as a dock window region. Use
# shadow-exclude-reg = "x10+0+0"
# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on.
#
# shadow-exclude-reg = ""
# Crop shadow of a window fully on a particular monitor to that monitor. This is # Crop shadow of a window fully on a particular monitor to that monitor. This is
# currently implemented using the X RandR extension. # currently implemented using the X RandR extension.
# crop-shadow-to-monitor = false # crop-shadow-to-monitor = false