mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 19:26:00 +01:00
idle-inhibit: Always recheck idle inhibitors on creation and deletion (#5738)
Formatting
This commit is contained in:
parent
3878f806ff
commit
72e31d3335
1 changed files with 12 additions and 13 deletions
|
@ -8,22 +8,21 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) {
|
||||||
|
|
||||||
Debug::log(LOG, "New idle inhibitor registered for surface {:x}", (uintptr_t)PINHIBIT->inhibitor->surface);
|
Debug::log(LOG, "New idle inhibitor registered for surface {:x}", (uintptr_t)PINHIBIT->inhibitor->surface);
|
||||||
|
|
||||||
PINHIBIT->inhibitor->listeners.destroy = PINHIBIT->inhibitor->resource.lock()->events.destroy.registerListener(
|
PINHIBIT->inhibitor->listeners.destroy = PINHIBIT->inhibitor->resource.lock()->events.destroy.registerListener([this, PINHIBIT](std::any data) {
|
||||||
[this, PINHIBIT](std::any data) { std::erase_if(m_vIdleInhibitors, [PINHIBIT](const auto& other) { return other.get() == PINHIBIT; }); });
|
std::erase_if(m_vIdleInhibitors, [PINHIBIT](const auto& other) { return other.get() == PINHIBIT; });
|
||||||
|
recheckIdleInhibitorStatus();
|
||||||
|
});
|
||||||
|
|
||||||
const auto PWINDOW = g_pCompositor->getWindowFromSurface(PINHIBIT->inhibitor->surface);
|
const auto PWINDOW = g_pCompositor->getWindowFromSurface(PINHIBIT->inhibitor->surface);
|
||||||
|
|
||||||
if (!PWINDOW) {
|
if (PWINDOW) {
|
||||||
|
PINHIBIT->pWindow = PWINDOW;
|
||||||
|
PINHIBIT->windowDestroyListener = PWINDOW->events.destroy.registerListener([PINHIBIT](std::any data) {
|
||||||
|
Debug::log(WARN, "Inhibitor got its window destroyed before its inhibitor resource.");
|
||||||
|
PINHIBIT->pWindow = nullptr;
|
||||||
|
});
|
||||||
|
} else
|
||||||
Debug::log(WARN, "Inhibitor is for no window?");
|
Debug::log(WARN, "Inhibitor is for no window?");
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PINHIBIT->pWindow = PWINDOW;
|
|
||||||
PINHIBIT->windowDestroyListener = PWINDOW->events.destroy.registerListener([PINHIBIT](std::any data) {
|
|
||||||
Debug::log(WARN, "Inhibitor got its window destroyed before its inhibitor resource.");
|
|
||||||
PINHIBIT->pWindow = nullptr;
|
|
||||||
});
|
|
||||||
|
|
||||||
recheckIdleInhibitorStatus();
|
recheckIdleInhibitorStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,4 +61,4 @@ void CInputManager::recheckIdleInhibitorStatus() {
|
||||||
|
|
||||||
g_pCompositor->setIdleActivityInhibit(true);
|
g_pCompositor->setIdleActivityInhibit(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue