]> git.mdlowis.com Git - proto/labwc.git/commitdiff
src/output.c: notify clients about config errors
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Thu, 22 Feb 2024 20:22:28 +0000 (21:22 +0100)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Thu, 22 Feb 2024 22:40:03 +0000 (23:40 +0100)
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.

src/output.c

index 6d05ee9419619ff0298b48eed9ed9182211c0b05..28ee298f30324af380095a2a5981c050563f5da3 100644 (file)
@@ -405,10 +405,11 @@ output_update_for_layout_change(struct server *server)
        cursor_update_image(&server->seat);
 }
 
-static void
+static bool
 output_config_apply(struct server *server,
                struct wlr_output_configuration_v1 *config)
 {
+       bool success = true;
        server->pending_output_layout_change++;
 
        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);
                }
                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 */
@@ -477,6 +485,7 @@ output_config_apply(struct server *server,
 
        server->pending_output_layout_change--;
        do_output_layout_change(server);
+       return success;
 }
 
 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);
 
-       if (config_is_good) {
-               output_config_apply(server, config);
+       if (config_is_good && output_config_apply(server, config)) {
                wlr_output_configuration_v1_send_succeeded(config);
        } else {
                wlr_output_configuration_v1_send_failed(config);