From 28b9ed6eb31015381a588a41c3878746fe0de2db Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 27 Apr 2011 10:18:46 +0200 Subject: [PATCH] Bugfix: Ensure that all outputs have a ->con before handling disabled outputs (Thanks JimdiGriz) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Steps to reproduce: • xrandr --output VGA1 --auto • xrandr --output LVDS1 --off --- src/randr.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/randr.c b/src/randr.c index 0c702db0..0c43670d 100644 --- a/src/randr.c +++ b/src/randr.c @@ -633,6 +633,18 @@ void randr_query_outputs() { } } + /* Ensure that all outputs which are active also have a con. This is + * necessary because in the next step, a clone might get disabled. Example: + * LVDS1 active, VGA1 gets activated as a clone of LVDS1 (has no con). + * LVDS1 gets disabled. */ + TAILQ_FOREACH(output, &outputs, outputs) { + if (output->active && output->con == NULL) { + DLOG("Need to initialize a Con for output %s\n", output->name); + output_init_con(output); + output->changed = false; + } + } + /* Handle outputs which have a new mode or are disabled now (either * because the user disabled them or because they are clones) */ TAILQ_FOREACH(output, &outputs, outputs) { @@ -706,12 +718,6 @@ void randr_query_outputs() { output->changed = false; } - if (output->active && output->con == NULL) { - DLOG("Need to initialize a Con for output %s\n", output->name); - output_init_con(output); - output->changed = false; - } - if (output->changed) { output_change_mode(conn, output); output->changed = false; -- 2.39.5