[dali_1.0.1] Merge branch 'tizen'
[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 Internal
28 {
29
30 namespace Adaptor
31 {
32
33 namespace ECore
34 {
35
36 /**
37  * @copydoc Dali::Internal::Adaptor::ECore::RenderSurface.
38  * Window specialization.
39  */
40 class WindowRenderSurface : public RenderSurface
41 {
42 public:
43
44   /**
45     * Uses an X11 surface to render to.
46     * @param [in] positionSize the position and size of the surface
47     * @param [in] surface can be a X-window or X-pixmap (type must be unsigned int).
48     * @param [in] display connection to X-server if the surface is a X window or pixmap (type must be void * to X display struct)
49     * @param [in] name optional name of surface passed in
50     * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
51     */
52   WindowRenderSurface( Dali::PositionSize positionSize,
53                        Any surface,
54                        Any display,
55                        const std::string& name,
56                        bool isTransparent = false );
57
58   /**
59    * @copydoc Dali::Internal::Adaptor::ECore::RenderSurface::~RenderSurface
60    */
61   virtual ~WindowRenderSurface();
62
63 public: // API
64
65   /**
66    * @copydoc Dali::RenderSurface::GetDrawable()
67    */
68   virtual Ecore_X_Drawable GetDrawable();
69
70   /**
71    * Request to approve deiconify operation
72    * If it is requested, it will send ECORE_X_ATOM_E_DEICONIFY_APPROVE event to window manager after rendering
73    */
74   void RequestToApproveDeiconify();
75
76 public: // from Dali::RenderSurface
77
78   /**
79    * @copydoc Dali::RenderSurface::GetType()
80    */
81   virtual Dali::RenderSurface::SurfaceType GetType();
82
83   /**
84    * @copydoc Dali::RenderSurface::GetSurface()
85    */
86   virtual Any GetSurface();
87
88   /**
89    * @copydoc Dali::RenderSurface::GetDrawable()
90    */
91   virtual Ecore_X_Window GetXWindow();
92
93 public:  // from Internal::Adaptor::RenderSurface
94
95   /**
96    * @copydoc Dali::Internal::Adaptor::RenderSurface::InitializeEgl()
97    */
98   virtual void InitializeEgl( EglInterface& egl );
99
100   /**
101    * @copydoc Dali::Internal::Adaptor::RenderSurface::CreateEglSurface()
102    */
103   virtual void CreateEglSurface( EglInterface& egl );
104
105   /**
106    * @copydoc Dali::Internal::Adaptor::RenderSurface::DestroyEglSurface()
107    */
108   virtual void DestroyEglSurface( EglInterface& egl );
109
110   /**
111    * @copydoc Dali::Internal::Adaptor::RenderSurface::ReplaceEGLSurface()
112    */
113   virtual bool ReplaceEGLSurface( EglInterface& egl );
114
115   /**
116    * @copydoc Dali::Internal::Adaptor::RenderSurface::MoveResize()
117    */
118   virtual void MoveResize( Dali::PositionSize positionSize);
119
120   /**
121    * @copydoc Dali::Internal::Adaptor::RenderSurface::Map()
122    */
123   virtual void Map();
124
125   /**
126    * @copydoc Dali::Internal::Adaptor::RenderSurface::PreRender()
127    */
128   virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction );
129
130   /**
131    * @copydoc Dali::Internal::Adaptor::RenderSurface::PostRender()
132    */
133   virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int timeDelta, SyncMode syncMode );
134
135   /**
136    * @copydoc Dali::Internal::Adaptor::RenderSurface::SetViewMode()
137    */
138   void SetViewMode( ViewMode viewMode );
139
140 protected:
141
142   /**
143    * Create XWindow
144    */
145   virtual void CreateXRenderable();
146
147   /**
148    * @copydoc Dali::Internal::Adaptor::ECore::RenderSurface::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 Adaptor
162
163 } // namespace internal
164
165 } // namespace Dali
166
167 #endif // __DALI_INTERNAL_ECORE_X_WINDOW_RENDER_SURFACE_H__