1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL2_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL2_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_Wl2.h>
27 #include <tizen-extension-client-protocol.h>
28 #include <wayland-egl.h>
29 #include <xkbcommon/xkbcommon.h>
31 #ifdef DALI_ELDBUS_AVAILABLE
42 class WindowRenderSurface;
43 class WindowRenderSurfaceEcoreWl2;
46 * WindowBaseEcoreWl2 class provides an WindowBase Ecore-Wayland2 implementation.
48 class WindowBaseEcoreWl2 : public WindowBase
55 WindowBaseEcoreWl2( PositionSize positionSize, Any surface, bool isTransparent );
60 virtual ~WindowBaseEcoreWl2();
65 * @brief Called when the window iconify state is changed.
67 Eina_Bool OnIconifyStateChanged( void* data, int type, void* event );
70 * @brief Called when the window gains focus.
72 Eina_Bool OnFocusIn( void* data, int type, void* event );
75 * @brief Called when the window loses focus.
77 Eina_Bool OnFocusOut( void* data, int type, void* event );
80 * @brief Called when the output is transformed.
82 Eina_Bool OnOutputTransform( void* data, int type, void* event );
85 * @brief Called when the output transform should be ignored.
87 Eina_Bool OnIgnoreOutputTransform( void* data, int type, void* event );
90 * @brief Called when a rotation event is recevied.
92 void OnRotation( void* data, int type, void* event );
95 * @brief Called when a configure event is recevied.
97 void OnConfiguration( void* data, int type, void* event );
100 * @brief Called when a touch down is received.
102 void OnMouseButtonDown( void* data, int type, void* event );
105 * @brief Called when a touch up is received.
107 void OnMouseButtonUp( void* data, int type, void* event );
110 * @brief Called when a touch motion is received.
112 void OnMouseButtonMove( void* data, int type, void* event );
115 * @brief Called when a touch is canceled.
117 void OnMouseButtonCancel( void* data, int type, void* event );
120 * @brief Called when a mouse wheel is received.
122 void OnMouseWheel( void* data, int type, void* event );
125 * @brief Called when a detent rotation event is recevied.
127 void OnDetentRotation( void* data, int type, void* event );
130 * @brief Called when a key down is received.
132 void OnKeyDown( void* data, int type, void* event );
135 * @brief Called when a key up is received.
137 void OnKeyUp( void* data, int type, void* event );
140 * @brief Called when the source window notifies us the content in clipboard is selected.
142 void OnDataSend( void* data, int type, void* event );
145 * @brief Called when the source window sends us about the selected content.
147 void OnDataReceive( void* data, int type, void* event );
150 * @brief Called when a font name is changed.
152 void OnFontNameChanged();
155 * @brief Called when a font size is changed.
157 void OnFontSizeChanged();
160 * @brief Called when a transition effect-start/end event is received.
162 void OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type );
165 * @brief Called when a keyboard repeat event is changed.
167 void OnKeyboardRepeatSettingsChanged();
169 #ifdef DALI_ELDBUS_AVAILABLE
171 * @brief Called when Ecore ElDBus accessibility event is received.
173 void OnEcoreElDBusAccessibilityNotification( void* context, const Eldbus_Message* message );
177 * @brief Called when a keymap is changed.
179 void KeymapChanged(void *data, int type, void *event);
182 * @brief RegistryGlobalCallback
184 void RegistryGlobalCallback( void* data, struct wl_registry *registry, uint32_t name, const char* interface, uint32_t version );
187 * @brief RegistryGlobalCallbackRemove
189 void RegistryGlobalCallbackRemove( void* data, struct wl_registry* registry, uint32_t id );
192 * @brief TizenPolicyNotificationChangeDone
194 void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state );
197 * @brief TizenPolicyScreenModeChangeDone
199 void TizenPolicyScreenModeChangeDone( void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t mode, uint32_t state );
202 * @brief DisplayPolicyBrightnessChangeDone
204 void DisplayPolicyBrightnessChangeDone( void* data, struct tizen_display_policy *displayPolicy, struct wl_surface* surface, int32_t brightness, uint32_t state );
208 * @brief Gets the key code by keyName.
210 void GetKeyCode( std::string keyName, int32_t& keyCode );
215 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
217 Any GetNativeWindow() override;
220 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
222 int GetNativeWindowId() override;
225 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
227 EGLNativeWindowType CreateEglWindow( int width, int height ) override;
230 * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
232 void DestroyEglWindow() override;
235 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
237 void SetEglWindowRotation( int angle ) override;
240 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
242 void SetEglWindowBufferTransform( int angle ) override;
245 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
247 void SetEglWindowTransform( int angle ) override;
250 * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
252 void ResizeEglWindow( PositionSize positionSize ) override;
255 * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
257 bool IsEglWindowRotationSupported() override;
260 * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
262 void Move( PositionSize positionSize ) override;
265 * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
267 void Resize( PositionSize positionSize ) override;
270 * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
272 void MoveResize( PositionSize positionSize ) override;
275 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
277 void SetClass( const std::string& name, const std::string& className ) override;
280 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
282 void Raise() override;
285 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
287 void Lower() override;
290 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
292 void Activate() override;
295 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
297 void SetAvailableAnlges( const std::vector< int >& angles ) override;
300 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
302 void SetPreferredAngle( int angle ) override;
305 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
307 void SetAcceptFocus( bool accept ) override;
310 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
312 void Show() override;
315 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
317 void Hide() override;
320 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
322 unsigned int GetSupportedAuxiliaryHintCount() const override;
325 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
327 std::string GetSupportedAuxiliaryHint( unsigned int index ) const override;
330 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
332 unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) override;
335 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
337 bool RemoveAuxiliaryHint( unsigned int id ) override;
340 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
342 bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) override;
345 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
347 std::string GetAuxiliaryHintValue( unsigned int id ) const override;
350 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
352 unsigned int GetAuxiliaryHintId( const std::string& hint ) const override;
355 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
357 void SetInputRegion( const Rect< int >& inputRegion ) override;
360 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
362 void SetType( Dali::Window::Type type ) override;
365 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
367 bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override;
370 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
372 Dali::Window::NotificationLevel::Type GetNotificationLevel() const override;
375 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
377 void SetOpaqueState( bool opaque ) override;
380 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
382 bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override;
385 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
387 Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override;
390 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
392 bool SetBrightness( int brightness ) override;
395 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
397 int GetBrightness() const override;
400 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
402 bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) override;
405 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
407 bool UngrabKey( Dali::KEY key ) override;
410 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
412 bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) override;
415 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
417 bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) override;
420 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
422 void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
425 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
427 int GetScreenRotationAngle() override;
430 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
432 void SetWindowRotationAngle( int degree ) override;
435 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
437 void WindowRotationCompleted( int degree, int width, int height ) override;
440 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
442 void SetTransparency( bool transparent ) override;
445 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
447 void SetParent( WindowBase* parentWinBase ) override;
450 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
452 int CreateFrameRenderedSyncFence() override;
455 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
457 int CreateFramePresentedSyncFence() override;
462 * Second stage initialization
464 void Initialize( PositionSize positionSize, Any surface, bool isTransparent );
467 * Initialize Ecore ElDBus
469 void InitializeEcoreElDBus();
472 * @brief Create window
474 void CreateWindow( PositionSize positionSize );
479 WindowBaseEcoreWl2(const WindowBaseEcoreWl2&) = delete;
482 WindowBaseEcoreWl2& operator=(const WindowBaseEcoreWl2& rhs) = delete;
486 typedef std::vector< std::pair< std::string, std::string > > AuxiliaryHints;
488 Dali::Vector< Ecore_Event_Handler* > mEcoreEventHandler;
490 Ecore_Wl2_Window* mEcoreWindow;
491 wl_surface* mWlSurface;
492 wl_egl_window* mEglWindow;
493 wl_display* mDisplay;
494 wl_event_queue* mEventQueue;
495 tizen_policy* mTizenPolicy;
496 tizen_display_policy* mTizenDisplayPolicy;
499 std::vector< std::string > mSupportedAuxiliaryHints;
500 AuxiliaryHints mAuxiliaryHints;
502 int mNotificationLevel;
503 uint32_t mNotificationChangeState;
504 bool mNotificationLevelChangeDone;
507 uint32_t mScreenOffModeChangeState;
508 bool mScreenOffModeChangeDone;
511 uint32_t mBrightnessChangeState;
512 bool mBrightnessChangeDone;
515 Dali::PositionSize mWindowPositionSize;
519 volatile uint32_t mMoveResizeSerial;
520 uint32_t mLastSubmittedMoveResizeSerial;
522 #ifdef DALI_ELDBUS_AVAILABLE
523 Eldbus_Connection* mSystemConnection;
524 #endif // DALI_ELDBUS_AVAILABLE
527 } // namespace Adaptor
529 } // namespace internal
533 #endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL2_H