src/output.c: notify clients about config errors

Preliminary fix for #1525.

Based on the protocol we should also revert all
previously correctly committed outputs. #1528
is doing just that but may cause regressions so
we need a short term solution and then deal with
potential issues in #1528 after the release.
This commit is contained in:
Consolatis 2024-02-22 21:22:28 +01:00
parent 1aa906e0de
commit d69faffc4e

View file

@ -405,10 +405,11 @@ output_update_for_layout_change(struct server *server)
cursor_update_image(&server->seat); cursor_update_image(&server->seat);
} }
static void static bool
output_config_apply(struct server *server, output_config_apply(struct server *server,
struct wlr_output_configuration_v1 *config) struct wlr_output_configuration_v1 *config)
{ {
bool success = true;
server->pending_output_layout_change++; server->pending_output_layout_change++;
struct wlr_output_configuration_head_v1 *head; struct wlr_output_configuration_head_v1 *head;
@ -436,8 +437,15 @@ output_config_apply(struct server *server,
output_enable_adaptive_sync(o, head->state.adaptive_sync_enabled); output_enable_adaptive_sync(o, head->state.adaptive_sync_enabled);
} }
if (!wlr_output_commit(o)) { if (!wlr_output_commit(o)) {
wlr_log(WLR_ERROR, "Output config commit failed"); /*
continue; * FIXME: This is only part of the story, we should revert
* all previously commited outputs as well here.
*
* See https://github.com/labwc/labwc/pull/1528
*/
wlr_log(WLR_INFO, "Output config commit failed: %s", o->name);
success = false;
break;
} }
/* Only do Layout specific actions if the commit went trough */ /* Only do Layout specific actions if the commit went trough */
@ -477,6 +485,7 @@ output_config_apply(struct server *server,
server->pending_output_layout_change--; server->pending_output_layout_change--;
do_output_layout_change(server); do_output_layout_change(server);
return success;
} }
static bool static bool
@ -569,8 +578,7 @@ handle_output_manager_apply(struct wl_listener *listener, void *data)
bool config_is_good = verify_output_config_v1(config); bool config_is_good = verify_output_config_v1(config);
if (config_is_good) { if (config_is_good && output_config_apply(server, config)) {
output_config_apply(server, config);
wlr_output_configuration_v1_send_succeeded(config); wlr_output_configuration_v1_send_succeeded(config);
} else { } else {
wlr_output_configuration_v1_send_failed(config); wlr_output_configuration_v1_send_failed(config);