[3.0] Add key grab/ungrab interfaces for Tizen (X11/Wayland)
[platform/core/uifw/dali-adaptor.git] / adaptors / ecore / 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 ECore
29 {
30
31 /**
32  * @copydoc Dali::ECore::EcoreWlRenderSurface.
33  * Window specialization.
34  */
35 class WindowRenderSurface : public EcoreWlRenderSurface
36 {
37 public:
38
39   /**
40     * Uses an Wayland surface to render to.
41     * @param [in] positionSize the position and size of the surface
42     * @param [in] surface can be a Wayland-window or Wayland-pixmap (type must be unsigned int).
43     * @param [in] name optional name of 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                        bool isTransparent = false );
50
51   /**
52    * @copydoc Dali::ECore::EcoreWlRenderSurface::~EcoreWlRenderSurface
53    */
54   virtual ~WindowRenderSurface();
55
56 public: // API
57
58   /**
59    * @copydoc Dali::RenderSurface::GetDrawable()
60    */
61   virtual Ecore_Wl_Window* GetDrawable();
62
63   /**
64    * Request to approve deiconify operation
65    * If it is requested, it will send ECORE_X_ATOM_E_DEICONIFY_APPROVE event to window manager after rendering
66    */
67   void RequestToApproveDeiconify();
68
69   /**
70    * Map window
71    */
72   virtual void Map();
73
74   /**
75    * @copydoc Dali::ECore::EcoreWlRenderSurface::GetSurface()
76    */
77   virtual Any GetSurface();
78
79   /**
80    * @copydoc Dali::ECore::EcoreWlRenderSurface::GetWlWindow()
81    */
82   virtual Ecore_Wl_Window* GetWlWindow();
83
84   struct wl_surface* GetWlSurface(){ return mWlSurface; }
85
86 public: // from Dali::RenderSurface
87
88   /**
89    * @copydoc Dali::RenderSurface::InitializeEgl()
90    */
91   virtual void InitializeEgl( EglInterface& egl );
92
93   /**
94    * @copydoc Dali::RenderSurface::CreateEglSurface()
95    */
96   virtual void CreateEglSurface( EglInterface& egl );
97
98   /**
99    * @copydoc Dali::RenderSurface::DestroyEglSurface()
100    */
101   virtual void DestroyEglSurface( EglInterface& egl );
102
103   /**
104    * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
105    */
106   virtual bool ReplaceEGLSurface( EglInterface& egl );
107
108   /**
109    * @copydoc Dali::RenderSurface::MoveResize()
110    */
111   virtual void MoveResize( Dali::PositionSize positionSize);
112
113   /**
114    * @copydoc Dali::RenderSurface::SetViewMode()
115    */
116   void SetViewMode( ViewMode viewMode );
117
118   /**
119    * @copydoc Dali::RenderSurface::StartRender()
120    */
121   virtual void StartRender();
122
123   /**
124    * @copydoc Dali::RenderSurface::PreRender()
125    */
126   virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction );
127
128   /**
129    * @copydoc Dali::RenderSurface::PostRender()
130    */
131   virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface );
132
133   /**
134    * @copydoc Dali::RenderSurface::StopRender()
135    */
136   virtual void StopRender();
137
138   /**
139    * @copydoc Dali::RenderSurface::SetThreadSynchronization
140    */
141   virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization );
142
143   /**
144    * @copydoc Dali::RenderSurface::ReleaseLock()
145    */
146   virtual void ReleaseLock();
147
148 protected:
149
150   /**
151    * Create WlWindow
152    */
153   virtual void CreateWlRenderable();
154
155   /**
156    * @copydoc Dali::Internal::Adaptor::ECore::EcoreWlRenderSurface::UseExistingRenderable
157    */
158   virtual void UseExistingRenderable( unsigned int surfaceId );
159
160 private: // Data
161
162   Ecore_Wl_Window*   mWlWindow; ///< Wayland-Window
163   wl_egl_window*     mEglWindow;
164   struct wl_surface* mWlSurface;
165   bool             mNeedToApproveDeiconify; ///< Whether need to send ECORE_X_ATOM_E_DEICONIFY_APPROVE event
166
167 }; // class WindowRenderSurface
168
169 } // namespace ECore
170
171 } // namespace Dali
172
173 #endif // __DALI_INTERNAL_ECORE_X_WINDOW_RENDER_SURFACE_H__