mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-06 15:11:57 -07:00
input: Rewritten pointer constraints (#4889)
* rewritten constraints * send pointer enter on activate if not pointer focus * minor cleanup * simulate movement on commit * don't ignore oneshot prop * various fixes * dont send motion on confined * update pos hint on region change
This commit is contained in:
@@ -1040,13 +1040,6 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
||||
if (pWindow->m_phForeignToplevel)
|
||||
wlr_foreign_toplevel_handle_v1_set_activated(pWindow->m_phForeignToplevel, true);
|
||||
|
||||
if (!pWindow->m_bIsX11) {
|
||||
const auto PCONSTRAINT = wlr_pointer_constraints_v1_constraint_for_surface(m_sWLRPointerConstraints, pWindow->m_uSurface.xdg->surface, m_sSeat.seat);
|
||||
|
||||
if (PCONSTRAINT)
|
||||
g_pInputManager->constrainMouse(m_sSeat.mouse, PCONSTRAINT);
|
||||
}
|
||||
|
||||
g_pInputManager->recheckIdleInhibitorStatus();
|
||||
|
||||
// move to front of the window history
|
||||
@@ -1069,6 +1062,8 @@ void CCompositor::focusSurface(wlr_surface* pSurface, CWindow* pWindowOwner) {
|
||||
if (g_pSessionLockManager->isSessionLocked() && !g_pSessionLockManager->isSurfaceSessionLock(pSurface))
|
||||
return;
|
||||
|
||||
const auto PLASTSURF = m_pLastFocus;
|
||||
|
||||
// Unfocus last surface if should
|
||||
if (m_pLastFocus && !pWindowOwner)
|
||||
g_pXWaylandManager->activateSurface(m_pLastFocus, false);
|
||||
@@ -1103,6 +1098,15 @@ void CCompositor::focusSurface(wlr_surface* pSurface, CWindow* pWindowOwner) {
|
||||
m_pLastFocus = pSurface;
|
||||
|
||||
EMIT_HOOK_EVENT("keyboardFocus", pSurface);
|
||||
|
||||
const auto SURF = CWLSurface::surfaceFromWlr(pSurface);
|
||||
const auto OLDSURF = CWLSurface::surfaceFromWlr(PLASTSURF);
|
||||
|
||||
if (OLDSURF && OLDSURF->constraint())
|
||||
OLDSURF->constraint()->deactivate();
|
||||
|
||||
if (SURF && SURF->constraint())
|
||||
SURF->constraint()->activate();
|
||||
}
|
||||
|
||||
bool CCompositor::windowValidMapped(CWindow* pWindow) {
|
||||
@@ -1770,31 +1774,6 @@ void checkFocusSurfaceIter(wlr_surface* pSurface, int x, int y, void* data) {
|
||||
pair->second = pair->second || pSurface == pair->first;
|
||||
}
|
||||
|
||||
CWindow* CCompositor::getConstraintWindow(SMouse* pMouse) {
|
||||
if (!pMouse->currentConstraint)
|
||||
return nullptr;
|
||||
|
||||
const auto PSURFACE = pMouse->currentConstraint->surface;
|
||||
|
||||
for (auto& w : m_vWindows) {
|
||||
if (w->isHidden() || !w->m_bIsMapped || !w->m_pWLSurface.exists())
|
||||
continue;
|
||||
|
||||
if (w->m_bIsX11) {
|
||||
if (PSURFACE == w->m_pWLSurface.wlr())
|
||||
return w.get();
|
||||
} else {
|
||||
std::pair<wlr_surface*, bool> check = {PSURFACE, false};
|
||||
wlr_surface_for_each_surface(w->m_uSurface.xdg->surface, checkFocusSurfaceIter, &check);
|
||||
|
||||
if (check.second)
|
||||
return w.get();
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CMonitor* CCompositor::getMonitorInDirection(const char& dir) {
|
||||
return this->getMonitorInDirection(m_pLastMonitor, dir);
|
||||
}
|
||||
|
Reference in New Issue
Block a user