mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-09-11 21:27:20 +03:00
internal: Fix wlr output management (#3234)
This commit is contained in:
parent
d490f198a4
commit
6c855dd6e4
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user