constraint focus simplifications

This commit is contained in:
vaxerski 2022-11-04 18:09:40 +00:00
parent c9eb0f3aab
commit 70aece8522

View file

@ -70,8 +70,6 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
const auto PMONITOR = g_pCompositor->getMonitorFromCursor(); const auto PMONITOR = g_pCompositor->getMonitorFromCursor();
bool didConstraintOnCursor = false;
// constraints // constraints
// All constraints TODO: multiple mice? // All constraints TODO: multiple mice?
if (g_pCompositor->m_sSeat.mouse->currentConstraint) { if (g_pCompositor->m_sSeat.mouse->currentConstraint) {
@ -104,32 +102,29 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
wlr_cursor_warp_closest(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, newConstrainedCoords.x, newConstrainedCoords.y); wlr_cursor_warp_closest(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, newConstrainedCoords.x, newConstrainedCoords.y);
mouseCoords = newConstrainedCoords; mouseCoords = newConstrainedCoords;
didConstraintOnCursor = true;
} }
} else { } else {
if ((!CONSTRAINTWINDOW->m_bIsX11 && PMONITOR && CONSTRAINTWINDOW->m_iWorkspaceID == PMONITOR->activeWorkspace) || (CONSTRAINTWINDOW->m_bIsX11)) { if ((!CONSTRAINTWINDOW->m_bIsX11 && PMONITOR && CONSTRAINTWINDOW->m_iWorkspaceID == PMONITOR->activeWorkspace) || (CONSTRAINTWINDOW->m_bIsX11)) {
g_pCompositor->m_sSeat.mouse->constraintActive = true; g_pCompositor->m_sSeat.mouse->constraintActive = true;
}
}
if (CONSTRAINTWINDOW->m_bIsX11) { if (CONSTRAINTWINDOW->m_bIsX11) {
foundSurface = g_pXWaylandManager->getWindowSurface(CONSTRAINTWINDOW); foundSurface = g_pXWaylandManager->getWindowSurface(CONSTRAINTWINDOW);
surfacePos = CONSTRAINTWINDOW->m_vRealPosition.vec(); surfacePos = CONSTRAINTWINDOW->m_vRealPosition.vec();
} else { } else {
g_pCompositor->vectorWindowToSurface(mouseCoords, CONSTRAINTWINDOW, surfaceCoords); g_pCompositor->vectorWindowToSurface(mouseCoords, CONSTRAINTWINDOW, surfaceCoords);
} }
pFoundWindow = CONSTRAINTWINDOW; pFoundWindow = CONSTRAINTWINDOW;
} }
} }
}
}
// update stuff // update stuff
updateDragIcon(); updateDragIcon();
g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal()); g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal());
if (didConstraintOnCursor)
return; // don't process when cursor constrained
if (PMONITOR && PMONITOR != g_pCompositor->m_pLastMonitor) { if (PMONITOR && PMONITOR != g_pCompositor->m_pLastMonitor) {
g_pCompositor->m_pLastMonitor = PMONITOR; g_pCompositor->m_pLastMonitor = PMONITOR;