1
1
mirror of https://github.com/swaywm/sway synced 2024-11-23 17:32:40 +01:00

desktop/output: Disable head if mode is NULL

wlr_output_configuration_head_v1_create normally fills out the head
"enabled" field to match the wlr_output state. We overwrite this to also
set the head as enabled if it is only turned off with DPMS.

However, in some cases we may not have a mode for this display, in which
case setting it as enabled will lead to a segfault later on. Therefore,
enabled conditional on the presence of a mode.
This commit is contained in:
Kenny Levinsen 2021-01-26 00:13:42 +01:00 committed by Simon Ser
parent ac7c81e3b9
commit 4d43f1dd99

@ -816,7 +816,7 @@ static void update_output_manager_config(struct sway_server *server) {
struct wlr_box *output_box = wlr_output_layout_get_box(
root->output_layout, output->wlr_output);
// We mark the output enabled even if it is switched off by DPMS
config_head->state.enabled = output->enabled;
config_head->state.enabled = output->current_mode != NULL && output->enabled;
config_head->state.mode = output->current_mode;
if (output_box) {
config_head->state.x = output_box->x;