aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorzakk4223 <[email protected]>2024-04-24 19:05:19 -0400
committerGitHub <[email protected]>2024-04-25 00:05:19 +0100
commit72e31d3335982382c289302a41f7144009c5c82f (patch)
tree8f75b8b2b98d2fc3fc6a2d8c78dd274bc4a232a7 /src
parent3878f806ff771651829977a01b84313c34997285 (diff)
downloadHyprland-72e31d3335982382c289302a41f7144009c5c82f.tar.gz
Hyprland-72e31d3335982382c289302a41f7144009c5c82f.zip
idle-inhibit: Always recheck idle inhibitors on creation and deletion (#5738)
Formatting
Diffstat (limited to 'src')
-rw-r--r--src/managers/input/IdleInhibitor.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/managers/input/IdleInhibitor.cpp b/src/managers/input/IdleInhibitor.cpp
index 21f1652f..b5e6feb2 100644
--- a/src/managers/input/IdleInhibitor.cpp
+++ b/src/managers/input/IdleInhibitor.cpp
@@ -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);
- PINHIBIT->inhibitor->listeners.destroy = PINHIBIT->inhibitor->resource.lock()->events.destroy.registerListener(
- [this, PINHIBIT](std::any data) { std::erase_if(m_vIdleInhibitors, [PINHIBIT](const auto& other) { return other.get() == PINHIBIT; }); });
+ PINHIBIT->inhibitor->listeners.destroy = PINHIBIT->inhibitor->resource.lock()->events.destroy.registerListener([this, PINHIBIT](std::any data) {
+ std::erase_if(m_vIdleInhibitors, [PINHIBIT](const auto& other) { return other.get() == PINHIBIT; });
+ recheckIdleInhibitorStatus();
+ });
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?");
- 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();
}
@@ -62,4 +61,4 @@ void CInputManager::recheckIdleInhibitorStatus() {
g_pCompositor->setIdleActivityInhibit(true);
return;
-} \ No newline at end of file
+}