further fixes to monitor disabling on launch

This commit is contained in:
Vaxry 2022-08-10 13:44:04 +02:00
parent a564be73c5
commit 15fc0892c7
3 changed files with 19 additions and 7 deletions

View file

@ -64,17 +64,16 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
PNEWMONITOR->ID = g_pCompositor->getNextAvailableMonitorID(); PNEWMONITOR->ID = g_pCompositor->getNextAvailableMonitorID();
wlr_output_init_render(OUTPUT, g_pCompositor->m_sWLRAllocator, g_pCompositor->m_sWLRRenderer);
PNEWMONITOR->output = OUTPUT; PNEWMONITOR->output = OUTPUT;
PNEWMONITOR->m_pThisWrap = PNEWMONITORWRAP; PNEWMONITOR->m_pThisWrap = PNEWMONITORWRAP;
PNEWMONITOR->onConnect(false); PNEWMONITOR->onConnect(false);
if (!pMostHzMonitor || PNEWMONITOR->refreshRate > pMostHzMonitor->refreshRate) if ((!pMostHzMonitor || PNEWMONITOR->refreshRate > pMostHzMonitor->refreshRate) && PNEWMONITOR->m_bEnabled)
pMostHzMonitor = PNEWMONITOR; pMostHzMonitor = PNEWMONITOR;
// ready to process cuz we have a monitor // ready to process cuz we have a monitor
if (PNEWMONITOR->m_bEnabled)
g_pCompositor->m_bReadyToProcess = true; g_pCompositor->m_bReadyToProcess = true;
} }

View file

@ -6,6 +6,8 @@ void CMonitor::onConnect(bool noRule) {
if (m_bEnabled) if (m_bEnabled)
return; return;
szName = output->name;
// get monitor rule that matches // get monitor rule that matches
SMonitorRule monitorRule = g_pConfigManager->getMonitorRuleFor(output->name); SMonitorRule monitorRule = g_pConfigManager->getMonitorRuleFor(output->name);
@ -37,9 +39,16 @@ void CMonitor::onConnect(bool noRule) {
if (PREFSTATE) if (PREFSTATE)
wlr_output_set_mode(output, PREFSTATE); wlr_output_set_mode(output, PREFSTATE);
else
Debug::log(WARN, "No mode found for disabled output %s", output->name)
wlr_output_enable(output, 0); wlr_output_enable(output, 0);
wlr_output_commit(output);
if (!wlr_output_commit(output)) {
Debug::log(ERR, "Couldn't commit disabled state on output %s", output->name);
}
Events::listener_change(nullptr, nullptr);
m_bEnabled = false; m_bEnabled = false;
@ -47,6 +56,11 @@ void CMonitor::onConnect(bool noRule) {
return; return;
} }
if (!m_bRenderingInitPassed) {
wlr_output_init_render(output, g_pCompositor->m_sWLRAllocator, g_pCompositor->m_sWLRRenderer);
m_bRenderingInitPassed = true;
}
if (!m_pThisWrap) { if (!m_pThisWrap) {
// find the wrap // find the wrap
@ -64,8 +78,6 @@ void CMonitor::onConnect(bool noRule) {
m_bEnabled = true; m_bEnabled = true;
szName = output->name;
wlr_output_set_scale(output, monitorRule.scale); wlr_output_set_scale(output, monitorRule.scale);
wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, monitorRule.scale); wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, monitorRule.scale);
wlr_output_set_transform(output, WL_OUTPUT_TRANSFORM_NORMAL); // TODO: support other transforms wlr_output_set_transform(output, WL_OUTPUT_TRANSFORM_NORMAL); // TODO: support other transforms

View file

@ -58,6 +58,7 @@ public:
std::shared_ptr<CMonitor>* m_pThisWrap = nullptr; std::shared_ptr<CMonitor>* m_pThisWrap = nullptr;
bool m_bEnabled = false; bool m_bEnabled = false;
bool m_bRenderingInitPassed = false;
// For the list lookup // For the list lookup