From f3fd983a65c968006f6c1ccf2018d971bb1a5fa0 Mon Sep 17 00:00:00 2001 From: Michael Schuldt Date: Mon, 16 Apr 2012 15:31:09 +0200 Subject: [PATCH] LayerManagerService: Fix: Wrong Surface Iteration on Input Handling. - This fixes the traversing of the surface renderorder for input events - Furthermore only surfaces with native content will be considered --- LayerManagerService/include/SurfaceList.h | 2 +- LayerManagerService/src/Scene.cpp | 80 +++++++++++++++---------------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/LayerManagerService/include/SurfaceList.h b/LayerManagerService/include/SurfaceList.h index d493bb7..456d8e9 100644 --- a/LayerManagerService/include/SurfaceList.h +++ b/LayerManagerService/include/SurfaceList.h @@ -25,5 +25,5 @@ typedef std::list SurfaceList; typedef std::list::iterator SurfaceListIterator; typedef std::list::const_iterator SurfaceListConstIterator; - +typedef std::list::const_reverse_iterator SurfaceListConstReverseIterator; #endif // _SURFACELIST_H_ diff --git a/LayerManagerService/src/Scene.cpp b/LayerManagerService/src/Scene.cpp index 7bdb3cf..ff94279 100644 --- a/LayerManagerService/src/Scene.cpp +++ b/LayerManagerService/src/Scene.cpp @@ -402,46 +402,46 @@ void Scene::getLayerGroupIDs(uint* length, uint** array) const */ Surface* Scene::getSurfaceAt(unsigned int *x, unsigned int *y, double minOpacity) { - Surface* surf; - SurfaceListConstIterator currentSurf; - LayerListConstReverseIterator currentLayer; - unsigned int x_SurfCoordinate, y_SurfCoordinate; - - surf = NULL; - - /* Need to browse for all layers. 1st layer of m_currentRenderOrder is rendered - * on bottom, last one is rendrered on top. So we have to reverse iterate */ - for (currentLayer = m_currentRenderOrder.rbegin(); - currentLayer != m_currentRenderOrder.rend() && surf == NULL; - currentLayer++) - { - if ( ((*currentLayer)->visibility) && ((*currentLayer)->getOpacity() >= minOpacity) ) - { - if ((*currentLayer)->isInside(*x, *y)) - { - x_SurfCoordinate = *x; - y_SurfCoordinate = *y; - (*currentLayer)->DestToSourceCoordinates(&x_SurfCoordinate, &y_SurfCoordinate, false); - /* Need to browse for all surfaces */ - for (currentSurf = (*currentLayer)->getAllSurfaces().begin(); - currentSurf != (*currentLayer)->getAllSurfaces().end() && surf == NULL; - currentSurf++) - { - if ( ((*currentSurf)->visibility) && ((*currentSurf)->getOpacity() >= minOpacity) ) - { - if ((*currentSurf)->isInside(x_SurfCoordinate, y_SurfCoordinate)) - { - surf = *currentSurf; - (*currentSurf)->DestToSourceCoordinates(&x_SurfCoordinate, &y_SurfCoordinate, false); - *x = x_SurfCoordinate; - *y = y_SurfCoordinate; - } - } - } - } - } - } - return surf; + Surface* surf; + SurfaceListConstReverseIterator currentSurf; + LayerListConstReverseIterator currentLayer; + unsigned int x_SurfCoordinate, y_SurfCoordinate; + + surf = NULL; + + /* Need to browse for all layers. 1st layer of m_currentRenderOrder is rendered + * on bottom, last one is rendrered on top. So we have to reverse iterate */ + for (currentLayer = m_currentRenderOrder.rbegin(); + currentLayer != m_currentRenderOrder.rend() && surf == NULL; + currentLayer++) + { + if ( ((*currentLayer)->visibility) && ((*currentLayer)->getOpacity() >= minOpacity) ) + { + if ((*currentLayer)->isInside(*x, *y)) + { + x_SurfCoordinate = *x; + y_SurfCoordinate = *y; + (*currentLayer)->DestToSourceCoordinates(&x_SurfCoordinate, &y_SurfCoordinate, false); + /* Need to browse for all surfaces */ + for (currentSurf = (*currentLayer)->getAllSurfaces().rbegin(); + currentSurf != (*currentLayer)->getAllSurfaces().rend() && surf == NULL; + currentSurf++) + { + if ( ((*currentSurf)->hasNativeContent()) && ((*currentSurf)->visibility) && ((*currentSurf)->getOpacity() >= minOpacity) ) + { + if ((*currentSurf)->isInside(x_SurfCoordinate, y_SurfCoordinate)) + { + surf = *currentSurf; + (*currentSurf)->DestToSourceCoordinates(&x_SurfCoordinate, &y_SurfCoordinate, false); + *x = x_SurfCoordinate; + *y = y_SurfCoordinate; + } + } + } + } + } + } + return surf; } bool Scene::isLayerInCurrentRenderOrder(const uint id) -- 2.7.4