Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: remove some really old options #1254

Merged
merged 2 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
* 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.

## 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)
* Remove command line options `-n`, `-a`, and `-s`. They were removed more than 10 years ago, it's time to finally get rid of them entirely. (#1254)

## Bug fixes

* Fix ghosting artifacts that sometimes occur when window manager is restarted (#1081)
Expand Down
3 changes: 0 additions & 3 deletions man/picom.1.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,6 @@ May also be one of the predefined kernels: `3x3box` (default), `5x5box`, `7x7box
*--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.

*--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 of a window fully on a particular monitor to that monitor. This is currently implemented using the X RandR extension.

Expand Down
7 changes: 0 additions & 7 deletions picom.sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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.
# 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
# currently implemented using the X RandR extension.
# crop-shadow-to-monitor = false
Expand Down
2 changes: 0 additions & 2 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,6 @@ typedef struct session {
/// Backend shadow context.
struct backend_shadow_context *shadow_context;
// for shadow precomputation
/// A region in which shadow is not painted on.
region_t shadow_exclude_reg;

// === Software-optimization-related ===
/// Nanosecond offset of the first painting.
Expand Down
101 changes: 0 additions & 101 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,107 +412,6 @@ struct conv **parse_blur_kern_lst(const char *src, bool *hasneg, int *count) {
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) {
int *minmax = user_data;
*end = NULL;
Expand Down
3 changes: 0 additions & 3 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ typedef struct options {
int shadow_radius;
int shadow_offset_x, shadow_offset_y;
double shadow_opacity;
/// argument string to shadow-exclude-reg option
char *shadow_exclude_reg_str;
/// Shadow blacklist. A linked list of conditions.
c2_lptr_t *shadow_blacklist;
/// Whether bounding-shaped window should be ignored.
Expand Down Expand Up @@ -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_int(const char *, int *);
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_numeric_prefix(const char *src, const char **end, void *user_data);
char *must_use locate_auxiliary_file(const char *scope, const char *path,
Expand Down
4 changes: 3 additions & 1 deletion src/config_libconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@
}
// --shadow-exclude-reg
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 "

Check warning on line 360 in src/config_libconfig.c

View check run for this annotation

Codecov / codecov/patch

src/config_libconfig.c#L360

Added line #L360 was not covered by tests
"clip-shadow-above for more flexible shadow exclusion.");
goto err;

Check warning on line 362 in src/config_libconfig.c

View check run for this annotation

Codecov / codecov/patch

src/config_libconfig.c#L362

Added line #L362 was not covered by tests
}
// --inactive-opacity-override
lcfg_lookup_bool(&cfg, "inactive-opacity-override", &opt->inactive_opacity_override);
Expand Down
12 changes: 3 additions & 9 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@
}
}

static const char *shortopts = "D:I:O:r:o:m:l:t:i:e:hscnfCazGb";
static const char *shortopts = "D:I:O:r:o:m:l:t:i:e:hcfCzGb";

/// Get config options that are needed to parse the rest of the options
/// Return true if we should quit
Expand Down Expand Up @@ -443,11 +443,6 @@
"cleared under certain types of windows, you can use "
"the \"full-shadow\" per window type option.");
break;
case 'n':
case 'a':
case 's':
log_error("-n, -a, and -s have been removed.");
failed = true; break;
// Long options
case 256:
// --config
Expand Down Expand Up @@ -629,10 +624,9 @@
break;
case 305:
// --shadow-exclude-reg
free(opt->shadow_exclude_reg_str);
opt->shadow_exclude_reg_str = strdup(optarg);
log_warn("--shadow-exclude-reg is deprecated. You are likely "
log_error("--shadow-exclude-reg is deprecated. You are likely "

Check warning on line 627 in src/options.c

View check run for this annotation

Codecov / codecov/patch

src/options.c#L627

Added line #L627 was not covered by tests
"better off using --clip-shadow-above anyway");
failed = true;

Check warning on line 629 in src/options.c

View check run for this annotation

Codecov / codecov/patch

src/options.c#L629

Added line #L629 was not covered by tests
break;
case 306:
// --paint-exclude
Expand Down
15 changes: 1 addition & 14 deletions src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,16 +594,6 @@ static void rebuild_screen_reg(session_t *ps) {
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
static void destroy_backend(session_t *ps) {
win_stack_foreach_managed_safe(w, wm_stack_end(ps->wm)) {
Expand Down Expand Up @@ -808,7 +798,6 @@ static void configure_root(session_t *ps) {
free(r);

rebuild_screen_reg(ps);
rebuild_shadow_exclude_reg(ps);

// Invalidate reg_ignore from the top
auto top_w = wm_stack_next_managed(ps->wm, wm_stack_end(ps->wm));
Expand Down Expand Up @@ -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->o.use_damage, ps->o.monitor_repaint, ps->o.force_win_blend,
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.wintype_option, &after_damage_us);
if (!succeeded) {
Expand Down Expand Up @@ -2289,8 +2278,6 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
sum_kernel_preprocess((conv *)ps->shadow_context);
}

rebuild_shadow_exclude_reg(ps);

// Query X Shape
ext_info = xcb_get_extension_data(ps->c.c, &xcb_shape_id);
if (ext_info && ext_info->present) {
Expand Down
5 changes: 0 additions & 5 deletions src/render.c
Original file line number Diff line number Diff line change
Expand Up @@ -1100,11 +1100,6 @@ void paint_all(session_t *ps, struct managed_win *t) {
// of the windows above. Because no one can see it
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)) {
pixman_region32_subtract(&reg_tmp, &reg_tmp, &reg_shadow_clip);
}
Expand Down
15 changes: 5 additions & 10 deletions src/renderer/command_builder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
static inline unsigned
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) {
auto w = layer->win;
if (!w->shadow) {
Expand Down Expand Up @@ -134,9 +134,6 @@ command_for_shadow(struct layer *layer, struct backend_command *cmd,
// Move mask region to screen coordinates for shadow exclusion
// calculation
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) {
pixman_region32_intersect(&cmd->mask.region, &cmd->mask.region,
&monitors->regions[w->randr_monitor]);
Expand Down Expand Up @@ -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
// value in `struct managed_win`.
void command_builder_build(struct command_builder *cb, struct layout *layout,
bool force_blend, bool blur_frame, bool inactive_dim_fixed,
double max_brightness, double inactive_dim,
const region_t *shadow_exclude, const struct x_monitors *monitors,
void command_builder_build(struct command_builder *cb, struct layout *layout, bool force_blend,
bool blur_frame, bool inactive_dim_fixed, double max_brightness,
double inactive_dim, const struct x_monitors *monitors,
const struct win_option *wintype_options) {

unsigned ncmds = 1;
Expand Down Expand Up @@ -402,8 +398,7 @@ void command_builder_build(struct command_builder *cb, struct layout *layout,
inactive_dim, max_brightness);

// Add shadow
cmd -= command_for_shadow(layer, cmd, wintype_options, shadow_exclude,
monitors, last + 1);
cmd -= command_for_shadow(layer, cmd, wintype_options, monitors, last + 1);

// Add blur
cmd -= command_for_blur(layer, cmd, &frame_region, force_blend, blur_frame);
Expand Down
7 changes: 3 additions & 4 deletions src/renderer/command_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// argument of blit), will be store in `struct backend_command::mask`. This might not
/// stay true after further passes.
void command_builder_build(struct command_builder *cb, struct layout *layout,
bool force_blend, bool blur_frame, bool inactive_dim_fixed,
double max_brightness, double inactive_dim,
const region_t *shadow_exclude, const struct x_monitors *monitors,
void command_builder_build(struct command_builder *cb, struct layout *layout, bool force_blend,
bool blur_frame, bool inactive_dim_fixed, double max_brightness,
double inactive_dim, const struct x_monitors *monitors,
const struct win_option *wintype_options);
11 changes: 5 additions & 6 deletions src/renderer/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
image_handle root_image, struct layout_manager *lm,
struct command_builder *cb, void *blur_context,
uint64_t render_start_us, xcb_sync_fence_t xsync_fence, bool use_damage,
bool monitor_repaint, bool force_blend, bool blur_frame,
bool inactive_dim_fixed, double max_brightness, double inactive_dim,
const region_t *shadow_exclude, const struct x_monitors *monitors,
uint64_t render_start_us, xcb_sync_fence_t xsync_fence,
bool use_damage, bool monitor_repaint, bool force_blend,
bool blur_frame, bool inactive_dim_fixed, double max_brightness,
double inactive_dim, const struct x_monitors *monitors,
const struct win_option *wintype_options, uint64_t *after_damage_us) {
if (xsync_fence != XCB_NONE) {
// Trigger the fence but don't immediately wait on it. Let it run
Expand All @@ -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,
max_brightness, inactive_dim, shadow_exclude, monitors,
wintype_options);
max_brightness, inactive_dim, monitors, wintype_options);
if (log_get_level_tls() <= LOG_LEVEL_TRACE) {
auto layer = layout->layers - 1;
auto layer_end = &layout->commands[layout->first_layer_start];
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
image_handle root_image, struct layout_manager *lm,
struct command_builder *cb, void *blur_context,
uint64_t render_start_us, xcb_sync_fence_t xsync_fence, bool use_damage,
bool monitor_repaint, bool force_blend, bool blur_frame,
bool inactive_dim_fixed, double max_brightness, double inactive_dim,
const region_t *shadow_exclude, const struct x_monitors *monitors,
uint64_t render_start_us, xcb_sync_fence_t xsync_fence,
bool use_damage, bool monitor_repaint, bool force_blend,
bool blur_frame, bool inactive_dim_fixed, double max_brightness,
double inactive_dim, const struct x_monitors *monitors,
const struct win_option *wintype_options, uint64_t *after_damage_us);
7 changes: 0 additions & 7 deletions tests/configs/parsing_test.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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.
# 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
# currently implemented using the X RandR extension.
# crop-shadow-to-monitor = false
Expand Down