[Tizen] Revert "Support screen rotation"
[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] className optional class name of the surface passed in
44     * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
45     */
46   WindowRenderSurface( Dali::PositionSize positionSize,
47                        Any surface,
48                        const std::string& name,
49                        const std::string& className,
50                        bool isTransparent = false );
51
52   /**
53    * @copydoc Dali::ECore::EcoreXRenderSurface::~EcoreXRenderSurface
54    */
55   virtual ~WindowRenderSurface();
56
57 public: // API
58
59   /**
60    * @copydoc Dali::RenderSurface::GetDrawable()
61    */
62   virtual Ecore_X_Drawable GetDrawable();
63
64   /**
65    * Request to approve deiconify operation
66    * If it is requested, it will send ECORE_X_ATOM_E_DEICONIFY_APPROVE event to window manager after rendering
67    */
68   void RequestToApproveDeiconify();
69
70   /**
71    * Map window
72    */
73   virtual void Map();
74
75   /**
76    * @copydoc Dali::ECore::EcoreXRenderSurface::GetSurface()
77    */
78   virtual Any GetSurface();
79
80   /**
81    * @copydoc Dali::ECore::EcoreXRenderSurface::GetXWindow()
82    */
83   virtual Ecore_X_Window GetXWindow();
84
85 public: // from Dali::RenderSurface
86
87   /**
88    * @copydoc Dali::RenderSurface::InitializeEgl()
89    */
90   virtual void InitializeEgl( EglInterface& egl );
91
92   /**
93    * @copydoc Dali::RenderSurface::CreateEglSurface()
94    */
95   virtual void CreateEglSurface( EglInterface& egl );
96
97   /**
98    * @copydoc Dali::RenderSurface::DestroyEglSurface()
99    */
100   virtual void DestroyEglSurface( EglInterface& egl );
101
102   /**
103    * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
104    */
105   virtual bool ReplaceEGLSurface( EglInterface& egl );
106
107   /**
108    * @copydoc Dali::RenderSurface::MoveResize()
109    */
110   virtual void MoveResize( Dali::PositionSize positionSize);
111
112   /**
113    * @copydoc Dali::RenderSurface::SetViewMode()
114    */
115   void SetViewMode( ViewMode viewMode );
116
117   /**
118    * @copydoc Dali::RenderSurface::StartRender()
119    */
120   virtual void StartRender();
121
122   /**
123    * @copydoc Dali::RenderSurface::PreRender()
124    */
125   virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction );
126
127   /**
128    * @copydoc Dali::RenderSurface::PostRender()
129    */
130   virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface );
131
132   /**
133    * @copydoc Dali::RenderSurface::StopRender()
134    */
135   virtual void StopRender();
136
137   /**
138    * @copydoc Dali::RenderSurface::SetThreadSynchronization
139    */
140   virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization );
141
142   /**
143    * @copydoc Dali::RenderSurface::ReleaseLock()
144    */
145   virtual void ReleaseLock();
146
147 protected:
148
149   /**
150    * Create XWindow
151    */
152   virtual void CreateXRenderable();
153
154   /**
155    * @copydoc Dali::Internal::Adaptor::ECore::EcoreXRenderSurface::UseExistingRenderable
156    */
157   virtual void UseExistingRenderable( unsigned int surfaceId );
158
159 private: // Data
160
161   Ecore_X_Window   mX11Window; ///< X-Window
162   bool             mNeedToApproveDeiconify; ///< Whether need to send ECORE_X_ATOM_E_DEICONIFY_APPROVE event
163   std::string      mClassName;          ///< The class name of the window
164
165 }; // class WindowRenderSurface
166
167 } // namespace ECore
168
169 } // namespace Dali
170
171 #endif // __DALI_INTERNAL_ECORE_X_WINDOW_RENDER_SURFACE_H__