aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Kenny Levinsen <kl@kl.wtf>2021-01-26 00:13:42 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2021-01-26 10:26:37 +0100
commit4d43f1dd996e61e38d89adf0ad1435dac32e38a5 (patch)
treee59caa9393c0f838d67028f2ac9a5fe7f3202003
parentFix typo in bug reporting template (diff)
downloadsway-4d43f1dd996e61e38d89adf0ad1435dac32e38a5.tar.gz
sway-4d43f1dd996e61e38d89adf0ad1435dac32e38a5.tar.zst
sway-4d43f1dd996e61e38d89adf0ad1435dac32e38a5.zip
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.
-rw-r--r--sway/desktop/output.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 5edc8f96..691a285d 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -816,7 +816,7 @@ static void update_output_manager_config(struct sway_server *server) {
816 struct wlr_box *output_box = wlr_output_layout_get_box( 816 struct wlr_box *output_box = wlr_output_layout_get_box(
817 root->output_layout, output->wlr_output); 817 root->output_layout, output->wlr_output);
818 // We mark the output enabled even if it is switched off by DPMS 818 // We mark the output enabled even if it is switched off by DPMS
819 config_head->state.enabled = output->enabled; 819 config_head->state.enabled = output->current_mode != NULL && output->enabled;
820 config_head->state.mode = output->current_mode; 820 config_head->state.mode = output->current_mode;
821 if (output_box) { 821 if (output_box) {
822 config_head->state.x = output_box->x; 822 config_head->state.x = output_box->x;