mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-09 23:45:58 +01:00
minor fixes for mirrors & log more monitor events
This commit is contained in:
parent
250d61e0b3
commit
e887149f25
5 changed files with 22 additions and 5 deletions
|
@ -1801,6 +1801,9 @@ void CCompositor::scheduleFrameForMonitor(CMonitor* pMonitor) {
|
||||||
if ((m_sWLRSession && !m_sWLRSession->active) || !m_bSessionActive)
|
if ((m_sWLRSession && !m_sWLRSession->active) || !m_bSessionActive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!pMonitor->m_bEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
wlr_output_schedule_frame(pMonitor->output);
|
wlr_output_schedule_frame(pMonitor->output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1479,14 +1479,14 @@ void CConfigManager::performMonitorReload() {
|
||||||
for (auto& m : g_pCompositor->m_vRealMonitors) {
|
for (auto& m : g_pCompositor->m_vRealMonitors) {
|
||||||
auto rule = getMonitorRuleFor(m->szName, m->output->description ? m->output->description : "");
|
auto rule = getMonitorRuleFor(m->szName, m->output->description ? m->output->description : "");
|
||||||
|
|
||||||
// ensure mirror
|
|
||||||
m->setMirror(rule.mirrorOf);
|
|
||||||
|
|
||||||
if (!g_pHyprRenderer->applyMonitorRule(m.get(), &rule)) {
|
if (!g_pHyprRenderer->applyMonitorRule(m.get(), &rule)) {
|
||||||
overAgain = true;
|
overAgain = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ensure mirror
|
||||||
|
m->setMirror(rule.mirrorOf);
|
||||||
|
|
||||||
g_pHyprRenderer->arrangeLayersForMonitor(m->ID);
|
g_pHyprRenderer->arrangeLayersForMonitor(m->ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,13 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PNEWMONITORWRAP && PNEWMONITORWRAP->get()->m_bEnabled) {
|
||||||
|
Debug::log(LOG, "Connected an enabled monitor???");
|
||||||
|
g_pConfigManager->m_bWantsMonitorReload = true;
|
||||||
|
g_pCompositor->scheduleFrameForMonitor(PNEWMONITORWRAP->get());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!PNEWMONITORWRAP) {
|
if (!PNEWMONITORWRAP) {
|
||||||
Debug::log(LOG, "Adding completely new monitor.");
|
Debug::log(LOG, "Adding completely new monitor.");
|
||||||
PNEWMONITORWRAP = &g_pCompositor->m_vRealMonitors.emplace_back(std::make_shared<CMonitor>());
|
PNEWMONITORWRAP = &g_pCompositor->m_vRealMonitors.emplace_back(std::make_shared<CMonitor>());
|
||||||
|
@ -88,6 +95,9 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
|
||||||
g_pCompositor->m_bReadyToProcess = true;
|
g_pCompositor->m_bReadyToProcess = true;
|
||||||
g_pCompositor->m_bUnsafeState = false;
|
g_pCompositor->m_bUnsafeState = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_pConfigManager->m_bWantsMonitorReload = true;
|
||||||
|
g_pCompositor->scheduleFrameForMonitor(PNEWMONITOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_monitorFrame(void* owner, void* data) {
|
void Events::listener_monitorFrame(void* owner, void* data) {
|
||||||
|
@ -326,11 +336,14 @@ void Events::listener_monitorDestroy(void* owner, void* data) {
|
||||||
if (!pMonitor)
|
if (!pMonitor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Debug::log(LOG, "Destroy called for monitor %s", pMonitor->output->name);
|
||||||
|
|
||||||
pMonitor->onDisconnect();
|
pMonitor->onDisconnect();
|
||||||
|
|
||||||
// cleanup if not unsafe
|
// cleanup if not unsafe
|
||||||
|
|
||||||
if (!g_pCompositor->m_bUnsafeState) {
|
if (!g_pCompositor->m_bUnsafeState) {
|
||||||
|
Debug::log(LOG, "Removing monitor %s from realMonitors", pMonitor->output->name);
|
||||||
|
|
||||||
g_pCompositor->m_vRealMonitors.erase(std::remove_if(g_pCompositor->m_vRealMonitors.begin(), g_pCompositor->m_vRealMonitors.end(), [&](std::shared_ptr<CMonitor>& el) { return el.get() == pMonitor; }));
|
g_pCompositor->m_vRealMonitors.erase(std::remove_if(g_pCompositor->m_vRealMonitors.begin(), g_pCompositor->m_vRealMonitors.end(), [&](std::shared_ptr<CMonitor>& el) { return el.get() == pMonitor; }));
|
||||||
|
|
||||||
if (pMostHzMonitor == pMonitor) {
|
if (pMostHzMonitor == pMonitor) {
|
||||||
|
|
|
@ -142,6 +142,8 @@ void CMonitor::onDisconnect() {
|
||||||
if (!m_bEnabled || g_pCompositor->m_bIsShuttingDown)
|
if (!m_bEnabled || g_pCompositor->m_bIsShuttingDown)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Debug::log(LOG, "onDisconnect called for %s", output->name);
|
||||||
|
|
||||||
// Cleanup everything. Move windows back, snap cursor, shit.
|
// Cleanup everything. Move windows back, snap cursor, shit.
|
||||||
CMonitor* BACKUPMON = nullptr;
|
CMonitor* BACKUPMON = nullptr;
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
|
|
|
@ -1371,7 +1371,6 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
|
|
||||||
if (!wlr_output_commit(pMonitor->output)) {
|
if (!wlr_output_commit(pMonitor->output)) {
|
||||||
Debug::log(ERR, "Couldn't commit output named %s", pMonitor->output->name);
|
Debug::log(ERR, "Couldn't commit output named %s", pMonitor->output->name);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
Loading…
Reference in a new issue