aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarten Ringwelski <git@maringuu.de>2020-12-05 14:52:58 +0100
committerSimon Ser <contact@emersion.fr>2020-12-07 11:18:58 +0100
commit44b1ff16e9bc9d3a0afc86c1afafd1efcdada806 (patch)
treedd8083e68203a329062c58a2151d4d5f1cff8244
parentbaf2319fd38659a0ab35e4767e267d32e8c9f150 (diff)
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.
-rw-r--r--types/wlr_output_management_v1.c20
1 files changed, 20 insertions, 0 deletions
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;