mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-05 06:25:59 +01:00
internal: Delay monitor events/hooks (#7797)
* Delay monitor messages * Format
This commit is contained in:
parent
e87758529e
commit
9e35656244
1 changed files with 7 additions and 7 deletions
|
@ -192,10 +192,6 @@ void CMonitor::onConnect(bool noRule) {
|
||||||
if (!activeMonitorRule.mirrorOf.empty())
|
if (!activeMonitorRule.mirrorOf.empty())
|
||||||
setMirror(activeMonitorRule.mirrorOf);
|
setMirror(activeMonitorRule.mirrorOf);
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"monitoradded", szName});
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"monitoraddedv2", std::format("{},{},{}", ID, szName, szShortDescription)});
|
|
||||||
EMIT_HOOK_EVENT("monitorAdded", this);
|
|
||||||
|
|
||||||
if (!g_pCompositor->m_pLastMonitor) // set the last monitor if it isnt set yet
|
if (!g_pCompositor->m_pLastMonitor) // set the last monitor if it isnt set yet
|
||||||
g_pCompositor->setActiveMonitor(this);
|
g_pCompositor->setActiveMonitor(this);
|
||||||
|
|
||||||
|
@ -224,6 +220,10 @@ void CMonitor::onConnect(bool noRule) {
|
||||||
PROTO::gamma->applyGammaToState(this);
|
PROTO::gamma->applyGammaToState(this);
|
||||||
|
|
||||||
events.connect.emit();
|
events.connect.emit();
|
||||||
|
|
||||||
|
g_pEventManager->postEvent(SHyprIPCEvent{"monitoradded", szName});
|
||||||
|
g_pEventManager->postEvent(SHyprIPCEvent{"monitoraddedv2", std::format("{},{},{}", ID, szName, szShortDescription)});
|
||||||
|
EMIT_HOOK_EVENT("monitorAdded", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMonitor::onDisconnect(bool destroy) {
|
void CMonitor::onDisconnect(bool destroy) {
|
||||||
|
@ -281,9 +281,6 @@ void CMonitor::onDisconnect(bool destroy) {
|
||||||
|
|
||||||
Debug::log(LOG, "Removed monitor {}!", szName);
|
Debug::log(LOG, "Removed monitor {}!", szName);
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"monitorremoved", szName});
|
|
||||||
EMIT_HOOK_EVENT("monitorRemoved", this);
|
|
||||||
|
|
||||||
if (!BACKUPMON) {
|
if (!BACKUPMON) {
|
||||||
Debug::log(WARN, "Unplugged last monitor, entering an unsafe state. Good luck my friend.");
|
Debug::log(WARN, "Unplugged last monitor, entering an unsafe state. Good luck my friend.");
|
||||||
g_pCompositor->enterUnsafeState();
|
g_pCompositor->enterUnsafeState();
|
||||||
|
@ -342,6 +339,9 @@ void CMonitor::onDisconnect(bool destroy) {
|
||||||
g_pHyprRenderer->m_pMostHzMonitor = pMonitorMostHz;
|
g_pHyprRenderer->m_pMostHzMonitor = pMonitorMostHz;
|
||||||
}
|
}
|
||||||
std::erase_if(g_pCompositor->m_vMonitors, [&](SP<CMonitor>& el) { return el.get() == this; });
|
std::erase_if(g_pCompositor->m_vMonitors, [&](SP<CMonitor>& el) { return el.get() == this; });
|
||||||
|
|
||||||
|
g_pEventManager->postEvent(SHyprIPCEvent{"monitorremoved", szName});
|
||||||
|
EMIT_HOOK_EVENT("monitorRemoved", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMonitor::addDamage(const pixman_region32_t* rg) {
|
void CMonitor::addDamage(const pixman_region32_t* rg) {
|
||||||
|
|
Loading…
Reference in a new issue