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