Remove StereoMode
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / ubuntu-x11 / window-base-ecore-x.h
1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_BASE_ECORE_X_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_BASE_ECORE_X_H
3
4 /*
5  * Copyright (c) 2018 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 <dali/internal/window-system/common/window-base.h>
23
24 // EXTERNAL HEADERS
25 #include <Ecore.h>
26 #include <Ecore_X.h>
27
28 namespace Dali
29 {
30 namespace Internal
31 {
32 namespace Adaptor
33 {
34
35 /**
36  * WindowBaseEcoreX class provides an WindowBase EcoreX implementation.
37  */
38 class WindowBaseEcoreX : public WindowBase
39 {
40 public:
41
42   /**
43    * @brief Constructor
44    */
45   WindowBaseEcoreX( PositionSize positionSize, Any surface, bool isTransparent );
46
47   /**
48    * @brief Destructor
49    */
50   virtual ~WindowBaseEcoreX();
51
52 public:
53
54   /**
55    * @brief Called when the window property is changed.
56    */
57   Eina_Bool OnWindowPropertyChanged( void* data, int type, void* event );
58
59   /**
60    * @brief Called when the window receives a delete request
61    */
62   void OnDeleteRequest();
63
64   /**
65    * @brief Called when the window gains focus.
66    */
67   void OnFocusIn( void* data, int type, void* event );
68
69   /**
70    * @brief Called when the window loses focus.
71    */
72   void OnFocusOut( void* data, int type, void* event );
73
74   /**
75    * @brief Called when the window is damaged.
76    */
77   void OnWindowDamaged( void* data, int type, void* event );
78
79   /**
80    * @brief Called when a touch down is received.
81    */
82   void OnMouseButtonDown( void* data, int type, void* event );
83
84   /**
85    * @brief Called when a touch up is received.
86    */
87   void OnMouseButtonUp( void* data, int type, void* event );
88
89   /**
90    * @brief Called when a touch motion is received.
91    */
92   void OnMouseButtonMove( void* data, int type, void* event );
93
94   /**
95    * @brief Called when a mouse wheel is received.
96    */
97   void OnMouseWheel( void* data, int type, void* event );
98
99   /**
100    * @brief Called when a key down is received.
101    */
102   void OnKeyDown( void* data, int type, void* event );
103
104   /**
105    * @brief Called when a key up is received.
106    */
107   void OnKeyUp( void* data, int type, void* event );
108
109   /**
110    * @brief Called when the source window notifies us the content in clipboard is selected.
111    */
112   void OnSelectionClear( void* data, int type, void* event );
113
114   /**
115    * @brief Called when the source window sends us about the selected content.
116    */
117   void OnSelectionNotify( void* data, int type, void* event );
118
119 public:
120
121   /**
122    * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
123    */
124   virtual Any GetNativeWindow() override;
125
126   /**
127    * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
128    */
129   virtual int GetNativeWindowId() override;
130
131   /**
132    * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
133    */
134   virtual EGLNativeWindowType CreateEglWindow( int width, int height ) override;
135
136   /**
137    * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
138    */
139   virtual void DestroyEglWindow() override;
140
141   /**
142    * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
143    */
144   virtual void SetEglWindowRotation( int angle ) override;
145
146   /**
147    * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
148    */
149   virtual void SetEglWindowBufferTransform( int angle ) override;
150
151   /**
152    * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
153    */
154   virtual void SetEglWindowTransform( int angle ) override;
155
156   /**
157    * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
158    */
159   virtual void ResizeEglWindow( PositionSize positionSize ) override;
160
161   /**
162    * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
163    */
164   virtual bool IsEglWindowRotationSupported() override;
165
166   /**
167    * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
168    */
169   virtual void Move( PositionSize positionSize ) override;
170
171   /**
172    * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
173    */
174   virtual void Resize( PositionSize positionSize ) override;
175
176   /**
177    * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
178    */
179   virtual void MoveResize( PositionSize positionSize ) override;
180
181   /**
182    * @copydoc Dali::Internal::Adaptor::WindowBase::ShowIndicator()
183    */
184   virtual void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode ) override;
185
186   /**
187    * @copydoc Dali::Internal::Adaptor::WindowBase::SetIndicatorProperties()
188    */
189   virtual void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ) override;
190
191   /**
192    * @copydoc Dali::Internal::Adaptor::WindowBase::IndicatorTypeChanged()
193    */
194   virtual void IndicatorTypeChanged( IndicatorInterface::Type type ) override;
195
196   /**
197    * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
198    */
199   virtual void SetClass( const std::string& name, const std::string& className ) override;
200
201   /**
202    * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
203    */
204   virtual void Raise() override;
205
206   /**
207    * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
208    */
209   virtual void Lower() override;
210
211   /**
212    * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
213    */
214   virtual void Activate() override;
215
216   /**
217    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableOrientations()
218    */
219   virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) override;
220
221   /**
222    * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredOrientation()
223    */
224   virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) override;
225
226   /**
227    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
228    */
229   virtual void SetAcceptFocus( bool accept ) override;
230
231   /**
232    * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
233    */
234   virtual void Show() override;
235
236   /**
237    * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
238    */
239   virtual void Hide() override;
240
241   /**
242    * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
243    */
244   virtual unsigned int GetSupportedAuxiliaryHintCount() const override;
245
246   /**
247    * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
248    */
249   virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const override;
250
251   /**
252    * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
253    */
254   virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) override;
255
256   /**
257    * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
258    */
259   virtual bool RemoveAuxiliaryHint( unsigned int id ) override;
260
261   /**
262    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
263    */
264   virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) override;
265
266   /**
267    * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
268    */
269   virtual std::string GetAuxiliaryHintValue( unsigned int id ) const override;
270
271   /**
272    * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
273    */
274   virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const override;
275
276   /**
277    * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
278    */
279   virtual void SetInputRegion( const Rect< int >& inputRegion ) override;
280
281   /**
282    * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
283    */
284   virtual void SetType( Dali::Window::Type type ) override;
285
286   /**
287    * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
288    */
289   virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override;
290
291   /**
292    * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
293    */
294   virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const override;
295
296   /**
297    * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
298    */
299   virtual void SetOpaqueState( bool opaque ) override;
300
301   /**
302    * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
303    */
304   virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override;
305
306   /**
307    * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
308    */
309   virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override;
310
311   /**
312    * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
313    */
314   virtual bool SetBrightness( int brightness ) override;
315
316   /**
317    * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
318    */
319   virtual int GetBrightness() const override;
320
321   /**
322    * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
323    */
324   virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) override;
325
326   /**
327    * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
328    */
329   virtual bool UngrabKey( Dali::KEY key ) override;
330
331   /**
332    * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
333    */
334   virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) override;
335
336   /**
337    * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
338    */
339   virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) override;
340
341   /**
342    * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
343    */
344   virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
345
346   /**
347    * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
348    */
349   virtual int GetScreenRotationAngle() override;
350
351   /**
352    * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
353    */
354   virtual void SetWindowRotationAngle( int degree ) override;
355
356   /**
357    * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
358    */
359   virtual void WindowRotationCompleted( int degree, int width, int height ) override;
360
361   /**
362    * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
363    */
364   virtual void SetTransparency( bool transparent ) override;
365
366 private:
367
368   /**
369    * Second stage initialization
370    */
371   void Initialize( PositionSize positionSize, Any surface, bool isTransparent );
372
373   /**
374    * @brief Get the surface id if the surface parameter is not empty
375    * @param surface Any containing a surface id, or can be empty
376    * @return surface id, or zero if surface is empty
377    */
378   unsigned int GetSurfaceId( Any surface ) const;
379
380   /**
381    * @brief Create window
382    */
383   void CreateWindow( PositionSize positionSize, bool isTransparent );
384
385 protected:
386
387   // Undefined
388   WindowBaseEcoreX(const WindowBaseEcoreX&) = delete;
389
390   // Undefined
391   WindowBaseEcoreX& operator=(const WindowBaseEcoreX& rhs) = delete;
392
393 private:
394
395   Dali::Vector< Ecore_Event_Handler* > mEcoreEventHandler;
396   Ecore_X_Window                       mEcoreWindow;        ///< Native window handle
397   bool                                 mOwnSurface:1;       ///< Whether we own the surface (responsible for deleting it)
398   bool                                 mIsTransparent;      ///< Whether the window is transparent (32 bit or 24 bit)
399   bool                                 mRotationAppSet:1;
400 };
401
402 } // namespace Adaptor
403
404 } // namespace internal
405
406 } // namespace Dali
407
408 #endif // DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_BASE_ECORE_X_H