1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL_H
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/internal/window-system/common/window-base.h>
26 #include <Ecore_Wayland.h>
27 #include <tizen-extension-client-protocol.h>
28 #include <wayland-egl.h>
30 #ifdef DALI_ELDBUS_AVAILABLE
41 class WindowRenderSurface;
42 class WindowRenderSurfaceEcoreWl;
45 * WindowBaseEcoreWl class provides an WindowBase Ecore-Wayland implementation.
47 class WindowBaseEcoreWl : public WindowBase
54 WindowBaseEcoreWl( PositionSize positionSize, Any surface, bool isTransparent );
59 virtual ~WindowBaseEcoreWl();
64 * @brief Called when the window iconify state is changed.
66 Eina_Bool OnIconifyStateChanged( void* data, int type, void* event );
69 * @brief Called when the window gains focus.
71 Eina_Bool OnFocusIn( void* data, int type, void* event );
74 * @brief Called when the window loses focus.
76 Eina_Bool OnFocusOut( void* data, int type, void* event );
79 * @brief Called when the output is transformed.
81 Eina_Bool OnOutputTransform( void* data, int type, void* event );
84 * @brief Called when the output transform should be ignored.
86 Eina_Bool OnIgnoreOutputTransform( void* data, int type, void* event );
89 * @brief Called when a rotation event is recevied.
91 void OnRotation( void* data, int type, void* event );
94 * @brief Called when a touch down is received.
96 void OnMouseButtonDown( void* data, int type, void* event );
99 * @brief Called when a touch up is received.
101 void OnMouseButtonUp( void* data, int type, void* event );
104 * @brief Called when a touch motion is received.
106 void OnMouseButtonMove( void* data, int type, void* event );
109 * @brief Called when a touch is canceled.
111 void OnMouseButtonCancel( void* data, int type, void* event );
114 * @brief Called when a mouse wheel is received.
116 void OnMouseWheel( void* data, int type, void* event );
119 * @brief Called when a detent rotation event is recevied.
121 void OnDetentRotation( void* data, int type, void* event );
124 * @brief Called when a key down is received.
126 void OnKeyDown( void* data, int type, void* event );
129 * @brief Called when a key up is received.
131 void OnKeyUp( void* data, int type, void* event );
134 * @brief Called when the source window notifies us the content in clipboard is selected.
136 void OnDataSend( void* data, int type, void* event );
139 * @brief Called when the source window sends us about the selected content.
141 void OnDataReceive( void* data, int type, void* event );
144 * @brief Called when a font name is changed.
146 void OnFontNameChanged();
149 * @brief Called when a font size is changed.
151 void OnFontSizeChanged();
153 #ifdef DALI_ELDBUS_AVAILABLE
155 * @brief Called when Ecore ElDBus accessibility event is received.
157 void OnEcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message );
161 * @brief RegistryGlobalCallback
163 void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version );
166 * @brief RegistryGlobalCallbackRemove
168 void RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id );
171 * @brief TizenPolicyNotificationChangeDone
173 void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state );
176 * @brief TizenPolicyScreenModeChangeDone
178 void TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state );
181 * @brief DisplayPolicyBrightnessChangeDone
183 void DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state );
188 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
190 Any GetNativeWindow() override;
193 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
195 int GetNativeWindowId() override;
198 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
200 EGLNativeWindowType CreateEglWindow( int width, int height ) override;
203 * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
205 void DestroyEglWindow() override;
208 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
210 void SetEglWindowRotation( int angle ) override;
213 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
215 void SetEglWindowBufferTransform( int angle ) override;
218 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
220 void SetEglWindowTransform( int angle ) override;
223 * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
225 void ResizeEglWindow( PositionSize positionSize ) override;
228 * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
230 bool IsEglWindowRotationSupported() override;
233 * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
235 void Move( PositionSize positionSize ) override;
238 * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
240 void Resize( PositionSize positionSize ) override;
243 * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
245 void MoveResize( PositionSize positionSize ) override;
248 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
250 void SetClass( const std::string& name, const std::string& className ) override;
253 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
255 void Raise() override;
258 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
260 void Lower() override;
263 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
265 void Activate() override;
268 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
270 void SetAvailableAnlges( const std::vector< int >& angles ) override;
273 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
275 void SetPreferredAngle( int angle ) override;
278 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
280 void SetAcceptFocus( bool accept ) override;
283 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
285 void Show() override;
288 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
290 void Hide() override;
293 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
295 unsigned int GetSupportedAuxiliaryHintCount() const override;
298 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
300 std::string GetSupportedAuxiliaryHint( unsigned int index ) const override;
303 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
305 unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) override;
308 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
310 bool RemoveAuxiliaryHint( unsigned int id ) override;
313 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
315 bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) override;
318 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
320 std::string GetAuxiliaryHintValue( unsigned int id ) const override;
323 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
325 unsigned int GetAuxiliaryHintId( const std::string& hint ) const override;
328 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
330 void SetInputRegion( const Rect< int >& inputRegion ) override;
333 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
335 void SetType( Dali::Window::Type type ) override;
338 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
340 bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override;
343 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
345 Dali::Window::NotificationLevel::Type GetNotificationLevel() const override;
348 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
350 void SetOpaqueState( bool opaque ) override;
353 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
355 bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override;
358 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
360 Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override;
363 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
365 bool SetBrightness( int brightness ) override;
368 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
370 int GetBrightness() const override;
373 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
375 bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) override;
378 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
380 bool UngrabKey( Dali::KEY key ) override;
383 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
385 bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) override;
388 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
390 bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) override;
393 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
395 void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
398 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
400 int GetScreenRotationAngle() override;
403 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
405 void SetWindowRotationAngle( int degree ) override;
408 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
410 void WindowRotationCompleted( int degree, int width, int height ) override;
413 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
415 void SetTransparency( bool transparent ) override;
418 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
420 void SetParent( WindowBase* parentWinBase ) override;
423 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
425 int CreateFrameRenderedSyncFence() override;
428 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
430 int CreateFramePresentedSyncFence() override;
435 * Second stage initialization
437 void Initialize( PositionSize positionSize, Any surface, bool isTransparent );
440 * Initialize Ecore ElDBus
442 void InitializeEcoreElDBus();
445 * @brief Create window
447 void CreateWindow( PositionSize positionSize );
452 WindowBaseEcoreWl(const WindowBaseEcoreWl&) = delete;
455 WindowBaseEcoreWl& operator=(const WindowBaseEcoreWl& rhs) = delete;
459 typedef std::vector< std::pair< std::string, std::string > > AuxiliaryHints;
461 Dali::Vector< Ecore_Event_Handler* > mEcoreEventHandler;
463 Ecore_Wl_Window* mEcoreWindow;
464 wl_surface* mWlSurface;
465 wl_egl_window* mEglWindow;
466 wl_display* mDisplay;
467 wl_event_queue* mEventQueue;
468 tizen_policy* mTizenPolicy;
469 tizen_display_policy* mTizenDisplayPolicy;
471 std::vector< std::string > mSupportedAuxiliaryHints;
472 AuxiliaryHints mAuxiliaryHints;
474 int mNotificationLevel;
475 uint32_t mNotificationChangeState;
476 bool mNotificationLevelChangeDone;
479 uint32_t mScreenOffModeChangeState;
480 bool mScreenOffModeChangeDone;
483 uint32_t mBrightnessChangeState;
484 bool mBrightnessChangeDone;
488 #ifdef DALI_ELDBUS_AVAILABLE
489 Eldbus_Connection* mSystemConnection;
490 #endif // DALI_ELDBUS_AVAILABLE
494 } // namespace Adaptor
496 } // namespace internal
500 #endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL_H