diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 8370eeec..c8e2aa12 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -580,12 +580,12 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string return; } - wl_output_transform transform = (wl_output_transform)std::stoi(ARGS[2]); + const auto TRANSFORM = (wl_output_transform)TSF; // overwrite if exists for (auto& r : m_dMonitorRules) { if (r.name == newrule.name) { - r.transform = transform; + r.transform = TRANSFORM; return; } } diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index a9fc25ae..8e45364a 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -38,8 +38,18 @@ void Events::listener_change(wl_listener* listener, void* data) { CONFIGHEAD->state.enabled = m->output->enabled; CONFIGHEAD->state.mode = m->output->current_mode; - CONFIGHEAD->state.x = m->vecPosition.x; - CONFIGHEAD->state.y = m->vecPosition.y; + if (!m->output->current_mode) { + CONFIGHEAD->state.custom_mode = { + m->output->width, + m->output->height, + m->output->refresh, + }; + } + CONFIGHEAD->state.x = m->vecPosition.x; + CONFIGHEAD->state.y = m->vecPosition.y; + CONFIGHEAD->state.transform = m->transform; + CONFIGHEAD->state.scale = m->scale; + CONFIGHEAD->state.adaptive_sync_enabled = m->vrrActive; } wlr_output_manager_v1_set_configuration(g_pCompositor->m_sWLROutputMgr, CONFIG); diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index c1443d40..553fe3e5 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -86,8 +86,6 @@ void CMonitor::onConnect(bool noRule) { if (!wlr_output_commit(output)) Debug::log(ERR, "Couldn't commit disabled state on output {}", output->name); - Events::listener_change(nullptr, nullptr); - m_bEnabled = false; hyprListener_monitorFrame.removeCallback(); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index bff9fab4..789a9ba6 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -1135,7 +1135,7 @@ void CHyprRenderer::setWindowScanoutMode(CWindow* pWindow) { void CHyprRenderer::outputMgrApplyTest(wlr_output_configuration_v1* config, bool test) { wlr_output_configuration_head_v1* head; - bool noError = true; + bool ok = true; wl_list_for_each(head, &config->heads, link) { @@ -1160,29 +1160,24 @@ void CHyprRenderer::outputMgrApplyTest(wlr_output_configuration_v1* config, bool 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); + commandForCfg += std::to_string(head->state.x) + "x" + std::to_string(head->state.y) + "," + std::to_string(head->state.scale) + ",transform," + + std::to_string((int)head->state.transform); if (!test) { g_pConfigManager->parseKeyword("monitor", commandForCfg, true); - - std::string transformStr = std::string(OUTPUT->name) + ",transform," + std::to_string((int)OUTPUT->transform); - - const auto PMONITOR = g_pCompositor->getMonitorFromName(OUTPUT->name); - - if (!PMONITOR || OUTPUT->transform != PMONITOR->transform) - g_pConfigManager->parseKeyword("monitor", transformStr); + wlr_output_state_set_adaptive_sync_enabled(&OUTPUT->pending, head->state.adaptive_sync_enabled); } - noError = wlr_output_test(OUTPUT); + ok = wlr_output_test(OUTPUT); - if (!noError) + if (!ok) break; } if (!test) g_pConfigManager->m_bWantsMonitorReload = true; // for monitor keywords - if (noError) + if (ok) wlr_output_configuration_v1_send_succeeded(config); else wlr_output_configuration_v1_send_failed(config); @@ -1859,6 +1854,8 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR EMIT_HOOK_EVENT("monitorLayoutChanged", nullptr); + Events::listener_change(nullptr, nullptr); + return true; }