From bc9d9c9c8dccee6f453250a3a767f2270e45a79a Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 19 Mar 2022 14:07:18 +0100 Subject: outputmgr applytest --- src/render/Renderer.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/render/Renderer.cpp') diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 14e47ba3..0ad0c1ba 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -99,3 +99,44 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) { wlr_surface_for_each_surface(ls->layerSurface->surface, renderSurface, &renderdata); } } + +void CHyprRenderer::outputMgrApplyTest(wlr_output_configuration_v1* config, bool test) { + wlr_output_configuration_head_v1* head; + bool noError = true; + + wl_list_for_each(head, &config->heads, link) { + const auto OUTPUT = head->state.output; + + wlr_output_enable(OUTPUT, head->state.enabled); + if (head->state.enabled) { + if (head->state.mode) + wlr_output_set_mode(OUTPUT, head->state.mode); + else + wlr_output_set_custom_mode(OUTPUT, head->state.custom_mode.width, head->state.custom_mode.height, head->state.custom_mode.refresh); + + wlr_output_layout_move(g_pCompositor->m_sWLROutputLayout, OUTPUT, head->state.x, head->state.y); + wlr_output_set_transform(OUTPUT, head->state.transform); + wlr_output_set_scale(OUTPUT, head->state.scale); + } + + noError = wlr_output_test(OUTPUT); + + if (!noError) + break; + } + + wl_list_for_each(head, &config->heads, link) { + if (noError && !test) + wlr_output_commit(head->state.output); + else + wlr_output_rollback(head->state.output); + } + + if (noError) + wlr_output_configuration_v1_send_succeeded(config); + else + wlr_output_configuration_v1_send_failed(config); + wlr_output_configuration_v1_destroy(config); + + Debug::log(LOG, "OutputMgr Applied/Tested."); +} \ No newline at end of file -- cgit v1.2.3