From 44b1ff16e9bc9d3a0afc86c1afafd1efcdada806 Mon Sep 17 00:00:00 2001 From: Marten Ringwelski Date: Sat, 5 Dec 2020 14:52:58 +0100 Subject: [PATCH] wlr-output-management: Handle modes added after initializing The DRM backend adds custom modes to wlr_output.modes Currently modes that are added after the first occurence of wlr_output_configuration_head_v1 are not added to wlr_output_head.mode_resources. --- types/wlr_output_management_v1.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/types/wlr_output_management_v1.c b/types/wlr_output_management_v1.c index 312057ed..ed53171f 100644 --- a/types/wlr_output_management_v1.c +++ b/types/wlr_output_management_v1.c @@ -819,6 +819,26 @@ static bool manager_update_head(struct wlr_output_manager_v1 *manager, state |= HEAD_STATE_SCALE; } + // If a mode was added to wlr_output.modes we need to add the new mode + // to the wlr_output_head + struct wlr_output_mode *mode; + wl_list_for_each(mode, &head->state.output->modes, link) { + bool found = false; + struct wl_resource *mode_resource; + wl_resource_for_each(mode_resource, &head->mode_resources) { + if (mode_from_resource(mode_resource) == mode) { + found = true; + break; + } + } + if (!found) { + struct wl_resource *resource; + wl_resource_for_each(resource, &head->resources) { + head_send_mode(head, resource, mode); + } + } + } + if (state != 0) { *current = *next;