diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-04-02 13:30:45 +0100 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-04-02 13:30:45 +0100 |
| commit | 0fc145c52cf1743a9bb71a8d7c759305d2323a23 (patch) | |
| tree | 743ad00776d7c656b4c39c7cdf14819f6f18c80a /src/Compositor.cpp | |
| parent | c2b25f4701c98704303ab4ca9d008a29deb527b3 (diff) | |
input: hold focus on mouse buttons
Diffstat (limited to 'src/Compositor.cpp')
| -rw-r--r-- | src/Compositor.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index b145022c..0f67b9b1 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -2150,11 +2150,28 @@ void CCompositor::closeWindow(CWindow* pWindow) { } SLayerSurface* CCompositor::getLayerSurfaceFromSurface(wlr_surface* pSurface) { + std::pair<wlr_surface*, bool> result = {pSurface, false}; + for (auto& m : m_vMonitors) { for (auto& lsl : m->m_aLayerSurfaceLayers) { for (auto& ls : lsl) { if (ls->layerSurface && ls->layerSurface->surface == pSurface) return ls.get(); + + static auto iter = [](wlr_surface* surf, int x, int y, void* data) -> void { + if (surf == ((std::pair<wlr_surface*, bool>*)data)->first) { + *(bool*)data = true; + return; + } + }; + + if (!ls->layerSurface || !ls->mapped) + continue; + + wlr_surface_for_each_surface(ls->layerSurface->surface, iter, &result); + + if (result.second) + return ls.get(); } } } |
