use a detached output state in outputmgrapplyortest()

wlr_output.pending might be removed in wlroots 0.18
This commit is contained in:
Leonardo Hernández Hernández 2023-11-30 21:10:21 -06:00
parent 43f31b8f1b
commit 2e29189b92
No known key found for this signature in database
GPG Key ID: E538897EE11B9624

25
dwl.c
View File

@ -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)