LayerManagerService: Fix: Wrong Surface Iteration on Input Handling.
authorMichael Schuldt <michael.schuldt@bmw.de>
Mon, 16 Apr 2012 13:31:09 +0000 (15:31 +0200)
committerMichael Schuldt <michael.schuldt@bmw.de>
Mon, 16 Apr 2012 13:31:09 +0000 (15:31 +0200)
- This fixes the traversing of the surface renderorder for input events
- Furthermore only surfaces with native content will be considered

LayerManagerService/include/SurfaceList.h
LayerManagerService/src/Scene.cpp

index d493bb7..456d8e9 100644 (file)
@@ -25,5 +25,5 @@
 typedef std::list<Surface*> SurfaceList;
 typedef std::list<Surface*>::iterator SurfaceListIterator;
 typedef std::list<Surface*>::const_iterator SurfaceListConstIterator;
-
+typedef std::list<Surface*>::const_reverse_iterator SurfaceListConstReverseIterator;
 #endif // _SURFACELIST_H_
index 7bdb3cf..ff94279 100644 (file)
@@ -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)