mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-06 15:11:57 -07:00
input/layers: Fix exclusive LS focus / refocus after unmap (#9984)
This commit is contained in:
@@ -234,9 +234,10 @@ void CLayerSurface::onUnmap() {
|
|||||||
|
|
||||||
// refocus if needed
|
// refocus if needed
|
||||||
// vvvvvvvvvvvvv if there is a last focus and the last focus is not keyboard focusable, fallback to window
|
// vvvvvvvvvvvvv if there is a last focus and the last focus is not keyboard focusable, fallback to window
|
||||||
if (WASLASTFOCUS || (g_pCompositor->m_pLastFocus && g_pCompositor->m_pLastFocus->hlSurface && !g_pCompositor->m_pLastFocus->hlSurface->keyboardFocusable()))
|
if (WASLASTFOCUS || (g_pCompositor->m_pLastFocus && g_pCompositor->m_pLastFocus->hlSurface && !g_pCompositor->m_pLastFocus->hlSurface->keyboardFocusable())) {
|
||||||
g_pInputManager->refocusLastWindow(PMONITOR);
|
if (!g_pInputManager->refocusLastWindow(PMONITOR))
|
||||||
else if (g_pCompositor->m_pLastFocus && g_pCompositor->m_pLastFocus != surface->resource())
|
g_pInputManager->refocus();
|
||||||
|
} else if (g_pCompositor->m_pLastFocus && g_pCompositor->m_pLastFocus != surface->resource())
|
||||||
g_pSeatManager->setKeyboardFocus(g_pCompositor->m_pLastFocus.lock());
|
g_pSeatManager->setKeyboardFocus(g_pCompositor->m_pLastFocus.lock());
|
||||||
|
|
||||||
CBox geomFixed = {geometry.x + PMONITOR->vecPosition.x, geometry.y + PMONITOR->vecPosition.y, geometry.width, geometry.height};
|
CBox geomFixed = {geometry.x + PMONITOR->vecPosition.x, geometry.y + PMONITOR->vecPosition.y, geometry.width, geometry.height};
|
||||||
|
@@ -306,6 +306,17 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal());
|
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)
|
if (!foundSurface)
|
||||||
foundSurface = g_pCompositor->vectorToLayerPopupSurface(mouseCoords, PMONITOR, &surfaceCoords, &pFoundLayerSurface);
|
foundSurface = g_pCompositor->vectorToLayerPopupSurface(mouseCoords, PMONITOR, &surfaceCoords, &pFoundLayerSurface);
|
||||||
|
|
||||||
@@ -1420,10 +1431,15 @@ void CInputManager::refocus() {
|
|||||||
mouseMoveUnified(0, true);
|
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) {
|
if (!pMonitor) {
|
||||||
refocus();
|
refocus();
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D surfaceCoords;
|
Vector2D surfaceCoords;
|
||||||
@@ -1432,10 +1448,6 @@ void CInputManager::refocusLastWindow(PHLMONITOR pMonitor) {
|
|||||||
|
|
||||||
g_pInputManager->releaseAllMouseButtons();
|
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
|
// then any surfaces above windows on the same monitor
|
||||||
if (!foundSurface) {
|
if (!foundSurface) {
|
||||||
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
|
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();
|
refocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::unconstrainMouse() {
|
void CInputManager::unconstrainMouse() {
|
||||||
|
@@ -114,7 +114,7 @@ class CInputManager {
|
|||||||
|
|
||||||
Vector2D getMouseCoordsInternal();
|
Vector2D getMouseCoordsInternal();
|
||||||
void refocus();
|
void refocus();
|
||||||
void refocusLastWindow(PHLMONITOR pMonitor);
|
bool refocusLastWindow(PHLMONITOR pMonitor);
|
||||||
void simulateMouseMovement();
|
void simulateMouseMovement();
|
||||||
void sendMotionEventsToFocused();
|
void sendMotionEventsToFocused();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user