2018-10-04 05:14:51 +08:00
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
// Copyright (c) 2012-2014 Richard Grenville <pyxlcy@gmail.com>
|
|
|
|
|
2018-08-22 19:58:49 +08:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include <libgen.h>
|
|
|
|
#include <libconfig.h>
|
2018-12-16 03:44:11 +08:00
|
|
|
#include <basedir_fs.h>
|
2018-08-22 19:58:49 +08:00
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "config.h"
|
2018-12-16 01:42:37 +08:00
|
|
|
#include "string_utils.h"
|
2018-12-16 01:53:17 +08:00
|
|
|
#include "log.h"
|
2018-08-22 19:58:49 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Wrapper of libconfig's <code>config_lookup_int</code>.
|
|
|
|
*
|
2018-10-24 05:12:42 +08:00
|
|
|
* So it takes a pointer to bool.
|
2018-08-22 19:58:49 +08:00
|
|
|
*/
|
2018-10-24 05:12:42 +08:00
|
|
|
static inline int
|
|
|
|
lcfg_lookup_bool(const config_t *config, const char *path, bool *value) {
|
2018-08-22 19:58:49 +08:00
|
|
|
int ival;
|
|
|
|
|
2018-10-24 05:12:42 +08:00
|
|
|
int ret = config_lookup_bool(config, path, &ival);
|
|
|
|
if (ret)
|
2018-08-22 19:58:49 +08:00
|
|
|
*value = ival;
|
|
|
|
|
2018-10-24 05:12:42 +08:00
|
|
|
return ret;
|
2018-08-22 19:58:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a file stream of the configuration file to read.
|
|
|
|
*
|
|
|
|
* Follows the XDG specification to search for the configuration file.
|
|
|
|
*/
|
|
|
|
FILE *
|
|
|
|
open_config_file(char *cpath, char **ppath) {
|
2018-12-16 03:44:11 +08:00
|
|
|
static const char *config_paths[] = {
|
|
|
|
"/compton.conf",
|
|
|
|
"/compton/compton.conf"
|
|
|
|
};
|
|
|
|
static const char config_filename_legacy[] = "/.compton.conf";
|
|
|
|
|
|
|
|
if (cpath) {
|
|
|
|
FILE *ret = fopen(cpath, "r");
|
|
|
|
if (ret && ppath)
|
|
|
|
*ppath = cpath;
|
|
|
|
return ret;
|
2018-08-22 19:58:49 +08:00
|
|
|
}
|
|
|
|
|
2018-12-16 03:44:11 +08:00
|
|
|
for (size_t i = 0; i < ARR_SIZE(config_paths); i++) {
|
|
|
|
char *path = xdgConfigFind(config_paths[i], NULL);
|
|
|
|
FILE *ret = fopen(path, "r");
|
2018-12-16 08:52:37 +08:00
|
|
|
if (ret && ppath) {
|
2018-12-16 03:44:11 +08:00
|
|
|
*ppath = strdup(path);
|
|
|
|
}
|
2018-08-22 19:58:49 +08:00
|
|
|
free(path);
|
2018-12-16 03:44:11 +08:00
|
|
|
if (ret) {
|
|
|
|
return ret;
|
2018-08-22 19:58:49 +08:00
|
|
|
}
|
|
|
|
}
|
2018-12-16 03:44:11 +08:00
|
|
|
|
|
|
|
// Fall back to legacy config file names
|
|
|
|
const char *home = getenv("HOME");
|
|
|
|
if (home && strlen(home)) {
|
|
|
|
auto path = ccalloc(strlen(home)+strlen(config_filename_legacy)+1, char);
|
|
|
|
strcpy(path, home);
|
|
|
|
strcpy(path+strlen(home), config_filename_legacy);
|
|
|
|
FILE *ret = fopen(path, "r");
|
|
|
|
if (ret && ppath)
|
2018-08-22 19:58:49 +08:00
|
|
|
*ppath = path;
|
|
|
|
else
|
|
|
|
free(path);
|
2018-12-16 03:44:11 +08:00
|
|
|
return ret;
|
2018-08-22 19:58:49 +08:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Parse a condition list in configuration file.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
parse_cfg_condlst(session_t *ps, const config_t *pcfg, c2_lptr_t **pcondlst,
|
|
|
|
const char *name) {
|
|
|
|
config_setting_t *setting = config_lookup(pcfg, name);
|
|
|
|
if (setting) {
|
|
|
|
// Parse an array of options
|
|
|
|
if (config_setting_is_array(setting)) {
|
|
|
|
int i = config_setting_length(setting);
|
|
|
|
while (i--)
|
|
|
|
condlst_add(ps, pcondlst, config_setting_get_string_elem(setting, i));
|
|
|
|
}
|
|
|
|
// Treat it as a single pattern if it's a string
|
|
|
|
else if (CONFIG_TYPE_STRING == config_setting_type(setting)) {
|
|
|
|
condlst_add(ps, pcondlst, config_setting_get_string(setting));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Parse an opacity rule list in configuration file.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
parse_cfg_condlst_opct(session_t *ps, const config_t *pcfg, const char *name) {
|
|
|
|
config_setting_t *setting = config_lookup(pcfg, name);
|
|
|
|
if (setting) {
|
|
|
|
// Parse an array of options
|
|
|
|
if (config_setting_is_array(setting)) {
|
|
|
|
int i = config_setting_length(setting);
|
|
|
|
while (i--)
|
|
|
|
if (!parse_rule_opacity(ps, config_setting_get_string_elem(setting,
|
|
|
|
i)))
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
// Treat it as a single pattern if it's a string
|
|
|
|
else if (CONFIG_TYPE_STRING == config_setting_type(setting)) {
|
|
|
|
parse_rule_opacity(ps, config_setting_get_string(setting));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Parse a configuration file from default location.
|
|
|
|
*/
|
2018-12-05 00:28:19 +08:00
|
|
|
void parse_config_libconfig(session_t *ps, bool *shadow_enable,
|
|
|
|
bool *fading_enable, win_option_mask_t *winopt_mask)
|
2018-12-04 21:44:16 +08:00
|
|
|
{
|
2018-08-22 19:58:49 +08:00
|
|
|
char *path = NULL;
|
|
|
|
FILE *f;
|
|
|
|
config_t cfg;
|
|
|
|
int ival = 0;
|
2018-10-24 05:12:42 +08:00
|
|
|
bool bval;
|
2018-08-22 19:58:49 +08:00
|
|
|
double dval = 0.0;
|
|
|
|
// libconfig manages string memory itself, so no need to manually free
|
|
|
|
// anything
|
|
|
|
const char *sval = NULL;
|
|
|
|
|
|
|
|
f = open_config_file(ps->o.config_file, &path);
|
|
|
|
if (!f) {
|
|
|
|
if (ps->o.config_file) {
|
|
|
|
free(ps->o.config_file);
|
|
|
|
ps->o.config_file = NULL;
|
2018-12-21 01:35:45 +08:00
|
|
|
|
|
|
|
log_fatal("Failed to read configuration file \"%s\".", ps->o.config_file);
|
|
|
|
abort();
|
2018-08-22 19:58:49 +08:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
config_init(&cfg);
|
|
|
|
{
|
|
|
|
// dirname() could modify the original string, thus we must pass a
|
|
|
|
// copy
|
2018-12-16 03:07:14 +08:00
|
|
|
char *path2 = strdup(path);
|
2018-08-22 19:58:49 +08:00
|
|
|
char *parent = dirname(path2);
|
|
|
|
|
|
|
|
if (parent)
|
|
|
|
config_set_include_dir(&cfg, parent);
|
|
|
|
|
|
|
|
free(path2);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
int read_result = config_read(&cfg, f);
|
|
|
|
fclose(f);
|
|
|
|
f = NULL;
|
2018-12-16 03:44:11 +08:00
|
|
|
if (read_result == CONFIG_FALSE) {
|
2018-12-21 01:35:45 +08:00
|
|
|
log_error("Error when reading configuration file \"%s\", line %d: %s",
|
|
|
|
path, config_error_line(&cfg), config_error_text(&cfg));
|
2018-08-22 19:58:49 +08:00
|
|
|
config_destroy(&cfg);
|
|
|
|
free(path);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
config_set_auto_convert(&cfg, 1);
|
|
|
|
|
|
|
|
if (path != ps->o.config_file) {
|
2018-12-16 03:44:11 +08:00
|
|
|
assert(ps->o.config_file == NULL);
|
2018-08-22 19:58:49 +08:00
|
|
|
ps->o.config_file = path;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get options from the configuration file. We don't do range checking
|
|
|
|
// right now. It will be done later
|
|
|
|
|
|
|
|
// -D (fade_delta)
|
2018-10-24 05:12:42 +08:00
|
|
|
if (config_lookup_int(&cfg, "fade-delta", &ival))
|
2018-08-22 19:58:49 +08:00
|
|
|
ps->o.fade_delta = ival;
|
|
|
|
// -I (fade_in_step)
|
|
|
|
if (config_lookup_float(&cfg, "fade-in-step", &dval))
|
|
|
|
ps->o.fade_in_step = normalize_d(dval) * OPAQUE;
|
|
|
|
// -O (fade_out_step)
|
|
|
|
if (config_lookup_float(&cfg, "fade-out-step", &dval))
|
|
|
|
ps->o.fade_out_step = normalize_d(dval) * OPAQUE;
|
|
|
|
// -r (shadow_radius)
|
2018-10-24 05:12:42 +08:00
|
|
|
config_lookup_int(&cfg, "shadow-radius", &ps->o.shadow_radius);
|
2018-08-22 19:58:49 +08:00
|
|
|
// -o (shadow_opacity)
|
|
|
|
config_lookup_float(&cfg, "shadow-opacity", &ps->o.shadow_opacity);
|
|
|
|
// -l (shadow_offset_x)
|
2018-10-24 05:12:42 +08:00
|
|
|
config_lookup_int(&cfg, "shadow-offset-x", &ps->o.shadow_offset_x);
|
2018-08-22 19:58:49 +08:00
|
|
|
// -t (shadow_offset_y)
|
2018-10-24 05:12:42 +08:00
|
|
|
config_lookup_int(&cfg, "shadow-offset-y", &ps->o.shadow_offset_y);
|
2018-08-22 19:58:49 +08:00
|
|
|
// -i (inactive_opacity)
|
|
|
|
if (config_lookup_float(&cfg, "inactive-opacity", &dval))
|
|
|
|
ps->o.inactive_opacity = normalize_d(dval) * OPAQUE;
|
|
|
|
// --active_opacity
|
|
|
|
if (config_lookup_float(&cfg, "active-opacity", &dval))
|
|
|
|
ps->o.active_opacity = normalize_d(dval) * OPAQUE;
|
|
|
|
// -e (frame_opacity)
|
|
|
|
config_lookup_float(&cfg, "frame-opacity", &ps->o.frame_opacity);
|
|
|
|
// -c (shadow_enable)
|
2018-12-04 21:44:16 +08:00
|
|
|
if (config_lookup_bool(&cfg, "shadow", &ival))
|
|
|
|
*shadow_enable = ival;
|
2018-08-22 19:58:49 +08:00
|
|
|
// -C (no_dock_shadow)
|
2018-12-04 21:44:16 +08:00
|
|
|
if (config_lookup_bool(&cfg, "no-dock-shadow", &ival)) {
|
2018-12-21 01:35:45 +08:00
|
|
|
log_warn("Option `no-dock-shadow` is deprecated, and will be removed."
|
|
|
|
" Please use the wintype option `shadow` of `dock` instead.");
|
2018-12-04 21:44:16 +08:00
|
|
|
ps->o.wintype_option[WINTYPE_DOCK].shadow = false;
|
|
|
|
winopt_mask[WINTYPE_DOCK].shadow = true;
|
|
|
|
}
|
2018-08-22 19:58:49 +08:00
|
|
|
// -G (no_dnd_shadow)
|
2018-12-04 21:44:16 +08:00
|
|
|
if (config_lookup_bool(&cfg, "no-dnd-shadow", &ival)) {
|
2018-12-21 01:35:45 +08:00
|
|
|
log_warn("Option `no-dnd-shadow` is deprecated, and will be removed."
|
|
|
|
" Please use the wintype option `shadow` of `dnd` instead.");
|
2018-12-04 21:44:16 +08:00
|
|
|
ps->o.wintype_option[WINTYPE_DND].shadow = false;
|
|
|
|
winopt_mask[WINTYPE_DND].shadow = true;
|
|
|
|
};
|
2018-08-22 19:58:49 +08:00
|
|
|
// -m (menu_opacity)
|
2018-12-04 21:44:16 +08:00
|
|
|
if (config_lookup_float(&cfg, "menu-opacity", &dval)) {
|
2018-12-21 01:35:45 +08:00
|
|
|
log_warn("Option `menu-opacity` is deprecated, and will be removed.Please use the "
|
|
|
|
"wintype option `opacity` of `popup_menu` and `dropdown_menu` instead.");
|
2018-12-04 21:44:16 +08:00
|
|
|
ps->o.wintype_option[WINTYPE_DROPDOWN_MENU].opacity = dval;
|
|
|
|
ps->o.wintype_option[WINTYPE_POPUP_MENU].opacity = dval;
|
|
|
|
winopt_mask[WINTYPE_DROPDOWN_MENU].opacity = true;
|
|
|
|
winopt_mask[WINTYPE_POPUP_MENU].opacity = true;
|
|
|
|
}
|
2018-08-22 19:58:49 +08:00
|
|
|
// -f (fading_enable)
|
2018-12-04 21:44:16 +08:00
|
|
|
if (config_lookup_bool(&cfg, "fading", &ival))
|
|
|
|
*fading_enable = ival;
|
2018-08-22 19:58:49 +08:00
|
|
|
// --no-fading-open-close
|
|
|
|
lcfg_lookup_bool(&cfg, "no-fading-openclose", &ps->o.no_fading_openclose);
|
|
|
|
// --no-fading-destroyed-argb
|
|
|
|
lcfg_lookup_bool(&cfg, "no-fading-destroyed-argb",
|
|
|
|
&ps->o.no_fading_destroyed_argb);
|
|
|
|
// --shadow-red
|
|
|
|
config_lookup_float(&cfg, "shadow-red", &ps->o.shadow_red);
|
|
|
|
// --shadow-green
|
|
|
|
config_lookup_float(&cfg, "shadow-green", &ps->o.shadow_green);
|
|
|
|
// --shadow-blue
|
|
|
|
config_lookup_float(&cfg, "shadow-blue", &ps->o.shadow_blue);
|
|
|
|
// --shadow-exclude-reg
|
Convert XfixesRegion to pixman region
Re-did the painting logic, and document it.
It is unclear to me what is the previous painting logic. But the current
one is basically this:
1. Go through all windows top to bottom, and put visible windows (not
unmapped, opacity > 0, etc) into a linked list, from bottom to top
2. Accumulate a region of ignore on each window, which is basically the
region of screen that is obscured by all the windows above current
one.
3. Paint all the visible windows from bottom to top. Subtract the region
of ignore from the painting region. If we need to paint shadow, we
subtract the body of the window from the shadow painting region too,
because we don't want shadow behind the window.
4. region of ignore is invalidated when window stack change, an
window on top moved or changed shape, when window changed between
opaque and transparent, etc.
Notes:
It is unclear whether all the different shapes of a window (extents,
noframe, border, bounding shape, etc) are calculated correctly or not.
It is unclear if window shape related events are handled correctly or
not. Need more testing.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 11:56:00 +08:00
|
|
|
if (config_lookup_string(&cfg, "shadow-exclude-reg", &sval))
|
|
|
|
ps->o.shadow_exclude_reg_str = strdup(sval);
|
2018-08-22 19:58:49 +08:00
|
|
|
// --inactive-opacity-override
|
|
|
|
lcfg_lookup_bool(&cfg, "inactive-opacity-override",
|
|
|
|
&ps->o.inactive_opacity_override);
|
|
|
|
// --inactive-dim
|
|
|
|
config_lookup_float(&cfg, "inactive-dim", &ps->o.inactive_dim);
|
|
|
|
// --mark-wmwin-focused
|
|
|
|
lcfg_lookup_bool(&cfg, "mark-wmwin-focused", &ps->o.mark_wmwin_focused);
|
|
|
|
// --mark-ovredir-focused
|
|
|
|
lcfg_lookup_bool(&cfg, "mark-ovredir-focused",
|
|
|
|
&ps->o.mark_ovredir_focused);
|
|
|
|
// --shadow-ignore-shaped
|
|
|
|
lcfg_lookup_bool(&cfg, "shadow-ignore-shaped",
|
|
|
|
&ps->o.shadow_ignore_shaped);
|
|
|
|
// --detect-rounded-corners
|
|
|
|
lcfg_lookup_bool(&cfg, "detect-rounded-corners",
|
|
|
|
&ps->o.detect_rounded_corners);
|
|
|
|
// --xinerama-shadow-crop
|
|
|
|
lcfg_lookup_bool(&cfg, "xinerama-shadow-crop",
|
|
|
|
&ps->o.xinerama_shadow_crop);
|
|
|
|
// --detect-client-opacity
|
|
|
|
lcfg_lookup_bool(&cfg, "detect-client-opacity",
|
|
|
|
&ps->o.detect_client_opacity);
|
|
|
|
// --refresh-rate
|
2018-10-24 05:12:42 +08:00
|
|
|
config_lookup_int(&cfg, "refresh-rate", &ps->o.refresh_rate);
|
2018-08-22 19:58:49 +08:00
|
|
|
// --vsync
|
2018-12-21 01:35:45 +08:00
|
|
|
if (config_lookup_string(&cfg, "vsync", &sval) && !parse_vsync(ps, sval)) {
|
|
|
|
log_fatal("Cannot parse vsync");
|
2018-08-22 19:58:49 +08:00
|
|
|
exit(1);
|
2018-12-21 01:35:45 +08:00
|
|
|
}
|
2018-08-22 19:58:49 +08:00
|
|
|
// --backend
|
2018-12-21 01:35:45 +08:00
|
|
|
if (config_lookup_string(&cfg, "backend", &sval) && !parse_backend(ps, sval)) {
|
|
|
|
log_fatal("Cannot parse backend");
|
2018-08-22 19:58:49 +08:00
|
|
|
exit(1);
|
2018-12-21 01:35:45 +08:00
|
|
|
}
|
2018-12-20 09:21:51 +08:00
|
|
|
// --log-level
|
|
|
|
if (config_lookup_string(&cfg, "log-level", &sval)) {
|
|
|
|
auto level = string_to_log_level(sval);
|
|
|
|
if (level == LOG_LEVEL_INVALID) {
|
|
|
|
log_warn("Invalid log level, defaults to WARN");
|
|
|
|
} else {
|
|
|
|
log_set_level_tls(level);
|
|
|
|
}
|
|
|
|
}
|
2018-08-22 19:58:49 +08:00
|
|
|
// --sw-opti
|
|
|
|
lcfg_lookup_bool(&cfg, "sw-opti", &ps->o.sw_opti);
|
|
|
|
// --use-ewmh-active-win
|
|
|
|
lcfg_lookup_bool(&cfg, "use-ewmh-active-win",
|
|
|
|
&ps->o.use_ewmh_active_win);
|
|
|
|
// --unredir-if-possible
|
|
|
|
lcfg_lookup_bool(&cfg, "unredir-if-possible",
|
|
|
|
&ps->o.unredir_if_possible);
|
|
|
|
// --unredir-if-possible-delay
|
2018-10-24 05:12:42 +08:00
|
|
|
if (config_lookup_int(&cfg, "unredir-if-possible-delay", &ival))
|
2018-08-22 19:58:49 +08:00
|
|
|
ps->o.unredir_if_possible_delay = ival;
|
|
|
|
// --inactive-dim-fixed
|
|
|
|
lcfg_lookup_bool(&cfg, "inactive-dim-fixed", &ps->o.inactive_dim_fixed);
|
|
|
|
// --detect-transient
|
|
|
|
lcfg_lookup_bool(&cfg, "detect-transient", &ps->o.detect_transient);
|
|
|
|
// --detect-client-leader
|
|
|
|
lcfg_lookup_bool(&cfg, "detect-client-leader",
|
|
|
|
&ps->o.detect_client_leader);
|
|
|
|
// --shadow-exclude
|
|
|
|
parse_cfg_condlst(ps, &cfg, &ps->o.shadow_blacklist, "shadow-exclude");
|
|
|
|
// --fade-exclude
|
|
|
|
parse_cfg_condlst(ps, &cfg, &ps->o.fade_blacklist, "fade-exclude");
|
|
|
|
// --focus-exclude
|
|
|
|
parse_cfg_condlst(ps, &cfg, &ps->o.focus_blacklist, "focus-exclude");
|
|
|
|
// --invert-color-include
|
|
|
|
parse_cfg_condlst(ps, &cfg, &ps->o.invert_color_list, "invert-color-include");
|
|
|
|
// --blur-background-exclude
|
|
|
|
parse_cfg_condlst(ps, &cfg, &ps->o.blur_background_blacklist, "blur-background-exclude");
|
|
|
|
// --opacity-rule
|
|
|
|
parse_cfg_condlst_opct(ps, &cfg, "opacity-rule");
|
|
|
|
// --unredir-if-possible-exclude
|
|
|
|
parse_cfg_condlst(ps, &cfg, &ps->o.unredir_if_possible_blacklist, "unredir-if-possible-exclude");
|
|
|
|
// --blur-background
|
|
|
|
lcfg_lookup_bool(&cfg, "blur-background", &ps->o.blur_background);
|
|
|
|
// --blur-background-frame
|
|
|
|
lcfg_lookup_bool(&cfg, "blur-background-frame",
|
|
|
|
&ps->o.blur_background_frame);
|
|
|
|
// --blur-background-fixed
|
|
|
|
lcfg_lookup_bool(&cfg, "blur-background-fixed",
|
|
|
|
&ps->o.blur_background_fixed);
|
|
|
|
// --blur-kern
|
|
|
|
if (config_lookup_string(&cfg, "blur-kern", &sval)
|
2018-12-21 01:35:45 +08:00
|
|
|
&& !parse_conv_kern_lst(ps, sval, ps->o.blur_kerns, MAX_BLUR_PASS)) {
|
|
|
|
log_fatal("Cannot parse \"blur-kern\"");
|
2018-08-22 19:58:49 +08:00
|
|
|
exit(1);
|
2018-12-21 01:35:45 +08:00
|
|
|
}
|
2018-08-22 19:58:49 +08:00
|
|
|
// --resize-damage
|
2018-10-24 05:12:42 +08:00
|
|
|
config_lookup_int(&cfg, "resize-damage", &ps->o.resize_damage);
|
2018-08-22 19:58:49 +08:00
|
|
|
// --glx-no-stencil
|
|
|
|
lcfg_lookup_bool(&cfg, "glx-no-stencil", &ps->o.glx_no_stencil);
|
|
|
|
// --glx-no-rebind-pixmap
|
|
|
|
lcfg_lookup_bool(&cfg, "glx-no-rebind-pixmap", &ps->o.glx_no_rebind_pixmap);
|
|
|
|
// --glx-swap-method
|
2018-12-21 01:35:45 +08:00
|
|
|
if (config_lookup_string(&cfg, "glx-swap-method", &sval) &&
|
|
|
|
!parse_glx_swap_method(ps, sval)) {
|
|
|
|
log_fatal("Cannot parse \"glx-swap-method\"");
|
2018-08-22 19:58:49 +08:00
|
|
|
exit(1);
|
2018-12-21 01:35:45 +08:00
|
|
|
}
|
2018-08-22 19:58:49 +08:00
|
|
|
// --glx-use-gpushader4
|
|
|
|
lcfg_lookup_bool(&cfg, "glx-use-gpushader4", &ps->o.glx_use_gpushader4);
|
2018-11-08 22:53:13 +08:00
|
|
|
// --xrender-sync
|
|
|
|
lcfg_lookup_bool(&cfg, "xrender-sync", &ps->o.xrender_sync);
|
|
|
|
// --xrender-sync-fence
|
|
|
|
lcfg_lookup_bool(&cfg, "xrender-sync-fence", &ps->o.xrender_sync_fence);
|
2018-10-24 05:12:42 +08:00
|
|
|
|
|
|
|
if (lcfg_lookup_bool(&cfg, "clear-shadow", &bval))
|
2018-12-21 01:35:45 +08:00
|
|
|
log_warn("\"clear-shadow\" is removed as an option, and is always"
|
|
|
|
" enabled now. Consider removing it from your config file");
|
2018-11-03 22:04:18 +08:00
|
|
|
if (lcfg_lookup_bool(&cfg, "paint-on-overlay", &bval))
|
2018-12-21 01:35:45 +08:00
|
|
|
log_warn("\"paint-on-overlay\" has been removed as an option, and "
|
|
|
|
"is enabled whenever possible");
|
2018-10-24 05:12:42 +08:00
|
|
|
|
2018-11-10 20:48:36 +08:00
|
|
|
if (config_lookup_float(&cfg, "alpha-step", &dval))
|
2018-12-21 01:35:45 +08:00
|
|
|
log_warn("\"alpha-step\" has been removed, compton now tries to make use"
|
|
|
|
" of all alpha values");
|
2018-11-10 20:48:36 +08:00
|
|
|
|
2018-10-24 05:12:42 +08:00
|
|
|
const char *deprecation_message = "has been removed. If you encounter problems "
|
2018-11-10 20:48:36 +08:00
|
|
|
"without this feature, please feel free to open a bug report";
|
2018-10-24 05:12:42 +08:00
|
|
|
if (lcfg_lookup_bool(&cfg, "glx-use-copysubbuffermesa", &bval) && bval)
|
2018-12-21 01:35:45 +08:00
|
|
|
log_warn("\"glx-use-copysubbuffermesa\" %s", deprecation_message);
|
2018-10-24 05:12:42 +08:00
|
|
|
if (lcfg_lookup_bool(&cfg, "glx-copy-from-front", &bval) && bval)
|
2018-12-21 01:35:45 +08:00
|
|
|
log_warn("\"glx-copy-from-front\" %s", deprecation_message);
|
2018-10-24 05:12:42 +08:00
|
|
|
|
2018-08-22 19:58:49 +08:00
|
|
|
// Wintype settings
|
|
|
|
|
2018-11-10 03:56:05 +08:00
|
|
|
// XXX ! Refactor all the wintype_* arrays into a struct
|
2018-08-22 19:58:49 +08:00
|
|
|
for (wintype_t i = 0; i < NUM_WINTYPES; ++i) {
|
|
|
|
char *str = mstrjoin("wintypes.", WINTYPES[i]);
|
|
|
|
config_setting_t *setting = config_lookup(&cfg, str);
|
|
|
|
free(str);
|
2018-12-04 21:44:16 +08:00
|
|
|
|
|
|
|
win_option_t *o = &ps->o.wintype_option[i];
|
|
|
|
win_option_mask_t *mask = &winopt_mask[i];
|
2018-08-22 19:58:49 +08:00
|
|
|
if (setting) {
|
2018-12-04 21:44:16 +08:00
|
|
|
if (config_setting_lookup_bool(setting, "shadow", &ival)) {
|
|
|
|
o->shadow = ival;
|
|
|
|
mask->shadow = true;
|
|
|
|
}
|
|
|
|
if (config_setting_lookup_bool(setting, "fade", &ival)) {
|
|
|
|
o->fade = ival;
|
|
|
|
mask->fade = true;
|
|
|
|
}
|
|
|
|
if (config_setting_lookup_bool(setting, "focus", &ival)) {
|
|
|
|
o->focus = ival;
|
|
|
|
mask->focus = true;
|
|
|
|
}
|
|
|
|
if (config_setting_lookup_bool(setting, "full-shadow", &ival)) {
|
|
|
|
o->full_shadow = ival;
|
|
|
|
mask->full_shadow = true;
|
|
|
|
}
|
2018-12-04 23:30:07 +08:00
|
|
|
if (config_setting_lookup_bool(setting, "redir-ignore", &ival)) {
|
|
|
|
o->redir_ignore = ival;
|
|
|
|
mask->redir_ignore = true;
|
|
|
|
}
|
2018-08-22 19:58:49 +08:00
|
|
|
|
|
|
|
double fval;
|
2018-12-04 21:44:16 +08:00
|
|
|
if (config_setting_lookup_float(setting, "opacity", &fval)) {
|
|
|
|
o->opacity = normalize_d(fval);
|
|
|
|
mask->opacity = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-22 19:58:49 +08:00
|
|
|
config_destroy(&cfg);
|
|
|
|
}
|