find surfaces in reverse for focus

This commit is contained in:
vaxerski 2022-06-10 15:18:30 +02:00
parent 3a2ac11e3e
commit dc5cc15474

View file

@ -585,11 +585,11 @@ CWindow* CCompositor::getWindowForPopup(wlr_xdg_popup* popup) {
} }
wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::list<SLayerSurface*>* layerSurfaces, Vector2D* sCoords) { wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::list<SLayerSurface*>* layerSurfaces, Vector2D* sCoords) {
for (auto& l : *layerSurfaces) { for (auto it = layerSurfaces->rbegin(); it != layerSurfaces->rend(); it++) {
if (l->fadingOut || (l->layerSurface && !l->layerSurface->mapped)) if ((*it)->fadingOut || !(*it)->layerSurface || ((*it)->layerSurface && !(*it)->layerSurface->mapped))
continue; continue;
const auto SURFACEAT = wlr_layer_surface_v1_surface_at(l->layerSurface, pos.x - l->geometry.x, pos.y - l->geometry.y, &sCoords->x, &sCoords->y); 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)
return SURFACEAT; return SURFACEAT;