1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_BASE_ECORE_X_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_BASE_ECORE_X_H
5 * Copyright (c) 2019 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>
25 #include <dali/internal/system/linux/dali-ecore.h>
26 #include <dali/internal/system/linux/dali-ecore-x.h>
36 * WindowBaseEcoreX class provides an WindowBase EcoreX implementation.
38 class WindowBaseEcoreX : public WindowBase
45 WindowBaseEcoreX( PositionSize positionSize, Any surface, bool isTransparent );
50 virtual ~WindowBaseEcoreX();
55 * @brief Called when the window property is changed.
57 Eina_Bool OnWindowPropertyChanged( void* data, int type, void* event );
60 * @brief Called when the window receives a delete request
62 void OnDeleteRequest();
65 * @brief Called when the window gains focus.
67 void OnFocusIn( void* data, int type, void* event );
70 * @brief Called when the window loses focus.
72 void OnFocusOut( void* data, int type, void* event );
75 * @brief Called when the window is damaged.
77 void OnWindowDamaged( void* data, int type, void* event );
80 * @brief Called when a touch down is received.
82 void OnMouseButtonDown( void* data, int type, void* event );
85 * @brief Called when a touch up is received.
87 void OnMouseButtonUp( void* data, int type, void* event );
90 * @brief Called when a touch motion is received.
92 void OnMouseButtonMove( void* data, int type, void* event );
95 * @brief Called when a mouse wheel is received.
97 void OnMouseWheel( void* data, int type, void* event );
100 * @brief Called when a key down is received.
102 void OnKeyDown( void* data, int type, void* event );
105 * @brief Called when a key up is received.
107 void OnKeyUp( void* data, int type, void* event );
110 * @brief Called when the source window notifies us the content in clipboard is selected.
112 void OnSelectionClear( void* data, int type, void* event );
115 * @brief Called when the source window sends us about the selected content.
117 void OnSelectionNotify( void* data, int type, void* event );
122 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
124 virtual Any GetNativeWindow() override;
127 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
129 virtual int GetNativeWindowId() override;
132 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
134 virtual EGLNativeWindowType CreateEglWindow( int width, int height ) override;
137 * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
139 virtual void DestroyEglWindow() override;
142 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
144 virtual void SetEglWindowRotation( int angle ) override;
147 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
149 virtual void SetEglWindowBufferTransform( int angle ) override;
152 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
154 virtual void SetEglWindowTransform( int angle ) override;
157 * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
159 virtual void ResizeEglWindow( PositionSize positionSize ) override;
162 * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
164 virtual bool IsEglWindowRotationSupported() override;
167 * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
169 virtual void Move( PositionSize positionSize ) override;
172 * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
174 virtual void Resize( PositionSize positionSize ) override;
177 * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
179 virtual void MoveResize( PositionSize positionSize ) override;
182 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
184 virtual void SetClass( const std::string& name, const std::string& className ) override;
187 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
189 virtual void Raise() override;
192 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
194 virtual void Lower() override;
197 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
199 virtual void Activate() override;
202 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
204 virtual void SetAvailableAnlges( const std::vector< int >& angles ) override;
207 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
209 virtual void SetPreferredAngle( int angle ) override;
212 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
214 virtual void SetAcceptFocus( bool accept ) override;
217 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
219 virtual void Show() override;
222 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
224 virtual void Hide() override;
227 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
229 virtual unsigned int GetSupportedAuxiliaryHintCount() const override;
232 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
234 virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const override;
237 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
239 virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) override;
242 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
244 virtual bool RemoveAuxiliaryHint( unsigned int id ) override;
247 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
249 virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) override;
252 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
254 virtual std::string GetAuxiliaryHintValue( unsigned int id ) const override;
257 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
259 virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const override;
262 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
264 virtual void SetInputRegion( const Rect< int >& inputRegion ) override;
267 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
269 virtual void SetType( Dali::Window::Type type ) override;
272 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
274 virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override;
277 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
279 virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const override;
282 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
284 virtual void SetOpaqueState( bool opaque ) override;
287 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
289 virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override;
292 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
294 virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override;
297 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
299 virtual bool SetBrightness( int brightness ) override;
302 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
304 virtual int GetBrightness() const override;
307 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
309 virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) override;
312 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
314 virtual bool UngrabKey( Dali::KEY key ) override;
317 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
319 virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) override;
322 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
324 virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) override;
327 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
329 virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
332 * @brief Return the orientation of the surface.
333 * @return The orientation
335 virtual int GetOrientation() const override;
338 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
340 virtual int GetScreenRotationAngle() override;
343 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
345 virtual void SetWindowRotationAngle( int degree ) override;
348 * @copydoc Dali::Internal::Adaptor::WindowBase::GetWindowRotationAngle()
350 virtual int GetWindowRotationAngle() override;
353 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
355 virtual void WindowRotationCompleted( int degree, int width, int height ) override;
358 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
360 virtual void SetTransparency( bool transparent ) override;
363 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
365 virtual void SetParent( WindowBase* parentWinBase ) override;
368 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
370 virtual int CreateFrameRenderedSyncFence() override;
373 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
375 virtual int CreateFramePresentedSyncFence() override;
380 * Second stage initialization
382 void Initialize( PositionSize positionSize, Any surface, bool isTransparent );
385 * @brief Get the surface id if the surface parameter is not empty
386 * @param surface Any containing a surface id, or can be empty
387 * @return surface id, or zero if surface is empty
389 unsigned int GetSurfaceId( Any surface ) const;
392 * @brief Create window
394 void CreateWindow( PositionSize positionSize, bool isTransparent );
399 WindowBaseEcoreX(const WindowBaseEcoreX&) = delete;
402 WindowBaseEcoreX& operator=(const WindowBaseEcoreX& rhs) = delete;
406 Dali::Vector< Ecore_Event_Handler* > mEcoreEventHandler;
407 Ecore_X_Window mEcoreWindow; ///< Native window handle
408 bool mOwnSurface:1; ///< Whether we own the surface (responsible for deleting it)
409 bool mIsTransparent; ///< Whether the window is transparent (32 bit or 24 bit)
410 bool mRotationAppSet:1;
413 } // namespace Adaptor
415 } // namespace internal
419 #endif // DALI_INTERNAL_WINDOWSYSTEM_ECOREX_WINDOW_BASE_ECORE_X_H