Merge "Implemented the Handle assignment operators properly" into tizen
[platform/core/uifw/dali-adaptor.git] / adaptors / wayland / window-render-surface.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) 2014 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 // INTERNAL INCLUDES
22 #include <ecore-wl-render-surface.h>
23 #include <wayland-egl.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 namespace Adaptor
32 {
33
34 namespace ECore
35 {
36
37 /**
38  * @copydoc Dali::Internal::Adaptor::ECore::RenderSurface.
39  * Window specialization.
40  */
41 class WindowRenderSurface : public RenderSurface
42 {
43 public:
44
45   /**
46     * Uses an Wayland surface to render to.
47     * @param [in] positionSize the position and size of the surface
48     * @param [in] surface can be a Wayland-window or Wayland-pixmap (type must be unsigned int).
49     * @param [in] display connection to Wayland-server if the surface is a X window or pixmap (type must be void * to X display struct)
50     * @param [in] name optional name of surface passed in
51     * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
52     */
53   WindowRenderSurface( Dali::PositionSize positionSize,
54                        Any surface,
55                        Any display,
56                        const std::string& name,
57                        bool isTransparent = false );
58
59   /**
60    * @copydoc Dali::Internal::Adaptor::ECore::RenderSurface::~RenderSurface
61    */
62   virtual ~WindowRenderSurface();
63
64 public: // API
65
66   /**
67    * @copydoc Dali::RenderSurface::GetDrawable()
68    */
69   virtual Ecore_Wl_Window* GetDrawable();
70
71   /**
72    * Request to approve deiconify operation
73    * If it is requested, it will send ECORE_X_ATOM_E_DEICONIFY_APPROVE event to window manager after rendering
74    */
75   void RequestToApproveDeiconify();
76
77 public: // from Dali::RenderSurface
78
79   /**
80    * @copydoc Dali::RenderSurface::GetType()
81    */
82   virtual Dali::RenderSurface::SurfaceType GetType();
83
84   /**
85    * @copydoc Dali::RenderSurface::GetSurface()
86    */
87   virtual Any GetSurface();
88
89   /**
90    * @copydoc Dali::RenderSurface::GetDrawable()
91    */
92   virtual Ecore_Wl_Window* GetWlWindow();
93
94 public:  // from Internal::Adaptor::RenderSurface
95
96   /**
97    * @copydoc Dali::Internal::Adaptor::RenderSurface::InitializeEgl()
98    */
99   virtual void InitializeEgl( EglInterface& egl );
100
101   /**
102    * @copydoc Dali::Internal::Adaptor::RenderSurface::CreateEglSurface()
103    */
104   virtual void CreateEglSurface( EglInterface& egl );
105
106   /**
107    * @copydoc Dali::Internal::Adaptor::RenderSurface::DestroyEglSurface()
108    */
109   virtual void DestroyEglSurface( EglInterface& egl );
110
111   /**
112    * @copydoc Dali::Internal::Adaptor::RenderSurface::ReplaceEGLSurface()
113    */
114   virtual bool ReplaceEGLSurface( EglInterface& egl );
115
116   /**
117    * @copydoc Dali::Internal::Adaptor::RenderSurface::MoveResize()
118    */
119   virtual void MoveResize( Dali::PositionSize positionSize);
120
121   /**
122    * @copydoc Dali::Internal::Adaptor::RenderSurface::Map()
123    */
124   virtual void Map();
125
126   /**
127    * @copydoc Dali::Internal::Adaptor::RenderSurface::PreRender()
128    */
129   virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction );
130
131   /**
132    * @copydoc Dali::Internal::Adaptor::RenderSurface::PostRender()
133    */
134   virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int timeDelta, SyncMode syncMode );
135
136   /**
137    * @copydoc Dali::Internal::Adaptor::RenderSurface::SetViewMode()
138    */
139   void SetViewMode( ViewMode viewMode );
140
141 protected:
142
143   /**
144    * Create WlWindow
145    */
146   virtual void CreateWlRenderable();
147
148   /**
149    * @copydoc Dali::Internal::Adaptor::ECoreX::RenderSurface::UseExistingRenderable
150    */
151   virtual void UseExistingRenderable( unsigned int surfaceId );
152
153 private: // Data
154
155   Ecore_Wl_Window*   mWlWindow; ///< Wayland-Window
156   wl_egl_window*     mEglWindow;
157   bool             mNeedToApproveDeiconify; ///< Whether need to send ECORE_X_ATOM_E_DEICONIFY_APPROVE event
158
159 }; // class WindowRenderSurface
160
161 } // namespace ECore
162
163 } // namespace Adaptor
164
165 } // namespace internal
166
167 } // namespace Dali
168
169 #endif // __DALI_INTERNAL_ECORE_X_WINDOW_RENDER_SURFACE_H__