Refactoring window system 28/176628/3
authorHeeyong Song <heeyong.song@samsung.com>
Fri, 20 Apr 2018 09:38:14 +0000 (18:38 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Thu, 26 Apr 2018 07:00:07 +0000 (16:00 +0900)
Change-Id: I9e9e0b19873386ede84ba3e8ad746345d0e1d051

75 files changed:
build/tizen/adaptor/Makefile.am
build/tizen/adaptor/linker-test.cpp
dali/devel-api/file.list
dali/integration-api/file.list
dali/integration-api/native-render-surface-factory.h
dali/integration-api/native-render-surface.h [new file with mode: 0644]
dali/integration-api/pixmap-render-surface-factory.h [deleted file]
dali/integration-api/render-surface.h [moved from dali/devel-api/adaptor-framework/render-surface.h with 97% similarity]
dali/integration-api/wayland/ecore-wl-render-surface.h [deleted file]
dali/integration-api/wayland/pixmap-render-surface.h [deleted file]
dali/integration-api/x11/ecore-x-render-surface.h [deleted file]
dali/integration-api/x11/input-method-context-impl.h [deleted file]
dali/integration-api/x11/pixmap-render-surface.h [deleted file]
dali/internal/adaptor/common/adaptor-impl.cpp
dali/internal/adaptor/common/adaptor-impl.h
dali/internal/adaptor/common/adaptor-internal-services.h
dali/internal/adaptor/common/adaptor.cpp
dali/internal/adaptor/common/application-impl.cpp
dali/internal/adaptor/tizen/adaptor-impl-tizen.cpp
dali/internal/graphics/common/render-helper.h
dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp
dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp
dali/internal/input/tizen-wayland/input-method-context-impl-ecore-wl.cpp
dali/internal/input/ubuntu-x11/input-method-context-impl-x.cpp
dali/internal/input/ubuntu-x11/input-method-context-impl-x.h
dali/internal/window-system/common/display-connection.h
dali/internal/window-system/common/native-render-surface-factory.cpp [moved from dali/internal/window-system/tizen-wearable/native-render-surface-factory-wearable.cpp with 68% similarity]
dali/internal/window-system/common/pixmap-render-surface.h [new file with mode: 0644]
dali/internal/window-system/common/render-surface-factory.h [new file with mode: 0644]
dali/internal/window-system/common/window-base-factory.h [new file with mode: 0644]
dali/internal/window-system/common/window-base.h [new file with mode: 0644]
dali/internal/window-system/common/window-impl.cpp [new file with mode: 0644]
dali/internal/window-system/common/window-impl.h
dali/internal/window-system/common/window-render-surface.h [new file with mode: 0644]
dali/internal/window-system/file.list
dali/internal/window-system/tizen-mobile/native-render-surface-factory-mobile.cpp [deleted file]
dali/internal/window-system/tizen-wayland/display-connection-impl-ecore-wl.cpp
dali/internal/window-system/tizen-wayland/display-connection-impl-ecore-wl.h
dali/internal/window-system/tizen-wayland/display-connection-impl-wl.h [deleted file]
dali/internal/window-system/tizen-wayland/event-handler-ecore-wl.cpp
dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp [new file with mode: 0644]
dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.h [moved from dali/integration-api/wayland/native-render-surface.h with 60% similarity]
dali/internal/window-system/tizen-wayland/pixmap-render-surface-ecore-wl.cpp [deleted file]
dali/internal/window-system/tizen-wayland/render-surface-ecore-wl.cpp [deleted file]
dali/internal/window-system/tizen-wayland/render-surface-factory-ecore-wl.cpp [new file with mode: 0644]
dali/internal/window-system/tizen-wayland/render-surface-factory-ecore-wl.h [new file with mode: 0644]
dali/internal/window-system/tizen-wayland/window-base-ecore-wl.cpp [new file with mode: 0644]
dali/internal/window-system/tizen-wayland/window-base-ecore-wl.h [new file with mode: 0644]
dali/internal/window-system/tizen-wayland/window-base-factory-ecore-wl.cpp [new file with mode: 0644]
dali/internal/window-system/tizen-wayland/window-base-factory-ecore-wl.h [new file with mode: 0644]
dali/internal/window-system/tizen-wayland/window-impl-ecore-wl.cpp [deleted file]
dali/internal/window-system/tizen-wayland/window-render-surface-ecore-wl.cpp
dali/internal/window-system/tizen-wayland/window-render-surface-ecore-wl.h
dali/internal/window-system/tizen-wayland/wl-types.h [moved from dali/integration-api/wayland/wl-types.h with 100% similarity]
dali/internal/window-system/tizen/native-render-surface-tizen.cpp [deleted file]
dali/internal/window-system/tizen/pixmap-render-surface-x.cpp [deleted file]
dali/internal/window-system/ubuntu-x11/display-connection-impl-x.cpp
dali/internal/window-system/ubuntu-x11/display-connection-impl-x.h
dali/internal/window-system/ubuntu-x11/ecore-x-types.h [moved from dali/integration-api/x11/ecore-x-types.h with 100% similarity]
dali/internal/window-system/ubuntu-x11/event-handler-ecore-x.cpp
dali/internal/window-system/ubuntu-x11/native-image-source-impl.h [deleted file]
dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.cpp [new file with mode: 0644]
dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.h [new file with mode: 0644]
dali/internal/window-system/ubuntu-x11/render-surface-ecore-x.cpp [deleted file]
dali/internal/window-system/ubuntu-x11/render-surface-factory-ecore-x.cpp
dali/internal/window-system/ubuntu-x11/render-surface-factory-ecore-x.h
dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp [new file with mode: 0644]
dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h [new file with mode: 0644]
dali/internal/window-system/ubuntu-x11/window-base-factory-ecore-x.cpp [new file with mode: 0644]
dali/internal/window-system/ubuntu-x11/window-base-factory-ecore-x.h [new file with mode: 0644]
dali/internal/window-system/ubuntu-x11/window-extensions.h [deleted file]
dali/internal/window-system/ubuntu-x11/window-impl-x.cpp [deleted file]
dali/internal/window-system/ubuntu-x11/window-interface-ecore-x.cpp
dali/internal/window-system/ubuntu-x11/window-render-surface-ecore-x.cpp [moved from dali/internal/window-system/ubuntu-x11/window-render-surface-x.cpp with 64% similarity]
dali/internal/window-system/ubuntu-x11/window-render-surface-ecore-x.h [moved from dali/internal/window-system/ubuntu-x11/window-render-surface-x.h with 54% similarity]

index 6afda1d..dd26888 100644 (file)
@@ -116,7 +116,6 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
                   $(adaptor_resampler_src_files) \
                   $(adaptor_video_common_src_files) \
                   $(adaptor_window_system_common_src_files) \
-                  $(adaptor_window_system_tizen_mobile_src_files) \
                   $(adaptor_window_system_tizen_src_files) \
                   $(adaptor_window_system_tizen_wayland_src_files) \
                   $(adaptor_trace_common_src_files) \
@@ -329,7 +328,6 @@ LIBDALI_ADAPTOR_LA_SOURCES = \
                   $(adaptor_window_system_common_src_files) \
                   $(adaptor_window_system_tizen_src_files) \
                   $(adaptor_window_system_tizen_wayland_src_files) \
-                  $(adaptor_window_system_tizen_wearable_src_files) \
                   $(adaptor_trace_common_src_files) \
                   $(devel_api_text_abstraction_src_files) \
                   $(static_libraries_glyphy_src_files) \
@@ -550,15 +548,6 @@ tizenadaptordevelapidir= $(devincludepath)/dali/devel-api
 tizenadaptorintegrationapidir = $(devincludepath)/dali/integration-api/adaptors
 tizenadaptorintegrationapi_HEADERS = $(adaptor_integration_api_header_files)
 
-if WAYLAND
-tizenadaptorintegrationwaylandapidir = $(devincludepath)/dali/integration-api/adaptors
-tizenadaptorintegrationwaylandapi_HEADERS = $(adaptor_integration_wayland_api_header_files)
-tizenadaptorintegrationwaylandapi_HEADERS += $(adaptor_integration_ecore_wayland_api_header_files)
-else
-tizenadaptorintegrationx11apidir = $(devincludepath)/dali/integration-api/adaptors
-tizenadaptorintegrationx11api_HEADERS = $(adaptor_integration_x11_api_header_files)
-endif
-
 tizenadaptorframeworkpublicapidir = $(tizenadaptorpublicapidir)/adaptor-framework
 tizenadaptorframeworkpublicapi_HEADERS = $(public_api_adaptor_framework_header_files)
 
index ceff86b..a85622d 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <dali/public-api/adaptor-framework/application.h>
 #include <dali/integration-api/adaptor.h>
-#include <dali/devel-api/adaptor-framework/render-surface.h>
+#include <dali/integration-api/render-surface.h>
 #include <dali/devel-api/adaptor-framework/orientation.h>
 #include <dali/public-api/adaptor-framework/timer.h>
 #include <iostream>
index 27e40d6..4fc7506 100755 (executable)
@@ -54,7 +54,6 @@ devel_api_adaptor_framework_header_files = \
   $(adaptor_devel_api_dir)/adaptor-framework/orientation.h \
   $(adaptor_devel_api_dir)/adaptor-framework/performance-logger.h \
   $(adaptor_devel_api_dir)/adaptor-framework/pixel-buffer.h \
-  $(adaptor_devel_api_dir)/adaptor-framework/render-surface.h \
   $(adaptor_devel_api_dir)/adaptor-framework/singleton-service.h \
   $(adaptor_devel_api_dir)/adaptor-framework/sound-player.h \
   $(adaptor_devel_api_dir)/adaptor-framework/style-monitor.h \
index c7a2553..d091cf0 100755 (executable)
@@ -2,23 +2,11 @@ adaptor_integration_api_header_files = \
   $(adaptor_integration_api_dir)/adaptor.h \
   $(adaptor_integration_api_dir)/egl-interface.h \
   $(adaptor_integration_api_dir)/log-factory-interface.h \
+  $(adaptor_integration_api_dir)/native-render-surface.h \
+  $(adaptor_integration_api_dir)/native-render-surface-factory.h \
+  $(adaptor_integration_api_dir)/render-surface.h \
   $(adaptor_integration_api_dir)/thread-synchronization-interface.h \
   $(adaptor_integration_api_dir)/trigger-event-interface.h \
   $(adaptor_integration_api_dir)/trigger-event-factory-interface.h \
   $(adaptor_integration_api_dir)/trigger-event-factory.h
 
-adaptor_integration_wayland_api_header_files = \
-  $(adaptor_integration_api_dir)/wayland/wl-types.h \
-  $(adaptor_integration_api_dir)/wayland/ecore-wl-render-surface.h \
-  $(adaptor_integration_api_dir)/wayland/native-render-surface.h \
-  $(adaptor_integration_api_dir)/native-render-surface-factory.h
-
-adaptor_integration_ecore_wayland_api_header_files = \
-  $(adaptor_integration_api_dir)/../internal/input/common/input-method-context-impl.h
-
-adaptor_integration_x11_api_header_files = \
-  $(adaptor_integration_api_dir)/x11/ecore-x-types.h \
-  $(adaptor_integration_api_dir)/x11/ecore-x-render-surface.h \
-  $(adaptor_integration_api_dir)/x11/pixmap-render-surface.h \
-  $(adaptor_integration_api_dir)/x11/input-method-context-impl.h \
-  $(adaptor_integration_api_dir)/pixmap-render-surface-factory.h
index fdc0469..eb69e8b 100644 (file)
@@ -20,7 +20,6 @@
 
 // EXTERNAL INCLUDES
 #include <string>
-#include <dali/public-api/object/any.h>
 #include <dali/public-api/common/dali-common.h>
 
 // INTERNAL INCLUDES
diff --git a/dali/integration-api/native-render-surface.h b/dali/integration-api/native-render-surface.h
new file mode 100644 (file)
index 0000000..796967f
--- /dev/null
@@ -0,0 +1,99 @@
+#ifndef __DALI_NATIVE_RENDER_SURFACE_H__
+#define __DALI_NATIVE_RENDER_SURFACE_H__
+
+/*
+ * Copyright (c) 2018 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/public-api/common/dali-common.h>
+
+// INTERNAL INCLUDES
+#ifdef DALI_ADAPTOR_COMPILATION
+#include <dali/integration-api/egl-interface.h>
+#include <dali/integration-api/render-surface.h>
+#else
+#include <dali/integration-api/adaptors/egl-interface.h>
+#include <dali/integration-api/adaptors/render-surface.h>
+#endif
+
+namespace Dali
+{
+
+class TriggerEventInterface;
+
+/**
+ * Native interface of render surface.
+ */
+class DALI_IMPORT_API NativeRenderSurface : public Dali::RenderSurface
+{
+public:
+
+  /**
+   * @brief Default constructor
+   */
+  NativeRenderSurface() = default;
+
+  /**
+   * @brief Destructor
+   */
+  virtual ~NativeRenderSurface() = default;
+
+public: // API
+
+  /**
+   * @brief Get the render surface the adaptor is using to render to.
+   * @return reference to current render surface
+   */
+  virtual Any GetDrawable() = 0;
+
+  /**
+   * @brief Sets the render notification trigger to call when render thread is completed a frame
+   * @param renderNotification to use
+   */
+  virtual void SetRenderNotification( TriggerEventInterface* renderNotification ) = 0;
+
+  /**
+   * @brief Waits until surface is replaced
+   * After tbm surface is acquired in PostRender, this function is finished.
+   */
+  virtual void WaitUntilSurfaceReplaced() = 0;
+
+private: // from NativeRenderSurface
+
+  /**
+   * @brief Create a renderable
+   */
+  virtual void CreateNativeRenderable() = 0;
+
+  /**
+   * @brief Release a drawable
+   */
+  virtual void ReleaseDrawable() = 0;
+
+protected:
+
+  // Undefined
+  NativeRenderSurface(const NativeRenderSurface&) = delete;
+
+  // Undefined
+  NativeRenderSurface& operator=(const NativeRenderSurface& rhs) = delete;
+
+};
+
+} // namespace Dali
+
+#endif // __DALI_NATIVE_RENDER_SURFACE_H__
diff --git a/dali/integration-api/pixmap-render-surface-factory.h b/dali/integration-api/pixmap-render-surface-factory.h
deleted file mode 100644 (file)
index 971dc35..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef __DALI_INTEGRATION_PIXMAP_RENDER_SURFACE_FACTORY_H__
-#define __DALI_INTEGRATION_PIXMAP_RENDER_SURFACE_FACTORY_H__
-
-/*
- * Copyright (c) 2014 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 <string>
-#include <dali/public-api/object/any.h>
-#include <dali/public-api/common/dali-common.h>
-
-// INTERNAL INCLUDES
-
-namespace Dali
-{
-
-namespace ECore
-{
-
-class PixmapRenderSurface;
-
-/**
- * Surface factory function for pixmap
- * A pixmap surface is created.
- *
- * @param [in] positionSize the position and size of the surface to create
- * @param [in] surface X Pixmap to use, or null for default.
- * @param [in] name Name of surface passed in
- * @param [in] isTransparent Whether the surface has an alpha channel
- */
-PixmapRenderSurface* CreatePixmapSurface(PositionSize       positionSize,
-                                         Any                surface,
-                                         const std::string& name,
-                                         bool               isTransparent);
-
-} // namespace ECoreX
-
-} // namespace Dali
-
-#endif //  __DALI_INTEGRATION_PIXMAP_RENDER_SURFACE_FACTORY_H__
similarity index 97%
rename from dali/devel-api/adaptor-framework/render-surface.h
rename to dali/integration-api/render-surface.h
index 9739770..3db6bac 100644 (file)
@@ -64,8 +64,8 @@ public:
 
   enum Type
   {
-    ECORE_RENDER_SURFACE,
-    WAYLAND_RENDER_SURFACE,
+    WINDOW_RENDER_SURFACE,
+    PIXMAP_RENDER_SURFACE,
     NATIVE_RENDER_SURFACE
   };
 
@@ -113,7 +113,7 @@ public:
   virtual bool ReplaceEGLSurface( EglInterface& egl ) = 0;
 
   /**
-   * @brief Resizes the underlying surface. Only available for x window
+   * @brief Resizes the underlying surface.
    */
   virtual void MoveResize( Dali::PositionSize positionSize ) = 0;
 
@@ -166,6 +166,9 @@ public:
    */
   virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) = 0;
 
+  /**
+   * @brief Gets the surface type
+   */
   virtual RenderSurface::Type GetSurfaceType() = 0;
 
 private:
diff --git a/dali/integration-api/wayland/ecore-wl-render-surface.h b/dali/integration-api/wayland/ecore-wl-render-surface.h
deleted file mode 100644 (file)
index d814e0b..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-#ifndef __DALI_ECORE_WL_RENDER_SURFACE_H__
-#define __DALI_ECORE_WL_RENDER_SURFACE_H__
-
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <Ecore_Wayland.h>
-#include <dali/public-api/common/dali-common.h>
-
-// INTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/render-surface.h>
-#include <dali/integration-api/egl-interface.h>
-
-namespace Dali
-{
-
-class TriggerEventInterface;
-
-namespace ECore
-{
-
-/**
- * Ecore Wayland implementation of render surface.
- * @todo change namespace to ECore_Wayland as the class
- * is no longer pure Wayland.
- */
-class DALI_IMPORT_API EcoreWlRenderSurface : public Dali::RenderSurface
-{
-public:
-  /**
-    * Uses an Wayland surface to render to.
-    * @param [in] positionSize the position and size of the surface
-    * @param [in] surface can be a X-window or X-pixmap (type must be unsigned int).
-    * @param [in] name optional name of surface passed in
-    * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
-    */
-  EcoreWlRenderSurface(Dali::PositionSize positionSize,
-                       Any surface,
-                       const std::string& name,
-                       bool isTransparent = false);
-
-  /**
-   * Destructor.
-   * Will delete the display, if it has ownership.
-   * Will delete the window/pixmap if it has owner ship
-   */
-  virtual ~EcoreWlRenderSurface();
-
-protected:
-  /**
-   * Second stage construction
-   * Creates the surface (window, pixmap or native buffer)
-   */
-  void Init( Any surface );
-
-public: // API
-
-  /**
-   * @brief Sets the render notification trigger to call when render thread is completed a frame
-   *
-   * @param renderNotification to use
-   */
-  void SetRenderNotification(TriggerEventInterface* renderNotification);
-
-  /**
-   * @brief Get window handle
-   *
-   * @return the Ecore X window handle
-   */
-  virtual Ecore_Wl_Window* GetWlWindow();
-
-  /**
-   * Get the surface as an Ecore_Wl_Window
-   */
-  virtual Ecore_Wl_Window* GetDrawable();
-
-public: // from Dali::RenderSurface
-
-  /**
-   * @copydoc Dali::RenderSurface::GetPositionSize()
-   */
-  virtual PositionSize GetPositionSize() const;
-
-  /**
-   * @copydoc Dali::RenderSurface::InitializeEgl()
-   */
-  virtual void InitializeEgl( EglInterface& egl ) = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::CreateEglSurface()
-   */
-  virtual void CreateEglSurface( EglInterface& egl ) = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::DestroyEglSurface()
-   */
-  virtual void DestroyEglSurface( EglInterface& egl ) = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
-   */
-  virtual bool ReplaceEGLSurface( EglInterface& egl ) = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::MoveResize()
-   */
-  virtual void MoveResize( Dali::PositionSize positionSize);
-
-  /**
-   * @copydoc Dali::RenderSurface::SetViewMode()
-   */
-  void SetViewMode( ViewMode viewMode );
-
-  /**
-   * @copydoc Dali::RenderSurface::StartRender()
-   */
-  virtual void StartRender() = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::PreRender()
-   */
-  virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface ) = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::PostRender()
-   */
-  virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface ) = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::ReleaseLock()
-   */
-  virtual void ReleaseLock() = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::GetSurfaceType()
-   */
-  virtual RenderSurface::Type GetSurfaceType();
-
-private:
-
-  /**
-   * Get the surface id if the surface parameter is not empty
-   * @param surface Any containing a surface id, or can be empty
-   * @return surface id, or zero if surface is empty
-   */
-  unsigned int GetSurfaceId( Any surface ) const;
-
-protected:
-
-  /**
-   * Create XRenderable
-   */
-  virtual void CreateWlRenderable() = 0;
-
-  /**
-   * Use an existing render surface
-   * @param surfaceId the id of the surface
-   */
-  virtual void UseExistingRenderable( unsigned int surfaceId ) = 0;
-
-protected: // Data
-
-  PositionSize                mPositionSize;       ///< Position
-  std::string                 mTitle;              ///< Title of window which shows from "xinfo -topvwins" command
-  TriggerEventInterface*      mRenderNotification; ///< Render notification trigger
-  ColorDepth                  mColorDepth;         ///< Color depth of surface (32 bit or 24 bit)
-  bool                        mOwnSurface;         ///< Whether we own the surface (responsible for deleting it)
-};
-
-} // namespace ECore
-
-} // namespace Dali
-
-#endif // __DALI_ECORE_WL_RENDER_SURFACE_H__
diff --git a/dali/integration-api/wayland/pixmap-render-surface.h b/dali/integration-api/wayland/pixmap-render-surface.h
deleted file mode 100644 (file)
index f2a7815..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-#ifndef __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__
-#define __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/wayland/ecore-wl-render-surface.h>
-
-namespace Dali
-{
-
-namespace ECore
-{
-
-/**
- * Ecore X11 implementation of render surface.
- */
-class PixmapRenderSurface : public EcoreWlRenderSurface
-{
-public:
-
-  /**
-    * Uses an Wayland surface to render to.
-    * @param [in] positionSize the position and size of the surface
-    * @param [in] surface can be a Wayland-window (type must be unsigned int).
-    * @param [in] name optional name of surface passed in
-    * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
-    */
-  PixmapRenderSurface( Dali::PositionSize positionSize,
-                       Any surface,
-                       const std::string& name,
-                       bool isTransparent = false);
-
-  /**
-   * @copydoc Dali::RenderSurface::~RenderSurface
-   */
-  virtual ~PixmapRenderSurface();
-
-public: // API
-
-  /**
-   * @copydoc Dali::ECore::EcoreWlRenderSurface::GetDrawable()
-   */
-  virtual Ecore_Wl_Window* GetDrawable();
-
-  /**
-   * @brief GetSurface
-   *
-   * @return pixmap
-   */
-  virtual Any GetSurface();
-
-public: // from Dali::RenderSurface
-
-  /**
-   * @copydoc Dali::RenderSurface::InitializeEgl()
-   */
-  virtual void InitializeEgl( EglInterface& egl );
-
-  /**
-   * @copydoc Dali::RenderSurface::CreateEglSurface()
-   */
-  virtual void CreateEglSurface( EglInterface& egl );
-
-  /**
-   * @copydoc Dali::RenderSurface::DestroyEglSurface()
-   */
-  virtual void DestroyEglSurface( EglInterface& egl );
-
-  /**
-   * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
-   */
-  virtual bool ReplaceEGLSurface( EglInterface& egl );
-
-  /**
-   * @copydoc Dali::RenderSurface::StartRender()
-   */
-  virtual void StartRender();
-
-  /**
-   * @copydoc Dali::RenderSurface::PreRender()
-   */
-  virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface );
-
-  /**
-   * @copydoc Dali::RenderSurface::PostRender()
-   */
-  virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface );
-
-  /**
-   * @copydoc Dali::RenderSurface::StopRender()
-   */
-  virtual void StopRender();
-
-  /**
-   * @copydoc Dali::RenderSurface::SetThreadSynchronization
-   */
-  virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization );
-
-private:
-  enum SyncMode
-  {
-    SYNC_MODE_NONE,
-    SYNC_MODE_WAIT
-  };
-
-  /**
-   * Set the sync mode.
-   * @param[in] syncMode The sync mode
-   */
-  void SetSyncMode( SyncMode syncMode );
-
-  /**
-   * If sync mode is WAIT, then acquire a lock. This prevents render thread from
-   * continuing until the pixmap has been drawn by the compositor.
-   * It must be released for rendering to continue.
-   */
-  void AcquireLock();
-
-  /**
-   * Release any locks.
-   */
-  void ReleaseLock();
-
-  /**
-   * Create XPixmap
-   */
-  virtual void CreateWlRenderable();
-
-  /**
-   * @copydoc Dali::Internal::Adaptor::ECore::RenderSurface::UseExistingRenderable
-   */
-  virtual void UseExistingRenderable( unsigned int surfaceId );
-
-private: // Data
-
-};
-
-} // namespace ECore
-
-} // namespace Dali
-
-#endif // __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__
diff --git a/dali/integration-api/x11/ecore-x-render-surface.h b/dali/integration-api/x11/ecore-x-render-surface.h
deleted file mode 100644 (file)
index 63f5682..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-#ifndef __DALI_ECORE_X_RENDER_SURFACE_H__
-#define __DALI_ECORE_X_RENDER_SURFACE_H__
-
-/*
- * Copyright (c) 2014 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 <Ecore_X.h>
-#include <dali/public-api/common/dali-common.h>
-
-// INTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/render-surface.h>
-#include <dali/integration-api/x11/ecore-x-types.h>
-#include <dali/integration-api/egl-interface.h>
-
-namespace Dali
-{
-
-class TriggerEventInterface;
-
-namespace ECore
-{
-
-/**
- * Ecore X11 implementation of render surface.
- * @todo change namespace to ECore_X11 as the class
- * is no longer pure X11.
- */
-class DALI_IMPORT_API EcoreXRenderSurface : public Dali::RenderSurface
-{
-public:
-  /**
-    * Uses an X11 surface to render to.
-    * @param [in] positionSize the position and size of the surface
-    * @param [in] surface can be a X-window or X-pixmap (type must be unsigned int).
-    * @param [in] name optional name of surface passed in
-    * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
-    */
-  EcoreXRenderSurface(Dali::PositionSize positionSize,
-                      Any surface,
-                      const std::string& name,
-                      bool isTransparent = false);
-
-  /**
-   * Destructor.
-   * Will delete the display, if it has ownership.
-   * Will delete the window/pixmap if it has owner ship
-   */
-  virtual ~EcoreXRenderSurface();
-
-protected:
-  /**
-   * Second stage construction
-   * Creates the surface (window, pixmap or native buffer)
-   */
-  void Init( Any surface );
-
-public: // API
-
-  /**
-   * @brief Sets the render notification trigger to call when render thread is completed a frame
-   *
-   * @param renderNotification to use
-   */
-  void SetRenderNotification(TriggerEventInterface* renderNotification);
-
-  /**
-   * @brief Get window handle
-   *
-   * @return the Ecore X window handle
-   */
-  Ecore_X_Window GetXWindow();
-
-  /**
-   * Get the surface as an Ecore_X_drawable
-   */
-  virtual Ecore_X_Drawable GetDrawable();
-
-  /**
-   * @brief Get the render surface the adaptor is using to render to.
-   *
-   * @return reference to current render surface (eg, pixmap / window)
-   */
-  virtual Any GetSurface() = 0;
-
-public: // from Dali::RenderSurface
-
-  /**
-   * @copydoc Dali::RenderSurface::GetPositionSize()
-   */
-  virtual PositionSize GetPositionSize() const;
-
-  /**
-   * @copydoc Dali::RenderSurface::InitializeEgl()
-   */
-  virtual void InitializeEgl( EglInterface& egl ) = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::CreateEglSurface()
-   */
-  virtual void CreateEglSurface( EglInterface& egl ) = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::DestroyEglSurface()
-   */
-  virtual void DestroyEglSurface( EglInterface& egl ) = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
-   */
-  virtual bool ReplaceEGLSurface( EglInterface& egl ) = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::MoveResize()
-   */
-  virtual void MoveResize( Dali::PositionSize positionSize);
-
-  /**
-   * @copydoc Dali::RenderSurface::SetViewMode()
-   */
-  void SetViewMode( ViewMode viewMode );
-
-  /**
-   * @copydoc Dali::RenderSurface::StartRender()
-   */
-  virtual void StartRender() = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::PreRender()
-   */
-  virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface ) = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::PostRender()
-   */
-  virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface ) = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::ReleaseLock()
-   */
-  virtual void ReleaseLock() = 0;
-
-  /**
-   * @copydoc Dali::RenderSurface::GetSurfaceType()
-   */
-  virtual RenderSurface::Type GetSurfaceType();
-
-private:
-
-  /**
-   * Get the surface id if the surface parameter is not empty
-   * @param surface Any containing a surface id, or can be empty
-   * @return surface id, or zero if surface is empty
-   */
-  unsigned int GetSurfaceId( Any surface ) const;
-
-protected:
-
-  /**
-   * Create XRenderable
-   */
-  virtual void CreateXRenderable() = 0;
-
-  /**
-   * Use an existing render surface
-   * @param surfaceId the id of the surface
-   */
-  virtual void UseExistingRenderable( unsigned int surfaceId ) = 0;
-
-protected: // Data
-
-  PositionSize                mPosition;               ///< Position
-  std::string                 mTitle;                  ///< Title of window which shows from "xinfo -topvwins" command
-  TriggerEventInterface*      mRenderNotification;     ///< Render notification trigger
-  ColorDepth                  mColorDepth;             ///< Color depth of surface (32 bit or 24 bit)
-  bool                        mOwnSurface;             ///< Whether we own the surface (responsible for deleting it)
-};
-
-} // namespace ECore
-
-} // namespace Dali
-
-#endif // __DALI_ECORE_X_RENDER_SURFACE_H__
diff --git a/dali/integration-api/x11/input-method-context-impl.h b/dali/integration-api/x11/input-method-context-impl.h
deleted file mode 100755 (executable)
index f29ec44..0000000
+++ /dev/null
@@ -1,349 +0,0 @@
-#ifndef __DALI_INTERNAL_INPUT_METHOD_CONTEXT_H
-#define __DALI_INTERNAL_INPUT_METHOD_CONTEXT_H
-
-/*
- * Copyright (c) 2018 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 <Ecore_IMF.h>
-#include <Ecore_X.h>
-
-#include <dali/public-api/object/base-object.h>
-
-// INTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/input-method-context.h>
-
-namespace Dali
-{
-
-class RenderSurface;
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-class InputMethodContext;
-
-typedef IntrusivePtr< InputMethodContext > InputMethodContextPtr;
-
-class DALI_IMPORT_API InputMethodContext : public Dali::BaseObject
-{
-public:
-  typedef Dali::InputMethodContext::ActivatedSignalType ActivatedSignalType;
-  typedef Dali::InputMethodContext::KeyboardEventSignalType KeyboardEventSignalType;
-  typedef Dali::InputMethodContext::StatusSignalType StatusSignalType;
-  typedef Dali::InputMethodContext::VoidSignalType VoidSignalType;
-  typedef Dali::InputMethodContext::KeyboardTypeSignalType KeyboardTypeSignalType;
-  typedef Dali::InputMethodContext::KeyboardResizedSignalType KeyboardResizedSignalType;
-  typedef Dali::InputMethodContext::LanguageChangedSignalType LanguageChangedSignalType;
-
-public:
-  /**
-   * @brief Creates a new InputMethodContext handle
-   *
-   * @return InputMethodContext pointer
-   */
-  static InputMethodContextPtr New();
-
-  /**
-   * @brief Initializes member data.
-   */
-  void Initialize();
-
-public:
-
-  /**
-   * @copydoc Dali::InputMethodContext::Finalize()
-   */
-  void Finalize();
-
-  /**
-   * Connect Callbacks required for InputMethodContext.
-   * If you don't connect InputMethodContext callbacks, you can't get the key events.
-   * The events are PreeditChanged, Commit and DeleteSurrounding.
-   */
-  void ConnectCallbacks();
-
-  /**
-   * Disconnect Callbacks attached to InputMethodContext context.
-   */
-  void DisconnectCallbacks();
-
-  /**
-   * @copydoc Dali::InputMethodContext::Activate()
-   */
-  void Activate();
-
-  /**
-   * @copydoc Dali::InputMethodContext::Deactivate()
-   */
-  void Deactivate();
-
-  /**
-   * @copydoc Dali::InputMethodContext::Reset()
-   */
-  void Reset();
-
-  /**
-   * @copydoc Dali::InputMethodContext::GetContext()
-   */
-  Ecore_IMF_Context* GetContext();
-
-  /**
-   * @copydoc Dali::InputMethodContext::RestoreAfterFocusLost()
-   */
-  bool RestoreAfterFocusLost() const;
-
-  /**
-   * @copydoc Dali::InputMethodContext::SetRestoreAfterFocusLost()
-   */
-  void SetRestoreAfterFocusLost( bool toggle );
-
-  /**
-   * @copydoc Dali::InputMethodContext::PreEditChanged()
-   */
-  void PreEditChanged( void* data, Ecore_IMF_Context* imfContext, void* event_info );
-
-  /**
-   * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
-   */
-  void CommitReceived( void* data, Ecore_IMF_Context* imfContext, void* event_info );
-
-  /**
-   * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
-   */
-  Eina_Bool RetrieveSurrounding( void* data, Ecore_IMF_Context* imfContext, char** text, int* cursorPosition );
-
-  /**
-   * @copydoc Dali::InputMethodContext::DeleteSurrounding()
-   */
-  void DeleteSurrounding( void* data, Ecore_IMF_Context* imfContext, void* event_info );
-
-  // Cursor related
-  /**
-   * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
-   */
-  void NotifyCursorPosition();
-
-  /**
-   * @copydoc Dali::InputMethodContext::SetCursorPosition()
-   */
-  void SetCursorPosition( unsigned int cursorPosition );
-
-  /**
-   * @copydoc Dali::InputMethodContext::GetCursorPosition()
-   */
-  unsigned int GetCursorPosition() const;
-
-  /**
-   * @copydoc Dali::InputMethodContext::SetSurroundingText()
-   */
-  void SetSurroundingText( const std::string& text );
-
-  /**
-   * @copydoc Dali::InputMethodContext::GetSurroundingText()
-   */
-  const std::string& GetSurroundingText() const;
-
-  /**
-  * @copydoc Dali::InputMethodContext::NotifyTextInputMultiLine()
-  */
-  void NotifyTextInputMultiLine( bool multiLine );
-
-  /**
-  * @copydoc Dali::InputMethodContext::GetTextDirection()
-  */
-  Dali::InputMethodContext::TextDirection GetTextDirection();
-
-  /**
-  * @copydoc Dali::InputMethodContext::GetInputMethodArea()
-  */
-  Dali::Rect<int> GetInputMethodArea();
-
-  /**
-  * @copydoc Dali::InputMethodContext::ApplyOptions()
-  */
-  void ApplyOptions( const InputMethodOptions& options );
-
-  /**
-   * @copydoc Dali::InputMethodContext::SetInputPanelData()
-   */
-  void SetInputPanelData( const std::string& data );
-
-  /**
-   * @copydoc Dali::InputMethodContext::GetInputPanelData()
-   */
-  void GetInputPanelData( std::string& data );
-
-  /**
-   * @copydoc Dali::InputMethodContext::GetInputPanelState()
-   */
-  Dali::InputMethodContext::State GetInputPanelState();
-
-  /**
-   * @copydoc Dali::InputMethodContext::SetReturnKeyState()
-   */
-  void SetReturnKeyState( bool visible );
-
-  /**
-   * @copydoc Dali::InputMethodContext::AutoEnableInputPanel()
-   */
-  void AutoEnableInputPanel( bool enabled );
-
-  /**
-   * @copydoc Dali::InputMethodContext::ShowInputPanel()
-   */
-  void ShowInputPanel();
-
-  /**
-   * @copydoc Dali::InputMethodContext::HideInputPanel()
-   */
-  void HideInputPanel();
-
-  /**
-   * @copydoc Dali::InputMethodContext::GetKeyboardType()
-   */
-  Dali::InputMethodContext::KeyboardType GetKeyboardType();
-
-  /**
-   * @copydoc Dali::InputMethodContext::GetInputPanelLocale()
-   */
-  std::string GetInputPanelLocale();
-
-  /**
-   * @copydoc Dali::FilterEventKey()
-   */
-  bool FilterEventKey( const Dali::KeyEvent& keyEvent );
-
-public:  // Signals
-
-  /**
-   * @copydoc Dali::InputMethodContext::ActivatedSignal()
-   */
-  ActivatedSignalType& ActivatedSignal() { return mActivatedSignal; }
-
-  /**
-   * @copydoc Dali::InputMethodContext::EventReceivedSignal()
-   */
-  KeyboardEventSignalType& EventReceivedSignal() { return mEventSignal; }
-
-  /**
-   * @copydoc Dali::InputMethodContext::StatusChangedSignal()
-   */
-  StatusSignalType& StatusChangedSignal() { return mKeyboardStatusSignal; }
-
-  /**
-   * @copydoc Dali::InputMethodContext::ResizedSignal()
-   */
-  KeyboardResizedSignalType& ResizedSignal() { return mKeyboardResizeSignal; }
-
-  /**
-   * @copydoc Dali::InputMethodContext::LanguageChangedSignal()
-   */
-  LanguageChangedSignalType& LanguageChangedSignal() { return mKeyboardLanguageChangedSignal; }
-
-  /**
-   * @copydoc Dali::InputMethodContext::KeyboardTypeChangedSignal()
-   */
-  KeyboardTypeSignalType& KeyboardTypeChangedSignal() { return mKeyboardTypeChangedSignal; }
-
-private:
-  /**
-   * Context created the first time and kept until deleted.
-   * @param[in] ecoreXwin, The window is created by application.
-   */
-  void CreateContext( Ecore_X_Window ecoreXwin );
-
-  /**
-   * @copydoc Dali::InputMethodContext::DeleteContext()
-   */
-  void DeleteContext();
-
-public:
-
-  /**
-   * Constructor
-   */
-  InputMethodContext() = default;
-
-
-  /**
-   * Destructor.
-   */
-  virtual ~InputMethodContext();
-
-private:
-  /**
-   * Constructor
-   * @param[in] ecoreXwin, The window is created by application.
-   */
-  InputMethodContext( Ecore_X_Window ecoreXwin );
-
-  // Undefined copy constructor
-  InputMethodContext( const InputMethodContext& inputMethodContext) = delete;
-
-  // Undefined assignment operator
-  InputMethodContext& operator=( const InputMethodContext& inputMethodContext ) = delete;
-
-private:
-  Ecore_IMF_Context* mIMFContext;
-  Ecore_X_Window mEcoreXwin;
-  int mIMFCursorPosition;
-  std::string mSurroundingText;
-
-  bool mRestoreAfterFocusLost:1;             ///< Whether the keyboard needs to be restored (activated ) after focus regained.
-  bool mIdleCallbackConnected:1;             ///< Whether the idle callback is already connected.
-  InputMethodOptions        mOptions;
-
-  ActivatedSignalType        mActivatedSignal;
-  KeyboardEventSignalType    mEventSignal;
-  StatusSignalType           mKeyboardStatusSignal;
-  KeyboardResizedSignalType  mKeyboardResizeSignal;
-  LanguageChangedSignalType  mKeyboardLanguageChangedSignal;
-  KeyboardTypeSignalType     mKeyboardTypeChangedSignal;
-
-public:
-
-DALI_IMPORT_API inline static Internal::Adaptor::InputMethodContext& GetImplementation(Dali::InputMethodContext& inputMethodContext)
-{
-  DALI_ASSERT_ALWAYS( inputMethodContext && "InputMethodContext handle is empty" );
-
-  BaseObject& handle = inputMethodContext.GetBaseObject();
-
-  return static_cast<Internal::Adaptor::InputMethodContext&>(handle);
-}
-
-DALI_IMPORT_API inline static const  Internal::Adaptor::InputMethodContext& GetImplementation(const Dali::InputMethodContext& inputMethodContext)
-{
-  DALI_ASSERT_ALWAYS( inputMethodContext && "InputMethodContext handle is empty" );
-
-  const BaseObject& handle = inputMethodContext.GetBaseObject();
-
-  return static_cast<const Internal::Adaptor::InputMethodContext&>(handle);
-}
-
-};
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_INPUT_METHOD_CONTEXT_H
diff --git a/dali/integration-api/x11/pixmap-render-surface.h b/dali/integration-api/x11/pixmap-render-surface.h
deleted file mode 100644 (file)
index 1dd3c7d..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-#ifndef __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__
-#define __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/x11/ecore-x-render-surface.h>
-
-namespace Dali
-{
-
-namespace ECore
-{
-
-/**
- * Ecore X11 implementation of render surface.
- */
-class PixmapRenderSurface : public EcoreXRenderSurface
-{
-public:
-
-  /**
-    * Uses an X11 surface to render to.
-    * @param [in] positionSize the position and size of the surface
-    * @param [in] surface can be a X-window or X-pixmap (type must be unsigned int).
-    * @param [in] name optional name of surface passed in
-    * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
-    */
-  PixmapRenderSurface( Dali::PositionSize positionSize,
-                       Any surface,
-                       const std::string& name,
-                       bool isTransparent = false);
-
-  /**
-   * @copydoc Dali::RenderSurface::~RenderSurface
-   */
-  virtual ~PixmapRenderSurface();
-
-public: // API
-
-  /**
-   * @copydoc Dali::ECore::EcoreXRenderSurface::GetDrawable()
-   */
-  virtual Ecore_X_Drawable GetDrawable();
-
-  /**
-   * @brief GetSurface
-   *
-   * @return pixmap
-   */
-  virtual Any GetSurface();
-
-public: // from Dali::RenderSurface
-
-  /**
-   * @copydoc Dali::RenderSurface::InitializeEgl()
-   */
-  virtual void InitializeEgl( EglInterface& egl );
-
-  /**
-   * @copydoc Dali::RenderSurface::CreateEglSurface()
-   */
-  virtual void CreateEglSurface( EglInterface& egl );
-
-  /**
-   * @copydoc Dali::RenderSurface::DestroyEglSurface()
-   */
-  virtual void DestroyEglSurface( EglInterface& egl );
-
-  /**
-   * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
-   */
-  virtual bool ReplaceEGLSurface( EglInterface& egl );
-
-  /**
-   * @copydoc Dali::RenderSurface::StartRender()
-   */
-  virtual void StartRender();
-
-  /**
-   * @copydoc Dali::RenderSurface::PreRender()
-   */
-  virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface );
-
-  /**
-   * @copydoc Dali::RenderSurface::PostRender()
-   */
-  virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface );
-
-  /**
-   * @copydoc Dali::RenderSurface::StopRender()
-   */
-  virtual void StopRender();
-
-  /**
-   * @copydoc Dali::RenderSurface::SetThreadSynchronization
-   */
-  virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization );
-
-  virtual RenderSurface::Type GetSurfaceType();
-
-private:
-
-  /**
-   * Release any locks.
-   */
-  void ReleaseLock();
-
-  /**
-   * Create XPixmap
-   */
-  virtual void CreateXRenderable();
-
-  /**
-   * @copydoc Dali::Internal::Adaptor::ECore::RenderSurface::UseExistingRenderable
-   */
-  virtual void UseExistingRenderable( unsigned int surfaceId );
-
-private: // Data
-
-  struct Impl;
-  Impl* mImpl;
-};
-
-} // namespace ECore
-
-} // namespace Dali
-
-#endif // __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__
index af6b0be..d8c92c8 100755 (executable)
@@ -38,7 +38,6 @@
 #include <dali/devel-api/text-abstraction/font-client.h>
 
 #include <dali/internal/system/common/callback-manager.h>
-#include <dali/devel-api/adaptor-framework/render-surface.h>
 #include <dali/internal/accessibility/common/tts-player-impl.h>
 #include <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
 #include <dali/internal/input/common/gesture-manager.h>
@@ -53,6 +52,7 @@
 #include <dali/internal/system/common/object-profiler.h>
 #include <dali/internal/window-system/common/display-connection.h>
 #include <dali/internal/window-system/common/window-impl.h>
+#include <dali/internal/window-system/common/window-render-surface.h>
 
 #include <dali/internal/system/common/logging.h>
 #include <dali/devel-api/adaptor-framework/image-loading.h>
index 5ba149d..5588cd8 100755 (executable)
@@ -28,7 +28,6 @@
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/adaptor.h>
-#include <dali/devel-api/adaptor-framework/render-surface.h>
 #include <dali/public-api/adaptor-framework/tts-player.h>
 #include <dali/devel-api/adaptor-framework/clipboard.h>
 
index 50d7ec3..5d52f9a 100644 (file)
@@ -30,7 +30,7 @@
 #include <dali/internal/system/common/performance-interface.h>
 #include <dali/internal/graphics/common/vsync-monitor-interface.h>
 #include <dali/internal/network/common/trace-interface.h>
-#include <dali/devel-api/adaptor-framework/render-surface.h>
+#include <dali/integration-api/render-surface.h>
 
 
 namespace Dali
index 4b7948f..4086605 100755 (executable)
@@ -24,7 +24,7 @@
 // INTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
 #include <dali/devel-api/adaptor-framework/style-monitor.h>
-#include <dali/devel-api/adaptor-framework/render-surface.h>
+#include <dali/integration-api/render-surface.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
 
 namespace Dali
index da1f3b6..e5a4f45 100644 (file)
@@ -28,6 +28,7 @@
 #include <dali/internal/adaptor/common/framework.h>
 #include <dali/internal/system/common/singleton-service-impl.h>
 #include <dali/internal/adaptor/common/lifecycle-controller-impl.h>
+#include <dali/internal/window-system/common/window-render-surface.h>
 
 namespace Dali
 {
index 35dbcea..c81f12b 100644 (file)
@@ -22,9 +22,8 @@
 #include <app_common.h>
 #ifdef APPCORE_WATCH_AVAILABLE
 #include <screen_connector_provider.h>
-#include <dali/integration-api/wayland/ecore-wl-render-surface.h>
 #endif
-
+#include <Ecore_Wayland.h>
 #include <system_settings.h>
 
 namespace Dali
index d05aefe..641a0cb 100644 (file)
@@ -20,7 +20,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/egl-interface.h>
-#include <dali/devel-api/adaptor-framework/render-surface.h>
+#include <dali/integration-api/render-surface.h>
 
 namespace Dali
 {
index d4f77d9..79a77cc 100644 (file)
@@ -28,7 +28,7 @@
 #include <dali/internal/graphics/common/egl-image-extensions.h>
 #include <dali/internal/graphics/gles20/egl-factory.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
-#include <dali/devel-api/adaptor-framework/render-surface.h>
+#include <dali/integration-api/render-surface.h>
 
 // Allow this to be encoded and saved:
 #include <dali/devel-api/adaptor-framework/bitmap-saver.h>
index 67c9140..9fed477 100644 (file)
@@ -29,7 +29,7 @@
 #include <dali/internal/graphics/gles20/egl-factory.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
 #include <dali/devel-api/adaptor-framework/bitmap-saver.h>
-#include <dali/devel-api/adaptor-framework/render-surface.h>
+#include <dali/integration-api/render-surface.h>
 
 namespace Dali
 {
index 008b44e..b4f71ea 100755 (executable)
@@ -33,7 +33,6 @@
 // INTERNAL INCLUDES
 #include <dali/integration-api/adaptor.h>
 #include <dali/internal/system/common/locale-utils.h>
-#include <dali/internal/window-system/tizen-wayland/window-render-surface-ecore-wl.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
 #include <dali/internal/system/common/singleton-service-impl.h>
 #include <dali/public-api/adaptor-framework/input-method.h>
index 57921d4..7afcf5a 100755 (executable)
@@ -28,7 +28,6 @@
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/adaptor.h>
-#include <dali/internal/window-system/ubuntu-x11/window-render-surface-x.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
 #include <dali/internal/system/common/locale-utils.h>
 #include <dali/internal/system/common/singleton-service-impl.h>
index daaf838..ff3d5c4 100755 (executable)
@@ -89,19 +89,19 @@ public:
    */
   void Deactivate() override;
 
-  // /**
-  //  * @copydoc Dali::InputMethodContext::Reset()
-  //  */
+  /**
+   * @copydoc Dali::InputMethodContext::Reset()
+   */
   void Reset() override;
 
-  // /**
-  //  * @copydoc Dali::InputMethodContext::GetContext()
-  //  */
+  /**
+   * @copydoc Dali::InputMethodContext::GetContext()
+   */
   ImfContext* GetContext() override;
 
-  // /**
-  //  * @copydoc Dali::InputMethodContext::RestoreAfterFocusLost()
-  //  */
+  /**
+   * @copydoc Dali::InputMethodContext::RestoreAfterFocusLost()
+   */
   bool RestoreAfterFocusLost() const override;
 
   /**
@@ -114,24 +114,24 @@ public:
    */
   void PreEditChanged( void* data, ImfContext* imfContext, void* event_info ) override;
 
-  // /**
-  //  * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
-  //  */
+  /**
+   * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
+   */
   void CommitReceived( void* data, ImfContext* imfContext, void* event_info ) override;
 
-  // /**
-  //  * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
-  //  */
+  /**
+   * @copydoc Dali::InputMethodContext::NotifyCursorPosition()
+   */
   bool RetrieveSurrounding( void* data, ImfContext* imfContext, char** text, int* cursorPosition ) override;
 
-  // /**
-  //  * @copydoc Dali::InputMethodContext::DeleteSurrounding()
-  //  */
+  /**
+   * @copydoc Dali::InputMethodContext::DeleteSurrounding()
+   */
   void DeleteSurrounding( void* data, ImfContext* imfContext, void* event_info ) override;
 
-  // /**
-  //  * @copydoc Dali::InputMethodContext::SendPrivateCommand()
-  //  */
+  /**
+   * @copydoc Dali::InputMethodContext::SendPrivateCommand()
+   */
   void SendPrivateCommand( void* data, ImfContext* imfContext, void* event_info ) override
   {}
 
index 9a9243c..bd6188f 100644 (file)
@@ -22,7 +22,7 @@
 #include <dali/public-api/object/any.h>
 
 // INTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/render-surface.h>
+#include <dali/integration-api/render-surface.h>
 
 #include <memory>
 
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -16,7 +16,8 @@
  */
 
 // INTERNAL INCLUDES
-#include <dali/integration-api/wayland/native-render-surface.h>
+#include <dali/integration-api/native-render-surface.h>
+#include <dali/internal/window-system/common/render-surface-factory.h>
 
 namespace Dali
 {
@@ -26,7 +27,9 @@ DALI_EXPORT_API NativeRenderSurface* CreateNativeSurface(
                                      const std::string& name,
                                      bool               isTransparent)
 {
-  return new NativeRenderSurface( positionSize, name, isTransparent );
+  auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
+  auto nativeRenderSurface =  renderSurfaceFactory->CreateNativeRenderSurface( positionSize, name, isTransparent );
+  return nativeRenderSurface.release();
 }
 
 } // namespace Dali
diff --git a/dali/internal/window-system/common/pixmap-render-surface.h b/dali/internal/window-system/common/pixmap-render-surface.h
new file mode 100644 (file)
index 0000000..4b5512f
--- /dev/null
@@ -0,0 +1,99 @@
+#ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_PIXMAP_RENDER_SURFACE_H
+#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_PIXMAP_RENDER_SURFACE_H
+
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/render-surface.h>
+
+namespace Dali
+{
+
+class TriggerEventInterface;
+
+namespace Internal
+{
+namespace Adaptor
+{
+
+/**
+ * Pixmap interface of render surface.
+ */
+class PixmapRenderSurface : public Dali::RenderSurface
+{
+public:
+
+  /**
+   * @brief Default constructor
+   */
+  PixmapRenderSurface() = default;
+
+  /**
+   * @brief Destructor
+   */
+  virtual ~PixmapRenderSurface() = default;
+
+public: // API
+
+  /**
+   * @brief Get the render surface the adaptor is using to render to.
+   * @return reference to current render surface
+   */
+  virtual Any GetSurface() = 0;
+
+  /**
+   * @brief Sets the render notification trigger to call when render thread is completed a frame
+   * @param renderNotification to use
+   */
+  virtual void SetRenderNotification( TriggerEventInterface* renderNotification ) = 0;
+
+private:
+
+  /**
+   * Second stage construction
+   */
+  virtual void Initialize( Any surface ) = 0;
+
+  /**
+   * @brief Create a renderable
+   */
+  virtual void CreateRenderable() = 0;
+
+  /**
+   * @brief Use an existing render surface
+   * @param surfaceId the id of the surface
+   */
+  virtual void UseExistingRenderable( unsigned int surfaceId ) = 0;
+
+protected:
+
+  // Undefined
+  PixmapRenderSurface(const PixmapRenderSurface&) = delete;
+
+  // Undefined
+  PixmapRenderSurface& operator=(const PixmapRenderSurface& rhs) = delete;
+
+};
+
+} // namespace Adaptor
+
+} // namespace internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_PIXMAP_RENDER_SURFACE_H
diff --git a/dali/internal/window-system/common/render-surface-factory.h b/dali/internal/window-system/common/render-surface-factory.h
new file mode 100644 (file)
index 0000000..024adb3
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_RENDER_SURFACE_FACTORY_H
+#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_RENDER_SURFACE_FACTORY_H
+
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/render-surface.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/any.h>
+#include <memory>
+
+namespace Dali
+{
+
+class NativeRenderSurface;
+
+namespace Internal
+{
+namespace Adaptor
+{
+
+class WindowRenderSurface;
+class PixmapRenderSurface;
+
+class RenderSurfaceFactory
+{
+public:
+
+  RenderSurfaceFactory() = default;
+  virtual ~RenderSurfaceFactory() = default;
+
+  virtual std::unique_ptr< WindowRenderSurface > CreateWindowRenderSurface( Dali::PositionSize positionSize, Any surface,
+                                                                            const std::string& name, const std::string& className, bool isTransparent = false ) = 0;
+
+  virtual std::unique_ptr< PixmapRenderSurface > CreatePixmapRenderSurface( Dali::PositionSize positionSize, Any surface,
+                                                                            const std::string& name, bool isTransparent = false ) = 0;
+
+  virtual std::unique_ptr< NativeRenderSurface > CreateNativeRenderSurface( Dali::PositionSize positionSize, const std::string& name, bool isTransparent = false ) = 0;
+};
+
+extern std::unique_ptr< RenderSurfaceFactory > GetRenderSurfaceFactory();
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_RENDER_SURFACE_FACTORY_H
diff --git a/dali/internal/window-system/common/window-base-factory.h b/dali/internal/window-system/common/window-base-factory.h
new file mode 100644 (file)
index 0000000..8944f09
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_FACTORY_H
+#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_FACTORY_H
+
+/*
+ * Copyright (c) 2018 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>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+class WindowBase;
+class Window;
+class WindowRenderSurface;
+
+class WindowBaseFactory
+{
+public:
+
+  WindowBaseFactory() = default;
+  virtual ~WindowBaseFactory() = default;
+
+  virtual std::unique_ptr< Dali::Internal::Adaptor::WindowBase > CreateWindowBase( Window* window, WindowRenderSurface* windowRenderSurface ) = 0;
+};
+
+extern std::unique_ptr< WindowBaseFactory > GetWindowBaseFactory();
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_FACTORY_H
diff --git a/dali/internal/window-system/common/window-base.h b/dali/internal/window-system/common/window-base.h
new file mode 100644 (file)
index 0000000..8f3a69f
--- /dev/null
@@ -0,0 +1,216 @@
+#ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
+#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
+
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/window.h>
+#include <dali/internal/window-system/common/indicator-interface.h>
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <vector>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+/**
+ * WindowBase interface
+ */
+class WindowBase
+{
+public:
+
+  /**
+   * @brief Default constructor
+   */
+  WindowBase() = default;
+
+  /**
+   * @brief Destructor
+   */
+  virtual ~WindowBase() = default;
+
+public:
+
+  /**
+   * Second stage initialization
+   */
+  virtual void Initialize() = 0;
+
+  /**
+   * @copydoc Dali::Window::ShowIndicator()
+   */
+  virtual void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode ) = 0;
+
+  /**
+   * Set the indicator properties on the window
+   */
+  virtual void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ) = 0;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::IndicatorInterface::Observer::IndicatorTypeChanged()
+   */
+  virtual void IndicatorTypeChanged( IndicatorInterface::Type type ) = 0;
+
+  /**
+   * @copydoc Dali::Window::SetClass()
+   */
+  virtual void SetClass( std::string name, std::string className ) = 0;
+
+  /**
+   * @copydoc Dali::Window::Raise()
+   */
+  virtual void Raise() = 0;
+
+  /**
+   * @copydoc Dali::Window::Lower()
+   */
+  virtual void Lower() = 0;
+
+  /**
+   * @copydoc Dali::Window::Activate()
+   */
+  virtual void Activate() = 0;
+
+  /**
+   * @copydoc Dali::Window::SetAvailableOrientations()
+   */
+  virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) = 0;
+
+  /**
+   * @copydoc Dali::Window::SetPreferredOrientation()
+   */
+  virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) = 0;
+
+  /**
+   * @copydoc Dali::Window::SetAcceptFocus()
+   */
+  virtual void SetAcceptFocus( bool accept ) = 0;
+
+  /**
+   * @copydoc Dali::Window::Show()
+   */
+  virtual void Show() = 0;
+
+  /**
+   * @copydoc Dali::Window::Hide()
+   */
+  virtual void Hide() = 0;
+
+  /**
+   * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
+   */
+  virtual unsigned int GetSupportedAuxiliaryHintCount() const = 0;
+
+  /**
+   * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
+   */
+  virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const = 0;
+
+  /**
+   * @copydoc Dali::Window::AddAuxiliaryHint()
+   */
+  virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) = 0;
+
+  /**
+   * @copydoc Dali::Window::RemoveAuxiliaryHint()
+   */
+  virtual bool RemoveAuxiliaryHint( unsigned int id ) = 0;
+
+  /**
+   * @copydoc Dali::Window::SetAuxiliaryHintValue()
+   */
+  virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) = 0;
+
+  /**
+   * @copydoc Dali::Window::GetAuxiliaryHintValue()
+   */
+  virtual std::string GetAuxiliaryHintValue( unsigned int id ) const = 0;
+
+  /**
+   * @copydoc Dali::Window::GetAuxiliaryHintId()
+   */
+  virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const = 0;
+
+  /**
+   * @copydoc Dali::Window::SetInputRegion()
+   */
+  virtual void SetInputRegion( const Rect< int >& inputRegion ) = 0;
+
+  /**
+   * @copydoc Dali::Window::SetType()
+   */
+  virtual void SetType( Dali::Window::Type type ) = 0;
+
+  /**
+   * @copydoc Dali::Window::SetNotificationLevel()
+   */
+  virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) = 0;
+
+  /**
+   * @copydoc Dali::Window::GetNotificationLevel()
+   */
+  virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const = 0;
+
+  /**
+   * @copydoc Dali::Window::SetOpaqueState()
+   */
+  virtual void SetOpaqueState( bool opaque ) = 0;
+
+  /**
+   * @copydoc Dali::Window::SetScreenOffMode()
+   */
+  virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) = 0;
+
+  /**
+   * @copydoc Dali::Window::GetScreenOffMode()
+   */
+  virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const = 0;
+
+  /**
+   * @copydoc Dali::Window::SetBrightness()
+   */
+  virtual bool SetBrightness( int brightness ) = 0;
+
+  /**
+   * @copydoc Dali::Window::GetBrightness()
+   */
+  virtual int GetBrightness() const = 0;
+
+protected:
+
+  // Undefined
+  WindowBase(const WindowBase&) = delete;
+
+  // Undefined
+  WindowBase& operator=(const WindowBase& rhs) = delete;
+
+};
+
+} // namespace Adaptor
+
+} // namespace internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp
new file mode 100644 (file)
index 0000000..caf6f61
--- /dev/null
@@ -0,0 +1,742 @@
+/*
+ * Copyright (c) 2018 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/window-system/common/window-impl.h>
+
+// EXTERNAL HEADERS
+#include <dali/integration-api/core.h>
+#include <dali/integration-api/system-overlay.h>
+#include <dali/public-api/render-tasks/render-task.h>
+#include <dali/public-api/render-tasks/render-task-list.h>
+#include <dali/devel-api/adaptor-framework/orientation.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/input/common/drag-and-drop-detector-impl.h>
+#include <dali/internal/window-system/common/ecore-indicator-impl.h>
+#include <dali/internal/window-system/common/window-visibility-observer.h>
+#include <dali/internal/window-system/common/orientation-impl.h>
+#include <dali/internal/window-system/common/render-surface-factory.h>
+#include <dali/internal/window-system/common/window-base-factory.h>
+#include <dali/internal/window-system/common/window-base.h>
+#include <dali/internal/window-system/common/window-render-surface.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gWindowLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW" );
+#endif
+
+} // unnamed namespace
+
+Window* Window::New( const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent )
+{
+  Window* window = new Window();
+  window->mIsTransparent = isTransparent;
+  window->Initialize( positionSize, name, className );
+  return window;
+}
+
+Window::Window()
+: mSurface( NULL ),
+  mWindowBase(),
+  mIndicatorVisible( Dali::Window::VISIBLE ),
+  mIndicatorIsShown( false ),
+  mShowRotatedIndicatorOnClose( false ),
+  mStarted( false ),
+  mIsTransparent( false ),
+  mIsFocusAcceptable( true ),
+  mVisible( true ),
+  mIconified( false ),
+  mOpaqueState( false ),
+  mResizeEnabled( false ),
+  mIndicator( NULL ),
+  mIndicatorOrientation( Dali::Window::PORTRAIT ),
+  mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
+  mIndicatorOpacityMode( Dali::Window::OPAQUE ),
+  mOverlay( NULL ),
+  mAdaptor( NULL ),
+  mType( Dali::Window::NORMAL ),
+  mPreferredOrientation( Dali::Window::PORTRAIT ),
+  mIndicatorVisibilityChangedSignal(),
+  mFocusChangedSignal(),
+  mResizedSignal(),
+  mDeleteRequestSignal()
+{
+}
+
+Window::~Window()
+{
+  if( mIndicator )
+  {
+    mOverlay->Remove( mIndicator->GetActor() );
+    Dali::RenderTaskList taskList = mOverlay->GetOverlayRenderTasks();
+    Dali::RenderTask indicatorTask = taskList.GetTask(0);
+    mOverlay->GetOverlayRenderTasks().RemoveTask(indicatorTask);
+    mIndicator->Close();
+    delete mIndicator;
+  }
+
+  if ( mAdaptor )
+  {
+    mAdaptor->RemoveObserver( *this );
+    mAdaptor->SetDragAndDropDetector( NULL );
+    mAdaptor = NULL;
+  }
+
+  delete mSurface;
+}
+
+void Window::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className)
+{
+  // create a window render surface
+  Any surface;
+  auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
+  auto windowRenderSurface = renderSurfaceFactory->CreateWindowRenderSurface( positionSize, surface, name, className, mIsTransparent );
+  mSurface = windowRenderSurface.release();
+
+  // create a window base
+  auto windowBaseFactory = Dali::Internal::Adaptor::GetWindowBaseFactory();
+  mWindowBase = windowBaseFactory->CreateWindowBase( this, mSurface );
+
+  mWindowBase->Initialize();
+
+  if( !positionSize.IsEmpty() )
+  {
+    AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
+    mResizeEnabled = true;
+  }
+
+  SetClass( name, className );
+
+  mSurface->Map();
+
+  mOrientation = Orientation::New( this );
+}
+
+void Window::SetAdaptor(Dali::Adaptor& adaptor)
+{
+  DALI_ASSERT_ALWAYS( !mStarted && "Adaptor already started" );
+  mStarted = true;
+
+  // Only create one overlay per window
+  Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation(adaptor);
+  Integration::Core& core = adaptorImpl.GetCore();
+  mOverlay = &core.GetSystemOverlay();
+
+  Dali::RenderTaskList taskList = mOverlay->GetOverlayRenderTasks();
+  taskList.CreateTask();
+
+  mAdaptor = &adaptorImpl;
+  mAdaptor->AddObserver( *this );
+
+  // Can only create the detector when we know the Core has been instantiated.
+  mDragAndDropDetector = DragAndDropDetector::New();
+  mAdaptor->SetDragAndDropDetector( &GetImplementation( mDragAndDropDetector ) );
+
+  if( mOrientation )
+  {
+    mOrientation->SetAdaptor(adaptor);
+  }
+
+  if( mIndicator != NULL )
+  {
+    mIndicator->SetAdaptor(mAdaptor);
+  }
+}
+
+WindowRenderSurface* Window::GetSurface()
+{
+  return mSurface;
+}
+
+void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode )
+{
+  mIndicatorVisible = visibleMode;
+
+  mWindowBase->ShowIndicator( mIndicatorVisible, mIndicatorOpacityMode );
+
+  DoShowIndicator( mIndicatorOrientation );
+}
+
+void Window::SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacityMode )
+{
+  mIndicatorOpacityMode = opacityMode;
+
+  if( mIndicator != NULL )
+  {
+    mIndicator->SetOpacityMode( opacityMode );
+  }
+}
+
+void Window::SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode )
+{
+  mIndicatorVisible = mode;
+}
+
+void Window::RotateIndicator( Dali::Window::WindowOrientation orientation )
+{
+  DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "Orientation: %d\n", orientation );
+
+  DoRotateIndicator( orientation );
+}
+
+void Window::SetClass( std::string name, std::string className )
+{
+  mWindowBase->SetClass( name, className );
+}
+
+void Window::Raise()
+{
+  mWindowBase->Raise();
+}
+
+void Window::Lower()
+{
+  mWindowBase->Lower();
+}
+
+void Window::Activate()
+{
+  mWindowBase->Activate();
+}
+
+void Window::AddAvailableOrientation( Dali::Window::WindowOrientation orientation )
+{
+  bool found = false;
+
+  if( orientation <= Dali::Window::LANDSCAPE_INVERSE )
+  {
+    for( std::size_t i = 0; i < mAvailableOrientations.size(); i++ )
+    {
+      if( mAvailableOrientations[i] == orientation )
+      {
+        found = true;
+        break;
+      }
+    }
+
+    if( !found )
+    {
+      mAvailableOrientations.push_back( orientation );
+      SetAvailableOrientations( mAvailableOrientations );
+    }
+  }
+}
+
+void Window::RemoveAvailableOrientation( Dali::Window::WindowOrientation orientation )
+{
+  for( std::vector<Dali::Window::WindowOrientation>::iterator iter = mAvailableOrientations.begin();
+       iter != mAvailableOrientations.end(); ++iter )
+  {
+    if( *iter == orientation )
+    {
+      mAvailableOrientations.erase( iter );
+      break;
+    }
+  }
+  SetAvailableOrientations( mAvailableOrientations );
+}
+
+void Window::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
+{
+  if( orientations.size() > 4 )
+  {
+    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetAvailableOrientations: Invalid vector size! [%d]\n", orientations.size() );
+    return;
+  }
+
+  mAvailableOrientations = orientations;
+
+  mWindowBase->SetAvailableOrientations( mAvailableOrientations );
+}
+
+const std::vector< Dali::Window::WindowOrientation >& Window::GetAvailableOrientations()
+{
+  return mAvailableOrientations;
+}
+
+void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
+{
+  mPreferredOrientation = orientation;
+
+  mWindowBase->SetPreferredOrientation( mPreferredOrientation );
+}
+
+Dali::Window::WindowOrientation Window::GetPreferredOrientation()
+{
+  return mPreferredOrientation;
+}
+
+Dali::DragAndDropDetector Window::GetDragAndDropDetector() const
+{
+  return mDragAndDropDetector;
+}
+
+Dali::Any Window::GetNativeHandle() const
+{
+  return mSurface->GetWindow();
+}
+
+void Window::SetAcceptFocus( bool accept )
+{
+  mIsFocusAcceptable = accept;
+
+  mWindowBase->SetAcceptFocus( accept );
+}
+
+bool Window::IsFocusAcceptable() const
+{
+  return mIsFocusAcceptable;
+}
+
+void Window::Show()
+{
+  mVisible = true;
+
+  mWindowBase->Show();
+
+  if( !mIconified )
+  {
+    WindowVisibilityObserver* observer( mAdaptor );
+    observer->OnWindowShown();
+    DALI_LOG_RELEASE_INFO( "Window (%p) ::Show()\n", this );
+  }
+}
+
+void Window::Hide()
+{
+  mVisible = false;
+
+  mWindowBase->Hide();
+
+  if( !mIconified )
+  {
+    WindowVisibilityObserver* observer( mAdaptor );
+    observer->OnWindowHidden();
+    DALI_LOG_RELEASE_INFO( "Window (%p) ::Hide() \n", this );
+  }
+}
+
+bool Window::IsVisible() const
+{
+  return mVisible;
+}
+
+unsigned int Window::GetSupportedAuxiliaryHintCount() const
+{
+  return mWindowBase->GetSupportedAuxiliaryHintCount();
+}
+
+std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
+{
+  return mWindowBase->GetSupportedAuxiliaryHint( index );
+}
+
+unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
+{
+  return mWindowBase->AddAuxiliaryHint( hint, value );
+}
+
+bool Window::RemoveAuxiliaryHint( unsigned int id )
+{
+  return mWindowBase->RemoveAuxiliaryHint( id );
+}
+
+bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
+{
+  return mWindowBase->SetAuxiliaryHintValue( id, value );
+}
+
+std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
+{
+  return mWindowBase->GetAuxiliaryHintValue( id );
+}
+
+unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
+{
+  return mWindowBase->GetAuxiliaryHintId( hint );
+}
+
+void Window::SetInputRegion( const Rect< int >& inputRegion )
+{
+  mWindowBase->SetInputRegion( inputRegion );
+
+  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetInputRegion: x = %d, y = %d, w = %d, h = %d\n", inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
+}
+
+void Window::SetType( Dali::Window::Type type )
+{
+  if( type != mType )
+  {
+    mWindowBase->SetType( type );
+
+    mType = type;
+  }
+}
+
+Dali::Window::Type Window::GetType() const
+{
+  return mType;
+}
+
+bool Window::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
+{
+  if( mType != Dali::Window::NOTIFICATION )
+  {
+    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", mType );
+    return false;
+  }
+
+  return mWindowBase->SetNotificationLevel( level );
+}
+
+Dali::Window::NotificationLevel::Type Window::GetNotificationLevel() const
+{
+  if( mType != Dali::Window::NOTIFICATION )
+  {
+    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", mType );
+    return Dali::Window::NotificationLevel::NONE;
+  }
+
+  return mWindowBase->GetNotificationLevel();
+}
+
+void Window::SetOpaqueState( bool opaque )
+{
+  mOpaqueState = opaque;
+
+  mWindowBase->SetOpaqueState( opaque );
+
+  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetOpaqueState: opaque = %d\n", opaque );
+}
+
+bool Window::IsOpaqueState() const
+{
+  return mOpaqueState;
+}
+
+bool Window::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
+{
+  return mWindowBase->SetScreenOffMode( screenOffMode );
+}
+
+Dali::Window::ScreenOffMode::Type Window::GetScreenOffMode() const
+{
+  return mWindowBase->GetScreenOffMode();
+}
+
+bool Window::SetBrightness( int brightness )
+{
+  if( brightness < 0 || brightness > 100 )
+  {
+    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Invalid brightness value [%d]\n", brightness );
+    return false;
+  }
+
+  return mWindowBase->SetBrightness( brightness );
+}
+
+int Window::GetBrightness() const
+{
+  return mWindowBase->GetBrightness();
+}
+
+void Window::SetSize( Dali::Window::WindowSize size )
+{
+  if( !mResizeEnabled )
+  {
+    AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
+    mResizeEnabled = true;
+  }
+
+  PositionSize positionSize = mSurface->GetPositionSize();
+
+  if( positionSize.width != size.GetWidth() || positionSize.height != size.GetHeight() )
+  {
+    positionSize.width = size.GetWidth();
+    positionSize.height = size.GetHeight();
+
+    mSurface->MoveResize( positionSize );
+
+    mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+
+    // Emit signal
+    mResizedSignal.Emit( Dali::Window::WindowSize( positionSize.width, positionSize.height ) );
+
+    mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+  }
+}
+
+Dali::Window::WindowSize Window::GetSize() const
+{
+  PositionSize positionSize = mSurface->GetPositionSize();
+
+  return Dali::Window::WindowSize( positionSize.width, positionSize.height );
+}
+
+void Window::SetPosition( Dali::Window::WindowPosition position )
+{
+  if( !mResizeEnabled )
+  {
+    AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
+    mResizeEnabled = true;
+  }
+
+  PositionSize positionSize = mSurface->GetPositionSize();
+
+  if( positionSize.x != position.GetX() || positionSize.y != position.GetY() )
+  {
+    positionSize.x = position.GetX();
+    positionSize.y = position.GetY();
+
+    mSurface->MoveResize( positionSize );
+  }
+}
+
+Dali::Window::WindowPosition Window::GetPosition() const
+{
+  PositionSize positionSize = mSurface->GetPositionSize();
+
+  return Dali::Window::WindowPosition( positionSize.x, positionSize.y );
+}
+
+void Window::SetTransparency( bool transparent )
+{
+  mSurface->SetTransparency( transparent );
+}
+
+void Window::RotationDone( int orientation, int width, int height )
+{
+  mSurface->RequestRotation( orientation, width, height );
+
+  mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( width, height ) );
+
+  // Emit signal
+  mResizedSignal.Emit( Dali::Window::WindowSize( width, height ) );
+
+  mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( width, height ) );
+}
+
+void Window::OnIconifyChanged( bool iconified )
+{
+  if( iconified )
+  {
+    mIconified = true;
+
+    if( mVisible )
+    {
+      WindowVisibilityObserver* observer( mAdaptor );
+      observer->OnWindowHidden();
+      DALI_LOG_RELEASE_INFO( "Window (%p) Iconified\n", this );
+    }
+  }
+  else
+  {
+    mIconified = false;
+
+    if( mVisible )
+    {
+      WindowVisibilityObserver* observer( mAdaptor );
+      observer->OnWindowShown();
+      DALI_LOG_RELEASE_INFO( "Window (%p) Deiconified\n", this );
+    }
+  }
+}
+
+void Window::OnFocusChanged( bool focusIn )
+{
+  mFocusChangedSignal.Emit( focusIn );
+}
+
+void Window::OnOutputTransformed()
+{
+  PositionSize positionSize = mSurface->GetPositionSize();
+  mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+  mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+}
+
+void Window::OnDeleteRequest()
+{
+  mDeleteRequestSignal.Emit();
+}
+
+void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation )
+{
+  if( mIndicator == NULL )
+  {
+    if( mIndicatorVisible != Dali::Window::INVISIBLE )
+    {
+      mIndicator = new Indicator( mAdaptor, mIndicatorOrientation, this );
+      mIndicator->SetOpacityMode( mIndicatorOpacityMode );
+      Dali::Actor actor = mIndicator->GetActor();
+      SetIndicatorActorRotation();
+      mOverlay->Add(actor);
+    }
+    // else don't create a hidden indicator
+  }
+  else // Already have indicator
+  {
+    if( mIndicatorVisible == Dali::Window::VISIBLE )
+    {
+      // If we are resuming, and rotation has changed,
+      if( mIndicatorIsShown == false && mIndicatorOrientation != mNextIndicatorOrientation )
+      {
+        // then close current indicator and open new one
+        mShowRotatedIndicatorOnClose = true;
+        mIndicator->Close(); // May synchronously call IndicatorClosed() callback & 1 level of recursion
+        // Don't show actor - will contain indicator for old orientation.
+      }
+    }
+  }
+
+  // set indicator visible mode
+  if( mIndicator != NULL )
+  {
+    mIndicator->SetVisible( mIndicatorVisible );
+  }
+
+  bool show = (mIndicatorVisible != Dali::Window::INVISIBLE );
+  SetIndicatorProperties( show, lastOrientation );
+  mIndicatorIsShown = show;
+}
+
+void Window::DoRotateIndicator( Dali::Window::WindowOrientation orientation )
+{
+  if( mIndicatorIsShown )
+  {
+    mShowRotatedIndicatorOnClose = true;
+    mNextIndicatorOrientation = orientation;
+    mIndicator->Close(); // May synchronously call IndicatorClosed() callback
+  }
+  else
+  {
+    // Save orientation for when the indicator is next shown
+    mShowRotatedIndicatorOnClose = false;
+    mNextIndicatorOrientation = orientation;
+  }
+}
+
+void Window::SetIndicatorActorRotation()
+{
+  DALI_LOG_TRACE_METHOD( gWindowLogFilter );
+  DALI_ASSERT_DEBUG( mIndicator != NULL );
+
+  Dali::Actor actor = mIndicator->GetActor();
+  switch( mIndicatorOrientation )
+  {
+    case Dali::Window::PORTRAIT:
+      actor.SetParentOrigin( ParentOrigin::TOP_CENTER );
+      actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
+      actor.SetOrientation( Degree(0), Vector3::ZAXIS );
+      break;
+    case Dali::Window::PORTRAIT_INVERSE:
+      actor.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
+      actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
+      actor.SetOrientation( Degree(180), Vector3::ZAXIS );
+      break;
+    case Dali::Window::LANDSCAPE:
+      actor.SetParentOrigin( ParentOrigin::CENTER_LEFT );
+      actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
+      actor.SetOrientation( Degree(270), Vector3::ZAXIS );
+      break;
+    case Dali::Window::LANDSCAPE_INVERSE:
+      actor.SetParentOrigin( ParentOrigin::CENTER_RIGHT );
+      actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
+      actor.SetOrientation( Degree(90), Vector3::ZAXIS );
+      break;
+  }
+}
+
+void Window::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
+{
+  mWindowBase->SetIndicatorProperties( isShow, lastOrientation );
+}
+
+void Window::IndicatorTypeChanged(Indicator::Type type)
+{
+  mWindowBase->IndicatorTypeChanged( type );
+}
+
+void Window::IndicatorClosed( IndicatorInterface* indicator )
+{
+  DALI_LOG_TRACE_METHOD( gWindowLogFilter );
+
+  if( mShowRotatedIndicatorOnClose )
+  {
+    Dali::Window::WindowOrientation currentOrientation = mIndicatorOrientation;
+    mIndicator->Open( mNextIndicatorOrientation );
+    mIndicatorOrientation = mNextIndicatorOrientation;
+    SetIndicatorActorRotation();
+    DoShowIndicator( currentOrientation );
+  }
+}
+
+void Window::IndicatorVisibilityChanged( bool isVisible )
+{
+  mIndicatorVisibilityChangedSignal.Emit( isVisible );
+}
+
+void Window::OnStart()
+{
+  DoShowIndicator( mIndicatorOrientation );
+}
+
+void Window::OnPause()
+{
+}
+
+void Window::OnResume()
+{
+  // resume indicator status
+  if( mIndicator != NULL )
+  {
+    // Restore own indicator opacity
+    // Send opacity mode to indicator service when app resumed
+    mIndicator->SetOpacityMode( mIndicatorOpacityMode );
+  }
+}
+
+void Window::OnStop()
+{
+  if( mIndicator )
+  {
+    mIndicator->Close();
+  }
+
+  delete mIndicator;
+  mIndicator = NULL;
+}
+
+void Window::OnDestroy()
+{
+  mAdaptor = NULL;
+}
+
+} // Adaptor
+
+} // Internal
+
+} // Dali
index 8a3bcd1..47f8325 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_WINDOW_H__
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
 #include <dali/internal/window-system/common/indicator-interface.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
 #include <dali/public-api/adaptor-framework/window.h>
-#include <dali/devel-api/adaptor-framework/orientation.h>
-#include <dali/devel-api/adaptor-framework/render-surface.h>
 #include <dali/devel-api/adaptor-framework/drag-and-drop-detector.h>
 
 namespace Dali
 {
 class Adaptor;
-class RenderSurface;
 
 namespace Integration
 {
@@ -46,6 +43,8 @@ namespace Internal
 namespace Adaptor
 {
 class Orientation;
+class WindowBase;
+class WindowRenderSurface;
 
 class Window;
 typedef IntrusivePtr<Window> WindowPtr;
@@ -82,7 +81,7 @@ public:
    * Get the window surface
    * @return The render surface
    */
-  RenderSurface* GetSurface();
+  WindowRenderSurface* GetSurface();
 
   /**
    * @copydoc Dali::Window::ShowIndicator()
@@ -95,6 +94,11 @@ public:
   void SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacity );
 
   /**
+   * Set the indicator visible mode
+   */
+  void SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode );
+
+  /**
    * @copydoc Dali::Window::RotateIndicator()
    */
   void RotateIndicator( Dali::Window::WindowOrientation orientation );
@@ -102,7 +106,7 @@ public:
   /**
    * @copydoc Dali::Window::SetClass()
    */
-  void SetClass( std::string name, std::string klass );
+  void SetClass( std::string name, std::string className );
 
   /**
    * @copydoc Dali::Window::Raise()
@@ -187,11 +191,11 @@ public:
   /**
    * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount()
    */
-   unsigned int GetSupportedAuxiliaryHintCount() const;
+  unsigned int GetSupportedAuxiliaryHintCount() const;
 
-   /**
-    * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
-    */
+  /**
+   * @copydoc Dali::Window::GetSupportedAuxiliaryHint()
+   */
   std::string GetSupportedAuxiliaryHint( unsigned int index ) const;
 
   /**
@@ -305,9 +309,24 @@ public:
   void RotationDone( int orientation, int width, int height );
 
   /**
-   * Set the indicator visible mode
+   * Called when the window becomes iconified or deiconified.
    */
-  void SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode );
+  void OnIconifyChanged( bool iconified );
+
+  /**
+   * Called when the window focus is changed.
+   */
+  void OnFocusChanged( bool focusIn );
+
+  /**
+   * Called when the output is transformed.
+   */
+  void OnOutputTransformed();
+
+  /**
+   * Called when the window receives a delete request
+   */
+  void OnDeleteRequest();
 
 private:
   /**
@@ -346,7 +365,7 @@ private:
   /**
    * Set the indicator properties on the window
    */
-  void SetIndicatorProperties( bool isShown, Dali::Window::WindowOrientation lastOrientation );
+  void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation );
 
 private: // IndicatorInterface::Observer interface
 
@@ -416,16 +435,13 @@ public: // Signals
 
 private:
 
-  typedef std::vector< std::pair< std::string, std::string > > AuxiliaryHints;
-
-  RenderSurface*                   mSurface;
+  WindowRenderSurface*             mSurface;
+  std::unique_ptr< WindowBase >    mWindowBase;
   Dali::Window::IndicatorVisibleMode mIndicatorVisible; ///< public state
   bool                             mIndicatorIsShown:1; ///< private state
   bool                             mShowRotatedIndicatorOnClose:1;
   bool                             mStarted:1;
   bool                             mIsTransparent:1;
-  bool                             mWMRotationAppSet:1;
-  bool                             mEcoreEventHander:1;
   bool                             mIsFocusAcceptable:1;
   bool                             mVisible:1;
   bool                             mIconified:1;
@@ -438,18 +454,12 @@ private:
   Integration::SystemOverlay*      mOverlay;
   Adaptor*                         mAdaptor;
   Dali::DragAndDropDetector        mDragAndDropDetector;
-  Dali::Window::Type          mType;
-
-  struct EventHandler;
-  EventHandler*                    mEventHandler;
+  Dali::Window::Type               mType;
 
   OrientationPtr                               mOrientation;
   std::vector<Dali::Window::WindowOrientation> mAvailableOrientations;
   Dali::Window::WindowOrientation              mPreferredOrientation;
 
-  std::vector< std::string >        mSupportedAuxiliaryHints;
-  AuxiliaryHints                    mAuxiliaryHints;
-
   // Signals
   IndicatorSignalType mIndicatorVisibilityChangedSignal;
   FocusSignalType     mFocusChangedSignal;
@@ -478,5 +488,4 @@ inline const Internal::Adaptor::Window& GetImplementation(const Dali::Window& wi
 
 } // namespace Dali
 
-
 #endif // __DALI_INTERNAL_WINDOW_H__
diff --git a/dali/internal/window-system/common/window-render-surface.h b/dali/internal/window-system/common/window-render-surface.h
new file mode 100644 (file)
index 0000000..1e0e5b0
--- /dev/null
@@ -0,0 +1,118 @@
+#ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_RENDER_SURFACE_H
+#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_RENDER_SURFACE_H
+
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/render-surface.h>
+
+namespace Dali
+{
+
+class TriggerEventInterface;
+
+namespace Internal
+{
+namespace Adaptor
+{
+
+/**
+ * Window interface of render surface.
+ */
+class WindowRenderSurface : public Dali::RenderSurface
+{
+public:
+
+  /**
+   * @brief Default constructor
+   */
+  WindowRenderSurface() = default;
+
+  /**
+   * @brief Destructor
+   */
+  virtual ~WindowRenderSurface() = default;
+
+public: // API
+
+  /**
+   * @brief Get the render surface the adaptor is using to render to.
+   * @return reference to current render surface
+   */
+  virtual Any GetWindow() = 0;
+
+  /**
+   * @brief Map window
+   */
+  virtual void Map() = 0;
+
+  /**
+   * @brief Sets the render notification trigger to call when render thread is completed a frame
+   * @param renderNotification to use
+   */
+  virtual void SetRenderNotification( TriggerEventInterface* renderNotification ) = 0;
+
+  /**
+   * @brief Sets whether the surface is transparent or not.
+   * @param[in] transparent Whether the surface is transparent
+   */
+  virtual void SetTransparency( bool transparent ) = 0;
+
+  /**
+   * Request surface rotation
+   * @param[in] angle A new angle of the surface
+   * @param[in] width A new width of the surface
+   * @param[in] height A new height of the surface
+   */
+  virtual void RequestRotation( int angle, int width, int height ) = 0;
+
+protected:
+
+  /**
+   * @brief Second stage construction
+   */
+  virtual void Initialize( Any surface ) = 0;
+
+  /**
+   * @brief Create window
+   */
+  virtual void CreateRenderable() = 0;
+
+  /**
+   * @brief Use an existing render surface
+   * @param surfaceId the id of the surface
+   */
+  virtual void UseExistingRenderable( unsigned int surfaceId ) = 0;
+
+protected:
+
+  // Undefined
+  WindowRenderSurface(const WindowRenderSurface&) = delete;
+
+  // Undefined
+  WindowRenderSurface& operator=(const WindowRenderSurface& rhs) = delete;
+
+}; // class WindowRenderSurface
+
+} // namespace Adaptor
+
+} // namespace internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_RENDER_SURFACE_H
index d272ee9..076dc72 100644 (file)
@@ -7,38 +7,29 @@ adaptor_window_system_common_src_files=\
     ${adaptor_window_system_dir}/common/ecore-indicator-impl.cpp \
     ${adaptor_window_system_dir}/common/ecore-server-connection.cpp \
     ${adaptor_window_system_dir}/common/indicator-buffer.cpp \
-    ${adaptor_window_system_dir}/common/orientation-impl.cpp
-
-# module: window-system, backend: tizen
-adaptor_window_system_tizen_src_files=\
-    ${adaptor_window_system_dir}/tizen/native-render-surface-tizen.cpp
-
-# module: window-system, backend: tizen-mobile
-adaptor_window_system_tizen_mobile_src_files=\
-    ${adaptor_window_system_dir}/tizen-mobile/native-render-surface-factory-mobile.cpp
+    ${adaptor_window_system_dir}/common/native-render-surface-factory.cpp \
+    ${adaptor_window_system_dir}/common/orientation-impl.cpp \
+    ${adaptor_window_system_dir}/common/window-impl.cpp
 
 # module: window-system, backend: tizen-wayland
 adaptor_window_system_tizen_wayland_src_files=\
     ${adaptor_window_system_dir}/tizen-wayland/display-connection-factory-ecore-wl.cpp \
     ${adaptor_window_system_dir}/tizen-wayland/display-connection-impl-ecore-wl.cpp \
     ${adaptor_window_system_dir}/tizen-wayland/event-handler-ecore-wl.cpp \
-    ${adaptor_window_system_dir}/tizen-wayland/pixmap-render-surface-ecore-wl.cpp \
-    ${adaptor_window_system_dir}/tizen-wayland/render-surface-ecore-wl.cpp \
-    ${adaptor_window_system_dir}/tizen-wayland/window-impl-ecore-wl.cpp \
-    ${adaptor_window_system_dir}/tizen-wayland/window-render-surface-ecore-wl.cpp
-
-# module: window-system, backend: tizen-wearable
-adaptor_window_system_tizen_wearable_src_files=\
-    ${adaptor_window_system_dir}/tizen-wearable/native-render-surface-factory-wearable.cpp
+    ${adaptor_window_system_dir}/tizen-wayland/native-render-surface-ecore-wl.cpp \
+    ${adaptor_window_system_dir}/tizen-wayland/render-surface-factory-ecore-wl.cpp \
+    ${adaptor_window_system_dir}/tizen-wayland/window-render-surface-ecore-wl.cpp \
+    ${adaptor_window_system_dir}/tizen-wayland/window-base-ecore-wl.cpp \
+    ${adaptor_window_system_dir}/tizen-wayland/window-base-factory-ecore-wl.cpp
 
 # module: window-system, backend: ubuntu-x11
 adaptor_window_system_ubuntu_x11_src_files=\
     ${adaptor_window_system_dir}/ubuntu-x11/display-connection-factory-x.cpp \
     ${adaptor_window_system_dir}/ubuntu-x11/display-connection-impl-x.cpp \
     ${adaptor_window_system_dir}/ubuntu-x11/event-handler-ecore-x.cpp \
-    ${adaptor_window_system_dir}/ubuntu-x11/render-surface-ecore-x.cpp \
+    ${adaptor_window_system_dir}/ubuntu-x11/pixmap-render-surface-ecore-x.cpp \
     ${adaptor_window_system_dir}/ubuntu-x11/render-surface-factory-ecore-x.cpp \
     ${adaptor_window_system_dir}/ubuntu-x11/window-interface-ecore-x.cpp \
-    ${adaptor_window_system_dir}/ubuntu-x11/window-impl-x.cpp \
-    ${adaptor_window_system_dir}/ubuntu-x11/window-render-surface-x.cpp \
-    ${adaptor_window_system_dir}/tizen/pixmap-render-surface-x.cpp
\ No newline at end of file
+    ${adaptor_window_system_dir}/ubuntu-x11/window-render-surface-ecore-x.cpp \
+    ${adaptor_window_system_dir}/ubuntu-x11/window-base-ecore-x.cpp \
+    ${adaptor_window_system_dir}/ubuntu-x11/window-base-factory-ecore-x.cpp
diff --git a/dali/internal/window-system/tizen-mobile/native-render-surface-factory-mobile.cpp b/dali/internal/window-system/tizen-mobile/native-render-surface-factory-mobile.cpp
deleted file mode 100644 (file)
index 5435eba..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/wayland/native-render-surface.h>
-
-namespace Dali
-{
-
-DALI_EXPORT_API NativeRenderSurface* CreateNativeSurface(
-                                     PositionSize       positionSize,
-                                     const std::string& name,
-                                     bool               isTransparent)
-{
-  return new NativeRenderSurface( positionSize, name, isTransparent );
-}
-
-} // namespace Dali
index 42ffab6..62aa28f 100755 (executable)
@@ -23,7 +23,7 @@
 #include <dali/integration-api/debug.h>
 
 // INTERNAL HEADERS
-#include <dali/integration-api/wayland/native-render-surface.h>
+#include <dali/integration-api/native-render-surface.h>
 
 namespace Dali
 {
@@ -43,7 +43,7 @@ DisplayConnection* DisplayConnectionEcoreWl::New()
 
 DisplayConnectionEcoreWl::DisplayConnectionEcoreWl()
 : mDisplay( NULL ),
-  mSurfaceType( RenderSurface::ECORE_RENDER_SURFACE )
+  mSurfaceType( RenderSurface::WINDOW_RENDER_SURFACE )
 {
 }
 
index 75f6888..5e6294f 100644 (file)
@@ -21,7 +21,7 @@
 // EXTERNAL INCLUDES
 #include <wayland-egl.h>
 #include <Ecore_Wayland.h>
-#include <dali/integration-api/wayland/wl-types.h>
+#include <dali/internal/window-system/tizen-wayland/wl-types.h>
 
 // INTERNAL INCLUDES
 #include <dali/internal/window-system/common/display-connection-impl.h>
diff --git a/dali/internal/window-system/tizen-wayland/display-connection-impl-wl.h b/dali/internal/window-system/tizen-wayland/display-connection-impl-wl.h
deleted file mode 100644 (file)
index 9b2202f..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-#ifndef DALI_INTERNAL_WINDOWSYSTEM_WAYLAND_DISPLAY_CONNECTION_IMPL_WL_H
-#define DALI_INTERNAL_WINDOWSYSTEM_WAYLAND_DISPLAY_CONNECTION_IMPL_WL_H
-
-/*
- * Copyright (c) 2015 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 <wayland-egl.h>
-#include <dali/integration-api/wayland/wl-types.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/window-system/common/display-connection.h>
-#include <dali/public-api/object/base-object.h>
-#include <dali/internal/graphics/gles20/egl-implementation.h>
-
-namespace Dali
-{
-
-class RenderSurface;
-class DisplayConnection;
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-/**
- * DisplayConnection implementation
- */
-class DisplayConnection : public Dali::BaseObject
-{
-public:
-
-  /**
-   * @brief Default constructor
-   */
-  DisplayConnection();
-
-  /**
-   * @brief Create an initialized DisplayConnection.
-   *
-   * @return A handle to a newly allocated DisplayConnection resource.
-   */
-  static DisplayConnection* New();
-
-public:
-
-  /**
-   * @copydoc Dali::DisplayConnection::GetDisplay
-   */
-  Any GetDisplay();
-
-  /**
-   * @copydoc Dali::DisplayConnection::GetDpi
-   */
-  static void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical);
-
-  /**
-   * @copydoc Dali::DisplayConnection::ConsumeEvents
-   */
-  void ConsumeEvents();
-
-  /**
-   * @copydoc Dali::DisplayConnection::InitializeEgl
-   */
-  bool InitializeEgl(EglInterface& egl);
-
-  void SetSurfaceType( RenderSurface::Type type );
-
-public:
-
-  /**
-   * Destructor
-   */
-  virtual ~DisplayConnection();
-
-protected:
-
-  EGLNativeDisplayType GetNativeDisplay();
-
-  void ReleaseNativeDisplay();
-
-  // Undefined
-  DisplayConnection(const DisplayConnection&);
-
-  // Undefined
-  DisplayConnection& operator=(const DisplayConnection& rhs);
-
-private:
-  WlDisplay*   mDisplay;        ///< Wayland-display for rendering
-};
-
-} // namespace Adaptor
-
-} // namespace internal
-
-} // namespace Dali
-
-#endif // DALI_INTERNAL_WINDOWSYSTEM_WAYLAND_DISPLAY_CONNECTION_IMPL_WL_H
index 40fabf5..6cdb165 100755 (executable)
@@ -25,8 +25,6 @@
 #include <Ecore.h>
 #include <Ecore_Input.h>
 #include <Ecore_IMF.h>
-#include <dali/integration-api/wayland/ecore-wl-render-surface.h>
-//#include <dali/window-system/tizen-wayland/window-render-surface-ecore-wl.h>
 #include <cstring>
 
 #include <sys/time.h>
@@ -1273,8 +1271,8 @@ EventHandler::EventHandler( RenderSurface* surface, CoreEventInterface& coreEven
 {
   Ecore_Wl_Window* window = 0;
 
-  // this code only works with the Ecore RenderSurface so need to downcast
-  ECore::WindowRenderSurface* ecoreSurface = dynamic_cast< ECore::WindowRenderSurface* >( surface );
+  // this code only works with the WindowRenderSurface so need to downcast
+  WindowRenderSurfaceEcoreWl* ecoreSurface = static_cast< WindowRenderSurfaceEcoreWl* >( surface );
   if( ecoreSurface )
   {
     window = ecoreSurface->GetWlWindow();
diff --git a/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp b/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp
new file mode 100644 (file)
index 0000000..7ecfce7
--- /dev/null
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 2018 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/gl-abstraction.h>
+#include <dali/integration-api/debug.h>
+
+#include <Ecore_Wayland.h>
+#include <tbm_bufmgr.h>
+#include <tbm_surface_internal.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/trigger-event.h>
+#include <dali/internal/graphics/gles20/egl-implementation.h>
+#include <dali/internal/window-system/common/display-connection.h>
+#include <dali/integration-api/thread-synchronization-interface.h>
+
+namespace Dali
+{
+
+namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gNativeSurfaceLogFilter = Debug::Filter::New(Debug::Verbose, false, "LOG_NATIVE_RENDER_SURFACE");
+#endif
+
+} // unnamed namespace
+
+NativeRenderSurfaceEcoreWl::NativeRenderSurfaceEcoreWl( Dali::PositionSize positionSize, const std::string& name, bool isTransparent )
+: mPosition( positionSize ),
+  mTitle( name ),
+  mRenderNotification( NULL ),
+  mColorDepth( isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24 ),
+  mTbmFormat( isTransparent ? TBM_FORMAT_ARGB8888 : TBM_FORMAT_RGB888 ),
+  mOwnSurface( false ),
+  mDrawableCompleted( false ),
+  mTbmQueue( NULL ),
+  mConsumeSurface( NULL ),
+  mThreadSynchronization( NULL )
+{
+  ecore_wl_init( NULL );
+  CreateNativeRenderable();
+  setenv( "EGL_PLATFORM", "tbm", 1 );
+}
+
+NativeRenderSurfaceEcoreWl::~NativeRenderSurfaceEcoreWl()
+{
+  // release the surface if we own one
+  if( mOwnSurface )
+  {
+    ReleaseDrawable();
+
+    if( mTbmQueue )
+    {
+      tbm_surface_queue_destroy( mTbmQueue );
+    }
+
+    DALI_LOG_INFO( gNativeSurfaceLogFilter, Debug::General, "Own tbm surface queue destroy\n" );
+  }
+}
+
+Any NativeRenderSurfaceEcoreWl::GetDrawable()
+{
+  return mConsumeSurface;
+}
+
+void NativeRenderSurfaceEcoreWl::SetRenderNotification( TriggerEventInterface* renderNotification )
+{
+  mRenderNotification = renderNotification;
+}
+
+void NativeRenderSurfaceEcoreWl::WaitUntilSurfaceReplaced()
+{
+  ConditionalWait::ScopedLock lock( mTbmSurfaceCondition );
+  while( !mDrawableCompleted )
+  {
+    mTbmSurfaceCondition.Wait( lock );
+  }
+
+  mDrawableCompleted = false;
+}
+
+PositionSize NativeRenderSurfaceEcoreWl::GetPositionSize() const
+{
+  return mPosition;
+}
+
+void NativeRenderSurfaceEcoreWl::InitializeEgl( EglInterface& egl )
+{
+  DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter );
+  unsetenv( "EGL_PLATFORM" );
+
+  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+
+  eglImpl.ChooseConfig( true, mColorDepth );
+}
+
+void NativeRenderSurfaceEcoreWl::CreateEglSurface( EglInterface& egl )
+{
+  DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter );
+
+  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+
+  eglImpl.CreateSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( mTbmQueue ), mColorDepth );
+}
+
+void NativeRenderSurfaceEcoreWl::DestroyEglSurface( EglInterface& egl )
+{
+  DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter );
+
+  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+  eglImpl.DestroySurface();
+}
+
+bool NativeRenderSurfaceEcoreWl::ReplaceEGLSurface( EglInterface& egl )
+{
+  DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter );
+
+  if( !mTbmQueue )
+  {
+    return false;
+  }
+
+  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+
+  return eglImpl.ReplaceSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( mTbmQueue ) );
+}
+
+void NativeRenderSurfaceEcoreWl::MoveResize( Dali::PositionSize positionSize )
+{
+}
+
+void NativeRenderSurfaceEcoreWl::SetViewMode( ViewMode viewMode )
+{
+}
+
+void NativeRenderSurfaceEcoreWl::StartRender()
+{
+}
+
+bool NativeRenderSurfaceEcoreWl::PreRender( EglInterface&, Integration::GlAbstraction&, bool )
+{
+  // nothing to do for pixmaps
+  return true;
+}
+
+void NativeRenderSurfaceEcoreWl::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface )
+{
+  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+  eglImpl.SwapBuffers();
+
+  if( mThreadSynchronization )
+  {
+    mThreadSynchronization->PostRenderStarted();
+  }
+
+  if( tbm_surface_queue_can_acquire( mTbmQueue, 1 ) )
+  {
+    if( tbm_surface_queue_acquire( mTbmQueue, &mConsumeSurface ) != TBM_SURFACE_QUEUE_ERROR_NONE )
+    {
+      DALI_LOG_ERROR( "Failed to aquire a tbm_surface\n" );
+      return;
+    }
+  }
+
+  tbm_surface_internal_ref( mConsumeSurface );
+
+  if( replacingSurface )
+  {
+    ConditionalWait::ScopedLock lock( mTbmSurfaceCondition );
+    mDrawableCompleted = true;
+    mTbmSurfaceCondition.Notify( lock );
+  }
+
+ // create damage for client applications which wish to know the update timing
+  if( !replacingSurface && mRenderNotification )
+  {
+    // use notification trigger
+    // Tell the event-thread to render the tbm_surface
+    mRenderNotification->Trigger();
+  }
+
+  if( mThreadSynchronization )
+  {
+    // wait until the event-thread completed to use the tbm_surface
+    mThreadSynchronization->PostRenderWaitForCompletion();
+  }
+
+  // release the consumed surface after post render was completed
+  ReleaseDrawable();
+}
+
+void NativeRenderSurfaceEcoreWl::StopRender()
+{
+  ReleaseLock();
+}
+
+void NativeRenderSurfaceEcoreWl::SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization )
+{
+  mThreadSynchronization = &threadSynchronization;
+}
+
+RenderSurface::Type NativeRenderSurfaceEcoreWl::GetSurfaceType()
+{
+  return RenderSurface::NATIVE_RENDER_SURFACE;
+}
+
+void NativeRenderSurfaceEcoreWl::ReleaseLock()
+{
+  if( mThreadSynchronization )
+  {
+    mThreadSynchronization->PostRenderComplete();
+  }
+}
+
+void NativeRenderSurfaceEcoreWl::CreateNativeRenderable()
+{
+  // check we're creating one with a valid size
+  DALI_ASSERT_ALWAYS( mPosition.width > 0 && mPosition.height > 0 && "tbm_surface size is invalid" );
+
+  mTbmQueue = tbm_surface_queue_create( 3, mPosition.width, mPosition.height, mTbmFormat, TBM_BO_DEFAULT );
+
+  if( mTbmQueue )
+  {
+    mOwnSurface = true;
+  }
+  else
+  {
+    mOwnSurface = false;
+  }
+}
+
+void NativeRenderSurfaceEcoreWl::ReleaseDrawable()
+{
+  if( mConsumeSurface )
+  {
+    tbm_surface_internal_unref( mConsumeSurface );
+
+    if( tbm_surface_internal_is_valid( mConsumeSurface ) )
+    {
+      tbm_surface_queue_release( mTbmQueue, mConsumeSurface );
+    }
+    mConsumeSurface = NULL;
+  }
+}
+
+} // namespace Dali
@@ -1,8 +1,8 @@
-#ifndef __DALI_NATIVE_RENDER_SURFACE_H__
-#define __DALI_NATIVE_RENDER_SURFACE_H__
+#ifndef DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_SURFACE_ECORE_WL_H
+#define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_SURFACE_ECORE_WL_H
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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 <tbm_surface.h>
+#include <tbm_surface_queue.h>
 #include <dali/public-api/common/dali-common.h>
+#include <dali/devel-api/threading/conditional-wait.h>
 
 // INTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/render-surface.h>
-#ifdef DALI_ADAPTOR_COMPILATION
-#include <dali/integration-api/egl-interface.h>
-#else
-#include <dali/integration-api/adaptors/egl-interface.h>
-#endif
+#include <dali/integration-api/native-render-surface.h>
 
 namespace Dali
 {
 
-class TriggerEventInterface;
-
 /**
- * Ecore X11 implementation of render surface.
+ * Ecore Wayland Native implementation of render surface.
  */
-class DALI_IMPORT_API NativeRenderSurface : public Dali::RenderSurface
+class NativeRenderSurfaceEcoreWl : public Dali::NativeRenderSurface
 {
 public:
 
@@ -48,41 +43,31 @@ public:
     * @param [in] name optional name of surface passed in
     * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
     */
-  NativeRenderSurface( Dali::PositionSize positionSize,
+  NativeRenderSurfaceEcoreWl( Dali::PositionSize positionSize,
                              const std::string& name,
                              bool isTransparent = false );
 
   /**
-   * @copydoc Dali::RenderSurface::~RenderSurface
+   * @brief Destructor
    */
-  virtual ~NativeRenderSurface();
-
-public: // API
+  virtual ~NativeRenderSurfaceEcoreWl();
 
-  /**
-   * @brief Sets the render notification trigger to call when render thread is completed a frame
-   *
-   * @param renderNotification to use
-   */
-  void SetRenderNotification( TriggerEventInterface* renderNotification );
+public: // from WindowRenderSurface
 
   /**
-   * @brief Gets the tbm surface for offscreen rendering
+   * @copydoc Dali::NativeRenderSurface::GetSurface()
    */
-  virtual tbm_surface_h GetDrawable();
+  virtual Any GetDrawable() override;
 
   /**
-   * @brief Gets the surface
-   *
-   * @return TBM surface
+   * @copydoc Dali::NativeRenderSurface::SetRenderNotification()
    */
-  virtual Any GetSurface();
+  virtual void SetRenderNotification( TriggerEventInterface* renderNotification ) override;
 
   /**
-   * @brief Waits until surface is replaced
-   * After tbm surface is acquired in PostRender, this function is finished.
+   * @copydoc Dali::NativeRenderSurface::WaitUntilSurfaceReplaced()
    */
-  void WaitUntilSurfaceReplaced();
+  virtual void WaitUntilSurfaceReplaced() override;
 
 public: // from Dali::RenderSurface
 
@@ -154,28 +139,37 @@ public: // from Dali::RenderSurface
 private:
 
   /**
-   * Release any locks.
+   * @copydoc Dali::RenderSurface::ReleaseLock()
    */
-  void ReleaseLock();
+  virtual void ReleaseLock() override;
 
   /**
-   * Create tbm surface
+   * @copydoc Dali::NativeRenderSurface::CreateNativeRenderable()
    */
-  virtual void CreateNativeRenderable();
+  virtual void CreateNativeRenderable() override;
 
   /**
-   * Release tbm surface
+   * @copydoc Dali::NativeRenderSurface::ReleaseDrawable()
    */
-  void ReleaseDrawable();
+  virtual void ReleaseDrawable() override;
 
 private: // Data
 
-  struct Impl;
+  PositionSize                    mPosition;
+  std::string                     mTitle;
+  TriggerEventInterface*          mRenderNotification;
+  ColorDepth                      mColorDepth;
+  tbm_format                      mTbmFormat;
+  bool                            mOwnSurface;
+  bool                            mDrawableCompleted;
 
-  Impl* mImpl;
+  tbm_surface_queue_h             mTbmQueue;
+  tbm_surface_h                   mConsumeSurface;
+  ThreadSynchronizationInterface* mThreadSynchronization;     ///< A pointer to the thread-synchronization
+  ConditionalWait                 mTbmSurfaceCondition;
 
 };
 
 } // namespace Dali
 
-#endif // __DALI_NATIVE_RENDER_SURFACE_H__
+#endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_SURFACE_ECORE_WL_H
diff --git a/dali/internal/window-system/tizen-wayland/pixmap-render-surface-ecore-wl.cpp b/dali/internal/window-system/tizen-wayland/pixmap-render-surface-ecore-wl.cpp
deleted file mode 100644 (file)
index d8aa702..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// CLASS HEADER
-#include <dali/integration-api/wayland/pixmap-render-surface.h>
-
-// EXTERNAL INCLUDES
-#include <dali/integration-api/gl-abstraction.h>
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/wayland/wl-types.h>
-#include <dali/internal/system/common/trigger-event.h>
-#include <dali/internal/graphics/gles20/egl-implementation.h>
-#include <dali/internal/window-system/common/display-connection.h>
-
-namespace Dali
-{
-
-#if defined(DEBUG_ENABLED)
-extern Debug::Filter* gRenderSurfaceLogFilter;
-#endif
-
-namespace ECore
-{
-
-PixmapRenderSurface::PixmapRenderSurface(Dali::PositionSize positionSize,
-                                         Any surface,
-                                         const std::string& name,
-                                         bool isTransparent)
-: EcoreWlRenderSurface( positionSize, surface, name, isTransparent )
-{
-  Init( surface );
-}
-
-PixmapRenderSurface::~PixmapRenderSurface()
-{
-  // release the surface if we own one
-  if( mOwnSurface )
-  {
-    //TODO: if we did create the pixmap, delete the pixmap
-  }
-}
-
-Ecore_Wl_Window* PixmapRenderSurface::GetDrawable()
-{
-  return NULL;
-}
-
-Any PixmapRenderSurface::GetSurface()
-{
-  return Any( NULL );
-}
-
-void PixmapRenderSurface::InitializeEgl( EglInterface& egl )
-{
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
-
-  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
-
-  eglImpl.ChooseConfig(false, mColorDepth);
-}
-
-void PixmapRenderSurface::CreateEglSurface( EglInterface& egl )
-{
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
-
-  // create the EGL surface
-  // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
-  // FIXME
-}
-
-void PixmapRenderSurface::DestroyEglSurface( EglInterface& egl )
-{
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
-
-  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
-  eglImpl.DestroySurface();
-}
-
-bool PixmapRenderSurface::ReplaceEGLSurface( EglInterface& egl )
-{
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
-
-  // a new surface for the new pixmap
-  // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
-  // FIXME
-  return false;
-}
-
-void PixmapRenderSurface::StartRender()
-{
-  // FIXME
-}
-
-bool PixmapRenderSurface::PreRender( EglInterface&, Integration::GlAbstraction&, bool )
-{
-  // nothing to do for pixmaps
-  return true;
-}
-
-void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface )
-{
-  // flush gl instruction queue
-  glAbstraction.Flush();
-
- // create damage for client applications which wish to know the update timing
-  if( mRenderNotification )
-  {
-    // use notification trigger
-    // Tell the event-thread to render the pixmap
-    mRenderNotification->Trigger();
-  }
-  else
-  {
-    // FIXME
-  }
-
-  // Do render synchronisation
-  // AcquireLock( replacingSurface ? SYNC_MODE_NONE : SYNC_MODE_WAIT );
-}
-
-void PixmapRenderSurface::StopRender()
-{
-  // FIXME
-}
-
-void PixmapRenderSurface::SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization )
-{
-  // Nothing to do
-}
-
-void PixmapRenderSurface::CreateWlRenderable()
-{
-  // check we're creating one with a valid size
-  DALI_ASSERT_ALWAYS( mPositionSize.width > 0 && mPositionSize.height > 0 && "Pixmap size is invalid" );
-
-  // FIXME
-}
-
-void PixmapRenderSurface::UseExistingRenderable( unsigned int surfaceId )
-{
-  // FIXME
-}
-
-void PixmapRenderSurface::SetSyncMode( SyncMode syncMode )
-{
-  // FIXME
-}
-
-void PixmapRenderSurface::AcquireLock()
-{
-  // FIXME
-}
-
-void PixmapRenderSurface::ReleaseLock()
-{
-  // FIXME
-}
-
-} // namespace ECore
-
-} // namespace Dali
diff --git a/dali/internal/window-system/tizen-wayland/render-surface-ecore-wl.cpp b/dali/internal/window-system/tizen-wayland/render-surface-ecore-wl.cpp
deleted file mode 100644 (file)
index fbec6cd..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/integration-api/wayland/ecore-wl-render-surface.h>
-
-// EXTERNAL INCLUDES
-#include <dali/integration-api/gl-abstraction.h>
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/wayland/wl-types.h>
-#include <dali/internal/system/common/trigger-event.h>
-#include <dali/internal/graphics/gles20/egl-implementation.h>
-
-namespace Dali
-{
-
-#if defined(DEBUG_ENABLED)
-Debug::Filter* gRenderSurfaceLogFilter = Debug::Filter::New(Debug::Verbose, false, "LOG_ECORE_WL_RENDER_SURFACE");
-#endif
-
-namespace ECore
-{
-
-EcoreWlRenderSurface::EcoreWlRenderSurface(Dali::PositionSize positionSize,
-                                           Any surface,
-                                           const std::string& name,
-                                           bool isTransparent)
-: mPositionSize( positionSize ),
-  mTitle( name ),
-  mRenderNotification( NULL ),
-  mColorDepth( isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24 ),
-  mOwnSurface( false )
-{
-}
-
-void EcoreWlRenderSurface::Init( Any surface )
-{
-  // see if there is a surface in Any surface
-  unsigned int surfaceId  = GetSurfaceId( surface );
-
-  // if the surface is empty, create a new one.
-  if ( surfaceId == 0 )
-  {
-    // we own the surface about to created
-    ecore_wl_init(NULL);
-    mOwnSurface = true;
-    CreateWlRenderable();
-  }
-  else
-  {
-    // XLib should already be initialized so no point in calling XInitThreads
-    UseExistingRenderable( surfaceId );
-  }
-
-#ifdef DEBUG_ENABLED
-  // prints out 'INFO: DALI: new EcoreWlRenderSurface, created display xx, used existing surface xx
-  // we can not use LOG_INFO because the surface can be created before Dali Core is created.
-  // TODO: Overy tizen 3.0, we don't use X anymore. Change this for Tizen 3.0
-  /*
-  printf( "INFO: DALI: new EcoreWlRenderSurface, %s %s surface %X \n",
-          mOwnSurface?"created":"used existing",
-          Dali::RenderSurface::PIXMAP==mType?" pixmap" :"window",
-          AnyCast<Ecore_X_Drawable>( GetSurface() ) );
-  */
-#endif
-}
-
-EcoreWlRenderSurface::~EcoreWlRenderSurface()
-{
-  if( mOwnSurface )
-  {
-    ecore_wl_shutdown();
-  }
-}
-
-void EcoreWlRenderSurface::SetRenderNotification(TriggerEventInterface* renderNotification)
-{
-  mRenderNotification = renderNotification;
-}
-
-Ecore_Wl_Window* EcoreWlRenderSurface::GetWlWindow()
-{
-  return 0;
-}
-
-Ecore_Wl_Window* EcoreWlRenderSurface::GetDrawable()
-{
-  return 0;
-}
-
-PositionSize EcoreWlRenderSurface::GetPositionSize() const
-{
-  return mPositionSize;
-}
-
-void EcoreWlRenderSurface::MoveResize( Dali::PositionSize positionSize )
-{
-  // nothing to do in base class
-}
-
-void EcoreWlRenderSurface::SetViewMode( ViewMode viewMode )
-{
-}
-
-unsigned int EcoreWlRenderSurface::GetSurfaceId( Any surface ) const
-{
-  unsigned int surfaceId = 0;
-
-  if ( surface.Empty() == false )
-  {
-    // check we have a valid type
-    DALI_ASSERT_ALWAYS( ( (surface.GetType() == typeid (Ecore_Wl_Window *) ) )
-                        && "Surface type is invalid" );
-
-    surfaceId = AnyCast<unsigned int>( surface );
-  }
-  return surfaceId;
-}
-
-RenderSurface::Type EcoreWlRenderSurface::GetSurfaceType()
-{
-  return RenderSurface::ECORE_RENDER_SURFACE;
-}
-
-} // namespace ECore
-
-} // namespace Dali
diff --git a/dali/internal/window-system/tizen-wayland/render-surface-factory-ecore-wl.cpp b/dali/internal/window-system/tizen-wayland/render-surface-factory-ecore-wl.cpp
new file mode 100644 (file)
index 0000000..c2619ce
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2018 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/window-system/tizen-wayland/render-surface-factory-ecore-wl.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/window-system/tizen-wayland/window-render-surface-ecore-wl.h>
+#include <dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.h>
+#include <dali/internal/window-system/common/pixmap-render-surface.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+std::unique_ptr< WindowRenderSurface > RenderSurfaceFactoryEcoreWl::CreateWindowRenderSurface( Dali::PositionSize positionSize,
+                                                                                               Any surface,
+                                                                                               const std::string& name,
+                                                                                               const std::string& className,
+                                                                                               bool isTransparent )
+{
+  return Utils::MakeUnique< WindowRenderSurfaceEcoreWl >( positionSize, surface, name, isTransparent );
+}
+
+std::unique_ptr< PixmapRenderSurface > RenderSurfaceFactoryEcoreWl::CreatePixmapRenderSurface( Dali::PositionSize positionSize, Any surface,
+                                                                                               const std::string& name, bool isTransparent )
+{
+  return std::unique_ptr< PixmapRenderSurface >( nullptr );
+}
+
+std::unique_ptr< NativeRenderSurface > RenderSurfaceFactoryEcoreWl::CreateNativeRenderSurface( Dali::PositionSize positionSize, const std::string& name, bool isTransparent )
+{
+  return Utils::MakeUnique< NativeRenderSurfaceEcoreWl >( positionSize, name, isTransparent );
+}
+
+// this should be created from somewhere
+std::unique_ptr< RenderSurfaceFactory > GetRenderSurfaceFactory()
+{
+  // returns Window factory
+  return Utils::MakeUnique< RenderSurfaceFactoryEcoreWl >();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/window-system/tizen-wayland/render-surface-factory-ecore-wl.h b/dali/internal/window-system/tizen-wayland/render-surface-factory-ecore-wl.h
new file mode 100644 (file)
index 0000000..b954247
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_RENDER_SURFACE_FACTORY_ECORE_WL_H
+#define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_RENDER_SURFACE_FACTORY_ECORE_WL_H
+
+/*
+ * Copyright (c) 2018 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.
+ *
+ */
+
+#include <dali/internal/window-system/common/render-surface-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+class RenderSurfaceFactoryEcoreWl : public RenderSurfaceFactory
+{
+public:
+  std::unique_ptr< WindowRenderSurface > CreateWindowRenderSurface( Dali::PositionSize positionSize, Any surface,
+                                                                    const std::string& name, const std::string& className, bool isTransparent = false ) override;
+
+  std::unique_ptr< PixmapRenderSurface > CreatePixmapRenderSurface( Dali::PositionSize positionSize, Any surface,
+                                                                    const std::string& name, bool isTransparent = false ) override;
+
+  std::unique_ptr< NativeRenderSurface > CreateNativeRenderSurface( Dali::PositionSize positionSize, const std::string& name, bool isTransparent = false ) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_RENDER_SURFACE_FACTORY_ECORE_WL_H
diff --git a/dali/internal/window-system/tizen-wayland/window-base-ecore-wl.cpp b/dali/internal/window-system/tizen-wayland/window-base-ecore-wl.cpp
new file mode 100644 (file)
index 0000000..4dc6cea
--- /dev/null
@@ -0,0 +1,1048 @@
+/*
+ * Copyright (c) 2018 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.
+ *
+ */
+
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+
+// CLASS HEADER
+#include <dali/internal/window-system/tizen-wayland/window-base-ecore-wl.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/window-system/common/window-impl.h>
+#include <dali/internal/window-system/tizen-wayland/window-render-surface-ecore-wl.h>
+
+// EXTERNAL_HEADERS
+#include <dali/public-api/object/any.h>
+#include <dali/integration-api/debug.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW_BASE" );
+#endif
+
+const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
+
+/// Called when the window iconify state is changed.
+static Eina_Bool EcoreEventWindowIconifyStateChanged( void* data, int type, void* event )
+{
+  WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
+  if( windowBase )
+  {
+    return windowBase->OnIconifyStateChanged( data, type, event );
+  }
+
+  return ECORE_CALLBACK_PASS_ON;
+}
+
+/// Called when the window gains focus
+static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
+{
+  WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
+  if( windowBase )
+  {
+    return windowBase->OnFocusIn( data, type, event );
+  }
+
+  return ECORE_CALLBACK_PASS_ON;
+}
+
+/// Called when the window loses focus
+static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
+{
+  WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
+  if( windowBase )
+  {
+    return windowBase->OnFocusOut( data, type, event );
+  }
+
+  return ECORE_CALLBACK_PASS_ON;
+}
+
+/// Called when the output is transformed
+static Eina_Bool EcoreEventOutputTransform( void* data, int type, void* event )
+{
+  WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
+  if( windowBase )
+  {
+    return windowBase->OnOutputTransform( data, type, event );
+  }
+
+  return ECORE_CALLBACK_PASS_ON;
+}
+
+/// Called when the output transform should be ignored
+static Eina_Bool EcoreEventIgnoreOutputTransform( void* data, int type, void* event )
+{
+  WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
+  if( windowBase )
+  {
+    return windowBase->OnIgnoreOutputTransform( data, type, event );
+  }
+
+  return ECORE_CALLBACK_PASS_ON;
+}
+
+static void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
+{
+  WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
+  if( windowBase )
+  {
+    windowBase->RegistryGlobalCallback( data, registry, name, interface, version );
+  }
+}
+
+static void RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
+{
+  WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
+  if( windowBase )
+  {
+    windowBase->RegistryGlobalCallbackRemove( data, registry, id );
+  }
+}
+
+static void TizenPolicyConformant( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant )
+{
+}
+
+static void TizenPolicyConformantArea( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t conformantPart, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h )
+{
+}
+
+static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
+{
+  WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
+  if( windowBase )
+  {
+    windowBase->TizenPolicyNotificationChangeDone( data, tizenPolicy, surface, level, state );
+  }
+}
+
+static void TizenPolicyTransientForDone( void* data, struct tizen_policy* tizenPolicy, uint32_t childId )
+{
+}
+
+static void TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
+{
+  WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
+  if( windowBase )
+  {
+    windowBase->TizenPolicyScreenModeChangeDone( data, tizenPolicy, surface, mode, state );
+  }
+}
+
+static void TizenPolicyIconifyStateChanged( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force )
+{
+}
+
+static void TizenPolicySupportedAuxiliaryHints( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints )
+{
+}
+
+static void TizenPolicyAllowedAuxiliaryHint( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id )
+{
+}
+
+static void TizenPolicyAuxiliaryMessage( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options )
+{
+}
+
+static void TizenPolicyConformantRegion( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t conformantPart, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t serial )
+{
+}
+
+static void DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
+{
+  WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
+  if( windowBase )
+  {
+    windowBase->DisplayPolicyBrightnessChangeDone( data, displayPolicy, surface, brightness, state );
+  }
+}
+
+const struct wl_registry_listener registryListener =
+{
+   RegistryGlobalCallback,
+   RegistryGlobalCallbackRemove
+};
+
+const struct tizen_policy_listener tizenPolicyListener =
+{
+   TizenPolicyConformant,
+   TizenPolicyConformantArea,
+   TizenPolicyNotificationChangeDone,
+   TizenPolicyTransientForDone,
+   TizenPolicyScreenModeChangeDone,
+   TizenPolicyIconifyStateChanged,
+   TizenPolicySupportedAuxiliaryHints,
+   TizenPolicyAllowedAuxiliaryHint,
+   TizenPolicyAuxiliaryMessage,
+   TizenPolicyConformantRegion
+};
+
+const struct tizen_display_policy_listener tizenDisplayPolicyListener =
+{
+  DisplayPolicyBrightnessChangeDone
+};
+
+} // unnamed namespace
+
+WindowBaseEcoreWl::WindowBaseEcoreWl( Window* window, WindowRenderSurface* windowRenderSurface )
+: mEcoreEventHandler(),
+  mWindow( window ),
+  mWindowSurface( NULL ),
+  mEcoreWindow( NULL ),
+  mDisplay( NULL ),
+  mEventQueue( NULL ),
+  mTizenPolicy( NULL ),
+  mTizenDisplayPolicy( NULL ),
+  mSupportedAuxiliaryHints(),
+  mAuxiliaryHints(),
+  mNotificationLevel( -1 ),
+  mNotificationChangeState( 0 ),
+  mNotificationLevelChangeDone( true ),
+  mScreenOffMode( 0 ),
+  mScreenOffModeChangeState( 0 ),
+  mScreenOffModeChangeDone( true ),
+  mBrightness( 0 ),
+  mBrightnessChangeState( 0 ),
+  mBrightnessChangeDone( true )
+{
+  mWindowSurface = dynamic_cast< WindowRenderSurfaceEcoreWl* >( windowRenderSurface );
+}
+
+WindowBaseEcoreWl::~WindowBaseEcoreWl()
+{
+  for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
+  {
+    ecore_event_handler_del( *iter );
+  }
+  mEcoreEventHandler.Clear();
+
+  if( mEventQueue )
+  {
+    wl_event_queue_destroy( mEventQueue );
+  }
+
+  mSupportedAuxiliaryHints.clear();
+  mAuxiliaryHints.clear();
+}
+
+void WindowBaseEcoreWl::Initialize()
+{
+  if( !mWindowSurface )
+  {
+    DALI_ASSERT_ALWAYS( "Invalid window surface" );
+  }
+
+  mEcoreWindow = mWindowSurface->GetWlWindow();
+  DALI_ASSERT_ALWAYS( mEcoreWindow != 0 && "There is no EcoreWl window" );
+
+  mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this ) );
+  mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this ) );
+  mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this ) );
+  mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this) );
+  mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this) );
+
+  mDisplay = ecore_wl_display_get();
+
+  if( mDisplay )
+  {
+    wl_display* displayWrapper = static_cast< wl_display* >( wl_proxy_create_wrapper( mDisplay ) );
+    if( displayWrapper )
+    {
+      mEventQueue = wl_display_create_queue( mDisplay );
+      if( mEventQueue )
+      {
+        wl_proxy_set_queue( reinterpret_cast< wl_proxy* >( displayWrapper ), mEventQueue );
+
+        wl_registry* registry = wl_display_get_registry( displayWrapper );
+        wl_registry_add_listener( registry, &registryListener, this );
+      }
+
+      wl_proxy_wrapper_destroy( displayWrapper );
+    }
+  }
+
+  // get auxiliary hint
+  Eina_List* hints = ecore_wl_window_aux_hints_supported_get( mEcoreWindow );
+  if( hints )
+  {
+    Eina_List* l = NULL;
+    char* hint = NULL;
+
+    for( l = hints, ( hint =  static_cast< char* >( eina_list_data_get(l) ) ); l; l = eina_list_next(l), ( hint = static_cast< char* >( eina_list_data_get(l) ) ) )
+    {
+      mSupportedAuxiliaryHints.push_back( hint );
+
+      DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::Initialize: %s\n", hint );
+    }
+  }
+}
+
+Eina_Bool WindowBaseEcoreWl::OnIconifyStateChanged( void* data, int type, void* event )
+{
+  Ecore_Wl_Event_Window_Iconify_State_Change* iconifyChangedEvent( static_cast< Ecore_Wl_Event_Window_Iconify_State_Change* >( event ) );
+  Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
+
+  if( iconifyChangedEvent->win == static_cast< unsigned int>( ecore_wl_window_id_get( mEcoreWindow ) ) )
+  {
+    if( iconifyChangedEvent->iconified == EINA_TRUE )
+    {
+      mWindow->OnIconifyChanged( true );
+    }
+    else
+    {
+      mWindow->OnIconifyChanged( false );
+    }
+    handled = ECORE_CALLBACK_DONE;
+  }
+
+  return handled;
+}
+
+Eina_Bool WindowBaseEcoreWl::OnFocusIn( void* data, int type, void* event )
+{
+  Ecore_Wl_Event_Focus_In* focusInEvent( static_cast< Ecore_Wl_Event_Focus_In* >( event ) );
+
+  if( focusInEvent->win == static_cast< unsigned int >( ecore_wl_window_id_get( mEcoreWindow ) ) )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
+
+    mWindow->OnFocusChanged( true );
+  }
+
+  return ECORE_CALLBACK_PASS_ON;
+}
+
+Eina_Bool WindowBaseEcoreWl::OnFocusOut( void* data, int type, void* event )
+{
+  Ecore_Wl_Event_Focus_Out* focusOutEvent( static_cast< Ecore_Wl_Event_Focus_Out* >( event ) );
+
+  if( focusOutEvent->win == static_cast< unsigned int >( ecore_wl_window_id_get( mEcoreWindow ) ) )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
+
+    mWindow->OnFocusChanged( false );
+  }
+
+  return ECORE_CALLBACK_PASS_ON;
+}
+
+Eina_Bool WindowBaseEcoreWl::OnOutputTransform( void* data, int type, void* event )
+{
+  Ecore_Wl_Event_Output_Transform* transformEvent( static_cast< Ecore_Wl_Event_Output_Transform* >( event ) );
+
+  if( transformEvent->output == ecore_wl_window_output_find( mEcoreWindow ) )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow );
+
+    mWindowSurface->OutputTransformed();
+
+    mWindow->OnOutputTransformed();
+  }
+
+  return ECORE_CALLBACK_PASS_ON;
+}
+
+Eina_Bool WindowBaseEcoreWl::OnIgnoreOutputTransform( void* data, int type, void* event )
+{
+  Ecore_Wl_Event_Ignore_Output_Transform* ignoreTransformEvent( static_cast< Ecore_Wl_Event_Ignore_Output_Transform* >( event ) );
+
+  if( ignoreTransformEvent->win == mEcoreWindow )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow );
+
+    mWindowSurface->OutputTransformed();
+
+    mWindow->OnOutputTransformed();
+  }
+
+  return ECORE_CALLBACK_PASS_ON;
+}
+
+void WindowBaseEcoreWl::RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
+{
+  if( strcmp( interface, tizen_policy_interface.name ) == 0 )
+  {
+    uint32_t clientVersion = std::min( version, MAX_TIZEN_CLIENT_VERSION );
+
+    mTizenPolicy = static_cast< tizen_policy* >( wl_registry_bind( registry, name, &tizen_policy_interface, clientVersion ) );
+    if( !mTizenPolicy )
+    {
+      DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n" );
+      return;
+    }
+
+    tizen_policy_add_listener( mTizenPolicy, &tizenPolicyListener, data );
+
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::RegistryGlobalCallback: tizen_policy_add_listener is called.\n" );
+  }
+  else if( strcmp( interface, tizen_display_policy_interface.name ) == 0 )
+  {
+    mTizenDisplayPolicy = static_cast< tizen_display_policy* >( wl_registry_bind( registry, name, &tizen_display_policy_interface, version ) );
+    if( !mTizenDisplayPolicy )
+    {
+      DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n" );
+      return;
+    }
+
+    tizen_display_policy_add_listener( mTizenDisplayPolicy, &tizenDisplayPolicyListener, data );
+
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n" );
+  }
+}
+
+void WindowBaseEcoreWl::RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
+{
+  mTizenPolicy = NULL;
+  mTizenDisplayPolicy = NULL;
+}
+
+void WindowBaseEcoreWl::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
+{
+  mNotificationLevel = level;
+  mNotificationChangeState = state;
+  mNotificationLevelChangeDone = true;
+
+  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state );
+}
+
+void WindowBaseEcoreWl::TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
+{
+  mScreenOffMode = mode;
+  mScreenOffModeChangeState = state;
+  mScreenOffModeChangeDone = true;
+
+  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state );
+}
+
+void WindowBaseEcoreWl::DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
+{
+  mBrightness = brightness;
+  mBrightnessChangeState = state;
+  mBrightnessChangeDone = true;
+
+  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state );
+}
+
+void WindowBaseEcoreWl::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode )
+{
+  DALI_LOG_TRACE_METHOD_FMT( gWindowBaseLogFilter, "visible : %d\n", visibleMode );
+
+  if( visibleMode == Dali::Window::VISIBLE )
+  {
+    // when the indicator is visible, set proper mode for indicator server according to bg mode
+    if( opacityMode == Dali::Window::OPAQUE )
+    {
+      ecore_wl_window_indicator_opacity_set( mEcoreWindow, ECORE_WL_INDICATOR_OPAQUE );
+    }
+    else if( opacityMode == Dali::Window::TRANSLUCENT )
+    {
+      ecore_wl_window_indicator_opacity_set( mEcoreWindow, ECORE_WL_INDICATOR_TRANSLUCENT );
+    }
+    else if( opacityMode == Dali::Window::TRANSPARENT )
+    {
+      ecore_wl_window_indicator_opacity_set( mEcoreWindow, ECORE_WL_INDICATOR_OPAQUE );
+    }
+  }
+  else
+  {
+    // when the indicator is not visible, set TRANSPARENT mode for indicator server
+    ecore_wl_window_indicator_opacity_set( mEcoreWindow, ECORE_WL_INDICATOR_TRANSPARENT); // it means hidden indicator
+  }
+}
+
+void WindowBaseEcoreWl::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
+{
+  if( isShow )
+  {
+    ecore_wl_window_indicator_state_set( mEcoreWindow, ECORE_WL_INDICATOR_STATE_ON );
+  }
+  else
+  {
+    ecore_wl_window_indicator_state_set( mEcoreWindow, ECORE_WL_INDICATOR_STATE_OFF );
+  }
+}
+
+void WindowBaseEcoreWl::IndicatorTypeChanged( IndicatorInterface::Type type )
+{
+#if defined(DALI_PROFILE_MOBILE)
+  switch( type )
+  {
+    case IndicatorInterface::INDICATOR_TYPE_1:
+    {
+      ecore_wl_indicator_visible_type_set( mEcoreWindow, ECORE_WL_INDICATOR_VISIBLE_TYPE_SHOWN );
+      break;
+    }
+    case IndicatorInterface::INDICATOR_TYPE_2:
+    {
+      ecore_wl_indicator_visible_type_set( mEcoreWindow, ECORE_WL_INDICATOR_VISIBLE_TYPE_HIDDEN );
+      break;
+    }
+    case IndicatorInterface::INDICATOR_TYPE_UNKNOWN:
+    default:
+    {
+      break;
+    }
+  }
+#endif //MOBILE
+}
+
+void WindowBaseEcoreWl::SetClass( std::string name, std::string className )
+{
+  ecore_wl_window_title_set( mEcoreWindow, name.c_str() );
+  ecore_wl_window_class_name_set( mEcoreWindow, className.c_str() );
+}
+
+void WindowBaseEcoreWl::Raise()
+{
+  // Use ecore_wl_window_activate to prevent the window shown without rendering
+  ecore_wl_window_activate( mEcoreWindow );
+}
+
+void WindowBaseEcoreWl::Lower()
+{
+  ecore_wl_window_lower( mEcoreWindow );
+}
+
+void WindowBaseEcoreWl::Activate()
+{
+  ecore_wl_window_activate( mEcoreWindow );
+}
+
+void WindowBaseEcoreWl::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
+{
+  int rotations[4] = { 0 };
+  for( std::size_t i = 0; i < orientations.size(); ++i )
+  {
+    rotations[i] = static_cast< int >( orientations[i] );
+  }
+  ecore_wl_window_rotation_available_rotations_set( mEcoreWindow, rotations, orientations.size() );
+}
+
+void WindowBaseEcoreWl::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
+{
+  ecore_wl_window_rotation_preferred_rotation_set( mEcoreWindow, orientation );
+}
+
+void WindowBaseEcoreWl::SetAcceptFocus( bool accept )
+{
+  ecore_wl_window_focus_skip_set( mEcoreWindow, !accept );
+}
+
+void WindowBaseEcoreWl::Show()
+{
+  ecore_wl_window_show( mEcoreWindow );
+}
+
+void WindowBaseEcoreWl::Hide()
+{
+  ecore_wl_window_hide( mEcoreWindow );
+}
+
+unsigned int WindowBaseEcoreWl::GetSupportedAuxiliaryHintCount() const
+{
+  return mSupportedAuxiliaryHints.size();
+}
+
+std::string WindowBaseEcoreWl::GetSupportedAuxiliaryHint( unsigned int index ) const
+{
+  if( index >= GetSupportedAuxiliaryHintCount() )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index );
+  }
+
+  return mSupportedAuxiliaryHints[index];
+}
+
+unsigned int WindowBaseEcoreWl::AddAuxiliaryHint( const std::string& hint, const std::string& value )
+{
+  bool supported = false;
+
+  // Check if the hint is suppported
+  for( std::vector< std::string >::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter )
+  {
+    if( *iter == hint )
+    {
+      supported = true;
+      break;
+    }
+  }
+
+  if( !supported )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str() );
+    return 0;
+  }
+
+  // Check if the hint is already added
+  for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
+  {
+    if( mAuxiliaryHints[i].first == hint )
+    {
+      // Just change the value
+      mAuxiliaryHints[i].second = value;
+
+      DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1 );
+
+      return i + 1;   // id is index + 1
+    }
+  }
+
+  // Add the hint
+  mAuxiliaryHints.push_back( std::pair< std::string, std::string >( hint, value ) );
+
+  unsigned int id = mAuxiliaryHints.size();
+
+  ecore_wl_window_aux_hint_add( mEcoreWindow, static_cast< int >( id ), hint.c_str(), value.c_str() );
+
+  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id );
+
+  return id;
+}
+
+bool WindowBaseEcoreWl::RemoveAuxiliaryHint( unsigned int id )
+{
+  if( id == 0 || id > mAuxiliaryHints.size() )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::RemoveAuxiliaryHint: Invalid id [%d]\n", id );
+    return false;
+  }
+
+  mAuxiliaryHints[id - 1].second = std::string();
+
+  ecore_wl_window_aux_hint_del( mEcoreWindow, static_cast< int >( id ) );
+
+  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str() );
+
+  return true;
+}
+
+bool WindowBaseEcoreWl::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
+{
+  if( id == 0 || id > mAuxiliaryHints.size() )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::SetAuxiliaryHintValue: Invalid id [%d]\n", id );
+    return false;
+  }
+
+  mAuxiliaryHints[id - 1].second = value;
+
+  ecore_wl_window_aux_hint_change( mEcoreWindow, static_cast< int >( id ), value.c_str() );
+
+  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetAuxiliaryHintValue: id = %d, hint = %s, value = %s\n", id, mAuxiliaryHints[id - 1].first.c_str(), mAuxiliaryHints[id - 1].second.c_str() );
+
+  return true;
+}
+
+std::string WindowBaseEcoreWl::GetAuxiliaryHintValue( unsigned int id ) const
+{
+  if( id == 0 || id > mAuxiliaryHints.size() )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::GetAuxiliaryHintValue: Invalid id [%d]\n", id );
+    return std::string();
+  }
+
+  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetAuxiliaryHintValue: id = %d, hint = %s, value = %s\n", id, mAuxiliaryHints[id - 1].first.c_str(), mAuxiliaryHints[id - 1].second.c_str() );
+
+  return mAuxiliaryHints[id - 1].second;
+}
+
+unsigned int WindowBaseEcoreWl::GetAuxiliaryHintId( const std::string& hint ) const
+{
+  for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
+  {
+    if( mAuxiliaryHints[i].first == hint )
+    {
+      DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1 );
+      return i + 1;
+    }
+  }
+
+  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str() );
+
+  return 0;
+}
+
+void WindowBaseEcoreWl::SetInputRegion( const Rect< int >& inputRegion )
+{
+  ecore_wl_window_input_region_set( mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
+}
+
+void WindowBaseEcoreWl::SetType( Dali::Window::Type type )
+{
+  Ecore_Wl_Window_Type windowType;
+
+  switch( type )
+  {
+    case Dali::Window::NORMAL:
+    {
+      windowType = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
+      break;
+    }
+    case Dali::Window::NOTIFICATION:
+    {
+      windowType = ECORE_WL_WINDOW_TYPE_NOTIFICATION;
+      break;
+    }
+    case Dali::Window::UTILITY:
+    {
+      windowType = ECORE_WL_WINDOW_TYPE_UTILITY;
+      break;
+    }
+    case Dali::Window::DIALOG:
+    {
+      windowType = ECORE_WL_WINDOW_TYPE_DIALOG;
+      break;
+    }
+    default:
+    {
+      windowType = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
+      break;
+    }
+  }
+
+  ecore_wl_window_type_set( mEcoreWindow, windowType );
+}
+
+bool WindowBaseEcoreWl::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
+{
+  while( !mTizenPolicy )
+  {
+    wl_display_dispatch_queue( mDisplay, mEventQueue );
+  }
+
+  int notificationLevel;
+
+  switch( level )
+  {
+    case Dali::Window::NotificationLevel::NONE:
+    {
+      notificationLevel = TIZEN_POLICY_LEVEL_NONE;
+      break;
+    }
+    case Dali::Window::NotificationLevel::BASE:
+    {
+      notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
+      break;
+    }
+    case Dali::Window::NotificationLevel::MEDIUM:
+    {
+      notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
+      break;
+    }
+    case Dali::Window::NotificationLevel::HIGH:
+    {
+      notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
+      break;
+    }
+    case Dali::Window::NotificationLevel::TOP:
+    {
+      notificationLevel = TIZEN_POLICY_LEVEL_TOP;
+      break;
+    }
+    default:
+    {
+      DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetNotificationLevel: invalid level [%d]\n", level );
+      notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
+      break;
+    }
+  }
+
+  mNotificationLevelChangeDone = false;
+  mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
+
+  tizen_policy_set_notification_level( mTizenPolicy, ecore_wl_window_surface_get( mEcoreWindow ), notificationLevel );
+
+  int count = 0;
+
+  while( !mNotificationLevelChangeDone && count < 3 )
+  {
+    ecore_wl_flush();
+    wl_display_dispatch_queue( mDisplay, mEventQueue );
+    count++;
+  }
+
+  if( !mNotificationLevelChangeDone )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState );
+    return false;
+  }
+  else if( mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetNotificationLevel: Permission denied! [%d]\n", level );
+    return false;
+  }
+
+  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel );
+
+  return true;
+}
+
+Dali::Window::NotificationLevel::Type WindowBaseEcoreWl::GetNotificationLevel() const
+{
+  while( !mTizenPolicy )
+  {
+    wl_display_dispatch_queue( mDisplay, mEventQueue );
+  }
+
+  int count = 0;
+
+  while( !mNotificationLevelChangeDone && count < 3 )
+  {
+    ecore_wl_flush();
+    wl_display_dispatch_queue( mDisplay, mEventQueue );
+    count++;
+  }
+
+  if( !mNotificationLevelChangeDone )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetNotificationLevel: Error! [%d]\n", mNotificationChangeState );
+    return Dali::Window::NotificationLevel::NONE;
+  }
+
+  Dali::Window::NotificationLevel::Type level;
+
+  switch( mNotificationLevel )
+  {
+    case TIZEN_POLICY_LEVEL_NONE:
+    {
+      level = Dali::Window::NotificationLevel::NONE;
+      break;
+    }
+    case TIZEN_POLICY_LEVEL_DEFAULT:
+    {
+      level = Dali::Window::NotificationLevel::BASE;
+      break;
+    }
+    case TIZEN_POLICY_LEVEL_MEDIUM:
+    {
+      level = Dali::Window::NotificationLevel::MEDIUM;
+      break;
+    }
+    case TIZEN_POLICY_LEVEL_HIGH:
+    {
+      level = Dali::Window::NotificationLevel::HIGH;
+      break;
+    }
+    case TIZEN_POLICY_LEVEL_TOP:
+    {
+      level = Dali::Window::NotificationLevel::TOP;
+      break;
+    }
+    default:
+    {
+      DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetNotificationLevel: invalid level [%d]\n", mNotificationLevel );
+      level = Dali::Window::NotificationLevel::NONE;
+      break;
+    }
+  }
+
+  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetNotificationLevel: level [%d]\n", mNotificationLevel );
+
+  return level;
+}
+
+void WindowBaseEcoreWl::SetOpaqueState( bool opaque )
+{
+  while( !mTizenPolicy )
+  {
+    wl_display_dispatch_queue( mDisplay, mEventQueue );
+  }
+
+  tizen_policy_set_opaque_state( mTizenPolicy, ecore_wl_window_surface_get( mEcoreWindow ), ( opaque ? 1 : 0 ) );
+}
+
+bool WindowBaseEcoreWl::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
+{
+  while( !mTizenPolicy )
+  {
+    wl_display_dispatch_queue( mDisplay, mEventQueue );
+  }
+
+  mScreenOffModeChangeDone = false;
+  mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
+
+  unsigned int mode = 0;
+
+  switch( screenOffMode )
+  {
+    case Dali::Window::ScreenOffMode::TIMEOUT:
+    {
+      mode = 0;
+      break;
+    }
+    case Dali::Window::ScreenOffMode::NEVER:
+    {
+      mode = 1;
+      break;
+    }
+  }
+
+  tizen_policy_set_window_screen_mode( mTizenPolicy, ecore_wl_window_surface_get( mEcoreWindow ), mode );
+
+  int count = 0;
+
+  while( !mScreenOffModeChangeDone && count < 3 )
+  {
+    ecore_wl_flush();
+    wl_display_dispatch_queue( mDisplay, mEventQueue );
+    count++;
+  }
+
+  if( !mScreenOffModeChangeDone )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState );
+    return false;
+  }
+  else if( mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode );
+    return false;
+  }
+
+  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode );
+
+  return true;
+}
+
+Dali::Window::ScreenOffMode::Type WindowBaseEcoreWl::GetScreenOffMode() const
+{
+  while( !mTizenPolicy )
+  {
+    wl_display_dispatch_queue( mDisplay, mEventQueue );
+  }
+
+  int count = 0;
+
+  while( !mScreenOffModeChangeDone && count < 3 )
+  {
+    ecore_wl_flush();
+    wl_display_dispatch_queue( mDisplay, mEventQueue );
+    count++;
+  }
+
+  if( !mScreenOffModeChangeDone )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetScreenOffMode: Error! [%d]\n", mScreenOffModeChangeState );
+    return Dali::Window::ScreenOffMode::TIMEOUT;
+  }
+
+  Dali::Window::ScreenOffMode::Type screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
+
+  switch( mScreenOffMode )
+  {
+    case 0:
+    {
+      screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
+      break;
+    }
+    case 1:
+    {
+      screenMode = Dali::Window::ScreenOffMode::NEVER;
+      break;
+    }
+  }
+
+  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetScreenOffMode: screen mode [%d]\n", mScreenOffMode );
+
+  return screenMode;
+}
+
+bool WindowBaseEcoreWl::SetBrightness( int brightness )
+{
+  while( !mTizenDisplayPolicy )
+  {
+    wl_display_dispatch_queue( mDisplay, mEventQueue );
+  }
+
+  mBrightnessChangeDone = false;
+  mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
+
+  tizen_display_policy_set_window_brightness( mTizenDisplayPolicy, ecore_wl_window_surface_get( mEcoreWindow ), brightness );
+
+  int count = 0;
+
+  while( !mBrightnessChangeDone && count < 3 )
+  {
+    ecore_wl_flush();
+    wl_display_dispatch_queue( mDisplay, mEventQueue );
+    count++;
+  }
+
+  if( !mBrightnessChangeDone )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState );
+    return false;
+  }
+  else if( mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetBrightness: Permission denied! [%d]\n", brightness );
+    return false;
+  }
+
+  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetBrightness: Brightness is changed [%d]\n", mBrightness );
+
+  return true;
+}
+
+int WindowBaseEcoreWl::GetBrightness() const
+{
+  while( !mTizenDisplayPolicy )
+  {
+    wl_display_dispatch_queue( mDisplay, mEventQueue );
+  }
+
+  int count = 0;
+
+  while( !mBrightnessChangeDone && count < 3 )
+  {
+    ecore_wl_flush();
+    wl_display_dispatch_queue( mDisplay, mEventQueue );
+    count++;
+  }
+
+  if( !mBrightnessChangeDone )
+  {
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetBrightness: Error! [%d]\n", mBrightnessChangeState );
+    return 0;
+  }
+
+  DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::GetBrightness: Brightness [%d]\n", mBrightness );
+
+  return mBrightness;
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#pragma GCC diagnostic pop
diff --git a/dali/internal/window-system/tizen-wayland/window-base-ecore-wl.h b/dali/internal/window-system/tizen-wayland/window-base-ecore-wl.h
new file mode 100644 (file)
index 0000000..7ab263d
--- /dev/null
@@ -0,0 +1,299 @@
+#ifndef DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL_H
+#define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL_H
+
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/window-system/common/window-base.h>
+
+// EXTERNAL HEADERS
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#include <tizen-extension-client-protocol.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+class WindowRenderSurface;
+class WindowRenderSurfaceEcoreWl;
+
+/**
+ * WindowBaseEcoreWl class provides an WindowBase EcoreX implementation.
+ */
+class WindowBaseEcoreWl : public WindowBase
+{
+public:
+
+  /**
+   * @brief Constructor
+   */
+  WindowBaseEcoreWl( Window* window, WindowRenderSurface* windowRenderSurface );
+
+  /**
+   * @brief Destructor
+   */
+  virtual ~WindowBaseEcoreWl();
+
+public:
+
+  /**
+   * @brief Called when the window iconify state is changed.
+   */
+  Eina_Bool OnIconifyStateChanged( void* data, int type, void* event );
+
+  /**
+   * @brief Called when the window gains focus.
+   */
+  Eina_Bool OnFocusIn( void* data, int type, void* event );
+
+  /**
+   * @brief Called when the window loses focus.
+   */
+  Eina_Bool OnFocusOut( void* data, int type, void* event );
+
+  /**
+   * @brief Called when the output is transformed.
+   */
+  Eina_Bool OnOutputTransform( void* data, int type, void* event );
+
+  /**
+   * @brief Called when the output transform should be ignored.
+   */
+  Eina_Bool OnIgnoreOutputTransform( void* data, int type, void* event );
+
+  /**
+   * @brief RegistryGlobalCallback
+   */
+  void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version );
+
+  /**
+   * @brief RegistryGlobalCallbackRemove
+   */
+  void RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id );
+
+  /**
+   * @brief TizenPolicyNotificationChangeDone
+   */
+  void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state );
+
+  /**
+   * @brief TizenPolicyScreenModeChangeDone
+   */
+  void TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state );
+
+  /**
+   * @brief DisplayPolicyBrightnessChangeDone
+   */
+  void DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state );
+
+public:
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Initialize()
+   */
+  virtual void Initialize() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::ShowIndicator()
+   */
+  virtual void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetIndicatorProperties()
+   */
+  virtual void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IndicatorTypeChanged()
+   */
+  virtual void IndicatorTypeChanged( IndicatorInterface::Type type ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
+   */
+  virtual void SetClass( std::string name, std::string className ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
+   */
+  virtual void Raise() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
+   */
+  virtual void Lower() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
+   */
+  virtual void Activate() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableOrientations()
+   */
+  virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredOrientation()
+   */
+  virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
+   */
+  virtual void SetAcceptFocus( bool accept ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
+   */
+  virtual void Show() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
+   */
+  virtual void Hide() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
+   */
+  virtual unsigned int GetSupportedAuxiliaryHintCount() const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
+   */
+  virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
+   */
+  virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
+   */
+  virtual bool RemoveAuxiliaryHint( unsigned int id ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
+   */
+  virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
+   */
+  virtual std::string GetAuxiliaryHintValue( unsigned int id ) const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
+   */
+  virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
+   */
+  virtual void SetInputRegion( const Rect< int >& inputRegion ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
+   */
+  virtual void SetType( Dali::Window::Type type ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
+   */
+  virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
+   */
+  virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
+   */
+  virtual void SetOpaqueState( bool opaque ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
+   */
+  virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
+   */
+  virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
+   */
+  virtual bool SetBrightness( int brightness ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
+   */
+  virtual int GetBrightness() const override;
+
+protected:
+
+  // Undefined
+  WindowBaseEcoreWl(const WindowBaseEcoreWl&) = delete;
+
+  // Undefined
+  WindowBaseEcoreWl& operator=(const WindowBaseEcoreWl& rhs) = delete;
+
+private:
+
+  typedef std::vector< std::pair< std::string, std::string > > AuxiliaryHints;
+
+  Dali::Vector< Ecore_Event_Handler* > mEcoreEventHandler;
+
+  Window*                              mWindow;
+  WindowRenderSurfaceEcoreWl*          mWindowSurface;
+  Ecore_Wl_Window*                     mEcoreWindow;
+  wl_display*                          mDisplay;
+  wl_event_queue*                      mEventQueue;
+  tizen_policy*                        mTizenPolicy;
+  tizen_display_policy*                mTizenDisplayPolicy;
+
+  std::vector< std::string >           mSupportedAuxiliaryHints;
+  AuxiliaryHints                       mAuxiliaryHints;
+
+  int                                  mNotificationLevel;
+  uint32_t                             mNotificationChangeState;
+  bool                                 mNotificationLevelChangeDone;
+
+  int                                  mScreenOffMode;
+  uint32_t                             mScreenOffModeChangeState;
+  bool                                 mScreenOffModeChangeDone;
+
+  int                                  mBrightness;
+  uint32_t                             mBrightnessChangeState;
+  bool                                 mBrightnessChangeDone;
+};
+
+} // namespace Adaptor
+
+} // namespace internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL_H
diff --git a/dali/internal/window-system/tizen-wayland/window-base-factory-ecore-wl.cpp b/dali/internal/window-system/tizen-wayland/window-base-factory-ecore-wl.cpp
new file mode 100644 (file)
index 0000000..484e4fd
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2018 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/window-system/tizen-wayland/window-base-factory-ecore-wl.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/window-system/tizen-wayland/window-base-ecore-wl.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+std::unique_ptr< Dali::Internal::Adaptor::WindowBase > WindowBaseFactoryEcoreWl::CreateWindowBase( Window* window, WindowRenderSurface* windowRenderSurface )
+{
+  return Utils::MakeUnique< WindowBaseEcoreWl >( window, windowRenderSurface );
+}
+
+// this should be created from somewhere
+std::unique_ptr< WindowBaseFactory > GetWindowBaseFactory()
+{
+  // returns WindowBase factory
+  return Utils::MakeUnique< WindowBaseFactoryEcoreWl >();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/window-system/tizen-wayland/window-base-factory-ecore-wl.h b/dali/internal/window-system/tizen-wayland/window-base-factory-ecore-wl.h
new file mode 100644 (file)
index 0000000..3bf5737
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_FACTORY_ECORE_WL_H
+#define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_FACTORY_ECORE_WL_H
+
+/*
+ * Copyright (c) 2018 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.
+ *
+ */
+
+#include <dali/internal/window-system/common/window-base-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+class WindowBaseFactoryEcoreWl : public WindowBaseFactory
+{
+public:
+  std::unique_ptr< Dali::Internal::Adaptor::WindowBase > CreateWindowBase( Window* window, WindowRenderSurface* windowRenderSurface ) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_FACTORY_ECORE_WL_H
diff --git a/dali/internal/window-system/tizen-wayland/window-impl-ecore-wl.cpp b/dali/internal/window-system/tizen-wayland/window-impl-ecore-wl.cpp
deleted file mode 100644 (file)
index fbcd0c6..0000000
+++ /dev/null
@@ -1,1568 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/internal/window-system/common/window-impl.h>
-
-// EXTERNAL HEADERS
-// Ecore is littered with C style cast
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-#include <Ecore.h>
-#include <Ecore_Wayland.h>
-#include <tizen-extension-client-protocol.h>
-
-#include <dali/integration-api/core.h>
-#include <dali/integration-api/system-overlay.h>
-#include <dali/public-api/render-tasks/render-task.h>
-#include <dali/public-api/render-tasks/render-task-list.h>
-#include <dali/devel-api/adaptor-framework/orientation.h>
-
-// INTERNAL HEADERS
-#include <dali/internal/window-system/tizen-wayland/window-render-surface-ecore-wl.h>
-#include <dali/internal/input/common/drag-and-drop-detector-impl.h>
-#include <dali/internal/window-system/common/ecore-indicator-impl.h>
-#include <dali/internal/window-system/common/window-visibility-observer.h>
-#include <dali/internal/window-system/common/orientation-impl.h>
-
-namespace
-{
-
-const float INDICATOR_ANIMATION_DURATION( 0.18f ); // 180 milli seconds
-const float INDICATOR_SHOW_Y_POSITION( 0.0f );
-const float INDICATOR_HIDE_Y_POSITION( -52.0f );
-
-const uint32_t MAX_TIZEN_CLIENT_VERSION = 7;
-
-}
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-
-#if defined(DEBUG_ENABLED)
-Debug::Filter* gWindowLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW");
-#endif
-
-/**
- * TODO: Abstract Window class out and move this into a window implementation for Ecore
- */
-struct Window::EventHandler
-{
-  /**
-   * Constructor
-   * @param[in]  window  A pointer to the window class.
-   */
-  EventHandler( Window* window )
-  : mWindow( window ),
-    mEcoreEventHandler(),
-    mEcoreWindow( 0 ),
-    mDisplay( NULL ),
-    mEventQueue( NULL ),
-    mTizenPolicy( NULL ),
-    mTizenDisplayPolicy( NULL ),
-    mNotificationLevel( -1 ),
-    mNotificationChangeState( 0 ),
-    mNotificationLevelChangeDone( true ),
-    mScreenOffMode( 0 ),
-    mScreenOffModeChangeState( 0 ),
-    mScreenOffModeChangeDone( true ),
-    mBrightness( 0 ),
-    mBrightnessChangeState( 0 ),
-    mBrightnessChangeDone( true )
-  {
-    // store ecore window handle
-    ECore::WindowRenderSurface* wlWindow( dynamic_cast< ECore::WindowRenderSurface * >( mWindow->mSurface ) );
-    if( wlWindow )
-    {
-      mEcoreWindow = wlWindow->GetWlWindow();
-    }
-    DALI_ASSERT_ALWAYS( mEcoreWindow != 0 && "There is no ecore Wl window");
-
-    if( mWindow->mEcoreEventHander )
-    {
-      mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this ) );
-      mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_IN, EcoreEventWindowFocusIn, this ) );
-      mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_FOCUS_OUT, EcoreEventWindowFocusOut, this ) );
-      mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_OUTPUT_TRANSFORM, EcoreEventOutputTransform, this) );
-      mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_IGNORE_OUTPUT_TRANSFORM, EcoreEventIgnoreOutputTransform, this) );
-    }
-
-    mDisplay = ecore_wl_display_get();
-
-    if( mDisplay )
-    {
-      wl_display* displayWrapper = static_cast< wl_display* >( wl_proxy_create_wrapper( mDisplay ) );
-      if( displayWrapper )
-      {
-        mEventQueue = wl_display_create_queue( mDisplay );
-        if( mEventQueue )
-        {
-          wl_proxy_set_queue( reinterpret_cast< wl_proxy* >( displayWrapper ), mEventQueue );
-
-          wl_registry* registry = wl_display_get_registry( displayWrapper );
-          wl_registry_add_listener( registry, &mRegistryListener, this );
-        }
-
-        wl_proxy_wrapper_destroy( displayWrapper );
-      }
-    }
-  }
-
-  /**
-   * Destructor
-   */
-  ~EventHandler()
-  {
-    for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
-    {
-      ecore_event_handler_del( *iter );
-    }
-    mEcoreEventHandler.Clear();
-
-    if( mEventQueue )
-    {
-      wl_event_queue_destroy( mEventQueue );
-    }
-  }
-
-  // Static methods
-
-  /// Called when the window iconify state is changed.
-  static Eina_Bool EcoreEventWindowIconifyStateChanged( void* data, int type, void* event )
-  {
-    Ecore_Wl_Event_Window_Iconify_State_Change* iconifyChangedEvent( static_cast< Ecore_Wl_Event_Window_Iconify_State_Change* >( event ) );
-    EventHandler* handler( static_cast< EventHandler* >( data ) );
-    Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
-
-    if ( handler && handler->mWindow )
-    {
-      WindowVisibilityObserver* observer( handler->mWindow->mAdaptor );
-      if ( observer && ( iconifyChangedEvent->win == static_cast< unsigned int> ( ecore_wl_window_id_get( handler->mEcoreWindow ) ) ) )
-      {
-        if( iconifyChangedEvent->iconified == EINA_TRUE )
-        {
-          handler->mWindow->mIconified = true;
-          if( handler->mWindow->mVisible )
-          {
-            observer->OnWindowHidden();
-          }
-          DALI_LOG_RELEASE_INFO( "Window (%p) Iconified\n", handler->mEcoreWindow);
-        }
-        else
-        {
-          handler->mWindow->mIconified = false;
-          if( handler->mWindow->mVisible )
-          {
-            observer->OnWindowShown();
-          }
-          DALI_LOG_RELEASE_INFO( "Window (%p) Deiconified\n", handler->mEcoreWindow );
-        }
-        handled = ECORE_CALLBACK_DONE;
-      }
-    }
-
-    return handled;
-  }
-
-  /// Called when the window gains focus
-  static Eina_Bool EcoreEventWindowFocusIn( void* data, int type, void* event )
-  {
-    Ecore_Wl_Event_Focus_In* focusInEvent( static_cast< Ecore_Wl_Event_Focus_In* >( event ) );
-    EventHandler* handler( static_cast< EventHandler* >( data ) );
-
-    if ( handler && handler->mWindow && focusInEvent->win == static_cast< unsigned int >( ecore_wl_window_id_get( handler->mEcoreWindow ) ) )
-    {
-      DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window EcoreEventWindowFocusIn\n" );
-
-      handler->mWindow->mFocusChangedSignal.Emit( true );
-    }
-
-    return ECORE_CALLBACK_PASS_ON;
-  }
-
-  /// Called when the window loses focus
-  static Eina_Bool EcoreEventWindowFocusOut( void* data, int type, void* event )
-  {
-    Ecore_Wl_Event_Focus_Out* focusOutEvent( static_cast< Ecore_Wl_Event_Focus_Out* >( event ) );
-    EventHandler* handler( static_cast< EventHandler* >( data ) );
-
-    if ( handler && handler->mWindow && focusOutEvent->win == static_cast< unsigned int >(ecore_wl_window_id_get( handler->mEcoreWindow ) ) )
-    {
-      DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window EcoreEventWindowFocusOut\n" );
-
-      handler->mWindow->mFocusChangedSignal.Emit( false );
-    }
-
-    return ECORE_CALLBACK_PASS_ON;
-  }
-
-  /// Called when the output is transformed
-  static Eina_Bool EcoreEventOutputTransform( void* data, int type, void* event )
-  {
-    Ecore_Wl_Event_Output_Transform* transformEvent( static_cast< Ecore_Wl_Event_Output_Transform* >( event ) );
-    EventHandler* handler( static_cast< EventHandler* >( data ) );
-
-    if ( handler && handler->mWindow && transformEvent->output == ecore_wl_window_output_find( handler->mEcoreWindow ) )
-    {
-      DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", handler->mEcoreWindow );
-
-      ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( handler->mWindow->mSurface ) );
-      if( wlSurface )
-      {
-        wlSurface->OutputTransformed();
-
-        PositionSize positionSize = wlSurface->GetPositionSize();
-        handler->mWindow->mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
-        handler->mWindow->mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
-      }
-    }
-
-    return ECORE_CALLBACK_PASS_ON;
-  }
-
-  /// Called when the output transform should be ignored
-  static Eina_Bool EcoreEventIgnoreOutputTransform( void* data, int type, void* event )
-  {
-    Ecore_Wl_Event_Ignore_Output_Transform* ignoreTransformEvent( static_cast< Ecore_Wl_Event_Ignore_Output_Transform* >( event ) );
-    EventHandler* handler( static_cast< EventHandler* >( data ) );
-
-    if ( handler && handler->mWindow && ignoreTransformEvent->win == handler->mEcoreWindow )
-    {
-      DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", handler->mEcoreWindow );
-
-      ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( handler->mWindow->mSurface ) );
-      if( wlSurface )
-      {
-        wlSurface->OutputTransformed();
-
-        PositionSize positionSize = wlSurface->GetPositionSize();
-        handler->mWindow->mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
-        handler->mWindow->mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
-      }
-    }
-
-    return ECORE_CALLBACK_PASS_ON;
-  }
-
-  static void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version )
-  {
-    Window::EventHandler* eventHandler = static_cast< Window::EventHandler* >( data );
-
-    if( strcmp( interface, tizen_policy_interface.name ) == 0 )
-    {
-      uint32_t clientVersion = std::min( version, MAX_TIZEN_CLIENT_VERSION );
-
-      eventHandler->mTizenPolicy = static_cast< tizen_policy* >( wl_registry_bind( registry, name, &tizen_policy_interface, clientVersion ) );
-      if( !eventHandler->mTizenPolicy )
-      {
-        DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::RegistryGlobalCallback: wl_registry_bind(tizen_policy_interface) is failed.\n" );
-        return;
-      }
-
-      tizen_policy_add_listener( eventHandler->mTizenPolicy, &eventHandler->mTizenPolicyListener, data );
-
-      DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::RegistryGlobalCallback: tizen_policy_add_listener is called.\n" );
-    }
-    else if( strcmp( interface, tizen_display_policy_interface.name ) == 0 )
-    {
-      eventHandler->mTizenDisplayPolicy = static_cast< tizen_display_policy* >( wl_registry_bind( registry, name, &tizen_display_policy_interface, version ) );
-      if( !eventHandler->mTizenDisplayPolicy )
-      {
-        DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::RegistryGlobalCallback: wl_registry_bind(tizen_display_policy_interface) is failed.\n" );
-        return;
-      }
-
-      tizen_display_policy_add_listener( eventHandler->mTizenDisplayPolicy, &eventHandler->mTizenDisplayPolicyListener, data );
-
-      DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::RegistryGlobalCallback: tizen_display_policy_add_listener is called.\n" );
-    }
-  }
-
-  static void RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id )
-  {
-    Window::EventHandler* eventHandler = static_cast< Window::EventHandler* >( data );
-    eventHandler->mTizenPolicy = NULL;
-    eventHandler->mTizenDisplayPolicy = NULL;
-  }
-
-  static void TizenPolicyConformant( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t isConformant )
-  {
-  }
-
-  static void TizenPolicyConformantArea( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t conformantPart, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h )
-  {
-  }
-
-  static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state )
-  {
-    Window::EventHandler* eventHandler = static_cast< Window::EventHandler* >( data );
-
-    eventHandler->mNotificationLevel = level;
-    eventHandler->mNotificationChangeState = state;
-    eventHandler->mNotificationLevelChangeDone = true;
-
-    DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::TizenPolicyNotificationChangeDone: level = %d, state = %d\n", level, state );
-  }
-
-  static void TizenPolicyTransientForDone( void* data, struct tizen_policy* tizenPolicy, uint32_t childId )
-  {
-  }
-
-  static void TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state )
-  {
-    Window::EventHandler* eventHandler = static_cast< Window::EventHandler* >( data );
-
-    eventHandler->mScreenOffMode = mode;
-    eventHandler->mScreenOffModeChangeState = state;
-    eventHandler->mScreenOffModeChangeDone = true;
-
-    DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::TizenPolicyScreenModeChangeDone: mode = %d, state = %d\n", mode, state );
-  }
-
-  static void TizenPolicyIconifyStateChanged( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t iconified, uint32_t force )
-  {
-  }
-
-  static void TizenPolicySupportedAuxiliaryHints( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, struct wl_array* hints, uint32_t numNints )
-  {
-  }
-
-  static void TizenPolicyAllowedAuxiliaryHint( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int id )
-  {
-  }
-
-  static void TizenPolicyAuxiliaryMessage( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, const char* key, const char* val, struct wl_array* options )
-  {
-  }
-
-  static void TizenPolicyConformantRegion( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t conformantPart, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t serial )
-  {
-  }
-
-  static void DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state )
-  {
-    Window::EventHandler* eventHandler = static_cast< Window::EventHandler* >( data );
-
-    eventHandler->mBrightness = brightness;
-    eventHandler->mBrightnessChangeState = state;
-    eventHandler->mBrightnessChangeDone = true;
-
-    DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window::EventHandler::DisplayPolicyBrightnessChangeDone: brightness = %d, state = %d\n", brightness, state );
-  }
-
-  const struct wl_registry_listener mRegistryListener =
-  {
-     RegistryGlobalCallback,
-     RegistryGlobalCallbackRemove
-  };
-
-  const struct tizen_policy_listener mTizenPolicyListener =
-  {
-     TizenPolicyConformant,
-     TizenPolicyConformantArea,
-     TizenPolicyNotificationChangeDone,
-     TizenPolicyTransientForDone,
-     TizenPolicyScreenModeChangeDone,
-     TizenPolicyIconifyStateChanged,
-     TizenPolicySupportedAuxiliaryHints,
-     TizenPolicyAllowedAuxiliaryHint,
-     TizenPolicyAuxiliaryMessage,
-     TizenPolicyConformantRegion
-  };
-
-  const struct tizen_display_policy_listener mTizenDisplayPolicyListener =
-  {
-    DisplayPolicyBrightnessChangeDone
-  };
-
-  // Data
-  Window* mWindow;
-  Dali::Vector< Ecore_Event_Handler* > mEcoreEventHandler;
-  Ecore_Wl_Window* mEcoreWindow;
-
-  wl_display* mDisplay;
-  wl_event_queue* mEventQueue;
-  tizen_policy* mTizenPolicy;
-  tizen_display_policy* mTizenDisplayPolicy;
-
-  int mNotificationLevel;
-  uint32_t mNotificationChangeState;
-  bool mNotificationLevelChangeDone;
-
-  int mScreenOffMode;
-  uint32_t mScreenOffModeChangeState;
-  bool mScreenOffModeChangeDone;
-
-  int mBrightness;
-  uint32_t mBrightnessChangeState;
-  bool mBrightnessChangeDone;
-};
-
-Window* Window::New( const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent )
-{
-  Window* window = new Window();
-  window->mIsTransparent = isTransparent;
-  window->Initialize( positionSize, name, className );
-  return window;
-}
-
-void Window::SetAdaptor(Dali::Adaptor& adaptor)
-{
-  DALI_ASSERT_ALWAYS( !mStarted && "Adaptor already started" );
-  mStarted = true;
-
-  // Only create one overlay per window
-  Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation(adaptor);
-  Integration::Core& core = adaptorImpl.GetCore();
-  mOverlay = &core.GetSystemOverlay();
-
-  Dali::RenderTaskList taskList = mOverlay->GetOverlayRenderTasks();
-  taskList.CreateTask();
-
-  mAdaptor = &adaptorImpl;
-  mAdaptor->AddObserver( *this );
-
-  // Can only create the detector when we know the Core has been instantiated.
-  mDragAndDropDetector = DragAndDropDetector::New();
-  mAdaptor->SetDragAndDropDetector( &GetImplementation( mDragAndDropDetector ) );
-
-  if( mOrientation )
-  {
-    mOrientation->SetAdaptor(adaptor);
-  }
-
-  if( mIndicator != NULL )
-  {
-    mIndicator->SetAdaptor(mAdaptor);
-  }
-}
-
-RenderSurface* Window::GetSurface()
-{
-  return mSurface;
-}
-
-void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode )
-{
-  DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "visible : %d\n", visibleMode );
-  DALI_ASSERT_DEBUG(mOverlay);
-
-  ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
-  DALI_ASSERT_DEBUG(wlSurface);
-
-  if( wlSurface )
-  {
-    Ecore_Wl_Window* wlWindow = wlSurface->GetWlWindow();
-
-    mIndicatorVisible = visibleMode;
-
-    if ( mIndicatorVisible == Dali::Window::VISIBLE )
-    {
-      // when the indicator is visible, set proper mode for indicator server according to bg mode
-      if ( mIndicatorOpacityMode == Dali::Window::OPAQUE )
-      {
-        ecore_wl_window_indicator_opacity_set(wlWindow, ECORE_WL_INDICATOR_OPAQUE);
-      }
-      else if ( mIndicatorOpacityMode == Dali::Window::TRANSLUCENT )
-      {
-        ecore_wl_window_indicator_opacity_set(wlWindow, ECORE_WL_INDICATOR_TRANSLUCENT);
-      }
-      else if ( mIndicatorOpacityMode == Dali::Window::TRANSPARENT )
-      {
-        ecore_wl_window_indicator_opacity_set(wlWindow, ECORE_WL_INDICATOR_OPAQUE);
-      }
-    }
-    else
-    {
-      // when the indicator is not visible, set TRANSPARENT mode for indicator server
-      ecore_wl_window_indicator_opacity_set(wlWindow, ECORE_WL_INDICATOR_TRANSPARENT); // it means hidden indicator
-    }
-  }
-
-  DoShowIndicator( mIndicatorOrientation );
-}
-
-void Window::RotateIndicator( Dali::Window::WindowOrientation orientation )
-{
-  DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "Orientation: %d\n", orientation );
-
-  DoRotateIndicator( orientation );
-}
-
-void Window::SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacityMode )
-{
-  mIndicatorOpacityMode = opacityMode;
-
-  if( mIndicator != NULL )
-  {
-    mIndicator->SetOpacityMode( opacityMode );
-  }
-}
-
-void Window::SetClass(std::string name, std::string klass)
-{
-  ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
-
-  if( wlSurface )
-  {
-    Ecore_Wl_Window* wlWindow = wlSurface->GetWlWindow();
-    ecore_wl_window_title_set( wlWindow, name.c_str() );
-    ecore_wl_window_class_name_set( wlWindow, klass.c_str() );
-  }
-  else
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window has no surface\n" );
-  }
-}
-
-Window::Window()
-: mSurface( NULL ),
-  mIndicatorVisible( Dali::Window::VISIBLE ),
-  mIndicatorIsShown( false ),
-  mShowRotatedIndicatorOnClose( false ),
-  mStarted( false ),
-  mIsTransparent( false ),
-  mWMRotationAppSet( false ),
-  mEcoreEventHander( true ),
-  mIsFocusAcceptable( true ),
-  mVisible( true ),
-  mIconified( false ),
-  mOpaqueState( false ),
-  mResizeEnabled( false ),
-  mIndicator( NULL ),
-  mIndicatorOrientation( Dali::Window::PORTRAIT ),
-  mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
-  mIndicatorOpacityMode( Dali::Window::OPAQUE ),
-  mOverlay( NULL ),
-  mAdaptor( NULL ),
-  mType( Dali::Window::NORMAL ),
-  mEventHandler( NULL ),
-  mPreferredOrientation( Dali::Window::PORTRAIT ),
-  mSupportedAuxiliaryHints(),
-  mAuxiliaryHints(),
-  mIndicatorVisibilityChangedSignal(),
-  mFocusChangedSignal(),
-  mResizedSignal(),
-  mDeleteRequestSignal()
-{
-}
-
-Window::~Window()
-{
-  delete mEventHandler;
-
-  if( mIndicator )
-  {
-    mIndicator->Close();
-    delete mIndicator;
-  }
-
-  if ( mAdaptor )
-  {
-    mAdaptor->RemoveObserver( *this );
-    mAdaptor->SetDragAndDropDetector( NULL );
-    mAdaptor = NULL;
-  }
-
-  delete mSurface;
-
-  mSupportedAuxiliaryHints.clear();
-  mAuxiliaryHints.clear();
-}
-
-void Window::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className)
-{
-  // create an Wayland window by default
-  Any surface;
-  ECore::WindowRenderSurface* windowSurface = new ECore::WindowRenderSurface( positionSize, surface, name, mIsTransparent );
-
-  mSurface = windowSurface;
-
-  // create event handler for Wayland window
-  mEventHandler = new EventHandler( this );
-
-  // get auxiliary hint
-  Eina_List* hints = ecore_wl_window_aux_hints_supported_get( mEventHandler->mEcoreWindow );
-  if( hints )
-  {
-    Eina_List* l = NULL;
-    char* hint = NULL;
-
-    for( l = hints, ( hint =  static_cast< char* >( eina_list_data_get(l) ) ); l; l = eina_list_next(l), ( hint = static_cast< char* >( eina_list_data_get(l) ) ) )
-    {
-      mSupportedAuxiliaryHints.push_back( hint );
-
-      DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::Initialize: %s\n", hint );
-    }
-  }
-
-  if( !positionSize.IsEmpty() )
-  {
-    AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
-    mResizeEnabled = true;
-  }
-
-  SetClass( name, className );
-  windowSurface->Map();
-
-  mOrientation = Orientation::New(this);
-}
-
-void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation )
-{
-  if( mIndicator == NULL )
-  {
-    if( mIndicatorVisible != Dali::Window::INVISIBLE )
-    {
-      mIndicator = new Indicator( mAdaptor, mIndicatorOrientation, this );
-      mIndicator->SetOpacityMode( mIndicatorOpacityMode );
-      Dali::Actor actor = mIndicator->GetActor();
-      SetIndicatorActorRotation();
-      mOverlay->Add(actor);
-    }
-    // else don't create a hidden indicator
-  }
-  else // Already have indicator
-  {
-    if( mIndicatorVisible == Dali::Window::VISIBLE )
-    {
-      // If we are resuming, and rotation has changed,
-      if( mIndicatorIsShown == false && mIndicatorOrientation != mNextIndicatorOrientation )
-      {
-        // then close current indicator and open new one
-        mShowRotatedIndicatorOnClose = true;
-        mIndicator->Close(); // May synchronously call IndicatorClosed() callback & 1 level of recursion
-        // Don't show actor - will contain indicator for old orientation.
-      }
-    }
-  }
-
-  // set indicator visible mode
-  if( mIndicator != NULL )
-  {
-    mIndicator->SetVisible( mIndicatorVisible );
-  }
-
-  bool show = (mIndicatorVisible != Dali::Window::INVISIBLE );
-  SetIndicatorProperties( show, lastOrientation );
-  mIndicatorIsShown = show;
-}
-
-void Window::DoRotateIndicator( Dali::Window::WindowOrientation orientation )
-{
-  if( mIndicatorIsShown )
-  {
-    mShowRotatedIndicatorOnClose = true;
-    mNextIndicatorOrientation = orientation;
-    mIndicator->Close(); // May synchronously call IndicatorClosed() callback
-  }
-  else
-  {
-    // Save orientation for when the indicator is next shown
-    mShowRotatedIndicatorOnClose = false;
-    mNextIndicatorOrientation = orientation;
-  }
-}
-
-void Window::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
-{
-  ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
-
-  if( wlSurface )
-  {
-    Ecore_Wl_Window* wlWindow = wlSurface->GetWlWindow();
-    if ( isShow )
-    {
-      ecore_wl_window_indicator_state_set(wlWindow, ECORE_WL_INDICATOR_STATE_ON);
-    }
-    else
-    {
-      ecore_wl_window_indicator_state_set(wlWindow, ECORE_WL_INDICATOR_STATE_OFF);
-    }
-  }
-}
-
-void Window::IndicatorTypeChanged(Indicator::Type type)
-{
-#if defined(DALI_PROFILE_MOBILE)
-  ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
-
-  if( wlSurface )
-  {
-    Ecore_Wl_Window* wlWindow = wlSurface->GetWlWindow();
-    switch(type)
-    {
-      case Indicator::INDICATOR_TYPE_1:
-        ecore_wl_indicator_visible_type_set(wlWindow, ECORE_WL_INDICATOR_VISIBLE_TYPE_SHOWN);
-        break;
-
-      case Indicator::INDICATOR_TYPE_2:
-        ecore_wl_indicator_visible_type_set(wlWindow, ECORE_WL_INDICATOR_VISIBLE_TYPE_HIDDEN);
-        break;
-
-      case Indicator::INDICATOR_TYPE_UNKNOWN:
-      default:
-        break;
-    }
-  }
-#endif //MOBILE
-}
-
-void Window::IndicatorClosed( IndicatorInterface* indicator )
-{
-  DALI_LOG_TRACE_METHOD( gWindowLogFilter );
-
-  if( mShowRotatedIndicatorOnClose )
-  {
-    Dali::Window::WindowOrientation currentOrientation = mIndicatorOrientation;
-    mIndicator->Open(mNextIndicatorOrientation);
-    mIndicatorOrientation = mNextIndicatorOrientation;
-    SetIndicatorActorRotation();
-    DoShowIndicator(currentOrientation);
-  }
-}
-
-void Window::IndicatorVisibilityChanged(bool isVisible)
-{
-  mIndicatorVisibilityChangedSignal.Emit(isVisible);
-}
-
-void Window::SetIndicatorActorRotation()
-{
-  DALI_LOG_TRACE_METHOD( gWindowLogFilter );
-  DALI_ASSERT_DEBUG( mIndicator != NULL );
-
-  Dali::Actor actor = mIndicator->GetActor();
-  switch( mIndicatorOrientation )
-  {
-    case Dali::Window::PORTRAIT:
-      actor.SetParentOrigin( ParentOrigin::TOP_CENTER );
-      actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
-      actor.SetOrientation( Degree(0), Vector3::ZAXIS );
-      break;
-    case Dali::Window::PORTRAIT_INVERSE:
-      actor.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
-      actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
-      actor.SetOrientation( Degree(180), Vector3::ZAXIS );
-      break;
-    case Dali::Window::LANDSCAPE:
-      actor.SetParentOrigin( ParentOrigin::CENTER_LEFT );
-      actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
-      actor.SetOrientation( Degree(270), Vector3::ZAXIS );
-      break;
-    case Dali::Window::LANDSCAPE_INVERSE:
-      actor.SetParentOrigin( ParentOrigin::CENTER_RIGHT );
-      actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
-      actor.SetOrientation( Degree(90), Vector3::ZAXIS );
-      break;
-  }
-}
-
-void Window::Raise()
-{
-  // Use ecore_wl_window_activate to prevent the window shown without rendering
-  ecore_wl_window_activate( mEventHandler->mEcoreWindow );
-}
-
-void Window::Lower()
-{
-  ecore_wl_window_lower( mEventHandler->mEcoreWindow );
-}
-
-void Window::Activate()
-{
-  ecore_wl_window_activate( mEventHandler->mEcoreWindow );
-}
-
-Dali::DragAndDropDetector Window::GetDragAndDropDetector() const
-{
-  return mDragAndDropDetector;
-}
-
-Dali::Any Window::GetNativeHandle() const
-{
-  if(mEventHandler)
-  {
-    return mEventHandler->mEcoreWindow;
-  }
-  else
-  {
-    return Dali::Any();
-  }
-}
-
-void Window::OnStart()
-{
-  DoShowIndicator( mIndicatorOrientation );
-}
-
-void Window::OnPause()
-{
-}
-
-void Window::OnResume()
-{
-  // resume indicator status
-  if( mIndicator != NULL )
-  {
-    // Restore own indicator opacity
-    // Send opacity mode to indicator service when app resumed
-    mIndicator->SetOpacityMode( mIndicatorOpacityMode );
-  }
-}
-
-void Window::OnStop()
-{
-  if( mIndicator )
-  {
-    mIndicator->Close();
-  }
-
-  delete mIndicator;
-  mIndicator = NULL;
-}
-
-void Window::OnDestroy()
-{
-  mAdaptor = NULL;
-}
-
-void Window::AddAvailableOrientation(Dali::Window::WindowOrientation orientation)
-{
-  bool found = false;
-
-  if ( orientation <= Dali::Window::LANDSCAPE_INVERSE )
-  {
-    for( std::size_t i = 0; i < mAvailableOrientations.size(); i++ )
-    {
-      if( mAvailableOrientations[i] == orientation )
-      {
-        found = true;
-        break;
-      }
-    }
-
-    if( ! found )
-    {
-      mAvailableOrientations.push_back(orientation);
-      SetAvailableOrientations( mAvailableOrientations );
-    }
-  }
-}
-
-void Window::RemoveAvailableOrientation(Dali::Window::WindowOrientation orientation)
-{
-  for( std::vector<Dali::Window::WindowOrientation>::iterator iter = mAvailableOrientations.begin();
-       iter != mAvailableOrientations.end(); ++iter )
-  {
-    if( *iter == orientation )
-    {
-      mAvailableOrientations.erase( iter );
-      break;
-    }
-  }
-  SetAvailableOrientations( mAvailableOrientations );
-}
-
-void Window::SetAvailableOrientations(const std::vector<Dali::Window::WindowOrientation>& orientations)
-{
-  int rotations[4] = { 0 };
-  for( std::size_t i = 0; i < mAvailableOrientations.size(); ++i )
-  {
-    rotations[i] = static_cast< int >( mAvailableOrientations[i] );
-  }
-  ecore_wl_window_rotation_available_rotations_set( mEventHandler->mEcoreWindow, rotations, mAvailableOrientations.size() );
-}
-
-const std::vector<Dali::Window::WindowOrientation>& Window::GetAvailableOrientations()
-{
-  return mAvailableOrientations;
-}
-
-void Window::SetPreferredOrientation(Dali::Window::WindowOrientation orientation)
-{
-  mPreferredOrientation = orientation;
-
-  ecore_wl_window_rotation_preferred_rotation_set( mEventHandler->mEcoreWindow, orientation );
-}
-
-Dali::Window::WindowOrientation Window::GetPreferredOrientation()
-{
-  return mPreferredOrientation;
-}
-
-void Window::SetAcceptFocus( bool accept )
-{
-  mIsFocusAcceptable = accept;
-
-  ecore_wl_window_focus_skip_set( mEventHandler->mEcoreWindow, !accept );
-}
-
-bool Window::IsFocusAcceptable() const
-{
-  return mIsFocusAcceptable;
-}
-
-void Window::Show()
-{
-  mVisible = true;
-  ecore_wl_window_show( mEventHandler->mEcoreWindow );
-
-  if( !mIconified )
-  {
-    if( mAdaptor )
-    {
-      WindowVisibilityObserver* observer( mAdaptor );
-      observer->OnWindowShown();
-      DALI_LOG_RELEASE_INFO( "Window (%p) ::Show() \n", mEventHandler->mEcoreWindow);
-    }
-  }
-}
-
-void Window::Hide()
-{
-  mVisible = false;
-  ecore_wl_window_hide( mEventHandler->mEcoreWindow );
-
-  if( !mIconified )
-  {
-    if( mAdaptor )
-    {
-      WindowVisibilityObserver* observer( mAdaptor );
-      observer->OnWindowHidden();
-      DALI_LOG_RELEASE_INFO( "Window (%p) ::Hide() \n", mEventHandler->mEcoreWindow);
-    }
-  }
-}
-
-bool Window::IsVisible() const
-{
-  return mVisible;
-}
-
-void Window::RotationDone( int orientation, int width, int height )
-{
-  ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
-  if( wlSurface )
-  {
-    wlSurface->RequestRotation( orientation, width, height );
-  }
-
-  mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( width, height ) );
-
-  // Emit signal
-  mResizedSignal.Emit( Dali::Window::WindowSize( width, height ) );
-
-  mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( width, height ) );
-}
-
-void Window::SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode )
-{
-  mIndicatorVisible = mode;
-}
-
-unsigned int Window::GetSupportedAuxiliaryHintCount() const
-{
-  return mSupportedAuxiliaryHints.size();
-}
-
-std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
-{
-  if( index >= GetSupportedAuxiliaryHintCount() )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetSupportedAuxiliaryHint: Invalid index! [%d]\n", index );
-  }
-
-  return mSupportedAuxiliaryHints[index];
-}
-
-unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
-{
-  bool supported = false;
-
-  // Check if the hint is suppported
-  for( std::vector< std::string >::iterator iter = mSupportedAuxiliaryHints.begin(); iter != mSupportedAuxiliaryHints.end(); ++iter )
-  {
-    if( *iter == hint )
-    {
-      supported = true;
-      break;
-    }
-  }
-
-  if( !supported )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Concise, "Window::AddAuxiliaryHint: Not supported auxiliary hint [%s]\n", hint.c_str() );
-    return 0;
-  }
-
-  // Check if the hint is already added
-  for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
-  {
-    if( mAuxiliaryHints[i].first == hint )
-    {
-      // Just change the value
-      mAuxiliaryHints[i].second = value;
-
-      DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::AddAuxiliaryHint: Change! hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), i + 1 );
-
-      return i + 1;   // id is index + 1
-    }
-  }
-
-  // Add the hint
-  mAuxiliaryHints.push_back( std::pair< std::string, std::string >( hint, value ) );
-
-  unsigned int id = mAuxiliaryHints.size();
-
-  ecore_wl_window_aux_hint_add( mEventHandler->mEcoreWindow, static_cast< int >( id ), hint.c_str(), value.c_str() );
-
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id );
-
-  return id;
-}
-
-bool Window::RemoveAuxiliaryHint( unsigned int id )
-{
-  if( id == 0 || id > mAuxiliaryHints.size() )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Concise, "Window::RemoveAuxiliaryHint: Invalid id [%d]\n", id );
-    return false;
-  }
-
-  mAuxiliaryHints[id - 1].second = std::string();
-
-  ecore_wl_window_aux_hint_del( mEventHandler->mEcoreWindow, static_cast< int >( id ) );
-
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str() );
-
-  return true;
-}
-
-bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
-{
-  if( id == 0 || id > mAuxiliaryHints.size() )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Concise, "Window::SetAuxiliaryHintValue: Invalid id [%d]\n", id );
-    return false;
-  }
-
-  mAuxiliaryHints[id - 1].second = value;
-
-  ecore_wl_window_aux_hint_change( mEventHandler->mEcoreWindow, static_cast< int >( id ), value.c_str() );
-
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetAuxiliaryHintValue: id = %d, hint = %s, value = %s\n", id, mAuxiliaryHints[id - 1].first.c_str(), mAuxiliaryHints[id - 1].second.c_str() );
-
-  return true;
-}
-
-std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
-{
-  if( id == 0 || id > mAuxiliaryHints.size() )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Concise, "Window::GetAuxiliaryHintValue: Invalid id [%d]\n", id );
-    return std::string();
-  }
-
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetAuxiliaryHintValue: id = %d, hint = %s, value = %s\n", id, mAuxiliaryHints[id - 1].first.c_str(), mAuxiliaryHints[id - 1].second.c_str() );
-
-  return mAuxiliaryHints[id - 1].second;
-}
-
-unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
-{
-  for( unsigned int i = 0; i < mAuxiliaryHints.size(); i++ )
-  {
-    if( mAuxiliaryHints[i].first == hint )
-    {
-      DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetAuxiliaryHintId: hint = %s, id = %d\n", hint.c_str(), i + 1 );
-      return i + 1;
-    }
-  }
-
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetAuxiliaryHintId: Invalid hint! [%s]\n", hint.c_str() );
-
-  return 0;
-}
-
-void Window::SetInputRegion( const Rect< int >& inputRegion )
-{
-  ecore_wl_window_input_region_set( mEventHandler->mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
-
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetInputRegion: x = %d, y = %d, w = %d, h = %d\n", inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
-}
-
-void Window::SetType( Dali::Window::Type type )
-{
-  Ecore_Wl_Window_Type windowType;
-
-  if( type != mType )
-  {
-    switch( type )
-    {
-      case Dali::Window::NORMAL:
-      {
-        windowType = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
-        break;
-      }
-      case Dali::Window::NOTIFICATION:
-      {
-        windowType = ECORE_WL_WINDOW_TYPE_NOTIFICATION;
-        break;
-      }
-      case Dali::Window::UTILITY:
-      {
-        windowType = ECORE_WL_WINDOW_TYPE_UTILITY;
-        break;
-      }
-      case Dali::Window::DIALOG:
-      {
-        windowType = ECORE_WL_WINDOW_TYPE_DIALOG;
-        break;
-      }
-      default:
-      {
-        windowType = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
-        break;
-      }
-    }
-
-    ecore_wl_window_type_set( mEventHandler->mEcoreWindow, windowType );
-  }
-
-  mType = type;
-}
-
-Dali::Window::Type Window::GetType() const
-{
-  return mType;
-}
-
-bool Window::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
-{
-  if( mType != Dali::Window::NOTIFICATION )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", mType );
-    return false;
-  }
-
-  while( !mEventHandler->mTizenPolicy )
-  {
-    wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
-  }
-
-  int notificationLevel;
-
-  switch( level )
-  {
-    case Dali::Window::NotificationLevel::NONE:
-    {
-      notificationLevel = TIZEN_POLICY_LEVEL_NONE;
-      break;
-    }
-    case Dali::Window::NotificationLevel::BASE:
-    {
-      notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
-      break;
-    }
-    case Dali::Window::NotificationLevel::MEDIUM:
-    {
-      notificationLevel = TIZEN_POLICY_LEVEL_MEDIUM;
-      break;
-    }
-    case Dali::Window::NotificationLevel::HIGH:
-    {
-      notificationLevel = TIZEN_POLICY_LEVEL_HIGH;
-      break;
-    }
-    case Dali::Window::NotificationLevel::TOP:
-    {
-      notificationLevel = TIZEN_POLICY_LEVEL_TOP;
-      break;
-    }
-    default:
-    {
-      DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: invalid level [%d]\n", level );
-      notificationLevel = TIZEN_POLICY_LEVEL_DEFAULT;
-      break;
-    }
-  }
-
-  mEventHandler->mNotificationLevelChangeDone = false;
-  mEventHandler->mNotificationChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
-
-  tizen_policy_set_notification_level( mEventHandler->mTizenPolicy, ecore_wl_window_surface_get( mEventHandler->mEcoreWindow ), notificationLevel );
-
-  int count = 0;
-
-  while( !mEventHandler->mNotificationLevelChangeDone && count < 3 )
-  {
-    ecore_wl_flush();
-    wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
-    count++;
-  }
-
-  if( !mEventHandler->mNotificationLevelChangeDone )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mEventHandler->mNotificationChangeState );
-    return false;
-  }
-  else if( mEventHandler->mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Permission denied! [%d]\n", level );
-    return false;
-  }
-
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Level is changed [%d]\n", mEventHandler->mNotificationLevel );
-
-  return true;
-}
-
-Dali::Window::NotificationLevel::Type Window::GetNotificationLevel() const
-{
-  if( mType != Dali::Window::NOTIFICATION )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", mType );
-    return Dali::Window::NotificationLevel::NONE;
-  }
-
-  while( !mEventHandler->mTizenPolicy )
-  {
-    wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
-  }
-
-  int count = 0;
-
-  while( !mEventHandler->mNotificationLevelChangeDone && count < 3 )
-  {
-    ecore_wl_flush();
-    wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
-    count++;
-  }
-
-  if( !mEventHandler->mNotificationLevelChangeDone )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Error! [%d]\n", mEventHandler->mNotificationChangeState );
-    return Dali::Window::NotificationLevel::NONE;
-  }
-
-  Dali::Window::NotificationLevel::Type level;
-
-  switch( mEventHandler->mNotificationLevel )
-  {
-    case TIZEN_POLICY_LEVEL_NONE:
-    {
-      level = Dali::Window::NotificationLevel::NONE;
-      break;
-    }
-    case TIZEN_POLICY_LEVEL_DEFAULT:
-    {
-      level = Dali::Window::NotificationLevel::BASE;
-      break;
-    }
-    case TIZEN_POLICY_LEVEL_MEDIUM:
-    {
-      level = Dali::Window::NotificationLevel::MEDIUM;
-      break;
-    }
-    case TIZEN_POLICY_LEVEL_HIGH:
-    {
-      level = Dali::Window::NotificationLevel::HIGH;
-      break;
-    }
-    case TIZEN_POLICY_LEVEL_TOP:
-    {
-      level = Dali::Window::NotificationLevel::TOP;
-      break;
-    }
-    default:
-    {
-      DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: invalid level [%d]\n", mEventHandler->mNotificationLevel );
-      level = Dali::Window::NotificationLevel::NONE;
-      break;
-    }
-  }
-
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: level [%d]\n", mEventHandler->mNotificationLevel );
-
-  return level;
-}
-
-void Window::SetOpaqueState( bool opaque )
-{
-  while( !mEventHandler->mTizenPolicy )
-  {
-    wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
-  }
-
-  tizen_policy_set_opaque_state( mEventHandler->mTizenPolicy, ecore_wl_window_surface_get( mEventHandler->mEcoreWindow ), ( opaque ? 1 : 0 ) );
-
-  mOpaqueState = opaque;
-
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetOpaqueState: opaque = %d\n", opaque );
-}
-
-bool Window::IsOpaqueState() const
-{
-  return mOpaqueState;
-}
-
-bool Window::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
-{
-  while( !mEventHandler->mTizenPolicy )
-  {
-    wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
-  }
-
-  mEventHandler->mScreenOffModeChangeDone = false;
-  mEventHandler->mScreenOffModeChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
-
-  unsigned int mode = 0;
-
-  switch( screenOffMode )
-  {
-    case Dali::Window::ScreenOffMode::TIMEOUT:
-    {
-      mode = 0;
-      break;
-    }
-    case Dali::Window::ScreenOffMode::NEVER:
-    {
-      mode = 1;
-      break;
-    }
-  }
-
-  tizen_policy_set_window_screen_mode( mEventHandler->mTizenPolicy, ecore_wl_window_surface_get( mEventHandler->mEcoreWindow ), mode );
-
-  int count = 0;
-
-  while( !mEventHandler->mScreenOffModeChangeDone && count < 3 )
-  {
-    ecore_wl_flush();
-    wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
-    count++;
-  }
-
-  if( !mEventHandler->mScreenOffModeChangeDone )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mEventHandler->mScreenOffModeChangeState );
-    return false;
-  }
-  else if( mEventHandler->mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode );
-    return false;
-  }
-
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetScreenOffMode: Screen mode is changed [%d]\n", mEventHandler->mScreenOffMode );
-
-  return true;
-}
-
-Dali::Window::ScreenOffMode::Type Window::GetScreenOffMode() const
-{
-  while( !mEventHandler->mTizenPolicy )
-  {
-    wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
-  }
-
-  int count = 0;
-
-  while( !mEventHandler->mScreenOffModeChangeDone && count < 3 )
-  {
-    ecore_wl_flush();
-    wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
-    count++;
-  }
-
-  if( !mEventHandler->mScreenOffModeChangeDone )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetScreenOffMode: Error! [%d]\n", mEventHandler->mScreenOffModeChangeState );
-    return Dali::Window::ScreenOffMode::TIMEOUT;
-  }
-
-  Dali::Window::ScreenOffMode::Type screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
-
-  switch( mEventHandler->mScreenOffMode )
-  {
-    case 0:
-    {
-      screenMode = Dali::Window::ScreenOffMode::TIMEOUT;
-      break;
-    }
-    case 1:
-    {
-      screenMode = Dali::Window::ScreenOffMode::NEVER;
-      break;
-    }
-  }
-
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetScreenOffMode: screen mode [%d]\n", mEventHandler->mScreenOffMode );
-
-  return screenMode;
-}
-
-bool Window::SetBrightness( int brightness )
-{
-  if( brightness < 0 || brightness > 100 )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Invalid brightness value [%d]\n", brightness );
-    return false;
-  }
-
-  while( !mEventHandler->mTizenDisplayPolicy )
-  {
-    wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
-  }
-
-  mEventHandler->mBrightnessChangeDone = false;
-  mEventHandler->mBrightnessChangeState = TIZEN_POLICY_ERROR_STATE_NONE;
-
-  tizen_display_policy_set_window_brightness( mEventHandler->mTizenDisplayPolicy, ecore_wl_window_surface_get( mEventHandler->mEcoreWindow ), brightness );
-
-  int count = 0;
-
-  while( !mEventHandler->mBrightnessChangeDone && count < 3 )
-  {
-    ecore_wl_flush();
-    wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
-    count++;
-  }
-
-  if( !mEventHandler->mBrightnessChangeDone )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mEventHandler->mBrightnessChangeState );
-    return false;
-  }
-  else if( mEventHandler->mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Permission denied! [%d]\n", brightness );
-    return false;
-  }
-
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Brightness is changed [%d]\n", mEventHandler->mBrightness );
-
-  return true;
-}
-
-int Window::GetBrightness() const
-{
-  while( !mEventHandler->mTizenDisplayPolicy )
-  {
-    wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
-  }
-
-  int count = 0;
-
-  while( !mEventHandler->mBrightnessChangeDone && count < 3 )
-  {
-    ecore_wl_flush();
-    wl_display_dispatch_queue( mEventHandler->mDisplay, mEventHandler->mEventQueue );
-    count++;
-  }
-
-  if( !mEventHandler->mBrightnessChangeDone )
-  {
-    DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetBrightness: Error! [%d]\n", mEventHandler->mBrightnessChangeState );
-    return 0;
-  }
-
-  DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetBrightness: Brightness [%d]\n", mEventHandler->mBrightness );
-
-  return mEventHandler->mBrightness;
-}
-
-void Window::SetSize( Dali::Window::WindowSize size )
-{
-  if( !mResizeEnabled )
-  {
-    AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
-    mResizeEnabled = true;
-  }
-
-  PositionSize positionSize = mSurface->GetPositionSize();
-
-  if( positionSize.width != size.GetWidth() || positionSize.height != size.GetHeight() )
-  {
-    positionSize.width = size.GetWidth();
-    positionSize.height = size.GetHeight();
-
-    mSurface->MoveResize( positionSize );
-
-    mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
-
-    // Emit signal
-    mResizedSignal.Emit( Dali::Window::WindowSize( positionSize.width, positionSize.height ) );
-
-    mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
-  }
-}
-
-Dali::Window::WindowSize Window::GetSize() const
-{
-  PositionSize positionSize = mSurface->GetPositionSize();
-
-  return Dali::Window::WindowSize( positionSize.width, positionSize.height );
-}
-
-void Window::SetPosition( Dali::Window::WindowPosition position )
-{
-  if( !mResizeEnabled )
-  {
-    AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
-    mResizeEnabled = true;
-  }
-
-  PositionSize positionSize = mSurface->GetPositionSize();
-
-  if( positionSize.x != position.GetX() || positionSize.y != position.GetY() )
-  {
-    positionSize.x = position.GetX();
-    positionSize.y = position.GetY();
-
-    mSurface->MoveResize( positionSize );
-  }
-}
-
-Dali::Window::WindowPosition Window::GetPosition() const
-{
-  PositionSize positionSize = mSurface->GetPositionSize();
-
-  return Dali::Window::WindowPosition( positionSize.x, positionSize.y );
-}
-
-void Window::SetTransparency( bool transparent )
-{
-  ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) );
-  if( wlSurface )
-  {
-    wlSurface->SetTransparency( transparent );
-  }
-}
-
-} // Adaptor
-
-} // Internal
-
-} // Dali
-
-#pragma GCC diagnostic pop
index b5b7e0f..0333bb4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
-#include <dali/integration-api/wayland/wl-types.h>
+#include <dali/internal/window-system/tizen-wayland/wl-types.h>
 #include <dali/internal/graphics/gles20/egl-implementation.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
 #include <dali/integration-api/trigger-event-factory-interface.h>
 
 namespace Dali
 {
-
-#if defined(DEBUG_ENABLED)
-extern Debug::Filter* gRenderSurfaceLogFilter;
-#endif
-
-namespace ECore
+namespace Internal
+{
+namespace Adaptor
 {
 
 namespace
@@ -43,30 +40,38 @@ namespace
 
 const int MINIMUM_DIMENSION_CHANGE( 1 ); ///< Minimum change for window to be considered to have moved
 
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gWindowRenderSurfaceLogFilter = Debug::Filter::New(Debug::Verbose, false, "LOG_WINDOW_RENDER_SURFACE_ECORE_WL");
+#endif
+
 } // unnamed namespace
 
-WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize,
-                                          Any surface,
-                                          const std::string& name,
-                                          bool isTransparent)
-: EcoreWlRenderSurface( positionSize, surface, name, isTransparent ),
+WindowRenderSurfaceEcoreWl::WindowRenderSurfaceEcoreWl( Dali::PositionSize positionSize,
+                                                        Any surface,
+                                                        const std::string& name,
+                                                        bool isTransparent)
+: mTitle( name ),
+  mPositionSize( positionSize ),
   mWlWindow( NULL ),
   mWlSurface( NULL ),
   mEglWindow( NULL ),
   mThreadSynchronization( NULL ),
+  mRenderNotification( NULL ),
   mRotationTrigger( NULL ),
+  mColorDepth( isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24 ),
   mRotationAngle( 0 ),
   mScreenRotationAngle( 0 ),
+  mOwnSurface( false ),
   mRotationSupported( false ),
   mRotationFinished( true ),
   mScreenRotationFinished( true ),
   mResizeFinished( true )
 {
-  DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "Creating Window\n" );
-  Init( surface );
+  DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "Creating Window\n" );
+  Initialize( surface );
 }
 
-WindowRenderSurface::~WindowRenderSurface()
+WindowRenderSurfaceEcoreWl::~WindowRenderSurfaceEcoreWl()
 {
   if( mEglWindow != NULL )
   {
@@ -84,37 +89,88 @@ WindowRenderSurface::~WindowRenderSurface()
     delete mRotationTrigger;
   }
 
+  if( mOwnSurface )
+  {
+    ecore_wl_shutdown();
+  }
+}
+
+void WindowRenderSurfaceEcoreWl::Initialize( Any surface )
+{
+  // see if there is a surface in Any surface
+  unsigned int surfaceId = GetSurfaceId( surface );
+
+  // if the surface is empty, create a new one.
+  if( surfaceId == 0 )
+  {
+    // we own the surface about to created
+    ecore_wl_init( NULL );
+    mOwnSurface = true;
+    CreateRenderable();
+  }
+  else
+  {
+    // XLib should already be initialized so no point in calling XInitThreads
+    UseExistingRenderable( surfaceId );
+  }
 }
 
-Ecore_Wl_Window* WindowRenderSurface::GetDrawable()
+Ecore_Wl_Window* WindowRenderSurfaceEcoreWl::GetWlWindow()
 {
-  // already an e-core type
   return mWlWindow;
 }
 
-Any WindowRenderSurface::GetSurface()
+void WindowRenderSurfaceEcoreWl::OutputTransformed()
 {
-  // already an e-core type
-  return Any( mWlWindow );
+  int transform;
+
+  if( ecore_wl_window_ignore_output_transform_get( mWlWindow ) )
+  {
+    transform = 0;
+  }
+  else
+  {
+    transform = ecore_wl_output_transform_get( ecore_wl_window_output_find( mWlWindow ) );
+  }
+
+  mScreenRotationAngle = transform * 90;
+  mScreenRotationFinished = false;
+
+  DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurfaceEcoreWl::OutputTransformed: angle = %d screen rotation = %d\n", mRotationAngle, mScreenRotationAngle );
 }
 
-Ecore_Wl_Window* WindowRenderSurface::GetWlWindow()
+Any WindowRenderSurfaceEcoreWl::GetWindow()
 {
   return mWlWindow;
 }
 
-void WindowRenderSurface::RequestRotation( int angle, int width, int height )
+void WindowRenderSurfaceEcoreWl::Map()
+{
+  ecore_wl_window_show( mWlWindow );
+}
+
+void WindowRenderSurfaceEcoreWl::SetRenderNotification( TriggerEventInterface* renderNotification )
+{
+  mRenderNotification = renderNotification;
+}
+
+void WindowRenderSurfaceEcoreWl::SetTransparency( bool transparent )
+{
+  ecore_wl_window_alpha_set( mWlWindow, transparent );
+}
+
+void WindowRenderSurfaceEcoreWl::RequestRotation( int angle, int width, int height )
 {
   if( !mRotationSupported )
   {
-    DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::Rotate: Rotation is not supported!\n" );
+    DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurfaceEcoreWl::Rotate: Rotation is not supported!\n" );
     return;
   }
 
   if( !mRotationTrigger )
   {
     TriggerEventFactoryInterface& triggerFactory = Internal::Adaptor::Adaptor::GetImplementation( Adaptor::Get() ).GetTriggerEventFactoryInterface();
-    mRotationTrigger = triggerFactory.CreateTriggerEvent( MakeCallback( this, &WindowRenderSurface::ProcessRotationRequest ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER );
+    mRotationTrigger = triggerFactory.CreateTriggerEvent( MakeCallback( this, &WindowRenderSurfaceEcoreWl::ProcessRotationRequest ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER );
   }
 
   mPositionSize.width = width;
@@ -125,45 +181,26 @@ void WindowRenderSurface::RequestRotation( int angle, int width, int height )
 
   ecore_wl_window_rotation_set( mWlWindow, mRotationAngle );
 
-  DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::Rotate: angle = %d screen rotation = %d\n", mRotationAngle, mScreenRotationAngle );
+  DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurfaceEcoreWl::Rotate: angle = %d screen rotation = %d\n", mRotationAngle, mScreenRotationAngle );
 }
 
-void WindowRenderSurface::OutputTransformed()
+PositionSize WindowRenderSurfaceEcoreWl::GetPositionSize() const
 {
-  int transform;
-
-  if( ecore_wl_window_ignore_output_transform_get( mWlWindow ) )
-  {
-    transform = 0;
-  }
-  else
-  {
-    transform = ecore_wl_output_transform_get( ecore_wl_window_output_find( mWlWindow ) );
-  }
-
-  mScreenRotationAngle = transform * 90;
-  mScreenRotationFinished = false;
-
-  DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::OutputTransformed: angle = %d screen rotation = %d\n", mRotationAngle, mScreenRotationAngle );
+  return mPositionSize;
 }
 
-void WindowRenderSurface::SetTransparency( bool transparent )
+void WindowRenderSurfaceEcoreWl::InitializeEgl( EglInterface& eglIf )
 {
-  ecore_wl_window_alpha_set( mWlWindow, transparent );
-}
-
-void WindowRenderSurface::InitializeEgl( EglInterface& eglIf )
-{
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
+  DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter );
 
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
 
   eglImpl.ChooseConfig(true, mColorDepth);
 }
 
-void WindowRenderSurface::CreateEglSurface( EglInterface& eglIf )
+void WindowRenderSurfaceEcoreWl::CreateEglSurface( EglInterface& eglIf )
 {
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
+  DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter );
 
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
 
@@ -184,16 +221,16 @@ void WindowRenderSurface::CreateEglSurface( EglInterface& eglIf )
   wl_egl_window_capability capability = static_cast< wl_egl_window_capability >( wl_egl_window_get_capabilities( mEglWindow ) );
   if( capability == WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED )
   {
-    DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::CreateEglSurface: capability = %d\n", capability );
+    DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurfaceEcoreWl::CreateEglSurface: capability = %d\n", capability );
     mRotationSupported = true;
   }
 
-  DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::CreateEglSurface: w = %d h = %d angle = %d screen rotation = %d\n", mPositionSize.width, mPositionSize.height, mRotationAngle, mScreenRotationAngle );
+  DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurfaceEcoreWl::CreateEglSurface: w = %d h = %d angle = %d screen rotation = %d\n", mPositionSize.width, mPositionSize.height, mRotationAngle, mScreenRotationAngle );
 }
 
-void WindowRenderSurface::DestroyEglSurface( EglInterface& eglIf )
+void WindowRenderSurfaceEcoreWl::DestroyEglSurface( EglInterface& eglIf )
 {
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
+  DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter );
 
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
   eglImpl.DestroySurface();
@@ -205,9 +242,9 @@ void WindowRenderSurface::DestroyEglSurface( EglInterface& eglIf )
   }
 }
 
-bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& egl )
+bool WindowRenderSurfaceEcoreWl::ReplaceEGLSurface( EglInterface& egl )
 {
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
+  DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter );
 
   if( mEglWindow != NULL )
   {
@@ -232,7 +269,7 @@ bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& egl )
   return eglImpl.ReplaceSurfaceWindow( windowType );
 }
 
-void WindowRenderSurface::MoveResize( Dali::PositionSize positionSize )
+void WindowRenderSurfaceEcoreWl::MoveResize( Dali::PositionSize positionSize )
 {
   bool needToMove = false;
   bool needToResize = false;
@@ -263,19 +300,18 @@ void WindowRenderSurface::MoveResize( Dali::PositionSize positionSize )
 
   mPositionSize = positionSize;
 
-  DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::MoveResize: %d, %d, %d, %d\n", mPositionSize.x, mPositionSize.y, mPositionSize.width, mPositionSize.height );
+  DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurfaceEcoreWl::MoveResize: %d, %d, %d, %d\n", mPositionSize.x, mPositionSize.y, mPositionSize.width, mPositionSize.height );
 }
 
-void WindowRenderSurface::Map()
+void WindowRenderSurfaceEcoreWl::SetViewMode( ViewMode viewMode )
 {
-  ecore_wl_window_show(mWlWindow);
 }
 
-void WindowRenderSurface::StartRender()
+void WindowRenderSurfaceEcoreWl::StartRender()
 {
 }
 
-bool WindowRenderSurface::PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface )
+bool WindowRenderSurfaceEcoreWl::PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface )
 {
   if( resizingSurface )
   {
@@ -328,7 +364,7 @@ bool WindowRenderSurface::PreRender( EglInterface& egl, Integration::GlAbstracti
       // Reset only screen rotation flag
       mScreenRotationFinished = true;
 
-      DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::PreRender: Set rotation [%d] [%d]\n", mRotationAngle, mScreenRotationAngle );
+      DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurfaceEcoreWl::PreRender: Set rotation [%d] [%d]\n", mRotationAngle, mScreenRotationAngle );
     }
 
     // Only window rotate
@@ -375,20 +411,20 @@ bool WindowRenderSurface::PreRender( EglInterface& egl, Integration::GlAbstracti
       wl_egl_window_resize( mEglWindow, mPositionSize.width, mPositionSize.height, mPositionSize.x, mPositionSize.y );
       mResizeFinished = true;
 
-      DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::PreRender: Set resize\n" );
+      DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurfaceEcoreWl::PreRender: Set resize\n" );
     }
   }
 
   return true;
 }
 
-void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface )
+void WindowRenderSurfaceEcoreWl::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface )
 {
   if( resizingSurface )
   {
     if( !mRotationFinished )
     {
-      DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::PostRender: Trigger rotation event\n" );
+      DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurfaceEcoreWl::PostRender: Trigger rotation event\n" );
 
       mRotationTrigger->Trigger();
 
@@ -409,16 +445,28 @@ void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract
   }
 }
 
-void WindowRenderSurface::StopRender()
+void WindowRenderSurfaceEcoreWl::StopRender()
+{
+}
+
+void WindowRenderSurfaceEcoreWl::SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization )
 {
+  DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurfaceEcoreWl::SetThreadSynchronization: called\n" );
+
+  mThreadSynchronization = &threadSynchronization;
 }
 
-void WindowRenderSurface::SetViewMode( ViewMode viewMode )
+void WindowRenderSurfaceEcoreWl::ReleaseLock()
 {
-  //FIXME
+  // Nothing to do.
 }
 
-void WindowRenderSurface::CreateWlRenderable()
+RenderSurface::Type WindowRenderSurfaceEcoreWl::GetSurfaceType()
+{
+  return RenderSurface::WINDOW_RENDER_SURFACE;
+}
+
+void WindowRenderSurfaceEcoreWl::CreateRenderable()
 {
    // if width or height are zero, go full screen.
   if ( (mPositionSize.width == 0) || (mPositionSize.height == 0) )
@@ -460,30 +508,33 @@ void WindowRenderSurface::CreateWlRenderable()
   }
 }
 
-void WindowRenderSurface::UseExistingRenderable( unsigned int surfaceId )
+void WindowRenderSurfaceEcoreWl::UseExistingRenderable( unsigned int surfaceId )
 {
   mWlWindow = AnyCast< Ecore_Wl_Window* >( surfaceId );
 }
 
-void WindowRenderSurface::SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization )
+unsigned int WindowRenderSurfaceEcoreWl::GetSurfaceId( Any surface ) const
 {
-  DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::SetThreadSynchronization: called\n" );
+  unsigned int surfaceId = 0;
 
-  mThreadSynchronization = &threadSynchronization;
-}
+  if( surface.Empty() == false )
+  {
+    // check we have a valid type
+    DALI_ASSERT_ALWAYS( ( (surface.GetType() == typeid (Ecore_Wl_Window *) ) )
+                        && "Surface type is invalid" );
 
-void WindowRenderSurface::ReleaseLock()
-{
-  // Nothing to do.
+    surfaceId = AnyCast<unsigned int>( surface );
+  }
+  return surfaceId;
 }
 
-void WindowRenderSurface::ProcessRotationRequest()
+void WindowRenderSurfaceEcoreWl::ProcessRotationRequest()
 {
   mRotationFinished = true;
 
   ecore_wl_window_rotation_change_done_send( mWlWindow );
 
-  DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::ProcessRotationRequest: Rotation Done\n" );
+  DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurfaceEcoreWl::ProcessRotationRequest: Rotation Done\n" );
 
   if( mThreadSynchronization )
   {
@@ -491,6 +542,8 @@ void WindowRenderSurface::ProcessRotationRequest()
   }
 }
 
-} // namespace ECore
+} // namespace Adaptor
+
+} // namespace internal
 
 } // namespace Dali
index 67b677c..00b217d 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_ECORE_WL_WINDOW_RENDER_SURFACE_H__
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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 <Ecore_Wayland.h>
 #include <wayland-egl.h>
+#include <dali/public-api/common/dali-common.h>
 
 // INTERNAL INCLUDES
-#include <dali/integration-api/wayland/ecore-wl-render-surface.h>
+#include <dali/integration-api/egl-interface.h>
 #include <dali/integration-api/thread-synchronization-interface.h>
+#include <dali/internal/window-system/common/window-render-surface.h>
 
 namespace Dali
 {
 
-namespace ECore
+namespace Internal
+{
+namespace Adaptor
 {
 
 /**
- * @copydoc Dali::ECore::EcoreWlRenderSurface.
- * Window specialization.
+ * Ecore Wayland Window implementation of render surface.
  */
-class WindowRenderSurface : public EcoreWlRenderSurface
+class WindowRenderSurfaceEcoreWl : public WindowRenderSurface
 {
 public:
 
@@ -46,61 +50,64 @@ public:
     * @param [in] name optional name of surface passed in
     * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
     */
-  WindowRenderSurface( Dali::PositionSize positionSize,
+  WindowRenderSurfaceEcoreWl( Dali::PositionSize positionSize,
                        Any surface,
                        const std::string& name,
                        bool isTransparent = false );
 
   /**
-   * @copydoc Dali::ECore::EcoreWlRenderSurface::~EcoreWlRenderSurface
+   * @brief Destructor
    */
-  virtual ~WindowRenderSurface();
+  virtual ~WindowRenderSurfaceEcoreWl();
 
 public: // API
 
   /**
-   * @copydoc Dali::RenderSurface::GetDrawable()
+   * @brief Get window handle
+   * @return the Ecore Waylnad window handle
    */
-  virtual Ecore_Wl_Window* GetDrawable();
+  Ecore_Wl_Window* GetWlWindow();
 
   /**
-   * Map window
+   * Notify output is transformed.
    */
-  virtual void Map();
+  void OutputTransformed();
+
+public: // from WindowRenderSurface
 
   /**
-   * @copydoc Dali::ECore::EcoreWlRenderSurface::GetSurface()
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::GetWindow()
    */
-  virtual Any GetSurface();
+  virtual Any GetWindow() override;
 
   /**
-   * @copydoc Dali::ECore::EcoreWlRenderSurface::GetWlWindow()
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::Map()
    */
-  virtual Ecore_Wl_Window* GetWlWindow();
+  virtual void Map() override;
 
   /**
-   * Request surface rotation
-   * @param[in] angle A new angle of the surface
-   * @param[in] width A new width of the surface
-   * @param[in] height A new height of the surface
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::SetRenderNotification()
    */
-  void RequestRotation( int angle, int width, int height );
+  virtual void SetRenderNotification( TriggerEventInterface* renderNotification ) override;
 
   /**
-   * Notify output is transformed.
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::SetTransparency()
    */
-  void OutputTransformed();
+  virtual void SetTransparency( bool transparent ) override;
 
   /**
-   * @brief Sets whether the surface is transparent or not.
-   *
-   * @param[in] transparent Whether the surface is transparent
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::RequestRotation()
    */
-  void SetTransparency( bool transparent );
+  virtual void RequestRotation( int angle, int width, int height ) override;
 
 public: // from Dali::RenderSurface
 
   /**
+   * @copydoc Dali::RenderSurface::GetPositionSize()
+   */
+  virtual PositionSize GetPositionSize() const;
+
+  /**
    * @copydoc Dali::RenderSurface::InitializeEgl()
    */
   virtual void InitializeEgl( EglInterface& egl );
@@ -160,42 +167,66 @@ public: // from Dali::RenderSurface
    */
   virtual void ReleaseLock();
 
-protected:
+  /**
+   * @copydoc Dali::RenderSurface::GetSurfaceType()
+   */
+  virtual RenderSurface::Type GetSurfaceType();
+
+private: // from WindowRenderSurface
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::Initialize()
+   */
+  void Initialize( Any surface ) override;
 
   /**
-   * Create WlWindow
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::CreateRenderable()
    */
-  virtual void CreateWlRenderable();
+  void CreateRenderable() override;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::ECore::EcoreWlRenderSurface::UseExistingRenderable
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::UseExistingRenderable()
    */
-  virtual void UseExistingRenderable( unsigned int surfaceId );
+  void UseExistingRenderable( unsigned int surfaceId ) override;
 
 private:
 
   /**
+   * Get the surface id if the surface parameter is not empty
+   * @param surface Any containing a surface id, or can be empty
+   * @return surface id, or zero if surface is empty
+   */
+  unsigned int GetSurfaceId( Any surface ) const;
+
+  /**
    * Used as the callback for the rotation-trigger.
    */
   void ProcessRotationRequest();
 
 private: // Data
 
-  Ecore_Wl_Window*                mWlWindow;  ///< Wayland-Window
+  std::string                     mTitle;              ///< Title of window which shows from "xinfo -topvwins" command
+  PositionSize                    mPositionSize;       ///< Position
+  Ecore_Wl_Window*                mWlWindow;           ///< Wayland-Window
   wl_surface*                     mWlSurface;
   wl_egl_window*                  mEglWindow;
   ThreadSynchronizationInterface* mThreadSynchronization;
+  TriggerEventInterface*          mRenderNotification; ///< Render notification trigger
   TriggerEventInterface*          mRotationTrigger;
+  ColorDepth                      mColorDepth;         ///< Color depth of surface (32 bit or 24 bit)
   int                             mRotationAngle;
   int                             mScreenRotationAngle;
+  bool                            mOwnSurface;         ///< Whether we own the surface (responsible for deleting it)
   bool                            mRotationSupported;
   bool                            mRotationFinished;
   bool                            mScreenRotationFinished;
   bool                            mResizeFinished;
 
-}; // class WindowRenderSurface
+}; // class WindowRenderSurfaceEcoreWl
+
+} // namespace Adaptor
 
-} // namespace ECore
+} // namespace internal
 
 } // namespace Dali
 
diff --git a/dali/internal/window-system/tizen/native-render-surface-tizen.cpp b/dali/internal/window-system/tizen/native-render-surface-tizen.cpp
deleted file mode 100644 (file)
index de42ab0..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/integration-api/wayland/native-render-surface.h>
-
-// EXTERNAL INCLUDES
-#include <dali/integration-api/gl-abstraction.h>
-#include <dali/integration-api/debug.h>
-#include <dali/devel-api/threading/conditional-wait.h>
-
-#include <Ecore_Wayland.h>
-#include <tbm_bufmgr.h>
-#include <tbm_surface_queue.h>
-#include <tbm_surface_internal.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/system/common/trigger-event.h>
-#include <dali/internal/graphics/gles20/egl-implementation.h>
-#include <dali/internal/window-system/common/display-connection.h>
-#include <dali/integration-api/thread-synchronization-interface.h>
-
-namespace Dali
-{
-
-#if defined(DEBUG_ENABLED)
-extern Debug::Filter* gRenderSurfaceLogFilter;
-#endif
-
-struct NativeRenderSurface::Impl
-{
-  Impl( Dali::PositionSize positionSize, const std::string& name, bool isTransparent )
-  : mPosition( positionSize ),
-    mTitle( name ),
-    mRenderNotification( NULL ),
-    mColorDepth( isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24 ),
-    mTbmFormat( isTransparent ? TBM_FORMAT_ARGB8888 : TBM_FORMAT_RGB888 ),
-    mOwnSurface( false ),
-    mDrawableCompleted( false ),
-    mTbmQueue( NULL ),
-    mConsumeSurface( NULL ),
-    mThreadSynchronization( NULL )
-  {
-  }
-
-  PositionSize mPosition;
-  std::string mTitle;
-  TriggerEventInterface* mRenderNotification;
-  ColorDepth mColorDepth;
-  tbm_format mTbmFormat;
-  bool mOwnSurface;
-  bool mDrawableCompleted;
-
-  tbm_surface_queue_h mTbmQueue;
-  tbm_surface_h mConsumeSurface;
-  ThreadSynchronizationInterface* mThreadSynchronization;     ///< A pointer to the thread-synchronization
-  ConditionalWait mTbmSurfaceCondition;
-};
-
-NativeRenderSurface::NativeRenderSurface(Dali::PositionSize positionSize,
-                                         const std::string& name,
-                                         bool isTransparent)
-: mImpl( new Impl( positionSize, name, isTransparent ) )
-{
-  ecore_wl_init(NULL);
-  CreateNativeRenderable();
-  setenv( "EGL_PLATFORM", "tbm", 1 );
-}
-
-NativeRenderSurface::~NativeRenderSurface()
-{
-  // release the surface if we own one
-  if( mImpl->mOwnSurface )
-  {
-    ReleaseDrawable();
-
-    if( mImpl->mTbmQueue )
-    {
-      tbm_surface_queue_destroy( mImpl->mTbmQueue );
-    }
-
-    delete mImpl;
-
-    DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::General, "Own tbm surface queue destroy\n" );
-  }
-}
-
-void NativeRenderSurface::SetRenderNotification( TriggerEventInterface* renderNotification )
-{
-  mImpl->mRenderNotification = renderNotification;
-}
-
-tbm_surface_h NativeRenderSurface::GetDrawable()
-{
-  return mImpl->mConsumeSurface;
-}
-
-Any NativeRenderSurface::GetSurface()
-{
-  return Any( NULL );
-}
-
-void NativeRenderSurface::InitializeEgl( EglInterface& egl )
-{
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
-  unsetenv( "EGL_PLATFORM" );
-
-  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
-
-  eglImpl.ChooseConfig( true, mImpl->mColorDepth );
-}
-
-void NativeRenderSurface::CreateEglSurface( EglInterface& egl )
-{
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
-
-  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
-
-  eglImpl.CreateSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( mImpl->mTbmQueue ), mImpl->mColorDepth );
-}
-
-void NativeRenderSurface::DestroyEglSurface( EglInterface& egl )
-{
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
-
-  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
-  eglImpl.DestroySurface();
-}
-
-bool NativeRenderSurface::ReplaceEGLSurface( EglInterface& egl )
-{
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
-
-  if( !mImpl->mTbmQueue )
-  {
-    return false;
-  }
-
-  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
-
-  return eglImpl.ReplaceSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( mImpl->mTbmQueue ) );
-}
-
-void NativeRenderSurface::StartRender()
-{
-}
-
-bool NativeRenderSurface::PreRender( EglInterface&, Integration::GlAbstraction&, bool )
-{
-  // nothing to do for pixmaps
-  return true;
-}
-
-void NativeRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface )
-{
-  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
-  eglImpl.SwapBuffers();
-
-  if( mImpl->mThreadSynchronization )
-  {
-    mImpl->mThreadSynchronization->PostRenderStarted();
-  }
-
-  if( tbm_surface_queue_can_acquire( mImpl->mTbmQueue, 1 ) )
-  {
-    if( tbm_surface_queue_acquire( mImpl->mTbmQueue, &mImpl->mConsumeSurface ) != TBM_SURFACE_QUEUE_ERROR_NONE )
-    {
-      DALI_LOG_ERROR( "Failed to aquire a tbm_surface\n" );
-      return;
-    }
-  }
-
-  tbm_surface_internal_ref( mImpl->mConsumeSurface );
-
-  if( replacingSurface )
-  {
-    ConditionalWait::ScopedLock lock( mImpl->mTbmSurfaceCondition );
-    mImpl->mDrawableCompleted = true;
-    mImpl->mTbmSurfaceCondition.Notify( lock );
-  }
-
- // create damage for client applications which wish to know the update timing
-  if( !replacingSurface && mImpl->mRenderNotification )
-  {
-    // use notification trigger
-    // Tell the event-thread to render the tbm_surface
-    mImpl->mRenderNotification->Trigger();
-  }
-
-  if( mImpl->mThreadSynchronization )
-  {
-    // wait until the event-thread completed to use the tbm_surface
-    mImpl->mThreadSynchronization->PostRenderWaitForCompletion();
-  }
-
-  // release the consumed surface after post render was completed
-  ReleaseDrawable();
-}
-
-void NativeRenderSurface::StopRender()
-{
-  ReleaseLock();
-}
-
-PositionSize NativeRenderSurface::GetPositionSize() const
-{
-  return mImpl->mPosition;
-}
-
-void NativeRenderSurface::MoveResize( Dali::PositionSize positionSize )
-{
-}
-
-void NativeRenderSurface::SetViewMode( ViewMode viewMode )
-{
-}
-
-void NativeRenderSurface::SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization )
-{
-  mImpl->mThreadSynchronization = &threadSynchronization;
-}
-
-RenderSurface::Type NativeRenderSurface::GetSurfaceType()
-{
-  return RenderSurface::NATIVE_RENDER_SURFACE;
-}
-
-void NativeRenderSurface::CreateNativeRenderable()
-{
-  // check we're creating one with a valid size
-  DALI_ASSERT_ALWAYS( mImpl->mPosition.width > 0 && mImpl->mPosition.height > 0 && "tbm_surface size is invalid" );
-
-  mImpl->mTbmQueue = tbm_surface_queue_create( 3, mImpl->mPosition.width, mImpl->mPosition.height, mImpl->mTbmFormat, TBM_BO_DEFAULT );
-
-  if( mImpl->mTbmQueue )
-  {
-    mImpl->mOwnSurface = true;
-  }
-  else
-  {
-    mImpl->mOwnSurface = false;
-  }
-}
-
-void NativeRenderSurface::ReleaseLock()
-{
-  if( mImpl->mThreadSynchronization )
-  {
-    mImpl->mThreadSynchronization->PostRenderComplete();
-  }
-}
-
-void NativeRenderSurface::WaitUntilSurfaceReplaced()
-{
-  ConditionalWait::ScopedLock lock( mImpl->mTbmSurfaceCondition );
-  while( !mImpl->mDrawableCompleted )
-  {
-    mImpl->mTbmSurfaceCondition.Wait( lock );
-  }
-
-  mImpl->mDrawableCompleted = false;
-}
-
-void NativeRenderSurface::ReleaseDrawable()
-{
-  if( mImpl->mConsumeSurface )
-  {
-    tbm_surface_internal_unref( mImpl->mConsumeSurface );
-
-    if( tbm_surface_internal_is_valid( mImpl->mConsumeSurface ) )
-    {
-      tbm_surface_queue_release( mImpl->mTbmQueue, mImpl->mConsumeSurface );
-    }
-    mImpl->mConsumeSurface = NULL;
-  }
-}
-
-} // namespace Dali
diff --git a/dali/internal/window-system/tizen/pixmap-render-surface-x.cpp b/dali/internal/window-system/tizen/pixmap-render-surface-x.cpp
deleted file mode 100644 (file)
index a258cd7..0000000
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/integration-api/x11/pixmap-render-surface.h>
-
-// EXTERNAL INCLUDES
-#include <X11/Xatom.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#include <X11/extensions/Xfixes.h> // for damage notify
-#include <X11/extensions/Xdamage.h> // for damage notify
-
-#include <dali/integration-api/gl-abstraction.h>
-#include <dali/integration-api/debug.h>
-#include <dali/devel-api/threading/mutex.h>
-#include <dali/devel-api/threading/conditional-wait.h>
-
-// INTERNAL INCLUDES
-
-#include <dali/integration-api/thread-synchronization-interface.h>
-#include <dali/integration-api/x11/ecore-x-types.h>
-#include <dali/internal/system/common/trigger-event.h>
-#include <dali/internal/graphics/gles20/egl-implementation.h>
-#include <dali/internal/window-system/common/display-connection.h>
-
-namespace Dali
-{
-
-#if defined(DEBUG_ENABLED)
-extern Debug::Filter* gRenderSurfaceLogFilter;
-#endif
-
-namespace ECore
-{
-
-namespace
-{
-static const int INITIAL_PRODUCE_BUFFER_INDEX = 0;
-static const int INITIAL_CONSUME_BUFFER_INDEX = 1;
-static const int BUFFER_COUNT = 2;
-}
-
-struct PixmapRenderSurface::Impl
-{
-  Impl()
-  : mProduceBufferIndex( INITIAL_PRODUCE_BUFFER_INDEX ),
-    mConsumeBufferIndex( INITIAL_CONSUME_BUFFER_INDEX ),
-    mThreadSynchronization(NULL)
-  {
-    for (int i = 0; i != BUFFER_COUNT; ++i)
-    {
-      mX11Pixmaps[i] = 0;
-      mEglSurfaces[i] = 0;
-    }
-  }
-
-  int                             mProduceBufferIndex;
-  int                             mConsumeBufferIndex;
-  XPixmap                         mX11Pixmaps[BUFFER_COUNT];  ///< X-Pixmap
-  EGLSurface                      mEglSurfaces[BUFFER_COUNT];
-  ThreadSynchronizationInterface* mThreadSynchronization;     ///< A pointer to the thread-synchronization
-  ConditionalWait                 mPixmapCondition;           ///< condition to share pixmap
-};
-
-PixmapRenderSurface::PixmapRenderSurface(Dali::PositionSize positionSize,
-                                         Any surface,
-                                         const std::string& name,
-                                         bool isTransparent)
-: EcoreXRenderSurface( positionSize, surface, name, isTransparent ),
-  mImpl( new Impl )
-{
-  Init( surface );
-}
-
-PixmapRenderSurface::~PixmapRenderSurface()
-{
-  // release the surface if we own one
-  if( mOwnSurface )
-  {
-    for (int i = 0; i < BUFFER_COUNT; ++i)
-    {
-      Ecore_X_Pixmap pixmap = mImpl->mX11Pixmaps[i];
-
-      // if we did create the pixmap, delete the pixmap
-      DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::General, "Own pixmap (%x) freed\n", pixmap );
-      ecore_x_pixmap_free( pixmap );
-    }
-  }
-
-  delete mImpl;
-}
-
-Ecore_X_Drawable PixmapRenderSurface::GetDrawable()
-{
-  Ecore_X_Pixmap pixmap = 0;
-  {
-    ConditionalWait::ScopedLock lock( mImpl->mPixmapCondition );
-    pixmap = mImpl->mX11Pixmaps[mImpl->mConsumeBufferIndex];
-  }
-
-  return Ecore_X_Drawable( pixmap );
-}
-
-Any PixmapRenderSurface::GetSurface()
-{
-  Ecore_X_Pixmap pixmap = 0;
-  {
-    ConditionalWait::ScopedLock lock( mImpl->mPixmapCondition );
-    pixmap = mImpl->mX11Pixmaps[mImpl->mProduceBufferIndex];
-  }
-
-  return Any( pixmap );
-}
-
-void PixmapRenderSurface::InitializeEgl( EglInterface& egl )
-{
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
-
-  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
-
-  eglImpl.ChooseConfig(false, mColorDepth);
-}
-
-void PixmapRenderSurface::CreateEglSurface( EglInterface& egl )
-{
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
-
-  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
-
-  for (int i = 0; i < BUFFER_COUNT; ++i)
-  {
-    // create the EGL surface
-    // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
-    XPixmap pixmap = static_cast<XPixmap>( mImpl->mX11Pixmaps[i] );
-    mImpl->mEglSurfaces[i] = eglImpl.CreateSurfacePixmap( EGLNativePixmapType( pixmap ), mColorDepth ); // reinterpret_cast does not compile
-  }
-}
-
-void PixmapRenderSurface::DestroyEglSurface( EglInterface& egl )
-{
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
-
-  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
-
-  for (int i = 0; i < BUFFER_COUNT; ++i)
-  {
-    // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
-    XPixmap pixmap = static_cast<XPixmap>( mImpl->mX11Pixmaps[i] );
-    eglImpl.MakeCurrent( EGLNativePixmapType( pixmap ), mImpl->mEglSurfaces[i] );
-    eglImpl.DestroySurface();
-  }
-}
-
-bool PixmapRenderSurface::ReplaceEGLSurface( EglInterface& egl )
-{
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
-
-  bool contextLost = false;
-
-  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
-
-  for (int i = 0; i < BUFFER_COUNT; ++i)
-  {
-    // a new surface for the new pixmap
-    // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
-    XPixmap pixmap = static_cast<XPixmap>( mImpl->mX11Pixmaps[i] );
-    contextLost = eglImpl.ReplaceSurfacePixmap( EGLNativePixmapType( pixmap ), mImpl->mEglSurfaces[i] ); // reinterpret_cast does not compile
-  }
-
-  // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
-  XPixmap pixmap = static_cast<XPixmap>( mImpl->mX11Pixmaps[mImpl->mProduceBufferIndex] );
-  eglImpl.MakeCurrent( EGLNativePixmapType( pixmap ), mImpl->mEglSurfaces[mImpl->mProduceBufferIndex] );
-
-  return contextLost;
-}
-
-void PixmapRenderSurface::StartRender()
-{
-}
-
-bool PixmapRenderSurface::PreRender( EglInterface& egl, Integration::GlAbstraction&, bool )
-{
-  // Nothing to do for pixmaps
-  return true;
-}
-
-void PixmapRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface )
-{
-  // flush gl instruction queue
-  glAbstraction.Flush();
-
-  if( mImpl->mThreadSynchronization )
-  {
-    mImpl->mThreadSynchronization->PostRenderStarted();
-  }
-
-  {
-    ConditionalWait::ScopedLock lock( mImpl->mPixmapCondition );
-    mImpl->mConsumeBufferIndex = __sync_fetch_and_xor( &mImpl->mProduceBufferIndex, 1 ); // Swap buffer indexes.
-
-    Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
-
-    // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
-    XPixmap pixmap = static_cast<XPixmap>( mImpl->mX11Pixmaps[mImpl->mProduceBufferIndex] );
-    eglImpl.MakeCurrent( EGLNativePixmapType( pixmap ), mImpl->mEglSurfaces[mImpl->mProduceBufferIndex] );
-  }
-
-  // create damage for client applications which wish to know the update timing
-  if( mRenderNotification )
-  {
-    // use notification trigger
-    // Tell the event-thread to render the pixmap
-    mRenderNotification->Trigger();
-  }
-  else
-  {
-    // as a fallback, send damage event.
-    Ecore_X_Drawable drawable = Ecore_X_Drawable( mImpl->mX11Pixmaps[mImpl->mProduceBufferIndex] );
-
-    if( drawable )
-    {
-      XRectangle rect;
-      XserverRegion region;
-
-      rect.x = 0;
-      rect.y = 0;
-      rect.width = mPosition.width;
-      rect.height = mPosition.height;
-
-      XDisplay* display = AnyCast<XDisplay*>(displayConnection->GetDisplay());
-
-      // make a fixes region as updated area
-      region = XFixesCreateRegion( display, &rect, 1 );
-      // add damage event to updated drawable
-      Drawable xdrawable( drawable ); // ecore type is unsigned int whereas in 64bit linux Drawable is long unsigned int
-      XDamageAdd( display, xdrawable, region );
-      XFixesDestroyRegion( display, region );
-
-      XFlush( display );
-    }
-  }
-
-  if( mImpl->mThreadSynchronization )
-  {
-    mImpl->mThreadSynchronization->PostRenderWaitForCompletion();
-  }
-}
-
-void PixmapRenderSurface::StopRender()
-{
-  ReleaseLock();
-}
-
-void PixmapRenderSurface::SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization )
-{
-  mImpl->mThreadSynchronization = &threadSynchronization;
-}
-
-void PixmapRenderSurface::CreateXRenderable()
-{
-  // check we're creating one with a valid size
-  DALI_ASSERT_ALWAYS( mPosition.width > 0 && mPosition.height > 0 && "Pixmap size is invalid" );
-
-  for (int i = 0; i < BUFFER_COUNT; ++i)
-  {
-    // create the pixmap
-    mImpl->mX11Pixmaps[i] = ecore_x_pixmap_new(0, mPosition.width, mPosition.height, mColorDepth);
-
-    // clear the pixmap
-    unsigned int foreground;
-    Ecore_X_GC gc;
-    foreground = 0;
-    gc = ecore_x_gc_new( mImpl->mX11Pixmaps[i],
-                         ECORE_X_GC_VALUE_MASK_FOREGROUND,
-                         &foreground );
-
-    DALI_ASSERT_ALWAYS( gc && "CreateXRenderable(): failed to get gc" );
-
-    ecore_x_drawable_rectangle_fill( mImpl->mX11Pixmaps[i], gc, 0, 0, mPosition.width, mPosition.height );
-
-    DALI_ASSERT_ALWAYS( mImpl->mX11Pixmaps[i] && "Failed to create X pixmap" );
-
-    // we SHOULD guarantee the xpixmap/x11 window was created in x server.
-    ecore_x_sync();
-
-    ecore_x_gc_free(gc);
-  }
-}
-
-void PixmapRenderSurface::UseExistingRenderable( unsigned int surfaceId )
-{
-}
-
-void PixmapRenderSurface::ReleaseLock()
-{
-  if( mImpl->mThreadSynchronization )
-  {
-    mImpl->mThreadSynchronization->PostRenderComplete();
-  }
-}
-
-RenderSurface::Type PixmapRenderSurface::GetSurfaceType()
-{
-  return RenderSurface::ECORE_RENDER_SURFACE;
-}
-
-} // namespace ECore
-
-} // namespace Dali
index d1a1e50..030373d 100644 (file)
@@ -23,7 +23,7 @@
 #include <dali/integration-api/debug.h>
 
 // INTERNAL HEADERS
-#include <dali/integration-api/x11/pixmap-render-surface.h>
+#include <dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.h>
 
 namespace Dali
 {
@@ -96,7 +96,7 @@ bool DisplayConnectionX11::InitializeEgl(EglInterface& egl)
 
 void DisplayConnectionX11::SetSurfaceType( RenderSurface::Type type )
 {
-  if( type == RenderSurface::ECORE_RENDER_SURFACE )
+  if( type == RenderSurface::WINDOW_RENDER_SURFACE )
   {
     // Because of DDK issue, we need to use separated x display instead of ecore default display
     mDisplay = XOpenDisplay(0);
index 4c781be..f74def4 100644 (file)
  *
  */
 
-// EXTERNAL INCLUDES
-#include <dali/integration-api/x11/ecore-x-types.h>
-
 // INTERNAL INCLUDES
 #include <dali/internal/window-system/common/display-connection-impl.h>
 #include <dali/public-api/object/base-object.h>
 #include <dali/internal/graphics/gles20/egl-implementation.h>
+#include <dali/internal/window-system/ubuntu-x11/ecore-x-types.h>
 
 namespace Dali
 {
index 2f6c752..7ab646d 100755 (executable)
@@ -55,7 +55,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/internal/input/common/gesture-manager.h>
-#include <dali/internal/window-system/ubuntu-x11/window-render-surface-x.h>
+#include <dali/internal/window-system/ubuntu-x11/window-render-surface-ecore-x.h>
 #include <dali/internal/clipboard/common/clipboard-impl.h>
 #include <dali/internal/input/common/key-impl.h>
 #include <dali/internal/input/common/physical-keyboard-impl.h>
@@ -1592,8 +1592,8 @@ EventHandler::EventHandler( RenderSurface* surface, CoreEventInterface& coreEven
 {
   Ecore_X_Window window = 0;
 
-  // this code only works with the EcoreX11 RenderSurface so need to downcast
-  ECore::WindowRenderSurface* ecoreSurface = dynamic_cast< ECore::WindowRenderSurface* >( surface );
+  // this code only works with the WindowRenderSurface so need to downcast
+  WindowRenderSurfaceEcoreX* ecoreSurface = static_cast< WindowRenderSurfaceEcoreX* >( surface );
   if( ecoreSurface )
   {
     // enable multi touch
diff --git a/dali/internal/window-system/ubuntu-x11/native-image-source-impl.h b/dali/internal/window-system/ubuntu-x11/native-image-source-impl.h
deleted file mode 100755 (executable)
index 92465aa..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-#ifndef __DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H__
-#define __DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H__
-
-/*
- * Copyright (c) 2014 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 <Ecore_X.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/adaptor-framework/native-image-source.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-class EglImageExtensions;
-
-/**
- * Dali internal NativeImageSource.
- */
-class NativeImageSource
-{
-public:
-
-  /**
-   * Create a new NativeImageSource internally.
-   * Depending on hardware the width and height may have to be a power of two.
-   * @param[in] width The width of the image.
-   * @param[in] height The height of the image.
-   * @param[in] depth color depth of the image.
-   * @param[in] nativeImageSource contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty
-   * @return A smart-pointer to a newly allocated image.
-   */
-  static NativeImageSource* New(unsigned int width,
-                          unsigned int height,
-                          Dali::NativeImageSource::ColorDepth depth,
-                          Any nativeImageSource);
-  /**
-   * @copydoc Dali::NativeImageSource::GetNativeImageSource()
-   */
-  Any GetNativeImageSource() const;
-
-  /**
-   * @copydoc Dali::NativeImageSource::GetPixels()
-   */
-  bool GetPixels(std::vector<unsigned char> &pixbuf, unsigned int &width, unsigned int &height, Pixel::Format& pixelFormat ) const;
-
-  /**
-   * @copydoc Dali::NativeImageSource::EncodeToFile(const std::string& )
-   */
-  bool EncodeToFile(const std::string& filename) const;
-
-  /**
-   * @copydoc Dali::NativeImageSource::SetSource( Any source )
-   */
-  void SetSource( Any source );
-
-  /**
-   * @copydoc Dali::NativeImageSource::IsColorDepthSupported( ColorDepth colorDepth )
-   */
-  bool IsColorDepthSupported( Dali::NativeImageSource::ColorDepth colorDepth );
-
-  /**
-   * destructor
-   */
-  ~NativeImageSource();
-
-  /**
-   * @copydoc Dali::NativeImageSource::GlExtensionCreate()
-   */
-  bool GlExtensionCreate();
-
-  /**
-   * @copydoc Dali::NativeImageSource::GlExtensionDestroy()
-   */
-  void GlExtensionDestroy();
-
-  /**
-   * @copydoc Dali::NativeImageSource::TargetTexture()
-   */
-  unsigned int TargetTexture();
-
-  /**
-   * @copydoc Dali::NativeImageSource::PrepareTexture()
-   */
-  void PrepareTexture();
-
-  /**
-   * @copydoc Dali::NativeImageSource::GetWidth()
-   */
-  unsigned int GetWidth() const
-  {
-    return mWidth;
-  }
-
-  /**
-   * @copydoc Dali::NativeImageSource::GetHeight()
-   */
-  unsigned int GetHeight() const
-  {
-    return mHeight;
-  }
-
-  /**
-   * @copydoc Dali::NativeImageSource::RequiresBlending()
-   */
-  bool RequiresBlending() const
-  {
-    return mBlendingRequired;
-  }
-
-  /**
-   * @copydoc Dali::NativeImageInterface::GetExtension()
-   */
-  NativeImageInterface::Extension* GetNativeImageInterfaceExtension()
-  {
-    return NULL;
-  }
-
-private:
-
-  /**
-   * Private constructor; @see NativeImageSource::New()
-   * @param[in] width The width of the image.
-   * @param[in] height The height of the image.
-   * @param[in] colour depth of the image.
-   * @param[in] nativeImageSource contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty
-   */
-  NativeImageSource(unsigned int width,
-              unsigned  int height,
-              Dali::NativeImageSource::ColorDepth depth,
-              Any nativeImageSource);
-
-  /**
-   * 2nd phase construction.
-   */
-  void Initialize();
-
-  /**
-   * Uses X11 to get the default depth.
-   * @param depth the PixelImage depth enum
-   * @return default x11 pixel depth
-   */
-  int GetPixelDepth(Dali::NativeImageSource::ColorDepth depth) const;
-
-  /**
-   * Gets the pixmap from the Any parameter
-   * @param pixmap contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty
-   * @return pixmap x11 pixmap
-   */
-  Ecore_X_Pixmap GetPixmapFromAny(Any pixmap) const;
-
-  /**
-   * Given an existing pixmap, the function uses X to find out
-   * the width, heigth and depth of that pixmap.
-   */
-  void GetPixmapDetails();
-
-private:
-
-  unsigned int mWidth;                        ///< image width
-  unsigned int mHeight;                       ///< image heights
-  bool mOwnPixmap;                            ///< Whether we created pixmap or not
-  Ecore_X_Pixmap mPixmap;                     ///< From Xlib
-  bool mBlendingRequired;                      ///< Whether blending is required
-  Dali::NativeImageSource::ColorDepth mColorDepth;  ///< color depth of image
-  void* mEglImageKHR;                         ///< From EGL extension
-  EglImageExtensions* mEglImageExtensions;    ///< The EGL Image Extensions
-};
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H__
diff --git a/dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.cpp b/dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.cpp
new file mode 100644 (file)
index 0000000..4a50c5c
--- /dev/null
@@ -0,0 +1,352 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.h>
+
+// EXTERNAL INCLUDES
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+#include <X11/extensions/Xfixes.h> // for damage notify
+#include <X11/extensions/Xdamage.h> // for damage notify
+
+#include <dali/integration-api/gl-abstraction.h>
+#include <dali/integration-api/debug.h>
+#include <dali/devel-api/threading/mutex.h>
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/thread-synchronization-interface.h>
+#include <dali/internal/system/common/trigger-event.h>
+#include <dali/internal/window-system/common/display-connection.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gPixmapRenderSurfaceLogFilter = Debug::Filter::New(Debug::Verbose, false, "LOG_PIXMAP_RENDER_SURFACE_ECORE_X");
+#endif
+
+namespace
+{
+static const int INITIAL_PRODUCE_BUFFER_INDEX = 0;
+static const int INITIAL_CONSUME_BUFFER_INDEX = 1;
+}
+
+PixmapRenderSurfaceEcoreX::PixmapRenderSurfaceEcoreX(Dali::PositionSize positionSize,
+                                         Any surface,
+                                         const std::string& name,
+                                         bool isTransparent)
+: mPosition( positionSize ),
+  mTitle( name ),
+  mRenderNotification( NULL ),
+  mColorDepth( isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24 ),
+  mOwnSurface( false ),
+  mProduceBufferIndex( INITIAL_PRODUCE_BUFFER_INDEX ),
+  mConsumeBufferIndex( INITIAL_CONSUME_BUFFER_INDEX ),
+  mThreadSynchronization(NULL)
+{
+  for( int i = 0; i != BUFFER_COUNT; ++i )
+  {
+    mX11Pixmaps[i] = 0;
+    mEglSurfaces[i] = 0;
+  }
+
+  Initialize( surface );
+}
+
+PixmapRenderSurfaceEcoreX::~PixmapRenderSurfaceEcoreX()
+{
+  // release the surface if we own one
+  if( mOwnSurface )
+  {
+    for (int i = 0; i < BUFFER_COUNT; ++i)
+    {
+      Ecore_X_Pixmap pixmap = mX11Pixmaps[i];
+
+      // if we did create the pixmap, delete the pixmap
+      DALI_LOG_INFO( gPixmapRenderSurfaceLogFilter, Debug::General, "Own pixmap (%x) freed\n", pixmap );
+      ecore_x_pixmap_free( pixmap );
+    }
+  }
+}
+
+void PixmapRenderSurfaceEcoreX::Initialize( Any surface )
+{
+  // see if there is a surface in Any surface
+  unsigned int surfaceId  = GetSurfaceId( surface );
+
+  // if the surface is empty, create a new one.
+  if ( surfaceId == 0 )
+  {
+    // we own the surface about to created
+    mOwnSurface = true;
+    CreateRenderable();
+  }
+  else
+  {
+    // XLib should already be initialized so no point in calling XInitThreads
+    UseExistingRenderable( surfaceId );
+  }
+}
+
+Any PixmapRenderSurfaceEcoreX::GetSurface()
+{
+  Ecore_X_Pixmap pixmap = 0;
+  {
+    ConditionalWait::ScopedLock lock( mPixmapCondition );
+    pixmap = mX11Pixmaps[mProduceBufferIndex];
+  }
+
+  return Any( pixmap );
+}
+
+void PixmapRenderSurfaceEcoreX::SetRenderNotification(TriggerEventInterface* renderNotification)
+{
+  mRenderNotification = renderNotification;
+}
+
+PositionSize PixmapRenderSurfaceEcoreX::GetPositionSize() const
+{
+  return mPosition;
+}
+
+void PixmapRenderSurfaceEcoreX::InitializeEgl( EglInterface& egl )
+{
+  DALI_LOG_TRACE_METHOD( gPixmapRenderSurfaceLogFilter );
+
+  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+
+  eglImpl.ChooseConfig(false, mColorDepth);
+}
+
+void PixmapRenderSurfaceEcoreX::CreateEglSurface( EglInterface& egl )
+{
+  DALI_LOG_TRACE_METHOD( gPixmapRenderSurfaceLogFilter );
+
+  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+
+  for (int i = 0; i < BUFFER_COUNT; ++i)
+  {
+    // create the EGL surface
+    // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
+    XPixmap pixmap = static_cast<XPixmap>( mX11Pixmaps[i] );
+    mEglSurfaces[i] = eglImpl.CreateSurfacePixmap( EGLNativePixmapType( pixmap ), mColorDepth ); // reinterpret_cast does not compile
+  }
+}
+
+void PixmapRenderSurfaceEcoreX::DestroyEglSurface( EglInterface& egl )
+{
+  DALI_LOG_TRACE_METHOD( gPixmapRenderSurfaceLogFilter );
+
+  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+
+  for (int i = 0; i < BUFFER_COUNT; ++i)
+  {
+    // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
+    XPixmap pixmap = static_cast<XPixmap>( mX11Pixmaps[i] );
+    eglImpl.MakeCurrent( EGLNativePixmapType( pixmap ), mEglSurfaces[i] );
+    eglImpl.DestroySurface();
+  }
+}
+
+bool PixmapRenderSurfaceEcoreX::ReplaceEGLSurface( EglInterface& egl )
+{
+  DALI_LOG_TRACE_METHOD( gPixmapRenderSurfaceLogFilter );
+
+  bool contextLost = false;
+
+  Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+
+  for (int i = 0; i < BUFFER_COUNT; ++i)
+  {
+    // a new surface for the new pixmap
+    // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
+    XPixmap pixmap = static_cast<XPixmap>( mX11Pixmaps[i] );
+    contextLost = eglImpl.ReplaceSurfacePixmap( EGLNativePixmapType( pixmap ), mEglSurfaces[i] ); // reinterpret_cast does not compile
+  }
+
+  // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
+  XPixmap pixmap = static_cast<XPixmap>( mX11Pixmaps[mProduceBufferIndex] );
+  eglImpl.MakeCurrent( EGLNativePixmapType( pixmap ), mEglSurfaces[mProduceBufferIndex] );
+
+  return contextLost;
+}
+
+void PixmapRenderSurfaceEcoreX::StartRender()
+{
+}
+
+bool PixmapRenderSurfaceEcoreX::PreRender( EglInterface& egl, Integration::GlAbstraction&, bool )
+{
+  // Nothing to do for pixmaps
+  return true;
+}
+
+void PixmapRenderSurfaceEcoreX::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, Dali::DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface )
+{
+  // flush gl instruction queue
+  glAbstraction.Flush();
+
+  if( mThreadSynchronization )
+  {
+    mThreadSynchronization->PostRenderStarted();
+  }
+
+  {
+    ConditionalWait::ScopedLock lock( mPixmapCondition );
+    mConsumeBufferIndex = __sync_fetch_and_xor( &mProduceBufferIndex, 1 ); // Swap buffer indexes.
+
+    Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
+
+    // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
+    XPixmap pixmap = static_cast<XPixmap>( mX11Pixmaps[mProduceBufferIndex] );
+    eglImpl.MakeCurrent( EGLNativePixmapType( pixmap ), mEglSurfaces[mProduceBufferIndex] );
+  }
+
+  // create damage for client applications which wish to know the update timing
+  if( mRenderNotification )
+  {
+    // use notification trigger
+    // Tell the event-thread to render the pixmap
+    mRenderNotification->Trigger();
+  }
+  else
+  {
+    // as a fallback, send damage event.
+    Ecore_X_Drawable drawable = Ecore_X_Drawable( mX11Pixmaps[mProduceBufferIndex] );
+
+    if( drawable )
+    {
+      XRectangle rect;
+      XserverRegion region;
+
+      rect.x = 0;
+      rect.y = 0;
+      rect.width = mPosition.width;
+      rect.height = mPosition.height;
+
+      XDisplay* display = AnyCast<XDisplay*>(displayConnection->GetDisplay());
+
+      // make a fixes region as updated area
+      region = XFixesCreateRegion( display, &rect, 1 );
+      // add damage event to updated drawable
+      Drawable xdrawable( drawable ); // ecore type is unsigned int whereas in 64bit linux Drawable is long unsigned int
+      XDamageAdd( display, xdrawable, region );
+      XFixesDestroyRegion( display, region );
+
+      XFlush( display );
+    }
+  }
+
+  if( mThreadSynchronization )
+  {
+    mThreadSynchronization->PostRenderWaitForCompletion();
+  }
+}
+
+void PixmapRenderSurfaceEcoreX::StopRender()
+{
+  ReleaseLock();
+}
+
+void PixmapRenderSurfaceEcoreX::SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization )
+{
+  mThreadSynchronization = &threadSynchronization;
+}
+
+void PixmapRenderSurfaceEcoreX::ReleaseLock()
+{
+  if( mThreadSynchronization )
+  {
+    mThreadSynchronization->PostRenderComplete();
+  }
+}
+
+RenderSurface::Type PixmapRenderSurfaceEcoreX::GetSurfaceType()
+{
+  return RenderSurface::PIXMAP_RENDER_SURFACE;
+}
+
+void PixmapRenderSurfaceEcoreX::CreateRenderable()
+{
+  // check we're creating one with a valid size
+  DALI_ASSERT_ALWAYS( mPosition.width > 0 && mPosition.height > 0 && "Pixmap size is invalid" );
+
+  for (int i = 0; i < BUFFER_COUNT; ++i)
+  {
+    // create the pixmap
+    mX11Pixmaps[i] = ecore_x_pixmap_new(0, mPosition.width, mPosition.height, mColorDepth);
+
+    // clear the pixmap
+    unsigned int foreground;
+    Ecore_X_GC gc;
+    foreground = 0;
+    gc = ecore_x_gc_new( mX11Pixmaps[i],
+                         ECORE_X_GC_VALUE_MASK_FOREGROUND,
+                         &foreground );
+
+    DALI_ASSERT_ALWAYS( gc && "CreateRenderable(): failed to get gc" );
+
+    ecore_x_drawable_rectangle_fill( mX11Pixmaps[i], gc, 0, 0, mPosition.width, mPosition.height );
+
+    DALI_ASSERT_ALWAYS( mX11Pixmaps[i] && "Failed to create X pixmap" );
+
+    // we SHOULD guarantee the xpixmap/x11 window was created in x server.
+    ecore_x_sync();
+
+    ecore_x_gc_free(gc);
+  }
+}
+
+void PixmapRenderSurfaceEcoreX::UseExistingRenderable( unsigned int surfaceId )
+{
+}
+
+unsigned int PixmapRenderSurfaceEcoreX::GetSurfaceId( Any surface ) const
+{
+  unsigned int surfaceId = 0;
+
+  if ( surface.Empty() == false )
+  {
+    // check we have a valid type
+    DALI_ASSERT_ALWAYS( ( (surface.GetType() == typeid (XWindow) ) ||
+                          (surface.GetType() == typeid (Ecore_X_Window) ) )
+                        && "Surface type is invalid" );
+
+    if ( surface.GetType() == typeid (Ecore_X_Window) )
+    {
+      surfaceId = AnyCast<Ecore_X_Window>( surface );
+    }
+    else
+    {
+      surfaceId = AnyCast<XWindow>( surface );
+    }
+  }
+  return surfaceId;
+}
+
+} // namespace Adaptor
+
+} // namespace internal
+
+} // namespace Dali
diff --git a/dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.h b/dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.h
new file mode 100644 (file)
index 0000000..91ee161
--- /dev/null
@@ -0,0 +1,197 @@
+#ifndef __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__
+#define __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__
+
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/egl-interface.h>
+#include <dali/internal/graphics/gles20/egl-implementation.h>
+#include <dali/internal/window-system/common/pixmap-render-surface.h>
+#include <dali/internal/window-system/ubuntu-x11/ecore-x-types.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+#include <dali/devel-api/threading/conditional-wait.h>
+#include <Ecore_X.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+/**
+ * Ecore X11 Pixmap implementation of render surface.
+ */
+class PixmapRenderSurfaceEcoreX : public PixmapRenderSurface
+{
+public:
+
+  /**
+    * Uses an X11 surface to render to.
+    * @param [in] positionSize the position and size of the surface
+    * @param [in] surface can be a X-window or X-pixmap (type must be unsigned int).
+    * @param [in] name optional name of surface passed in
+    * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
+    */
+  PixmapRenderSurfaceEcoreX( Dali::PositionSize positionSize,
+                       Any surface,
+                       const std::string& name,
+                       bool isTransparent = false);
+
+  /**
+   * @brief Destructor
+   */
+  virtual ~PixmapRenderSurfaceEcoreX();
+
+public: // from WindowRenderSurface
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::PixmapRenderSurface::GetSurface()
+   */
+  virtual Any GetSurface() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::PixmapRenderSurface::SetRenderNotification()
+   */
+  virtual void SetRenderNotification( TriggerEventInterface* renderNotification ) override;
+
+public: // from Dali::RenderSurface
+
+  /**
+   * @copydoc Dali::RenderSurface::GetPositionSize()
+   */
+  virtual PositionSize GetPositionSize() const;
+
+  /**
+   * @copydoc Dali::RenderSurface::InitializeEgl()
+   */
+  virtual void InitializeEgl( EglInterface& egl );
+
+  /**
+   * @copydoc Dali::RenderSurface::CreateEglSurface()
+   */
+  virtual void CreateEglSurface( EglInterface& egl );
+
+  /**
+   * @copydoc Dali::RenderSurface::DestroyEglSurface()
+   */
+  virtual void DestroyEglSurface( EglInterface& egl );
+
+  /**
+   * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
+   */
+  virtual bool ReplaceEGLSurface( EglInterface& egl );
+
+  /**
+   * @copydoc Dali::RenderSurface::MoveResize()
+   */
+  virtual void MoveResize( Dali::PositionSize positionSize) {}
+
+  /**
+   * @copydoc Dali::RenderSurface::SetViewMode()
+   */
+  void SetViewMode( ViewMode viewMode ) {}
+
+  /**
+   * @copydoc Dali::RenderSurface::StartRender()
+   */
+  virtual void StartRender();
+
+  /**
+   * @copydoc Dali::RenderSurface::PreRender()
+   */
+  virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface );
+
+  /**
+   * @copydoc Dali::RenderSurface::PostRender()
+   */
+  virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface );
+
+  /**
+   * @copydoc Dali::RenderSurface::StopRender()
+   */
+  virtual void StopRender();
+
+  /**
+   * @copydoc Dali::RenderSurface::SetThreadSynchronization
+   */
+  virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization );
+
+  /**
+   * @copydoc Dali::RenderSurface::GetSurfaceType()
+   */
+  virtual RenderSurface::Type GetSurfaceType();
+
+private: // from PixmapRenderSurface
+
+  /**
+   * @copydoc Dali::RenderSurface::ReleaseLock()
+   */
+  virtual void ReleaseLock();
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::PixmapRenderSurface::Initialize()
+   */
+  virtual void Initialize( Any surface ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::PixmapRenderSurface::Initialize()
+   */
+  virtual void CreateRenderable() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::PixmapRenderSurface::Initialize()
+   */
+  virtual void UseExistingRenderable( unsigned int surfaceId ) override;
+
+private:
+
+  /**
+   * Get the surface id if the surface parameter is not empty
+   * @param surface Any containing a surface id, or can be empty
+   * @return surface id, or zero if surface is empty
+   */
+  unsigned int GetSurfaceId( Any surface ) const;
+
+private: // Data
+
+  static const int BUFFER_COUNT = 2;
+
+  PositionSize                    mPosition;               ///< Position
+  std::string                     mTitle;                  ///< Title of window which shows from "xinfo -topvwins" command
+  TriggerEventInterface*          mRenderNotification;     ///< Render notification trigger
+  ColorDepth                      mColorDepth;             ///< Color depth of surface (32 bit or 24 bit)
+  bool                            mOwnSurface;             ///< Whether we own the surface (responsible for deleting it)
+
+  int                             mProduceBufferIndex;
+  int                             mConsumeBufferIndex;
+  XPixmap                         mX11Pixmaps[BUFFER_COUNT];  ///< X-Pixmap
+  EGLSurface                      mEglSurfaces[BUFFER_COUNT];
+  ThreadSynchronizationInterface* mThreadSynchronization;     ///< A pointer to the thread-synchronization
+  ConditionalWait                 mPixmapCondition;           ///< condition to share pixmap
+};
+
+} // namespace Adaptor
+
+} // namespace internal
+
+} // namespace Dali
+
+#endif // __DALI_ECORE_X_PIXMAP_RENDER_SURFACE_H__
diff --git a/dali/internal/window-system/ubuntu-x11/render-surface-ecore-x.cpp b/dali/internal/window-system/ubuntu-x11/render-surface-ecore-x.cpp
deleted file mode 100644 (file)
index 5a36015..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/integration-api/x11/ecore-x-render-surface.h>
-
-// EXTERNAL INCLUDES
-#include <X11/Xatom.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#include <X11/extensions/Xfixes.h> // for damage notify
-#include <X11/extensions/Xdamage.h> // for damage notify
-
-#include <dali/integration-api/gl-abstraction.h>
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/x11/ecore-x-types.h>
-#include <dali/internal/system/common/trigger-event.h>
-#include <dali/internal/graphics/gles20/egl-implementation.h>
-
-namespace Dali
-{
-
-#if defined(DEBUG_ENABLED)
-Debug::Filter* gRenderSurfaceLogFilter = Debug::Filter::New(Debug::Verbose, false, "LOG_ECORE_X_RENDER_SURFACE");
-#endif
-
-namespace ECore
-{
-
-EcoreXRenderSurface::EcoreXRenderSurface(Dali::PositionSize positionSize,
-                                         Any surface,
-                                         const std::string& name,
-                                         bool isTransparent)
-: mPosition(positionSize),
-  mTitle(name),
-  mRenderNotification(NULL),
-  mColorDepth(isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24),
-  mOwnSurface(false)
-{
-}
-
-void EcoreXRenderSurface::Init( Any surface )
-{
-  // see if there is a surface in Any surface
-  unsigned int surfaceId  = GetSurfaceId( surface );
-
-  // if the surface is empty, create a new one.
-  if ( surfaceId == 0 )
-  {
-    // we own the surface about to created
-    mOwnSurface = true;
-    CreateXRenderable();
-  }
-  else
-  {
-    // XLib should already be initialized so no point in calling XInitThreads
-    UseExistingRenderable( surfaceId );
-  }
-}
-
-EcoreXRenderSurface::~EcoreXRenderSurface()
-{
-}
-
-void EcoreXRenderSurface::SetRenderNotification(TriggerEventInterface* renderNotification)
-{
-  mRenderNotification = renderNotification;
-}
-
-Ecore_X_Window EcoreXRenderSurface::GetXWindow()
-{
-  return 0;
-}
-
-Ecore_X_Drawable EcoreXRenderSurface::GetDrawable()
-{
-  return 0;
-}
-
-PositionSize EcoreXRenderSurface::GetPositionSize() const
-{
-  return mPosition;
-}
-
-void EcoreXRenderSurface::MoveResize( Dali::PositionSize positionSize )
-{
-  // nothing to do in base class
-}
-
-void EcoreXRenderSurface::SetViewMode( ViewMode viewMode )
-{
-}
-
-unsigned int EcoreXRenderSurface::GetSurfaceId( Any surface ) const
-{
-  unsigned int surfaceId = 0;
-
-  if ( surface.Empty() == false )
-  {
-    // check we have a valid type
-    DALI_ASSERT_ALWAYS( ( (surface.GetType() == typeid (XWindow) ) ||
-                          (surface.GetType() == typeid (Ecore_X_Window) ) )
-                        && "Surface type is invalid" );
-
-    if ( surface.GetType() == typeid (Ecore_X_Window) )
-    {
-      surfaceId = AnyCast<Ecore_X_Window>( surface );
-    }
-    else
-    {
-      surfaceId = AnyCast<XWindow>( surface );
-    }
-  }
-  return surfaceId;
-}
-
-RenderSurface::Type EcoreXRenderSurface::GetSurfaceType()
-{
-  return RenderSurface::ECORE_RENDER_SURFACE;
-}
-
-} // namespace ECore
-
-} // namespace Dali
index c8d23b2..1740552 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
  *
  */
 
-// INTERNAL INCLUDES
-#include <dali/integration-api/x11/pixmap-render-surface.h>
+// CLASS HEADER
+#include <dali/internal/window-system/ubuntu-x11/render-surface-factory-ecore-x.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/window-system/ubuntu-x11/window-render-surface-ecore-x.h>
+#include <dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.h>
+#include <dali/internal/window-system/common/display-utils.h>
+#include <dali/integration-api/native-render-surface.h>
 
 namespace Dali
 {
+namespace Internal
+{
+namespace Adaptor
+{
 
-namespace ECore
+std::unique_ptr< WindowRenderSurface > RenderSurfaceFactoryEcoreX::CreateWindowRenderSurface( Dali::PositionSize positionSize,
+                                                                                              Any surface,
+                                                                                              const std::string& name,
+                                                                                              const std::string& className,
+                                                                                              bool isTransparent )
 {
+  return Utils::MakeUnique< WindowRenderSurfaceEcoreX >( positionSize, surface, name, className, isTransparent );
+}
 
-DALI_EXPORT_API PixmapRenderSurface* CreatePixmapSurface(
-  PositionSize       positionSize,
-  Any                surface,
-  const std::string& name,
-  bool               isTransparent)
+std::unique_ptr< PixmapRenderSurface > RenderSurfaceFactoryEcoreX::CreatePixmapRenderSurface( Dali::PositionSize positionSize, Any surface,
+                                                                                              const std::string& name, bool isTransparent )
 {
-  return new PixmapRenderSurface(positionSize, surface, name, isTransparent);
+  return Utils::MakeUnique< PixmapRenderSurfaceEcoreX >( positionSize, surface, name, isTransparent );
 }
 
+std::unique_ptr< NativeRenderSurface > RenderSurfaceFactoryEcoreX::CreateNativeRenderSurface( Dali::PositionSize positionSize, const std::string& name, bool isTransparent )
+{
+  return std::unique_ptr< NativeRenderSurface >( nullptr );
+}
 
-} // namespace ECore
+// this should be created from somewhere
+std::unique_ptr< RenderSurfaceFactory > GetRenderSurfaceFactory()
+{
+  // returns Window factory
+  return Utils::MakeUnique< RenderSurfaceFactoryEcoreX >();
+}
 
+} // namespace Adaptor
+} // namespace Internal
 } // namespace Dali
-
-
-
index 781bb85..5ba5e70 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_ADAPTOR_ECORE_X_RENDER_SURFACE_FACTORY_H__
-#define __DALI_INTERNAL_ADAPTOR_ECORE_X_RENDER_SURFACE_FACTORY_H__
+#ifndef DALI_INTERNAL_WINDOWSYSTEM_ECOREX_RENDER_SURFACE_FACTORY_ECORE_X_H
+#define DALI_INTERNAL_WINDOWSYSTEM_ECOREX_RENDER_SURFACE_FACTORY_ECORE_X_H
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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 <string>
-#include <dali/public-api/math/rect.h>
-#include <dali/public-api/common/dali-common.h>
-
-// INTERNAL INCLUDES
-#include <native-buffer-pool.h>
+#include <dali/internal/window-system/common/render-surface-factory.h>
 
 namespace Dali
 {
-
 namespace Internal
 {
-
 namespace Adaptor
 {
 
-namespace ECore
+class RenderSurfaceFactoryEcoreX : public RenderSurfaceFactory
 {
+public:
+  std::unique_ptr< WindowRenderSurface > CreateWindowRenderSurface( Dali::PositionSize positionSize, Any surface,
+                                                                    const std::string& name, const std::string& className, bool isTransparent = false ) override;
 
-class RenderSurface;
-
-/**
- * Surface factory function for pixmap
- * A pixmap surface is created.
- *
- * @param [in] type the type of surface to create
- * @param [in] positionSize the position and size of the surface to create
- * @param [in] display X Pixmap to use, or null for default.
- * @param [in] display X Display to use, or null for default.
- * @param [in] name Name of surface passed in
- * @param [in] isTransparent Whether the surface has an alpha channel
- */
-RenderSurface* CreatePixmapSurface(
-  PositionSize       positionSize,
-  Any         surface,
-  Any         display,
-  const std::string& name,
-  bool               isTransparent );
+  std::unique_ptr< PixmapRenderSurface > CreatePixmapRenderSurface( Dali::PositionSize positionSize, Any surface,
+                                                                    const std::string& name, bool isTransparent = false ) override;
 
-} // namespace ECore
+  std::unique_ptr< NativeRenderSurface > CreateNativeRenderSurface( Dali::PositionSize positionSize, const std::string& name, bool isTransparent = false ) override;
+};
 
 } // namespace Adaptor
-
 } // namespace Internal
-
 } // namespace Dali
 
-#endif //  __DALI_INTERNAL_ADAPTOR_ECORE_X_RENDER_SURFACE_FACTORY_H__
+#endif // DALI_INTERNAL_WINDOWSYSTEM_ECOREX_RENDER_SURFACE_FACTORY_ECORE_X_H
diff --git a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp
new file mode 100644 (file)
index 0000000..b9a72ea
--- /dev/null
@@ -0,0 +1,336 @@
+/*
+ * Copyright (c) 2018 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.
+ *
+ */
+
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+
+// CLASS HEADER
+#include <dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/window-system/common/window-impl.h>
+#include <dali/internal/window-system/ubuntu-x11/window-render-surface-ecore-x.h>
+
+// EXTERNAL_HEADERS
+#include <dali/public-api/object/any.h>
+#include <dali/integration-api/debug.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW_BASE" );
+#endif
+
+static Eina_Bool EcoreEventWindowPropertyChanged( void* data, int type, void* event )
+{
+  WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
+  if( windowBase )
+  {
+    return windowBase->OnWindowPropertyChanged( data, type, event );
+  }
+
+  return ECORE_CALLBACK_PASS_ON;
+}
+
+/// Called when the window receives a delete request
+static Eina_Bool EcoreEventWindowDeleteRequest( void* data, int type, void* event )
+{
+  WindowBaseEcoreX* windowBase = static_cast< WindowBaseEcoreX* >( data );
+  if( windowBase )
+  {
+    windowBase->OnDeleteRequest();
+  }
+  return ECORE_CALLBACK_DONE;
+}
+
+} // unnamed namespace
+
+WindowBaseEcoreX::WindowBaseEcoreX( Window* window, WindowRenderSurface* windowRenderSurface )
+: mEcoreEventHandler(),
+  mWindow( window ),
+  mWindowSurface( NULL ),
+  mEcoreWindow( 0 ),
+  mRotationAppSet( false )
+{
+  mWindowSurface = dynamic_cast< WindowRenderSurfaceEcoreX* >( windowRenderSurface );
+}
+
+WindowBaseEcoreX::~WindowBaseEcoreX()
+{
+  for( Dali::Vector< Ecore_Event_Handler* >::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter )
+  {
+    ecore_event_handler_del( *iter );
+  }
+  mEcoreEventHandler.Clear();
+}
+
+void WindowBaseEcoreX::Initialize()
+{
+  if( !mWindowSurface )
+  {
+    DALI_ASSERT_ALWAYS( "Invalid window surface" );
+  }
+
+  mEcoreWindow = mWindowSurface->GetXWindow();
+  DALI_ASSERT_ALWAYS( mEcoreWindow != 0 && "There is no EcoreX window" );
+
+  ecore_x_input_multi_select( mEcoreWindow );
+
+  // This ensures that we catch the window close (or delete) request
+  ecore_x_icccm_protocol_set( mEcoreWindow, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, EINA_TRUE );
+
+  mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_PROPERTY, EcoreEventWindowPropertyChanged, this ) );
+  mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_X_EVENT_WINDOW_DELETE_REQUEST, EcoreEventWindowDeleteRequest, this ) );
+}
+
+Eina_Bool WindowBaseEcoreX::OnWindowPropertyChanged( void* data, int type, void* event )
+{
+  Ecore_X_Event_Window_Property* propertyChangedEvent = static_cast< Ecore_X_Event_Window_Property* >( event );
+  Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
+
+  if( propertyChangedEvent->win == mEcoreWindow )
+  {
+    Ecore_X_Window_State_Hint state( ecore_x_icccm_state_get( propertyChangedEvent->win ) );
+
+    switch( state )
+    {
+      case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
+      {
+        // Window was hidden.
+        mWindow->OnIconifyChanged( true );
+        DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%d) Withdrawn\n", mWindow );
+        handled = ECORE_CALLBACK_DONE;
+        break;
+      }
+      case ECORE_X_WINDOW_STATE_HINT_ICONIC:
+      {
+        // Window was iconified (minimised).
+        mWindow->OnIconifyChanged( true );
+        DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%d) Iconfied\n", mWindow );
+        handled = ECORE_CALLBACK_DONE;
+        break;
+      }
+      case ECORE_X_WINDOW_STATE_HINT_NORMAL:
+      {
+        // Window was shown.
+        mWindow->OnIconifyChanged( false );
+        DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%d) Shown\n", mWindow );
+        handled = ECORE_CALLBACK_DONE;
+        break;
+      }
+      default:
+      {
+        // Ignore
+        break;
+      }
+    }
+  }
+
+  return handled;
+}
+
+void WindowBaseEcoreX::OnDeleteRequest()
+{
+  mWindow->OnDeleteRequest();
+}
+
+void WindowBaseEcoreX::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode )
+{
+  DALI_LOG_TRACE_METHOD_FMT( gWindowBaseLogFilter, "visible : %d\n", visibleMode );
+
+  if( visibleMode == Dali::Window::VISIBLE )
+  {
+    // when the indicator is visible, set proper mode for indicator server according to bg mode
+    if( opacityMode == Dali::Window::OPAQUE )
+    {
+      ecore_x_e_illume_indicator_opacity_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_OPAQUE );
+    }
+    else if( opacityMode == Dali::Window::TRANSLUCENT )
+    {
+      ecore_x_e_illume_indicator_opacity_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT );
+    }
+#if defined (DALI_PROFILE_MOBILE)
+    else if( opacityMode == Dali::Window::TRANSPARENT )
+    {
+      ecore_x_e_illume_indicator_opacity_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_OPAQUE );
+    }
+#endif
+  }
+  else
+  {
+    // when the indicator is not visible, set TRANSPARENT mode for indicator server
+    ecore_x_e_illume_indicator_opacity_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_TRANSPARENT ); // it means hidden indicator
+  }
+}
+
+void WindowBaseEcoreX::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
+{
+  int show_state = static_cast< int >( isShow );
+  ecore_x_window_prop_property_set( mEcoreWindow, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
+                                    ECORE_X_ATOM_CARDINAL, 32, &show_state, 1 );
+
+  if( isShow )
+  {
+    ecore_x_e_illume_indicator_state_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_STATE_ON );
+  }
+  else
+  {
+    ecore_x_e_illume_indicator_state_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_STATE_OFF );
+  }
+}
+
+void WindowBaseEcoreX::IndicatorTypeChanged( IndicatorInterface::Type type )
+{
+}
+
+void WindowBaseEcoreX::SetClass( std::string name, std::string className )
+{
+  ecore_x_icccm_name_class_set( mEcoreWindow, name.c_str(), className.c_str() );
+}
+
+void WindowBaseEcoreX::Raise()
+{
+  ecore_x_window_raise( mEcoreWindow );
+}
+
+void WindowBaseEcoreX::Lower()
+{
+  ecore_x_window_lower( mEcoreWindow );
+}
+
+void WindowBaseEcoreX::Activate()
+{
+  ecore_x_netwm_client_active_request( ecore_x_window_root_get( mEcoreWindow ), mEcoreWindow, 1 /* request type, 1:application, 2:pager */, 0 );
+}
+
+void WindowBaseEcoreX::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
+{
+}
+
+void WindowBaseEcoreX::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
+{
+}
+
+void WindowBaseEcoreX::SetAcceptFocus( bool accept )
+{
+}
+
+void WindowBaseEcoreX::Show()
+{
+  ecore_x_window_show( mEcoreWindow );
+}
+
+void WindowBaseEcoreX::Hide()
+{
+  ecore_x_window_hide( mEcoreWindow );
+}
+
+unsigned int WindowBaseEcoreX::GetSupportedAuxiliaryHintCount() const
+{
+  return 0;
+}
+
+std::string WindowBaseEcoreX::GetSupportedAuxiliaryHint( unsigned int index ) const
+{
+  return std::string();
+}
+
+unsigned int WindowBaseEcoreX::AddAuxiliaryHint( const std::string& hint, const std::string& value )
+{
+  return 0;
+}
+
+bool WindowBaseEcoreX::RemoveAuxiliaryHint( unsigned int id )
+{
+  return false;
+}
+
+bool WindowBaseEcoreX::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
+{
+  return false;
+}
+
+std::string WindowBaseEcoreX::GetAuxiliaryHintValue( unsigned int id ) const
+{
+  return std::string();
+}
+
+unsigned int WindowBaseEcoreX::GetAuxiliaryHintId( const std::string& hint ) const
+{
+  return 0;
+}
+
+void WindowBaseEcoreX::SetInputRegion( const Rect< int >& inputRegion )
+{
+}
+
+void WindowBaseEcoreX::SetType( Dali::Window::Type type )
+{
+}
+
+bool WindowBaseEcoreX::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
+{
+  return false;
+}
+
+Dali::Window::NotificationLevel::Type WindowBaseEcoreX::GetNotificationLevel() const
+{
+  return Dali::Window::NotificationLevel::NONE;
+}
+
+void WindowBaseEcoreX::SetOpaqueState( bool opaque )
+{
+}
+
+bool WindowBaseEcoreX::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
+{
+  return false;
+}
+
+Dali::Window::ScreenOffMode::Type WindowBaseEcoreX::GetScreenOffMode() const
+{
+  return Dali::Window::ScreenOffMode::TIMEOUT;
+}
+
+bool WindowBaseEcoreX::SetBrightness( int brightness )
+{
+  return false;
+}
+
+int WindowBaseEcoreX::GetBrightness() const
+{
+  return 0;
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#pragma GCC diagnostic pop
diff --git a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h
new file mode 100644 (file)
index 0000000..9e7ecc6
--- /dev/null
@@ -0,0 +1,240 @@
+#ifndef DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_BASE_ECORE_X_H
+#define DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_BASE_ECORE_X_H
+
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/window-system/common/window-base.h>
+
+// EXTERNAL HEADERS
+#include <Ecore.h>
+#include <Ecore_X.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+class Window;
+class WindowRenderSurface;
+class WindowRenderSurfaceEcoreX;
+
+/**
+ * WindowBaseEcoreX class provides an WindowBase EcoreX implementation.
+ */
+class WindowBaseEcoreX : public WindowBase
+{
+public:
+
+  /**
+   * @brief Constructor
+   */
+  WindowBaseEcoreX( Window* window, WindowRenderSurface* windowRenderSurface );
+
+  /**
+   * @brief Destructor
+   */
+  virtual ~WindowBaseEcoreX();
+
+public:
+
+  /**
+   * @brief Called when the window property is changed.
+   */
+  Eina_Bool OnWindowPropertyChanged( void* data, int type, void* event );
+
+  /**
+   * Called when the window receives a delete request
+   */
+  void OnDeleteRequest();
+
+public:
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Initialize()
+   */
+  virtual void Initialize() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::ShowIndicator()
+   */
+  virtual void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetIndicatorProperties()
+   */
+  virtual void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IndicatorTypeChanged()
+   */
+  virtual void IndicatorTypeChanged( IndicatorInterface::Type type ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
+   */
+  virtual void SetClass( std::string name, std::string className ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
+   */
+  virtual void Raise() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
+   */
+  virtual void Lower() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
+   */
+  virtual void Activate() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableOrientations()
+   */
+  virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredOrientation()
+   */
+  virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
+   */
+  virtual void SetAcceptFocus( bool accept ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
+   */
+  virtual void Show() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
+   */
+  virtual void Hide() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
+   */
+  virtual unsigned int GetSupportedAuxiliaryHintCount() const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
+   */
+  virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
+   */
+  virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
+   */
+  virtual bool RemoveAuxiliaryHint( unsigned int id ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
+   */
+  virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
+   */
+  virtual std::string GetAuxiliaryHintValue( unsigned int id ) const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
+   */
+  virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
+   */
+  virtual void SetInputRegion( const Rect< int >& inputRegion ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
+   */
+  virtual void SetType( Dali::Window::Type type ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
+   */
+  virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
+   */
+  virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
+   */
+  virtual void SetOpaqueState( bool opaque ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
+   */
+  virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
+   */
+  virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
+   */
+  virtual bool SetBrightness( int brightness ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
+   */
+  virtual int GetBrightness() const override;
+
+protected:
+
+  // Undefined
+  WindowBaseEcoreX(const WindowBaseEcoreX&) = delete;
+
+  // Undefined
+  WindowBaseEcoreX& operator=(const WindowBaseEcoreX& rhs) = delete;
+
+private:
+
+  Dali::Vector< Ecore_Event_Handler* > mEcoreEventHandler;
+
+  Window*                              mWindow;
+  WindowRenderSurfaceEcoreX*           mWindowSurface;
+  Ecore_X_Window                       mEcoreWindow;
+
+  bool                                 mRotationAppSet:1;
+};
+
+} // namespace Adaptor
+
+} // namespace internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_BASE_ECORE_X_H
diff --git a/dali/internal/window-system/ubuntu-x11/window-base-factory-ecore-x.cpp b/dali/internal/window-system/ubuntu-x11/window-base-factory-ecore-x.cpp
new file mode 100644 (file)
index 0000000..6b59782
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2018 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/window-system/ubuntu-x11/window-base-factory-ecore-x.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+std::unique_ptr< Dali::Internal::Adaptor::WindowBase > WindowBaseFactoryEcoreX::CreateWindowBase( Window* window, WindowRenderSurface* windowRenderSurface )
+{
+  return Utils::MakeUnique< WindowBaseEcoreX >( window, windowRenderSurface );
+}
+
+// this should be created from somewhere
+std::unique_ptr< WindowBaseFactory > GetWindowBaseFactory()
+{
+  // returns WindowBase factory
+  return Utils::MakeUnique< WindowBaseFactoryEcoreX >();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/window-system/ubuntu-x11/window-base-factory-ecore-x.h b/dali/internal/window-system/ubuntu-x11/window-base-factory-ecore-x.h
new file mode 100644 (file)
index 0000000..83abc22
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_FACTORY_ECORE_X_H
+#define DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_FACTORY_ECORE_X_H
+
+/*
+ * Copyright (c) 2018 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.
+ *
+ */
+
+#include <dali/internal/window-system/common/window-base-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+class WindowBaseFactoryEcoreX : public WindowBaseFactory
+{
+public:
+  std::unique_ptr< Dali::Internal::Adaptor::WindowBase > CreateWindowBase( Window* window, WindowRenderSurface* windowRenderSurface ) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_FACTORY_ECORE_X_H
diff --git a/dali/internal/window-system/ubuntu-x11/window-extensions.h b/dali/internal/window-system/ubuntu-x11/window-extensions.h
deleted file mode 100644 (file)
index 243d006..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef __DALI_WINDOW_EXTENSIONS_H__
-#define __DALI_WINDOW_EXTENSIONS_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-
-namespace Dali
-{
-class Window;
-
-namespace WindowExtensions
-{
-
-/**
- * @brief Set whether the effect will enable or not.
- *
- * The effect will be shown when the application is launched, quit, shown and hiden.
- *
- * @note This function is only specified by tizen.
- *
- * @param[in] window The window to set.
- * @param[in] enable True if the effect is enabled.
- */
-DALI_IMPORT_API void EnableEffect( Window window, bool enable );
-
-/**
- * @brief Retrieve whether the effect is enabled or not.
- *
- * @note This function is only specified by tizen.
- *
- * @param[in] window The window to set.
- * @return True if the effect is enabled.
- */
-DALI_IMPORT_API bool IsEffectEnabled( Window window );
-
-} // namespace WindowExtensions
-
-} // namespace Dali
-
-#endif // __DALI_WINDOW_EXTENSIONS_H__
diff --git a/dali/internal/window-system/ubuntu-x11/window-impl-x.cpp b/dali/internal/window-system/ubuntu-x11/window-impl-x.cpp
deleted file mode 100644 (file)
index c0b2fa4..0000000
+++ /dev/null
@@ -1,974 +0,0 @@
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/internal/window-system/common/window-impl.h>
-
-// EXTERNAL HEADERS
-// Ecore is littered with C style cast
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-#include <Ecore.h>
-#include <Ecore_X.h>
-
-#include <dali/integration-api/core.h>
-#include <dali/integration-api/system-overlay.h>
-#include <dali/public-api/render-tasks/render-task.h>
-#include <dali/public-api/render-tasks/render-task-list.h>
-
-// INTERNAL HEADERS
-#include <dali/internal/window-system/ubuntu-x11/window-render-surface-x.h>
-#include <dali/internal/input/common/drag-and-drop-detector-impl.h>
-#include <dali/internal/window-system/common/ecore-indicator-impl.h>
-#include <dali/internal/window-system/common/window-visibility-observer.h>
-#include <dali/devel-api/adaptor-framework/orientation.h>
-#include <dali/internal/window-system/common/orientation-impl.h>
-
-namespace
-{
-const float INDICATOR_ANIMATION_DURATION( 0.18f ); // 180 milli seconds
-const float INDICATOR_SHOW_Y_POSITION( 0.0f );
-const float INDICATOR_HIDE_Y_POSITION( -52.0f );
-}
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-#if defined(DEBUG_ENABLED)
-Debug::Filter* gWindowLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_WINDOW");
-#endif
-
-/**
- * TODO: Abstract Window class out and move this into a window implementation for Ecore
- */
-struct Window::EventHandler
-{
-  /**
-   * Constructor
-   * @param[in]  window  A pointer to the window class.
-   */
-  EventHandler( Window* window )
-  : mWindow( window ),
-    mWindowPropertyHandler( NULL ),
-    mClientMessagehandler( NULL ),
-    mWindowDeleteRequestHandler( NULL ),
-    mEcoreWindow( 0 )
-  {
-    // store ecore window handle
-    ECore::WindowRenderSurface* x11Window( dynamic_cast< ECore::WindowRenderSurface * >( mWindow->mSurface ) );
-    if( x11Window )
-    {
-      mEcoreWindow = x11Window->GetXWindow();
-    }
-    DALI_ASSERT_ALWAYS( mEcoreWindow != 0 && "There is no ecore x window");
-
-#ifndef DALI_PROFILE_UBUNTU
-    // set property on window to get deiconify approve client message
-    unsigned int tmp = 1;
-    ecore_x_window_prop_card32_set(mEcoreWindow,
-                             ECORE_X_ATOM_E_DEICONIFY_APPROVE,
-                             &tmp, 1);
-#endif // DALI_PROFILE_UBUNTU
-
-    if( mWindow->mEcoreEventHander )
-    {
-      ecore_x_input_multi_select( mEcoreWindow );
-
-      // This ensures that we catch the window close (or delete) request
-      ecore_x_icccm_protocol_set( mEcoreWindow, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, EINA_TRUE );
-
-      mWindowPropertyHandler=  ecore_event_handler_add( ECORE_X_EVENT_WINDOW_PROPERTY,  EcoreEventWindowPropertyChanged, this );
-      mClientMessagehandler =  ecore_event_handler_add( ECORE_X_EVENT_CLIENT_MESSAGE,  EcoreEventClientMessage, this );
-      mWindowDeleteRequestHandler = ecore_event_handler_add( ECORE_X_EVENT_WINDOW_DELETE_REQUEST, EcoreEventWindowDeleteRequest, this );
-    }
-  }
-
-  /**
-   * Destructor
-   */
-  ~EventHandler()
-  {
-    if ( mWindowPropertyHandler )
-    {
-      ecore_event_handler_del( mWindowPropertyHandler );
-    }
-    if ( mClientMessagehandler )
-    {
-      ecore_event_handler_del( mClientMessagehandler );
-    }
-    if ( mWindowDeleteRequestHandler )
-    {
-      ecore_event_handler_del( mWindowDeleteRequestHandler );
-    }
-  }
-
-  // Static methods
-
-  /// Called when the window properties are changed.
-  static Eina_Bool EcoreEventWindowPropertyChanged( void* data, int type, void* event )
-  {
-    Ecore_X_Event_Window_Property* propertyChangedEvent( (Ecore_X_Event_Window_Property*)event );
-    EventHandler* handler( (EventHandler*)data );
-    Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
-
-    if ( handler && handler->mWindow )
-    {
-      WindowVisibilityObserver* observer( handler->mWindow->mAdaptor );
-      if ( observer && ( propertyChangedEvent->win == handler->mEcoreWindow ) )
-      {
-        Ecore_X_Window_State_Hint state( ecore_x_icccm_state_get( propertyChangedEvent->win ) );
-
-        switch ( state )
-        {
-          case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
-          {
-            // Window was hidden.
-            observer->OnWindowHidden();
-            DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%d) Withdrawn\n", handler->mEcoreWindow );
-            handled = ECORE_CALLBACK_DONE;
-          }
-          break;
-
-          case ECORE_X_WINDOW_STATE_HINT_ICONIC:
-          {
-            // Window was iconified (minimised).
-            observer->OnWindowHidden();
-            DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%d) Iconfied\n", handler->mEcoreWindow );
-            handled = ECORE_CALLBACK_DONE;
-          }
-          break;
-
-          case ECORE_X_WINDOW_STATE_HINT_NORMAL:
-          {
-            // Window was shown.
-            observer->OnWindowShown();
-            DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%d) Shown\n", handler->mEcoreWindow );
-            handled = ECORE_CALLBACK_DONE;
-          }
-          break;
-
-          default:
-            // Ignore
-            break;
-        }
-      }
-    }
-
-    return handled;
-  }
-
-  /// Called when the window properties are changed.
-  static Eina_Bool EcoreEventClientMessage( void* data, int type, void* event )
-  {
-    Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
-#ifndef DALI_PROFILE_UBUNTU
-    Ecore_X_Event_Client_Message* clientMessageEvent( (Ecore_X_Event_Client_Message*)event );
-    EventHandler* handler( (EventHandler*)data );
-
-    if (clientMessageEvent->message_type == ECORE_X_ATOM_E_DEICONIFY_APPROVE)
-    {
-      ECore::WindowRenderSurface* x11Window( dynamic_cast< ECore::WindowRenderSurface * >( handler->mWindow->mSurface ) );
-      WindowVisibilityObserver* observer( handler->mWindow->mAdaptor );
-
-      if ( observer && ( (unsigned int)clientMessageEvent->data.l[0] == handler->mEcoreWindow ) )
-      {
-        if (clientMessageEvent->data.l[1] == 0) //wm sends request message using value 0
-        {
-          observer->OnWindowShown();
-
-          // request to approve the deiconify. render-surface should send proper event after real rendering
-          if(x11Window)
-          {
-            x11Window->RequestToApproveDeiconify();
-          }
-
-          handled = ECORE_CALLBACK_DONE;
-        }
-      }
-    }
-#endif // DALI_PROFILE_UBUNTU
-
-    return handled;
-  }
-
-  /// Called when the window receives a delete request
-  static Eina_Bool EcoreEventWindowDeleteRequest( void* data, int type, void* event )
-  {
-    EventHandler* handler( (EventHandler*)data );
-    handler->mWindow->mDeleteRequestSignal.Emit();
-    return ECORE_CALLBACK_DONE;
-  }
-
-  // Data
-  Window* mWindow;
-  Ecore_Event_Handler* mWindowPropertyHandler;
-  Ecore_Event_Handler* mClientMessagehandler;
-  Ecore_Event_Handler* mWindowDeleteRequestHandler;
-  Ecore_X_Window mEcoreWindow;
-};
-
-
-Window* Window::New( const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent )
-{
-  Window* window = new Window();
-  window->mIsTransparent = isTransparent;
-  window->Initialize( positionSize, name, className );
-  return window;
-}
-
-void Window::SetAdaptor(Dali::Adaptor& adaptor)
-{
-  DALI_ASSERT_ALWAYS( !mStarted && "Adaptor already started" );
-  mStarted = true;
-
-  // Only create one overlay per window
-  Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation(adaptor);
-  Integration::Core& core = adaptorImpl.GetCore();
-  mOverlay = &core.GetSystemOverlay();
-
-  Dali::RenderTaskList taskList = mOverlay->GetOverlayRenderTasks();
-  taskList.CreateTask();
-
-  mAdaptor = &adaptorImpl;
-  mAdaptor->AddObserver( *this );
-
-  // Can only create the detector when we know the Core has been instantiated.
-  mDragAndDropDetector = DragAndDropDetector::New();
-  mAdaptor->SetDragAndDropDetector( &GetImplementation( mDragAndDropDetector ) );
-
-  if( mOrientation )
-  {
-    mOrientation->SetAdaptor(adaptor);
-  }
-
-  if( mIndicator != NULL )
-  {
-    mIndicator->SetAdaptor(mAdaptor);
-  }
-}
-
-RenderSurface* Window::GetSurface()
-{
-  return mSurface;
-}
-
-void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode )
-{
-  DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "visible : %d\n", visibleMode );
-  DALI_ASSERT_DEBUG(mOverlay);
-
-  ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
-  DALI_ASSERT_DEBUG(x11Window);
-  Ecore_X_Window xWinId = x11Window->GetXWindow();
-
-  mIndicatorVisible = visibleMode;
-
-  if ( mIndicatorVisible == Dali::Window::VISIBLE )
-  {
-    // when the indicator is visible, set proper mode for indicator server according to bg mode
-    if ( mIndicatorOpacityMode == Dali::Window::OPAQUE )
-    {
-      ecore_x_e_illume_indicator_opacity_set(xWinId, ECORE_X_ILLUME_INDICATOR_OPAQUE);
-    }
-    else if ( mIndicatorOpacityMode == Dali::Window::TRANSLUCENT )
-    {
-      ecore_x_e_illume_indicator_opacity_set(xWinId, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT);
-    }
-#if defined(DALI_PROFILE_MOBILE)
-    else if ( mIndicatorOpacityMode == Dali::Window::TRANSPARENT )
-    {
-      ecore_x_e_illume_indicator_opacity_set(xWinId, ECORE_X_ILLUME_INDICATOR_OPAQUE);
-    }
-#endif
-  }
-  else
-  {
-    // when the indicator is not visible, set TRANSPARENT mode for indicator server
-    ecore_x_e_illume_indicator_opacity_set(xWinId, ECORE_X_ILLUME_INDICATOR_TRANSPARENT); // it means hidden indicator
-  }
-
-  DoShowIndicator( mIndicatorOrientation );
-}
-
-void Window::RotateIndicator(Dali::Window::WindowOrientation orientation)
-{
-  DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "Orientation: %d\n", orientation );
-
-  DoRotateIndicator( orientation );
-}
-
-void Window::SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacityMode )
-{
-  mIndicatorOpacityMode = opacityMode;
-
-  if( mIndicator != NULL )
-  {
-    mIndicator->SetOpacityMode( opacityMode );
-  }
-}
-
-void Window::SetClass(std::string name, std::string klass)
-{
-  // Get render surface's x11 window
-  if( mSurface )
-  {
-    ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
-    if( x11Window )
-    {
-      ecore_x_icccm_name_class_set( x11Window->GetXWindow(), name.c_str(), klass.c_str() );
-    }
-  }
-}
-
-Window::Window()
-: mSurface( NULL ),
-  mIndicatorVisible( Dali::Window::INVISIBLE ),
-  mIndicatorIsShown( false ),
-  mShowRotatedIndicatorOnClose( false ),
-  mStarted( false ),
-  mIsTransparent( false ),
-  mWMRotationAppSet( false ),
-  mEcoreEventHander( true ),
-  mIsFocusAcceptable( true ),
-  mVisible( true ),
-  mIconified( false ),
-  mOpaqueState( false ),
-  mResizeEnabled( true ),
-  mIndicator( NULL ),
-  mIndicatorOrientation( Dali::Window::PORTRAIT ),
-  mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
-  mIndicatorOpacityMode( Dali::Window::OPAQUE ),
-  mOverlay( NULL ),
-  mAdaptor( NULL ),
-  mType( Dali::Window::NORMAL ),
-  mEventHandler( NULL ),
-  mPreferredOrientation( Dali::Window::PORTRAIT ),
-  mSupportedAuxiliaryHints(),
-  mAuxiliaryHints(),
-  mIndicatorVisibilityChangedSignal(),
-  mFocusChangedSignal(),
-  mResizedSignal(),
-  mDeleteRequestSignal()
-{
-}
-
-Window::~Window()
-{
-  delete mEventHandler;
-
-  if( mIndicator )
-  {
-    mOverlay->Remove( mIndicator->GetActor() );
-    Dali::RenderTaskList taskList = mOverlay->GetOverlayRenderTasks();
-    Dali::RenderTask indicatorTask = taskList.GetTask(0);
-    mOverlay->GetOverlayRenderTasks().RemoveTask(indicatorTask);
-    mIndicator->Close();
-    delete mIndicator;
-  }
-
-  if( mAdaptor )
-  {
-    mAdaptor->RemoveObserver( *this );
-    mAdaptor->SetDragAndDropDetector( NULL );
-    mAdaptor = NULL;
-  }
-
-  delete mSurface;
-}
-
-void Window::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className)
-{
-  // create an X11 window by default
-  Any surface;
-  ECore::WindowRenderSurface* windowSurface = new ECore::WindowRenderSurface( positionSize, surface, name, className, mIsTransparent );
-  windowSurface->Map();
-
-  mSurface = windowSurface;
-
-  mOrientation = Orientation::New(this);
-
-  // create event handler for X11 window
-  mEventHandler = new EventHandler( this );
-}
-
-void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation )
-{
-  if( mIndicator == NULL )
-  {
-    if( mIndicatorVisible != Dali::Window::INVISIBLE )
-    {
-      mIndicator = new Indicator( mAdaptor, mIndicatorOrientation, this );
-      mIndicator->SetOpacityMode( mIndicatorOpacityMode );
-      Dali::Actor actor = mIndicator->GetActor();
-      SetIndicatorActorRotation();
-      mOverlay->Add(actor);
-    }
-    // else don't create a hidden indicator
-  }
-  else // Already have indicator
-  {
-    if( mIndicatorVisible == Dali::Window::VISIBLE )
-    {
-      // If we are resuming, and rotation has changed,
-      if( mIndicatorIsShown == false && mIndicatorOrientation != mNextIndicatorOrientation )
-      {
-        // then close current indicator and open new one
-        mShowRotatedIndicatorOnClose = true;
-        mIndicator->Close(); // May synchronously call IndicatorClosed() callback & 1 level of recursion
-        // Don't show actor - will contain indicator for old orientation.
-      }
-    }
-  }
-
-  // set indicator visible mode
-  if( mIndicator != NULL )
-  {
-    mIndicator->SetVisible( mIndicatorVisible );
-  }
-
-  bool show = (mIndicatorVisible != Dali::Window::INVISIBLE );
-  SetIndicatorProperties( show, lastOrientation );
-  mIndicatorIsShown = show;
-}
-
-void Window::DoRotateIndicator( Dali::Window::WindowOrientation orientation )
-{
-  if( mIndicatorIsShown )
-  {
-    mShowRotatedIndicatorOnClose = true;
-    mNextIndicatorOrientation = orientation;
-    mIndicator->Close(); // May synchronously call IndicatorClosed() callback
-  }
-  else
-  {
-    // Save orientation for when the indicator is next shown
-    mShowRotatedIndicatorOnClose = false;
-    mNextIndicatorOrientation = orientation;
-  }
-}
-
-void Window::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
-{
-  ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
-  if( x11Window )
-  {
-    Ecore_X_Window win = x11Window->GetXWindow();
-
-    int show_state = static_cast<int>( isShow );
-    ecore_x_window_prop_property_set( win,
-                                      ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
-                                      ECORE_X_ATOM_CARDINAL, 32, &show_state, 1);
-
-    if ( isShow )
-    {
-      ecore_x_e_illume_indicator_state_set(win, ECORE_X_ILLUME_INDICATOR_STATE_ON);
-    }
-    else
-    {
-      ecore_x_e_illume_indicator_state_set(win, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
-    }
-  }
-}
-
-void Window::IndicatorTypeChanged(Indicator::Type type)
-{
-  ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
-  if( x11Window )
-  {
-#ifndef DALI_PROFILE_UBUNTU
-    Ecore_X_Window win = x11Window->GetXWindow();
-    switch(type)
-    {
-      case Indicator::INDICATOR_TYPE_1:
-        ecore_x_e_illume_indicator_type_set( win, ECORE_X_ILLUME_INDICATOR_TYPE_1 );
-        break;
-
-      case Indicator::INDICATOR_TYPE_2:
-        ecore_x_e_illume_indicator_type_set( win, ECORE_X_ILLUME_INDICATOR_TYPE_2 );
-        break;
-
-      case Indicator::INDICATOR_TYPE_UNKNOWN:
-      default:
-        break;
-    }
-#endif // DALI_PROFILE_UBUNTU
-  }
-}
-
-void Window::IndicatorClosed( IndicatorInterface* indicator )
-{
-  DALI_LOG_TRACE_METHOD( gWindowLogFilter );
-
-  if( mShowRotatedIndicatorOnClose )
-  {
-    Dali::Window::WindowOrientation currentOrientation = mIndicatorOrientation;
-    mIndicator->Open(mNextIndicatorOrientation);
-    mIndicatorOrientation = mNextIndicatorOrientation;
-    SetIndicatorActorRotation();
-    DoShowIndicator(currentOrientation);
-  }
-}
-
-void Window::IndicatorVisibilityChanged(bool isVisible)
-{
-  mIndicatorVisibilityChangedSignal.Emit(isVisible);
-}
-
-void Window::SetIndicatorActorRotation()
-{
-  DALI_LOG_TRACE_METHOD( gWindowLogFilter );
-  DALI_ASSERT_DEBUG( mIndicator != NULL );
-
-  Dali::Actor actor = mIndicator->GetActor();
-  switch( mIndicatorOrientation )
-  {
-    case Dali::Window::PORTRAIT:
-      actor.SetParentOrigin( ParentOrigin::TOP_CENTER );
-      actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
-      actor.SetOrientation( Degree(0), Vector3::ZAXIS );
-      break;
-    case Dali::Window::PORTRAIT_INVERSE:
-      actor.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
-      actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
-      actor.SetOrientation( Degree(180), Vector3::ZAXIS );
-      break;
-    case Dali::Window::LANDSCAPE:
-      actor.SetParentOrigin( ParentOrigin::CENTER_LEFT );
-      actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
-      actor.SetOrientation( Degree(270), Vector3::ZAXIS );
-      break;
-    case Dali::Window::LANDSCAPE_INVERSE:
-      actor.SetParentOrigin( ParentOrigin::CENTER_RIGHT );
-      actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
-      actor.SetOrientation( Degree(90), Vector3::ZAXIS );
-      break;
-  }
-}
-
-void Window::Raise()
-{
-  ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
-  if( x11Window )
-  {
-    Ecore_X_Window win = x11Window->GetXWindow();
-    ecore_x_window_raise(win);
-  }
-}
-
-void Window::Lower()
-{
-  ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
-  if( x11Window )
-  {
-    Ecore_X_Window win = x11Window->GetXWindow();
-    ecore_x_window_lower(win);
-  }
-}
-
-void Window::Activate()
-{
-  ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
-  if( x11Window )
-  {
-    Ecore_X_Window win = x11Window->GetXWindow();
-    ecore_x_netwm_client_active_request(ecore_x_window_root_get(win), win, 1 /* request type, 1:application, 2:pager */, 0);
-  }
-}
-
-Dali::DragAndDropDetector Window::GetDragAndDropDetector() const
-{
-  return mDragAndDropDetector;
-}
-
-Dali::Any Window::GetNativeHandle() const
-{
-  if(mEventHandler)
-  {
-    return mEventHandler->mEcoreWindow;
-  }
-  else
-  {
-    return Dali::Any();
-  }
-}
-
-void Window::OnStart()
-{
-  ShowIndicator( mIndicatorVisible );
-}
-
-void Window::OnPause()
-{
-}
-
-void Window::OnResume()
-{
-  // resume indicator status
-  if( mIndicator != NULL )
-  {
-    // Restore own indicator opacity
-    // Send opacity mode to indicator service when app resumed
-    mIndicator->SetOpacityMode( mIndicatorOpacityMode );
-  }
-}
-
-void Window::OnStop()
-{
-  if( mIndicator )
-  {
-    mIndicator->Close();
-  }
-
-  delete mIndicator;
-  mIndicator = NULL;
-}
-
-void Window::OnDestroy()
-{
-  mAdaptor = NULL;
-}
-
-void Window::AddAvailableOrientation(Dali::Window::WindowOrientation orientation)
-{
-  bool found = false;
-
-  for( std::size_t i=0; i<mAvailableOrientations.size(); i++ )
-  {
-    if(mAvailableOrientations[i] == orientation)
-    {
-      found = true;
-      break;
-    }
-  }
-
-  if( ! found )
-  {
-    mAvailableOrientations.push_back(orientation);
-    SetAvailableOrientations( mAvailableOrientations );
-  }
-}
-
-void Window::RemoveAvailableOrientation(Dali::Window::WindowOrientation orientation)
-{
-  for( std::vector<Dali::Window::WindowOrientation>::iterator iter = mAvailableOrientations.begin();
-       iter != mAvailableOrientations.end(); ++iter )
-  {
-    if( *iter == orientation )
-    {
-      mAvailableOrientations.erase( iter );
-      break;
-    }
-  }
-  SetAvailableOrientations( mAvailableOrientations );
-}
-
-void Window::SetAvailableOrientations(const std::vector<Dali::Window::WindowOrientation>& orientations)
-{
-  DALI_ASSERT_ALWAYS( mAvailableOrientations.size() <= 4 && "Incorrect number of available orientations" );
-
-  mAvailableOrientations = orientations;
-  ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
-  if( x11Window )
-  {
-#ifndef DALI_PROFILE_UBUNTU
-    Ecore_X_Window ecoreWindow = x11Window->GetXWindow();
-    if( ! mWMRotationAppSet )
-    {
-      mWMRotationAppSet = true;
-      ecore_x_e_window_rotation_app_set(ecoreWindow, EINA_TRUE);
-    }
-
-    int rotations[4];
-    for( std::size_t i=0; i<mAvailableOrientations.size(); i++ )
-    {
-      rotations[i] = static_cast<int>(mAvailableOrientations[i]);
-    }
-    ecore_x_e_window_rotation_available_rotations_set(ecoreWindow, rotations, mAvailableOrientations.size() );
-#endif // DALI_PROFILE_UBUNTU
-  }
-}
-
-const std::vector<Dali::Window::WindowOrientation>& Window::GetAvailableOrientations()
-{
-  return mAvailableOrientations;
-}
-
-void Window::SetPreferredOrientation(Dali::Window::WindowOrientation orientation)
-{
-  mPreferredOrientation = orientation;
-
-  ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
-  if( x11Window )
-  {
-#ifndef DALI_PROFILE_UBUNTU
-    Ecore_X_Window ecoreWindow = x11Window->GetXWindow();
-
-    if( ! mWMRotationAppSet )
-    {
-      mWMRotationAppSet = true;
-      ecore_x_e_window_rotation_app_set(ecoreWindow, EINA_TRUE);
-    }
-
-    ecore_x_e_window_rotation_preferred_rotation_set(ecoreWindow, orientation);
-#endif // DALI_PROFILE_UBUNTU
-  }
-}
-
-Dali::Window::WindowOrientation Window::GetPreferredOrientation()
-{
-  return mPreferredOrientation;
-}
-
-void Window::SetAcceptFocus( bool accept )
-{
-  mIsFocusAcceptable = accept;
-}
-
-bool Window::IsFocusAcceptable() const
-{
-  return mIsFocusAcceptable;
-}
-
-void Window::Show()
-{
-  ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
-  if( x11Window )
-  {
-    Ecore_X_Window win = x11Window->GetXWindow();
-    ecore_x_window_show( win );
-
-    // Need an update request
-    if( mAdaptor )
-    {
-      mAdaptor->RequestUpdateOnce();
-    }
-  }
-}
-
-void Window::Hide()
-{
-  ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
-  if( x11Window )
-  {
-    Ecore_X_Window win = x11Window->GetXWindow();
-    ecore_x_window_hide( win );
-  }
-}
-
-bool Window::IsVisible() const
-{
-  bool visible = false;
-
-  ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
-  if( x11Window )
-  {
-    Ecore_X_Window win = x11Window->GetXWindow();
-    visible = static_cast< bool >( ecore_x_window_visible_get( win ) );
-  }
-  return visible;
-}
-
-void Window::RotationDone( int orientation, int width, int height )
-{
-  // Tell window manager we're done
-  ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
-  if( x11Window )
-  {
-#ifndef DALI_PROFILE_UBUNTU
-    Ecore_X_Window ecoreWindow = x11Window->GetXWindow();
-    Ecore_X_Window root = ecore_x_window_root_get(ecoreWindow);
-
-    /**
-     * send rotation done message to wm, even if window is already rotated.
-     * that's why wm must be wait for comming rotation done message
-     * after sending rotation request.
-     */
-    ecore_x_e_window_rotation_change_done_send(root, ecoreWindow, orientation, width, height);
-
-    /**
-     * set rotate window property
-     */
-    int angles[2] = { orientation, orientation };
-    ecore_x_window_prop_property_set( ecoreWindow,
-                                     ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
-                                     ECORE_X_ATOM_CARDINAL, 32, &angles, 2 );
-
-    mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( width, height ) );
-
-    // Emit signal
-    mResizedSignal.Emit( Dali::Window::WindowSize( width, height ) );
-
-    mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( width, height ) );
-#endif // DALI_PROFILE_UBUNTU
-  }
-}
-
-void Window::SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode )
-{
-  mIndicatorVisible = mode;
-}
-
-unsigned int Window::GetSupportedAuxiliaryHintCount() const
-{
-  return 0;
-}
-
-std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
-{
-  return std::string();
-}
-
-unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
-{
-  return -1;
-}
-
-bool Window::RemoveAuxiliaryHint( unsigned int id )
-{
-  return false;
-}
-
-bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
-{
-  return false;
-}
-
-std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
-{
-  return std::string();
-}
-
-unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
-{
-  return -1;
-}
-
-void Window::SetInputRegion( const Rect< int >& inputRegion )
-{
-}
-
-void Window::SetType( Dali::Window::Type type )
-{
-  mType = type;
-}
-
-Dali::Window::Type Window::GetType() const
-{
-  return mType;
-}
-
-bool Window::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
-{
-  return false;
-}
-
-Dali::Window::NotificationLevel::Type Window::GetNotificationLevel() const
-{
-  return Dali::Window::NotificationLevel::NONE;
-}
-
-void Window::SetOpaqueState( bool opaque )
-{
-  mOpaqueState = opaque;
-}
-
-bool Window::IsOpaqueState() const
-{
-  return mOpaqueState;
-}
-
-bool Window::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
-{
-  return false;
-}
-
-Dali::Window::ScreenOffMode::Type Window::GetScreenOffMode() const
-{
-  return Dali::Window::ScreenOffMode::TIMEOUT;
-}
-
-bool Window::SetBrightness( int brightness )
-{
-  return false;
-}
-
-int Window::GetBrightness() const
-{
-  return 0;
-}
-
-void Window::SetSize( Dali::Window::WindowSize size )
-{
-  PositionSize positionSize = mSurface->GetPositionSize();
-
-  if( positionSize.width != size.GetWidth() || positionSize.height != size.GetHeight() )
-  {
-    positionSize.width = size.GetWidth();
-    positionSize.height = size.GetHeight();
-
-    mSurface->MoveResize( positionSize );
-
-    mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
-
-    // Emit signal
-    mResizedSignal.Emit( Dali::Window::WindowSize( positionSize.width, positionSize.height ) );
-
-    mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
-  }
-}
-
-Dali::Window::WindowSize Window::GetSize() const
-{
-  PositionSize positionSize = mSurface->GetPositionSize();
-
-  return Dali::Window::WindowSize( positionSize.width, positionSize.height );
-}
-
-void Window::SetPosition( Dali::Window::WindowPosition position )
-{
-  PositionSize positionSize = mSurface->GetPositionSize();
-
-  if( positionSize.x != position.GetX() || positionSize.y != position.GetY() )
-  {
-    positionSize.x = position.GetX();
-    positionSize.y = position.GetY();
-
-    mSurface->MoveResize( positionSize );
-  }
-}
-
-Dali::Window::WindowPosition Window::GetPosition() const
-{
-  PositionSize positionSize = mSurface->GetPositionSize();
-
-  return Dali::Window::WindowPosition( positionSize.x, positionSize.y );
-}
-
-void Window::SetTransparency( bool transparent )
-{
-}
-
-} // Adaptor
-
-} // Internal
-
-} // Dali
-
-#pragma GCC diagnostic pop
index 8d075e6..1b22155 100644 (file)
@@ -26,7 +26,7 @@
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
-#include <dali/integration-api/x11/ecore-x-types.h>
+#include <dali/internal/window-system/ubuntu-x11/ecore-x-types.h>
 
 namespace Dali
 {
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/window-system/ubuntu-x11/window-render-surface-x.h>
+#include <dali/internal/window-system/ubuntu-x11/window-render-surface-ecore-x.h>
 
 // EXTERNAL INCLUDES
 #include <X11/Xatom.h>
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
-
-#include <dali/integration-api/x11/ecore-x-types.h>
+#include <dali/internal/window-system/ubuntu-x11/ecore-x-types.h>
 #include <dali/internal/system/common/trigger-event.h>
 #include <dali/internal/graphics/gles20/egl-implementation.h>
 #include <dali/internal/window-system/common/display-connection.h>
 
 namespace Dali
 {
-
-#if defined(DEBUG_ENABLED)
-extern Debug::Filter* gRenderSurfaceLogFilter;
-#endif
-
-namespace ECore
+namespace Internal
+{
+namespace Adaptor
 {
 
 namespace
@@ -51,23 +47,30 @@ namespace
 
 const int MINIMUM_DIMENSION_CHANGE( 1 ); ///< Minimum change for window to be considered to have moved
 
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gWindowRenderSurfaceLogFilter = Debug::Filter::New(Debug::Verbose, false, "LOG_WINDOW_RENDER_SURFACE_ECORE_X");
+#endif
+
 } // unnamed namespace
 
-WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize,
+WindowRenderSurfaceEcoreX::WindowRenderSurfaceEcoreX( Dali::PositionSize positionSize,
                                           Any surface,
                                           const std::string& name,
                                           const std::string& className,
                                           bool isTransparent)
-: EcoreXRenderSurface( positionSize, surface, name, isTransparent ),
+: mTitle( name ),
+  mClassName( className ),
+  mPosition( positionSize ),
+  mColorDepth( isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24 ),
   mX11Window( 0 ),
-  mNeedToApproveDeiconify(false),
-  mClassName(className)
+  mOwnSurface( false ),
+  mNeedToApproveDeiconify( false )
 {
-  DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "Creating Window\n" );
-  Init( surface );
+  DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "Creating Window\n" );
+  Initialize( surface );
 }
 
-WindowRenderSurface::~WindowRenderSurface()
+WindowRenderSurfaceEcoreX::~WindowRenderSurfaceEcoreX()
 {
   if( mOwnSurface )
   {
@@ -75,40 +78,74 @@ WindowRenderSurface::~WindowRenderSurface()
   }
 }
 
-Ecore_X_Drawable WindowRenderSurface::GetDrawable()
+void WindowRenderSurfaceEcoreX::Initialize( Any surface )
 {
-  // already an e-core type
-  return static_cast< Ecore_X_Drawable >( mX11Window );
+  // see if there is a surface in Any surface
+  unsigned int surfaceId = GetSurfaceId( surface );
+
+  // if the surface is empty, create a new one.
+  if( surfaceId == 0 )
+  {
+    // we own the surface about to created
+    mOwnSurface = true;
+    CreateRenderable();
+  }
+  else
+  {
+    // XLib should already be initialized so no point in calling XInitThreads
+    UseExistingRenderable( surfaceId );
+  }
 }
 
-Any WindowRenderSurface::GetSurface()
+Ecore_X_Window WindowRenderSurfaceEcoreX::GetXWindow()
 {
-  // already an e-core type
-  return Any( mX11Window );
+  return mX11Window;
 }
 
-Ecore_X_Window WindowRenderSurface::GetXWindow()
+void WindowRenderSurfaceEcoreX::RequestToApproveDeiconify()
+{
+  mNeedToApproveDeiconify = true;
+}
+
+Any WindowRenderSurfaceEcoreX::GetWindow()
 {
   return mX11Window;
 }
 
-void WindowRenderSurface::RequestToApproveDeiconify()
+void WindowRenderSurfaceEcoreX::Map()
+{
+  ecore_x_window_show( mX11Window );
+}
+
+void WindowRenderSurfaceEcoreX::SetRenderNotification( TriggerEventInterface* renderNotification )
 {
-  mNeedToApproveDeiconify = true;
 }
 
-void WindowRenderSurface::InitializeEgl( EglInterface& eglIf )
+void WindowRenderSurfaceEcoreX::SetTransparency( bool transparent )
 {
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
+}
+
+void WindowRenderSurfaceEcoreX::RequestRotation( int angle, int width, int height )
+{
+}
+
+PositionSize WindowRenderSurfaceEcoreX::GetPositionSize() const
+{
+  return mPosition;
+}
+
+void WindowRenderSurfaceEcoreX::InitializeEgl( EglInterface& eglIf )
+{
+  DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter );
 
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
 
   eglImpl.ChooseConfig(true, mColorDepth);
 }
 
-void WindowRenderSurface::CreateEglSurface( EglInterface& eglIf )
+void WindowRenderSurfaceEcoreX::CreateEglSurface( EglInterface& eglIf )
 {
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
+  DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter );
 
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
 
@@ -118,17 +155,17 @@ void WindowRenderSurface::CreateEglSurface( EglInterface& eglIf )
   eglImpl.CreateSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( window ), mColorDepth );
 }
 
-void WindowRenderSurface::DestroyEglSurface( EglInterface& eglIf )
+void WindowRenderSurfaceEcoreX::DestroyEglSurface( EglInterface& eglIf )
 {
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
+  DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter );
 
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
   eglImpl.DestroySurface();
 }
 
-bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& egl )
+bool WindowRenderSurfaceEcoreX::ReplaceEGLSurface( EglInterface& egl )
 {
-  DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
+  DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter );
 
   // need to create X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit
   XWindow window( mX11Window );
@@ -137,7 +174,7 @@ bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& egl )
   return eglImpl.ReplaceSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( window ) );
 }
 
-void WindowRenderSurface::MoveResize( Dali::PositionSize positionSize )
+void WindowRenderSurfaceEcoreX::MoveResize( Dali::PositionSize positionSize )
 {
   bool needToMove = false;
   bool needToResize = false;
@@ -171,25 +208,30 @@ void WindowRenderSurface::MoveResize( Dali::PositionSize positionSize )
     ecore_x_window_resize(mX11Window, positionSize.width, positionSize.height);
     mPosition = positionSize;
   }
-
 }
 
-void WindowRenderSurface::Map()
+void WindowRenderSurfaceEcoreX::SetViewMode( ViewMode viewMode )
 {
-  ecore_x_window_show(mX11Window);
+  Ecore_X_Atom viewModeAtom( ecore_x_atom_get( "_E_COMP_3D_APP_WIN" ) );
+
+  if( viewModeAtom != None )
+  {
+    unsigned int value( static_cast<unsigned int>( viewMode ) );
+    ecore_x_window_prop_card32_set( mX11Window, viewModeAtom, &value, 1 );
+  }
 }
 
-void WindowRenderSurface::StartRender()
+void WindowRenderSurfaceEcoreX::StartRender()
 {
 }
 
-bool WindowRenderSurface::PreRender( EglInterface&, Integration::GlAbstraction&, bool )
+bool WindowRenderSurfaceEcoreX::PreRender( EglInterface&, Integration::GlAbstraction&, bool )
 {
   // nothing to do for windows
   return true;
 }
 
-void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface )
+void WindowRenderSurfaceEcoreX::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, Dali::DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface )
 {
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
   eglImpl.SwapBuffers();
@@ -225,22 +267,26 @@ void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract
   }
 }
 
-void WindowRenderSurface::StopRender()
+void WindowRenderSurfaceEcoreX::StopRender()
 {
 }
 
-void WindowRenderSurface::SetViewMode( ViewMode viewMode )
+void WindowRenderSurfaceEcoreX::SetThreadSynchronization( ThreadSynchronizationInterface& /* threadSynchronization */ )
 {
-  Ecore_X_Atom viewModeAtom( ecore_x_atom_get( "_E_COMP_3D_APP_WIN" ) );
+  // Nothing to do.
+}
 
-  if( viewModeAtom != None )
-  {
-    unsigned int value( static_cast<unsigned int>( viewMode ) );
-    ecore_x_window_prop_card32_set( mX11Window, viewModeAtom, &value, 1 );
-  }
+void WindowRenderSurfaceEcoreX::ReleaseLock()
+{
+  // Nothing to do.
+}
+
+RenderSurface::Type WindowRenderSurfaceEcoreX::GetSurfaceType()
+{
+  return WINDOW_RENDER_SURFACE;
 }
 
-void WindowRenderSurface::CreateXRenderable()
+void WindowRenderSurfaceEcoreX::CreateRenderable()
 {
    // if width or height are zero, go full screen.
   if ( (mPosition.width == 0) || (mPosition.height == 0) )
@@ -293,21 +339,36 @@ void WindowRenderSurface::CreateXRenderable()
   ecore_x_sync();
 }
 
-void WindowRenderSurface::UseExistingRenderable( unsigned int surfaceId )
+void WindowRenderSurfaceEcoreX::UseExistingRenderable( unsigned int surfaceId )
 {
   mX11Window = static_cast< Ecore_X_Window >( surfaceId );
 }
 
-void WindowRenderSurface::SetThreadSynchronization( ThreadSynchronizationInterface& /* threadSynchronization */ )
+unsigned int WindowRenderSurfaceEcoreX::GetSurfaceId( Any surface ) const
 {
-  // Nothing to do.
-}
+  unsigned int surfaceId = 0;
 
-void WindowRenderSurface::ReleaseLock()
-{
-  // Nothing to do.
+  if ( surface.Empty() == false )
+  {
+    // check we have a valid type
+    DALI_ASSERT_ALWAYS( ( (surface.GetType() == typeid (XWindow) ) ||
+                          (surface.GetType() == typeid (Ecore_X_Window) ) )
+                        && "Surface type is invalid" );
+
+    if ( surface.GetType() == typeid (Ecore_X_Window) )
+    {
+      surfaceId = AnyCast<Ecore_X_Window>( surface );
+    }
+    else
+    {
+      surfaceId = AnyCast<XWindow>( surface );
+    }
+  }
+  return surfaceId;
 }
 
-} // namespace ECore
+} // namespace Adaptor
+
+} // namespace internal
 
 } // namespace Dali
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_ECORE_X_WINDOW_RENDER_SURFACE_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
  */
 
 // INTERNAL INCLUDES
-#include <dali/integration-api/x11/ecore-x-render-surface.h>
+#include <dali/integration-api/egl-interface.h>
+#include <dali/internal/window-system/common/window-render-surface.h>
+#include <dali/internal/window-system/ubuntu-x11/ecore-x-types.h>
+
+// EXTERNAL INCLUDES
+#include <Ecore_X.h>
 
 namespace Dali
 {
-
-namespace ECore
+namespace Internal
+{
+namespace Adaptor
 {
 
 /**
- * @copydoc Dali::ECore::EcoreXRenderSurface.
- * Window specialization.
+ * Ecore X11 Window implementation of render surface.
  */
-class WindowRenderSurface : public EcoreXRenderSurface
+class WindowRenderSurfaceEcoreX : public WindowRenderSurface
 {
 public:
 
@@ -43,23 +48,24 @@ public:
     * @param [in] className optional class name of the surface passed in
     * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
     */
-  WindowRenderSurface( Dali::PositionSize positionSize,
+  WindowRenderSurfaceEcoreX( Dali::PositionSize positionSize,
                        Any surface,
                        const std::string& name,
                        const std::string& className,
                        bool isTransparent = false );
 
   /**
-   * @copydoc Dali::ECore::EcoreXRenderSurface::~EcoreXRenderSurface
+   * @brief Destructor
    */
-  virtual ~WindowRenderSurface();
+  virtual ~WindowRenderSurfaceEcoreX();
 
 public: // API
 
   /**
-   * @copydoc Dali::RenderSurface::GetDrawable()
+   * @brief Get window handle
+   * @return the Ecore X window handle
    */
-  virtual Ecore_X_Drawable GetDrawable();
+  Ecore_X_Window GetXWindow();
 
   /**
    * Request to approve deiconify operation
@@ -67,24 +73,41 @@ public: // API
    */
   void RequestToApproveDeiconify();
 
+public: // from WindowRenderSurface
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::GetWindow()
+   */
+  virtual Any GetWindow() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::Map()
+   */
+  virtual void Map() override;
+
   /**
-   * Map window
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::SetRenderNotification()
    */
-  virtual void Map();
+  virtual void SetRenderNotification( TriggerEventInterface* renderNotification ) override;
 
   /**
-   * @copydoc Dali::ECore::EcoreXRenderSurface::GetSurface()
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::SetTransparency()
    */
-  virtual Any GetSurface();
+  virtual void SetTransparency( bool transparent ) override;
 
   /**
-   * @copydoc Dali::ECore::EcoreXRenderSurface::GetXWindow()
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::RequestRotation()
    */
-  virtual Ecore_X_Window GetXWindow();
+  virtual void RequestRotation( int angle, int width, int height ) override;
 
 public: // from Dali::RenderSurface
 
   /**
+   * @copydoc Dali::RenderSurface::GetPositionSize()
+   */
+  virtual PositionSize GetPositionSize() const;
+
+  /**
    * @copydoc Dali::RenderSurface::InitializeEgl()
    */
   virtual void InitializeEgl( EglInterface& egl );
@@ -144,27 +167,52 @@ public: // from Dali::RenderSurface
    */
   virtual void ReleaseLock();
 
-protected:
+  /**
+   * @copydoc Dali::RenderSurface::GetSurfaceType()
+   */
+  virtual RenderSurface::Type GetSurfaceType();
+
+private: // from WindowRenderSurface
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::Initialize()
+   */
+  void Initialize( Any surface ) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::CreateRenderable()
+   */
+  void CreateRenderable() override;
 
   /**
-   * Create XWindow
+   * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::UseExistingRenderable()
    */
-  virtual void CreateXRenderable();
+  void UseExistingRenderable( unsigned int surfaceId ) override;
+
+private:
 
   /**
-   * @copydoc Dali::Internal::Adaptor::ECore::EcoreXRenderSurface::UseExistingRenderable
+   * Get the surface id if the surface parameter is not empty
+   * @param surface Any containing a surface id, or can be empty
+   * @return surface id, or zero if surface is empty
    */
-  virtual void UseExistingRenderable( unsigned int surfaceId );
+  unsigned int GetSurfaceId( Any surface ) const;
 
 private: // Data
 
-  Ecore_X_Window   mX11Window; ///< X-Window
+  std::string      mTitle;                  ///< Title of window which shows from "xinfo -topvwins" command
+  std::string      mClassName;              ///< The class name of the window
+  PositionSize     mPosition;               ///< Position
+  ColorDepth       mColorDepth;             ///< Color depth of surface (32 bit or 24 bit)
+  Ecore_X_Window   mX11Window;              ///< X-Window
+  bool             mOwnSurface;             ///< Whether we own the surface (responsible for deleting it)
   bool             mNeedToApproveDeiconify; ///< Whether need to send ECORE_X_ATOM_E_DEICONIFY_APPROVE event
-  std::string      mClassName;          ///< The class name of the window
 
-}; // class WindowRenderSurface
+}; // class WindowRenderSurfaceEcoreX
+
+} // namespace Adaptor
 
-} // namespace ECore
+} // namespace internal
 
 } // namespace Dali