From 6f59367c0076266b8efa97f90dfc5b1c932f4120 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 23 Sep 2018 23:52:55 +0100 Subject: [PATCH] Remove the clear-shadow option Shadows attached to ARGB/transparent windows are always cleared now. --- man/compton.1.asciidoc | 3 --- src/common.h | 1 - src/compton.c | 7 ++++--- src/config_libconfig.c | 2 -- src/dbus.c | 18 ++++++++---------- 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/man/compton.1.asciidoc b/man/compton.1.asciidoc index 23d4542..b8e3f3f 100644 --- a/man/compton.1.asciidoc +++ b/man/compton.1.asciidoc @@ -59,9 +59,6 @@ OPTIONS *-C*, *--no-dock-shadow*:: Avoid drawing shadows on dock/panel windows. -*-z*, *--clear-shadow*:: - Zero the part of the shadow's mask behind the window. Note this may not work properly on ARGB windows with fully transparent areas. - *-f*, *--fading*:: Fade windows in/out when opening/closing and when opacity changes, unless *--no-fading-openclose* is used. diff --git a/src/common.h b/src/common.h index 62ee1f8..67f0b9f 100644 --- a/src/common.h +++ b/src/common.h @@ -625,7 +625,6 @@ typedef struct _options_t { int shadow_radius; int shadow_offset_x, shadow_offset_y; double shadow_opacity; - bool clear_shadow; /// Geometry of a region in which shadow is not painted on. geometry_t shadow_exclude_reg_geom; /// Shadow blacklist. A linked list of conditions. diff --git a/src/compton.c b/src/compton.c index 7c34ffa..d2b1f4c 100644 --- a/src/compton.c +++ b/src/compton.c @@ -1808,7 +1808,7 @@ paint_all(session_t *ps, XserverRegion region, XserverRegion region_real, win *t // Clear the shadow here instead of in make_shadow() for saving GPU // power and handling shaped windows - if (ps->o.clear_shadow && w->border_size) + if (w->mode != WMODE_SOLID && w->border_size) XFixesSubtractRegion(ps->dpy, reg_paint, reg_paint, w->border_size); #ifdef CONFIG_XINERAMA @@ -4037,7 +4037,9 @@ get_cfg(session_t *ps, int argc, char *const *argv, bool first_pass) { case 'e': ps->o.frame_opacity = atof(optarg); break; - P_CASEBOOL('z', clear_shadow); + case 'z': + printf_errf("(): clear-shadow is removed, shadows are automatically cleared now."); + break; case 'n': case 'a': case 's': @@ -5159,7 +5161,6 @@ session_init(session_t *ps_old, int argc, char **argv) { .shadow_offset_x = -15, .shadow_offset_y = -15, .shadow_opacity = .75, - .clear_shadow = false, .shadow_blacklist = NULL, .shadow_ignore_shaped = false, .respect_prop_shadow = false, diff --git a/src/config_libconfig.c b/src/config_libconfig.c index f16dfb0..864d302 100644 --- a/src/config_libconfig.c +++ b/src/config_libconfig.c @@ -245,8 +245,6 @@ parse_config(session_t *ps, struct options_tmp *pcfgtmp) { ps->o.active_opacity = normalize_d(dval) * OPAQUE; // -e (frame_opacity) config_lookup_float(&cfg, "frame-opacity", &ps->o.frame_opacity); - // -z (clear_shadow) - lcfg_lookup_bool(&cfg, "clear-shadow", &ps->o.clear_shadow); // -c (shadow_enable) if (config_lookup_bool(&cfg, "shadow", &ival) && ival) wintype_arr_enable(ps->o.wintype_shadow); diff --git a/src/dbus.c b/src/dbus.c index d760011..7b1ec74 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -888,6 +888,12 @@ cdbus_process_opts_get(session_t *ps, DBusMessage *msg) { return true; \ } +#define cdbus_m_opts_get_stub(tgt, apdarg_func, ret) \ + if (!strcmp(MSTR(tgt), target)) { \ + apdarg_func(ps, msg, ret); \ + return true; \ + } + // version if (!strcmp("version", target)) { cdbus_reply_string(ps, msg, COMPTON_VERSION); @@ -948,7 +954,7 @@ cdbus_process_opts_get(session_t *ps, DBusMessage *msg) { cdbus_m_opts_get_do(shadow_offset_x, cdbus_reply_int32); cdbus_m_opts_get_do(shadow_offset_y, cdbus_reply_int32); cdbus_m_opts_get_do(shadow_opacity, cdbus_reply_double); - cdbus_m_opts_get_do(clear_shadow, cdbus_reply_bool); + cdbus_m_opts_get_stub(clear_shadow, cdbus_reply_bool, true); cdbus_m_opts_get_do(xinerama_shadow_crop, cdbus_reply_bool); cdbus_m_opts_get_do(fade_delta, cdbus_reply_int32); @@ -1054,16 +1060,8 @@ cdbus_process_opts_set(session_t *ps, DBusMessage *msg) { } // clear_shadow - if (!strcmp("clear_shadow", target)) { - dbus_bool_t val = FALSE; - if (!cdbus_msg_get_arg(msg, 1, DBUS_TYPE_BOOLEAN, &val)) - return false; - if (ps->o.clear_shadow != val) { - ps->o.clear_shadow = val; - force_repaint(ps); - } + if (!strcmp("clear_shadow", target)) goto cdbus_process_opts_set_success; - } // track_focus if (!strcmp("track_focus", target)) {