diff options
author | Josef Gajdusek <atx@atx.name> | 2019-05-24 21:23:36 +0200 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-06-03 08:30:28 -0400 |
commit | 74ac8d0ec28c57f4f0871e6f4af0473d1f70192f (patch) | |
tree | d33347450402a54b1d3da52f23c0a5e38d29a6b3 | |
parent | commands/bar: fix mode and hidden_state at runtime (diff) | |
download | sway-74ac8d0ec28c57f4f0871e6f4af0473d1f70192f.tar.gz sway-74ac8d0ec28c57f4f0871e6f4af0473d1f70192f.tar.zst sway-74ac8d0ec28c57f4f0871e6f4af0473d1f70192f.zip |
Update output manager config on all output events
The output manager config was not properly updated when output
configuration was changed through some other means (such as a command).
-rw-r--r-- | sway/desktop/output.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 0cc08525..1b72fc21 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -507,6 +507,30 @@ static void damage_handle_destroy(struct wl_listener *listener, void *data) { | |||
507 | transaction_commit_dirty(); | 507 | transaction_commit_dirty(); |
508 | } | 508 | } |
509 | 509 | ||
510 | static void update_output_manager_config(struct sway_server *server) { | ||
511 | struct wlr_output_configuration_v1 *config = | ||
512 | wlr_output_configuration_v1_create(); | ||
513 | |||
514 | struct sway_output *output; | ||
515 | wl_list_for_each(output, &root->all_outputs, link) { | ||
516 | if (output == root->noop_output) { | ||
517 | continue; | ||
518 | } | ||
519 | struct wlr_output_configuration_head_v1 *config_head = | ||
520 | wlr_output_configuration_head_v1_create(config, output->wlr_output); | ||
521 | struct wlr_box *output_box = wlr_output_layout_get_box( | ||
522 | root->output_layout, output->wlr_output); | ||
523 | // We mark the output enabled even if it is switched off by DPMS | ||
524 | config_head->state.enabled = output->enabled; | ||
525 | if (output_box) { | ||
526 | config_head->state.x = output_box->x; | ||
527 | config_head->state.y = output_box->y; | ||
528 | } | ||
529 | } | ||
530 | |||
531 | wlr_output_manager_v1_set_configuration(server->output_manager_v1, config); | ||
532 | } | ||
533 | |||
510 | static void handle_destroy(struct wl_listener *listener, void *data) { | 534 | static void handle_destroy(struct wl_listener *listener, void *data) { |
511 | struct sway_output *output = wl_container_of(listener, output, destroy); | 535 | struct sway_output *output = wl_container_of(listener, output, destroy); |
512 | wl_signal_emit(&output->events.destroy, output); | 536 | wl_signal_emit(&output->events.destroy, output); |
@@ -525,6 +549,8 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
525 | wl_list_remove(&output->damage_frame.link); | 549 | wl_list_remove(&output->damage_frame.link); |
526 | 550 | ||
527 | transaction_commit_dirty(); | 551 | transaction_commit_dirty(); |
552 | |||
553 | update_output_manager_config(output->server); | ||
528 | } | 554 | } |
529 | 555 | ||
530 | static void handle_mode(struct wl_listener *listener, void *data) { | 556 | static void handle_mode(struct wl_listener *listener, void *data) { |
@@ -548,6 +574,8 @@ static void handle_mode(struct wl_listener *listener, void *data) { | |||
548 | arrange_layers(output); | 574 | arrange_layers(output); |
549 | arrange_output(output); | 575 | arrange_output(output); |
550 | transaction_commit_dirty(); | 576 | transaction_commit_dirty(); |
577 | |||
578 | update_output_manager_config(output->server); | ||
551 | } | 579 | } |
552 | 580 | ||
553 | static void handle_transform(struct wl_listener *listener, void *data) { | 581 | static void handle_transform(struct wl_listener *listener, void *data) { |
@@ -558,6 +586,8 @@ static void handle_transform(struct wl_listener *listener, void *data) { | |||
558 | arrange_layers(output); | 586 | arrange_layers(output); |
559 | arrange_output(output); | 587 | arrange_output(output); |
560 | transaction_commit_dirty(); | 588 | transaction_commit_dirty(); |
589 | |||
590 | update_output_manager_config(output->server); | ||
561 | } | 591 | } |
562 | 592 | ||
563 | static void update_textures(struct sway_container *con, void *data) { | 593 | static void update_textures(struct sway_container *con, void *data) { |
@@ -574,6 +604,8 @@ static void handle_scale(struct wl_listener *listener, void *data) { | |||
574 | output_for_each_container(output, update_textures, NULL); | 604 | output_for_each_container(output, update_textures, NULL); |
575 | arrange_output(output); | 605 | arrange_output(output); |
576 | transaction_commit_dirty(); | 606 | transaction_commit_dirty(); |
607 | |||
608 | update_output_manager_config(output->server); | ||
577 | } | 609 | } |
578 | 610 | ||
579 | static void send_presented_iterator(struct sway_output *output, | 611 | static void send_presented_iterator(struct sway_output *output, |