diff options
author | Junxuan Liao <[email protected]> | 2024-04-07 22:15:50 +0800 |
---|---|---|
committer | GitHub <[email protected]> | 2024-04-07 15:15:50 +0100 |
commit | d657b59f701a65c7a85986e8d99754716468ee5b (patch) | |
tree | 633d9ad270eb1f2455641d2c2fa708c7e1759b38 /src/managers/input/InputManager.cpp | |
parent | f2a848cbcc41f29fb62ee67aef95136ae1a650da (diff) | |
download | Hyprland-d657b59f701a65c7a85986e8d99754716468ee5b.tar.gz Hyprland-d657b59f701a65c7a85986e8d99754716468ee5b.zip |
IME: fix IME popup mouse inputs (again) (#5417)
`lastBoxLocal`'s size should be the actual popup's size instead of the cursor
rectangle's size. Also, the rectangle position is now relative to the popup.
(Actually fixes #5255 imho.)
One thing #3922 missed was handling focus held by buttons. Let's hope I get
it right this time.
Diffstat (limited to 'src/managers/input/InputManager.cpp')
-rw-r--r-- | src/managers/input/InputManager.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 05317281..84ac00b5 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -171,26 +171,26 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { updateDragIcon(); if (!m_sDrag.drag && !m_lCurrentlyHeldButtons.empty() && g_pCompositor->m_pLastFocus && m_pLastMouseSurface) { - if (m_bLastFocusOnLS) { - foundSurface = m_pLastMouseSurface; - pFoundLayerSurface = g_pCompositor->getLayerSurfaceFromSurface(foundSurface); - if (pFoundLayerSurface) { - surfacePos = g_pCompositor->getLayerSurfaceFromSurface(foundSurface)->position; + foundSurface = m_pLastMouseSurface; + pFoundLayerSurface = g_pCompositor->getLayerSurfaceFromSurface(foundSurface); + if (pFoundLayerSurface) { + surfacePos = pFoundLayerSurface->position; + m_bFocusHeldByButtons = true; + m_bRefocusHeldByButtons = refocus; + } else { + CInputPopup* foundPopup = m_sIMERelay.popupFromSurface(foundSurface); + if (foundPopup) { + surfacePos = foundPopup->globalBox().pos(); m_bFocusHeldByButtons = true; m_bRefocusHeldByButtons = refocus; - } else { - // ? - foundSurface = nullptr; - pFoundLayerSurface = nullptr; - } - } else if (g_pCompositor->m_pLastWindow) { - foundSurface = m_pLastMouseSurface; - pFoundWindow = g_pCompositor->m_pLastWindow; - - surfaceCoords = g_pCompositor->vectorToSurfaceLocal(mouseCoords, pFoundWindow, foundSurface); + } else if (g_pCompositor->m_pLastWindow) { + foundSurface = m_pLastMouseSurface; + pFoundWindow = g_pCompositor->m_pLastWindow; - m_bFocusHeldByButtons = true; - m_bRefocusHeldByButtons = refocus; + surfaceCoords = g_pCompositor->vectorToSurfaceLocal(mouseCoords, pFoundWindow, foundSurface); + m_bFocusHeldByButtons = true; + m_bRefocusHeldByButtons = refocus; + } } } |