respect outputMgrApplyTest

This commit is contained in:
vaxerski 2022-05-06 17:18:24 +02:00
parent ff86f723b2
commit 034192650f

View file

@ -196,32 +196,39 @@ void CHyprRenderer::outputMgrApplyTest(wlr_output_configuration_v1* config, bool
bool noError = true; bool noError = true;
wl_list_for_each(head, &config->heads, link) { wl_list_for_each(head, &config->heads, link) {
std::string commandForCfg = "";
const auto OUTPUT = head->state.output; const auto OUTPUT = head->state.output;
wlr_output_enable(OUTPUT, head->state.enabled); commandForCfg += std::string(OUTPUT->name) + ",";
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); if (!head->state.enabled) {
wlr_output_set_transform(OUTPUT, head->state.transform); commandForCfg += "disabled";
wlr_output_set_scale(OUTPUT, head->state.scale); if (!test)
g_pConfigManager->parseKeyword("monitor", commandForCfg, true);
continue;
} }
wlr_output_enable(OUTPUT, head->state.enabled);
if (head->state.mode)
commandForCfg += std::to_string(head->state.mode->width) + "x" + std::to_string(head->state.mode->height) + "@" + std::to_string(head->state.mode->refresh / 1000.f) + ",";
else
commandForCfg += std::to_string(head->state.custom_mode.width) + "x" + std::to_string(head->state.custom_mode.height) + "@" + std::to_string(head->state.custom_mode.refresh / 1000.f) + ",";
commandForCfg += std::to_string(head->state.x) + "x" + std::to_string(head->state.y) + "," + std::to_string(head->state.scale);
if (!test)
g_pConfigManager->parseKeyword("monitor", commandForCfg, true);
noError = wlr_output_test(OUTPUT); noError = wlr_output_test(OUTPUT);
if (!noError) if (!noError)
break; break;
} }
wl_list_for_each(head, &config->heads, link) { if (!test)
if (noError && !test) g_pConfigManager->m_bWantsMonitorReload = true; // for monitor keywords
wlr_output_commit(head->state.output);
else
wlr_output_rollback(head->state.output);
}
if (noError) if (noError)
wlr_output_configuration_v1_send_succeeded(config); wlr_output_configuration_v1_send_succeeded(config);