config/output: Always set all output fields on finalize

This commit is contained in:
Kenny Levinsen 2024-10-17 01:08:54 +02:00
parent 7e0c0dda42
commit af0d4a048a

View file

@ -520,24 +520,23 @@ static bool finalize_output_config(struct output_config *oc, struct sway_output
return true; return true;
} }
if (oc) { enum scale_filter_mode scale_filter_old = output->scale_filter;
enum scale_filter_mode scale_filter_old = output->scale_filter; enum scale_filter_mode scale_filter_new = oc ? oc->scale_filter : SCALE_FILTER_DEFAULT;
switch (oc->scale_filter) { switch (scale_filter_new) {
case SCALE_FILTER_DEFAULT: case SCALE_FILTER_DEFAULT:
case SCALE_FILTER_SMART: case SCALE_FILTER_SMART:
output->scale_filter = ceilf(wlr_output->scale) == wlr_output->scale ? output->scale_filter = ceilf(wlr_output->scale) == wlr_output->scale ?
SCALE_FILTER_NEAREST : SCALE_FILTER_LINEAR; SCALE_FILTER_NEAREST : SCALE_FILTER_LINEAR;
break; break;
case SCALE_FILTER_LINEAR: case SCALE_FILTER_LINEAR:
case SCALE_FILTER_NEAREST: case SCALE_FILTER_NEAREST:
output->scale_filter = oc->scale_filter; output->scale_filter = scale_filter_new;
break; break;
} }
if (scale_filter_old != output->scale_filter) { if (scale_filter_old != output->scale_filter) {
sway_log(SWAY_DEBUG, "Set %s scale_filter to %s", oc->name, sway_log(SWAY_DEBUG, "Set %s scale_filter to %s", oc->name,
sway_output_scale_filter_to_string(output->scale_filter)); sway_output_scale_filter_to_string(output->scale_filter));
wlr_damage_ring_add_whole(&output->scene_output->damage_ring); wlr_damage_ring_add_whole(&output->scene_output->damage_ring);
}
} }
// Find position for it // Find position for it
@ -560,25 +559,19 @@ static bool finalize_output_config(struct output_config *oc, struct sway_output
output_enable(output); output_enable(output);
} }
if (oc && oc->max_render_time >= 0) {
sway_log(SWAY_DEBUG, "Set %s max render time to %d",
oc->name, oc->max_render_time);
output->max_render_time = oc->max_render_time;
}
if (oc && oc->set_color_transform) { if (oc && oc->set_color_transform) {
if (oc->color_transform) { if (oc->color_transform) {
wlr_color_transform_ref(oc->color_transform); wlr_color_transform_ref(oc->color_transform);
} }
wlr_color_transform_unref(output->color_transform); wlr_color_transform_unref(output->color_transform);
output->color_transform = oc->color_transform; output->color_transform = oc->color_transform;
} else {
wlr_color_transform_unref(output->color_transform);
output->color_transform = NULL;
} }
if (oc && oc->allow_tearing >= 0) { output->max_render_time = oc && oc->max_render_time > 0 ? oc->max_render_time : 0;
sway_log(SWAY_DEBUG, "Set %s allow tearing to %d", output->allow_tearing = oc && oc->allow_tearing > 0;
oc->name, oc->allow_tearing);
output->allow_tearing = oc->allow_tearing;
}
return true; return true;
} }