Fix re-enabling outputs gaining a CRTC

If output->configured is true, then the output has been modeset correctly and
we don't need to try again. If output->enabled is true, then we are in the
process of configuring the output and we shouldn't do anything.
This commit is contained in:
emersion 2019-01-19 10:19:59 +01:00
parent 695948e689
commit 0bf3252d8b
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -503,20 +503,22 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
static void handle_mode(struct wl_listener *listener, void *data) { static void handle_mode(struct wl_listener *listener, void *data) {
struct sway_output *output = wl_container_of(listener, output, mode); struct sway_output *output = wl_container_of(listener, output, mode);
if (!output->configured) { if (!output->configured && !output->enabled) {
return;
}
if (!output->enabled) {
struct output_config *oc = output_find_config(output); struct output_config *oc = output_find_config(output);
if (output->wlr_output->current_mode != NULL && if (output->wlr_output->current_mode != NULL &&
(!oc || oc->enabled)) { (!oc || oc->enabled)) {
// We want to enable this output, but it didn't work last time, // We want to enable this output, but it didn't work last time,
// possibly because we hadn't enough CRTCs. Try again now that the // possibly because we hadn't enough CRTCs. Try again now that the
// output has a mode. // output has a mode.
output_enable(output, oc); wlr_log(WLR_DEBUG, "Output %s has gained a CRTC, "
"trying to enable it", output->wlr_output->name);
apply_output_config(oc, output);
} }
return; return;
} }
if (!output->enabled || !output->configured) {
return;
}
arrange_layers(output); arrange_layers(output);
arrange_output(output); arrange_output(output);
transaction_commit_dirty(); transaction_commit_dirty();