Merge "Reduce Render::Texture size by 30% and texture upload message size by 50%...
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 13 Jul 2017 18:47:27 +0000 (18:47 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Thu, 13 Jul 2017 18:47:27 +0000 (18:47 +0000)
25 files changed:
automated-tests/src/dali/utc-Dali-FrameBuffer.cpp
automated-tests/src/dali/utc-Dali-KeyEvent.cpp
automated-tests/src/dali/utc-Dali-PropertyBuffer.cpp
automated-tests/src/dali/utc-Dali-Stage.cpp
automated-tests/src/dali/utc-Dali-TouchDataProcessing.cpp
automated-tests/src/dali/utc-Dali-Vector.cpp
dali/devel-api/common/dali-vector-devel.h [new file with mode: 0644]
dali/devel-api/common/owner-container.h
dali/devel-api/events/device.h [new file with mode: 0644]
dali/devel-api/events/key-event-devel.h
dali/devel-api/events/touch-event-devel.h [new file with mode: 0644]
dali/devel-api/file.list
dali/integration-api/events/key-event-integ.cpp
dali/integration-api/events/key-event-integ.h
dali/integration-api/events/point.cpp
dali/integration-api/events/point.h
dali/internal/event/events/key-event-impl.cpp
dali/internal/event/events/key-event-impl.h
dali/internal/event/events/key-event-processor.cpp
dali/internal/event/events/touch-data-impl.cpp
dali/internal/event/events/touch-data-impl.h
dali/internal/render/common/render-manager.cpp
dali/internal/update/manager/update-manager.cpp
dali/public-api/events/key-event.cpp
dali/public-api/events/touch-data.cpp

index 6278193..041e1bb 100644 (file)
@@ -326,6 +326,10 @@ int UtcDaliFramebufferContextLoss(void)
   DALI_TEST_CHECK( frameBuffer );
   frameBuffer.AttachColorTexture( texture, 0u, 1u );
 
+  Geometry geometry = CreateQuadGeometry();
+  Shader shader = CreateShader();
+  Renderer renderer = Renderer::New(geometry, shader);
+
   application.SendNotification();
   application.Render(16);
 
index 0429ffb..db3e48c 100644 (file)
@@ -311,9 +311,10 @@ int UtcDaliIntegrationKeyEvent(void)
     const unsigned long timeStamp(132);
     const Integration::KeyEvent::State keyState(Integration::KeyEvent::Up);
     const std::string deviceName("hwKeyboard");
-    const DevelKeyEvent::DeviceClass::Type deviceClass = DevelKeyEvent::DeviceClass::KEYBOARD;
+    const DevelDevice::Class::Type deviceClass = DevelDevice::Class::KEYBOARD;
+    const DevelDevice::Subclass::Type deviceSubclass = DevelDevice::Subclass::NONE;
 
-    Integration::KeyEvent keyEvent(keyName, keyString, keyCode, keyModifier, timeStamp, keyState, deviceName, deviceClass );
+    Integration::KeyEvent keyEvent(keyName, keyString, keyCode, keyModifier, timeStamp, keyState, deviceName, deviceClass, deviceSubclass );
     DALI_TEST_EQUALS( keyEvent.type, Integration::Event::Key, TEST_LOCATION );
     DALI_TEST_CHECK( keyEvent.keyName == keyName );
     DALI_TEST_CHECK( keyEvent.keyString == keyString );
@@ -323,6 +324,7 @@ int UtcDaliIntegrationKeyEvent(void)
     DALI_TEST_EQUALS( keyEvent.state, keyState, TEST_LOCATION);
     DALI_TEST_EQUALS( keyEvent.deviceName, deviceName, TEST_LOCATION);
     DALI_TEST_EQUALS( keyEvent.deviceClass, deviceClass, TEST_LOCATION);
+    DALI_TEST_EQUALS( keyEvent.deviceSubclass, deviceSubclass, TEST_LOCATION);
   }
   END_TEST;
 }
@@ -343,7 +345,8 @@ int UtcDaliIntegrationKeyEventConvertor(void)
   DALI_TEST_EQUALS( keyEvent.time, 0lu, TEST_LOCATION );
   DALI_TEST_EQUALS( keyEvent.state, Integration::KeyEvent::Down, TEST_LOCATION);
   DALI_TEST_EQUALS( keyEvent.deviceName, "", TEST_LOCATION);
-  DALI_TEST_EQUALS( keyEvent.deviceClass, DevelKeyEvent::DeviceClass::NONE, TEST_LOCATION);
+  DALI_TEST_EQUALS( keyEvent.deviceClass, DevelDevice::Class::NONE, TEST_LOCATION);
+  DALI_TEST_EQUALS( keyEvent.deviceSubclass, DevelDevice::Subclass::NONE, TEST_LOCATION);
 
   END_TEST;
 }
@@ -365,7 +368,18 @@ int UtcDaliKeyEventSetDeviceClass(void)
 
   KeyEvent event(TEST_STRING_1,"i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::Down);
 
-  DALI_TEST_EQUALS( DevelKeyEvent::GetDeviceClass( event ), DevelKeyEvent::DeviceClass::NONE, TEST_LOCATION);
+  DALI_TEST_EQUALS( DevelKeyEvent::GetDeviceClass( event ), DevelDevice::Class::NONE, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliKeyEventSetDeviceSubclass(void)
+{
+  TestApplication application;
+
+  KeyEvent event(TEST_STRING_1,"i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::Down);
+
+  DALI_TEST_EQUALS( DevelKeyEvent::GetDeviceSubclass( event ), DevelDevice::Subclass::NONE, TEST_LOCATION);
 
   END_TEST;
 }
index 4da91dc..3d70484 100644 (file)
@@ -118,40 +118,46 @@ int UtcDaliPropertyBufferSetData01(void)
   texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
   texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
 
-  PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat );
-  DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION );
+  {
+    PropertyBuffer propertyBuffer = PropertyBuffer::New( texturedQuadVertexFormat );
+    DALI_TEST_EQUALS( (bool)propertyBuffer, true, TEST_LOCATION );
 
-  const float halfQuadSize = .5f;
-  struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
-  TexturedQuadVertex texturedQuadVertexData[4] = {
-    { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) },
-    { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
-    { Vector2(-halfQuadSize,  halfQuadSize), Vector2(0.f, 1.f) },
-    { Vector2( halfQuadSize,  halfQuadSize), Vector2(1.f, 1.f) } };
+    const float halfQuadSize = .5f;
+    struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
+    TexturedQuadVertex texturedQuadVertexData[4] = {
+      { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) },
+      { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
+      { Vector2(-halfQuadSize,  halfQuadSize), Vector2(0.f, 1.f) },
+      { Vector2( halfQuadSize,  halfQuadSize), Vector2(1.f, 1.f) } };
 
-  propertyBuffer.SetData( texturedQuadVertexData, 4 );
+    propertyBuffer.SetData( texturedQuadVertexData, 4 );
 
-  Geometry geometry = Geometry::New();
-  geometry.AddVertexBuffer( propertyBuffer );
+    Geometry geometry = Geometry::New();
+    geometry.AddVertexBuffer( propertyBuffer );
 
-  Shader shader = CreateShader();
-  Renderer renderer = Renderer::New(geometry, shader);
-  Actor actor = Actor::New();
-  actor.SetSize(Vector3::ONE * 100.f);
-  actor.AddRenderer(renderer);
-  Stage::GetCurrent().Add(actor);
+    Shader shader = CreateShader();
+    Renderer renderer = Renderer::New(geometry, shader);
+    Actor actor = Actor::New();
+    actor.SetSize(Vector3::ONE * 100.f);
+    actor.AddRenderer(renderer);
+    Stage::GetCurrent().Add(actor);
 
-  application.SendNotification();
-  application.Render(0);
-  application.Render();
-  application.SendNotification();
+    application.SendNotification();
+    application.Render(0);
+    application.Render();
+    application.SendNotification();
 
-  const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
-      application.GetGlAbstraction().GetBufferDataCalls();
+    const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
+        application.GetGlAbstraction().GetBufferDataCalls();
+
+    DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
 
-  DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
+    DALI_TEST_EQUALS( bufferDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION );
 
-  DALI_TEST_EQUALS( bufferDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION );
+  }
+  // end of scope to let the buffer and geometry die; do another notification and render to get the deletion processed
+  application.SendNotification();
+  application.Render(0);
 
   END_TEST;
 }
index 24c13e7..102e451 100644 (file)
@@ -883,7 +883,7 @@ int UtcDaliStageKeyEventGeneratedSignalP(void)
   KeyEventGeneratedReceivedFunctor functor2( data2 );
   GetImplementation( stage ).ConnectSignal( &application, "keyEventGenerated", functor2 );
 
-  Integration::KeyEvent event( "a", "a", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
+  Integration::KeyEvent event( "a", "a", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
   application.ProcessEvent( event );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
@@ -894,7 +894,7 @@ int UtcDaliStageKeyEventGeneratedSignalP(void)
 
   data.Reset();
 
-  Integration::KeyEvent event2( "i", "i", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
+  Integration::KeyEvent event2( "i", "i", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
   application.ProcessEvent( event2 );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
@@ -905,7 +905,7 @@ int UtcDaliStageKeyEventGeneratedSignalP(void)
 
   data.Reset();
 
-  Integration::KeyEvent event3( "a", "a", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
+  Integration::KeyEvent event3( "a", "a", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
   application.ProcessEvent( event3 );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
@@ -916,7 +916,7 @@ int UtcDaliStageKeyEventGeneratedSignalP(void)
 
   data.Reset();
 
-  Integration::KeyEvent event4( "a", "a", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
+  Integration::KeyEvent event4( "a", "a", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
   application.ProcessEvent( event4 );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
@@ -936,7 +936,7 @@ int UtcDaliStageSignalKeyEventP(void)
   KeyEventReceivedFunctor functor( data );
   stage.KeyEventSignal().Connect( &application, functor );
 
-  Integration::KeyEvent event( "i", "i", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
+  Integration::KeyEvent event( "i", "i", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
   application.ProcessEvent( event );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
@@ -947,7 +947,7 @@ int UtcDaliStageSignalKeyEventP(void)
 
   data.Reset();
 
-  Integration::KeyEvent event2( "i", "i", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
+  Integration::KeyEvent event2( "i", "i", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
   application.ProcessEvent( event2 );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
@@ -958,7 +958,7 @@ int UtcDaliStageSignalKeyEventP(void)
 
   data.Reset();
 
-  Integration::KeyEvent event3( "a", "a", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
+  Integration::KeyEvent event3( "a", "a", 0, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
   application.ProcessEvent( event3 );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
@@ -969,7 +969,7 @@ int UtcDaliStageSignalKeyEventP(void)
 
   data.Reset();
 
-  Integration::KeyEvent event4( "a", "a", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelKeyEvent::DeviceClass::NONE );
+  Integration::KeyEvent event4( "a", "a", 0, 0, 0, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DevelDevice::Class::NONE, DevelDevice::Subclass::NONE );
   application.ProcessEvent( event4 );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
index 2ec12df..844a67a 100644 (file)
@@ -21,6 +21,7 @@
 #include <dali/public-api/dali-core.h>
 #include <dali/integration-api/events/touch-event-integ.h>
 #include <dali/integration-api/system-overlay.h>
+#include <dali/devel-api/events/touch-event-devel.h>
 #include <dali-test-suite-utils.h>
 
 using namespace Dali;
@@ -50,6 +51,8 @@ struct TestPoint
   Vector2 ellipseRadius;
   float pressure;
   Degree angle;
+  DevelDevice::Class::Type deviceClass;
+  DevelDevice::Subclass::Type deviceSubclass;
 
   TestPoint()
   : deviceId(-1), state(PointState::FINISHED), radius(0), pressure(0)
@@ -139,6 +142,8 @@ struct TouchDataFunctor
       p.ellipseRadius = touchData.GetEllipseRadius(i);
       p.pressure = touchData.GetPressure(i);
       p.angle = touchData.GetAngle(i);
+      p.deviceClass = DevelTouchData::GetDeviceClass(touchData, i);
+      p.deviceSubclass = DevelTouchData::GetDeviceSubclass(touchData, i);
       signalData.touchData.points.push_back(p);
     }
 
@@ -281,6 +286,8 @@ Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vecto
   Integration::Point point;
   point.SetState( state );
   point.SetScreenPosition( screenPosition );
+  point.SetDeviceClass( DevelDevice::Class::TOUCH );
+  point.SetDeviceSubclass( DevelDevice::Subclass::NONE );
   touchEvent.points.push_back( point );
   return touchEvent;
 }
@@ -1972,6 +1979,35 @@ int UtcDaliTouchDataAndEventUsage(void)
   DALI_TEST_EQUALS( true, touchEventFunctorCalled, TEST_LOCATION );
 
   END_TEST;
+}
 
+int UtcDaliTouchDataGetDeviceAPINegative(void)
+{
+  TestApplication application;
 
+  Actor actor = Actor::New();
+  actor.SetSize(100.0f, 100.0f);
+  actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+  Stage::GetCurrent().Add(actor);
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Connect to actor's touched signal
+  HandleData handleData;
+  TouchDataHandleFunctor functor( handleData );
+  actor.TouchSignal().Connect( &application, functor );
+
+  Vector2 screenCoordinates( 10.0f, 10.0f );
+  Vector2 localCoordinates;
+  actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
+
+  // Emit a down signal
+  application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
+
+  TouchData data = handleData.touchData;
+  DALI_TEST_EQUALS( DevelTouchData::GetDeviceClass( data, -1 ), DevelDevice::Class::NONE, TEST_LOCATION );
+  DALI_TEST_EQUALS( DevelTouchData::GetDeviceSubclass( data, -1 ), DevelDevice::Subclass::NONE, TEST_LOCATION );
+  END_TEST;
 }
index 6677cea..28fe6b6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
 #include <iostream>
 #include <stdlib.h>
 #include <dali/public-api/dali-core.h>
+#include <dali/devel-api/common/dali-vector-devel.h>
 #include <dali-test-suite-utils.h>
 
 using namespace Dali;
@@ -1339,6 +1340,28 @@ int UtcDaliVectorMatrixP(void)
   END_TEST;
 }
 
+int UtcDaliVectorCpp11ForP(void)
+{
+  Vector< Vector3 > classvector;
+  for ( auto i : classvector )
+  {
+    std::ignore = i;
+    tet_result( TET_FAIL );
+  }
+
+  classvector.PushBack( Vector3( 0.1f, 0.2f, 0.3f ) );
+  classvector.PushBack( Vector3( 0.1f, 0.2f, 0.3f ) );
+  classvector.PushBack( Vector3( 0.1f, 0.2f, 0.3f ) );
+
+  for ( auto i : classvector )
+  {
+    DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), i, TEST_LOCATION );
+  }
+
+  END_TEST;
+}
+
+
 /*
  * this does not compile at the moment
  * Vector< Actor > classvector; this does not compile yet either
diff --git a/dali/devel-api/common/dali-vector-devel.h b/dali/devel-api/common/dali-vector-devel.h
new file mode 100644 (file)
index 0000000..08e3abf
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef DALI_VECTOR_DEVEL_H
+#define DALI_VECTOR_DEVEL_H
+
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-vector.h>
+
+namespace Dali
+{
+/**
+ * Dali::Vector support for C++11 Range-based for loop: for( item : container )
+ *
+ * @param vector The vector to iterate
+ * @return The start iterator
+ */
+template< class T >
+typename T::Iterator begin( T& vector )
+{
+    return vector.Begin();
+}
+
+/**
+ * Dali::Vector support for C++11 Range-based for loop: for( item : container )
+ *
+ * @param vector The vector to iterate
+ * @return The end iterator
+ */
+template< class T >
+typename T::Iterator end( T& vector )
+{
+    return vector.End();
+}
+
+} // namespace Dali
+
+#endif /* DALI_VECTOR_DEVEL_H */
index f35b278..b5ac951 100644 (file)
@@ -21,6 +21,7 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/common/dali-vector.h>
+#include <dali/devel-api/common/dali-vector-devel.h>
 
 namespace Dali
 {
diff --git a/dali/devel-api/events/device.h b/dali/devel-api/events/device.h
new file mode 100644 (file)
index 0000000..aab32e0
--- /dev/null
@@ -0,0 +1,88 @@
+#ifndef DALI_DEVICE_H
+#define DALI_DEVICE_H
+
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Dali
+{
+
+/**
+ * @brief Information about device types
+ *
+ * These types are for widget viewer applications.
+ * A widget viewer application by Dali have to deliver events to widget applications
+ * Server for handling events actually delivers any events to widget applications
+ * The server needs to know input device information such as type to deliver events of proper type to widget applications
+ */
+namespace DevelDevice
+{
+
+/**
+ * @brief Categorization type about input Device
+ */
+namespace Class
+{
+
+/**
+ * @brief An enum of Device Class types.
+ */
+enum Type
+{
+  NONE,      ///< Not a device
+  USER,      ///< The user/seat (the user themselves)
+  KEYBOARD,  ///< A regular keyboard, numberpad or attached buttons
+  MOUSE,     ///< A mouse, trackball or touchpad relative motion device
+  TOUCH,     ///< A touchscreen with fingers or stylus
+  PEN,       ///< A special pen device
+  POINTER,   ///< A pointing device based on laser, infrared or similar technology
+  GAMEPAD    ///< A gamepad controller or joystick
+};
+
+} // namespace DeviceClass
+
+/**
+ * @brief Subcategorization type about input device
+ */
+namespace Subclass
+{
+
+/**
+ * @brief An enum of Device Subclass types.
+ */
+enum Type
+{
+  NONE, ///< Not a device
+  FINGER, ///< The normal flat of your finger
+  FINGERNAIL, ///< A fingernail
+  KNUCKLE, ///< A Knuckle
+  PALM, ///< The palm of a users hand
+  HAND_SIDE, ///< The side of your hand
+  HAND_FLAT, ///< The flat of your hand
+  PEN_TIP, ///< The tip of a pen
+  TRACKPAD, ///< A trackpad style mouse
+  TRACKPOINT, //< A trackpoint style mouse
+  TRACKBALL, ///< A trackball style mouse
+};
+
+} // namespace DeviceSubclass
+
+} // namespace DevelDevice
+
+} // namespace Dali
+
+#endif  //DALI_KEY_EVENT_DEVEL_H
index ec2a85e..417dd48 100644 (file)
@@ -20,6 +20,7 @@
 
 // INTERNAL_INCLUDES
 #include <dali/public-api/events/key-event.h>
+#include <dali/devel-api/events/device.h>
 
 namespace Dali
 {
@@ -27,26 +28,6 @@ namespace Dali
 namespace DevelKeyEvent
 {
 
-namespace DeviceClass
-{
-
-/**
- * @brief An enum of Device Classe types.
- */
-enum Type
-{
-  NONE,      ///< Not a device
-  USER,      ///< The user/seat (the user themselves)
-  KEYBOARD,  ///< A regular keyboard, numberpad or attached buttons
-  MOUSE,     ///< A mouse, trackball or touchpad relative motion device
-  TOUCH,     ///< A touchscreen with fingers or stylus
-  PEN,       ///< A special pen device
-  POINTER,   ///< A laser pointer, wii-style or 7"minority report" pointing device
-  GAMEPAD    ///< A gamepad controller or joystick
-};
-
-} // namespace DeviceClass
-
 /**
  * @brief Get the device name the key event originated from
  *
@@ -58,10 +39,20 @@ DALI_IMPORT_API std::string GetDeviceName( const KeyEvent& keyEvent );
 /**
  * @brief Get the device class the key event originated from
  *
+ * The device class type is classification type of the input device of event received
  * @param[in] keyEvent The KeyEvent to retrieve the device class from
- * @return The device class
+ * @return The type of the device class
+ */
+DALI_IMPORT_API DevelDevice::Class::Type GetDeviceClass( const KeyEvent& keyEvent );
+
+/**
+ * @brief Get the device subclass the key event originated from
+ *
+ * The device subclass type is subclassification type of the input device of event received.
+ * @param[in] keyEvent The KeyEvent to retrieve the device subclass from
+ * @return The type of the device subclass
  */
-DALI_IMPORT_API DeviceClass::Type GetDeviceClass( const KeyEvent& keyEvent );
+DALI_IMPORT_API DevelDevice::Subclass::Type GetDeviceSubclass( const KeyEvent& keyEvent );
 
 } // namespace DevelKeyEvent
 
diff --git a/dali/devel-api/events/touch-event-devel.h b/dali/devel-api/events/touch-event-devel.h
new file mode 100644 (file)
index 0000000..6ab21db
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef DALI_TOUCH_DATA_DEVEL_H
+#define DALI_TOUCH_DATA_DEVEL_H
+
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL_INCLUDES
+#include <dali/public-api/events/touch-data.h>
+#include <dali/devel-api/events/device.h>
+
+namespace Dali
+{
+
+namespace DevelTouchData
+{
+
+/**
+ * @brief Get the device class type the mouse/touch event originated from
+ *
+ * The device class type is classification type of the input device of event received.
+ * @param[in] touch The TouchData to retrieve the device class from
+ * @param[in] point The point required
+ * @return The type of the device class
+ */
+DALI_IMPORT_API DevelDevice::Class::Type GetDeviceClass( const TouchData& touch, std::size_t point );
+
+/**
+ * @brief Get the device subclass type the mouse/touch event originated from
+ *
+ * The device subclass type is subclassification type of the input device of event received.
+ * @param[in] touch The TouchData to retrieve the device subclass from
+ * @param[in] point The point required
+ * @return The type of the device subclass
+ */
+DALI_IMPORT_API DevelDevice::Subclass::Type GetDeviceSubclass( const TouchData& touch, std::size_t point );
+
+} // namespace DevelTouchData
+
+} // namespace Dali
+
+#endif //DALI_TOUCH_DATA_DEVEL_H
index d30f932..227ce5c 100644 (file)
@@ -34,6 +34,7 @@ devel_api_core_animation_header_files = \
   $(devel_api_src_dir)/animation/animation-devel.h
 
 devel_api_core_common_header_files = \
+  $(devel_api_src_dir)/common/dali-vector-devel.h \
   $(devel_api_src_dir)/common/hash.h \
   $(devel_api_src_dir)/common/map-wrapper.h \
   $(devel_api_src_dir)/common/owner-container.h \
@@ -43,6 +44,8 @@ devel_api_core_common_header_files = \
 
 devel_api_core_events_header_files = \
   $(devel_api_src_dir)/events/hit-test-algorithm.h \
+  $(devel_api_src_dir)/events/device.h \
+  $(devel_api_src_dir)/events/touch-event-devel.h \
   $(devel_api_src_dir)/events/key-event-devel.h
 
 devel_api_core_images_header_files = \
index b3bcdee..79da685 100644 (file)
@@ -33,12 +33,14 @@ KeyEvent::KeyEvent()
   time( 0 ),
   state( KeyEvent::Down ),
   deviceName( "" ),
-  deviceClass( DevelKeyEvent::DeviceClass::NONE )
+  deviceClass( DevelDevice::Class::NONE ),
+  deviceSubclass( DevelDevice::Subclass::NONE )
 {
 }
 
 KeyEvent::KeyEvent( const std::string& keyName, const std::string& keyString, int keyCode, int keyModifier,
-                    unsigned long timeStamp, const State& keyState, const std::string deviceName, const DevelKeyEvent::DeviceClass::Type deviceClass )
+                    unsigned long timeStamp, const State& keyState, const std::string deviceName,
+                    const DevelDevice::Class::Type deviceClass, const DevelDevice::Subclass::Type deviceSubclass )
 : Event( Key ),
   keyName( keyName ),
   keyString( keyString ),
@@ -47,7 +49,8 @@ KeyEvent::KeyEvent( const std::string& keyName, const std::string& keyString, in
   time( timeStamp ),
   state( keyState ),
   deviceName( deviceName ),
-  deviceClass( deviceClass )
+  deviceClass( deviceClass ),
+  deviceSubclass( deviceSubclass )
 {
 }
 
@@ -60,7 +63,8 @@ KeyEvent::KeyEvent( const Dali::KeyEvent& event )
   time( event.time ),
   state( static_cast< Integration::KeyEvent::State >( event.state ) ),
   deviceName( "" ),
-  deviceClass( DevelKeyEvent::DeviceClass::NONE )
+  deviceClass( DevelDevice::Class::NONE ),
+  deviceSubclass( DevelDevice::Subclass::NONE )
 {
 }
 
index d98970d..536d3ef 100644 (file)
@@ -72,7 +72,8 @@ struct KeyEvent : public Event
            unsigned long timeStamp,
            const State& keyState,
            const std::string deviceName,
-           const DevelKeyEvent::DeviceClass::Type deviceClass );
+           const DevelDevice::Class::Type deviceClass,
+           const DevelDevice::Subclass::Type deviceSubclass );
 
   /*
    * Constructor, creates a Integration::KeyEvent from a Dali::KeyEvent
@@ -126,7 +127,12 @@ struct KeyEvent : public Event
   /**
    * Class of device KeyEvent originated from
    */
-  DevelKeyEvent::DeviceClass::Type deviceClass;
+  DevelDevice::Class::Type deviceClass;
+
+  /**
+   * Subclass of device KeyEvent originated from
+   */
+  DevelDevice::Subclass::Type deviceSubclass;
 };
 
 } // namespace Integration
index 485c4ed..def483f 100644 (file)
@@ -28,6 +28,8 @@ Point::Point()
 : mTouchPoint( 0, TouchPoint::Started, 0.0f, 0.0f ),
   mEllipseRadius(),
   mAngle( 0.0f ),
+  mDeviceClass( DevelDevice::Class::NONE ),
+  mDeviceSubclass( DevelDevice::Subclass::NONE ),
   mPressure( 1.0f ),
   mRadius( 0.0f )
 {
@@ -37,6 +39,8 @@ Point::Point( const TouchPoint& touchPoint )
 : mTouchPoint( touchPoint ),
   mEllipseRadius(),
   mAngle( 0.0f ),
+  mDeviceClass( DevelDevice::Class::NONE ),
+  mDeviceSubclass( DevelDevice::Subclass::NONE ),
   mPressure( 1.0f ),
   mRadius( 0.0f )
 {
@@ -142,6 +146,26 @@ const TouchPoint& Point::GetTouchPoint() const
   return mTouchPoint;
 }
 
+void Point::SetDeviceClass( DevelDevice::Class::Type deviceClass )
+{
+  mDeviceClass = deviceClass;
+}
+
+void Point::SetDeviceSubclass( DevelDevice::Subclass::Type deviceSubclass )
+{
+  mDeviceSubclass = deviceSubclass;
+}
+
+DevelDevice::Class::Type Point::GetDeviceClass() const
+{
+  return mDeviceClass;
+}
+
+DevelDevice::Subclass::Type Point::GetDeviceSubclass() const
+{
+  return mDeviceSubclass;
+}
+
 } // namespace Integration
 
 } // namespace Dali
index 3b05f5c..6570c65 100644 (file)
@@ -23,6 +23,7 @@
 #include <dali/public-api/math/degree.h>
 #include <dali/public-api/math/vector2.h>
 #include <dali/public-api/events/touch-point.h>
+#include <dali/devel-api/events/device.h>
 
 namespace Dali
 {
@@ -106,6 +107,18 @@ struct DALI_IMPORT_API Point
   void SetAngle( Degree angle );
 
   /**
+   * @brief Sets the class of the device for the event
+   * @param[in] deviceClass The class of the device.
+   */
+  void SetDeviceClass( DevelDevice::Class::Type deviceClass );
+
+  /**
+   * @brief Sets the subclass of the device for the event
+   * @param[in] deviceSubclass The subclass of the device.
+   */
+  void SetDeviceSubclass( DevelDevice::Subclass::Type deviceSubclass );
+
+  /**
    * @brief Retrieve the Unique Device ID of the point.
    * @return The Unique Device ID of the point.
    */
@@ -153,6 +166,20 @@ struct DALI_IMPORT_API Point
    */
   Degree GetAngle() const;
 
+  /**
+   * @brief Retrieve the class of the device for the event.
+   * @return The class of the device
+   */
+  DevelDevice::Class::Type GetDeviceClass() const;
+
+  /**
+   * @brief Retrieve the subclass of the device for the event.
+   * @return The subclass of the device
+   */
+  DevelDevice::Subclass::Type GetDeviceSubclass() const;
+
+
+
 public: // Not intended for Integration API developers
 
   /**
@@ -192,6 +219,8 @@ private:
   TouchPoint mTouchPoint; ///< Stores screen position, device Id, local & screen positions and the hit-actor. @see TouchPoint
   Vector2 mEllipseRadius; ///< Radius of both the horizontal and vertical radius (useful if an ellipse).
   Degree mAngle; ///< The angle of the press point, relative to the Y-Axis.
+  DevelDevice::Class::Type mDeviceClass;
+  DevelDevice::Subclass::Type mDeviceSubclass;
   float mPressure; ///< The touch pressure.
   float mRadius; ///< Radius of the press point, an average of the ellipse radius.
 };
index e04d8c8..f6a0a32 100644 (file)
@@ -39,7 +39,8 @@ namespace Internal
 
 KeyEventImpl::KeyEventImpl( KeyEvent* keyEvent )
 : mDeviceName( "" ),
-  mDeviceClass( DevelKeyEvent::DeviceClass::NONE )
+  mDeviceClass( DevelDevice::Class::NONE ),
+  mDeviceSubclass( DevelDevice::Subclass::NONE )
 {
   keyEventImplMap[keyEvent] = this;
 }
@@ -62,6 +63,7 @@ KeyEventImpl& KeyEventImpl::operator=( const KeyEventImpl& rhs )
   {
     mDeviceName = rhs.mDeviceName;
     mDeviceClass = rhs.mDeviceClass;
+    mDeviceSubclass = rhs.mDeviceSubclass;
   }
 
   return *this;
@@ -77,16 +79,26 @@ void KeyEventImpl::SetDeviceName( const std::string& deviceName )
   mDeviceName = deviceName;
 }
 
-DevelKeyEvent::DeviceClass::Type KeyEventImpl::GetDeviceClass() const
+DevelDevice::Class::Type KeyEventImpl::GetDeviceClass() const
 {
   return mDeviceClass;
 }
 
-void KeyEventImpl::SetDeviceClass( const DevelKeyEvent::DeviceClass::Type& deviceClass )
+void KeyEventImpl::SetDeviceClass( DevelDevice::Class::Type deviceClass )
 {
   mDeviceClass = deviceClass;
 }
 
+DevelDevice::Subclass::Type KeyEventImpl::GetDeviceSubclass() const
+{
+  return mDeviceSubclass;
+}
+
+void KeyEventImpl::SetDeviceSubclass( DevelDevice::Subclass::Type deviceSubclass )
+{
+  mDeviceSubclass = deviceSubclass;
+}
+
 } // namsespace Internal
 
 Internal::KeyEventImpl* GetImplementation( KeyEvent* keyEvent )
index 57b8cbe..b6245b1 100644 (file)
@@ -52,7 +52,6 @@ public:
   /**
    * @brief Get the device name the key event originated from
    *
-   * @param[in] keyEvent The KeyEvent to retrieve the device name from
    * @return The device name
    */
    std::string GetDeviceName() const;
@@ -60,7 +59,6 @@ public:
   /**
    * @brief Set the device name to the KeyEvent
    *
-   * @param[in] keyEvent The KeyEvent to set the device name on
    * @param[in] deviceName Device name string to set
    */
   void SetDeviceName( const std::string& deviceName );
@@ -68,18 +66,30 @@ public:
   /**
    * @brief Get the device class the key event originated from
    *
-   * @param[in] keyEvent The KeyEvent to retrieve the device class from
    * @return The device class
    */
-  DevelKeyEvent::DeviceClass::Type GetDeviceClass() const;
+  DevelDevice::Class::Type GetDeviceClass() const;
 
   /**
    * @brief Set the device class to the KeyEvent
    *
-   * @param[in] keyEvent The KeyEvent to set the device class on
    * @param[in] deviceClass Device class to set
    */
-  void SetDeviceClass( const DevelKeyEvent::DeviceClass::Type& deviceClass );
+  void SetDeviceClass( DevelDevice::Class::Type deviceClass );
+
+  /**
+   * @brief Get the device subclass the key event originated from
+   *
+   * @return The device subclass
+   */
+  DevelDevice::Subclass::Type GetDeviceSubclass() const;
+
+  /**
+   * @brief Set the device subclass to the KeyEvent
+   *
+   * @param[in] deviceClass Device subclass to set
+   */
+  void SetDeviceSubclass( DevelDevice::Subclass::Type deviceSubclass );
 
 private:
 
@@ -92,7 +102,8 @@ private:
 private:
 
   std::string mDeviceName;
-  DevelKeyEvent::DeviceClass::Type mDeviceClass;
+  DevelDevice::Class::Type mDeviceClass;
+  DevelDevice::Subclass::Type mDeviceSubclass;
 };
 
 } // namespace Internal
index bfc1f43..5afb81b 100644 (file)
@@ -47,6 +47,7 @@ void KeyEventProcessor::ProcessKeyEvent(const Integration::KeyEvent& event)
 
   GetImplementation( &keyEvent )->SetDeviceName( event.deviceName );
   GetImplementation( &keyEvent )->SetDeviceClass( event.deviceClass );
+  GetImplementation( &keyEvent )->SetDeviceSubclass( event.deviceSubclass );
 
   // Emit the key event signal from stage.
   consumed = mStage.EmitKeyEventGeneratedSignal( keyEvent );
index a041c82..678829d 100644 (file)
@@ -159,6 +159,24 @@ void TouchData::AddPoint( const Integration::Point& point )
   mPoints.push_back( point );
 }
 
+DevelDevice::Class::Type TouchData::GetDeviceClass( std::size_t point ) const
+{
+  if( point < mPoints.size() )
+  {
+    return mPoints[ point ].GetDeviceClass();
+  }
+  return DevelDevice::Class::NONE;
+}
+
+DevelDevice::Subclass::Type TouchData::GetDeviceSubclass( std::size_t point ) const
+{
+  if( point < mPoints.size() )
+  {
+    return mPoints[ point ].GetDeviceSubclass();
+  }
+  return DevelDevice::Subclass::NONE;
+}
+
 } // namsespace Internal
 
 } // namespace Dali
index 5221db0..1f53a11 100644 (file)
@@ -158,6 +158,20 @@ public:
    */
   void AddPoint( const Integration::Point& point );
 
+    /**
+   * @brief Get the device class the mouse/touch event originated from
+   *
+   * @return The device class
+   */
+  DevelDevice::Class::Type GetDeviceClass( std::size_t point ) const;
+
+  /**
+   * @brief Get the device subclass the mouse/touch event originated from
+   *
+   * @return The device subclass
+   */
+  DevelDevice::Subclass::Type GetDeviceSubclass( std::size_t point ) const;
+
 private:
 
   /// Undefined Copy constructor
@@ -166,6 +180,8 @@ private:
   /// Undefined
   TouchData& operator=( const TouchData& other );
 
+private:
+
   std::vector< Integration::Point > mPoints; ///< Container of the points for this touch event.
   unsigned long mTime; ///< The time (in ms) that the touch event occurred.
 };
index c980d74..b391961 100644 (file)
@@ -48,28 +48,6 @@ namespace Internal
 namespace SceneGraph
 {
 
-typedef OwnerContainer< Render::Renderer* >    RendererOwnerContainer;
-typedef RendererOwnerContainer::Iterator       RendererOwnerIter;
-
-typedef OwnerContainer< Render::Geometry* >    GeometryOwnerContainer;
-typedef GeometryOwnerContainer::Iterator       GeometryOwnerIter;
-
-typedef OwnerContainer< Render::Sampler* >    SamplerOwnerContainer;
-typedef SamplerOwnerContainer::Iterator       SamplerOwnerIter;
-
-typedef OwnerContainer< Render::Texture* >   TextureOwnerContainer;
-typedef TextureOwnerContainer::Iterator         TextureOwnerIter;
-
-typedef OwnerContainer< Render::FrameBuffer* >  FrameBufferOwnerContainer;
-typedef FrameBufferOwnerContainer::Iterator     FrameBufferOwnerIter;
-
-typedef OwnerContainer< Render::PropertyBuffer* > PropertyBufferOwnerContainer;
-typedef PropertyBufferOwnerContainer::Iterator    PropertyBufferOwnerIter;
-
-typedef OwnerContainer< Render::RenderTracker* > RenderTrackerContainer;
-typedef RenderTrackerContainer::Iterator         RenderTrackerIter;
-typedef RenderTrackerContainer::ConstIterator    RenderTrackerConstIter;
-
 /**
  * Structure to contain internal data
  */
@@ -111,41 +89,41 @@ struct RenderManager::Impl
 
   void UpdateTrackers()
   {
-    for(RenderTrackerIter iter = mRenderTrackers.Begin(), end = mRenderTrackers.End(); iter != end; ++iter)
+    for( auto&& iter : mRenderTrackers )
     {
-      (*iter)->PollSyncObject();
+      iter->PollSyncObject();
     }
   }
 
   // the order is important for destruction,
   // programs are owned by context at the moment.
-  Context                       context;                  ///< holds the GL state
-  Integration::GlSyncAbstraction& glSyncAbstraction;      ///< GL sync abstraction
-  RenderQueue                   renderQueue;              ///< A message queue for receiving messages from the update-thread.
+  Context                                   context;                 ///< holds the GL state
+  Integration::GlSyncAbstraction&           glSyncAbstraction;       ///< GL sync abstraction
+  RenderQueue                               renderQueue;             ///< A message queue for receiving messages from the update-thread.
 
   // Render instructions describe what should be rendered during RenderManager::Render()
   // Owned by RenderManager. Update manager updates instructions for the next frame while we render the current one
-  RenderInstructionContainer    instructions;
+  RenderInstructionContainer                instructions;
 
-  Vector4                       backgroundColor;          ///< The glClear color used at the beginning of each frame.
+  Vector4                                   backgroundColor;         ///< The glClear color used at the beginning of each frame.
 
-  unsigned int                  frameCount;               ///< The current frame count
-  BufferIndex                   renderBufferIndex;        ///< The index of the buffer to read from; this is opposite of the "update" buffer
+  unsigned int                              frameCount;              ///< The current frame count
+  BufferIndex                               renderBufferIndex;       ///< The index of the buffer to read from; this is opposite of the "update" buffer
 
-  Rect<int>                     defaultSurfaceRect;       ///< Rectangle for the default surface we are rendering to
+  Rect<int>                                 defaultSurfaceRect;      ///< Rectangle for the default surface we are rendering to
 
-  RendererOwnerContainer        rendererContainer;        ///< List of owned renderers
-  SamplerOwnerContainer         samplerContainer;         ///< List of owned samplers
-  TextureOwnerContainer         textureContainer;         ///< List of owned textures
-  FrameBufferOwnerContainer     frameBufferContainer;     ///< List of owned framebuffers
-  PropertyBufferOwnerContainer  propertyBufferContainer;  ///< List of owned property buffers
-  GeometryOwnerContainer        geometryContainer;        ///< List of owned Geometries
+  OwnerContainer< Render::Renderer* >       rendererContainer;       ///< List of owned renderers
+  OwnerContainer< Render::Sampler* >        samplerContainer;        ///< List of owned samplers
+  OwnerContainer< Render::Texture* >        textureContainer;        ///< List of owned textures
+  OwnerContainer< Render::FrameBuffer* >    frameBufferContainer;    ///< List of owned framebuffers
+  OwnerContainer< Render::PropertyBuffer* > propertyBufferContainer; ///< List of owned property buffers
+  OwnerContainer< Render::Geometry* >       geometryContainer;       ///< List of owned Geometries
 
-  bool                          lastFrameWasRendered;     ///< Keeps track of the last frame being rendered due to having render instructions
+  bool                                      lastFrameWasRendered;    ///< Keeps track of the last frame being rendered due to having render instructions
 
-  RenderTrackerContainer        mRenderTrackers;          ///< List of render trackers
+  OwnerContainer< Render::RenderTracker* >  mRenderTrackers;         ///< List of render trackers
 
-  ProgramController             programController;        ///< Owner of the GL programs
+  ProgramController                         programController;        ///< Owner of the GL programs
 
 };
 
@@ -188,24 +166,21 @@ void RenderManager::ContextDestroyed()
   mImpl->programController.GlContextDestroyed();
 
   //Inform textures
-  for( TextureOwnerIter iter = mImpl->textureContainer.Begin(); iter != mImpl->textureContainer.End(); ++iter )
+  for( auto&& texture : mImpl->textureContainer )
   {
-    (*iter)->GlContextDestroyed();
+    texture->GlContextDestroyed();
   }
 
   //Inform framebuffers
-  for( FrameBufferOwnerIter iter = mImpl->frameBufferContainer.Begin(); iter != mImpl->frameBufferContainer.End(); ++iter )
+  for( auto&& framebuffer : mImpl->frameBufferContainer )
   {
-    (*iter)->GlContextDestroyed();
+    framebuffer->GlContextDestroyed();
   }
 
   // inform renderers
-  RendererOwnerContainer::Iterator end = mImpl->rendererContainer.End();
-  RendererOwnerContainer::Iterator iter = mImpl->rendererContainer.Begin();
-  for( ; iter != end; ++iter )
+  for( auto&& renderer : mImpl->rendererContainer )
   {
-    GlResourceOwner* renderer = *iter;
-    renderer->GlContextDestroyed(); // Clear up vertex buffers
+    renderer->GlContextDestroyed();
   }
 }
 
@@ -262,16 +237,14 @@ void RenderManager::RemoveTexture( Render::Texture* texture )
 {
   DALI_ASSERT_DEBUG( NULL != texture );
 
-  TextureOwnerContainer& textures = mImpl->textureContainer;
-
-  // Find the texture
-  for ( TextureOwnerIter iter = textures.Begin(); iter != textures.End(); ++iter )
+  // Find the texture, use reference to pointer so we can do the erase safely
+  for ( auto&& iter : mImpl->textureContainer )
   {
-    if ( *iter == texture )
+    if ( iter == texture )
     {
       texture->Destroy( mImpl->context );
-      textures.Erase( iter ); // Texture found; now destroy it
-      break;
+      mImpl->textureContainer.Erase( &iter ); // Texture found; now destroy it
+      return;
     }
   }
 }
@@ -309,15 +282,13 @@ void RenderManager::RemoveFrameBuffer( Render::FrameBuffer* frameBuffer )
 {
   DALI_ASSERT_DEBUG( NULL != frameBuffer );
 
-  FrameBufferOwnerContainer& framebuffers = mImpl->frameBufferContainer;
-
-  // Find the sampler
-  for ( FrameBufferOwnerIter iter = framebuffers.Begin(); iter != framebuffers.End(); ++iter )
+  // Find the sampler, use reference so we can safely do the erase
+  for ( auto&& iter : mImpl->frameBufferContainer )
   {
-    if ( *iter == frameBuffer )
+    if ( iter == frameBuffer )
     {
       frameBuffer->Destroy( mImpl->context );
-      framebuffers.Erase( iter ); // frameBuffer found; now destroy it
+      mImpl->frameBufferContainer.Erase( &iter ); // frameBuffer found; now destroy it
       break;
     }
   }
@@ -367,14 +338,12 @@ void RenderManager::AttachVertexBuffer( Render::Geometry* geometry, Render::Prop
 {
   DALI_ASSERT_DEBUG( NULL != geometry );
 
-  GeometryOwnerContainer& geometries = mImpl->geometryContainer;
-
-  // Find the renderer
-  for ( GeometryOwnerIter iter = geometries.Begin(); iter != geometries.End(); ++iter )
+  // Find the geometry
+  for ( auto&& iter : mImpl->geometryContainer )
   {
-    if ( *iter == geometry )
+    if ( iter == geometry )
     {
-      (*iter)->AddPropertyBuffer( propertyBuffer );
+      iter->AddPropertyBuffer( propertyBuffer );
       break;
     }
   }
@@ -384,14 +353,12 @@ void RenderManager::RemoveVertexBuffer( Render::Geometry* geometry, Render::Prop
 {
   DALI_ASSERT_DEBUG( NULL != geometry );
 
-  GeometryOwnerContainer& geometries = mImpl->geometryContainer;
-
-  // Find the renderer
-  for ( GeometryOwnerIter iter = geometries.Begin(); iter != geometries.End(); ++iter )
+  // Find the geometry
+  for ( auto&& iter : mImpl->geometryContainer )
   {
-    if ( *iter == geometry )
+    if ( iter == geometry )
     {
-      (*iter)->RemovePropertyBuffer( propertyBuffer );
+      iter->RemovePropertyBuffer( propertyBuffer );
       break;
     }
   }
@@ -481,9 +448,9 @@ void RenderManager::Render( Integration::RenderStatus& status )
     mImpl->UpdateTrackers();
 
     //Notify RenderGeometries that rendering has finished
-    for ( GeometryOwnerIter iter = mImpl->geometryContainer.Begin(); iter != mImpl->geometryContainer.End(); ++iter )
+    for ( auto&& iter : mImpl->geometryContainer )
     {
-      (*iter)->OnRenderFinished();
+      iter->OnRenderFinished();
     }
   }
 
index 64bf05f..cf23bc2 100644 (file)
@@ -108,11 +108,10 @@ template< class T >
 inline void ResetToBaseValues( OwnerContainer<T*>& container, BufferIndex updateBufferIndex )
 {
   // Reset animatable properties to base values
-  typename OwnerContainer<T*>::Iterator iter = container.Begin();
-  const typename OwnerContainer<T*>::ConstIterator endIter = container.End();
-  for ( ; iter != endIter; ++iter )
+  // use reference to avoid extra copies of the iterator
+  for( auto&& iter : container )
   {
-    (*iter)->ResetToBaseValues( updateBufferIndex );
+    iter->ResetToBaseValues( updateBufferIndex );
   }
 }
 
@@ -128,34 +127,20 @@ inline void EraseUsingDiscardQueue( OwnerContainer<T*>& container, T* object, Di
 {
   DALI_ASSERT_DEBUG( object && "NULL object not allowed" );
 
-  typename OwnerContainer<T*>::Iterator iter = container.Begin();
-  const typename OwnerContainer<T*>::ConstIterator endIter = container.End();
-  for ( ; iter != endIter; ++iter )
+  // need to use the reference version of auto as we need the pointer to the pointer for the Release call below
+  for( auto&& iter : container )
   {
-    if ( *iter == object )
+    if ( iter == object )
     {
       // Transfer ownership to the discard queue, this keeps the object alive, until the render-thread has finished with it
-      discardQueue.Add( updateBufferIndex, container.Release( iter ) );
-      return;
+      discardQueue.Add( updateBufferIndex, container.Release( &iter ) ); // take the address of the reference to a pointer (iter)
+      return; // return as we only ever remove one object. Iterators to container are now invalidated as well so cannot continue
     }
   }
 }
 
 }
 
-typedef OwnerContainer< Shader* >              ShaderOwner;
-typedef ShaderOwner::Iterator                  ShaderIter;
-typedef std::vector<Internal::ShaderDataPtr>   ShaderDataBinaryQueue;
-
-typedef OwnerContainer< TextureSet* >          TextureSetOwner;
-typedef TextureSetOwner::Iterator              TextureSetIter;
-
-typedef OwnerContainer<Renderer*>              RendererOwner;
-typedef RendererOwner::Iterator                RendererIter;
-
-typedef OwnerContainer< Camera* >              CameraOwner;
-typedef OwnerContainer< PropertyOwner* >       CustomObjectOwner;
-
 /**
  * Structure to contain UpdateManager internal data
  */
@@ -211,15 +196,15 @@ struct UpdateManager::Impl
   {
     // Disconnect render tasks from nodes, before destroying the nodes
     RenderTaskList::RenderTaskContainer& tasks = taskList.GetTasks();
-    for (RenderTaskList::RenderTaskContainer::Iterator iter = tasks.Begin(); iter != tasks.End(); ++iter)
+    for ( auto&& iter : tasks )
     {
-      (*iter)->SetSourceNode( NULL );
+      iter->SetSourceNode( NULL );
     }
     // ..repeat for system level RenderTasks
     RenderTaskList::RenderTaskContainer& systemLevelTasks = systemLevelTaskList.GetTasks();
-    for (RenderTaskList::RenderTaskContainer::Iterator iter = systemLevelTasks.Begin(); iter != systemLevelTasks.End(); ++iter)
+    for ( auto&& iter : systemLevelTasks )
     {
-      (*iter)->SetSourceNode( NULL );
+      iter->SetSourceNode( NULL );
     }
 
     // UpdateManager owns the Nodes. Although Nodes are pool allocated they contain heap allocated parts
@@ -252,58 +237,58 @@ struct UpdateManager::Impl
     delete sceneController;
   }
 
-  SceneGraphBuffers                   sceneGraphBuffers;             ///< Used to keep track of which buffers are being written or read
-  RenderMessageDispatcher             renderMessageDispatcher;       ///< Used for passing messages to the render-thread
-  NotificationManager&                notificationManager;           ///< Queues notification messages for the event-thread.
-  TransformManager                    transformManager;              ///< Used to update the transformation matrices of the nodes
-  CompleteNotificationInterface&      animationPlaylist;             ///< Holds handles to all the animations
-  PropertyNotifier&                   propertyNotifier;              ///< Provides notification to applications when properties are modified.
-  ShaderSaver*                        shaderSaver;                   ///< Saves shader binaries.
-  DiscardQueue&                       discardQueue;                  ///< Nodes are added here when disconnected from the scene-graph.
-  RenderController&                   renderController;              ///< render controller
-  SceneControllerImpl*                sceneController;               ///< scene controller
-  RenderManager&                      renderManager;                 ///< This is responsible for rendering the results of each "update"
-  RenderQueue&                        renderQueue;                   ///< Used to queue messages for the next render
-  RenderInstructionContainer&         renderInstructions;            ///< Used to prepare the render instructions
-  RenderTaskProcessor&                renderTaskProcessor;           ///< Handles RenderTasks and RenderInstrucitons
+  SceneGraphBuffers                    sceneGraphBuffers;             ///< Used to keep track of which buffers are being written or read
+  RenderMessageDispatcher              renderMessageDispatcher;       ///< Used for passing messages to the render-thread
+  NotificationManager&                 notificationManager;           ///< Queues notification messages for the event-thread.
+  TransformManager                     transformManager;              ///< Used to update the transformation matrices of the nodes
+  CompleteNotificationInterface&       animationPlaylist;             ///< Holds handles to all the animations
+  PropertyNotifier&                    propertyNotifier;              ///< Provides notification to applications when properties are modified.
+  ShaderSaver*                         shaderSaver;                   ///< Saves shader binaries.
+  DiscardQueue&                        discardQueue;                  ///< Nodes are added here when disconnected from the scene-graph.
+  RenderController&                    renderController;              ///< render controller
+  SceneControllerImpl*                 sceneController;               ///< scene controller
+  RenderManager&                       renderManager;                 ///< This is responsible for rendering the results of each "update"
+  RenderQueue&                         renderQueue;                   ///< Used to queue messages for the next render
+  RenderInstructionContainer&          renderInstructions;            ///< Used to prepare the render instructions
+  RenderTaskProcessor&                 renderTaskProcessor;           ///< Handles RenderTasks and RenderInstrucitons
 
-  Vector4                             backgroundColor;               ///< The glClear color used at the beginning of each frame.
+  Vector4                              backgroundColor;               ///< The glClear color used at the beginning of each frame.
 
-  RenderTaskList                      taskList;                      ///< The list of scene graph render-tasks
-  RenderTaskList                      systemLevelTaskList;           ///< Separate render-tasks for system-level content
+  RenderTaskList                       taskList;                      ///< The list of scene graph render-tasks
+  RenderTaskList                       systemLevelTaskList;           ///< Separate render-tasks for system-level content
 
-  Layer*                              root;                          ///< The root node (root is a layer)
-  Layer*                              systemLevelRoot;               ///< A separate root-node for system-level content
+  Layer*                               root;                          ///< The root node (root is a layer)
+  Layer*                               systemLevelRoot;               ///< A separate root-node for system-level content
 
-  Vector<Node*>                       nodes;                         ///< A container of all instantiated nodes
+  Vector<Node*>                        nodes;                         ///< A container of all instantiated nodes
 
-  SortedLayerPointers                 sortedLayers;                  ///< A container of Layer pointers sorted by depth
-  SortedLayerPointers                 systemLevelSortedLayers;       ///< A separate container of system-level Layers
+  SortedLayerPointers                  sortedLayers;                  ///< A container of Layer pointers sorted by depth
+  SortedLayerPointers                  systemLevelSortedLayers;       ///< A separate container of system-level Layers
 
-  CameraOwner                         cameras;                       ///< A container of cameras
-  CustomObjectOwner                   customObjects;                 ///< A container of owned objects (with custom properties)
+  OwnerContainer< Camera* >            cameras;                       ///< A container of cameras
+  OwnerContainer< PropertyOwner* >     customObjects;                 ///< A container of owned objects (with custom properties)
 
-  AnimationContainer                  animations;                    ///< A container of owned animations
-  PropertyNotificationContainer       propertyNotifications;         ///< A container of owner property notifications.
+  AnimationContainer                   animations;                    ///< A container of owned animations
+  PropertyNotificationContainer        propertyNotifications;         ///< A container of owner property notifications.
 
-  RendererOwner                       renderers;                     ///< A container of owned renderers
-  TextureSetOwner                     textureSets;                   ///< A container of owned texture sets
-  ShaderOwner                         shaders;                       ///< A container of owned shaders
-  OwnerPointer<PanGesture>            panGestureProcessor;           ///< Owned pan gesture processor; it lives for the lifecycle of UpdateManager
+  OwnerContainer< Renderer* >          renderers;                     ///< A container of owned renderers
+  OwnerContainer< TextureSet* >        textureSets;                   ///< A container of owned texture sets
+  OwnerContainer< Shader* >            shaders;                       ///< A container of owned shaders
+  OwnerPointer< PanGesture >           panGestureProcessor;           ///< Owned pan gesture processor; it lives for the lifecycle of UpdateManager
 
-  MessageQueue                        messageQueue;                  ///< The messages queued from the event-thread
-  ShaderDataBinaryQueue               renderCompiledShaders;         ///< Shaders compiled on Render thread are inserted here for update thread to pass on to event thread.
-  ShaderDataBinaryQueue               updateCompiledShaders;         ///< Shaders to be sent from Update to Event
-  Mutex                               compiledShaderMutex;           ///< lock to ensure no corruption on the renderCompiledShaders
+  MessageQueue                         messageQueue;                  ///< The messages queued from the event-thread
+  std::vector<Internal::ShaderDataPtr> renderCompiledShaders;         ///< Shaders compiled on Render thread are inserted here for update thread to pass on to event thread.
+  std::vector<Internal::ShaderDataPtr> updateCompiledShaders;         ///< Shaders to be sent from Update to Event
+  Mutex                                compiledShaderMutex;           ///< lock to ensure no corruption on the renderCompiledShaders
 
-  float                               keepRenderingSeconds;          ///< Set via Dali::Stage::KeepRendering
-  int                                 nodeDirtyFlags;                ///< cumulative node dirty flags from previous frame
-  int                                 frameCounter;                  ///< Frame counter used in debugging to choose which frame to debug and which to ignore.
+  float                                keepRenderingSeconds;          ///< Set via Dali::Stage::KeepRendering
+  int                                  nodeDirtyFlags;                ///< cumulative node dirty flags from previous frame
+  int                                  frameCounter;                  ///< Frame counter used in debugging to choose which frame to debug and which to ignore.
 
-  bool                                animationFinishedDuringUpdate; ///< Flag whether any animations finished during the Update()
-  bool                                previousUpdateScene;           ///< True if the scene was updated in the previous frame (otherwise it was optimized out)
-  bool                                renderTaskWaiting;             ///< A REFRESH_ONCE render task is waiting to be rendered
-  bool                                renderersAdded;                ///< Flag to keep track when renderers have been added to avoid unnecessary processing
+  bool                                 animationFinishedDuringUpdate; ///< Flag whether any animations finished during the Update()
+  bool                                 previousUpdateScene;           ///< True if the scene was updated in the previous frame (otherwise it was optimized out)
+  bool                                 renderTaskWaiting;             ///< A REFRESH_ONCE render task is waiting to be rendered
+  bool                                 renderersAdded;                ///< Flag to keep track when renderers have been added to avoid unnecessary processing
 
 private:
 
@@ -464,24 +449,19 @@ void UpdateManager::RemoveAnimation( Animation* animation )
 
 bool UpdateManager::IsAnimationRunning() const
 {
-  bool isRunning(false);
-  AnimationContainer& animations = mImpl->animations;
-
   // Find any animation that isn't stopped or paused
-
-  const AnimationIter endIter = animations.End();
-  for ( AnimationIter iter = animations.Begin(); !isRunning && iter != endIter; ++iter )
+  for ( auto&& iter : mImpl->animations )
   {
-    const Animation::State state = (*iter)->GetState();
+    const Animation::State state = iter->GetState();
 
     if (state != Animation::Stopped &&
         state != Animation::Paused)
     {
-      isRunning = true;
+      return true; // stop iteration as soon as first one is found
     }
   }
 
-  return isRunning;
+  return false;
 }
 
 void UpdateManager::AddPropertyNotification( OwnerPointer< PropertyNotification >& propertyNotification )
@@ -703,12 +683,9 @@ void UpdateManager::Animate( BufferIndex bufferIndex, float elapsedSeconds )
 void UpdateManager::ConstrainCustomObjects( BufferIndex bufferIndex )
 {
   //Constrain custom objects (in construction order)
-  OwnerContainer< PropertyOwner* >& customObjects = mImpl->customObjects;
-  const OwnerContainer< PropertyOwner* >::Iterator endIter = customObjects.End();
-  for ( OwnerContainer< PropertyOwner* >::Iterator iter = customObjects.Begin(); endIter != iter; ++iter )
+  for ( auto&& object : mImpl->customObjects )
   {
-    PropertyOwner& object = **iter;
-    ConstrainPropertyOwner( object, bufferIndex );
+    ConstrainPropertyOwner( *object, bufferIndex );
   }
 }
 
@@ -716,46 +693,37 @@ void UpdateManager::ConstrainRenderTasks( BufferIndex bufferIndex )
 {
   // Constrain system-level render-tasks
   const RenderTaskList::RenderTaskContainer& systemLevelTasks = mImpl->systemLevelTaskList.GetTasks();
-  for ( RenderTaskList::RenderTaskContainer::ConstIterator iter = systemLevelTasks.Begin(); iter != systemLevelTasks.End(); ++iter )
+  for ( auto&& task : systemLevelTasks )
   {
-    RenderTask& task = **iter;
-    ConstrainPropertyOwner( task, bufferIndex );
+    ConstrainPropertyOwner( *task, bufferIndex );
   }
 
   // Constrain render-tasks
   const RenderTaskList::RenderTaskContainer& tasks = mImpl->taskList.GetTasks();
-  for ( RenderTaskList::RenderTaskContainer::ConstIterator iter = tasks.Begin(); iter != tasks.End(); ++iter )
+  for ( auto&& task : tasks )
   {
-    RenderTask& task = **iter;
-    ConstrainPropertyOwner( task, bufferIndex );
+    ConstrainPropertyOwner( *task, bufferIndex );
   }
 }
 
 void UpdateManager::ConstrainShaders( BufferIndex bufferIndex )
 {
   // constrain shaders... (in construction order)
-  ShaderOwner& shaders = mImpl->shaders;
-  for ( ShaderIter iter = shaders.Begin(); iter != shaders.End(); ++iter )
+  for ( auto&& shader : mImpl->shaders )
   {
-    Shader& shader = **iter;
-    ConstrainPropertyOwner( shader, bufferIndex );
+    ConstrainPropertyOwner( *shader, bufferIndex );
   }
 }
 
 void UpdateManager::ProcessPropertyNotifications( BufferIndex bufferIndex )
 {
-  PropertyNotificationContainer &notifications = mImpl->propertyNotifications;
-  PropertyNotificationIter iter = notifications.Begin();
-
-  while ( iter != notifications.End() )
+  for( auto&& notification : mImpl->propertyNotifications )
   {
-    PropertyNotification* notification = *iter;
     bool valid = notification->Check( bufferIndex );
     if(valid)
     {
       mImpl->notificationManager.QueueMessage( PropertyChangedMessage( mImpl->propertyNotifier, notification, notification->GetValidity() ) );
     }
-    ++iter;
   }
 }
 
@@ -774,11 +742,9 @@ void UpdateManager::ForwardCompiledShadersToEventThread()
     if( mImpl->updateCompiledShaders.size() > 0 )
     {
       ShaderSaver& factory = *mImpl->shaderSaver;
-      ShaderDataBinaryQueue::iterator i   = mImpl->updateCompiledShaders.begin();
-      ShaderDataBinaryQueue::iterator end = mImpl->updateCompiledShaders.end();
-      for( ; i != end; ++i )
+      for( auto&& shader : mImpl->updateCompiledShaders )
       {
-        mImpl->notificationManager.QueueMessage( ShaderCompiledMessage( factory, *i ) );
+        mImpl->notificationManager.QueueMessage( ShaderCompiledMessage( factory, shader ) );
       }
       // we don't need them in update anymore
       mImpl->updateCompiledShaders.clear();
@@ -897,10 +863,9 @@ unsigned int UpdateManager::Update( float elapsedSeconds,
     ProcessPropertyNotifications( bufferIndex );
 
     //Update cameras
-    const CameraOwner::Iterator endCameraIterator = mImpl->cameras.End();
-    for( CameraOwner::Iterator cameraIterator = mImpl->cameras.Begin(); endCameraIterator != cameraIterator; ++cameraIterator )
+    for( auto&& cameraIterator : mImpl->cameras )
     {
-      ( *cameraIterator )->Update( bufferIndex );
+      cameraIterator->Update( bufferIndex );
     }
 
     //Process the RenderTasks if renderers exist. This creates the instructions for rendering the next frame.
@@ -934,21 +899,17 @@ unsigned int UpdateManager::Update( float elapsedSeconds,
   // check the countdown and notify (note, at the moment this is only done for normal tasks, not for systemlevel tasks)
   bool doRenderOnceNotify = false;
   mImpl->renderTaskWaiting = false;
-  const RenderTaskList::RenderTaskContainer& tasks = mImpl->taskList.GetTasks();
-  for ( RenderTaskList::RenderTaskContainer::ConstIterator iter = tasks.Begin(), endIter = tasks.End();
-        endIter != iter; ++iter )
+  for ( auto&& renderTask : mImpl->taskList.GetTasks() )
   {
-    RenderTask& renderTask(*(*iter));
-
-    renderTask.UpdateState();
+    renderTask->UpdateState();
 
-    if( renderTask.IsWaitingToRender() &&
-        renderTask.ReadyToRender( bufferIndex ) /*avoid updating forever when source actor is off-stage*/ )
+    if( renderTask->IsWaitingToRender() &&
+        renderTask->ReadyToRender( bufferIndex ) /*avoid updating forever when source actor is off-stage*/ )
     {
       mImpl->renderTaskWaiting = true; // keep update/render threads alive
     }
 
-    if( renderTask.HasRendered() )
+    if( renderTask->HasRendered() )
     {
       doRenderOnceNotify = true;
     }
@@ -1057,11 +1018,9 @@ void UpdateManager::SetDepthIndices( OwnerPointer< NodeDepths >& nodeDepths )
 {
   // note,this vector is already in depth order. It could be used as-is to
   // remove sorting in update algorithm. However, it lacks layer boundary markers.
-  for( std::vector<NodeDepthPair>::iterator iter = nodeDepths->nodeDepths.begin(),
-         end = nodeDepths->nodeDepths.end() ;
-       iter != end ; ++iter )
+  for( auto&& iter : nodeDepths->nodeDepths )
   {
-    iter->node->SetDepthIndex( iter->sortedDepth );
+    iter.node->SetDepthIndex( iter.sortedDepth );
   }
 }
 
index 40498f3..6d9b156 100644 (file)
@@ -124,9 +124,15 @@ std::string DevelKeyEvent::GetDeviceName( const KeyEvent& keyEvent )
   return GetImplementation( &keyEvent )->GetDeviceName();
 }
 
-DevelKeyEvent::DeviceClass::Type DevelKeyEvent::GetDeviceClass( const KeyEvent& keyEvent )
+DevelDevice::Class::Type DevelKeyEvent::GetDeviceClass( const KeyEvent& keyEvent )
 {
   return GetImplementation( &keyEvent )->GetDeviceClass();
 }
 
+DevelDevice::Subclass::Type DevelKeyEvent::GetDeviceSubclass( const KeyEvent& keyEvent )
+{
+  return GetImplementation( &keyEvent )->GetDeviceSubclass();
+}
+
+
 } // namespace Dali
index 215ae67..1dcdbd6 100644 (file)
@@ -20,6 +20,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/public-api/actors/actor.h>
+#include <dali/devel-api/events/touch-event-devel.h>
 #include <dali/internal/event/events/touch-data-impl.h>
 
 #include <cstdio>
@@ -102,6 +103,16 @@ Degree TouchData::GetAngle( std::size_t point ) const
   return GetImplementation( *this ).GetAngle( point );
 }
 
+DevelDevice::Class::Type DevelTouchData::GetDeviceClass( const TouchData& touch, std::size_t point )
+{
+  return GetImplementation( touch ).GetDeviceClass( point );
+}
+
+DevelDevice::Subclass::Type DevelTouchData::GetDeviceSubclass( const TouchData& touch, std::size_t point )
+{
+  return GetImplementation( touch ).GetDeviceSubclass( point );
+}
+
 TouchData::TouchData( Internal::TouchData* internal )
 : BaseHandle( internal )
 {