diff options
author | Devin J. Pohly <djpohly@gmail.com> | 2021-01-18 15:02:15 -0600 |
---|---|---|
committer | Devin J. Pohly <djpohly@gmail.com> | 2021-01-18 15:02:15 -0600 |
commit | ab032822958dd3041f478c48498f17e5d259dd6f (patch) | |
tree | db9a050e094ef54293cc2672ae0d4eb0d43633a2 /dwl.c | |
parent | 3747b3162ea062fb4630e63cee1a8ad57de87a81 (diff) |
commit entire output config, or fail and rollback
The wlr-output-management protocol requires that either all of the
changes from an apply request be applied successfully, in which case a
"succeeded" event is sent, or all of the changes are reverted and a
"failed" event is sent. As written, this could partially commit
changes, then fail.
Test the changes first (even for an "apply" event), then commit or
rollback as appropriate.
Diffstat (limited to 'dwl.c')
-rw-r--r-- | dwl.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1545,11 +1545,14 @@ outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int test) } } - if (test) { - ok &= wlr_output_test(wlr_output); - wlr_output_rollback(wlr_output); - } else - ok &= wlr_output_commit(wlr_output); + if (!(ok = wlr_output_test(wlr_output))) + break; + } + wl_list_for_each(config_head, &config->heads, link) { + if (ok && !test) + wlr_output_commit(config_head->state.output); + else + wlr_output_rollback(config_head->state.output); } if (ok) wlr_output_configuration_v1_send_succeeded(config); |