rootston: disable then enable outputs when applying output-management state

This commit is contained in:
emersion 2019-03-28 21:41:55 +02:00 committed by Drew DeVault
parent 524f5c8425
commit a800aa3fb4
1 changed files with 10 additions and 1 deletions

View File

@ -443,12 +443,21 @@ void handle_output_manager_apply(struct wl_listener *listener, void *data) {
bool ok = true; bool ok = true;
struct wlr_output_configuration_head_v1 *config_head; struct wlr_output_configuration_head_v1 *config_head;
// First disable outputs we need to disable
wl_list_for_each(config_head, &config->heads, link) {
struct wlr_output *wlr_output = config_head->state.output;
if (!config_head->state.enabled) {
ok &= wlr_output_enable(wlr_output, false);
}
}
// Then enable outputs that need to
wl_list_for_each(config_head, &config->heads, link) { wl_list_for_each(config_head, &config->heads, link) {
struct wlr_output *wlr_output = config_head->state.output; struct wlr_output *wlr_output = config_head->state.output;
ok &= wlr_output_enable(wlr_output, config_head->state.enabled);
if (!config_head->state.enabled) { if (!config_head->state.enabled) {
continue; continue;
} }
ok &= wlr_output_enable(wlr_output, true);
if (config_head->state.mode != NULL) { if (config_head->state.mode != NULL) {
ok &= wlr_output_set_mode(wlr_output, config_head->state.mode); ok &= wlr_output_set_mode(wlr_output, config_head->state.mode);
} else { } else {