summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Compositor.cpp4
-rw-r--r--src/events/Windows.cpp8
-rw-r--r--src/managers/input/InputManager.cpp3
3 files changed, 12 insertions, 3 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index 7fa45b07..66306888 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -893,6 +893,10 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
g_pLayoutManager->getCurrentLayout()->bringWindowToTop(pWindow);
if (!pWindow || !windowValidMapped(pWindow)) {
+
+ if (!m_pLastWindow && !pWindow)
+ return;
+
const auto PLASTWINDOW = m_pLastWindow;
m_pLastWindow = nullptr;
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp
index 54ffb37e..f78a2975 100644
--- a/src/events/Windows.cpp
+++ b/src/events/Windows.cpp
@@ -737,8 +737,14 @@ void Events::listener_unmapWindow(void* owner, void* data) {
g_pInputManager->simulateMouseMovement();
else
g_pCompositor->focusWindow(PWINDOWCANDIDATE);
- } else {
+ } else
g_pInputManager->simulateMouseMovement();
+
+ // CWindow::onUnmap will remove this window's active status, but we can't really do it above.
+ if (PWINDOW == g_pCompositor->m_pLastWindow || !g_pCompositor->m_pLastWindow) {
+ g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", ","});
+ g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", ","});
+ EMIT_HOOK_EVENT("activeWindow", (CWindow*)nullptr);
}
} else {
Debug::log(LOG, "Unmapped was not focused, ignoring a refocus.");
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index fe66b8ba..1b89f8fc 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -314,9 +314,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
wlr_seat_pointer_clear_focus(g_pCompositor->m_sSeat.seat);
- if (refocus) { // if we are forcing a refocus, and we don't find a surface, clear the kb focus too!
+ if (refocus || !g_pCompositor->m_pLastWindow) // if we are forcing a refocus, and we don't find a surface, clear the kb focus too!
g_pCompositor->focusWindow(nullptr);
- }
return;
}