mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 14:45:59 +01:00
unify LS unmap focus
This commit is contained in:
parent
34bd2cf803
commit
ba9a8a9ded
3 changed files with 26 additions and 4 deletions
|
@ -199,8 +199,29 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) {
|
|||
|
||||
// refocus if needed
|
||||
if (layersurface->layerSurface->surface == g_pCompositor->m_pLastFocus) {
|
||||
|
||||
Vector2D surfaceCoords;
|
||||
SLayerSurface* pFoundLayerSurface = nullptr;
|
||||
wlr_surface* foundSurface = nullptr;
|
||||
|
||||
g_pCompositor->m_pLastFocus = nullptr;
|
||||
g_pInputManager->refocus();
|
||||
|
||||
// find LS-es to focus
|
||||
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface);
|
||||
|
||||
if (!foundSurface)
|
||||
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface);
|
||||
|
||||
|
||||
if (!foundSurface) {
|
||||
// if there isn't any, focus the last window
|
||||
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
|
||||
g_pCompositor->focusWindow(nullptr);
|
||||
g_pCompositor->focusWindow(PLASTWINDOW);
|
||||
} else {
|
||||
// otherwise, full refocus
|
||||
g_pInputManager->refocus();
|
||||
}
|
||||
}
|
||||
|
||||
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, layersurface->geometry.height};
|
||||
|
|
|
@ -62,8 +62,10 @@ void CHyprXWaylandManager::activateWindow(CWindow* pWindow, bool activate) {
|
|||
else
|
||||
wlr_xdg_toplevel_set_activated(pWindow->m_uSurface.xdg->toplevel, activate);
|
||||
|
||||
g_pCompositor->m_pLastFocus = getWindowSurface(pWindow);
|
||||
g_pCompositor->m_pLastWindow = pWindow;
|
||||
if (activate) {
|
||||
g_pCompositor->m_pLastFocus = getWindowSurface(pWindow);
|
||||
g_pCompositor->m_pLastWindow = pWindow;
|
||||
}
|
||||
|
||||
if (!pWindow->m_bPinned)
|
||||
g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID)->m_pLastFocusedWindow = pWindow;
|
||||
|
|
|
@ -311,7 +311,6 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||
} else {
|
||||
if (pFoundLayerSurface && pFoundLayerSurface->layerSurface->current.keyboard_interactive && *PFOLLOWMOUSE != 3 && allowKeyboardRefocus) {
|
||||
g_pCompositor->focusSurface(foundSurface);
|
||||
g_pCompositor->m_pLastWindow = nullptr; // reset last window as we have a full focus on a LS
|
||||
}
|
||||
|
||||
if (pFoundLayerSurface)
|
||||
|
|
Loading…
Reference in a new issue