Support multiple scenes in EvasPlugin 21/226121/4
authorJiyun Yang <ji.yang@samsung.com>
Fri, 21 Feb 2020 11:03:07 +0000 (20:03 +0900)
committerJiyun Yang <ji.yang@samsung.com>
Thu, 5 Mar 2020 03:36:18 +0000 (12:36 +0900)
Change-Id: I004cf3973aa2645756e38df799293937d301b68d
Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
16 files changed:
dali-extension/dali-extension.h
dali-extension/devel-api/evas-plugin/evas-plugin.cpp
dali-extension/devel-api/evas-plugin/evas-plugin.h
dali-extension/devel-api/evas-plugin/file.list
dali-extension/devel-api/evas-plugin/scene.cpp [new file with mode: 0644]
dali-extension/devel-api/evas-plugin/scene.h [new file with mode: 0644]
dali-extension/internal/evas-plugin/evas-event-handler.cpp
dali-extension/internal/evas-plugin/evas-event-handler.h
dali-extension/internal/evas-plugin/evas-event-interface.h
dali-extension/internal/evas-plugin/evas-plugin-impl.cpp
dali-extension/internal/evas-plugin/evas-plugin-impl.h
dali-extension/internal/evas-plugin/evas-wrapper.cpp
dali-extension/internal/evas-plugin/evas-wrapper.h
dali-extension/internal/evas-plugin/file.list
dali-extension/internal/evas-plugin/scene-impl.cpp [new file with mode: 0644]
dali-extension/internal/evas-plugin/scene-impl.h [new file with mode: 0644]

index 762dd96..3d634aa 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __DALI_EXTENSION_H__
-#define __DALI_EXTENSION_H__
+#ifndef DALI_EXTENSION_H
+#define DALI_EXTENSION_H
 
 /*
  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
@@ -19,5 +19,6 @@
  */
 
 #include <dali-extension/devel-api/evas-plugin/evas-plugin.h>
+#include <dali-extension/devel-api/evas-plugin/scene.h>
 
-#endif // __DALI_EXTENSION_H__
+#endif // DALI_EXTENSION_H
index 30219a5..18d4414 100755 (executable)
@@ -27,17 +27,12 @@ namespace Dali
 namespace Extension
 {
 
-EvasPlugin EvasPlugin::New( Evas_Object* parentEvasObject, int width, int height, bool isTranslucent )
+EvasPlugin EvasPlugin::New( Evas_Object* parentEvasObject, uint16_t width, uint16_t height, bool isTranslucent )
 {
   IntrusivePtr< Internal::EvasPlugin > impl = Internal::EvasPlugin::New( parentEvasObject, width, height, isTranslucent );
 
-  // When Initialize(), EvasPlugin creates Adaptor which needs BaseHandle of Internal::EvasPlugin.
-  // In that process, EvasPlugin can be deleted when destroying BaseHandle
-  // so it is needed to count reference before calling Initialize()
   EvasPlugin evasPlugin = EvasPlugin( impl.Get() );
 
-  impl->Initialize();
-
   return evasPlugin;
 }
 
@@ -46,7 +41,7 @@ EvasPlugin::EvasPlugin()
 }
 
 EvasPlugin::EvasPlugin( const EvasPlugin& evasPlugin )
-: SceneHolder( evasPlugin )
+: BaseHandle( evasPlugin )
 {
 }
 
@@ -83,6 +78,11 @@ void EvasPlugin::Stop()
   Internal::GetImplementation( *this ).Stop();
 }
 
+Scene EvasPlugin::GetDefaultScene()
+{
+  return Internal::GetImplementation( *this ).GetDefaultScene();
+}
+
 Evas_Object* EvasPlugin::GetAccessEvasObject()
 {
   return Internal::GetImplementation( *this ).GetAccessEvasObject();
@@ -129,7 +129,7 @@ EvasPlugin::EvasPluginSignalType& EvasPlugin::UnFocusedSignal()
 }
 
 EvasPlugin::EvasPlugin( Internal::EvasPlugin* evasPlugin )
-: SceneHolder( evasPlugin )
+: BaseHandle( evasPlugin )
 {
 }
 
index bdd964e..177f479 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_EXTENSION_EVAS_PLUGIN_H__
-#define __DALI_EXTENSION_EVAS_PLUGIN_H__
+#ifndef DALI_EXTENSION_EVAS_PLUGIN_H
+#define DALI_EXTENSION_EVAS_PLUGIN_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -27,7 +27,6 @@
 #include <Evas.h>
 
 #include <dali/public-api/signals/dali-signal.h>
-#include <dali/integration-api/adaptor-framework/scene-holder.h>
 
 namespace Dali
 {
@@ -35,6 +34,8 @@ namespace Dali
 namespace Extension
 {
 
+class Scene;
+
 namespace Internal
 {
 class EvasPlugin;
@@ -69,8 +70,8 @@ class EvasPlugin;
  * namespace
  * {
  * const char* const APPLICATION_TITLE = "EvasPluginExample";
- * const int EVAS_PLUGIN_WIDTH = 360;
- * const int EVAS_PLUGIN_HEIGHT = 360;
+ * const uint16_t EVAS_PLUGIN_WIDTH = 360;
+ * const uint16_t EVAS_PLUGIN_HEIGHT = 360;
  * }
  *
  * class EvasPluginExample : public ConnectionTracker
@@ -90,8 +91,8 @@ class EvasPlugin;
  *
  *   void OnInitialize()
  *   {
- *     Stage stage = Stage::GetCurrent();
- *     stage.SetBackgroundColor( Color::WHITE );
+ *     Scene scene = mEvasPlugin.GetDefaultScene();
+ *     scene.SetBackgroundColor( Color::WHITE );
  *
  *     TextLabel textLabel = TextLabel::New( "Hello World" );
  *     textLabel.SetParentOrigin( ParentOrigin::CENTER );
@@ -99,7 +100,7 @@ class EvasPlugin;
  *     textLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::CENTER );
  *     textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 40 );
  *     textLabel.SetName( "helloWorldLabel" );
- *     stage.Add( textLabel );
+ *     scene.Add( textLabel );
  *
  *     Animation anim = Animation::New( 3.f );
  *     anim.SetLooping( true );
@@ -194,7 +195,7 @@ class EvasPlugin;
  *
  * @endcode
  */
-class DALI_IMPORT_API EvasPlugin : public Dali::Integration::SceneHolder
+class DALI_IMPORT_API EvasPlugin : public Dali::BaseHandle
 {
 public:
 
@@ -203,14 +204,14 @@ public:
 public:
 
   /**
-   * @brief This is the constructor for Tizen EFL applications
+   * @brief This is the constructor of EvasPlugin for Tizen EFL applications
    *
-   * @param[in] parentEvasObject Parent of the new Evas object
-   * @param[in] width The initial width of the Dali view port
-   * @param[in] height The initial height of the Dali view port
+   * @param[in] parentEvasObject Parent Evas object of the default scene
+   * @param[in] width The initial width of the default scene
+   * @param[in] height The initial height of the default scene
    * @param[in] isTranslucent Whether the Evas object is translucent or not
    */
-  static EvasPlugin New( Evas_Object* parentEvasObject, int width, int height, bool isTranslucent );
+  static EvasPlugin New( Evas_Object* parentEvasObject, uint16_t width, uint16_t height, bool isTranslucent );
 
   /**
    * @brief Constructs an empty handle
@@ -240,11 +241,13 @@ public:
   void Run();
 
   /**
+   * @note DEPRECATED. Instead, hide corresponding Evas object.
    * @brief Pauses the Evas plugin
    */
   void Pause();
 
   /**
+   * @note DEPRECATED. Instead, show corresponding Evas object.
    * @brief Resumes the Evas plugin
    */
   void Resume();
@@ -254,8 +257,17 @@ public:
    */
   void Stop();
 
+
   /**
-   * @brief This returns the Evas_Object* which is created internally
+   * @brief Get the default Scene handle
+   * @return The default Scene
+   */
+  Scene GetDefaultScene();
+
+  /**
+   * @note DEPRECATED. This is same as evasPlugin.GetDefaultScene().GetAccessEvasObject()
+   *
+   * @brief This returns the Evas_Object* for accessibility which is created internally
    *
    * Applications should append this access object to custom focus chain for accessibility
    *
@@ -266,6 +278,8 @@ public:
   Evas_Object* GetAccessEvasObject();
 
   /**
+   * @note DEPRECATED. This is same as evasPlugin.GetDefaultScene().GetDaliEvasObject()
+   *
    * @brief This returns the Evas_Object* which is created internally
    *
    * @return Evas_Object* Evas object which is rendered by Dali
@@ -277,6 +291,8 @@ public:  // Signals
   /**
    * @brief Signal to notify the client when the application is ready to be initialized
    *
+   * @note EvasPlugin::Run() should be called to be initialized
+   *
    * @return The signal
    */
   EvasPluginSignalType& InitSignal();
@@ -289,6 +305,7 @@ public:  // Signals
   EvasPluginSignalType& TerminateSignal();
 
   /**
+   * @note DEPRECATED
    * @brief Signal to notify the client when the EvasPlugin is about to be paused
    *
    * The user should connect to this signal if the user needs to perform any special
@@ -298,6 +315,7 @@ public:  // Signals
   EvasPluginSignalType& PauseSignal();
 
   /**
+   * @note DEPRECATED
    * @brief Signal to notify the client when the adpator has resumed
    *
    * The user should connect to this signal if the user needs to perform any special
@@ -307,6 +325,8 @@ public:  // Signals
   EvasPluginSignalType& ResumeSignal();
 
   /**
+   * @note DEPRECATED. Use Scene::ResizedSignal()
+   *
    * @brief Signal to notify the client when the Evas object is resized
    *
    * @return The signal
@@ -314,6 +334,8 @@ public:  // Signals
   EvasPluginSignalType& ResizeSignal();
 
   /**
+   * @note DEPRECATED. Use Scene::FocusChangedSignal()
+   *
    * @brief Signal to notify the client when the Evas object gets the keyboard focus
    *
    * @return The signal
@@ -321,6 +343,8 @@ public:  // Signals
   EvasPluginSignalType& FocusedSignal();
 
   /**
+   * @note DEPRECATED. Use Scene::FocusChangedSignal()
+   *
    * @brief Signal to notify the client when the Evas object loses the keyboard focus
    *
    * @return The signal
@@ -343,4 +367,4 @@ public: // Not intended for application developers
 
 }  // namespace Dali
 
-#endif // __DALI_EXTENSION_EVAS_PLUGIN_H__
+#endif // DALI_EXTENSION_EVAS_PLUGIN_H
index 7796046..24958c9 100644 (file)
@@ -1,5 +1,7 @@
 evas_plugin_devel_header_files = \
-   $(extension_src_dir)/devel-api/evas-plugin/evas-plugin.h
+   $(extension_src_dir)/devel-api/evas-plugin/evas-plugin.h \
+   $(extension_src_dir)/devel-api/evas-plugin/scene.h
 
 evas_plugin_devel_src_files = \
-   $(extension_src_dir)/devel-api/evas-plugin/evas-plugin.cpp
+   $(extension_src_dir)/devel-api/evas-plugin/evas-plugin.cpp \
+   $(extension_src_dir)/devel-api/evas-plugin/scene.cpp
diff --git a/dali-extension/devel-api/evas-plugin/scene.cpp b/dali-extension/devel-api/evas-plugin/scene.cpp
new file mode 100644 (file)
index 0000000..364a49d
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2020 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.
+ *
+ */
+
+// EXTENRAL INCLUDES
+#include <dali/public-api/actors/layer.h>
+
+// INTERNAL INCLUDES
+#include <dali-extension/internal/evas-plugin/evas-plugin-impl.h>
+#include <dali-extension/internal/evas-plugin/scene-impl.h>
+
+// CLASS HEADER
+#include <dali-extension/devel-api/evas-plugin/scene.h>
+
+namespace Dali
+{
+
+namespace Extension
+{
+
+Scene Scene::New( EvasPlugin evasPlugin, Evas_Object* parentEvasObject, uint16_t width, uint16_t height, bool isTranslucent )
+{
+  IntrusivePtr< Internal::Scene > impl = Internal::Scene::New( parentEvasObject, width, height, isTranslucent );
+
+  Scene scene = Scene( impl.Get() );
+
+  impl->Initialize( &Internal::GetImplementation( evasPlugin ), false );
+
+  return scene;
+}
+
+Scene::Scene()
+{
+}
+
+Scene::Scene( const Scene& scene )
+: BaseHandle( scene )
+{
+}
+
+Scene& Scene::operator=( const Scene& scene )
+{
+  if( *this != scene )
+  {
+    BaseHandle::operator=( scene );
+  }
+  return *this;
+}
+
+Scene::~Scene()
+{
+}
+
+void Scene::Add( Actor actor )
+{
+  Internal::GetImplementation( *this ).Add( actor );
+}
+
+void Scene::Remove( Actor actor )
+{
+  Internal::GetImplementation( *this ).Remove( actor );
+}
+
+void Scene::SetBackgroundColor( const Vector4& color )
+{
+  Internal::GetImplementation( *this ).SetBackgroundColor( color );
+}
+
+Vector4 Scene::GetBackgroundColor() const
+{
+  return Internal::GetImplementation( *this ).GetBackgroundColor();
+}
+
+Layer Scene::GetRootLayer() const
+{
+  return Internal::GetImplementation( *this ).GetRootLayer();
+}
+
+uint32_t Scene::GetLayerCount() const
+{
+  return Internal::GetImplementation( *this ).GetLayerCount();
+}
+
+Layer Scene::GetLayer( uint32_t depth ) const
+{
+  return Internal::GetImplementation( *this ).GetLayer( depth );
+}
+
+Scene::SceneSize Scene::GetSize() const
+{
+  return Internal::GetImplementation( *this ).GetSize();
+}
+
+Evas_Object* Scene::GetAccessEvasObject()
+{
+  return Internal::GetImplementation( *this ).GetAccessEvasObject();
+}
+
+Evas_Object* Scene::GetDaliEvasObject()
+{
+  return Internal::GetImplementation( *this ).GetDaliEvasObject();
+}
+
+Scene::ResizedSignalType& Scene::ResizedSignal()
+{
+  return Internal::GetImplementation( *this ).ResizedSignal();
+}
+
+Scene::VisibilityChangedSignalType& Scene::VisibilityChangedSignal()
+{
+  return Internal::GetImplementation( *this ).VisibilityChangedSignal();
+}
+
+Scene::FocusChangedSignalType& Scene::FocusChangedSignal()
+{
+  return Internal::GetImplementation( *this ).FocusChangedSignal();
+}
+
+Scene::Scene( Internal::Scene* scene )
+: BaseHandle( scene )
+{
+}
+
+}  // namespace Extension
+
+}  // namespace Dali
diff --git a/dali-extension/devel-api/evas-plugin/scene.h b/dali-extension/devel-api/evas-plugin/scene.h
new file mode 100644 (file)
index 0000000..fb57d1b
--- /dev/null
@@ -0,0 +1,240 @@
+#ifndef DALI_EXTENSION_SCENE_H
+#define DALI_EXTENSION_SCENE_H
+
+/*
+ * Copyright (c) 2020 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.
+ *
+ */
+
+/**
+ * @addtogroup CAPI_DALI_EXTENSION_FRAMEWORK_MODULE
+ * @{
+ */
+
+// EXTERNAL INCLUDES
+#include <Evas.h>
+
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/math/uint-16-pair.h>
+#include <dali/public-api/signals/dali-signal.h>
+
+// INTERNAL INCLUDES
+#include <dali-extension/devel-api/evas-plugin/evas-plugin.h>
+
+namespace Dali
+{
+
+class Layer;
+
+namespace Extension
+{
+
+namespace Internal
+{
+class Scene;
+}
+
+/**
+ * @brief Like EvasPlugin is an Application class used by EFL applications,
+ * the Scene corresponds to the Window class.
+ *
+ * |  DALi         | EFL with DALi     |
+ * |---------------|-------------------|
+ * |  Application  | EvasPlugin        |
+ * |  Window       | Scene             |
+ *
+ * When the EvasPlugin is created, a Scene is generated by default, it is called "default scene".
+ * You can get it by calling EvasPlugin::GetDefaultScene().
+ *
+ * Also, the EvasPlugin can have multiple scenes.
+ * You can create a new Scene by calling Scene::New(...);
+ */
+class DALI_IMPORT_API Scene : public Dali::BaseHandle
+{
+public:
+
+  typedef Uint16Pair SceneSize;
+
+  typedef Signal<void (Scene, bool)> VisibilityChangedSignalType;
+
+  typedef Signal<void (Scene, bool)> FocusChangedSignalType;
+
+  typedef Signal<void (Scene, uint16_t, uint16_t)> ResizedSignalType;
+
+public:
+
+  /**
+   * @brief Creates an initialized handle to a new Scene
+   * @note You should hold the returned handle. If you missed the handle, the scene will be released
+   *
+   * @param[in] evasPlugin The EvasPlugin handle
+   * @param[in] parentEvasObject Parent Evas object of the new scene
+   * @param[in] width The initial width of the scene
+   * @param[in] height The initial height of the scene
+   * @param[in] isTranslucent Whether the Evas object is translucent or not
+   */
+  static Scene New( EvasPlugin evasPlugin, Evas_Object* parentEvasObject, uint16_t width, uint16_t height, bool isTranslucent );
+
+  /**
+   * @brief Constructs an empty handle
+   */
+  Scene();
+
+  /**
+   * @brief Copy constructor
+   */
+  Scene( const Scene& scene );
+
+  /**
+   * @brief Assignment operator
+   */
+  Scene& operator=( const Scene& scene );
+
+  /**
+   * @brief Destructor
+   */
+  ~Scene();
+
+public:
+  /**
+   * @brief Adds a child Actor to the Scene.
+   *
+   * The child will be referenced.
+   *
+   * @param[in] actor The child
+   * @pre The actor has been initialized.
+   * @pre The actor does not have a parent.
+   */
+  void Add( Actor actor );
+
+  /**
+   * @brief Removes a child Actor from the Scene.
+   *
+   * The child will be unreferenced.
+   *
+   * @param[in] actor The child
+   * @pre The actor has been added to the Scene.
+   */
+  void Remove( Actor actor );
+
+  /**
+   * @brief Sets the background color of the Scene.
+   *
+   * @param[in] color The new background color
+   */
+  void SetBackgroundColor( const Vector4& color );
+
+  /**
+   * @brief Gets the background color of the Scene.
+   *
+   * @return The background color
+   */
+  Vector4 GetBackgroundColor() const;
+
+  /**
+   * @brief Returns the root Layer of the Scene.
+   *
+   * @return The root layer
+   */
+  Layer GetRootLayer() const;
+
+  /**
+   * @brief Queries the number of on-scene layers.
+   *
+   * Note that a default layer is always provided (count >= 1).
+   *
+   * @return The number of layers
+   */
+  uint32_t GetLayerCount() const;
+
+  /**
+   * @brief Retrieves the layer at a specified depth in the Scene.
+   *
+   * @SINCE_1_4.19
+   * @param[in] depth The depth
+   * @return The layer found at the given depth
+   * @pre Depth is less than layer count; see GetLayerCount().
+   */
+  Layer GetLayer( uint32_t depth ) const;
+
+  /**
+   * @brief Returns the size of the Scene in pixels as a Vector.
+   *
+   * The x component will be the width of the Scene in pixels.
+   * The y component will be the height of the Scene in pixels.
+   *
+   * @return The size of the Scene as a Vector
+   */
+  SceneSize GetSize() const;
+
+  /**
+   * @brief This returns the Evas_Object* for accessibility which is created internally
+   *
+   * Applications should append this access object to custom focus chain for accessibility
+   *
+   * e.g., elm_object_focus_custom_chain_append(layout, dali_access_object, NULL);
+   *
+   * @return Evas_Object* Elm access object which Dali image Evas object is registered
+   */
+  Evas_Object* GetAccessEvasObject();
+
+  /**
+   * @brief This returns the Evas_Object* which is created internally
+   *
+   * @return Evas_Object* Evas object which is rendered by Dali
+   */
+  Evas_Object* GetDaliEvasObject();
+
+public:  // Signals
+
+  /**
+   * @brief Signal to notify the client when the Evas object's visibility is changed
+   *
+   * @return The signal
+   */
+  VisibilityChangedSignalType& VisibilityChangedSignal();
+
+  /**
+   * @brief Signal to notify the client when the Evas object is resized
+   *
+   * @return The signal
+   */
+  ResizedSignalType& ResizedSignal();
+
+  /**
+   * @brief Signal to notify the client when the Evas object gets/loses the keyboard focus
+   *
+   * @return The signal
+   */
+  FocusChangedSignalType& FocusChangedSignal();
+
+public: // Not intended for application developers
+
+  /**
+   * @brief Internal constructor
+   */
+  explicit DALI_INTERNAL Scene( Internal::Scene* scene );
+
+};
+
+/**
+ * @}
+ */
+
+}  // namespace Extension
+
+}  // namespace Dali
+
+#endif // DALI_EXTENSION_SCENE_H
index 6445a25..1909df5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright ( c ) 2019 Samsung Electronics Co., Ltd.
+ * Copyright ( c ) 2020 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.
@@ -440,60 +440,66 @@ void FillIntegrationKeyEvent( Type keyEvent, Integration::KeyEvent& result )
 
 } // anonymous namespace
 
-EvasPluginEventHandler::EvasPluginEventHandler( EvasPluginEventInterface& evasPluginEventInterface )
-: mEvasPluginEventInterface( evasPluginEventInterface )
+EvasEventHandler::EvasEventHandler( EvasEventInterface& evasEventInterface )
+: mEvasEventInterface( evasEventInterface )
 {
-  EvasWrapper* evasWrapper = mEvasPluginEventInterface.GetEvasWrapper();
+  EvasWrapper* evasWrapper = mEvasEventInterface.GetEvasWrapper();
   Evas_Object* renderTarget = evasWrapper->GetRenderTarget();
   Evas_Object* accessibilityTarget = evasWrapper->GetAccessibilityTarget();
   Evas_Object* focusTarget = evasWrapper->GetFocusTarget();
   Evas* renderTargetAsEvas = evas_object_evas_get( renderTarget );
 
   // Register the evas event callbacks
-  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOUSE_DOWN,  OnEvasObjectMouseDown,      &evasPluginEventInterface );
-  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOUSE_UP,    OnEvasObjectMouseUp,        &evasPluginEventInterface );
-  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOUSE_MOVE,  OnEvasObjectMouseMove,      &evasPluginEventInterface );
-  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOUSE_WHEEL, OnEvasObjectMouseWheel,     &evasPluginEventInterface );
-  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MULTI_DOWN,  OnEvasObjectMultiTouchDown, &evasPluginEventInterface );
-  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MULTI_UP,    OnEvasObjectMultiTouchUp,   &evasPluginEventInterface );
-  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MULTI_MOVE,  OnEvasObjectMultiTouchMove, &evasPluginEventInterface );
-  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_KEY_DOWN,    OnEvasObjectKeyDown,        &evasPluginEventInterface );
-  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_KEY_UP,      OnEvasObjectKeyUp,          &evasPluginEventInterface );
+  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOUSE_DOWN,  OnEvasObjectMouseDown,      &evasEventInterface );
+  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOUSE_UP,    OnEvasObjectMouseUp,        &evasEventInterface );
+  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOUSE_MOVE,  OnEvasObjectMouseMove,      &evasEventInterface );
+  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOUSE_WHEEL, OnEvasObjectMouseWheel,     &evasEventInterface );
+  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MULTI_DOWN,  OnEvasObjectMultiTouchDown, &evasEventInterface );
+  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MULTI_UP,    OnEvasObjectMultiTouchUp,   &evasEventInterface );
+  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MULTI_MOVE,  OnEvasObjectMultiTouchMove, &evasEventInterface );
+  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_KEY_DOWN,    OnEvasObjectKeyDown,        &evasEventInterface );
+  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_KEY_UP,      OnEvasObjectKeyUp,          &evasEventInterface );
 
   // Register the evas geometry callbacks
-  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOVE,   OnEvasObjectMove,   &evasPluginEventInterface );
-  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_RESIZE, OnEvasObjectResize, &evasPluginEventInterface );
+  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_MOVE,   OnEvasObjectMove,   &evasEventInterface );
+  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_RESIZE, OnEvasObjectResize, &evasEventInterface );
+
+  // Register the evas visibility callbacks
+  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_SHOW, OnEvasObjectShow, &evasEventInterface );
+  evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_HIDE, OnEvasObjectHide, &evasEventInterface );
 
   // Register the evas focus callbacks
   evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_FOCUS_IN,  OnEvasObjectFocusIn,  this );
   evas_object_event_callback_add( renderTarget, EVAS_CALLBACK_FOCUS_OUT, OnEvasObjectFocusOut, this );
 
-  evas_event_callback_add( renderTargetAsEvas, EVAS_CALLBACK_CANVAS_FOCUS_IN,  OnEvasFocusIn,  &evasPluginEventInterface );
-  evas_event_callback_add( renderTargetAsEvas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, OnEvasFocusOut, &evasPluginEventInterface );
+  evas_event_callback_add( renderTargetAsEvas, EVAS_CALLBACK_CANVAS_FOCUS_IN,  OnEvasFocusIn,  &evasEventInterface );
+  evas_event_callback_add( renderTargetAsEvas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, OnEvasFocusOut, &evasEventInterface );
 
   // Register the evas render callbacks
-  evas_event_callback_add( renderTargetAsEvas, EVAS_CALLBACK_RENDER_POST, OnEvasRenderPost, &evasPluginEventInterface );
+  evas_event_callback_add( renderTargetAsEvas, EVAS_CALLBACK_RENDER_POST, OnEvasRenderPost, &evasEventInterface );
 
   // Register the elm access action callbacks and these callbacks are disconnected when mElmAccessEvasObject is unregistred
-  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_HIGHLIGHT,      OnElmAccessActionHighlight,      &evasPluginEventInterface );
-  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_UNHIGHLIGHT,    OnElmAccessActionUnhighlight,    &evasPluginEventInterface );
-  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, OnElmAccessActionHighlightNext,  &evasPluginEventInterface );
-  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_HIGHLIGHT_PREV, OnElmAccessActionHighlightPrev,  &evasPluginEventInterface );
-  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_ACTIVATE,       OnElmAccessActionActivate,       &evasPluginEventInterface );
-  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_UP,             OnElmAccessActionUp,             &evasPluginEventInterface );
-  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_DOWN,           OnElmAccessActionDown,           &evasPluginEventInterface );
-  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_SCROLL,         OnElmAccessActionScroll,         &evasPluginEventInterface );
-  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_BACK,           OnElmAccessActionBack,           &evasPluginEventInterface );
-  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_READ,           OnElmAccessActionRead,           &evasPluginEventInterface );
+  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_HIGHLIGHT,      OnElmAccessActionHighlight,      &evasEventInterface );
+  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_UNHIGHLIGHT,    OnElmAccessActionUnhighlight,    &evasEventInterface );
+  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, OnElmAccessActionHighlightNext,  &evasEventInterface );
+  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_HIGHLIGHT_PREV, OnElmAccessActionHighlightPrev,  &evasEventInterface );
+  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_ACTIVATE,       OnElmAccessActionActivate,       &evasEventInterface );
+  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_UP,             OnElmAccessActionUp,             &evasEventInterface );
+  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_DOWN,           OnElmAccessActionDown,           &evasEventInterface );
+  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_SCROLL,         OnElmAccessActionScroll,         &evasEventInterface );
+  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_BACK,           OnElmAccessActionBack,           &evasEventInterface );
+  elm_access_action_cb_set( accessibilityTarget, ELM_ACCESS_ACTION_READ,           OnElmAccessActionRead,           &evasEventInterface );
 
   // Register the elm focus callbacks
   evas_object_smart_callback_add( focusTarget, EVAS_OBJECT_FOCUSED_EVENT_NAME,   OnEvasObjectSmartFocused,   this );
   evas_object_smart_callback_add( focusTarget, EVAS_OBJECT_UNFOCUSED_EVENT_NAME, OnEvasObjectSmartUnfocused, this );
+
+  EnableEcoreWl2Events();
 }
 
-EvasPluginEventHandler::~EvasPluginEventHandler()
+EvasEventHandler::~EvasEventHandler()
 {
-  EvasWrapper* evasWrapper = mEvasPluginEventInterface.GetEvasWrapper();
+  EvasWrapper* evasWrapper = mEvasEventInterface.GetEvasWrapper();
   Evas_Object* renderTarget = evasWrapper->GetRenderTarget();
   Evas_Object* focusTarget = evasWrapper->GetFocusTarget();
   Evas* renderTargetAsEvas = evas_object_evas_get( renderTarget );
@@ -513,6 +519,10 @@ EvasPluginEventHandler::~EvasPluginEventHandler()
   evas_object_event_callback_del( renderTarget, EVAS_CALLBACK_MOVE,   OnEvasObjectMove );
   evas_object_event_callback_del( renderTarget, EVAS_CALLBACK_RESIZE, OnEvasObjectResize );
 
+  // Unregister the evas visibility callbacks
+  evas_object_event_callback_del( renderTarget, EVAS_CALLBACK_SHOW, OnEvasObjectShow );
+  evas_object_event_callback_del( renderTarget, EVAS_CALLBACK_HIDE, OnEvasObjectHide );
+
   // Unregister the evas focus callbacks
   evas_object_event_callback_del( renderTarget, EVAS_CALLBACK_FOCUS_IN,  OnEvasObjectFocusIn );
   evas_object_event_callback_del( renderTarget, EVAS_CALLBACK_FOCUS_OUT, OnEvasObjectFocusOut );
@@ -526,18 +536,20 @@ EvasPluginEventHandler::~EvasPluginEventHandler()
   // Unregister the elm focus callbacks
   evas_object_smart_callback_del( focusTarget, EVAS_OBJECT_FOCUSED_EVENT_NAME,   OnEvasObjectSmartFocused );
   evas_object_smart_callback_del( focusTarget, EVAS_OBJECT_UNFOCUSED_EVENT_NAME, OnEvasObjectSmartUnfocused );
+
+  DisableEcoreWl2Events();
 }
 
-void EvasPluginEventHandler::EnableEcoreWl2Events()
+void EvasEventHandler::EnableEcoreWl2Events()
 {
   if( !mEcoreEventHandlers.size() )
   {
     // Register Window visibility change events
-    mEcoreEventHandlers.push_back( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE, OnEcoreWl2EventWindowVisibilityChange, &mEvasPluginEventInterface ) );
+    mEcoreEventHandlers.push_back( ecore_event_handler_add( ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE, OnEcoreWl2EventWindowVisibilityChange, &mEvasEventInterface ) );
   }
 }
 
-void EvasPluginEventHandler::DisableEcoreWl2Events()
+void EvasEventHandler::DisableEcoreWl2Events()
 {
   if( mEcoreEventHandlers.size() )
   {
@@ -554,7 +566,7 @@ void EvasPluginEventHandler::DisableEcoreWl2Events()
 // Event callbacks
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 
-void EvasPluginEventHandler::OnEvasObjectMouseDown( void *data, Evas* evas, Evas_Object* evasObject, void* event )
+void EvasEventHandler::OnEvasObjectMouseDown( void *data, Evas* evas, Evas_Object* evasObject, void* event )
 {
   Evas_Event_Mouse_Down* eventMouseDown = static_cast<Evas_Event_Mouse_Down*>( event );
 
@@ -568,11 +580,11 @@ void EvasPluginEventHandler::OnEvasObjectMouseDown( void *data, Evas* evas, Evas
     timeStamp = GetCurrentMilliSeconds();
   }
 
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
-  pEvasPlugin->OnEvasObjectTouchEvent( point, timeStamp );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
+  eventInterface->OnEvasObjectTouchEvent( point, timeStamp );
 }
 
-void EvasPluginEventHandler::OnEvasObjectMouseUp( void *data, Evas* evas, Evas_Object* evasObject, void* event )
+void EvasEventHandler::OnEvasObjectMouseUp( void *data, Evas* evas, Evas_Object* evasObject, void* event )
 {
   Evas_Event_Mouse_Up* eventMouseUp = static_cast<Evas_Event_Mouse_Up*>( event );
 
@@ -586,11 +598,11 @@ void EvasPluginEventHandler::OnEvasObjectMouseUp( void *data, Evas* evas, Evas_O
     timeStamp = GetCurrentMilliSeconds();
   }
 
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
-  pEvasPlugin->OnEvasObjectTouchEvent( point, timeStamp );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
+  eventInterface->OnEvasObjectTouchEvent( point, timeStamp );
 }
 
-void EvasPluginEventHandler::OnEvasObjectMouseMove( void *data, Evas* evas, Evas_Object* evasObject, void* event )
+void EvasEventHandler::OnEvasObjectMouseMove( void *data, Evas* evas, Evas_Object* evasObject, void* event )
 {
   Evas_Event_Mouse_Move* eventMouseMove = static_cast<Evas_Event_Mouse_Move*>( event );
 
@@ -604,11 +616,11 @@ void EvasPluginEventHandler::OnEvasObjectMouseMove( void *data, Evas* evas, Evas
     timeStamp = GetCurrentMilliSeconds();
   }
 
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
-  pEvasPlugin->OnEvasObjectTouchEvent( point, timeStamp );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
+  eventInterface->OnEvasObjectTouchEvent( point, timeStamp );
 }
 
-void EvasPluginEventHandler::OnEvasObjectMouseWheel( void *data, Evas* evas, Evas_Object* evasObject, void* event )
+void EvasEventHandler::OnEvasObjectMouseWheel( void *data, Evas* evas, Evas_Object* evasObject, void* event )
 {
   Evas_Event_Mouse_Wheel* eventMouseWheel = static_cast<Evas_Event_Mouse_Wheel*>( event );
 
@@ -627,11 +639,11 @@ void EvasPluginEventHandler::OnEvasObjectMouseWheel( void *data, Evas* evas, Eva
 
   Dali::Integration::WheelEvent wheelEvent( Dali::Integration::WheelEvent::MOUSE_WHEEL, direction, modifiers, point, z, timeStamp );
 
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
-  pEvasPlugin->OnEvasObjectWheelEvent( wheelEvent );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
+  eventInterface->OnEvasObjectWheelEvent( wheelEvent );
 }
 
-void EvasPluginEventHandler::OnEvasObjectMultiTouchDown( void *data, Evas* evas, Evas_Object* evasObject, void* event )
+void EvasEventHandler::OnEvasObjectMultiTouchDown( void *data, Evas* evas, Evas_Object* evasObject, void* event )
 {
   Evas_Event_Multi_Down* eventMultiDown = static_cast<Evas_Event_Multi_Down*>( event );
 
@@ -645,11 +657,11 @@ void EvasPluginEventHandler::OnEvasObjectMultiTouchDown( void *data, Evas* evas,
     timeStamp = GetCurrentMilliSeconds();
   }
 
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
-  pEvasPlugin->OnEvasObjectTouchEvent( point, timeStamp );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
+  eventInterface->OnEvasObjectTouchEvent( point, timeStamp );
 }
 
-void EvasPluginEventHandler::OnEvasObjectMultiTouchUp( void *data, Evas* evas, Evas_Object* evasObject, void* event )
+void EvasEventHandler::OnEvasObjectMultiTouchUp( void *data, Evas* evas, Evas_Object* evasObject, void* event )
 {
   Evas_Event_Multi_Up* eventMultiUp = static_cast<Evas_Event_Multi_Up*>( event );
 
@@ -663,11 +675,11 @@ void EvasPluginEventHandler::OnEvasObjectMultiTouchUp( void *data, Evas* evas, E
     timeStamp = GetCurrentMilliSeconds();
   }
 
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
-  pEvasPlugin->OnEvasObjectTouchEvent( point, timeStamp );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
+  eventInterface->OnEvasObjectTouchEvent( point, timeStamp );
 }
 
-void EvasPluginEventHandler::OnEvasObjectMultiTouchMove( void *data, Evas* evas, Evas_Object* evasObject, void* event )
+void EvasEventHandler::OnEvasObjectMultiTouchMove( void *data, Evas* evas, Evas_Object* evasObject, void* event )
 {
   Evas_Event_Multi_Move* eventMultiMove = static_cast<Evas_Event_Multi_Move*>( event );
 
@@ -681,11 +693,11 @@ void EvasPluginEventHandler::OnEvasObjectMultiTouchMove( void *data, Evas* evas,
     timeStamp = GetCurrentMilliSeconds();
   }
 
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
-  pEvasPlugin->OnEvasObjectTouchEvent( point, timeStamp );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
+  eventInterface->OnEvasObjectTouchEvent( point, timeStamp );
 }
 
-void EvasPluginEventHandler::OnEvasObjectKeyDown( void *data, Evas* evas, Evas_Object* evasObject, void* event )
+void EvasEventHandler::OnEvasObjectKeyDown( void *data, Evas* evas, Evas_Object* evasObject, void* event )
 {
   Evas_Event_Key_Down* keyEvent = static_cast<Evas_Event_Key_Down*>( event );
 
@@ -697,10 +709,10 @@ void EvasPluginEventHandler::OnEvasObjectKeyDown( void *data, Evas* evas, Evas_O
   FillIntegrationKeyEvent( keyEvent, integKeyEvent );
 
   // Feed to EvasPlugin
-  ( static_cast<EvasPluginEventInterface*>( data ) )->OnEvasObjectKeyEvent( integKeyEvent );
+  ( static_cast<EvasEventInterface*>( data ) )->OnEvasObjectKeyEvent( integKeyEvent );
 }
 
-void EvasPluginEventHandler::OnEvasObjectKeyUp( void *data, Evas* evas, Evas_Object* evasObject, void* event )
+void EvasEventHandler::OnEvasObjectKeyUp( void *data, Evas* evas, Evas_Object* evasObject, void* event )
 {
   Evas_Event_Key_Up* keyEvent = static_cast<Evas_Event_Key_Up*>( event );
 
@@ -712,56 +724,70 @@ void EvasPluginEventHandler::OnEvasObjectKeyUp( void *data, Evas* evas, Evas_Obj
   FillIntegrationKeyEvent( keyEvent, integKeyEvent );
 
   // Feed to EvasPlugin
-  ( static_cast<EvasPluginEventInterface*>( data ) )->OnEvasObjectKeyEvent( integKeyEvent );
+  ( static_cast<EvasEventInterface*>( data ) )->OnEvasObjectKeyEvent( integKeyEvent );
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 // Geometry callbacks
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 
-void EvasPluginEventHandler::OnEvasObjectMove( void *data, Evas* evas, Evas_Object* evasObject, void* event )
+void EvasEventHandler::OnEvasObjectMove( void *data, Evas* evas, Evas_Object* evasObject, void* event )
 {
   Rect<int> geometry;
   evas_object_geometry_get( evasObject, &geometry.x, &geometry.y, &geometry.width, &geometry.height );
 
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
-  pEvasPlugin->OnEvasObjectMove( geometry );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
+  eventInterface->OnEvasObjectMove( geometry );
 }
 
-void EvasPluginEventHandler::OnEvasObjectResize( void *data, Evas* evas, Evas_Object* evasObject, void* event )
+void EvasEventHandler::OnEvasObjectResize( void *data, Evas* evas, Evas_Object* evasObject, void* event )
 {
   Rect<int> geometry;
   evas_object_geometry_get( evasObject, &geometry.x, &geometry.y, &geometry.width, &geometry.height );
 
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
-  pEvasPlugin->OnEvasObjectResize( geometry );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
+  eventInterface->OnEvasObjectResize( geometry );
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////
+// Visibility callbacks
+/////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void EvasEventHandler::OnEvasObjectShow( void *data, Evas* evas, Evas_Object* evasObject, void* event )
+{
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
+  eventInterface->OnEvasObjectVisiblityChanged( true );
+}
+
+void EvasEventHandler::OnEvasObjectHide( void *data, Evas* evas, Evas_Object* evasObject, void* event )
+{
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
+  eventInterface->OnEvasObjectVisiblityChanged( false );
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 // Focus callbacks
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 
-void EvasPluginEventHandler::OnEvasObjectFocusIn( void *data, Evas* evas, Evas_Object* evasObject, void* event )
+void EvasEventHandler::OnEvasObjectFocusIn( void *data, Evas* evas, Evas_Object* evasObject, void* event )
 {
-  EvasPluginEventHandler* eventHandler = static_cast<EvasPluginEventHandler*>( data );
+  EvasEventHandler* eventHandler = static_cast<EvasEventHandler*>( data );
 
-  eventHandler->EnableEcoreWl2Events();
-  eventHandler->GetEvasPluginInterface().OnEvasObjectFocusIn();
+  eventHandler->GetEvasEventInterface().OnEvasObjectFocusIn();
 }
 
-void EvasPluginEventHandler::OnEvasObjectFocusOut( void *data, Evas* evas, Evas_Object* evasObject, void* event )
+void EvasEventHandler::OnEvasObjectFocusOut( void *data, Evas* evas, Evas_Object* evasObject, void* event )
 {
-  EvasPluginEventHandler* eventHandler = static_cast<EvasPluginEventHandler*>( data );
+  EvasEventHandler* eventHandler = static_cast<EvasEventHandler*>( data );
 
-  eventHandler->DisableEcoreWl2Events();
-  eventHandler->GetEvasPluginInterface().OnEvasObjectFocusOut();
+  eventHandler->GetEvasEventInterface().OnEvasObjectFocusOut();
 }
 
-void EvasPluginEventHandler::OnEvasFocusIn( void *data, Evas* evas, void* event )
+void EvasEventHandler::OnEvasFocusIn( void *data, Evas* evas, void* event )
 {
 }
 
-void EvasPluginEventHandler::OnEvasFocusOut( void *data, Evas* evas, void* event )
+void EvasEventHandler::OnEvasFocusOut( void *data, Evas* evas, void* event )
 {
 }
 
@@ -769,116 +795,116 @@ void EvasPluginEventHandler::OnEvasFocusOut( void *data, Evas* evas, void* event
 // Render callbacks
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 
-void EvasPluginEventHandler::OnEvasRenderPost( void *data, Evas* evas, void* event )
+void EvasEventHandler::OnEvasRenderPost( void *data, Evas* evas, void* event )
 {
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
-  pEvasPlugin->OnEvasPostRender();
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
+  eventInterface->OnEvasPostRender();
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 // Elm Access callbacks
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 
-Eina_Bool EvasPluginEventHandler::OnElmAccessActionHighlight( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
+Eina_Bool EvasEventHandler::OnElmAccessActionHighlight( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
 {
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
   Dali::Extension::Internal::AccessActionInfo daliActionInfo;
   ConvertActionInfo( actionInfo, daliActionInfo );
 
-  return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo );
+  return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo );
 }
 
-Eina_Bool EvasPluginEventHandler::OnElmAccessActionUnhighlight( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
+Eina_Bool EvasEventHandler::OnElmAccessActionUnhighlight( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
 {
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
   Dali::Extension::Internal::AccessActionInfo daliActionInfo;
   ConvertActionInfo( actionInfo, daliActionInfo );
 
-  return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo );
+  return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo );
 }
 
-Eina_Bool EvasPluginEventHandler::OnElmAccessActionHighlightNext( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
+Eina_Bool EvasEventHandler::OnElmAccessActionHighlightNext( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
 {
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
   Dali::Extension::Internal::AccessActionInfo daliActionInfo;
   ConvertActionInfo( actionInfo, daliActionInfo );
 
-  return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo );
+  return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo );
 }
 
-Eina_Bool EvasPluginEventHandler::OnElmAccessActionHighlightPrev( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
+Eina_Bool EvasEventHandler::OnElmAccessActionHighlightPrev( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
 {
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
   Dali::Extension::Internal::AccessActionInfo daliActionInfo;
   ConvertActionInfo( actionInfo, daliActionInfo );
 
-  return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo );
+  return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo );
 }
 
-Eina_Bool EvasPluginEventHandler::OnElmAccessActionActivate( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
+Eina_Bool EvasEventHandler::OnElmAccessActionActivate( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
 {
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
   Dali::Extension::Internal::AccessActionInfo daliActionInfo;
   ConvertActionInfo( actionInfo, daliActionInfo );
 
-  return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo );
+  return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo );
 }
 
-Eina_Bool EvasPluginEventHandler::OnElmAccessActionScroll( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
+Eina_Bool EvasEventHandler::OnElmAccessActionScroll( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
 {
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
   Dali::Extension::Internal::AccessActionInfo daliActionInfo;
   ConvertActionInfo( actionInfo, daliActionInfo );
 
-  return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo );
+  return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo );
 }
 
-Eina_Bool EvasPluginEventHandler::OnElmAccessActionUp( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
+Eina_Bool EvasEventHandler::OnElmAccessActionUp( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
 {
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
   Dali::Extension::Internal::AccessActionInfo daliActionInfo;
   ConvertActionInfo( actionInfo, daliActionInfo );
 
-  return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo );
+  return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo );
 }
 
-Eina_Bool EvasPluginEventHandler::OnElmAccessActionDown( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
+Eina_Bool EvasEventHandler::OnElmAccessActionDown( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
 {
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
   Dali::Extension::Internal::AccessActionInfo daliActionInfo;
   ConvertActionInfo( actionInfo, daliActionInfo );
 
-  return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo );
+  return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo );
 }
 
-Eina_Bool EvasPluginEventHandler::OnElmAccessActionBack( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
+Eina_Bool EvasEventHandler::OnElmAccessActionBack( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
 {
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
   Dali::Extension::Internal::AccessActionInfo daliActionInfo;
   ConvertActionInfo( actionInfo, daliActionInfo );
 
-  return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo );
+  return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo );
 }
 
-Eina_Bool EvasPluginEventHandler::OnElmAccessActionRead( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
+Eina_Bool EvasEventHandler::OnElmAccessActionRead( void* data, Evas_Object* evasObject, Elm_Access_Action_Info* actionInfo )
 {
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
   Dali::Extension::Internal::AccessActionInfo daliActionInfo;
   ConvertActionInfo( actionInfo, daliActionInfo );
 
-  return pEvasPlugin->OnElmAccessibilityActionEvent( daliActionInfo );
+  return eventInterface->OnElmAccessibilityActionEvent( daliActionInfo );
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 // Elm Focus callbacks
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 
-void EvasPluginEventHandler::OnEvasObjectSmartFocused( void *data, Evas_Object* evasObject, void* event )
+void EvasEventHandler::OnEvasObjectSmartFocused( void *data, Evas_Object* evasObject, void* event )
 {
-  EvasPluginEventHandler* eventHandler = static_cast<EvasPluginEventHandler*>( data );
-  EvasPluginEventInterface& evasPlugin = eventHandler->GetEvasPluginInterface();
+  EvasEventHandler* eventHandler = static_cast<EvasEventHandler*>( data );
+  EvasEventInterface& evasPlugin = eventHandler->GetEvasEventInterface();
 
-  if( eventHandler->mEvasPluginEventInterface.GetEvasWrapper()->GetFocusTarget() == evasObject )
+  if( eventHandler->mEvasEventInterface.GetEvasWrapper()->GetFocusTarget() == evasObject )
   {
     Evas_Object* topWidget = elm_object_top_widget_get( evasObject );
 
@@ -893,16 +919,16 @@ void EvasPluginEventHandler::OnEvasObjectSmartFocused( void *data, Evas_Object*
       }
     }
 
-    evas_object_focus_set( eventHandler->mEvasPluginEventInterface.GetEvasWrapper()->GetRenderTarget(), EINA_TRUE );
+    evas_object_focus_set( eventHandler->mEvasEventInterface.GetEvasWrapper()->GetRenderTarget(), EINA_TRUE );
   }
 }
 
-void EvasPluginEventHandler::OnEvasObjectSmartUnfocused( void *data, Evas_Object* evasObject, void* event )
+void EvasEventHandler::OnEvasObjectSmartUnfocused( void *data, Evas_Object* evasObject, void* event )
 {
-  EvasPluginEventHandler* eventHandler = static_cast<EvasPluginEventHandler*>( data );
-  if( eventHandler->mEvasPluginEventInterface.GetEvasWrapper()->GetFocusTarget() == evasObject )
+  EvasEventHandler* eventHandler = static_cast<EvasEventHandler*>( data );
+  if( eventHandler->mEvasEventInterface.GetEvasWrapper()->GetFocusTarget() == evasObject )
   {
-    evas_object_focus_set( eventHandler->mEvasPluginEventInterface.GetEvasWrapper()->GetRenderTarget(), EINA_FALSE );
+    evas_object_focus_set( eventHandler->mEvasEventInterface.GetEvasWrapper()->GetRenderTarget(), EINA_FALSE );
   }
 }
 
@@ -910,14 +936,14 @@ void EvasPluginEventHandler::OnEvasObjectSmartUnfocused( void *data, Evas_Object
 // Ecore Wl2 callbacks
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 
-Eina_Bool EvasPluginEventHandler::OnEcoreWl2EventWindowVisibilityChange( void* data, int type, void* event )
+Eina_Bool EvasEventHandler::OnEcoreWl2EventWindowVisibilityChange( void* data, int type, void* event )
 {
   Ecore_Wl2_Event_Window_Visibility_Change* eventWindowVisibilityChange = static_cast<Ecore_Wl2_Event_Window_Visibility_Change*>( event );
 
-  EvasPluginEventInterface* pEvasPlugin = static_cast<EvasPluginEventInterface*>( data );
+  EvasEventInterface* eventInterface = static_cast<EvasEventInterface*>( data );
 
   // 0 is visible and 1 is invisible
-  pEvasPlugin->OnEcoreWl2VisibilityChange( !eventWindowVisibilityChange->fully_obscured );
+  eventInterface->OnEcoreWl2VisibilityChange( !eventWindowVisibilityChange->fully_obscured );
 
   return ECORE_CALLBACK_PASS_ON;
 }
index 8b12772..7041f49 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_EXTENSION_INTERNAL_EVAS_EVENT_HANDLER__
-#define __DALI_EXTENSION_INTERNAL_EVAS_EVENT_HANDLER__
+#ifndef DALI_EXTENSION_INTERNAL_EVAS_EVENT_HANDLER
+#define DALI_EXTENSION_INTERNAL_EVAS_EVENT_HANDLER
 
 /*
- * Copyright ( c ) 2019 Samsung Electronics Co., Ltd.
+ * Copyright ( c ) 2020 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.
@@ -40,28 +40,28 @@ namespace Extension
 namespace Internal
 {
 
-class EvasPluginEventInterface;
+class EvasEventInterface;
 
-class EvasPluginEventHandler
+class EvasEventHandler
 {
 public:
   /**
    * @brief Constructor
    *
-   * @param[in] evasPluginEventInterface Used to send event to evas plugin
+   * @param[in] evasEventInterface Used to send event to evas plugin
    */
-  EvasPluginEventHandler( EvasPluginEventInterface& evasPluginEventInterface );
+  EvasEventHandler( EvasEventInterface& evasEventInterface );
 
   /**
    * Destructor.
    */
-  ~EvasPluginEventHandler();
+  ~EvasEventHandler();
 
 public:
 
-  EvasPluginEventInterface& GetEvasPluginInterface()
+  EvasEventInterface& GetEvasEventInterface()
   {
-    return mEvasPluginEventInterface;
+    return mEvasEventInterface;
   }
 
 private:
@@ -134,6 +134,20 @@ private:
   static void OnEvasObjectResize( void *data, Evas* evas, Evas_Object* evasObject, void* event );
 
   /////////////////////////////////////////////////////////////////////////////////////////////////////
+  // Visibility callbacks
+  /////////////////////////////////////////////////////////////////////////////////////////////////////
+
+  /**
+   * @brief Called when show is received
+   */
+  static void OnEvasObjectShow( void *data, Evas* evas, Evas_Object* evasObject, void* event );
+
+  /**
+   * @brief Called when hide is received
+   */
+  static void OnEvasObjectHide( void *data, Evas* evas, Evas_Object* evasObject, void* event );
+
+  /////////////////////////////////////////////////////////////////////////////////////////////////////
   // Focus callbacks
   /////////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -206,7 +220,7 @@ private:
 
 private:
 
-  EvasPluginEventInterface&         mEvasPluginEventInterface;
+  EvasEventInterface&               mEvasEventInterface;
   std::vector<Ecore_Event_Handler*> mEcoreEventHandlers;
 };
 
index 9a736d1..1b38999 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_EXTENSION_INTERNAL_EVAS_EVENT_INTERFACE_H__
-#define __DALI_EXTENSION_INTERNAL_EVAS_EVENT_INTERFACE_H__
+#ifndef DALI_EXTENSION_INTERNAL_EVAS_EVENT_INTERFACE_H
+#define DALI_EXTENSION_INTERNAL_EVAS_EVENT_INTERFACE_H
 
 /*
- * Copyright ( c ) 2019 Samsung Electronics Co., Ltd.
+ * Copyright ( c ) 2020 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.
@@ -81,7 +81,7 @@ struct AccessActionInfo
    unsigned int     timeStamp;
 };
 
-class EvasPluginEventInterface
+class EvasEventInterface
 {
 public:
    /**
@@ -128,6 +128,13 @@ public:
   virtual void OnEvasObjectResize( const Rect<int>& geometry ) = 0;
 
   /**
+   * @brief Handle evas object visibility
+   *
+   * @param visible is the visibility information of evas object
+   */
+  virtual void OnEvasObjectVisiblityChanged( bool visible ) = 0;
+
+  /**
    * @brief Handle evas object focus in
    */
   virtual void OnEvasObjectFocusIn() = 0;
@@ -152,9 +159,9 @@ public:
   /**
    * @brief Process the ecore wayland visibility.
    *
-   * @param[in] visibility True is that ecore wayland window is show up and false is not
+   * @param[in] visible True is that ecore wayland window is show up and false is not
    */
-  virtual void OnEcoreWl2VisibilityChange( bool visibility ) = 0;
+  virtual void OnEcoreWl2VisibilityChange( bool visible ) = 0;
 };
 
 }  // namespace Internal
index 1484c9e..91ee2f5 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
  */
 
 // EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/clipboard.h>
-#include <dali/devel-api/adaptor-framework/clipboard-event-notifier.h>
-#include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
 #include <dali/integration-api/adaptor-framework/adaptor.h>
 #include <dali/integration-api/adaptor-framework/native-render-surface.h>
-#include <dali/integration-api/adaptor-framework/native-render-surface-factory.h>
-#include <dali/integration-api/adaptor-framework/trigger-event-factory.h>
-#include <dali/integration-api/debug.h>
-#include <dali/public-api/common/stage.h>
-#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
-#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
 
 // INTERNAL INCLUDES
-#include <dali-extension/internal/evas-plugin/evas-wrapper.h>
-#include <dali-extension/internal/evas-plugin/evas-event-handler.h>
+#include <dali-extension/internal/evas-plugin/scene-impl.h>
 
 // CLASS HEADER
 #include <dali-extension/internal/evas-plugin/evas-plugin-impl.h>
@@ -44,86 +34,60 @@ namespace Extension
 namespace Internal
 {
 
-// Initialize static members
-
-Adaptor* EvasPlugin::mAdaptor = nullptr;
-
-uint32_t EvasPlugin::mEvasPluginCount = 0;
-
-IntrusivePtr< EvasPlugin > EvasPlugin::New( Evas_Object* parentEvasObject, int width, int height, bool isTranslucent )
+IntrusivePtr< EvasPlugin > EvasPlugin::New( Evas_Object* parentEvasObject, uint16_t width, uint16_t height, bool isTranslucent )
 {
   IntrusivePtr< EvasPlugin > evasPlugin = new EvasPlugin( parentEvasObject, width, height, isTranslucent );
   return evasPlugin;
 }
 
-EvasPlugin::EvasPlugin( Evas_Object* parentEvasObject, int width, int height, bool isTranslucent )
-: mEvasWrapper( new EvasWrapper( parentEvasObject, width, height, isTranslucent ) ),
-  mRenderNotification(),
-  mEvasPluginEventHandler(),
-  mState( READY ),
-  mIsFocus( false ),
-  mIsTranslucent( isTranslucent )
+EvasPlugin::EvasPlugin( Evas_Object* parentEvasObject, uint16_t width, uint16_t height, bool isTranslucent )
+: mState( READY )
 {
-  DALI_ASSERT_ALWAYS( parentEvasObject && "No parent object for the evas plugin." );
+  DALI_ASSERT_ALWAYS( parentEvasObject && "No parent object for the EvasPlugin." );
 
-  // Increase plugin count.
-  mEvasPluginCount++;
+  // Generate a default scene
+  IntrusivePtr< Internal::Scene > scenePtr = Internal::Scene::New( parentEvasObject, width, height, isTranslucent );
 
-  // Create surface
-  mSurface = std::unique_ptr< RenderSurfaceInterface >( CreateNativeSurface( PositionSize( 0, 0, width, height ), isTranslucent ) );
-}
+  mDefaultScene = Extension::Scene( scenePtr.Get() );
 
-void EvasPlugin::Initialize()
-{
-  NativeRenderSurface* surface =  static_cast<NativeRenderSurface*>( mSurface.get() );
-
-  Dali::Integration::SceneHolder sceneHolderHandler = Dali::Extension::EvasPlugin( this );
+  // Generate DALi adaptor
+  NativeRenderSurface* surface = static_cast<NativeRenderSurface*>( scenePtr->GetSurface() );
 
-  if( !mAdaptor )
-  {
-    // Create an adaptor or add new scene holder to the adaptor
-    mAdaptor = &Adaptor::New( sceneHolderHandler, *surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
-  }
-  else
-  {
-    mAdaptor->AddWindow( sceneHolderHandler, "", "", mIsTranslucent );
-  }
+  mAdaptor = &Adaptor::New( Dali::Integration::SceneHolder( scenePtr.Get() ), *surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
 
-  // Connect callback to be notified when the surface is rendered
-  TriggerEventFactory triggerEventFactory;
+  // Initialize default scene
+  scenePtr->Initialize( this, true );
 
-  mRenderNotification = std::unique_ptr< TriggerEventInterface >( triggerEventFactory.CreateTriggerEvent( MakeCallback( this, &EvasPlugin::OnPostRender ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER ) );
+  scenePtr->ResizedSignal().Connect( this, &EvasPlugin::OnDefaultSceneResized );
 
-  surface->SetRenderNotification( mRenderNotification.get() );
+  scenePtr->FocusChangedSignal().Connect( this, &EvasPlugin::OnDefaultSceneFocusChanged );
 }
 
 EvasPlugin::~EvasPlugin()
 {
-  mEvasPluginCount--;
+  delete mAdaptor;
+  mAdaptor = nullptr;
+}
 
-  if( !mEvasPluginCount )
-  {
-    delete mAdaptor;
-  }
+Adaptor* EvasPlugin::GetAdaptor()
+{
+  return mAdaptor;
 }
 
 void EvasPlugin::Run()
 {
   if( READY == mState )
   {
-    if( !mEvasPluginEventHandler )
-    {
-      mEvasPluginEventHandler = std::unique_ptr< EvasPluginEventHandler >( new EvasPluginEventHandler( *this ) );
-    }
-
     // Start the adaptor
     mAdaptor->Start();
 
+    mState = RUNNING;
+
+    mPreInitSignal.Emit();
+
     mInitSignal.Emit();
 
     mAdaptor->NotifySceneCreated();
-
-    mState = RUNNING;
   }
 }
 
@@ -133,7 +97,7 @@ void EvasPlugin::Pause()
   {
     mState = SUSPENDED;
 
-    Hide();
+    mAdaptor->Pause();
 
     mPauseSignal.Emit();
   }
@@ -143,7 +107,7 @@ void EvasPlugin::Resume()
 {
   if( mState == SUSPENDED )
   {
-    Show();
+    mAdaptor->Resume();
 
     mResumeSignal.Emit();
 
@@ -163,297 +127,35 @@ void EvasPlugin::Stop()
   }
 }
 
-Dali::Any EvasPlugin::GetNativeHandle() const
+Extension::Scene EvasPlugin::GetDefaultScene()
 {
-  return mEvasWrapper->GetNativeWindow();
-}
-
-NativeRenderSurface* EvasPlugin::GetNativeRenderSurface() const
-{
-  return dynamic_cast< NativeRenderSurface* >( mSurface.get() );
+  return mDefaultScene;
 }
 
 Evas_Object* EvasPlugin::GetAccessEvasObject()
 {
-  return mEvasWrapper->GetAccessibilityTarget();
+  return mDefaultScene.GetAccessEvasObject();
 }
 
 Evas_Object* EvasPlugin::GetDaliEvasObject()
 {
-  return mEvasWrapper->GetFocusTarget();
+  return mDefaultScene.GetDaliEvasObject();
 }
 
-void EvasPlugin::ResizeSurface( int width, int height )
+void EvasPlugin::OnDefaultSceneResized( Extension::Scene defaultScene, uint16_t width, uint16_t height )
 {
-  if( !mSurface || !mAdaptor || width <= 1 || height <= 1 )
-  {
-    return;
-  }
-
-  PositionSize currentSize = mSurface->GetPositionSize();
-  if( currentSize.width == width && currentSize.height == height )
-  {
-    return;
-  }
-
-  mSurface->MoveResize( PositionSize( 0, 0, width, height ) );
-
-  SurfaceResized();
-
-  Adaptor::SurfaceSize newSize( width, height );
-
-  // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
-  mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
-
   mResizeSignal.Emit();
-
-  mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
-}
-
-void EvasPlugin::OnPostRender()
-{
-  // Bind offscreen surface to the evas object
-  NativeRenderSurface* surface = GetNativeRenderSurface();
-
-  DALI_ASSERT_DEBUG( surface && "Surface is null in EvasPlugin" );
-
-  tbm_surface_h tbmSurface = AnyCast<tbm_surface_h>( surface->GetDrawable() );
-
-  if( !tbmSurface )
-  {
-    return;
-  }
-
-  mEvasWrapper->BindTBMSurface( tbmSurface );
-
-  mEvasWrapper->RequestRender();
-
-  surface->ReleaseLock();
-}
-
-EvasWrapper* EvasPlugin::GetEvasWrapper() const
-{
-  return mEvasWrapper.get();
-}
-
-void EvasPlugin::OnEvasObjectTouchEvent( Dali::Integration::Point& touchPoint, unsigned long timeStamp )
-{
-  FeedTouchPoint( touchPoint, timeStamp );
-}
-
-void EvasPlugin::OnEvasObjectWheelEvent( Dali::Integration::WheelEvent& wheelEvent )
-{
-  FeedWheelEvent( wheelEvent );
 }
 
-void EvasPlugin::OnEvasObjectKeyEvent( Dali::Integration::KeyEvent& keyEvent )
+void EvasPlugin::OnDefaultSceneFocusChanged( Extension::Scene defaultScene, bool focused )
 {
-  FeedKeyEvent( keyEvent );
-}
-
-void EvasPlugin::OnEvasObjectMove( const Rect<int>& geometry )
-{
-}
-
-void EvasPlugin::OnEvasObjectResize( const Rect<int>& geometry )
-{
-  ResizeSurface( geometry.width, geometry.height );
-}
-
-void EvasPlugin::OnEvasObjectFocusIn()
-{
-  if( !mIsFocus )
+  if( focused )
   {
     mFocusedSignal.Emit();
-
-    mIsFocus = true;
-  }
-}
-
-void EvasPlugin::OnEvasObjectFocusOut()
-{
-  if( mIsFocus )
-  {
-    mIsFocus = false;
-
-    Toolkit::KeyInputFocusManager focusManager = Toolkit::KeyInputFocusManager::Get();
-    Toolkit::Control currentFocused = focusManager.GetCurrentFocusControl();
-    if( currentFocused )
-    {
-      focusManager.RemoveFocus( currentFocused );
-    }
-
-    Clipboard::Get().HideClipboard();
-
-    mUnFocusedSignal.Emit();
-  }
-}
-
-void EvasPlugin::OnEvasPostRender()
-{
-}
-
-bool EvasPlugin::OnElmAccessibilityActionEvent( AccessActionInfo& accessActionInfo )
-{
-  bool ret = false;
-
-  if( mAdaptor == nullptr )
-  {
-    return ret;
-  }
-
-  Dali::AccessibilityAdaptor accessibilityAdaptor = Dali::AccessibilityAdaptor::Get();
-  if( accessibilityAdaptor )
-  {
-    switch( accessActionInfo.actionBy )
-    {
-      case Dali::Extension::Internal::ACCESS_ACTION_HIGHLIGHT:
-      case Dali::Extension::Internal::ACCESS_ACTION_READ:
-      {
-        ret = accessibilityAdaptor.HandleActionReadEvent( (unsigned int)accessActionInfo.x, (unsigned int)accessActionInfo.y, true );
-      }
-      break;
-
-      case Dali::Extension::Internal::ACCESS_ACTION_HIGHLIGHT_PREV:
-      {
-        // if accessActionInfo.highlight_end is true, need to handle end_of_list sound feedback
-        ret = accessibilityAdaptor.HandleActionPreviousEvent( accessActionInfo.highlightCycle );
-        if(!ret)
-        {
-          // when focus moving was failed, clear the focus
-          accessibilityAdaptor.HandleActionClearFocusEvent();
-        }
-      }
-      break;
-
-      case Dali::Extension::Internal::ACCESS_ACTION_HIGHLIGHT_NEXT:
-      {
-        // if accessActionInfo.highlight_cycle is true, need to handle end_of_list sound feedback
-        ret = accessibilityAdaptor.HandleActionNextEvent( accessActionInfo.highlightCycle );
-        if(!ret)
-        {
-          // when focus moving was failed, clear the focus
-          accessibilityAdaptor.HandleActionClearFocusEvent();
-        }
-      }
-      break;
-
-      case Dali::Extension::Internal::ACCESS_ACTION_ACTIVATE:
-      {
-        ret = accessibilityAdaptor.HandleActionActivateEvent();
-      }
-      break;
-
-      case Dali::Extension::Internal::ACCESS_ACTION_UNHIGHLIGHT:
-      {
-        ret = accessibilityAdaptor.HandleActionClearFocusEvent();
-      }
-      break;
-
-      case Dali::Extension::Internal::ACCESS_ACTION_SCROLL:
-      {
-        Evas_Object* eo = mEvasWrapper->GetAccessibilityTarget();
-
-        if( eo )
-        {
-          int touchType = accessActionInfo.mouseType;
-
-          TouchPoint::State state( TouchPoint::Down );
-
-          if( touchType == 0 )
-          {
-            state = TouchPoint::Down; // mouse down
-          }
-          else if( touchType == 1 )
-          {
-            state = TouchPoint::Motion; // mouse move
-          }
-          else if( touchType == 2 )
-          {
-            state = TouchPoint::Up; // mouse up
-          }
-          else
-          {
-            state = TouchPoint::Interrupted; // error
-          }
-
-          // Send touch event to accessibility manager.
-          Evas_Coord rel_x, rel_y, obj_x,  obj_y, obj_w, obj_h;
-
-          evas_object_geometry_get( eo, &obj_x,  &obj_y, &obj_w, &obj_h );
-
-          rel_x = accessActionInfo.x - obj_x;
-          rel_y = accessActionInfo.y - obj_y;
-
-          TouchPoint point( 0, state, (float)rel_x, (float)rel_y );
-
-          ret = accessibilityAdaptor.HandleActionScrollEvent( point, accessActionInfo.timeStamp );
-        }
-      }
-      break;
-
-      case Dali::Extension::Internal::ACCESS_ACTION_UP:
-      {
-        ret = accessibilityAdaptor.HandleActionUpEvent();
-      }
-      break;
-
-      case Dali::Extension::Internal::ACCESS_ACTION_DOWN:
-      {
-        ret = accessibilityAdaptor.HandleActionDownEvent();
-      }
-      break;
-
-      case Dali::Extension::Internal::ACCESS_ACTION_BACK:
-      default:
-      {
-        DALI_LOG_WARNING( "[%s:%d]\n", __FUNCTION__, __LINE__ );
-      }
-
-      break;
-    }
-  }
-  else
-  {
-    DALI_LOG_WARNING( "[%s:%d]\n", __FUNCTION__, __LINE__ );
-  }
-
-  return ret;
-}
-
-void EvasPlugin::OnEcoreWl2VisibilityChange( bool visibility )
-{
-  DALI_LOG_RELEASE_INFO( "EvasPlugin::OnEcoreWl2VisibilityChange( %s )", visibility ? "T" : "F" );
-
-  if( visibility )
-  {
-    Show();
   }
   else
   {
-    Hide();
-
-    mAdaptor->ReleaseSurfaceLock();
-  }
-}
-
-void EvasPlugin::Show()
-{
-  if( !mVisible )
-  {
-    mVisible = true;
-
-    mAdaptor->OnWindowShown();
-  }
-}
-
-void EvasPlugin::Hide()
-{
-  if( mVisible )
-  {
-    mVisible = false;
-
-    mAdaptor->OnWindowHidden();
+    mUnFocusedSignal.Emit();
   }
 }
 
index 78da4e3..7cc0f31 100755 (executable)
@@ -1,5 +1,5 @@
-#ifndef __DALI_EXTENSION_INTERNAL_EVAS_PLUGIN_H__
-#define __DALI_EXTENSION_INTERNAL_EVAS_PLUGIN_H__
+#ifndef DALI_EXTENSION_INTERNAL_EVAS_PLUGIN_H
+#define DALI_EXTENSION_INTERNAL_EVAS_PLUGIN_H
 
 /*
  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
 
 #include <dali/integration-api/adaptor-framework/scene-holder-impl.h>
 #include <dali/public-api/common/intrusive-ptr.h>
-#include <dali/public-api/math/rect.h>
+#include <dali/public-api/object/base-object.h>
 #include <dali/public-api/signals/connection-tracker.h>
 
 // INTERNAL INCLUDES
-#include <dali-extension/internal/evas-plugin/evas-event-interface.h>
 #include <dali-extension/devel-api/evas-plugin/evas-plugin.h>
+#include <dali-extension/devel-api/evas-plugin/scene.h>
 
 namespace Dali
 {
 class Adaptor;
-class NativeRenderSurface;
-class TriggerEventInterface;
 
 namespace Extension
 {
@@ -43,15 +41,11 @@ namespace Extension
 namespace Internal
 {
 
-class EvasPluginEventHandler;
-class EvasWrapper;
-
 /**
  * Implementation of the EvasPlugin class.
  */
-class EvasPlugin : public Dali::Internal::Adaptor::SceneHolder,
-                   public ConnectionTracker,
-                   public Extension::Internal::EvasPluginEventInterface
+class EvasPlugin : public BaseObject,
+                   public ConnectionTracker
 {
 public:
 
@@ -64,7 +58,7 @@ public:
    * @param[in] height The height of Dali view port
    * @param[in] isTranslucent Whether the evas object is translucent or not
    */
-  static IntrusivePtr<EvasPlugin> New( Evas_Object* parentEvasObject, int width, int height, bool isTranslucent );
+  static IntrusivePtr<EvasPlugin> New( Evas_Object* parentEvasObject, uint16_t width, uint16_t height, bool isTranslucent );
 
 public:
 
@@ -89,17 +83,9 @@ public:
   void Stop();
 
   /**
-   * @brief Gets the native handle.
-   * @note When users call this function, it wraps the actual type used by the underlying system.
-   * @return The native handle or an empty handle
+   * @copydoc Dali::Extension::EvasPlugin::GetDefaultScene()
    */
-  Dali::Any GetNativeHandle() const override;
-
-  /**
-   * @brief Get the native render surface
-   * @return The render surface
-   */
-  NativeRenderSurface* GetNativeRenderSurface() const;
+  Extension::Scene GetDefaultScene();
 
   /**
    * @copydoc Dali::Extension::EvasPlugin::GetAccessEvasObject()
@@ -167,89 +153,41 @@ public:
     return mUnFocusedSignal;
   }
 
-  /*
-   * @bried Initialize EvasPlugin
-   */
-  void Initialize();
-
-private:
-
-  /**
-   * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::GetEvasWrapper
-   */
-  EvasWrapper* GetEvasWrapper() const override;
-
-  /**
-   * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEvasObjectTouchEvent
-   */
-  void OnEvasObjectTouchEvent( Dali::Integration::Point& touchPoint, unsigned long timeStamp ) override;
-
-  /**
-   * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEvasObjectWheelEvent
-   */
-  void OnEvasObjectWheelEvent( Dali::Integration::WheelEvent& wheelEvent ) override;
-
-  /**
-   * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEvasObjectKeyEvent
-   */
-  void OnEvasObjectKeyEvent( Dali::Integration::KeyEvent& keyEvent ) override;
-
-  /**
-   * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEvasObjectMove
-   */
-  void OnEvasObjectMove( const Rect<int>& geometry ) override;
-
-  /**
-   * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEvasObjectResize
-   */
-  void OnEvasObjectResize( const Rect<int>& geometry ) override;
-
-  /**
-   * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEvasObjectFocusIn
-   */
-  void OnEvasObjectFocusIn() override;
-
-  /**
-   * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEvasObjectFocusOut
-   */
-  void OnEvasObjectFocusOut() override;
-
-  /**
-   * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEvasRenderPost
-   */
-  void OnEvasPostRender() override;
-
-  /**
-   * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnElmAccessibilityActionEvent
-   */
-  bool OnElmAccessibilityActionEvent( AccessActionInfo& actionInfo ) override;
-
+public:
   /**
-   * @copydoc Dali::Extension::Internal::EvasPluginEventInterface::OnEcoreWl2VisibilityChange
+   * All methods here are for the internal use
    */
-  void OnEcoreWl2VisibilityChange( bool visibility ) override;
 
-  /**
-   * @brief Resize the surface
-   * @param[in] width The width value
-   * @param[in] height The height value
-   */
-  void ResizeSurface( int width, int height );
+  enum State
+  {
+    READY,
+    RUNNING,
+    SUSPENDED,
+    STOPPED,
+  };
 
   /**
-   * This function is called after drawing by dali.
+   * @brief This is for internal use to get notified before InitSignal() emits
    */
-  void OnPostRender();
+  EvasPluginSignalType& PreInitSignal()
+  {
+    return mPreInitSignal;
+  }
 
   /**
-   * @brief Shows the EvasPlugin if it is hidden.
+   * @brief Get EvasPlugin's current state
+   *
+   * @return The state
    */
-  void Show();
+  const State GetState() const
+  {
+    return mState;
+  }
 
-  /**
-   * @brief Hides the EvasPlugin if it is showing.
+  /*
+   * @bried Get currently working Adaptor. It can be null.
    */
-  void Hide();
+  Adaptor* GetAdaptor();
 
 private:
   /**
@@ -259,7 +197,7 @@ private:
    * @param[in] height The height of Dali view port
    * @param[in] isTranslucent Whether the evas object is translucent or not
    */
-  EvasPlugin( Evas_Object* parentEvasObject, int width, int height, bool isTranslucent );
+  EvasPlugin( Evas_Object* parentEvasObject, uint16_t width, uint16_t height, bool isTranslucent );
 
   /**
    * Destructor
@@ -270,39 +208,36 @@ private:
   EvasPlugin( const EvasPlugin& );
   EvasPlugin& operator=( EvasPlugin& );
 
-private:
+  /**
+   * This callback is for supporting legacy API EvasPlugin::ResizeSignal
+   */
+  void OnDefaultSceneResized( Extension::Scene defaultScene, uint16_t width, uint16_t height );
 
-  enum State
-  {
-    READY,
-    RUNNING,
-    SUSPENDED,
-    STOPPED,
-  };
+  /**
+   * This callback is for supporting legacy API EvasPlugin::FocusedSignal, EvasPlugin::UnFocusedSignal
+   */
+  void OnDefaultSceneFocusChanged( Extension::Scene defaultScene, bool focused );
 
-  static Adaptor*                           mAdaptor;
-  static uint32_t                           mEvasPluginCount;
+private:
 
-  std::unique_ptr< EvasWrapper >            mEvasWrapper;
-  std::unique_ptr< TriggerEventInterface >  mRenderNotification;
-  std::unique_ptr< EvasPluginEventHandler > mEvasPluginEventHandler;
+  Adaptor*                                  mAdaptor;
+  Extension::Scene                          mDefaultScene;
 
+  EvasPluginSignalType                      mPreInitSignal;
   EvasPluginSignalType                      mInitSignal;
   EvasPluginSignalType                      mTerminateSignal;
   EvasPluginSignalType                      mPauseSignal;
   EvasPluginSignalType                      mResumeSignal;
-  EvasPluginSignalType                      mResizeSignal;
-  EvasPluginSignalType                      mFocusedSignal;
-  EvasPluginSignalType                      mUnFocusedSignal;
+  EvasPluginSignalType                      mResizeSignal;    // Connect to DefaultScene.ResizedSignal
+  EvasPluginSignalType                      mFocusedSignal;   // Connect to DefaultScene.FocusChangedSignal
+  EvasPluginSignalType                      mUnFocusedSignal; // Connect to DefaultScene.FocusChangedSignal
 
   State                                     mState;
-  bool                                      mIsFocus;
-  bool                                      mIsTranslucent;
 };
 
 inline EvasPlugin& GetImplementation( Extension::EvasPlugin& evasPlugin )
 {
-  DALI_ASSERT_ALWAYS( evasPlugin && "evasPluing handle is empty" );
+  DALI_ASSERT_ALWAYS( evasPlugin && "EvasPlugin handle is empty" );
 
   BaseObject& handle = evasPlugin.GetBaseObject();
 
@@ -311,7 +246,7 @@ inline EvasPlugin& GetImplementation( Extension::EvasPlugin& evasPlugin )
 
 inline const EvasPlugin& GetImplementation( const Extension::EvasPlugin& evasPlugin )
 {
-  DALI_ASSERT_ALWAYS( evasPlugin && "evasPlugin handle is empty" );
+  DALI_ASSERT_ALWAYS( evasPlugin && "EvasPlugin handle is empty" );
 
   const BaseObject& handle = evasPlugin.GetBaseObject();
 
@@ -324,4 +259,4 @@ inline const EvasPlugin& GetImplementation( const Extension::EvasPlugin& evasPlu
 
 } // namespace Dali
 
-#endif // __DALI_EXTENSION_INTERNAL_EVAS_PLUGIN_H__
+#endif // DALI_EXTENSION_INTERNAL_EVAS_PLUGIN_H
index ef216ce..7ab1d94 100644 (file)
@@ -41,21 +41,23 @@ const char* ELM_OBJECT_CONTAINER_PART_NAME = "elm.swallow.content";
 
 } // unnamed namespace
 
-EvasWrapper::EvasWrapper( Evas_Object* pluginParent, int width, int height, bool transparent )
+EvasWrapper::EvasWrapper( Evas_Object* pluginParent, uint16_t width, uint16_t height, bool transparent )
 : mEcoreEvas( nullptr ),
   mImageEvasObject( nullptr ),
   mAccessibilityEvasObject( nullptr ),
   mFocusEvasObject( nullptr )
 {
+  int intWidth = static_cast<int>( width );
+  int intHeight = static_cast<int>( height );
+
   Evas* evas = evas_object_evas_get( pluginParent );
   mEcoreEvas = ecore_evas_ecore_evas_get( evas );
 
   // Create the image evas object
   mImageEvasObject = evas_object_image_filled_add( evas );
   evas_object_name_set( mImageEvasObject, IMAGE_EVAS_OBJECT_NAME );
-  evas_object_image_content_hint_set( mImageEvasObject, EVAS_IMAGE_CONTENT_HINT_DYNAMIC );
   evas_object_image_alpha_set( mImageEvasObject, transparent ? EINA_TRUE : EINA_FALSE );
-  evas_object_image_size_set( mImageEvasObject, width, height );
+  evas_object_image_size_set( mImageEvasObject, intWidth, intHeight );
   evas_object_size_hint_weight_set( mImageEvasObject, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND );
   evas_object_size_hint_align_set( mImageEvasObject, EVAS_HINT_FILL, EVAS_HINT_FILL );
 
@@ -77,7 +79,7 @@ EvasWrapper::EvasWrapper( Evas_Object* pluginParent, int width, int height, bool
   evas_object_size_hint_align_set( mFocusEvasObject, EVAS_HINT_FILL, EVAS_HINT_FILL );
 
   evas_object_move( mFocusEvasObject, 0, 0 );
-  evas_object_resize( mFocusEvasObject, width, height );
+  evas_object_resize( mFocusEvasObject, intWidth, intHeight );
   evas_object_show( mFocusEvasObject );
 }
 
index 0728602..a853772 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __DALI_EXTENSION_INTERNAL_EVAS_WRAPPER__
-#define __DALI_EXTENSION_INTERNAL_EVAS_WRAPPER__
+#ifndef DALI_EXTENSION_INTERNAL_EVAS_WRAPPER
+#define DALI_EXTENSION_INTERNAL_EVAS_WRAPPER
 
 /*
  * Copyright ( c ) 2019 Samsung Electronics Co., Ltd.
@@ -56,7 +56,7 @@ public:
    * @param[in] height The initial height of the Dali view port
    * @param[in] transparent Whether the Evas object is transparent or not
    */
-  EvasWrapper( Evas_Object* pluginParent, int width, int height, bool transparent );
+  EvasWrapper( Evas_Object* pluginParent, uint16_t width, uint16_t height, bool transparent );
 
   /**
    * @brief Destructor
@@ -122,4 +122,4 @@ private:
 
 }  // namespace Dali
 
-#endif // __DALI_EXTENSION_INTERNAL_EVAS_WRAPPER__
+#endif // DALI_EXTENSION_INTERNAL_EVAS_WRAPPER
index d94bbca..1330896 100644 (file)
@@ -2,9 +2,11 @@ evas_plugin_internal_header_files = \
    $(extension_src_dir)/internal/evas-plugin/evas-event-handler.h \
    $(extension_src_dir)/internal/evas-plugin/evas-event-interface.h \
    $(extension_src_dir)/internal/evas-plugin/evas-plugin-impl.h \
-   $(extension_src_dir)/internal/evas-plugin/evas-wrapper.h
+   $(extension_src_dir)/internal/evas-plugin/evas-wrapper.h \
+   $(extension_src_dir)/internal/evas-plugin/scene-impl.h
 
 evas_plugin_internal_src_files = \
    $(extension_src_dir)/internal/evas-plugin/evas-event-handler.cpp \
    $(extension_src_dir)/internal/evas-plugin/evas-plugin-impl.cpp \
-   $(extension_src_dir)/internal/evas-plugin/evas-wrapper.cpp
+   $(extension_src_dir)/internal/evas-plugin/evas-wrapper.cpp \
+   $(extension_src_dir)/internal/evas-plugin/scene-impl.cpp
diff --git a/dali-extension/internal/evas-plugin/scene-impl.cpp b/dali-extension/internal/evas-plugin/scene-impl.cpp
new file mode 100644 (file)
index 0000000..bf2746d
--- /dev/null
@@ -0,0 +1,451 @@
+/*
+ * Copyright (c) 2020 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
+#include <dali/devel-api/adaptor-framework/clipboard.h>
+#include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
+#include <dali/integration-api/adaptor-framework/adaptor.h>
+#include <dali/integration-api/adaptor-framework/native-render-surface.h>
+#include <dali/integration-api/adaptor-framework/native-render-surface-factory.h>
+#include <dali/integration-api/adaptor-framework/trigger-event-factory.h>
+#include <dali/integration-api/debug.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
+#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
+
+// INTERNAL INCLUDES
+#include <dali-extension/internal/evas-plugin/evas-event-handler.h>
+#include <dali-extension/internal/evas-plugin/evas-plugin-impl.h>
+#include <dali-extension/internal/evas-plugin/evas-wrapper.h>
+
+// CLASS HEADER
+#include <dali-extension/internal/evas-plugin/scene-impl.h>
+
+namespace Dali
+{
+
+namespace Extension
+{
+
+namespace Internal
+{
+
+IntrusivePtr< Scene > Scene::New( Evas_Object* parentEvasObject, uint16_t width, uint16_t height, bool isTranslucent )
+{
+  IntrusivePtr< Scene > scene = new Scene( parentEvasObject, width, height, isTranslucent );
+  return scene;
+}
+
+Scene::Scene( Evas_Object* parentEvasObject, uint16_t width, uint16_t height, bool isTranslucent )
+: mAdaptor( nullptr ),
+  mEvasWrapper( new EvasWrapper( parentEvasObject, width, height, isTranslucent ) ),
+  mEvasEventHandler(),
+  mRenderNotification(),
+  mIsFocus( false ),
+  mIsTranslucent( isTranslucent )
+{
+  DALI_ASSERT_ALWAYS( parentEvasObject && "No parent object for the scene" );
+
+  // Create surface
+  mSurface = std::unique_ptr< RenderSurfaceInterface >( CreateNativeSurface( PositionSize( 0, 0, static_cast<int>( width ), static_cast<int>( height ) ), isTranslucent ) );
+}
+
+void Scene::Initialize( EvasPlugin* evasPlugin, bool isDefaultScene )
+{
+  mAdaptor = evasPlugin->GetAdaptor();
+
+  DALI_ASSERT_ALWAYS( mAdaptor && "Scene can not be created when the Adaptor is null" );
+
+  if( isDefaultScene )
+  {
+    Initialize();
+    return;
+  }
+
+  if( evasPlugin->GetState() != EvasPlugin::RUNNING )
+  {
+    evasPlugin->PreInitSignal().Connect( this, &Scene::OnPreInitEvasPlugin );
+
+    return;
+  }
+
+  Dali::Integration::SceneHolder sceneHolderHandler = Dali::Integration::SceneHolder( this );
+  mAdaptor->AddWindow( sceneHolderHandler, "", "", mIsTranslucent );
+
+  Initialize();
+}
+
+void Scene::Initialize()
+{
+  // Connect callback to be notified when the surface is rendered
+  TriggerEventFactory triggerEventFactory;
+
+  mRenderNotification = std::unique_ptr< TriggerEventInterface >( triggerEventFactory.CreateTriggerEvent( MakeCallback( this, &Scene::OnPostRender ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER ) );
+
+  NativeRenderSurface* surface = GetNativeRenderSurface();
+
+  surface->SetRenderNotification( mRenderNotification.get() );
+
+  if( !mEvasEventHandler )
+  {
+    mEvasEventHandler = std::unique_ptr< EvasEventHandler >( new EvasEventHandler( *this ) );
+  }
+}
+
+void Scene::OnPreInitEvasPlugin()
+{
+  Dali::Integration::SceneHolder sceneHolderHandler = Dali::Integration::SceneHolder( this );
+  mAdaptor->AddWindow( sceneHolderHandler, "", "", mIsTranslucent );
+
+  Initialize();
+}
+
+Scene::~Scene()
+{
+  // To prevent notification triggering in NativeRenderSurface::PostRender while deleting SceneHolder
+  GetNativeRenderSurface()->SetRenderNotification( nullptr );
+}
+
+uint32_t Scene::GetLayerCount() const
+{
+  return mScene.GetLayerCount();
+}
+
+Layer Scene::GetLayer( uint32_t depth ) const
+{
+  return mScene.GetLayer( depth );
+}
+
+Scene::SceneSize Scene::GetSize() const
+{
+  Size size = mScene.GetSize();
+
+  return Scene::SceneSize( static_cast<uint16_t>( size.width ), static_cast<uint16_t>( size.height ) );
+}
+
+Dali::Any Scene::GetNativeHandle() const
+{
+  return mEvasWrapper->GetNativeWindow();
+}
+
+NativeRenderSurface* Scene::GetNativeRenderSurface() const
+{
+  return dynamic_cast< NativeRenderSurface* >( mSurface.get() );
+}
+
+Evas_Object* Scene::GetAccessEvasObject()
+{
+  return mEvasWrapper->GetAccessibilityTarget();
+}
+
+Evas_Object* Scene::GetDaliEvasObject()
+{
+  return mEvasWrapper->GetFocusTarget();
+}
+
+void Scene::ResizeSurface( uint16_t width, uint16_t height )
+{
+  if( !mSurface || !mAdaptor || width <= 1 || height <= 1 )
+  {
+    return;
+  }
+
+  int intWidth = static_cast<int>( width );
+  int intHeight = static_cast<int>( height );
+
+  PositionSize currentSize = mSurface->GetPositionSize();
+  if( currentSize.width == intWidth && currentSize.height == intHeight )
+  {
+    return;
+  }
+
+  mSurface->MoveResize( PositionSize( 0, 0, intWidth, intHeight ) );
+
+  SurfaceResized();
+
+  Adaptor::SurfaceSize newSize( width, height );
+
+  // When surface size is updated, inform adaptor of resizing and emit ResizedSignal
+  mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
+
+  mResizedSignal.Emit( Extension::Scene( this ), width, height );
+
+  mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
+}
+
+void Scene::OnPostRender()
+{
+  // Bind offscreen surface to the evas object
+  NativeRenderSurface* surface = GetNativeRenderSurface();
+
+  DALI_ASSERT_DEBUG( surface && "Surface is null in the Scene" );
+
+  tbm_surface_h tbmSurface = AnyCast<tbm_surface_h>( surface->GetDrawable() );
+
+  if( !tbmSurface )
+  {
+    return;
+  }
+
+  mEvasWrapper->BindTBMSurface( tbmSurface );
+
+  mEvasWrapper->RequestRender();
+
+  surface->ReleaseLock();
+}
+
+EvasWrapper* Scene::GetEvasWrapper() const
+{
+  return mEvasWrapper.get();
+}
+
+void Scene::OnEvasObjectTouchEvent( Dali::Integration::Point& touchPoint, unsigned long timeStamp )
+{
+  FeedTouchPoint( touchPoint, timeStamp );
+}
+
+void Scene::OnEvasObjectWheelEvent( Dali::Integration::WheelEvent& wheelEvent )
+{
+  FeedWheelEvent( wheelEvent );
+}
+
+void Scene::OnEvasObjectKeyEvent( Dali::Integration::KeyEvent& keyEvent )
+{
+  FeedKeyEvent( keyEvent );
+}
+
+void Scene::OnEvasObjectMove( const Rect<int>& geometry )
+{
+}
+
+void Scene::OnEvasObjectResize( const Rect<int>& geometry )
+{
+  ResizeSurface( static_cast<uint16_t>( geometry.width ), static_cast<uint16_t>( geometry.height ) );
+}
+
+void Scene::OnEvasObjectVisiblityChanged( bool visible )
+{
+  if( mVisible == visible )
+  {
+    return;
+  }
+  DALI_LOG_RELEASE_INFO( "Scene::OnEvasObjectVisiblityChanged( %s )", visible ? "T" : "F" );
+
+  SetVisibility( visible );
+}
+
+void Scene::OnEvasObjectFocusIn()
+{
+  if( !mIsFocus )
+  {
+    mFocusChangedSignal.Emit( Extension::Scene( this ), true );
+
+    mIsFocus = true;
+  }
+}
+
+void Scene::OnEvasObjectFocusOut()
+{
+  if( mIsFocus )
+  {
+    mIsFocus = false;
+
+    Toolkit::KeyInputFocusManager focusManager = Toolkit::KeyInputFocusManager::Get();
+    Toolkit::Control currentFocused = focusManager.GetCurrentFocusControl();
+    if( currentFocused )
+    {
+      focusManager.RemoveFocus( currentFocused );
+    }
+
+    Clipboard::Get().HideClipboard();
+
+    mFocusChangedSignal.Emit( Extension::Scene( this ), false );
+  }
+}
+
+void Scene::OnEvasPostRender()
+{
+}
+
+bool Scene::OnElmAccessibilityActionEvent( AccessActionInfo& accessActionInfo )
+{
+  bool ret = false;
+
+  if( mAdaptor == nullptr )
+  {
+    return ret;
+  }
+
+  Dali::AccessibilityAdaptor accessibilityAdaptor = Dali::AccessibilityAdaptor::Get();
+  if( accessibilityAdaptor )
+  {
+    switch( accessActionInfo.actionBy )
+    {
+      case Dali::Extension::Internal::ACCESS_ACTION_HIGHLIGHT:
+      case Dali::Extension::Internal::ACCESS_ACTION_READ:
+      {
+        ret = accessibilityAdaptor.HandleActionReadEvent( (unsigned int)accessActionInfo.x, (unsigned int)accessActionInfo.y, true );
+      }
+      break;
+
+      case Dali::Extension::Internal::ACCESS_ACTION_HIGHLIGHT_PREV:
+      {
+        // if accessActionInfo.highlight_end is true, need to handle end_of_list sound feedback
+        ret = accessibilityAdaptor.HandleActionPreviousEvent( accessActionInfo.highlightCycle );
+        if(!ret)
+        {
+          // when focus moving was failed, clear the focus
+          accessibilityAdaptor.HandleActionClearFocusEvent();
+        }
+      }
+      break;
+
+      case Dali::Extension::Internal::ACCESS_ACTION_HIGHLIGHT_NEXT:
+      {
+        // if accessActionInfo.highlight_cycle is true, need to handle end_of_list sound feedback
+        ret = accessibilityAdaptor.HandleActionNextEvent( accessActionInfo.highlightCycle );
+        if(!ret)
+        {
+          // when focus moving was failed, clear the focus
+          accessibilityAdaptor.HandleActionClearFocusEvent();
+        }
+      }
+      break;
+
+      case Dali::Extension::Internal::ACCESS_ACTION_ACTIVATE:
+      {
+        ret = accessibilityAdaptor.HandleActionActivateEvent();
+      }
+      break;
+
+      case Dali::Extension::Internal::ACCESS_ACTION_UNHIGHLIGHT:
+      {
+        ret = accessibilityAdaptor.HandleActionClearFocusEvent();
+      }
+      break;
+
+      case Dali::Extension::Internal::ACCESS_ACTION_SCROLL:
+      {
+        Evas_Object* eo = mEvasWrapper->GetAccessibilityTarget();
+
+        if( eo )
+        {
+          int touchType = accessActionInfo.mouseType;
+
+          TouchPoint::State state( TouchPoint::Down );
+
+          if( touchType == 0 )
+          {
+            state = TouchPoint::Down; // mouse down
+          }
+          else if( touchType == 1 )
+          {
+            state = TouchPoint::Motion; // mouse move
+          }
+          else if( touchType == 2 )
+          {
+            state = TouchPoint::Up; // mouse up
+          }
+          else
+          {
+            state = TouchPoint::Interrupted; // error
+          }
+
+          // Send touch event to accessibility manager.
+          Evas_Coord rel_x, rel_y, obj_x,  obj_y, obj_w, obj_h;
+
+          evas_object_geometry_get( eo, &obj_x,  &obj_y, &obj_w, &obj_h );
+
+          rel_x = accessActionInfo.x - obj_x;
+          rel_y = accessActionInfo.y - obj_y;
+
+          TouchPoint point( 0, state, (float)rel_x, (float)rel_y );
+
+          ret = accessibilityAdaptor.HandleActionScrollEvent( point, accessActionInfo.timeStamp );
+        }
+      }
+      break;
+
+      case Dali::Extension::Internal::ACCESS_ACTION_UP:
+      {
+        ret = accessibilityAdaptor.HandleActionUpEvent();
+      }
+      break;
+
+      case Dali::Extension::Internal::ACCESS_ACTION_DOWN:
+      {
+        ret = accessibilityAdaptor.HandleActionDownEvent();
+      }
+      break;
+
+      case Dali::Extension::Internal::ACCESS_ACTION_BACK:
+      default:
+      {
+        DALI_LOG_WARNING( "[%s:%d]\n", __FUNCTION__, __LINE__ );
+      }
+
+      break;
+    }
+  }
+  else
+  {
+    DALI_LOG_WARNING( "[%s:%d]\n", __FUNCTION__, __LINE__ );
+  }
+
+  return ret;
+}
+
+void Scene::OnEcoreWl2VisibilityChange( bool visible )
+{
+  DALI_LOG_RELEASE_INFO( "Scene::OnEcoreWl2VisibilityChange( %s )", visible ? "T" : "F" );
+
+  SetVisibility( visible );
+}
+
+void Scene::SetVisibility( bool visible )
+{
+  if( mVisible == visible )
+  {
+    return;
+  }
+
+  mVisible = visible;
+
+  if( !mAdaptor )
+  {
+    return;
+  }
+
+  if( mVisible )
+  {
+    mAdaptor->OnWindowShown();
+  }
+  else
+  {
+    mAdaptor->OnWindowHidden();
+
+    mSurface->ReleaseLock();
+  }
+
+  mVisibilityChangedSignal.Emit( Extension::Scene( this ), mVisible );
+}
+
+} // namespace Internal
+
+} // namespace Extension
+
+} // namespace Dali
diff --git a/dali-extension/internal/evas-plugin/scene-impl.h b/dali-extension/internal/evas-plugin/scene-impl.h
new file mode 100644 (file)
index 0000000..4a5660d
--- /dev/null
@@ -0,0 +1,299 @@
+#ifndef DALI_EXTENSION_INTERNAL_SCENE_IMPL_H
+#define DALI_EXTENSION_INTERNAL_SCENE_IMPL_H
+
+/*
+ * Copyright (c) 2020 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
+#include <memory>
+#include <Ecore_IMF_Evas.h>
+
+#include <dali/integration-api/adaptor-framework/scene-holder-impl.h>
+#include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/signals/connection-tracker.h>
+
+// INTERNAL INCLUDES
+#include <dali-extension/internal/evas-plugin/evas-event-interface.h>
+#include <dali-extension/devel-api/evas-plugin/scene.h>
+
+namespace Dali
+{
+class Adaptor;
+class Layer;
+class NativeRenderSurface;
+class TriggerEventInterface;
+
+namespace Extension
+{
+
+namespace Internal
+{
+
+class EvasEventHandler;
+class EvasWrapper;
+
+/**
+ * Implementation of the Scene class.
+ */
+class Scene : public Dali::Internal::Adaptor::SceneHolder,
+              public ConnectionTracker,
+              public Extension::Internal::EvasEventInterface
+{
+public:
+  typedef Dali::Extension::Scene::SceneSize SceneSize;
+
+  typedef Dali::Extension::Scene::VisibilityChangedSignalType VisibilityChangedSignalType;
+
+  typedef Dali::Extension::Scene::FocusChangedSignalType FocusChangedSignalType;
+
+  typedef Dali::Extension::Scene::ResizedSignalType ResizedSignalType;
+
+  /**
+   * @brief Create a new scene
+   *
+   * @param[in] parentEvasObject Parent Evas object of the new scene
+   * @param[in] width The initial width of the scene
+   * @param[in] height The initial height of the scene
+   * @param[in] isTranslucent Whether the Evas object is translucent or not
+   */
+  static IntrusivePtr<Scene> New( Evas_Object* parentEvasObject, uint16_t width, uint16_t height, bool isTranslucent );
+
+public:
+
+  /**
+   * @copydoc Dali::Extension::Scene::GetLayerCount
+   */
+  uint32_t GetLayerCount() const;
+
+  /**
+   * @copydoc Dali::Extension::Scene::GetLayer
+   */
+  Layer GetLayer( uint32_t depth ) const;
+
+  /**
+   * @copydoc Dali::Extension::Scene::GetSize
+   */
+  SceneSize GetSize() const;
+
+  /**
+   * @brief Gets the native handle.
+   * @note When users call this function, it wraps the actual type used by the underlying system.
+   * @return The native handle or an empty handle
+   */
+  Dali::Any GetNativeHandle() const override;
+
+  /**
+   * @copydoc Dali::Extension::Scene::GetAccessEvasObject
+   */
+  Evas_Object* GetAccessEvasObject();
+
+  /**
+   * @copydoc Dali::Extension::Scene::GetDaliEvasObject
+   */
+  Evas_Object* GetDaliEvasObject();
+
+  /**
+   * @copydoc Dali::Extension::Scene::VisibilityChangedSignal
+   */
+  VisibilityChangedSignalType& VisibilityChangedSignal()
+  {
+    return mVisibilityChangedSignal;
+  }
+
+  /**
+   * @copydoc Dali::Extension::Scene::ResizedSignal
+   */
+  ResizedSignalType& ResizedSignal()
+  {
+    return mResizedSignal;
+  }
+
+  /**
+   * @copydoc Dali::Extension::Scene::FocusChangedSignal
+   */
+  FocusChangedSignalType& FocusChangedSignal()
+  {
+    return mFocusChangedSignal;
+  }
+
+  /*
+   * @brief Initialize the Scene
+   * @param[in] evasPlugin The EvasPlugin instance to be used to intialize the new scene
+   * @param[in] isDefaultScene Whether the Scene is a default one or not
+   */
+  void Initialize( EvasPlugin* evasPlugin, bool isDefaultScene );
+
+private:
+
+  /**
+   * @brief Resize the surface
+   * @param[in] width The width value
+   * @param[in] height The height value
+   */
+  void ResizeSurface( uint16_t width, uint16_t height );
+
+  /**
+   * This function is called after drawing by dali.
+   */
+  void OnPostRender();
+
+  /**
+   * @brief Set visibility of the Scene
+   * @param[in] visible The visibility
+   */
+  void SetVisibility( bool visible );
+
+  /**
+   * @brief Get the native render surface
+   * @return The render surface
+   */
+  NativeRenderSurface* GetNativeRenderSurface() const;
+
+private:
+
+  /**
+   * @copydoc Dali::Extension::Internal::EvasEventInterface::GetEvasWrapper
+   */
+  EvasWrapper* GetEvasWrapper() const override;
+
+  /**
+   * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasObjectTouchEvent
+   */
+  void OnEvasObjectTouchEvent( Dali::Integration::Point& touchPoint, unsigned long timeStamp ) override;
+
+  /**
+   * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasObjectWheelEvent
+   */
+  void OnEvasObjectWheelEvent( Dali::Integration::WheelEvent& wheelEvent ) override;
+
+  /**
+   * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasObjectKeyEvent
+   */
+  void OnEvasObjectKeyEvent( Dali::Integration::KeyEvent& keyEvent ) override;
+
+  /**
+   * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasObjectMove
+   */
+  void OnEvasObjectMove( const Rect<int>& geometry ) override;
+
+  /**
+   * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasObjectResize
+   */
+  void OnEvasObjectResize( const Rect<int>& geometry ) override;
+
+  /**
+   * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasObjectVisiblityChanged
+   */
+  void OnEvasObjectVisiblityChanged( bool visible ) override;
+
+  /**
+   * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasObjectFocusIn
+   */
+  void OnEvasObjectFocusIn() override;
+
+  /**
+   * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasObjectFocusOut
+   */
+  void OnEvasObjectFocusOut() override;
+
+  /**
+   * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEvasRenderPost
+   */
+  void OnEvasPostRender() override;
+
+  /**
+   * @copydoc Dali::Extension::Internal::EvasEventInterface::OnElmAccessibilityActionEvent
+   */
+  bool OnElmAccessibilityActionEvent( AccessActionInfo& actionInfo ) override;
+
+  /**
+   * @copydoc Dali::Extension::Internal::EvasEventInterface::OnEcoreWl2VisibilityChange
+   */
+  void OnEcoreWl2VisibilityChange( bool visible ) override;
+
+private:
+
+  /**
+   * Private constructor
+   *
+   * @param[in] parentEvasObject Parent Evas object of the new scene
+   * @param[in] width The initial width of the scene
+   * @param[in] height The initial height of the scene
+   * @param[in] isTranslucent Whether the Evas object is translucent or not
+   */
+  Scene( Evas_Object* parentEvasObject, uint16_t width, uint16_t height, bool isTranslucent );
+
+  /**
+   * Destructor
+   */
+  virtual ~Scene();
+
+  // Undefined
+  Scene( const Scene& );
+  Scene& operator=( Scene& );
+
+  /**
+   * This is for initialization of this Scene in case it is created before adaptor is running.
+   */
+  void OnPreInitEvasPlugin();
+
+  /*
+   * @brief Initialize the Scene (for internal use)
+   */
+  void Initialize();
+
+private:
+
+  Adaptor*                                  mAdaptor;
+
+  std::unique_ptr< EvasWrapper >            mEvasWrapper;
+  std::unique_ptr< EvasEventHandler >       mEvasEventHandler;
+  std::unique_ptr< TriggerEventInterface >  mRenderNotification;
+
+  ResizedSignalType                         mResizedSignal;
+  VisibilityChangedSignalType               mVisibilityChangedSignal;
+  FocusChangedSignalType                    mFocusChangedSignal;
+
+  bool                                      mIsFocus;
+  bool                                      mIsTranslucent;
+};
+
+inline Scene& GetImplementation( Extension::Scene& scene )
+{
+  DALI_ASSERT_ALWAYS( scene && "Extension::Scene handle is empty" );
+
+  BaseObject& handle = scene.GetBaseObject();
+
+  return static_cast<Scene&>( handle );
+}
+
+inline const Scene& GetImplementation( const Extension::Scene& scene )
+{
+  DALI_ASSERT_ALWAYS( scene && "Extension::Scene handle is empty" );
+
+  const BaseObject& handle = scene.GetBaseObject();
+
+  return static_cast<const Scene&>( handle );
+}
+
+} // namespace Internal
+
+} // namespace Extension
+
+} // namespace Dali
+
+#endif // DALI_EXTENSION_INTERNAL_SCENE_IMPL_H