diff options
| author | vaxerski <vaxry@vaxry.net> | 2023-09-13 11:33:36 +0100 |
|---|---|---|
| committer | vaxerski <vaxry@vaxry.net> | 2023-09-13 11:33:36 +0100 |
| commit | b884544ee63b4c3b3b150ff69cf24c90058c2777 (patch) | |
| tree | 8bcc1ad77b9238ecddab0f22c3b3343c46ced8b4 /src/managers/input/InputManager.cpp | |
| parent | 6b1ac659e005042a6970ffc489aef71e0875af15 (diff) | |
input: don't refocus on switched workspace on the same monitor
Diffstat (limited to 'src/managers/input/InputManager.cpp')
| -rw-r--r-- | src/managers/input/InputManager.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index dbd40bef..6b0841f5 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -45,6 +45,23 @@ void CInputManager::simulateMouseMovement() { m_tmrLastCursorMovement.reset(); } +void CInputManager::sendMotionEventsToFocused() { + if (!g_pCompositor->m_pLastFocus) + return; + + // todo: this sucks ass + const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_pLastFocus); + const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_pLastFocus); + + timespec now; + clock_gettime(CLOCK_MONOTONIC, &now); + + const auto LOCAL = getMouseCoordsInternal() - (PWINDOW ? PWINDOW->m_vRealPosition.goalv() : (PLS ? Vector2D{PLS->geometry.x, PLS->geometry.y} : Vector2D{})); + + wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, g_pCompositor->m_pLastFocus, LOCAL.x, LOCAL.y); + wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, now.tv_sec * 1000 + now.tv_nsec / 10000000, LOCAL.x, LOCAL.y); +} + void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue; static auto* const PMOUSEREFOCUS = &g_pConfigManager->getConfigValuePtr("input:mouse_refocus")->intValue; @@ -1569,7 +1586,7 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) { wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; eBorderIconDirection direction = BORDERICON_NONE; wlr_box boxFullGrabInput = {box.x - *PEXTENDBORDERGRAB - BORDERSIZE, box.y - *PEXTENDBORDERGRAB - BORDERSIZE, box.width + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE), - box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)}; + box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)}; if (!wlr_box_contains_point(&boxFullGrabInput, mouseCoords.x, mouseCoords.y) || (!m_lCurrentlyHeldButtons.empty() && !currentlyDraggedWindow)) { direction = BORDERICON_NONE; |
