1 #ifndef __DALI_ECORE_WL_RENDER_SURFACE_H__
2 #define __DALI_ECORE_WL_RENDER_SURFACE_H__
5 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <Ecore_Wayland.h>
23 #include <dali/public-api/common/dali-common.h>
26 #include <dali/devel-api/adaptor-framework/render-surface.h>
27 #ifdef DALI_ADAPTOR_COMPILATION // full path doesn't exist until adaptor is installed so we have to use relative
28 #include <dali/integration-api/egl-interface.h>
30 #include <dali/integration-api/adaptors/egl-interface.h>
36 class TriggerEventInterface;
42 * Ecore Wayland implementation of render surface.
43 * @todo change namespace to ECore_Wayland as the class
44 * is no longer pure Wayland.
46 class DALI_IMPORT_API EcoreWlRenderSurface : public Dali::RenderSurface
50 * Uses an Wayland surface to render to.
51 * @param [in] positionSize the position and size of the surface
52 * @param [in] surface can be a X-window or X-pixmap (type must be unsigned int).
53 * @param [in] name optional name of surface passed in
54 * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
56 EcoreWlRenderSurface(Dali::PositionSize positionSize,
58 const std::string& name,
59 bool isTransparent = false);
63 * Will delete the display, if it has ownership.
64 * Will delete the window/pixmap if it has owner ship
66 virtual ~EcoreWlRenderSurface();
70 * Second stage construction
71 * Creates the surface (window, pixmap or native buffer)
73 void Init( Any surface );
78 * @brief Sets the render notification trigger to call when render thread is completed a frame
80 * @param renderNotification to use
82 void SetRenderNotification(TriggerEventInterface* renderNotification);
85 * @brief Get window handle
87 * @return the Ecore X window handle
89 virtual Ecore_Wl_Window* GetWlWindow();
92 * Get the surface as an Ecore_Wl_Window
94 virtual Ecore_Wl_Window* GetDrawable();
96 public: // from Dali::RenderSurface
99 * @copydoc Dali::RenderSurface::GetPositionSize()
101 virtual PositionSize GetPositionSize() const;
104 * @copydoc Dali::RenderSurface::InitializeEgl()
106 virtual void InitializeEgl( EglInterface& egl ) = 0;
109 * @copydoc Dali::RenderSurface::CreateEglSurface()
111 virtual void CreateEglSurface( EglInterface& egl ) = 0;
114 * @copydoc Dali::RenderSurface::DestroyEglSurface()
116 virtual void DestroyEglSurface( EglInterface& egl ) = 0;
119 * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
121 virtual bool ReplaceEGLSurface( EglInterface& egl ) = 0;
124 * @copydoc Dali::RenderSurface::MoveResize()
126 virtual void MoveResize( Dali::PositionSize positionSize);
129 * @copydoc Dali::RenderSurface::SetViewMode()
131 void SetViewMode( ViewMode viewMode );
134 * @copydoc Dali::RenderSurface::StartRender()
136 virtual void StartRender() = 0;
139 * @copydoc Dali::RenderSurface::PreRender()
141 virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface ) = 0;
144 * @copydoc Dali::RenderSurface::PostRender()
146 virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface ) = 0;
149 * @copydoc Dali::RenderSurface::ReleaseLock()
151 virtual void ReleaseLock() = 0;
154 * @copydoc Dali::RenderSurface::GetSurfaceType()
156 virtual RenderSurface::Type GetSurfaceType();
161 * Get the surface id if the surface parameter is not empty
162 * @param surface Any containing a surface id, or can be empty
163 * @return surface id, or zero if surface is empty
165 unsigned int GetSurfaceId( Any surface ) const;
172 virtual void CreateWlRenderable() = 0;
175 * Use an existing render surface
176 * @param surfaceId the id of the surface
178 virtual void UseExistingRenderable( unsigned int surfaceId ) = 0;
182 PositionSize mPositionSize; ///< Position
183 std::string mTitle; ///< Title of window which shows from "xinfo -topvwins" command
184 TriggerEventInterface* mRenderNotification; ///< Render notification trigger
185 ColorDepth mColorDepth; ///< Color depth of surface (32 bit or 24 bit)
186 bool mOwnSurface; ///< Whether we own the surface (responsible for deleting it)
193 #endif // __DALI_ECORE_WL_RENDER_SURFACE_H__