diff options
author | Leonardo Hernández Hernández <leohdz172@proton.me> | 2023-11-30 21:10:21 -0600 |
---|---|---|
committer | Leonardo Hernández Hernández <leohdz172@proton.me> | 2023-11-30 22:38:11 -0600 |
commit | 2e29189b92c581345eb6b40a98e81c0e692fe8a8 (patch) | |
tree | 1b8d5a1ed7a88b27790f0f75ebc79de95ad59595 | |
parent | 43f31b8f1be327bf4d29e1efc2ea51178ac64481 (diff) |
use a detached output state in outputmgrapplyortest()
wlr_output.pending might be removed in wlroots 0.18
-rw-r--r-- | dwl.c | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -1724,14 +1724,17 @@ outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int test) wl_list_for_each(config_head, &config->heads, link) { struct wlr_output *wlr_output = config_head->state.output; Monitor *m = wlr_output->data; + struct wlr_output_state state; - wlr_output_enable(wlr_output, config_head->state.enabled); + wlr_output_state_init(&state); + wlr_output_state_set_enabled(&state, config_head->state.enabled); if (!config_head->state.enabled) goto apply_or_test; + if (config_head->state.mode) - wlr_output_set_mode(wlr_output, config_head->state.mode); + wlr_output_state_set_mode(&state, config_head->state.mode); else - wlr_output_set_custom_mode(wlr_output, + wlr_output_state_set_custom_mode(&state, config_head->state.custom_mode.width, config_head->state.custom_mode.height, config_head->state.custom_mode.refresh); @@ -1741,18 +1744,16 @@ outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int test) if (m->m.x != config_head->state.x || m->m.y != config_head->state.y) wlr_output_layout_add(output_layout, wlr_output, config_head->state.x, config_head->state.y); - wlr_output_set_transform(wlr_output, config_head->state.transform); - wlr_output_set_scale(wlr_output, config_head->state.scale); - wlr_output_enable_adaptive_sync(wlr_output, + wlr_output_state_set_transform(&state, config_head->state.transform); + wlr_output_state_set_scale(&state, config_head->state.scale); + wlr_output_state_set_adaptive_sync_enabled(&state, config_head->state.adaptive_sync_enabled); apply_or_test: - if (test) { - ok &= wlr_output_test(wlr_output); - wlr_output_rollback(wlr_output); - } else { - ok &= wlr_output_commit(wlr_output); - } + ok &= test ? wlr_output_test_state(wlr_output, &state) + : wlr_output_commit_state(wlr_output, &state); + + wlr_output_state_finish(&state); } if (ok) |