aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/output.c
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2019-01-17 22:30:24 +0100
committerLibravatar emersion <contact@emersion.fr>2019-01-18 10:09:10 +0100
commita737d7ecc4d7f4825ca7879e3449522bc87049be (patch)
tree7c40fbaebce93738d1f44d32f2d6f059a073e85e /sway/desktop/output.c
parentoutput: remove output_add_listeners (diff)
downloadsway-a737d7ecc4d7f4825ca7879e3449522bc87049be.tar.gz
sway-a737d7ecc4d7f4825ca7879e3449522bc87049be.tar.zst
sway-a737d7ecc4d7f4825ca7879e3449522bc87049be.zip
Better handle outputs without CRTC
This happens if you plug in more outputs than supported by your GPU. This patch makes it so outputs without CRTCs appear as disabled. As soon as they get a CRTC (signalled via the mode event), we can enable them.
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r--sway/desktop/output.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 3f6c3d87..37651d66 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -503,7 +503,18 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
503 503
504static void handle_mode(struct wl_listener *listener, void *data) { 504static void handle_mode(struct wl_listener *listener, void *data) {
505 struct sway_output *output = wl_container_of(listener, output, mode); 505 struct sway_output *output = wl_container_of(listener, output, mode);
506 if (!output->configured) {
507 return;
508 }
506 if (!output->enabled) { 509 if (!output->enabled) {
510 struct output_config *oc = output_find_config(output);
511 if (output->wlr_output->current_mode != NULL &&
512 (!oc || oc->enabled)) {
513 // We want to enable this output, but it didn't work last time,
514 // possibly because we hadn't enough CRTCs. Try again now that the
515 // output has a mode.
516 output_enable(output, oc);
517 }
507 return; 518 return;
508 } 519 }
509 arrange_layers(output); 520 arrange_layers(output);
@@ -592,7 +603,6 @@ void handle_new_output(struct wl_listener *listener, void *data) {
592 output->damage_destroy.notify = damage_handle_destroy; 603 output->damage_destroy.notify = damage_handle_destroy;
593 604
594 struct output_config *oc = output_find_config(output); 605 struct output_config *oc = output_find_config(output);
595
596 if (!oc || oc->enabled) { 606 if (!oc || oc->enabled) {
597 output_enable(output, oc); 607 output_enable(output, oc);
598 } else { 608 } else {