Revert "[Tizen] ecore-wl2: add zxdg_shell define"
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / ecore-wl / window-render-surface-ecore-wl.h
1 #ifndef __DALI_INTERNAL_ECORE_WL_WINDOW_RENDER_SURFACE_H__
2 #define __DALI_INTERNAL_ECORE_WL_WINDOW_RENDER_SURFACE_H__
3
4 /*
5  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <wayland-egl.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/integration-api/wayland/ecore-wl/ecore-wl-render-surface.h>
26 #include <dali/integration-api/thread-synchronization-interface.h>
27
28 namespace Dali
29 {
30
31 namespace ECore
32 {
33
34 /**
35  * @copydoc Dali::ECore::EcoreWlRenderSurface.
36  * Window specialization.
37  */
38 class WindowRenderSurface : public EcoreWlRenderSurface
39 {
40 public:
41
42   /**
43     * Uses an Wayland surface to render to.
44     * @param [in] positionSize the position and size of the surface
45     * @param [in] surface can be a Wayland-window or Wayland-pixmap (type must be unsigned int).
46     * @param [in] name optional name of surface passed in
47     * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
48     */
49   WindowRenderSurface( Dali::PositionSize positionSize,
50                        Any surface,
51                        const std::string& name,
52                        bool isTransparent = false );
53
54   /**
55    * @copydoc Dali::ECore::EcoreWlRenderSurface::~EcoreWlRenderSurface
56    */
57   virtual ~WindowRenderSurface();
58
59 public: // API
60
61   /**
62    * @copydoc Dali::RenderSurface::GetDrawable()
63    */
64   virtual Ecore_Wl_Window* GetDrawable();
65
66   /**
67    * Map window
68    */
69   virtual void Map();
70
71   /**
72    * @copydoc Dali::ECore::EcoreWlRenderSurface::GetSurface()
73    */
74   virtual Any GetSurface();
75
76   /**
77    * @copydoc Dali::ECore::EcoreWlRenderSurface::GetWlWindow()
78    */
79   virtual Ecore_Wl_Window* GetWlWindow();
80
81   /**
82    * Request surface rotation
83    * @param[in] angle A new angle of the surface
84    * @param[in] width A new width of the surface
85    * @param[in] height A new height of the surface
86    */
87   void RequestRotation( int angle, int width, int height );
88
89   /**
90    * Notify output is transformed.
91    */
92   void OutputTransformed();
93
94   /**
95    * @brief Sets whether the surface is transparent or not.
96    *
97    * @param[in] transparent Whether the surface is transparent
98    */
99   void SetTransparency( bool transparent );
100
101 public: // from Dali::RenderSurface
102
103   /**
104    * @copydoc Dali::RenderSurface::InitializeEgl()
105    */
106   virtual void InitializeEgl( EglInterface& egl );
107
108   /**
109    * @copydoc Dali::RenderSurface::CreateEglSurface()
110    */
111   virtual void CreateEglSurface( EglInterface& egl );
112
113   /**
114    * @copydoc Dali::RenderSurface::DestroyEglSurface()
115    */
116   virtual void DestroyEglSurface( EglInterface& egl );
117
118   /**
119    * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
120    */
121   virtual bool ReplaceEGLSurface( EglInterface& egl );
122
123   /**
124    * @copydoc Dali::RenderSurface::MoveResize()
125    */
126   virtual void MoveResize( Dali::PositionSize positionSize);
127
128   /**
129    * @copydoc Dali::RenderSurface::SetViewMode()
130    */
131   void SetViewMode( ViewMode viewMode );
132
133   /**
134    * @copydoc Dali::RenderSurface::StartRender()
135    */
136   virtual void StartRender();
137
138   /**
139    * @copydoc Dali::RenderSurface::PreRender()
140    */
141   virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface );
142
143   /**
144    * @copydoc Dali::RenderSurface::PostRender()
145    */
146   virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface );
147
148   /**
149    * @copydoc Dali::RenderSurface::StopRender()
150    */
151   virtual void StopRender();
152
153   /**
154    * @copydoc Dali::RenderSurface::SetThreadSynchronization
155    */
156   virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization );
157
158   /**
159    * @copydoc Dali::RenderSurface::ReleaseLock()
160    */
161   virtual void ReleaseLock();
162
163 protected:
164
165   /**
166    * Create WlWindow
167    */
168   virtual void CreateWlRenderable();
169
170   /**
171    * @copydoc Dali::Internal::Adaptor::ECore::EcoreWlRenderSurface::UseExistingRenderable
172    */
173   virtual void UseExistingRenderable( unsigned int surfaceId );
174
175 private:
176
177   /**
178    * Used as the callback for the rotation-trigger.
179    */
180   void ProcessRotationRequest();
181
182 private: // Data
183
184   Ecore_Wl_Window*                mWlWindow;  ///< Wayland-Window
185   wl_surface*                     mWlSurface;
186   wl_egl_window*                  mEglWindow;
187   ThreadSynchronizationInterface* mThreadSynchronization;
188   TriggerEventInterface*          mRotationTrigger;
189   int                             mRotationAngle;
190   int                             mScreenRotationAngle;
191   bool                            mRotationSupported;
192   bool                            mRotationFinished;
193   bool                            mScreenRotationFinished;
194   bool                            mResizeFinished;
195
196 }; // class WindowRenderSurface
197
198 } // namespace ECore
199
200 } // namespace Dali
201
202 #endif // __DALI_INTERNAL_ECORE_WL_WINDOW_RENDER_SURFACE_H__