rework outputmgrapplyortest()
first disable requested monitors, then enable and/or change mode, x and y, etc. This is mostly what sway doesmain
parent
3431ac165d
commit
b6e3fc1645
36
dwl.c
36
dwl.c
|
@ -1583,11 +1583,27 @@ outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int test)
|
||||||
struct wlr_output_configuration_head_v1 *config_head;
|
struct wlr_output_configuration_head_v1 *config_head;
|
||||||
int ok = 1;
|
int ok = 1;
|
||||||
|
|
||||||
|
/* First disable outputs we need to disable */
|
||||||
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;
|
||||||
|
if (!wlr_output->enabled || config_head->state.enabled)
|
||||||
|
continue;
|
||||||
|
wlr_output_enable(wlr_output, 0);
|
||||||
|
if (test) {
|
||||||
|
ok &= wlr_output_test(wlr_output);
|
||||||
|
wlr_output_rollback(wlr_output);
|
||||||
|
} else {
|
||||||
|
ok &= wlr_output_commit(wlr_output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wlr_output_enable(wlr_output, config_head->state.enabled);
|
/* Then enable outputs that need to */
|
||||||
if (config_head->state.enabled) {
|
wl_list_for_each(config_head, &config->heads, link) {
|
||||||
|
struct wlr_output *wlr_output = config_head->state.output;
|
||||||
|
if (!config_head->state.enabled)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
wlr_output_enable(wlr_output, 1);
|
||||||
if (config_head->state.mode)
|
if (config_head->state.mode)
|
||||||
wlr_output_set_mode(wlr_output, config_head->state.mode);
|
wlr_output_set_mode(wlr_output, config_head->state.mode);
|
||||||
else
|
else
|
||||||
|
@ -1600,17 +1616,15 @@ outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int test)
|
||||||
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_set_transform(wlr_output, config_head->state.transform);
|
||||||
wlr_output_set_scale(wlr_output, config_head->state.scale);
|
wlr_output_set_scale(wlr_output, config_head->state.scale);
|
||||||
|
|
||||||
|
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)
|
if (ok)
|
||||||
wlr_output_configuration_v1_send_succeeded(config);
|
wlr_output_configuration_v1_send_succeeded(config);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue