From 8364cef120b565c63fb38e6366ca1bce0c15f45d Mon Sep 17 00:00:00 2001 From: Richard Huang Date: Mon, 3 Jun 2019 17:14:56 +0100 Subject: [PATCH] Basic support of keyboard focus for multiple windows Change-Id: I5ff7a43ed9ea9c9b9437aa5973d9632b64245eff --- dali/devel-api/adaptor-framework/window-devel.h | 2 +- dali/integration-api/adaptor.h | 16 +++++++++++++ dali/internal/adaptor/common/adaptor-impl.cpp | 31 +++++++++++++++++++++++++ dali/internal/adaptor/common/adaptor-impl.h | 19 +++++++++++++-- dali/internal/adaptor/common/adaptor.cpp | 10 ++++++++ 5 files changed, 75 insertions(+), 3 deletions(-) diff --git a/dali/devel-api/adaptor-framework/window-devel.h b/dali/devel-api/adaptor-framework/window-devel.h index bbdac10..3da549e 100644 --- a/dali/devel-api/adaptor-framework/window-devel.h +++ b/dali/devel-api/adaptor-framework/window-devel.h @@ -53,7 +53,7 @@ DALI_ADAPTOR_API void SetPositionSize( Window window, PositionSize positionSize * @param[in] window The window instance * @return A valid handle to a RenderTaskList */ -Dali::RenderTaskList GetRenderTaskList( Window window ); +DALI_ADAPTOR_API Dali::RenderTaskList GetRenderTaskList( Window window ); /** * @brief Retrieve the window that the given actor is added to. diff --git a/dali/integration-api/adaptor.h b/dali/integration-api/adaptor.h index 25b5a6b..570ff19 100755 --- a/dali/integration-api/adaptor.h +++ b/dali/integration-api/adaptor.h @@ -44,6 +44,8 @@ namespace Dali class RenderSurfaceInterface; +using WindowContainer = std::vector; + namespace Integration { class SceneHolder; @@ -122,6 +124,7 @@ class DALI_ADAPTOR_API Adaptor public: typedef Signal< void (Adaptor&) > AdaptorSignalType; ///< Generic Type for adaptor signals + typedef Signal< void (Window&) > WindowCreatedSignalType; ///< Window created signal type public: /** @@ -427,6 +430,12 @@ public: */ void UnregisterProcessor( Integration::Processor& processor ); + /** + * @brief Get the list of windows created. + * @return The list of windows + */ + Dali::WindowContainer GetWindows() const; + public: // Signals /** @@ -444,6 +453,13 @@ public: // Signals */ AdaptorSignalType& LanguageChangedSignal(); + /** + * @brief This signal is emitted when a new window is created + * + * @return The signal to connect to + */ + WindowCreatedSignalType& WindowCreatedSignal(); + private: // Undefined diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index 6bce4d5..28417ee 100755 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -182,6 +182,12 @@ void Adaptor::Initialize( GraphicsFactory& graphicsFactory, Dali::Configuration: defaultWindow->SetAdaptor( Get() ); + Dali::Window window( dynamic_cast( ( &defaultWindow )->Get() ) ); + if ( window ) + { + mWindowCreatedSignal.Emit( window ); + } + const unsigned int timeInterval = mEnvironmentOptions->GetObjectProfilerInterval(); if( 0u < timeInterval ) { @@ -572,6 +578,13 @@ bool Adaptor::AddWindow( Dali::Integration::SceneHolder* childWindow, const std: // Add the new Window to the container - the order is not important mWindows.push_back( SceneHolderPtr( &windowImpl ) ); + + Dali::Window window( dynamic_cast( &windowImpl ) ); + if ( window ) + { + mWindowCreatedSignal.Emit( window ); + } + return true; } @@ -1008,9 +1021,27 @@ Dali::Internal::Adaptor::SceneHolder* Adaptor::GetWindow( Dali::Actor& actor ) return nullptr; } +Dali::WindowContainer Adaptor::GetWindows() const +{ + Dali::WindowContainer windows; + + for ( auto iter = mWindows.begin(); iter != mWindows.end(); ++iter ) + { + // Downcast to Dali::Window + Dali::Window window( dynamic_cast( iter->Get() ) ); + if ( window ) + { + windows.push_back( window ); + } + } + + return windows; +} + Adaptor::Adaptor(Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions) : mResizedSignal(), mLanguageChangedSignal(), + mWindowCreatedSignal(), mAdaptor( adaptor ), mState( READY ), mCore( nullptr ), diff --git a/dali/internal/adaptor/common/adaptor-impl.h b/dali/internal/adaptor/common/adaptor-impl.h index 29bb7d5..d36f8a6 100755 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -97,9 +97,10 @@ class Adaptor : public Integration::RenderController, { public: - typedef Dali::Adaptor::AdaptorSignalType AdaptorSignalType; + using AdaptorSignalType = Dali::Adaptor::AdaptorSignalType; + using WindowCreatedSignalType = Dali::Adaptor::WindowCreatedSignalType; - typedef Uint16Pair SurfaceSize; ///< Surface size type + using SurfaceSize = Uint16Pair; ///< Surface size type /** * Creates a New Adaptor @@ -302,6 +303,11 @@ public: // AdaptorInternalServices implementation */ Dali::Internal::Adaptor::SceneHolder* GetWindow( Dali::Actor& actor ); + /** + * @copydoc Dali::Adaptor::GetWindows() + */ + Dali::WindowContainer GetWindows() const; + public: /** @@ -503,6 +509,14 @@ public: // Signals return mLanguageChangedSignal; } + /** + * @copydoc Dali::Adaptor::WindowCreatedSignal + */ + WindowCreatedSignalType& WindowCreatedSignal() + { + return mWindowCreatedSignal; + } + public: // From Dali::Internal::Adaptor::CoreEventInterface /** @@ -632,6 +646,7 @@ private: // Data AdaptorSignalType mResizedSignal; ///< Resized signal. AdaptorSignalType mLanguageChangedSignal; ///< Language changed signal. + WindowCreatedSignalType mWindowCreatedSignal; ///< Window created signal. Dali::Adaptor& mAdaptor; ///< Reference to public adaptor instance. State mState; ///< Current state of the adaptor diff --git a/dali/internal/adaptor/common/adaptor.cpp b/dali/internal/adaptor/common/adaptor.cpp index a183350..17b0805 100755 --- a/dali/internal/adaptor/common/adaptor.cpp +++ b/dali/internal/adaptor/common/adaptor.cpp @@ -141,6 +141,11 @@ Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal() return mImpl->LanguageChangedSignal(); } +Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal() +{ + return mImpl->WindowCreatedSignal(); +} + Dali::RenderSurfaceInterface& Adaptor::GetSurface() { return mImpl->GetSurface(); @@ -236,6 +241,11 @@ void Adaptor::UnregisterProcessor( Integration::Processor& processor ) mImpl->UnregisterProcessor( processor ); } +Dali::WindowContainer Adaptor::GetWindows() const +{ + return mImpl->GetWindows(); +} + Adaptor::Adaptor() : mImpl( NULL ) { -- 2.7.4