minor constraint fixes

This commit is contained in:
vaxerski 2022-05-12 16:07:14 +02:00
parent d4d72ae54d
commit 1d21e5303b

View file

@ -141,12 +141,16 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
// constraints
// All constraints TODO: multiple mice?
if (g_pCompositor->m_sSeat.mouse->currentConstraint) {
if (g_pCompositor->m_sSeat.mouse->currentConstraint && pFoundWindow) { // TODO: make this match the pFoundWindow in SOME way. We don't want to constrain the mouse on another window.
// XWayland windows sometimes issue constraints weirdly.
const auto CONSTRAINTWINDOW = g_pCompositor->getConstraintWindow(g_pCompositor->m_sSeat.mouse);
if (!CONSTRAINTWINDOW) {
g_pCompositor->m_sSeat.mouse->currentConstraint = nullptr;
} else {
// Native Wayland apps know how 2 constrain themselves.
// XWayland, we just have to accept them. Might cause issues, but thats XWayland for ya.
if (CONSTRAINTWINDOW->m_bIsX11 || pFoundWindow == CONSTRAINTWINDOW) {
const auto CONSTRAINTPOS = CONSTRAINTWINDOW->m_bIsX11 ? Vector2D(CONSTRAINTWINDOW->m_uSurface.xwayland->x, CONSTRAINTWINDOW->m_uSurface.xwayland->y) : CONSTRAINTWINDOW->m_vRealPosition.vec();
const auto CONSTRAINTSIZE = CONSTRAINTWINDOW->m_bIsX11 ? Vector2D(CONSTRAINTWINDOW->m_uSurface.xwayland->width, CONSTRAINTWINDOW->m_uSurface.xwayland->height) : CONSTRAINTWINDOW->m_vRealSize.vec();
@ -159,6 +163,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
}
}
}
}
void CInputManager::onMouseButton(wlr_pointer_button_event* e) {
wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sSeat.seat);