backend: allow transparent windows to clip other windows

Transparent windows usually blends on top of other windows, this commit
adds an option to make transparent windows clip other windows like
non-transparent windows do.

Closes #265

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2019-11-30 21:24:22 +00:00
parent 7040579a38
commit 6a3d1354be
6 changed files with 53 additions and 5 deletions

View File

@ -321,7 +321,11 @@ static void usage(const char *argv0, int ret) {
"\n"
"--no-ewmh-fullscreen\n"
" Do not use EWMH to detect fullscreen windows. Reverts to checking\n"
" if a window is fullscreen based only on its size and coordinates.\n";
" if a window is fullscreen based only on its size and coordinates.\n"
"\n"
"--transparent-clipping\n"
" Make transparent windows clip other windows like non-transparent windows\n"
" do, instead of blending on top of them\n";
FILE *f = (ret ? stderr : stdout);
fprintf(f, usage_text, argv0);
#undef WARNING_DISABLED
@ -417,6 +421,7 @@ static const struct option longopts[] = {
{"no-use-damage", no_argument, NULL, 324},
{"no-vsync", no_argument, NULL, 325},
{"max-brightness", required_argument, NULL, 326},
{"transparent-clipping", no_argument, NULL, 327},
{"experimental-backends", no_argument, NULL, 733},
{"monitor-repaint", no_argument, NULL, 800},
{"diagnostics", no_argument, NULL, 801},
@ -802,6 +807,7 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
case 326:
opt->max_brightness = atof(optarg);
break;
P_CASEBOOL(327, transparent_clipping);
P_CASEBOOL(733, experimental_backends);
P_CASEBOOL(800, monitor_repaint);
@ -835,6 +841,12 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
return false;
}
if (opt->transparent_clipping && !opt->experimental_backends) {
log_error("Transparent clipping only works with the experimental "
"backends");
return false;
}
// Range checking and option assignments
opt->fade_delta = max2(opt->fade_delta, 1);
opt->shadow_radius = max2(opt->shadow_radius, 0);