[Tizen] Support Ecore-Wayland2
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / ecore-wl2 / window-base-ecore-wl2.h
1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL2_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL2_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_Wl2.h>
27 #include <tizen-extension-client-protocol.h>
28
29 namespace Dali
30 {
31 namespace Internal
32 {
33 namespace Adaptor
34 {
35
36 class WindowRenderSurface;
37 class WindowRenderSurfaceEcoreWl2;
38
39 /**
40  * WindowBaseEcoreWl2 class provides an WindowBase Ecore-Wayland2 implementation.
41  */
42 class WindowBaseEcoreWl2 : public WindowBase
43 {
44 public:
45
46   /**
47    * @brief Constructor
48    */
49   WindowBaseEcoreWl2( Window* window, WindowRenderSurface* windowRenderSurface );
50
51   /**
52    * @brief Destructor
53    */
54   virtual ~WindowBaseEcoreWl2();
55
56 public:
57
58   /**
59    * @brief Called when the window iconify state is changed.
60    */
61   Eina_Bool OnIconifyStateChanged( void* data, int type, void* event );
62
63   /**
64    * @brief Called when the window gains focus.
65    */
66   Eina_Bool OnFocusIn( void* data, int type, void* event );
67
68   /**
69    * @brief Called when the window loses focus.
70    */
71   Eina_Bool OnFocusOut( void* data, int type, void* event );
72
73   /**
74    * @brief Called when the output is transformed.
75    */
76   Eina_Bool OnOutputTransform( void* data, int type, void* event );
77
78   /**
79    * @brief Called when the output transform should be ignored.
80    */
81   Eina_Bool OnIgnoreOutputTransform( void* data, int type, void* event );
82
83   /**
84    * @brief RegistryGlobalCallback
85    */
86   void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version );
87
88   /**
89    * @brief RegistryGlobalCallbackRemove
90    */
91   void RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id );
92
93   /**
94    * @brief TizenPolicyNotificationChangeDone
95    */
96   void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state );
97
98   /**
99    * @brief TizenPolicyScreenModeChangeDone
100    */
101   void TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state );
102
103   /**
104    * @brief DisplayPolicyBrightnessChangeDone
105    */
106   void DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state );
107
108 public:
109
110   /**
111    * @copydoc Dali::Internal::Adaptor::WindowBase::Initialize()
112    */
113   virtual void Initialize() override;
114
115   /**
116    * @copydoc Dali::Internal::Adaptor::WindowBase::ShowIndicator()
117    */
118   virtual void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode ) override;
119
120   /**
121    * @copydoc Dali::Internal::Adaptor::WindowBase::SetIndicatorProperties()
122    */
123   virtual void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ) override;
124
125   /**
126    * @copydoc Dali::Internal::Adaptor::WindowBase::IndicatorTypeChanged()
127    */
128   virtual void IndicatorTypeChanged( IndicatorInterface::Type type ) override;
129
130   /**
131    * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
132    */
133   virtual void SetClass( std::string name, std::string className ) override;
134
135   /**
136    * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
137    */
138   virtual void Raise() override;
139
140   /**
141    * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
142    */
143   virtual void Lower() override;
144
145   /**
146    * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
147    */
148   virtual void Activate() override;
149
150   /**
151    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableOrientations()
152    */
153   virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) override;
154
155   /**
156    * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredOrientation()
157    */
158   virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) override;
159
160   /**
161    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
162    */
163   virtual void SetAcceptFocus( bool accept ) override;
164
165   /**
166    * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
167    */
168   virtual void Show() override;
169
170   /**
171    * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
172    */
173   virtual void Hide() override;
174
175   /**
176    * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
177    */
178   virtual unsigned int GetSupportedAuxiliaryHintCount() const override;
179
180   /**
181    * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
182    */
183   virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const override;
184
185   /**
186    * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
187    */
188   virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) override;
189
190   /**
191    * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
192    */
193   virtual bool RemoveAuxiliaryHint( unsigned int id ) override;
194
195   /**
196    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
197    */
198   virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) override;
199
200   /**
201    * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
202    */
203   virtual std::string GetAuxiliaryHintValue( unsigned int id ) const override;
204
205   /**
206    * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
207    */
208   virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const override;
209
210   /**
211    * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
212    */
213   virtual void SetInputRegion( const Rect< int >& inputRegion ) override;
214
215   /**
216    * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
217    */
218   virtual void SetType( Dali::Window::Type type ) override;
219
220   /**
221    * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
222    */
223   virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override;
224
225   /**
226    * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
227    */
228   virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const override;
229
230   /**
231    * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
232    */
233   virtual void SetOpaqueState( bool opaque ) override;
234
235   /**
236    * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
237    */
238   virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override;
239
240   /**
241    * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
242    */
243   virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override;
244
245   /**
246    * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
247    */
248   virtual bool SetBrightness( int brightness ) override;
249
250   /**
251    * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
252    */
253   virtual int GetBrightness() const override;
254
255   /**
256    * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
257    */
258   virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) override;
259
260   /**
261    * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
262    */
263   virtual bool UngrabKey( Dali::KEY key ) override;
264
265   /**
266    * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
267    */
268   virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) override;
269
270   /**
271    * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
272    */
273   virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) override;
274
275 protected:
276
277   // Undefined
278   WindowBaseEcoreWl2(const WindowBaseEcoreWl2&) = delete;
279
280   // Undefined
281   WindowBaseEcoreWl2& operator=(const WindowBaseEcoreWl2& rhs) = delete;
282
283 private:
284
285   typedef std::vector< std::pair< std::string, std::string > > AuxiliaryHints;
286
287   Dali::Vector< Ecore_Event_Handler* > mEcoreEventHandler;
288
289   Window*                              mWindow;
290   WindowRenderSurfaceEcoreWl2*         mWindowSurface;
291   Ecore_Wl2_Window*                    mEcoreWindow;
292   wl_display*                          mDisplay;
293   wl_event_queue*                      mEventQueue;
294   tizen_policy*                        mTizenPolicy;
295   tizen_display_policy*                mTizenDisplayPolicy;
296
297   std::vector< std::string >           mSupportedAuxiliaryHints;
298   AuxiliaryHints                       mAuxiliaryHints;
299
300   int                                  mNotificationLevel;
301   uint32_t                             mNotificationChangeState;
302   bool                                 mNotificationLevelChangeDone;
303
304   int                                  mScreenOffMode;
305   uint32_t                             mScreenOffModeChangeState;
306   bool                                 mScreenOffModeChangeDone;
307
308   int                                  mBrightness;
309   uint32_t                             mBrightnessChangeState;
310   bool                                 mBrightnessChangeDone;
311 };
312
313 } // namespace Adaptor
314
315 } // namespace internal
316
317 } // namespace Dali
318
319 #endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL2_H