From 7397befb168afc3662fb2f65fb4390adeb0f9dd6 Mon Sep 17 00:00:00 2001 From: Ilia Bozhinov Date: Thu, 26 Oct 2023 18:36:41 +0200 Subject: [PATCH] output-layout: add support for custom modes in wlr-output-management-v1 --- src/core/output-layout.cpp | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/core/output-layout.cpp b/src/core/output-layout.cpp index a38073fdb..baaf4ae38 100644 --- a/src/core/output-layout.cpp +++ b/src/core/output-layout.cpp @@ -540,20 +540,7 @@ struct output_layout_output_t /** Check whether the given state can be applied */ bool test_state(const output_state_t& state) { - if (state.source == OUTPUT_IMAGE_SOURCE_NONE) - { - return true; - } - - if (state.source == OUTPUT_IMAGE_SOURCE_MIRROR) - { - return true; - } - - /* XXX: are there more things to check? */ - refresh_custom_modes(); - - return is_mode_supported(state.mode); + return true; } /** Change the output mode */ @@ -585,8 +572,7 @@ struct output_layout_output_t " for output ", handle->name, ". Trying to use custom mode", "(might not work)"); - wlr_output_set_custom_mode(handle, mode.width, mode.height, - mode.refresh); + wlr_output_set_custom_mode(handle, mode.width, mode.height, mode.refresh); } wlr_output_commit(handle); @@ -970,8 +956,17 @@ class output_layout_t::impl } state.source = OUTPUT_IMAGE_SOURCE_SELF; - state.mode = head->state.mode ? *head->state.mode : - this->outputs[handle]->current_state.mode; + + if (head->state.mode) + { + state.mode = *head->state.mode; + } else + { + state.mode.width = head->state.custom_mode.width; + state.mode.height = head->state.custom_mode.height; + state.mode.refresh = head->state.custom_mode.refresh; + } + state.position = {head->state.x, head->state.y}; state.scale = head->state.scale; state.transform = head->state.transform;