diff --git a/src/Compositor.cpp b/src/Compositor.cpp index c3758513..0d8698a6 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -625,15 +625,17 @@ CWindow* CCompositor::getWindowForPopup(wlr_xdg_popup* popup) { return nullptr; } -wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::list* layerSurfaces, Vector2D* sCoords) { +wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::list* layerSurfaces, Vector2D* sCoords, SLayerSurface** ppLayerSurfaceFound) { for (auto it = layerSurfaces->rbegin(); it != layerSurfaces->rend(); it++) { if ((*it)->fadingOut || !(*it)->layerSurface || ((*it)->layerSurface && !(*it)->layerSurface->mapped)) continue; const auto SURFACEAT = wlr_layer_surface_v1_surface_at((*it)->layerSurface, pos.x - (*it)->geometry.x, pos.y - (*it)->geometry.y, &sCoords->x, &sCoords->y); - if (SURFACEAT) + if (SURFACEAT) { + *ppLayerSurfaceFound = *it; return SURFACEAT; + } } return nullptr; diff --git a/src/Compositor.hpp b/src/Compositor.hpp index ae7777d3..7ad3b7f8 100644 --- a/src/Compositor.hpp +++ b/src/Compositor.hpp @@ -101,7 +101,7 @@ public: CWindow* vectorToWindow(const Vector2D&); CWindow* vectorToWindowIdeal(const Vector2D&); CWindow* vectorToWindowTiled(const Vector2D&); - wlr_surface* vectorToLayerSurface(const Vector2D&, std::list*, Vector2D*); + wlr_surface* vectorToLayerSurface(const Vector2D&, std::list*, Vector2D*, SLayerSurface**); wlr_surface* vectorWindowToSurface(const Vector2D&, CWindow*, Vector2D& sl); CWindow* windowFromCursor(); CWindow* windowFloatingFromCursor(); diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 24143833..9d175fe9 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -117,10 +117,11 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { Vector2D surfaceCoords; Vector2D surfacePos = Vector2D(-1337, -1337); CWindow* pFoundWindow = nullptr; + SLayerSurface* pFoundLayerSurface = nullptr; // overlay is above fullscreen if (!foundSurface) - foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords); + foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords, &pFoundLayerSurface); // then, we check if the workspace doesnt have a fullscreen window const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace); @@ -148,7 +149,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { } if (!foundSurface) - foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords); + foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords, &pFoundLayerSurface); // then windows if (!foundSurface) { @@ -169,10 +170,10 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { // then surfaces below if (!foundSurface) - foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &surfaceCoords); + foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &surfaceCoords, &pFoundLayerSurface); if (!foundSurface) - foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords); + foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords, &pFoundLayerSurface); if (!foundSurface) { if (m_ecbClickBehavior == CLICKMODE_KILL) @@ -213,7 +214,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { } else { g_pCompositor->focusWindow(pFoundWindow, foundSurface); } - } else + } else if (pFoundLayerSurface && pFoundLayerSurface->layerSurface->current.keyboard_interactive) g_pCompositor->focusSurface(foundSurface); wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);