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) { 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;
Monitor *m = wlr_output->data; 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) if (!config_head->state.enabled)
goto apply_or_test; goto apply_or_test;
if (config_head->state.mode) 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 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.width,
config_head->state.custom_mode.height, config_head->state.custom_mode.height,
config_head->state.custom_mode.refresh); 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) if (m->m.x != config_head->state.x || m->m.y != config_head->state.y)
wlr_output_layout_add(output_layout, wlr_output, wlr_output_layout_add(output_layout, wlr_output,
config_head->state.x, config_head->state.y); config_head->state.x, config_head->state.y);
wlr_output_set_transform(wlr_output, config_head->state.transform); wlr_output_state_set_transform(&state, config_head->state.transform);
wlr_output_set_scale(wlr_output, config_head->state.scale); wlr_output_state_set_scale(&state, config_head->state.scale);
wlr_output_enable_adaptive_sync(wlr_output, wlr_output_state_set_adaptive_sync_enabled(&state,
config_head->state.adaptive_sync_enabled); config_head->state.adaptive_sync_enabled);
apply_or_test: apply_or_test:
if (test) { ok &= test ? wlr_output_test_state(wlr_output, &state)
ok &= wlr_output_test(wlr_output); : wlr_output_commit_state(wlr_output, &state);
wlr_output_rollback(wlr_output);
} else { wlr_output_state_finish(&state);
ok &= wlr_output_commit(wlr_output);
}
} }
if (ok) if (ok)