mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-02 03:45:58 +01:00
input: find surface pos correctly when mouse drag is active
fixes #6144
This commit is contained in:
parent
c21a5a9340
commit
f8857e6072
1 changed files with 19 additions and 16 deletions
|
@ -223,25 +223,28 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
// and we're not dnd-ing, don't refocus. Keep focus on last surface.
|
// and we're not dnd-ing, don't refocus. Keep focus on last surface.
|
||||||
if (!PROTO::data->dndActive() && !m_lCurrentlyHeldButtons.empty() && g_pCompositor->m_pLastFocus && g_pSeatManager->state.pointerFocus && !m_bHardInput) {
|
if (!PROTO::data->dndActive() && !m_lCurrentlyHeldButtons.empty() && g_pCompositor->m_pLastFocus && g_pSeatManager->state.pointerFocus && !m_bHardInput) {
|
||||||
foundSurface = g_pSeatManager->state.pointerFocus;
|
foundSurface = g_pSeatManager->state.pointerFocus;
|
||||||
pFoundLayerSurface = g_pCompositor->getLayerSurfaceFromSurface(foundSurface);
|
|
||||||
if (pFoundLayerSurface) {
|
// IME popups aren't desktop-like elements
|
||||||
surfacePos = pFoundLayerSurface->position;
|
// TODO: make them.
|
||||||
m_bFocusHeldByButtons = true;
|
|
||||||
m_bRefocusHeldByButtons = refocus;
|
|
||||||
} else {
|
|
||||||
CInputPopup* foundPopup = m_sIMERelay.popupFromSurface(foundSurface);
|
CInputPopup* foundPopup = m_sIMERelay.popupFromSurface(foundSurface);
|
||||||
if (foundPopup) {
|
if (foundPopup) {
|
||||||
surfacePos = foundPopup->globalBox().pos();
|
surfacePos = foundPopup->globalBox().pos();
|
||||||
m_bFocusHeldByButtons = true;
|
m_bFocusHeldByButtons = true;
|
||||||
m_bRefocusHeldByButtons = refocus;
|
m_bRefocusHeldByButtons = refocus;
|
||||||
} else if (!g_pCompositor->m_pLastWindow.expired()) {
|
} else {
|
||||||
foundSurface = g_pSeatManager->state.pointerFocus;
|
auto HLSurface = CWLSurface::surfaceFromWlr(foundSurface);
|
||||||
pFoundWindow = g_pCompositor->m_pLastWindow.lock();
|
|
||||||
|
|
||||||
surfaceCoords = g_pCompositor->vectorToSurfaceLocal(mouseCoords, pFoundWindow, foundSurface);
|
if (HLSurface) {
|
||||||
m_bFocusHeldByButtons = true;
|
const auto BOX = HLSurface->getSurfaceBoxGlobal();
|
||||||
m_bRefocusHeldByButtons = refocus;
|
|
||||||
}
|
if (BOX) {
|
||||||
|
surfacePos = BOX->pos();
|
||||||
|
pFoundLayerSurface = HLSurface->getLayer();
|
||||||
|
pFoundWindow = HLSurface->getWindow();
|
||||||
|
} else // reset foundSurface, find one normally
|
||||||
|
foundSurface = nullptr;
|
||||||
|
} else // reset foundSurface, find one normally
|
||||||
|
foundSurface = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue