use config functions
This commit is contained in:
parent
f37b1f19b9
commit
783ceb7937
3 changed files with 8 additions and 14 deletions
|
@ -767,6 +767,8 @@ int config_get_blur_size();
|
||||||
|
|
||||||
bool config_should_parameters_blur();
|
bool config_should_parameters_blur();
|
||||||
|
|
||||||
|
bool config_should_parameters_shadow();
|
||||||
|
|
||||||
/* Global config singleton. */
|
/* Global config singleton. */
|
||||||
extern struct sway_config *config;
|
extern struct sway_config *config;
|
||||||
|
|
||||||
|
|
|
@ -1101,3 +1101,7 @@ int config_get_blur_size() {
|
||||||
bool config_should_parameters_blur() {
|
bool config_should_parameters_blur() {
|
||||||
return config->blur_params.radius > 0 && config->blur_params.num_passes > 0;
|
return config->blur_params.radius > 0 && config->blur_params.num_passes > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool config_should_parameters_shadow() {
|
||||||
|
return config->shadow_blur_sigma > 0 && config->shadow_color[3] > 0.0;
|
||||||
|
}
|
||||||
|
|
|
@ -45,18 +45,6 @@ struct decoration_data get_undecorated_decoration_data() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_blur_size() {
|
|
||||||
return pow(2, config->blur_params.num_passes) * config->blur_params.radius;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool should_parameters_blur() {
|
|
||||||
return config->blur_params.radius > 0 && config->blur_params.num_passes > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool should_parameters_shadow() {
|
|
||||||
return config->shadow_blur_sigma > 0 && config->shadow_color[3] > 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: contribute wlroots function to allow creating an fbox from a box?
|
// TODO: contribute wlroots function to allow creating an fbox from a box?
|
||||||
struct wlr_fbox wlr_fbox_from_wlr_box(struct wlr_box *box) {
|
struct wlr_fbox wlr_fbox_from_wlr_box(struct wlr_box *box) {
|
||||||
return (struct wlr_fbox) {
|
return (struct wlr_fbox) {
|
||||||
|
@ -471,7 +459,7 @@ static void render_surface_iterator(struct sway_output *output,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// render blur
|
// render blur
|
||||||
if (deco_data.blur && should_parameters_blur() && !is_subsurface) {
|
if (deco_data.blur && config_should_parameters_blur() && !is_subsurface) {
|
||||||
pixman_region32_t opaque_region;
|
pixman_region32_t opaque_region;
|
||||||
pixman_region32_init(&opaque_region);
|
pixman_region32_init(&opaque_region);
|
||||||
|
|
||||||
|
@ -523,7 +511,7 @@ static void render_layer_iterator(struct sway_output *output,
|
||||||
bool is_subsurface = view ? view->surface != surface : false;
|
bool is_subsurface = view ? view->surface != surface : false;
|
||||||
|
|
||||||
// render shadow
|
// render shadow
|
||||||
if (deco_data.shadow && should_parameters_shadow() && !is_subsurface) {
|
if (deco_data.shadow && config_should_parameters_shadow() && !is_subsurface) {
|
||||||
int corner_radius = deco_data.corner_radius;
|
int corner_radius = deco_data.corner_radius;
|
||||||
render_box_shadow(output, output_damage, &dst_box, config->shadow_color,
|
render_box_shadow(output, output_damage, &dst_box, config->shadow_color,
|
||||||
config->shadow_blur_sigma, corner_radius);
|
config->shadow_blur_sigma, corner_radius);
|
||||||
|
|
Loading…
Add table
Reference in a new issue