diff --git a/src/events/Popups.cpp b/src/events/Popups.cpp index 00a49de0..56ce41a6 100644 --- a/src/events/Popups.cpp +++ b/src/events/Popups.cpp @@ -178,6 +178,8 @@ void Events::listener_unmapPopupXDG(void* owner, void* data) { g_pHyprRenderer->damageBox(lx - extents.x, ly - extents.y, extents.width + 2, extents.height + 2); PPOPUP->pSurfaceTree = nullptr; + + g_pInputManager->simulateMouseMovement(); // to focus and return back to an appropriate surface } void Events::listener_commitPopupXDG(void* owner, void* data) { diff --git a/src/helpers/SubsurfaceTree.cpp b/src/helpers/SubsurfaceTree.cpp index 633d80ad..aa9411f0 100644 --- a/src/helpers/SubsurfaceTree.cpp +++ b/src/helpers/SubsurfaceTree.cpp @@ -197,6 +197,8 @@ void Events::listener_unmapSubsurface(void* owner, void* data) { // subsurface->pChild = nullptr; } } + + g_pInputManager->simulateMouseMovement(); // to focus and return back to an appropriate surface } void Events::listener_commitSubsurface(void* owner, void* data) { diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index f00b135a..e3bd9c81 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -35,6 +35,15 @@ void CInputManager::onMouseWarp(wlr_pointer_motion_absolute_event* e) { m_bLastInputTouch = false; } +void CInputManager::simulateMouseMovement() { + timespec now; + clock_gettime(CLOCK_MONOTONIC, &now); + m_vLastCursorPosFloored = m_vLastCursorPosFloored - Vector2D(1, 1); // hack: force the mouseMoveUnified to report without making this a refocus. + mouseMoveUnified(now.tv_sec * 1000 + now.tv_nsec / 10000000); + + m_tmrLastCursorMovement.reset(); +} + void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue; static auto* const PMOUSEDPMS = &g_pConfigManager->getConfigValuePtr("misc:mouse_move_enables_dpms")->intValue; diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp index ec495d69..525b5c85 100644 --- a/src/managers/input/InputManager.hpp +++ b/src/managers/input/InputManager.hpp @@ -7,12 +7,14 @@ #include "../../helpers/Timer.hpp" #include "InputMethodRelay.hpp" -enum eClickBehaviorMode { +enum eClickBehaviorMode +{ CLICKMODE_DEFAULT = 0, CLICKMODE_KILL }; -enum eMouseBindMode { +enum eMouseBindMode +{ MBIND_INVALID = -1, MBIND_MOVE = 0, MBIND_RESIZE @@ -72,6 +74,7 @@ class CInputManager { Vector2D getMouseCoordsInternal(); void refocus(); + void simulateMouseMovement(); void setKeyboardLayout(); void setPointerConfigs();