From: Adeel Kazmi Date: Thu, 9 May 2019 16:32:24 +0000 (+0000) Subject: Merge "Add deprcated macro to newly deprecated Window API" into devel/master X-Git-Tag: dali_1.4.19~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=6e876b904e69dc4a74993c5dfc443e321daade20;hp=40cd039e420782d8ca8cc448b412fc3e883a3ca6 Merge "Add deprcated macro to newly deprecated Window API" into devel/master --- diff --git a/dali/devel-api/adaptor-framework/window-devel.cpp b/dali/devel-api/adaptor-framework/window-devel.cpp index 9453a93..2496c21 100644 --- a/dali/devel-api/adaptor-framework/window-devel.cpp +++ b/dali/devel-api/adaptor-framework/window-devel.cpp @@ -35,6 +35,11 @@ void SetPositionSize( Window window, PositionSize positionSize ) GetImplementation( window ).SetPositionSize( positionSize ); } +Window Get( Actor actor ) +{ + return Internal::Adaptor::Window::Get( actor ); +} + EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window ) { return GetImplementation( window ).EventProcessingFinishedSignal(); diff --git a/dali/devel-api/adaptor-framework/window-devel.h b/dali/devel-api/adaptor-framework/window-devel.h index 0006b2b..e80e55a 100644 --- a/dali/devel-api/adaptor-framework/window-devel.h +++ b/dali/devel-api/adaptor-framework/window-devel.h @@ -47,6 +47,14 @@ typedef Signal< void (const WheelEvent&) > WheelEventSignalType; ///< Touched DALI_ADAPTOR_API void SetPositionSize( Window window, PositionSize positionSize ); /** + * @brief Retrieve the window that the given actor is added to. + * + * @param[in] actor The actor + * @return The window the actor is added to or an empty handle if the actor is not added to any window. + */ +DALI_ADAPTOR_API Window Get( Actor actor ); + +/** * @brief This signal is emitted just after the event processing is finished. * * @param[in] window The window instance diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index 7406728..6899099 100755 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -966,6 +966,21 @@ bool Adaptor::ProcessCoreEventsFromIdle() return false; } +Dali::Internal::Adaptor::SceneHolder* Adaptor::GetWindow( Dali::Actor& actor ) +{ + Dali::Integration::Scene scene = Dali::Integration::Scene::Get( actor ); + + for( auto window : mWindows ) + { + if ( scene == window->GetScene() ) + { + return window.Get(); + } + } + + return nullptr; +} + Adaptor::Adaptor(Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions) : mResizedSignal(), mLanguageChangedSignal(), diff --git a/dali/internal/adaptor/common/adaptor-impl.h b/dali/internal/adaptor/common/adaptor-impl.h index ddcaf17..32df0ed 100755 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -294,6 +294,14 @@ public: // AdaptorInternalServices implementation */ bool RemoveWindow( Dali::Internal::Adaptor::SceneHolder* childWindow ); + /** + * @brief Retrieve the window that the given actor is added to. + * + * @param[in] actor The actor + * @return The window the actor is added to or a null pointer if the actor is not added to any widnow. + */ + Dali::Internal::Adaptor::SceneHolder* GetWindow( Dali::Actor& actor ); + public: /** diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index 9d24fee..d606f10 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -646,6 +646,18 @@ bool Window::SetRotationObserver( RotationObserver* observer ) return false; } +Dali::Window Window::Get( Dali::Actor actor ) +{ + Internal::Adaptor::Window* windowImpl = nullptr; + + if ( Internal::Adaptor::Adaptor::IsAvailable() ) + { + Dali::Internal::Adaptor::Adaptor& adaptor = Internal::Adaptor::Adaptor::GetImplementation( Internal::Adaptor::Adaptor::Get() ); + windowImpl = static_cast( adaptor.GetWindow( actor ) ); + } + + return Dali::Window( windowImpl ); +} } // Adaptor diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h index 3dd82d7..1249b3e 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -335,6 +335,11 @@ public: */ bool SetRotationObserver( RotationObserver* observer ); + /** + * @copydoc Dali::DevelWindow::Get() + */ + static Dali::Window Get( Dali::Actor actor ); + public: // Dali::Internal::Adaptor::SceneHolder /**