input/layers: Fix exclusive LS focus / refocus after unmap (#9984)

This commit is contained in:
Vaxry
2025-04-07 20:52:11 +02:00
committed by GitHub
parent a8eda7f978
commit 70ae99f521
3 changed files with 25 additions and 10 deletions

View File

@@ -306,6 +306,17 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal());
// forced above all
if (!g_pInputManager->m_dExclusiveLSes.empty()) {
if (!foundSurface)
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &g_pInputManager->m_dExclusiveLSes, &surfaceCoords, &pFoundLayerSurface);
if (!foundSurface) {
foundSurface = (*g_pInputManager->m_dExclusiveLSes.begin())->surface->resource();
surfacePos = (*g_pInputManager->m_dExclusiveLSes.begin())->realPosition->goal();
}
}
if (!foundSurface)
foundSurface = g_pCompositor->vectorToLayerPopupSurface(mouseCoords, PMONITOR, &surfaceCoords, &pFoundLayerSurface);
@@ -1420,10 +1431,15 @@ void CInputManager::refocus() {
mouseMoveUnified(0, true);
}
void CInputManager::refocusLastWindow(PHLMONITOR pMonitor) {
bool CInputManager::refocusLastWindow(PHLMONITOR pMonitor) {
if (!m_dExclusiveLSes.empty()) {
Debug::log(LOG, "CInputManager::refocusLastWindow: ignoring, exclusive LS present.");
return false;
}
if (!pMonitor) {
refocus();
return;
return true;
}
Vector2D surfaceCoords;
@@ -1432,10 +1448,6 @@ void CInputManager::refocusLastWindow(PHLMONITOR pMonitor) {
g_pInputManager->releaseAllMouseButtons();
// first try for an exclusive layer
if (!m_dExclusiveLSes.empty())
foundSurface = m_dExclusiveLSes[m_dExclusiveLSes.size() - 1]->surface->resource();
// then any surfaces above windows on the same monitor
if (!foundSurface) {
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
@@ -1465,6 +1477,8 @@ void CInputManager::refocusLastWindow(PHLMONITOR pMonitor) {
refocus();
}
return true;
}
void CInputManager::unconstrainMouse() {