From: Paul Wisbey Date: Thu, 28 Jul 2016 12:13:32 +0000 (+0100) Subject: VR: Merge devel/master into devel/new_vr branch X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e930b69d75e94e68c9006d99a2b99ffce0184ced;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git VR: Merge devel/master into devel/new_vr branch Change-Id: Ia9f7418b19791d87e48be222d3ce60664741687b --- diff --git a/adaptors/base/display-connection.cpp b/adaptors/base/display-connection.cpp index 1dc44e920..d34a14f42 100644 --- a/adaptors/base/display-connection.cpp +++ b/adaptors/base/display-connection.cpp @@ -34,6 +34,14 @@ DisplayConnection* DisplayConnection::New() return new DisplayConnection(internal); } +DisplayConnection* DisplayConnection::New( RenderSurface::Type type ) +{ + Internal::Adaptor::DisplayConnection* internal(Internal::Adaptor::DisplayConnection::New()); + internal->SetSurfaceType( type ); + + return new DisplayConnection(internal); +} + DisplayConnection::DisplayConnection() : mImpl( NULL ) { diff --git a/adaptors/base/display-connection.h b/adaptors/base/display-connection.h index e38cc78d2..e59f74c86 100644 --- a/adaptors/base/display-connection.h +++ b/adaptors/base/display-connection.h @@ -22,6 +22,7 @@ #include // INTERNAL INCLUDES +#include namespace Dali @@ -48,6 +49,15 @@ public: */ static DisplayConnection* New(); + /** + * @brief Create an initialized DisplayConnection. + * Native surface will need this instead of DisplayConnection::New() + * + * @param[in] type Render surface type + * @return A handle to a newly allocated DisplayConnection resource. + */ + static DisplayConnection* New( RenderSurface::Type type ); + /** * @brief Create a DisplayConnection handle; this can be initialised with DisplayConnection::New(). * diff --git a/adaptors/base/render-helper.cpp b/adaptors/base/render-helper.cpp index d3a771aab..b4ee99943 100644 --- a/adaptors/base/render-helper.cpp +++ b/adaptors/base/render-helper.cpp @@ -43,7 +43,14 @@ RenderHelper::RenderHelper( AdaptorInternalServices& adaptorInterfaces ) // set the initial values before render thread starts mSurface = adaptorInterfaces.GetRenderSurfaceInterface(); - mDisplayConnection = Dali::DisplayConnection::New(); + if( mSurface ) + { + mDisplayConnection = Dali::DisplayConnection::New( mSurface->GetSurfaceType() ); + } + else + { + mDisplayConnection = Dali::DisplayConnection::New(); + } } RenderHelper::~RenderHelper() diff --git a/adaptors/common/adaptor-impl.cpp b/adaptors/common/adaptor-impl.cpp index b39744792..bacca1429 100644 --- a/adaptors/common/adaptor-impl.cpp +++ b/adaptors/common/adaptor-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -470,6 +470,10 @@ bool Adaptor::AddIdle( CallbackBase* callback ) return idleAdded; } +void Adaptor::RemoveIdle( CallbackBase* callback ) +{ + mCallbackManager->RemoveIdleCallback( callback ); +} Dali::Adaptor& Adaptor::Get() { diff --git a/adaptors/common/adaptor-impl.h b/adaptors/common/adaptor-impl.h index 056ad47b1..e52a190d4 100644 --- a/adaptors/common/adaptor-impl.h +++ b/adaptors/common/adaptor-impl.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_ADAPTOR_IMPL_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -221,6 +221,11 @@ public: // AdaptorInternalServices implementation */ virtual bool AddIdle( CallbackBase* callback ); + /** + * @copydoc Dali::Adaptor::RemoveIdle() + */ + virtual void RemoveIdle( CallbackBase* callback ); + public: /** diff --git a/adaptors/common/adaptor.cpp b/adaptors/common/adaptor.cpp index 9c6701c73..a2e80adbc 100644 --- a/adaptors/common/adaptor.cpp +++ b/adaptors/common/adaptor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,6 +84,11 @@ bool Adaptor::AddIdle( CallbackBase* callback ) return mImpl->AddIdle( callback ); } +void Adaptor::RemoveIdle( CallbackBase* callback ) +{ + mImpl->RemoveIdle( callback ); +} + void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface ) { mImpl->ReplaceSurface(nativeWindow, surface); diff --git a/adaptors/common/application-impl.cpp b/adaptors/common/application-impl.cpp index c471eb315..fca53370d 100644 --- a/adaptors/common/application-impl.cpp +++ b/adaptors/common/application-impl.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include //TODOVR @@ -353,6 +354,11 @@ void Application::ReplaceWindow(PositionSize windowPosition, const std::string& mWindow = newWindow; } +std::string Application::GetResourcePath() +{ + return Internal::Adaptor::Framework::GetResourcePath(); +} + } // namespace Adaptor } // namespace Internal diff --git a/adaptors/common/application-impl.h b/adaptors/common/application-impl.h index 68de173f7..506496f19 100644 --- a/adaptors/common/application-impl.h +++ b/adaptors/common/application-impl.h @@ -106,6 +106,11 @@ public: */ void ReplaceWindow(PositionSize windowPosition, const std::string& name); + /** + * @copydoc Dali::Application::GetResourcePath(); + */ + static std::string GetResourcePath(); + public: // Stereoscopy /** diff --git a/adaptors/common/callback-manager.h b/adaptors/common/callback-manager.h index 20f87986c..fc16aca37 100644 --- a/adaptors/common/callback-manager.h +++ b/adaptors/common/callback-manager.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_CALLBACK_MANAGER_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,14 +50,25 @@ public: virtual ~CallbackManager() {} /** - * Adds a call back to be run on idle. - * Must be call from main thread only. - * @param callback custom call back function - * @param priority call back priority + * @brief Adds a @p callback to be run on idle. + * @note Must be called from the main thread only. + * + * @param[in] callback custom callback function. + * * @return true on success */ virtual bool AddIdleCallback( CallbackBase* callback ) = 0; + /** + * @brief Removes a previously added @p callback. + * @note Must be called from main thread only. + * + * Does nothing if the @p callback doesn't exist. + * + * @param[in] callback The callback to be removed. + */ + virtual void RemoveIdleCallback( CallbackBase* callback ) = 0; + /** * Starts the callback manager. */ diff --git a/adaptors/common/clipboard-impl.h b/adaptors/common/clipboard-impl.h index da164a99a..75f70e993 100644 --- a/adaptors/common/clipboard-impl.h +++ b/adaptors/common/clipboard-impl.h @@ -66,9 +66,9 @@ public: bool SetItem(const std::string &itemData); /** - * @copydoc Dali::Clipboard::GetItem() + * @copydoc Dali::Clipboard::RequestItem() */ - std::string GetItem( unsigned int index ); + void RequestItem(); /** * @copydoc Dali::Clipboard::NumberOfClipboardItems() @@ -83,7 +83,21 @@ public: /** * @copydoc Dali::Clipboard::HideClipboard() */ - void HideClipboard(); + void HideClipboard(bool skipFirstHide); + + /** + * @copydoc Dali::Clipboard::IsVisible() + */ + bool IsVisible() const; + + /** + * @brief exchange either sending or receiving buffered data + * + * @param[in] type true for send buffered data, false for receive data to buffer + * @param[in] event information pointer + * @return The buffer pointer for send or receive data + */ + char* ExcuteBuffered( bool type, void *event ); private: @@ -95,26 +109,27 @@ private: Impl* mImpl; -}; // class clipboard +public: +}; // class clipboard } // namespace Adaptor } // namespace Internal - inline static Internal::Adaptor::Clipboard& GetImplementation(Dali::Clipboard& clipboard) - { - DALI_ASSERT_ALWAYS( clipboard && "Clipboard handle is empty" ); - BaseObject& handle = clipboard.GetBaseObject(); - return static_cast(handle); - } - - inline static const Internal::Adaptor::Clipboard& GetImplementation(const Dali::Clipboard& clipboard) - { - DALI_ASSERT_ALWAYS( clipboard && "Clipboard handle is empty" ); - const BaseObject& handle = clipboard.GetBaseObject(); - return static_cast(handle); - } +inline static Internal::Adaptor::Clipboard& GetImplementation(Dali::Clipboard& clipboard) +{ + DALI_ASSERT_ALWAYS( clipboard && "Clipboard handle is empty" ); + BaseObject& handle = clipboard.GetBaseObject(); + return static_cast(handle); +} + +inline static const Internal::Adaptor::Clipboard& GetImplementation(const Dali::Clipboard& clipboard) +{ + DALI_ASSERT_ALWAYS( clipboard && "Clipboard handle is empty" ); + const BaseObject& handle = clipboard.GetBaseObject(); + return static_cast(handle); +} } // namespace Dali diff --git a/adaptors/common/event-loop/ecore/ecore-callback-manager.cpp b/adaptors/common/event-loop/ecore/ecore-callback-manager.cpp index b6e5f3cd9..77b525e5d 100644 --- a/adaptors/common/event-loop/ecore/ecore-callback-manager.cpp +++ b/adaptors/common/event-loop/ecore/ecore-callback-manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -120,7 +120,7 @@ bool EcoreCallbackManager::AddIdleCallback( CallbackBase* callback ) return false; } - CallbackData *callbackData = new CallbackData( callback ); + CallbackData* callbackData = new CallbackData( callback ); callbackData->mRemoveFromContainerFunction = MakeCallback( this, &EcoreCallbackManager::RemoveCallbackFromContainer ); @@ -135,6 +135,25 @@ bool EcoreCallbackManager::AddIdleCallback( CallbackBase* callback ) return true; } +void EcoreCallbackManager::RemoveIdleCallback( CallbackBase* callback ) +{ + for( CallbackList::iterator it = mCallbackContainer.begin(), + endIt = mCallbackContainer.end(); + it != endIt; + ++it ) + { + CallbackData* data = *it; + + if( data->mCallback == callback ) + { + // remove callback data from the container. + CallbackBase::Execute( *data->mRemoveFromContainerFunction, data ); + + ecore_idler_del( data->mIdler ); + } + } +} + void EcoreCallbackManager::RemoveCallbackFromContainer(CallbackData *callbackData) { mCallbackContainer.remove(callbackData); diff --git a/adaptors/common/event-loop/ecore/ecore-callback-manager.h b/adaptors/common/event-loop/ecore/ecore-callback-manager.h index f93cc72b7..a158a4ec4 100644 --- a/adaptors/common/event-loop/ecore/ecore-callback-manager.h +++ b/adaptors/common/event-loop/ecore/ecore-callback-manager.h @@ -2,7 +2,7 @@ #define __DALI_ECORE_CALLBACK_MANAGER_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,10 +57,15 @@ public: } /** - * @copydoc CallbackManager::AddCallback() + * @copydoc CallbackManager::AddIdleCallback() */ virtual bool AddIdleCallback( CallbackBase* callback ); + /** + * @copydoc CallbackManager::RemoveIdleCallback() + */ + virtual void RemoveIdleCallback( CallbackBase* callback ); + /** * @copydoc CallbackManager::Start() */ diff --git a/adaptors/common/event-loop/lib-uv/uv-callback-manager.cpp b/adaptors/common/event-loop/lib-uv/uv-callback-manager.cpp index ab8552dcd..9aca9c8c8 100644 --- a/adaptors/common/event-loop/lib-uv/uv-callback-manager.cpp +++ b/adaptors/common/event-loop/lib-uv/uv-callback-manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -154,7 +154,7 @@ bool UvCallbackManager::AddIdleCallback( CallbackBase* callback ) return false; } - CallbackData *callbackData = new CallbackData(callback ); + CallbackData *callbackData = new CallbackData( callback ); // To inform the manager a callback has finished, we get it to call RemoveCallbackFromContainer callbackData->mRemoveFromContainerFunction = MakeCallback( this, &UvCallbackManager::RemoveCallbackFromContainer ); @@ -168,6 +168,25 @@ bool UvCallbackManager::AddIdleCallback( CallbackBase* callback ) return true; } +void UvCallbackManager::RemoveIdleCallback( CallbackBase* callback ) +{ + for( CallbackList::iterator it = mCallbackContainer.begin(), + endIt = mCallbackContainer.end(); + it != endIt; + ++it ) + { + CallbackData* data = *it; + + if( data->mCallback == callback ) + { + // remove callback data from the container. + CallbackBase::Execute( *data->mRemoveFromContainerFunction, data ); + + delete data; + } + } +} + void UvCallbackManager::RemoveCallbackFromContainer(CallbackData *callbackData) { mCallbackContainer.remove(callbackData); diff --git a/adaptors/common/event-loop/lib-uv/uv-callback-manager.h b/adaptors/common/event-loop/lib-uv/uv-callback-manager.h index 78abab674..0fcc2c1e1 100644 --- a/adaptors/common/event-loop/lib-uv/uv-callback-manager.h +++ b/adaptors/common/event-loop/lib-uv/uv-callback-manager.h @@ -2,7 +2,7 @@ #define __DALI_UV_CALLBACK_MANAGER_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,10 +56,15 @@ public: ~UvCallbackManager(){} /** - * @copydoc CallbackManager::AddCallback() + * @copydoc CallbackManager::AddIdleCallback() */ virtual bool AddIdleCallback( CallbackBase* callback ); + /** + * @copydoc CallbackManager::RemoveIdleCallback() + */ + virtual void RemoveIdleCallback( CallbackBase* callback ); + /** * @copydoc CallbackManager::Start() */ diff --git a/adaptors/common/framework.h b/adaptors/common/framework.h index 4dacf5f58..6037d57ec 100644 --- a/adaptors/common/framework.h +++ b/adaptors/common/framework.h @@ -38,9 +38,12 @@ namespace Adaptor { /** - * The Framework class is used to register callbacks with the TIZEN platform so that + * The Framework class is ideally placed to provide key API required by Applications. + * + * The class is also used to register callbacks with the TIZEN platform so that * we know when any of the application lifecycle events occur. This includes events * like when our application is to be initialised, terminated, paused, resumed etc. + * */ class Framework { @@ -179,6 +182,11 @@ public: */ std::string GetBundleId() const; + /** + * Gets the path at which application resources are stored. + */ + static std::string GetResourcePath(); + private: // Undefined diff --git a/adaptors/devel-api/adaptor-framework/clipboard.cpp b/adaptors/devel-api/adaptor-framework/clipboard.cpp index 95f1b5281..38264a50c 100644 --- a/adaptors/devel-api/adaptor-framework/clipboard.cpp +++ b/adaptors/devel-api/adaptor-framework/clipboard.cpp @@ -39,14 +39,15 @@ Clipboard Clipboard::Get() { return Internal::Adaptor::Clipboard::Get(); } + bool Clipboard::SetItem( const std::string &itemData) { return GetImplementation(*this).SetItem( itemData ); } -std::string Clipboard::GetItem( unsigned int index ) +void Clipboard::RequestItem() { - return GetImplementation(*this).GetItem( index ); + GetImplementation(*this).RequestItem(); } unsigned int Clipboard::NumberOfItems() @@ -61,7 +62,12 @@ void Clipboard::ShowClipboard() void Clipboard::HideClipboard() { - GetImplementation(*this).HideClipboard(); + GetImplementation(*this).HideClipboard(false); +} + +bool Clipboard::IsVisible() const +{ + return GetImplementation(*this).IsVisible(); } } // namespace Dali diff --git a/adaptors/devel-api/adaptor-framework/clipboard.h b/adaptors/devel-api/adaptor-framework/clipboard.h index 9b5a54a60..5d84c8f71 100644 --- a/adaptors/devel-api/adaptor-framework/clipboard.h +++ b/adaptors/devel-api/adaptor-framework/clipboard.h @@ -2,7 +2,7 @@ #define __DALI_CLIPBOARD_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,12 +82,12 @@ public: bool SetItem( const std::string& itemData ); /** - * @brief Retreive the string at the given index in the clipboard. + * @brief Request clipboard service to retrieve an item * - * @param[in] index item in clipboard list to retrieve - * @return string the text item at the current index. + * Calling this method will trigger a signal from the clipboard event notifier. + * @see Dali::ClipboardEventNotifier::ContentSelectedSignal() */ - std::string GetItem( unsigned int index ); + void RequestItem(); /** * @brief Returns the number of item currently in the clipboard. @@ -106,6 +106,12 @@ public: */ void HideClipboard(); + /** + * @brief Retrieves the clipboard's visibility + * @return bool true if the clipboard is visible. + */ + bool IsVisible() const; + }; } // namespace Dali diff --git a/adaptors/devel-api/adaptor-framework/imf-manager.cpp b/adaptors/devel-api/adaptor-framework/imf-manager.cpp index f083c8b1f..441060928 100644 --- a/adaptors/devel-api/adaptor-framework/imf-manager.cpp +++ b/adaptors/devel-api/adaptor-framework/imf-manager.cpp @@ -88,6 +88,11 @@ const std::string& ImfManager::GetSurroundingText() const return Internal::Adaptor::ImfManager::GetImplementation(*this).GetSurroundingText(); } +void ImfManager::NotifyTextInputMultiLine( bool multiLine ) +{ + Internal::Adaptor::ImfManager::GetImplementation(*this).NotifyTextInputMultiLine( multiLine ); +} + ImfManager::ImfManagerSignalType& ImfManager::ActivatedSignal() { return Internal::Adaptor::ImfManager::GetImplementation(*this).ActivatedSignal(); diff --git a/adaptors/devel-api/adaptor-framework/imf-manager.h b/adaptors/devel-api/adaptor-framework/imf-manager.h index a674ce777..8123b9dae 100644 --- a/adaptors/devel-api/adaptor-framework/imf-manager.h +++ b/adaptors/devel-api/adaptor-framework/imf-manager.h @@ -211,6 +211,13 @@ public: */ const std::string& GetSurroundingText() const; + /** + * @brief Notifies IMF context that text input is set to multi line or not + * + * @param[in] multiLine True if multiline text input is used + */ + void NotifyTextInputMultiLine( bool multiLine ); + public: // Signals diff --git a/adaptors/devel-api/adaptor-framework/render-surface.h b/adaptors/devel-api/adaptor-framework/render-surface.h index 28441053b..61fd74d79 100644 --- a/adaptors/devel-api/adaptor-framework/render-surface.h +++ b/adaptors/devel-api/adaptor-framework/render-surface.h @@ -62,6 +62,13 @@ class RenderSurface { public: + enum Type + { + ECORE_RENDER_SURFACE, + WAYLAND_RENDER_SURFACE, + NATIVE_RENDER_SURFACE + }; + /** * @brief Constructor * Inlined as this is a pure abstract interface @@ -157,6 +164,8 @@ public: */ virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) = 0; + virtual RenderSurface::Type GetSurfaceType() = 0; + private: /** diff --git a/adaptors/ecore/common/ecore-indicator-impl.cpp b/adaptors/ecore/common/ecore-indicator-impl.cpp index a57aaa698..b954b6965 100644 --- a/adaptors/ecore/common/ecore-indicator-impl.cpp +++ b/adaptors/ecore/common/ecore-indicator-impl.cpp @@ -21,6 +21,11 @@ // EXTERNAL INCLUDES #include #include +#ifdef WAYLAND +#include +#else +#include +#endif #include #include @@ -148,6 +153,8 @@ const char* INDICATOR_SERVICE_NAME("elm_indicator"); // Copied from ecore_evas_extn_engine.h +#define NBUF 2 + enum // opcodes { OP_RESIZE, @@ -175,7 +182,8 @@ enum // opcodes OP_EV_KEY_DOWN, OP_EV_HOLD, OP_MSG_PARENT, - OP_MSG + OP_MSG, + OP_PIXMAP_REF, }; // Copied from elm_conform.c @@ -285,6 +293,107 @@ namespace Adaptor Debug::Filter* gIndicatorLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_INDICATOR"); #endif +// Impl to hide EFL implementation. + +struct Indicator::Impl +{ + enum // operation mode + { + INDICATOR_HIDE, + INDICATOR_STAY_WITH_DURATION + }; + + /** + * Constructor + */ + Impl(Indicator* indicator) + : mIndicator(indicator), + mEcoreEventHandler(NULL) + { +#if defined(DALI_PROFILE_MOBILE) +#if defined(WAYLAND) + mEcoreEventHandler = ecore_event_handler_add(ECORE_WL_EVENT_INDICATOR_FLICK, EcoreEventIndicator, this); +#else + mEcoreEventHandler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, EcoreEventClientMessage, this); +#endif +#endif // WAYLAND && DALI_PROFILE_MOBILE + } + + /** + * Destructor + */ + ~Impl() + { + if ( mEcoreEventHandler ) + { + ecore_event_handler_del(mEcoreEventHandler); + } + } + + static void SetIndicatorVisibility( void* data, int operation ) + { + Indicator::Impl* indicatorImpl((Indicator::Impl*)data); + + if ( indicatorImpl == NULL || indicatorImpl->mIndicator == NULL) + { + return; + } + if ( operation == INDICATOR_STAY_WITH_DURATION ) + { + // if indicator is not showing, INDICATOR_FLICK_DONE is given + if( indicatorImpl->mIndicator->mVisible == Dali::Window::AUTO && + !indicatorImpl->mIndicator->mIsShowing ) + { + indicatorImpl->mIndicator->ShowIndicator( AUTO_INDICATOR_STAY_DURATION ); + } + } + else if( operation == INDICATOR_HIDE ) + { + if( indicatorImpl->mIndicator->mVisible == Dali::Window::AUTO && + indicatorImpl->mIndicator->mIsShowing ) + { + indicatorImpl->mIndicator->ShowIndicator( HIDE_NOW ); + } + } + } +#if defined(DALI_PROFILE_MOBILE) +#if defined(WAYLAND) + /** + * Called when the Ecore indicator event is received. + */ + static Eina_Bool EcoreEventIndicator( void* data, int type, void* event ) + { + SetIndicatorVisibility( data, INDICATOR_STAY_WITH_DURATION ); + return ECORE_CALLBACK_PASS_ON; + } +#else + /** + * Called when the client messages (i.e. quick panel state) are received. + */ + static Eina_Bool EcoreEventClientMessage( void* data, int type, void* event ) + { + Ecore_X_Event_Client_Message* clientMessageEvent((Ecore_X_Event_Client_Message*)event); + + if ( clientMessageEvent != NULL ) + { + if (clientMessageEvent->message_type == ECORE_X_ATOM_E_INDICATOR_FLICK_DONE) + { + SetIndicatorVisibility( data, INDICATOR_STAY_WITH_DURATION ); + } + else if ( clientMessageEvent->message_type == ECORE_X_ATOM_E_MOVE_QUICKPANEL_STATE ) + { + SetIndicatorVisibility( data, INDICATOR_HIDE ); + } + } + return ECORE_CALLBACK_PASS_ON; + } +#endif +#endif // WAYLAND && DALI_PROFILE_MOBILE + + // Data + Indicator* mIndicator; + Ecore_Event_Handler* mEcoreEventHandler; +}; Indicator::LockFile::LockFile(const std::string filename) : mFilename(filename), @@ -392,6 +501,8 @@ Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientat mIsShowing( true ), mIsAnimationPlaying( false ), mCurrentSharedFile( 0 ), + mSharedBufferType( BUFFER_TYPE_SHM ), + mImpl( NULL ), mBackgroundVisible( false ) { mIndicatorContentActor = Dali::Actor::New(); @@ -429,10 +540,19 @@ Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientat } // hide the indicator by default mIndicatorActor.SetVisible( false ); + + // create impl to handle ecore event + mImpl = new Impl(this); } Indicator::~Indicator() { + if(mImpl) + { + delete mImpl; + mImpl = NULL; + } + if(mEventActor) { mEventActor.TouchedSignal().Disconnect( this, &Indicator::OnTouched ); @@ -541,9 +661,22 @@ void Indicator::SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool { UpdateImageData( mCurrentSharedFile ); } - if ( visibleMode != Dali::Window::INVISIBLE ) + + if ( visibleMode == Dali::Window::INVISIBLE ) + { + if (mServerConnection) + { + mServerConnection->SendEvent( OP_HIDE, NULL, 0 ); + } + } + else { mIndicatorActor.SetVisible( true ); + + if( mServerConnection ) + { + mServerConnection->SendEvent( OP_SHOW, NULL, 0 ); + } } mVisible = visibleMode; @@ -566,6 +699,10 @@ void Indicator::SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool ShowIndicator( HIDE_NOW ); } } + else + { + mIsShowing = false; + } } } @@ -620,6 +757,7 @@ bool Indicator::OnTouched(Dali::Actor indicator, const Dali::TouchEvent& touchEv break; case Dali::PointState::UP: + case Dali::PointState::INTERRUPTED: { IpcDataEvMouseUp ipcUp( touchEvent.time ); mServerConnection->SendEvent( OP_EV_MOUSE_UP, &ipcUp, sizeof(ipcUp) ); @@ -814,6 +952,11 @@ void Indicator::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent ) // epcEvent->ref_to == sys // epcEvent->response == buffer num + if ( mSharedBufferType != BUFFER_TYPE_SHM ) + { + return ; + } + int n = epcEvent->response; if( n >= 0 && n < SHARED_FILE_NUMBER ) @@ -846,19 +989,7 @@ void Indicator::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent ) } CreateNewImage( n ); - - if( CheckVisibleState() ) - { - // set default indicator type (enable the quick panel) - OnIndicatorTypeChanged( INDICATOR_TYPE_1 ); - } - else - { - // set default indicator type (disable the quick panel) - OnIndicatorTypeChanged( INDICATOR_TYPE_2 ); - } - - SetVisible(mVisible, true); + UpdateVisibility(); } } } @@ -867,38 +998,43 @@ void Indicator::LoadPixmapImage( Ecore_Ipc_Event_Server_Data *epcEvent ) { DALI_LOG_TRACE_METHOD( gIndicatorLogFilter ); - // epcEvent->ref == w - // epcEvent->ref_to == h - // epcEvent->response == alpha - // epcEvent->data = pixmap id + // epcEvent->ref == pixmap id + // epcEvent->ref_to == type + // epcEvent->response == buffer num - if( ( epcEvent->data ) && - (epcEvent->size >= (int)sizeof(PixmapId)) ) + if( (epcEvent->ref > 0) && (epcEvent->ref_to > 0) ) { + mSharedBufferType = (BufferType)(epcEvent->ref_to); + ClearSharedFileInfo(); - if( (epcEvent->ref > 0) && (epcEvent->ref_to > 0) ) - { - mImageWidth = epcEvent->ref; - mImageHeight = epcEvent->ref_to; + mPixmap = static_cast(epcEvent->ref); + DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "mPixmap [%x]", mPixmap); - mPixmap = *(static_cast(epcEvent->data)); - CreateNewPixmapImage(); + CreateNewPixmapImage(); + UpdateVisibility(); + } +} - if( CheckVisibleState() ) - { - // set default indicator type (enable the quick panel) - OnIndicatorTypeChanged( INDICATOR_TYPE_1 ); - } - else - { - // set default indicator type (disable the quick panel) - OnIndicatorTypeChanged( INDICATOR_TYPE_2 ); - } +void Indicator::UpdateVisibility() +{ + if( CheckVisibleState() ) + { + // set default indicator type (enable the quick panel) + OnIndicatorTypeChanged( INDICATOR_TYPE_1 ); + } + else + { + // set default indicator type (disable the quick panel) + OnIndicatorTypeChanged( INDICATOR_TYPE_2 ); + } - SetVisible(mVisible, true); - } + if( !mIsShowing ) + { + mIndicatorContentActor.SetPosition( 0.0f, -mImageHeight, 0.0f ); } + + SetVisible(mVisible, true); } void Indicator::UpdateImageData( int bufferNumber ) @@ -1174,7 +1310,7 @@ void Indicator::DataReceived( void* event ) DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_UPDATE\n" ); if( mIsShowing ) { - mAdaptor->RequestUpdateOnce(); + //mAdaptor->RequestUpdateOnce(); } break; } @@ -1182,7 +1318,7 @@ void Indicator::DataReceived( void* event ) { DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_UPDATE_DONE [%d]\n", epcEvent->response ); // epcEvent->response == display buffer # - UpdateImageData( epcEvent->response ); + //UpdateImageData( epcEvent->response ); break; } case OP_SHM_REF0: @@ -1203,6 +1339,12 @@ void Indicator::DataReceived( void* event ) LoadSharedImage( epcEvent ); break; } + case OP_PIXMAP_REF: + { + DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_PIXMAP_REF\n" ); + LoadPixmapImage( epcEvent ); + break; + } case OP_RESIZE: { DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_RESIZE\n" ); @@ -1256,7 +1398,6 @@ void Indicator::DataReceived( void* event ) } break; } - } } break; @@ -1281,7 +1422,8 @@ bool Indicator::CheckVisibleState() { if( mOrientation == Dali::Window::LANDSCAPE || mOrientation == Dali::Window::LANDSCAPE_INVERSE - || (mVisible != Dali::Window::VISIBLE) ) + || (mVisible == Dali::Window::INVISIBLE) + || (mVisible == Dali::Window::AUTO && !mIsShowing) ) { return false; } @@ -1332,6 +1474,8 @@ void Indicator::ShowIndicator(float duration) } else { + mIndicatorAnimation.Clear(); + if( EqualsZero(duration) ) { mIndicatorAnimation.AnimateTo( Property( mIndicatorContentActor, Dali::Actor::Property::POSITION ), Vector3(0, -mImageHeight, 0), Dali::AlphaFunction::EASE_OUT ); @@ -1396,17 +1540,16 @@ void Indicator::OnAnimationFinished(Dali::Animation& animation) { mIsAnimationPlaying = false; // once animation is finished and indicator is hidden, take it off stage - if( !mIsShowing ) + if( mObserver != NULL ) { - if( mObserver != NULL ) - { - mObserver->IndicatorVisibilityChanged( mIsShowing ); // is showing? - } + mObserver->IndicatorVisibilityChanged( mIsShowing ); // is showing? } } void Indicator::OnPan( Dali::Actor actor, const Dali::PanGesture& gesture ) { + return ; + if( mServerConnection ) { switch( gesture.state ) @@ -1470,7 +1613,11 @@ void Indicator::OnStageTouched(const Dali::TouchEvent& touchEvent) { case Dali::PointState::DOWN: { - ShowIndicator( HIDE_NOW ); + // if touch point is inside the indicator, indicator is not hidden + if( mImageHeight < int(touchPoint.screen.y) ) + { + ShowIndicator( HIDE_NOW ); + } break; } diff --git a/adaptors/ecore/common/ecore-indicator-impl.h b/adaptors/ecore/common/ecore-indicator-impl.h index 801c12e1d..53e93d119 100644 --- a/adaptors/ecore/common/ecore-indicator-impl.h +++ b/adaptors/ecore/common/ecore-indicator-impl.h @@ -62,6 +62,16 @@ public: CONNECTED }; + /** + * copied from ecore_evas_extn_engine.h + */ + enum BufferType + { + BUFFER_TYPE_SHM = 0, ///< shared memory-based buffer backend + BUFFER_TYPE_DRI2_PIXMAP, ///< dri2 pixmap-based buffer backend + BUFFER_TYPE_EVASGL_PIXMAP, ///< pixmap backend for Evas GL only (DEPRECATED) + BUFFER_TYPE_GL_PIXMAP, ///< double buffered GL pixmap backend + }; protected: /** @@ -279,6 +289,11 @@ private: */ void LoadPixmapImage( Ecore_Ipc_Event_Server_Data *epcEvent ); + /** + * Update the visibility and position of the actors + */ + void UpdateVisibility(); + /** * Inform dali that the indicator data has been updated. * @param[in] bufferNumber The shared file number @@ -424,6 +439,11 @@ private: int mCurrentSharedFile; ///< Current shared file number SharedFileInfo mSharedFileInfo[SHARED_FILE_NUMBER]; ///< Table to store shared file info + BufferType mSharedBufferType; ///< Shared buffer type which is used to render indicator + + struct Impl; ///< Contains Ecore specific information + Impl* mImpl; ///< Created on construction and destroyed on destruction. + bool mBackgroundVisible; ///< Indicate whether background is visible }; diff --git a/adaptors/ecore/wayland/clipboard-impl-ecore-wl.cpp b/adaptors/ecore/wayland/clipboard-impl-ecore-wl.cpp index cea687c15..1744b2dbe 100644 --- a/adaptors/ecore/wayland/clipboard-impl-ecore-wl.cpp +++ b/adaptors/ecore/wayland/clipboard-impl-ecore-wl.cpp @@ -24,21 +24,22 @@ #include #include #include +#include + +#ifdef DALI_ELDBUS_AVAILABLE +#include +#endif // DALI_ELDBUS_AVAILABLE // INTERNAL INCLUDES #include -namespace //unnamed namespace -{ -const char* const CBHM_WINDOW = "CBHM_XWIN"; -const char* const CBHM_MSG = "CBHM_MSG"; -const char* const CBHM_ITEM = "CBHM_ITEM"; -const char* const CBHM_cCOUNT = "CBHM_cCOUNT"; -const char* const CBHM_ERROR = "CBHM_ERROR"; -const char* const SET_ITEM = "SET_ITEM"; -const char* const SHOW = "show0"; -const char* const HIDE = "cbhm_hide"; -} +#define CBHM_DBUS_OBJPATH "/org/tizen/cbhm/dbus" +#ifndef CBHM_DBUS_INTERFACE +#define CBHM_DBUS_INTERFACE "org.tizen.cbhm.dbus" +#endif /* CBHM_DBUS_INTERFACE */ + +#define CLIPBOARD_STR "CLIPBOARD_STR" +#define CLIPBOARD_BUFFER_SIZE 512 /////////////////////////////////////////////////////////////////////////////////////////////////// // Clipboard @@ -55,7 +56,168 @@ namespace Adaptor struct Clipboard::Impl { - // Put implementation here. + Impl() + { + Eldbus_Object *eldbus_obj; + cbhm_conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION); + eldbus_obj = eldbus_object_get(cbhm_conn, CBHM_DBUS_INTERFACE, CBHM_DBUS_OBJPATH); + eldbus_proxy = eldbus_proxy_get(eldbus_obj, CBHM_DBUS_INTERFACE); + eldbus_name_owner_changed_callback_add(cbhm_conn, CBHM_DBUS_INTERFACE, NULL, cbhm_conn, EINA_TRUE); + eldbus_proxy_signal_handler_add(eldbus_proxy, "ItemClicked", _on_item_clicked, this); + mVisible = false; + mIsFirstTimeHidden = true; + } + + ~Impl() + { + if (cbhm_conn) + eldbus_connection_unref(cbhm_conn); + } + + Eldbus_Proxy* cbhm_proxy_get() + { + return eldbus_proxy; + } + + Eldbus_Connection* cbhm_connection_get() + { + return cbhm_conn; + } + + void SetItem( const std::string &itemData ) + { + const char *data = itemData.c_str(); + const char *types[10] = {0, }; + int i = -1; + + if (data == NULL) + { + return; + } + strcpy(mSendBuf, data); + + // ELM_SEL_TYPE_CLIPBOARD - To distinguish clipboard selection in cbhm + types[++i] = "CLIPBOARD_BEGIN"; + + types[++i] = "application/x-elementary-markup"; + types[++i] = "text/plain"; + types[++i] = "text/plain;charset=utf-8"; + + // ELM_SEL_TYPE_CLIPBOARD - To distinguish clipboard selection in cbhm + types[++i] = "CLIPBOARD_END"; + ecore_wl_dnd_selection_set(ecore_wl_input_get(), types); + } + + void RequestItem() + { + const char *types[10] = {0, }; + int i = -1; + + types[++i] = "application/x-elementary-markup"; + types[++i] = "text/plain"; + types[++i] = "text/plain;charset=utf-8"; + ecore_wl_dnd_selection_get(ecore_wl_input_get(), *types); + } + + char *ExcuteSend( void *event ) + { + Ecore_Wl_Event_Data_Source_Send *ev = (Ecore_Wl_Event_Data_Source_Send *)event; + int len_buf = strlen(mSendBuf); + int len_remained = len_buf; + int len_written = 0, ret; + char *buf = mSendBuf; + + while (len_written < len_buf) + { + ret = write(ev->fd, buf, len_remained); + if (ret == -1) break; + buf += ret; + len_written += ret; + len_remained -= ret; + } + close(ev->fd); + return (char *)mSendBuf; + } + + char *ExcuteReceive( void *event ) + { + Ecore_Wl_Event_Selection_Data_Ready *ev = (Ecore_Wl_Event_Selection_Data_Ready *)event; + + strncpy(mReceiveBuf, (char *)ev->data, ev->len); + mReceiveBuf[ev->len] = '\0'; + return (char *)mReceiveBuf; + } + + int GetCount() + { + Eldbus_Message *reply, *req; + const char *errname = NULL, *errmsg = NULL; + int count = -1; + + if (!(req = eldbus_proxy_method_call_new(eldbus_proxy, "CbhmGetCount"))) + { + DALI_LOG_ERROR("Failed to create method call on org.freedesktop.DBus.Properties.Get"); + return -1; + } + + eldbus_message_ref(req); + reply = eldbus_proxy_send_and_block(eldbus_proxy, req, 100); + if (!reply || eldbus_message_error_get(reply, &errname, &errmsg)) + { + DALI_LOG_ERROR("Unable to call method org.freedesktop.DBus.Properties.Get: %s %s", + errname, errmsg); + eldbus_message_unref(req); + return -1; + } + + if (!eldbus_message_arguments_get(reply, "i", &count)) + { + DALI_LOG_ERROR("Cannot get arguments from eldbus"); + eldbus_message_unref(req); + return -1; + } + + eldbus_message_unref(req); + DALI_LOG_ERROR("cbhm item count(%d)", count); + return count; + } + + void ShowClipboard() + { + eldbus_proxy_call(cbhm_proxy_get(), "CbhmShow", NULL, NULL, -1, "s", "0"); + mIsFirstTimeHidden = true; + mVisible = true; + } + + void HideClipboard( bool skipFirstHide ) + { + if ( skipFirstHide && mIsFirstTimeHidden ) + { + mIsFirstTimeHidden = false; + return; + } + eldbus_proxy_call(cbhm_proxy_get(), "CbhmHide", NULL, NULL, -1, ""); + mIsFirstTimeHidden = false; + mVisible = false; + } + + bool IsVisible() const + { + return mVisible; + } + + static void _on_item_clicked(void *data, const Eldbus_Message *msg EINA_UNUSED) + { + static_cast(data)->RequestItem(); + } + + Eldbus_Proxy *eldbus_proxy; + Eldbus_Connection *cbhm_conn; + + char mSendBuf[CLIPBOARD_BUFFER_SIZE]; + char mReceiveBuf[CLIPBOARD_BUFFER_SIZE]; + bool mVisible; + bool mIsFirstTimeHidden; }; Clipboard::Clipboard(Impl* impl) @@ -94,24 +256,16 @@ Dali::Clipboard Clipboard::Get() bool Clipboard::SetItem(const std::string &itemData ) { + mImpl->SetItem( itemData ); return true; } /* - * Get string at given index of clipboard + * Request clipboard service to give an item */ -std::string Clipboard::GetItem( unsigned int index ) // change string to a Dali::Text object. +void Clipboard::RequestItem() { - if ( index >= NumberOfItems() ) - { - return ""; - } - - std::string emptyString( "" ); - char sendBuf[20]; - - snprintf( sendBuf, 20, "%s%d", CBHM_ITEM, index ); - return emptyString; + mImpl->RequestItem(); } /* @@ -119,24 +273,28 @@ std::string Clipboard::GetItem( unsigned int index ) // change string to a Dali */ unsigned int Clipboard::NumberOfItems() { - int count = -1; - - return count; + return mImpl->GetCount(); } -/** - * Show clipboard window - * Function to send message to show the Clipboard (cbhm) as no direct API available - * Reference elementary/src/modules/ctxpopup_copypasteUI/cbhm_helper.c - */ void Clipboard::ShowClipboard() { + mImpl->ShowClipboard(); } -void Clipboard::HideClipboard() +void Clipboard::HideClipboard(bool skipFirstHide) { + mImpl->HideClipboard(skipFirstHide); } +bool Clipboard::IsVisible() const +{ + return mImpl->IsVisible(); +} + +char* Clipboard::ExcuteBuffered( bool type, void *event ) +{ + return (type ? mImpl->ExcuteSend( event ) : mImpl->ExcuteReceive( event )); +} } // namespace Adaptor diff --git a/adaptors/ecore/wayland/display-connection-impl-ecore-wl.cpp b/adaptors/ecore/wayland/display-connection-impl-ecore-wl.cpp index 49d293c17..eb262c576 100644 --- a/adaptors/ecore/wayland/display-connection-impl-ecore-wl.cpp +++ b/adaptors/ecore/wayland/display-connection-impl-ecore-wl.cpp @@ -23,7 +23,7 @@ #include // INTERNAL HEADERS -#include +#include namespace Dali { @@ -42,19 +42,20 @@ DisplayConnection* DisplayConnection::New() } DisplayConnection::DisplayConnection() -: mDisplay(NULL) { - mDisplay = ecore_wl_display_get(); } DisplayConnection::~DisplayConnection() { - //FIXME + if( mSurfaceType == RenderSurface::NATIVE_RENDER_SURFACE ) + { + ReleaseNativeDisplay(); + } } Any DisplayConnection::GetDisplay() { - return Any(mDisplay); + return Any( mDisplay ); } void DisplayConnection::ConsumeEvents() @@ -65,7 +66,7 @@ bool DisplayConnection::InitializeEgl(EglInterface& egl) { EglImplementation& eglImpl = static_cast(egl); - if (!eglImpl.InitializeGles(reinterpret_cast(mDisplay))) + if( !eglImpl.InitializeGles( mDisplay ) ) { DALI_LOG_ERROR("Failed to initialize GLES.\n"); return false; @@ -74,6 +75,20 @@ bool DisplayConnection::InitializeEgl(EglInterface& egl) return true; } +void DisplayConnection::SetSurfaceType( RenderSurface::Type type ) +{ + mSurfaceType = type; + + if( mSurfaceType == RenderSurface::NATIVE_RENDER_SURFACE ) + { + mDisplay = GetNativeDisplay(); + } + else + { + mDisplay = reinterpret_cast< EGLNativeDisplayType >( ecore_wl_display_get() ); + } +} + void DisplayConnection::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) { // calculate DPI diff --git a/adaptors/ecore/wayland/display-connection-impl.h b/adaptors/ecore/wayland/display-connection-impl.h index b9134d19b..fc647ccb1 100644 --- a/adaptors/ecore/wayland/display-connection-impl.h +++ b/adaptors/ecore/wayland/display-connection-impl.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_ECORE_X_DIPLAY_CONNECTION_H__ -#define __DALI_INTERNAL_ECORE_X_DIPLAY_CONNECTION_H__ +#ifndef __DALI_INTERNAL_ECORE_WAYLAND_DIPLAY_CONNECTION_H__ +#define __DALI_INTERNAL_ECORE_WAYLAND_DIPLAY_CONNECTION_H__ /* * Copyright (c) 2015 Samsung Electronics Co., Ltd. @@ -81,6 +81,11 @@ public: */ bool InitializeEgl(EglInterface& egl); + /** + * @brief Sets surface type + */ + void SetSurfaceType( RenderSurface::Type type ); + public: /** @@ -90,6 +95,16 @@ public: protected: + /** + * @brief Gets display connection for native surface + */ + EGLNativeDisplayType GetNativeDisplay(); + + /** + * @brief Release display connection for native surface + */ + void ReleaseNativeDisplay(); + // Undefined DisplayConnection(const DisplayConnection&); @@ -97,7 +112,8 @@ protected: DisplayConnection& operator=(const DisplayConnection& rhs); private: - WlDisplay* mDisplay; ///< Wayland-display for rendering + EGLNativeDisplayType mDisplay; ///< Wayland-display for rendering + RenderSurface::Type mSurfaceType; }; } // namespace Adaptor diff --git a/adaptors/ecore/wayland/event-handler-ecore-wl.cpp b/adaptors/ecore/wayland/event-handler-ecore-wl.cpp index 1d38c49b1..6d29d8016 100644 --- a/adaptors/ecore/wayland/event-handler-ecore-wl.cpp +++ b/adaptors/ecore/wayland/event-handler-ecore-wl.cpp @@ -193,6 +193,13 @@ struct EventHandler::Impl mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, handler ) ); mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, handler ) ); + // Register Selection event - clipboard selection + mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, handler ) ); + mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, handler ) ); + + // Register Detent event + mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_DETENT_ROTATE, EcoreEventDetent, handler) ); + #ifndef DALI_PROFILE_UBUNTU // Register Vconf notify - font name and size vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontNameChanged, handler ); @@ -500,7 +507,8 @@ struct EventHandler::Impl } } } - // No need to connect callbacks as KeyboardStatusChanged will be called. + Dali::Clipboard clipboard = Clipboard::Get(); + clipboard.HideClipboard(); } return ECORE_CALLBACK_PASS_ON; @@ -532,9 +540,13 @@ struct EventHandler::Impl } } - // Clipboard don't support that whether clipboard is shown or not. Hide clipboard. + // Hiding clipboard event will be ignored once because window focus out event is always received on showing clipboard Dali::Clipboard clipboard = Clipboard::Get(); - clipboard.HideClipboard(); + if ( clipboard ) + { + Clipboard& clipBoardImpl( GetImplementation( clipboard ) ); + clipBoardImpl.HideClipboard(true); + } } return ECORE_CALLBACK_PASS_ON; @@ -649,6 +661,65 @@ struct EventHandler::Impl return ECORE_CALLBACK_PASS_ON; } + /** + * Called when the source window notifies us the content in clipboard is selected. + */ + static Eina_Bool EcoreEventDataSend( void* data, int type, void* event ) + { + DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventDataSend\n" ); + + Dali::Clipboard clipboard = Clipboard::Get(); + if ( clipboard ) + { + Clipboard& clipBoardImpl( GetImplementation( clipboard ) ); + clipBoardImpl.ExcuteBuffered( true, event ); + } + return ECORE_CALLBACK_PASS_ON; + } + + /** + * Called when the source window sends us about the selected content. + * For example, when item is selected in the clipboard. + */ + static Eina_Bool EcoreEventDataReceive( void* data, int type, void* event ) + { + DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventDataReceive\n" ); + + EventHandler* handler( (EventHandler*)data ); + Dali::Clipboard clipboard = Clipboard::Get(); + char *selectionData = NULL; + if ( clipboard ) + { + Clipboard& clipBoardImpl( GetImplementation( clipboard ) ); + selectionData = clipBoardImpl.ExcuteBuffered( false, event ); + } + if ( selectionData && handler->mClipboardEventNotifier ) + { + ClipboardEventNotifier& clipboardEventNotifier( ClipboardEventNotifier::GetImplementation( handler->mClipboardEventNotifier ) ); + std::string content( selectionData, strlen(selectionData) ); + + clipboardEventNotifier.SetContent( content ); + clipboardEventNotifier.EmitContentSelectedSignal(); + } + return ECORE_CALLBACK_PASS_ON; + } + + /* + * Called when detent event is recevied + */ + static Eina_Bool EcoreEventDetent( void* data, int type, void* event ) + { + DALI_LOG_INFO(gSelectionEventLogFilter, Debug::Concise, "EcoreEventDetent\n" ); + EventHandler* handler( (EventHandler*)data ); + Ecore_Event_Detent_Rotate *e((Ecore_Event_Detent_Rotate *)event); + int direction = (e->direction == ECORE_DETENT_DIRECTION_CLOCKWISE) ? 1 : -1; + int timeStamp = e->timestamp; + + WheelEvent wheelEvent( WheelEvent::CUSTOM_WHEEL, 0, 0, Vector2(0.0f, 0.0f), direction, timeStamp ); + handler->SendWheelEvent( wheelEvent ); + return ECORE_CALLBACK_PASS_ON; + } + ///////////////////////////////////////////////////////////////////////////////////////////////// // Font Callbacks ///////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/adaptors/ecore/wayland/imf-manager-impl-ecore-wl.cpp b/adaptors/ecore/wayland/imf-manager-impl-ecore-wl.cpp index 825b44471..e88e30aed 100644 --- a/adaptors/ecore/wayland/imf-manager-impl-ecore-wl.cpp +++ b/adaptors/ecore/wayland/imf-manager-impl-ecore-wl.cpp @@ -516,6 +516,14 @@ const std::string& ImfManager::GetSurroundingText() const return mSurroundingText; } +void ImfManager::NotifyTextInputMultiLine( bool multiLine ) +{ + Ecore_IMF_Input_Hints currentHint = ecore_imf_context_input_hint_get(mIMFContext); + ecore_imf_context_input_hint_set(mIMFContext, (Ecore_IMF_Input_Hints)(multiLine ? + (currentHint | ECORE_IMF_INPUT_HINT_MULTILINE) : + (currentHint & ~ECORE_IMF_INPUT_HINT_MULTILINE))); +} + } // Adaptor } // Internal diff --git a/adaptors/ecore/wayland/imf-manager-impl.h b/adaptors/ecore/wayland/imf-manager-impl.h index 1fd8e1613..391c56d50 100644 --- a/adaptors/ecore/wayland/imf-manager-impl.h +++ b/adaptors/ecore/wayland/imf-manager-impl.h @@ -151,6 +151,11 @@ public: */ const std::string& GetSurroundingText() const; + /** + * @copydoc Dali::ImfManager::NotifyTextInputMultiLine() + */ + void NotifyTextInputMultiLine( bool multiLine ); + public: // Signals /** diff --git a/adaptors/ecore/wayland/render-surface-ecore-wl.cpp b/adaptors/ecore/wayland/render-surface-ecore-wl.cpp index dbb495a2f..8ef5cc0c1 100644 --- a/adaptors/ecore/wayland/render-surface-ecore-wl.cpp +++ b/adaptors/ecore/wayland/render-surface-ecore-wl.cpp @@ -126,6 +126,11 @@ unsigned int EcoreWlRenderSurface::GetSurfaceId( Any surface ) const return surfaceId; } +RenderSurface::Type EcoreWlRenderSurface::GetSurfaceType() +{ + return RenderSurface::ECORE_RENDER_SURFACE; +} + } // namespace ECore } // namespace Dali diff --git a/adaptors/ecore/wayland/window-impl-ecore-wl.cpp b/adaptors/ecore/wayland/window-impl-ecore-wl.cpp index 41c7f36bf..4738eecf2 100644 --- a/adaptors/ecore/wayland/window-impl-ecore-wl.cpp +++ b/adaptors/ecore/wayland/window-impl-ecore-wl.cpp @@ -331,10 +331,46 @@ void Window::DoRotateIndicator( Dali::Window::WindowOrientation orientation ) void Window::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ) { + ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) ); + + if( wlSurface ) + { + Ecore_Wl_Window* wlWindow = wlSurface->GetWlWindow(); + if ( isShow ) + { + ecore_wl_window_indicator_state_set(wlWindow, ECORE_WL_INDICATOR_STATE_ON); + } + else + { + ecore_wl_window_indicator_state_set(wlWindow, ECORE_WL_INDICATOR_STATE_OFF); + } + } } void Window::IndicatorTypeChanged(Indicator::Type type) { +#if defined(DALI_PROFILE_MOBILE) + ECore::WindowRenderSurface* wlSurface( dynamic_cast< ECore::WindowRenderSurface * >( mSurface ) ); + + if( wlSurface ) + { + Ecore_Wl_Window* wlWindow = wlSurface->GetWlWindow(); + switch(type) + { + case Indicator::INDICATOR_TYPE_1: + ecore_wl_indicator_visible_type_set(wlWindow, ECORE_WL_INDICATOR_VISIBLE_TYPE_SHOWN); + break; + + case Indicator::INDICATOR_TYPE_2: + ecore_wl_indicator_visible_type_set(wlWindow, ECORE_WL_INDICATOR_VISIBLE_TYPE_HIDDEN); + break; + + case Indicator::INDICATOR_TYPE_UNKNOWN: + default: + break; + } + } +#endif //MOBILE } void Window::IndicatorClosed( IndicatorInterface* indicator ) diff --git a/adaptors/integration-api/adaptor.h b/adaptors/integration-api/adaptor.h index 8eabd4a41..7de4d655d 100644 --- a/adaptors/integration-api/adaptor.h +++ b/adaptors/integration-api/adaptor.h @@ -2,7 +2,7 @@ #define __DALI_INTEGRATION_ADAPTOR_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -197,6 +197,16 @@ public: */ bool AddIdle( CallbackBase* callback ); + /** + * @brief Removes a previously added @p callback. + * @note Function must be called from the main event thread only. + * + * Does nothing if the @p callback doesn't exist. + * + * @param[in] callback The callback to be removed. + */ + void RemoveIdle( CallbackBase* callback ); + /** * @brief Replaces the rendering surface * diff --git a/adaptors/integration-api/file.list b/adaptors/integration-api/file.list index 45fcc772d..16014d244 100644 --- a/adaptors/integration-api/file.list +++ b/adaptors/integration-api/file.list @@ -4,16 +4,17 @@ adaptor_integration_api_header_files = \ $(adaptor_integration_api_dir)/thread-synchronization-interface.h \ $(adaptor_integration_api_dir)/trigger-event-interface.h \ $(adaptor_integration_api_dir)/trigger-event-factory-interface.h \ - $(adaptor_integration_api_dir)/trigger-event-factory.h \ - $(adaptor_integration_api_dir)/pixmap-render-surface-factory.h + $(adaptor_integration_api_dir)/trigger-event-factory.h adaptor_integration_wayland_api_header_files = \ $(adaptor_integration_api_dir)/wayland/wl-types.h \ $(adaptor_integration_api_dir)/wayland/ecore-wl-render-surface.h \ - $(adaptor_integration_api_dir)/wayland/pixmap-render-surface.h + $(adaptor_integration_api_dir)/wayland/native-render-surface.h \ + $(adaptor_integration_api_dir)/native-render-surface-factory.h adaptor_integration_x11_api_header_files = \ $(adaptor_integration_api_dir)/x11/ecore-x-types.h \ $(adaptor_integration_api_dir)/x11/ecore-x-render-surface.h \ $(adaptor_integration_api_dir)/x11/pixmap-render-surface.h \ - $(adaptor_integration_api_dir)/x11/imf-manager-impl.h + $(adaptor_integration_api_dir)/x11/imf-manager-impl.h \ + $(adaptor_integration_api_dir)/pixmap-render-surface-factory.h diff --git a/adaptors/integration-api/native-render-surface-factory.h b/adaptors/integration-api/native-render-surface-factory.h new file mode 100644 index 000000000..fdc04698f --- /dev/null +++ b/adaptors/integration-api/native-render-surface-factory.h @@ -0,0 +1,47 @@ +#ifndef __DALI_INTEGRATION_NATIVE_RENDER_SURFACE_FACTORY_H__ +#define __DALI_INTEGRATION_NATIVE_RENDER_SURFACE_FACTORY_H__ + +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include +#include +#include + +// INTERNAL INCLUDES + +namespace Dali +{ + +class NativeRenderSurface; + +/** + * Factory function for native surface + * A native surface is created. + * + * @param [in] positionSize the position and size of the surface to create + * @param [in] name Name of surface passed in + * @param [in] isTransparent Whether the surface has an alpha channel + */ +NativeRenderSurface* CreateNativeSurface( PositionSize positionSize, + const std::string& name, + bool isTransparent ); + +} // namespace Dali + +#endif // __DALI_INTEGRATION_NATIVE_RENDER_SURFACE_FACTORY_H__ diff --git a/adaptors/integration-api/trigger-event-factory-interface.h b/adaptors/integration-api/trigger-event-factory-interface.h index 947f812e6..ebf5c0db9 100644 --- a/adaptors/integration-api/trigger-event-factory-interface.h +++ b/adaptors/integration-api/trigger-event-factory-interface.h @@ -22,7 +22,11 @@ #include // INTERNAL INCLUDES +#ifdef DALI_ADAPTOR_COMPILATION #include +#else +#include +#endif namespace Dali { diff --git a/adaptors/integration-api/trigger-event-factory.h b/adaptors/integration-api/trigger-event-factory.h index 1633a0de8..a90890a79 100644 --- a/adaptors/integration-api/trigger-event-factory.h +++ b/adaptors/integration-api/trigger-event-factory.h @@ -19,8 +19,12 @@ */ // INTERNAL INCLUDES -#include #include +#ifdef DALI_ADAPTOR_COMPILATION +#include +#else +#include +#endif namespace Dali { diff --git a/adaptors/integration-api/wayland/ecore-wl-render-surface.h b/adaptors/integration-api/wayland/ecore-wl-render-surface.h index 4a30da7ab..aa747c417 100644 --- a/adaptors/integration-api/wayland/ecore-wl-render-surface.h +++ b/adaptors/integration-api/wayland/ecore-wl-render-surface.h @@ -146,6 +146,11 @@ public: // from Dali::RenderSurface */ virtual void ReleaseLock() = 0; + /** + * @copydoc Dali::RenderSurface::GetSurfaceType() + */ + virtual RenderSurface::Type GetSurfaceType(); + private: /** diff --git a/adaptors/integration-api/wayland/native-render-surface.h b/adaptors/integration-api/wayland/native-render-surface.h new file mode 100644 index 000000000..44caaa211 --- /dev/null +++ b/adaptors/integration-api/wayland/native-render-surface.h @@ -0,0 +1,176 @@ +#ifndef __DALI_NATIVE_RENDER_SURFACE_H__ +#define __DALI_NATIVE_RENDER_SURFACE_H__ + +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#ifdef DALI_ADAPTOR_COMPILATION +#include +#include +#else +#include +#include +#endif + +namespace Dali +{ + +class TriggerEventInterface; + +/** + * Ecore X11 implementation of render surface. + */ +class DALI_IMPORT_API NativeRenderSurface : public Dali::RenderSurface +{ +public: + + /** + * Uses an Wayland surface to render to. + * @param [in] positionSize the position and size of the surface + * @param [in] name optional name of surface passed in + * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit + */ + NativeRenderSurface( Dali::PositionSize positionSize, + const std::string& name, + bool isTransparent = false ); + + /** + * @copydoc Dali::RenderSurface::~RenderSurface + */ + virtual ~NativeRenderSurface(); + +public: // API + + /** + * @brief Sets the render notification trigger to call when render thread is completed a frame + * + * @param renderNotification to use + */ + void SetRenderNotification( TriggerEventInterface* renderNotification ); + + /** + * @brief Gets the tbm surface for offscreen rendering + */ + virtual tbm_surface_h GetDrawable(); + + /** + * @brief Get the surface + * + * @return tbm surface + */ + virtual Any GetSurface(); + + /** + * @brief Release the surface + */ + virtual void ReleaseSurface(); + +public: // from Dali::RenderSurface + + /** + * @copydoc Dali::RenderSurface::GetPositionSize() + */ + virtual PositionSize GetPositionSize() const; + + /** + * @copydoc Dali::RenderSurface::InitializeEgl() + */ + virtual void InitializeEgl( EglInterface& egl ); + + /** + * @copydoc Dali::RenderSurface::CreateEglSurface() + */ + virtual void CreateEglSurface( EglInterface& egl ); + + /** + * @copydoc Dali::RenderSurface::DestroyEglSurface() + */ + virtual void DestroyEglSurface( EglInterface& egl ); + + /** + * @copydoc Dali::RenderSurface::ReplaceEGLSurface() + */ + virtual bool ReplaceEGLSurface( EglInterface& egl ); + + /** + * @copydoc Dali::RenderSurface::MoveResize() + */ + virtual void MoveResize( Dali::PositionSize positionSize); + + /** + * @copydoc Dali::RenderSurface::SetViewMode() + */ + void SetViewMode( ViewMode viewMode ); + + /** + * @copydoc Dali::RenderSurface::StartRender() + */ + virtual void StartRender(); + + /** + * @copydoc Dali::RenderSurface::PreRender() + */ + virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ); + + /** + * @copydoc Dali::RenderSurface::PostRender() + */ + virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface ); + + /** + * @copydoc Dali::RenderSurface::StopRender() + */ + virtual void StopRender(); + + /** + * @copydoc Dali::RenderSurface::SetThreadSynchronization + */ + virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ); + + /** + * @copydoc Dali::RenderSurface::GetSurfaceType() + */ + virtual RenderSurface::Type GetSurfaceType(); + +private: + + /** + * Release any locks. + */ + void ReleaseLock(); + + /** + * Create tbm surface + */ + virtual void CreateNativeRenderable(); + +private: // Data + + struct Impl; + + Impl* mImpl; + +}; + +} // namespace Dali + +#endif // __DALI_NATIVE_RENDER_SURFACE_H__ diff --git a/adaptors/integration-api/x11/ecore-x-render-surface.h b/adaptors/integration-api/x11/ecore-x-render-surface.h index 1eaa8232e..3f9b97cc1 100644 --- a/adaptors/integration-api/x11/ecore-x-render-surface.h +++ b/adaptors/integration-api/x11/ecore-x-render-surface.h @@ -154,6 +154,11 @@ public: // from Dali::RenderSurface */ virtual void ReleaseLock() = 0; + /** + * @copydoc Dali::RenderSurface::GetSurfaceType() + */ + virtual RenderSurface::Type GetSurfaceType(); + private: /** diff --git a/adaptors/integration-api/x11/imf-manager-impl.h b/adaptors/integration-api/x11/imf-manager-impl.h index 1791792bf..ea7fe87c0 100644 --- a/adaptors/integration-api/x11/imf-manager-impl.h +++ b/adaptors/integration-api/x11/imf-manager-impl.h @@ -154,6 +154,11 @@ public: */ const std::string& GetSurroundingText() const; + /** + * @copydoc Dali::ImfManager::NotifyTextInputMultiLine() + */ + void NotifyTextInputMultiLine( bool multiLine ); + public: // Signals /** diff --git a/adaptors/integration-api/x11/pixmap-render-surface.h b/adaptors/integration-api/x11/pixmap-render-surface.h index 471462fe9..f31a0c7fc 100644 --- a/adaptors/integration-api/x11/pixmap-render-surface.h +++ b/adaptors/integration-api/x11/pixmap-render-surface.h @@ -112,6 +112,8 @@ public: // from Dali::RenderSurface */ virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ); + virtual RenderSurface::Type GetSurfaceType(); + private: /** diff --git a/adaptors/libuv/framework-libuv.cpp b/adaptors/libuv/framework-libuv.cpp index cc7dc7771..3a8f3aee7 100644 --- a/adaptors/libuv/framework-libuv.cpp +++ b/adaptors/libuv/framework-libuv.cpp @@ -158,6 +158,12 @@ std::string Framework::GetBundleId() const return ""; } +std::string Framework::GetResourcePath() +{ + // TIZEN_PLATFORM_CONFIG_SUPPORTED not defined for libuv so path not available. + return ""; +} + void Framework::SetBundleId(const std::string& id) { } diff --git a/adaptors/mobile/file.list b/adaptors/mobile/file.list index abe484d34..1a294b634 100644 --- a/adaptors/mobile/file.list +++ b/adaptors/mobile/file.list @@ -1,6 +1,11 @@ # mobile profile internal files adaptor_common_internal_mobile_profile_src_files = \ $(adaptor_mobile_dir)/accessibility-adaptor-impl-mobile.cpp \ - $(adaptor_mobile_dir)/pixmap-render-surface-factory.cpp \ $(adaptor_mobile_dir)/mobile-system-settings.cpp \ $(adaptor_mobile_dir)/mobile-color-controller-impl.cpp + +adaptor_common_internal_wayland_mobile_profile_src_files = \ + $(adaptor_mobile_dir)/native-render-surface-factory.cpp + +adaptor_common_internal_x_mobile_profile_src_files = \ + $(adaptor_mobile_dir)/pixmap-render-surface-factory.cpp diff --git a/adaptors/mobile/native-render-surface-factory.cpp b/adaptors/mobile/native-render-surface-factory.cpp new file mode 100644 index 000000000..ba57dfc6a --- /dev/null +++ b/adaptors/mobile/native-render-surface-factory.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +DALI_EXPORT_API NativeRenderSurface* CreateNativeSurface( + PositionSize positionSize, + const std::string& name, + bool isTransparent) +{ + return new NativeRenderSurface( positionSize, name, isTransparent ); +} + +} // namespace Dali diff --git a/adaptors/public-api/adaptor-framework/application.cpp b/adaptors/public-api/adaptor-framework/application.cpp index 0a5e4f3d6..62908dd38 100644 --- a/adaptors/public-api/adaptor-framework/application.cpp +++ b/adaptors/public-api/adaptor-framework/application.cpp @@ -110,6 +110,11 @@ void Application::ReplaceWindow(PositionSize windowPosition, const std::string& Internal::Adaptor::GetImplementation(*this).ReplaceWindow(windowPosition, name); } +std::string Application::GetResourcePath() +{ + return Internal::Adaptor::Application::GetResourcePath(); +} + void Application::SetViewMode( ViewMode viewMode ) { Internal::Adaptor::GetImplementation(*this).SetViewMode( viewMode ); diff --git a/adaptors/public-api/adaptor-framework/application.h b/adaptors/public-api/adaptor-framework/application.h index 371b533a9..ea15cc79c 100644 --- a/adaptors/public-api/adaptor-framework/application.h +++ b/adaptors/public-api/adaptor-framework/application.h @@ -126,6 +126,8 @@ public: /** * @brief This is the constructor for applications without an argument list. * @SINCE_1_0.0 + * @PRIVLEVEL_PUBLIC + * @PRIVILEGE_DISPLAY */ static Application New(); @@ -133,6 +135,8 @@ public: * @brief This is the constructor for applications. * * @SINCE_1_0.0 + * @PRIVLEVEL_PUBLIC + * @PRIVILEGE_DISPLAY * @param[in,out] argc A pointer to the number of arguments * @param[in,out] argv A pointer the the argument list */ @@ -142,9 +146,12 @@ public: * @brief This is the constructor for applications with a name * * @SINCE_1_0.0 + * @PRIVLEVEL_PUBLIC + * @PRIVILEGE_DISPLAY * @param[in,out] argc A pointer to the number of arguments * @param[in,out] argv A pointer the the argument list * @param[in] stylesheet The path to user defined theme file + * @note If the stylesheet is not specified, then the library's default stylesheet will not be overridden. */ static Application New( int* argc, char **argv[], const std::string& stylesheet ); @@ -152,10 +159,13 @@ public: * @brief This is the constructor for applications with a name * * @SINCE_1_0.0 + * @PRIVLEVEL_PUBLIC + * @PRIVILEGE_DISPLAY * @param[in,out] argc A pointer to the number of arguments * @param[in,out] argv A pointer the the argument list * @param[in] stylesheet The path to user defined theme file * @param[in] windowMode A member of WINDOW_MODE + * @note If the stylesheet is not specified, then the library's default stylesheet will not be overridden. */ static Application New( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode ); @@ -258,6 +268,15 @@ public: */ void ReplaceWindow(PositionSize windowPosition, const std::string& name); + /** + * @brief Get path application resources are stored at + * + * @SINCE_1_2.2 + * @return the full path of the resources + */ + static std::string GetResourcePath(); + + public: // Stereoscopy /** @@ -277,6 +296,8 @@ public: // Stereoscopy /** * @brief Set the stereo base (eye separation) for Stereoscopic 3D * + * The stereo base is the distance in millimetres between the eyes. Typical values are + * between 50mm and 70mm. The default value is 65mm. * @SINCE_1_0.0 * @param[in] stereoBase The stereo base (eye separation) for Stereoscopic 3D */ @@ -366,11 +387,13 @@ public: // Signals AppSignalType& MemoryLowSignal(); public: // Not intended for application developers + /// @cond internal /** * @brief Internal constructor * @SINCE_1_0.0 */ explicit DALI_INTERNAL Application(Internal::Adaptor::Application* application); + /// @endcond }; /** diff --git a/adaptors/public-api/adaptor-framework/native-image-source.h b/adaptors/public-api/adaptor-framework/native-image-source.h index d26511cc6..0332739d8 100755 --- a/adaptors/public-api/adaptor-framework/native-image-source.h +++ b/adaptors/public-api/adaptor-framework/native-image-source.h @@ -53,8 +53,11 @@ typedef Dali::IntrusivePtr NativeImageSourcePtr; * * NativeImageSource can be created internally or * externally by native image source. + * NativeImage is a platform specific way of providing pixel data to the GPU for rendering, + * for example via an EGL image. * * @SINCE_1_1.4 + * @see NativeImage */ class DALI_IMPORT_API NativeImageSource : public NativeImageInterface { @@ -91,6 +94,7 @@ public: * @SINCE_1_0.0 * @param[in] nativeImageSource must be a any handle with native image source * @return A smart-pointer to a newly allocated image. + * @see NativeImageInterface */ static NativeImageSourcePtr New( Any nativeImageSource ); @@ -189,6 +193,7 @@ private: // native image private: + /// @cond internal /** * @brief Private constructor * @SINCE_1_0.0 @@ -224,10 +229,13 @@ private: * @param[in] rhs A reference to the object to copy. */ DALI_INTERNAL NativeImageSource& operator=(const NativeImageSource& rhs); + /// @endcond private: + /// @cond internal Internal::Adaptor::NativeImageSource* mImpl; ///< Implementation pointer + /// @endcond }; /** diff --git a/adaptors/public-api/adaptor-framework/tts-player.h b/adaptors/public-api/adaptor-framework/tts-player.h index 68591557d..cef2e9215 100644 --- a/adaptors/public-api/adaptor-framework/tts-player.h +++ b/adaptors/public-api/adaptor-framework/tts-player.h @@ -52,8 +52,8 @@ public: // ENUMs enum Mode { DEFAULT = 0, ///< Default mode for normal application @SINCE_1_0.0 - NOTIFICATION, ///< Notification mode @SINCE_1_0.0 - SCREEN_READER, ///< Screen reader mode @SINCE_1_0.0 + NOTIFICATION, ///< Notification mode, such as playing utterance is started or completed @SINCE_1_0.0 + SCREEN_READER, ///< Screen reader mode. To help visually impaired users interact with their devices, screen reader reads text or graphic elements on the screen using the TTS engine. @SINCE_1_0.0 MODE_NUM }; @@ -168,12 +168,14 @@ public: // API public: // Not intended for application developers + /// @cond internal /** * @brief This constructor is used by TtsPlayer::Get(). * @SINCE_1_0.0 * @param[in] ttsPlayer A pointer to the TTS player. */ explicit DALI_INTERNAL TtsPlayer( Internal::Adaptor::TtsPlayer* ttsPlayer ); + /// @endcond }; /** diff --git a/adaptors/public-api/adaptor-framework/window.h b/adaptors/public-api/adaptor-framework/window.h index ea44240c6..40872cd64 100644 --- a/adaptors/public-api/adaptor-framework/window.h +++ b/adaptors/public-api/adaptor-framework/window.h @@ -63,13 +63,13 @@ public: // Enumerations /** - * @brief Orientation of the window. + * @brief Orientation of the window is the way in which a rectangular page is oriented for normal viewing. * @SINCE_1_0.0 */ enum WindowOrientation { - PORTRAIT = 0, ///< Portrait orientation @SINCE_1_0.0 - LANDSCAPE = 90, ///< Landscape orientation @SINCE_1_0.0 + PORTRAIT = 0, ///< Portrait orientation. The height of the display area is greater than the width. @SINCE_1_0.0 + LANDSCAPE = 90, ///< Landscape orientation. A wide view area is needed. @SINCE_1_0.0 PORTRAIT_INVERSE = 180, ///< Portrait inverse orientation @SINCE_1_0.0 LANDSCAPE_INVERSE = 270 ///< Landscape inverse orientation @SINCE_1_0.0 }; @@ -232,6 +232,7 @@ public: /** * @brief Returns the Drag & drop detector which can be used to receive drag & drop events. + * @note Not intended for application developers. * @SINCE_1_0.0 * @return A handle to the DragAndDropDetector. */ @@ -239,6 +240,8 @@ public: /** * @brief Get the native handle of the window. + * + * When users call this function, it wraps the actual type used by the underlying window system. * @SINCE_1_0.0 * @return The native handle of the window or an empty handle. */ @@ -252,12 +255,14 @@ public: // Signals IndicatorSignalType& IndicatorVisibilityChangedSignal(); public: // Not intended for application developers + /// @cond internal /** * @brief This constructor is used by Dali::Application::GetWindow(). * @SINCE_1_0.0 * @param[in] window A pointer to the window. */ explicit DALI_INTERNAL Window( Internal::Adaptor::Window* window ); + /// @endcond }; /** diff --git a/adaptors/public-api/dali-adaptor-version.cpp b/adaptors/public-api/dali-adaptor-version.cpp index ee27115f0..5d8aa7dcc 100644 --- a/adaptors/public-api/dali-adaptor-version.cpp +++ b/adaptors/public-api/dali-adaptor-version.cpp @@ -27,8 +27,8 @@ namespace Dali { const unsigned int ADAPTOR_MAJOR_VERSION = 1; -const unsigned int ADAPTOR_MINOR_VERSION = 1; -const unsigned int ADAPTOR_MICRO_VERSION = 45; +const unsigned int ADAPTOR_MINOR_VERSION = 2; +const unsigned int ADAPTOR_MICRO_VERSION = 5; const char * const ADAPTOR_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/adaptors/tizen/display-connection-impl-tizen.cpp b/adaptors/tizen/display-connection-impl-tizen.cpp new file mode 100644 index 000000000..0516ba211 --- /dev/null +++ b/adaptors/tizen/display-connection-impl-tizen.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +// EXTERNAL_HEADERS +#include +#include + +// INTERNAL HEADERS +#include +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +EGLNativeDisplayType DisplayConnection::GetNativeDisplay() +{ + return (EGLNativeDisplayType)tbm_bufmgr_init( -1 ); +} + +void DisplayConnection::ReleaseNativeDisplay() +{ + if( mDisplay ) + { + tbm_bufmgr_deinit( (tbm_bufmgr)mDisplay ); + } +} + +} // namespace Adaptor + +} // namespace Internal + +} // namespace Dali diff --git a/adaptors/tizen/file.list b/adaptors/tizen/file.list index ecfc46169..541cafd0f 100644 --- a/adaptors/tizen/file.list +++ b/adaptors/tizen/file.list @@ -17,6 +17,8 @@ adaptor_tizen_internal_egl_extension_src_files = \ $(adaptor_tizen_dir)/gl/egl-image-extensions-tizen.cpp adaptor_tizen_internal_native_image_src_files = \ + $(adaptor_tizen_dir)/display-connection-impl-tizen.cpp \ + $(adaptor_tizen_dir)/native-render-surface-tizen.cpp \ $(adaptor_tizen_dir)/native-image-source-impl-tizen.cpp public_api_adaptor_tizen_header_files = \ diff --git a/adaptors/tizen/framework-tizen.cpp b/adaptors/tizen/framework-tizen.cpp index 1f0cf57b6..d140a9979 100644 --- a/adaptors/tizen/framework-tizen.cpp +++ b/adaptors/tizen/framework-tizen.cpp @@ -30,6 +30,10 @@ #include #endif +#if defined( TIZEN_PLATFORM_CONFIG_SUPPORTED ) && TIZEN_PLATFORM_CONFIG_SUPPORTED +#include +#endif // TIZEN_PLATFORM_CONFIG_SUPPORTED + #include // INTERNAL INCLUDES @@ -325,7 +329,6 @@ Framework::Framework( Framework::Observer& observer, int *argc, char ***argv, Ty if( featureFlag == false ) { set_last_result( TIZEN_ERROR_NOT_SUPPORTED ); - throw Dali::DaliException( "", "OpenGL ES 2.0 is not supported." ); } InitThreads(); @@ -392,6 +395,16 @@ std::string Framework::GetBundleId() const return mBundleId; } +std::string Framework::GetResourcePath() +{ + std::string resourcePath = ""; +#if defined( TIZEN_PLATFORM_CONFIG_SUPPORTED ) && TIZEN_PLATFORM_CONFIG_SUPPORTED + resourcePath = app_get_resource_path(); +#endif //TIZEN_PLATFORM_CONFIG_SUPPORTED + + return resourcePath; +} + void Framework::SetBundleId(const std::string& id) { mBundleId = id; diff --git a/adaptors/tizen/native-render-surface-tizen.cpp b/adaptors/tizen/native-render-surface-tizen.cpp new file mode 100644 index 000000000..7f1b1a7ba --- /dev/null +++ b/adaptors/tizen/native-render-surface-tizen.cpp @@ -0,0 +1,277 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +// EXTERNAL INCLUDES +#include +#include +#include + +#include +#include +#include + +// INTERNAL INCLUDES +#include +#include +#include +#include + +namespace Dali +{ + +#if defined(DEBUG_ENABLED) +extern Debug::Filter* gRenderSurfaceLogFilter; +#endif + +struct NativeRenderSurface::Impl +{ + Impl( Dali::PositionSize positionSize, const std::string& name, bool isTransparent ) + : mPosition( positionSize ), + mTitle( name ), + mRenderNotification( NULL ), + mColorDepth( isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24 ), + mTbmFormat( isTransparent ? TBM_FORMAT_ARGB8888 : TBM_FORMAT_RGB888 ), + mOwnSurface( false ), + mConsumeSurface( NULL ), + mThreadSynchronization( NULL ) + { + } + + PositionSize mPosition; + std::string mTitle; + TriggerEventInterface* mRenderNotification; + ColorDepth mColorDepth; + tbm_format mTbmFormat; + bool mOwnSurface; + + tbm_surface_queue_h mTbmQueue; + tbm_surface_h mConsumeSurface; + ThreadSynchronizationInterface* mThreadSynchronization; ///< A pointer to the thread-synchronization + ConditionalWait mTbmSurfaceCondition; +}; + +NativeRenderSurface::NativeRenderSurface(Dali::PositionSize positionSize, + const std::string& name, + bool isTransparent) +: mImpl( new Impl( positionSize, name, isTransparent ) ) +{ + ecore_wl_init(NULL); + CreateNativeRenderable(); +} + +NativeRenderSurface::~NativeRenderSurface() +{ + // release the surface if we own one + if( mImpl->mOwnSurface ) + { + + if( mImpl->mConsumeSurface ) + { + tbm_surface_queue_release( mImpl->mTbmQueue, mImpl->mConsumeSurface ); + mImpl->mConsumeSurface = NULL; + } + + if( mImpl->mTbmQueue ) + { + tbm_surface_queue_destroy( mImpl->mTbmQueue ); + } + + delete mImpl; + + DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::General, "Own tbm surface queue destroy\n" ); + } +} + +void NativeRenderSurface::SetRenderNotification( TriggerEventInterface* renderNotification ) +{ + mImpl->mRenderNotification = renderNotification; +} + +tbm_surface_h NativeRenderSurface::GetDrawable() +{ + ConditionalWait::ScopedLock lock( mImpl->mTbmSurfaceCondition ); + + return mImpl->mConsumeSurface; +} + +Any NativeRenderSurface::GetSurface() +{ + return Any( NULL ); +} + +void NativeRenderSurface::InitializeEgl( EglInterface& egl ) +{ + DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); + + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + + eglImpl.ChooseConfig( true, mImpl->mColorDepth ); +} + +void NativeRenderSurface::CreateEglSurface( EglInterface& egl ) +{ + DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); + + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + + eglImpl.CreateSurfaceWindow( (EGLNativeWindowType)mImpl->mTbmQueue, mImpl->mColorDepth ); +} + +void NativeRenderSurface::DestroyEglSurface( EglInterface& egl ) +{ + DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); + + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + eglImpl.DestroySurface(); +} + +bool NativeRenderSurface::ReplaceEGLSurface( EglInterface& egl ) +{ + DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); + + if( mImpl->mConsumeSurface ) + { + tbm_surface_queue_release( mImpl->mTbmQueue, mImpl->mConsumeSurface ); + mImpl->mConsumeSurface = NULL; + } + + if( mImpl->mTbmQueue ) + { + tbm_surface_queue_destroy( mImpl->mTbmQueue ); + } + + CreateNativeRenderable(); + + if( !mImpl->mTbmQueue ) + { + return false; + } + + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + + return eglImpl.ReplaceSurfaceWindow( (EGLNativeWindowType)mImpl->mTbmQueue ); // reinterpret_cast does not compile +} + +void NativeRenderSurface::StartRender() +{ +} + +bool NativeRenderSurface::PreRender( EglInterface&, Integration::GlAbstraction& ) +{ + // nothing to do for pixmaps + return true; +} + +void NativeRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface ) +{ + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + eglImpl.SwapBuffers(); + + // flush gl instruction queue + glAbstraction.Flush(); + + { + if( tbm_surface_queue_can_acquire( mImpl->mTbmQueue, 1 ) ) + { + if( tbm_surface_queue_acquire( mImpl->mTbmQueue, &mImpl->mConsumeSurface ) != TBM_SURFACE_QUEUE_ERROR_NONE ) + { + DALI_LOG_ERROR( "Failed aquire consume tbm_surface\n" ); + return; + } + } + } + + // create damage for client applications which wish to know the update timing + if( mImpl->mRenderNotification ) + { + // use notification trigger + // Tell the event-thread to render the pixmap + mImpl->mRenderNotification->Trigger(); + } + else + { + // FIXME + } + +} + +void NativeRenderSurface::StopRender() +{ + ReleaseLock(); +} + +PositionSize NativeRenderSurface::GetPositionSize() const +{ + return mImpl->mPosition; +} + +void NativeRenderSurface::MoveResize( Dali::PositionSize positionSize ) +{ +} + +void NativeRenderSurface::SetViewMode( ViewMode viewMode ) +{ +} + +void NativeRenderSurface::SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) +{ + mImpl->mThreadSynchronization = &threadSynchronization; +} + +RenderSurface::Type NativeRenderSurface::GetSurfaceType() +{ + return RenderSurface::NATIVE_RENDER_SURFACE; +} + +void NativeRenderSurface::CreateNativeRenderable() +{ + // check we're creating one with a valid size + DALI_ASSERT_ALWAYS( mImpl->mPosition.width > 0 && mImpl->mPosition.height > 0 && "Pixmap size is invalid" ); + + mImpl->mTbmQueue = tbm_surface_queue_create( 3, mImpl->mPosition.width, mImpl->mPosition.height, mImpl->mTbmFormat, TBM_BO_DEFAULT ); + + if( mImpl->mTbmQueue ) + { + mImpl->mOwnSurface = true; + } + else + { + mImpl->mOwnSurface = false; + } +} + +void NativeRenderSurface::ReleaseSurface() +{ + if( mImpl->mConsumeSurface ) + { + tbm_surface_queue_release( mImpl->mTbmQueue, mImpl->mConsumeSurface ); + mImpl->mConsumeSurface = NULL; + } +} + +void NativeRenderSurface::ReleaseLock() +{ + if( mImpl->mThreadSynchronization ) + { + mImpl->mThreadSynchronization->PostRenderComplete(); + } +} + +} // namespace Dali diff --git a/adaptors/ubuntu/framework-ubuntu.cpp b/adaptors/ubuntu/framework-ubuntu.cpp index fe706ea45..22203ccba 100644 --- a/adaptors/ubuntu/framework-ubuntu.cpp +++ b/adaptors/ubuntu/framework-ubuntu.cpp @@ -194,6 +194,20 @@ std::string Framework::GetBundleId() const return mBundleId; } +std::string Framework::GetResourcePath() +{ + // "DALI_APPLICATION_PACKAGE" is used by Ubuntu specifically to get the already configured Application package path. + const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_PACKAGE"; + char* value = getenv( ubuntuEnvironmentVariable ); + std::string resourcePath; + if ( value != NULL ) + { + resourcePath = value; + } + + return resourcePath; +} + void Framework::SetBundleId(const std::string& id) { mBundleId = id; diff --git a/adaptors/wayland/clipboard/clipboard-impl-wl.cpp b/adaptors/wayland/clipboard/clipboard-impl-wl.cpp index e207e6fb7..611ddf3ef 100644 --- a/adaptors/wayland/clipboard/clipboard-impl-wl.cpp +++ b/adaptors/wayland/clipboard/clipboard-impl-wl.cpp @@ -87,11 +87,10 @@ bool Clipboard::SetItem(const std::string &itemData ) } /* - * Get string at given index of clipboard + * Request clipboard service to retrieve an item */ -std::string Clipboard::GetItem( unsigned int index ) // change string to a Dali::Text object. +void Clipboard::RequestItem() { - return "not supported"; } /* @@ -111,10 +110,19 @@ void Clipboard::ShowClipboard() { } -void Clipboard::HideClipboard() +void Clipboard::HideClipboard(bool skipFirstHide) { } +bool Clipboard::IsVisible() const +{ + return false; +} + +char* Clipboard::ExcuteBuffered( bool type, void *event ) +{ + return NULL; +} } // namespace Adaptor diff --git a/adaptors/wayland/display-connection-impl-wl.cpp b/adaptors/wayland/display-connection-impl-wl.cpp index 3b8751944..c08e05598 100644 --- a/adaptors/wayland/display-connection-impl-wl.cpp +++ b/adaptors/wayland/display-connection-impl-wl.cpp @@ -60,6 +60,10 @@ bool DisplayConnection::InitializeEgl(EglInterface& egl) return true; } +void DisplayConnection::SetSurfaceType( RenderSurface::Type type ) +{ +} + void DisplayConnection::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) { CompositorOutput::GetDpi( dpiHorizontal, dpiVertical); diff --git a/adaptors/wayland/display-connection-impl.h b/adaptors/wayland/display-connection-impl.h index f531628d6..2f957394a 100644 --- a/adaptors/wayland/display-connection-impl.h +++ b/adaptors/wayland/display-connection-impl.h @@ -80,6 +80,8 @@ public: */ bool InitializeEgl(EglInterface& egl); + void SetSurfaceType( RenderSurface::Type type ); + public: /** @@ -89,6 +91,10 @@ public: protected: + EGLNativeDisplayType GetNativeDisplay(); + + void ReleaseNativeDisplay(); + // Undefined DisplayConnection(const DisplayConnection&); diff --git a/adaptors/wayland/input/text/imf/imf-manager-impl-wl.cpp b/adaptors/wayland/input/text/imf/imf-manager-impl-wl.cpp index ad95ac5d7..731763e9a 100644 --- a/adaptors/wayland/input/text/imf/imf-manager-impl-wl.cpp +++ b/adaptors/wayland/input/text/imf/imf-manager-impl-wl.cpp @@ -303,6 +303,10 @@ const std::string& ImfManager::GetSurroundingText() const return mSurroundingText; } +void ImfManager::NotifyTextInputMultiLine( bool multiLine ) +{ +} + } // Adaptor } // Internal diff --git a/adaptors/wayland/input/text/imf/imf-manager-impl.h b/adaptors/wayland/input/text/imf/imf-manager-impl.h index 7a0d2872b..1af41bcb6 100644 --- a/adaptors/wayland/input/text/imf/imf-manager-impl.h +++ b/adaptors/wayland/input/text/imf/imf-manager-impl.h @@ -148,6 +148,11 @@ public: */ const std::string& GetSurroundingText() const; + /** + * @copydoc Dali::ImfManager::NotifyTextInputMultiLine() + */ + void NotifyTextInputMultiLine( bool multiLine ); + public: // Signals /** diff --git a/adaptors/wayland/render-surface/render-surface-wl.cpp b/adaptors/wayland/render-surface/render-surface-wl.cpp index 43750a830..f8323ea05 100644 --- a/adaptors/wayland/render-surface/render-surface-wl.cpp +++ b/adaptors/wayland/render-surface/render-surface-wl.cpp @@ -149,7 +149,10 @@ void RenderSurface::SetThreadSynchronization( ThreadSynchronizationInterface& th { } - +RenderSurface::Type RenderSurface::GetSurfaceType() +{ + return RenderSurface::WAYLAND_RENDER_SURFACE; +} } // namespace Wayland diff --git a/adaptors/wayland/render-surface/render-surface-wl.h b/adaptors/wayland/render-surface/render-surface-wl.h index b54c304fb..bbbf4d26e 100644 --- a/adaptors/wayland/render-surface/render-surface-wl.h +++ b/adaptors/wayland/render-surface/render-surface-wl.h @@ -161,6 +161,11 @@ public: // from Dali::RenderSurface */ virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ); + /** + * @copydoc Dali::RenderSurface::GetSurfaceType() + */ + virtual RenderSurface::Type GetSurfaceType(); + protected: // Data Window mWindow; diff --git a/adaptors/wearable/watch/watch-application.h b/adaptors/wearable/watch/watch-application.h index 37fb62b05..f83355ff5 100644 --- a/adaptors/wearable/watch/watch-application.h +++ b/adaptors/wearable/watch/watch-application.h @@ -165,13 +165,15 @@ public: WatchTimeSignal& TimeTickSignal(); /** - * @brief This signal is emitted at every second in ambient mode + * @brief This signal is emitted at each minute in ambient mode * A callback of the following type may be connected: * @code * void YourCallbackName(Application& application, WatchTimeSignal &time); * @endcode * time(watch time handle) will not be available after returning this callback. It will be freed by the framework. * @SINCE_1_1.37 + * @remarks http://tizen.org/privilege/alarm.set privilege is needed to receive ambient ticks at each minute. + * The AmbientTickSignal() will be ignored if your app doesn't have the privilege */ WatchTimeSignal& AmbientTickSignal(); @@ -187,11 +189,13 @@ public: WatchBoolSignal& AmbientChangedSignal(); public: // Not intended for application developers + /// @cond internal /** * @brief Internal constructor * @SINCE_1_1.37 */ explicit DALI_INTERNAL WatchApplication(Internal::Adaptor::WatchApplication* implementation); + /// @endcond }; /** diff --git a/adaptors/wearable/watch/watch-time.cpp b/adaptors/wearable/watch/watch-time.cpp index 34c408971..73890c2fb 100644 --- a/adaptors/wearable/watch/watch-time.cpp +++ b/adaptors/wearable/watch/watch-time.cpp @@ -36,11 +36,6 @@ struct WatchTime::Impl void *mTimeHandle; }; -WatchTime::WatchTime() - :mImpl(NULL) -{ -} - WatchTime::WatchTime(void *time_handle) { mImpl = new Impl(time_handle); @@ -57,6 +52,14 @@ WatchTime::~WatchTime() #ifdef APPCORE_WATCH_AVAILABLE +WatchTime::WatchTime() +{ + watch_time_h watch_time = {0,}; + + watch_time_get_current_time(&watch_time); + mImpl = new Impl(watch_time); +} + int WatchTime::GetHour() const { int hour; @@ -91,6 +94,11 @@ int WatchTime::GetSecond() const #else +WatchTime::WatchTime() + :mImpl(NULL) +{ +} + int WatchTime::GetHour() const { return 0; @@ -111,6 +119,6 @@ int WatchTime::GetSecond() const return 0; } -#endif +#endif // APPCORE_WATCH_AVAILABLE } // namespace Dali diff --git a/adaptors/x11/clipboard-impl-x.cpp b/adaptors/x11/clipboard-impl-x.cpp index 1982b5e58..de8c98d9e 100644 --- a/adaptors/x11/clipboard-impl-x.cpp +++ b/adaptors/x11/clipboard-impl-x.cpp @@ -28,6 +28,7 @@ #include #include #include +#include namespace //unnamed namespace { @@ -127,15 +128,11 @@ bool Clipboard::SetItem(const std::string &itemData ) } /* - * Get string at given index of clipboard + * Request clipboard service to retrieve an item */ -std::string Clipboard::GetItem( unsigned int index ) // change string to a Dali::Text object. +void Clipboard::RequestItem() { - if ( index >= NumberOfItems() ) - { - return ""; - } - + int index = 0; char sendBuf[20]; snprintf( sendBuf, 20, "%s%d", CBHM_ITEM, index ); Ecore_X_Atom xAtomCbhmItem = ecore_x_atom_get( sendBuf ); @@ -150,10 +147,17 @@ std::string Clipboard::GetItem( unsigned int index ) // change string to a Dali Ecore_X_Atom xAtomCbhmError = ecore_x_atom_get( CBHM_ERROR ); if ( xAtomItemType != xAtomCbhmError ) { - return clipboardString; + // Call ClipboardEventNotifier to notify event observe of retrieved string + Dali::ClipboardEventNotifier clipboardEventNotifier(ClipboardEventNotifier::Get()); + if ( clipboardEventNotifier ) + { + ClipboardEventNotifier& notifierImpl( ClipboardEventNotifier::GetImplementation( clipboardEventNotifier ) ); + + notifierImpl.SetContent( clipboardString ); + notifierImpl.EmitContentSelectedSignal(); + } } } - return ""; } /* @@ -190,7 +194,7 @@ void Clipboard::ShowClipboard() ECore::WindowInterface::SendXEvent( ecore_x_display_get(), cbhmWin, False, NoEventMask, atomCbhmMsg, 8, SHOW ); } -void Clipboard::HideClipboard() +void Clipboard::HideClipboard(bool skipFirstHide) { Ecore_X_Window cbhmWin = ECore::WindowInterface::GetWindow(); // Launch the clipboard window @@ -201,6 +205,15 @@ void Clipboard::HideClipboard() ecore_x_selection_secondary_clear(); } +bool Clipboard::IsVisible() const +{ + return false; +} + +char* Clipboard::ExcuteBuffered( bool type, void *event ) +{ + return NULL; +} } // namespace Adaptor diff --git a/adaptors/x11/display-connection-impl-x.cpp b/adaptors/x11/display-connection-impl-x.cpp index b0c804b33..b91745889 100644 --- a/adaptors/x11/display-connection-impl-x.cpp +++ b/adaptors/x11/display-connection-impl-x.cpp @@ -44,8 +44,6 @@ DisplayConnection* DisplayConnection::New() DisplayConnection::DisplayConnection() : mDisplay(NULL) { - // Because of DDK issue, we need to use separated x display instead of ecore default display - mDisplay = XOpenDisplay(0); } DisplayConnection::~DisplayConnection() @@ -95,6 +93,15 @@ bool DisplayConnection::InitializeEgl(EglInterface& egl) return true; } +void DisplayConnection::SetSurfaceType( RenderSurface::Type type ) +{ + if( type == RenderSurface::ECORE_RENDER_SURFACE ) + { + // Because of DDK issue, we need to use separated x display instead of ecore default display + mDisplay = XOpenDisplay(0); + } +} + void DisplayConnection::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) { // calculate DPI diff --git a/adaptors/x11/display-connection-impl.h b/adaptors/x11/display-connection-impl.h index c5b7a7088..2c0eabd92 100644 --- a/adaptors/x11/display-connection-impl.h +++ b/adaptors/x11/display-connection-impl.h @@ -80,6 +80,8 @@ public: */ bool InitializeEgl(EglInterface& egl); + void SetSurfaceType( RenderSurface::Type type ); + public: /** diff --git a/adaptors/x11/ecore-x-render-surface.cpp b/adaptors/x11/ecore-x-render-surface.cpp index 6c0401ef8..70b469463 100644 --- a/adaptors/x11/ecore-x-render-surface.cpp +++ b/adaptors/x11/ecore-x-render-surface.cpp @@ -139,6 +139,11 @@ unsigned int EcoreXRenderSurface::GetSurfaceId( Any surface ) const return surfaceId; } +RenderSurface::Type EcoreXRenderSurface::GetSurfaceType() +{ + return RenderSurface::ECORE_RENDER_SURFACE; +} + } // namespace ECore } // namespace Dali diff --git a/adaptors/x11/imf-manager-impl-x.cpp b/adaptors/x11/imf-manager-impl-x.cpp index 57ffb35ba..14dc3854c 100644 --- a/adaptors/x11/imf-manager-impl-x.cpp +++ b/adaptors/x11/imf-manager-impl-x.cpp @@ -516,6 +516,10 @@ const std::string& ImfManager::GetSurroundingText() const return mSurroundingText; } +void ImfManager::NotifyTextInputMultiLine( bool multiLine ) +{ +} + } // Adaptor } // Internal diff --git a/adaptors/x11/pixmap-render-surface-x.cpp b/adaptors/x11/pixmap-render-surface-x.cpp index 2cfc77684..9447e8a13 100644 --- a/adaptors/x11/pixmap-render-surface-x.cpp +++ b/adaptors/x11/pixmap-render-surface-x.cpp @@ -314,6 +314,11 @@ void PixmapRenderSurface::ReleaseLock() } } +RenderSurface::Type PixmapRenderSurface::GetSurfaceType() +{ + return RenderSurface::ECORE_RENDER_SURFACE; +} + } // namespace ECore } // namespace Dali diff --git a/automated-tests/patch-coverage.pl b/automated-tests/patch-coverage.pl index 68754eb53..c19953b23 100755 --- a/automated-tests/patch-coverage.pl +++ b/automated-tests/patch-coverage.pl @@ -45,16 +45,14 @@ our $repo = Git->repository(); our $debug=0; our $pd_debug=0; our $opt_cached; -our $opt_head; -#our $opt_workingtree; -#our $opt_diff=1; our $opt_help; -our $opt_verbose; +our $opt_output; our $opt_quiet; +our $opt_verbose; my %options = ( "cached" => { "optvar"=>\$opt_cached, "desc"=>"Use index" }, - "head" => { "optvar"=>\$opt_head, "desc"=>"Use git show" }, + "output:s" => { "optvar"=>\$opt_output, "desc"=>"Generate html output"}, "help" => { "optvar"=>\$opt_help, "desc"=>""}, "quiet" => { "optvar"=>\$opt_quiet, "desc"=>""}, "verbose" => { "optvar"=>\$opt_verbose, "desc"=>"" }); @@ -323,6 +321,7 @@ sub get_coverage # output for the patch. sub run_diff { + #print "run_diff(" . join(" ", @_) . ")\n"; my ($fh, $c) = $repo->command_output_pipe(@_); our @patch=(); while(<$fh>) @@ -332,6 +331,8 @@ sub run_diff } $repo->command_close_pipe($fh, $c); + print "Patch size: " . scalar(@patch) . "\n" if $debug; + # @patch has slurped diff for all files... my $filesref = parse_diff ( \@patch ); show_patch_lines($filesref) if $debug; @@ -344,6 +345,7 @@ sub run_diff for my $file (keys(%$filesref)) { my ($name, $path, $suffix) = fileparse($file, qr{\.[^.]*$}); + next if($path !~ /^dali/); if($suffix eq ".cpp" || $suffix eq ".c" || $suffix eq ".h") { get_coverage($file, $filesref); @@ -353,7 +355,6 @@ sub run_diff return $filesref; } - sub calc_patch_coverage_percentage { my $filesref = shift; @@ -362,6 +363,9 @@ sub calc_patch_coverage_percentage foreach my $file (keys(%$filesref)) { + my ($name, $path, $suffix) = fileparse($file, qr{\.[^.]*$}); + next if($path !~ /^dali/); + my $covered_lines = 0; my $uncovered_lines = 0; @@ -401,7 +405,7 @@ sub calc_patch_coverage_percentage my $percent = 0; if($total_exec > 0) { $percent = 100 * $total_covered_lines / $total_exec; } - return $percent; + return [ $total_exec, $percent ]; } sub patch_output @@ -480,6 +484,117 @@ sub patch_output } +sub patch_html_output +{ + my $filesref = shift; + + open( my $filehandle, ">", $opt_output ) || die "Can't open $opt_output for writing:$!\n"; + + my $OUTPUT_FH = select; + select $filehandle; + print < + + +Patch Coverage + + +EOH + + foreach my $file (keys(%$filesref)) + { + my ($name, $path, $suffix) = fileparse($file, qr{\.[^.]*$}); + next if($path !~ /^dali/); + + my $patchref = $filesref->{$file}->{"patch"}; + my $b_lines_ref = $filesref->{$file}->{"b_lines"}; + my $coverage_ref = $filesref->{$file}->{"coverage"}; + print "

$file

\n"; + + if($coverage_ref) + { + if( $coverage_ref->{"covered_lines"} > 0 + || + $coverage_ref->{"uncovered_lines"} > 0 ) + { + print "

Covered: " . + $coverage_ref->{"covered_lines"} . "

" . + "

Uncovered: " . + $coverage_ref->{"uncovered_lines"} . "

"; + } + } + else + { + print "

"; + my $span=0; + if($suffix eq ".cpp" || $suffix eq ".c" || $suffix eq ".h") + { + print ""; + $span=1; + } + print "No coverage found"; + print "" if $span; + } + print "

"; + + for my $patch (@$patchref) + { + my $hunkstr="Hunk: " . $patch->[0]; + if( $patch->[1] > 1 ) + { + $hunkstr .= " - " . ($patch->[0]+$patch->[1]-1); + } + print "

" . $hunkstr . "

"; + + print "
";
+            for(my $i = 0; $i < $patch->[1]; $i++ )
+            {
+                my $line = $i + $patch->[0];
+                my $num_line_digits=log($line)/log(10);
+                for $i (0..(6-$num_line_digits-1))
+                {
+                    print " ";
+                }
+                print "$line  ";
+
+                if($coverage_ref)
+                {
+                    my $color;
+                    if($coverage_ref->{"covered"}->{$line})
+                    {
+                        print("");
+                    }
+                    elsif($coverage_ref->{"uncovered"}->{$line})
+                    {
+                        print("");
+                    }
+                    else
+                    {
+                        #print("");
+                    }
+                    my $src=$coverage_ref->{"src"}->{$line};
+                    chomp($src);
+                    #print $color, "$src\n", RESET;
+                    print "$src\n";
+                }
+                else
+                {
+                    # We don't have coverage data, so print it from the patch instead.
+                    my $src = $b_lines_ref->{$line};
+                    print "$src\n";
+                }
+            }
+            print "<\pre>\n";
+        }
+    }
+
+    print $filehandle "
\n\n\n"; + close $filehandle; + select $OUTPUT_FH; +} + + ################################################################################ ## MAIN ## ################################################################################ @@ -492,30 +607,82 @@ chdir "build/tizen"; my @cmd=('--no-pager','diff','--no-ext-diff','-U0','--no-color'); my $status = $repo->command("status", "-s"); -if( $status eq "" ) +if( $status eq "" && !scalar(@ARGV)) { - # There are no changes in the index or working tree. Use the last patch instead + # There are no changes in the index or working tree, and + # no diff arguments to append. Use the last patch instead. push @cmd, ('HEAD~1','HEAD'); } -elsif($opt_cached) # TODO: Remove this option. Instead, need full diff +else { - push @cmd, "--cached"; + # detect if there are only cached changes or only working tree changes + my $cached = 0; + my $working = 0; + for my $fstat ( split(/\n/, $status) ) + { + if(substr( $fstat, 0, 1 ) ne " "){ $cached++; } + if(substr( $fstat, 1, 1 ) ne " "){ $working++; } + } + if($cached > 0 ) + { + if($working == 0) + { + push @cmd, "--cached"; + } + else + { + die "Both cached & working files - cannot get correct patch from git\n"; + # Would have to diff from separate clone. + } + } } push @cmd, @ARGV; my $filesref = run_diff(@cmd); -my $percent = calc_patch_coverage_percentage($filesref); -if( ! $opt_quiet ) +chdir $cwd; + +# Check how many actual source files there are in the patch +my $filecount = 0; +foreach my $file (keys(%$filesref)) +{ + my ($name, $path, $suffix) = fileparse($file, qr{\.[^.]*$}); + next if($path !~ /^dali/); + next if($suffix ne ".cpp" && $suffix ne ".c" && $suffix ne ".h"); + $filecount++; +} +if( $filecount == 0 ) +{ + print "No source files found\n"; + exit 0; # Exit with no error. +} + +my $percentref = calc_patch_coverage_percentage($filesref); +if($percentref->[0] == 0) +{ + print "No coverable lines found\n"; + exit 0; +} +my $percent = $percentref->[1]; + +my $color=BOLD RED; +if($opt_output) +{ + print "Outputing to $opt_output\n" if $debug; + patch_html_output($filesref); +} +elsif( ! $opt_quiet ) { patch_output($filesref); - my $color=BOLD RED; if($percent>=90) { $color=GREEN; } - printf("Percentage of change covered: $color %5.2f%\n" . RESET, $percent); + print RESET; } + +printf("Percentage of change covered: %5.2f%\n", $percent); + exit($percent<90); diff --git a/automated-tests/src/dali-adaptor-internal/utc-Dali-FontClient.cpp b/automated-tests/src/dali-adaptor-internal/utc-Dali-FontClient.cpp index fdb1df5b4..0134b9bbe 100644 --- a/automated-tests/src/dali-adaptor-internal/utc-Dali-FontClient.cpp +++ b/automated-tests/src/dali-adaptor-internal/utc-Dali-FontClient.cpp @@ -27,40 +27,61 @@ using namespace Dali; int UtcDaliFontClient(void) { - const int ORDERED_VALUES[] = { 50, 63, 75, 87, 100, 113, 125, 150, 200 }; + const int ORDERED_VALUES[] = { -1, 50, 63, 75, 87, 100, 113, 125, 150, 200 }; const unsigned int NUM_OF_ORDERED_VALUES = sizeof( ORDERED_VALUES ) / sizeof( int ); TestApplication application; - int preciseIndex = 0; int result=0; - tet_infoline("UtcDaliFontClient center range"); - preciseIndex = 4; - result = TextAbstraction::Internal::ValueToIndex( ORDERED_VALUES[preciseIndex], ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); - DALI_TEST_EQUALS( preciseIndex, result, TEST_LOCATION ); + tet_infoline("UtcDaliFontClient No table"); + result = TextAbstraction::Internal::ValueToIndex( 100, NULL, 0u ); + DALI_TEST_EQUALS( -1, result, TEST_LOCATION ); - tet_infoline("UtcDaliFontClient start of range"); - preciseIndex = 0; - result = TextAbstraction::Internal::ValueToIndex( ORDERED_VALUES[preciseIndex], ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); - DALI_TEST_EQUALS( preciseIndex, result, TEST_LOCATION ); - - tet_infoline("UtcDaliFontClient end of range"); - preciseIndex = 8; - result = TextAbstraction::Internal::ValueToIndex( ORDERED_VALUES[preciseIndex], ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); - DALI_TEST_EQUALS( preciseIndex, result, TEST_LOCATION ); + tet_infoline("UtcDaliFontClient Non defined values"); + result = TextAbstraction::Internal::ValueToIndex( -1, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); + DALI_TEST_EQUALS( 0, result, TEST_LOCATION ); + result = TextAbstraction::Internal::ValueToIndex( -3, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); + DALI_TEST_EQUALS( 0, result, TEST_LOCATION ); - tet_infoline("UtcDaliFontClient below of range"); + tet_infoline("UtcDaliFontClient Between non defined and first of range."); + result = TextAbstraction::Internal::ValueToIndex( 0, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); + DALI_TEST_EQUALS( 1, result, TEST_LOCATION ); result = TextAbstraction::Internal::ValueToIndex( 30, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); - DALI_TEST_EQUALS( 0, result, TEST_LOCATION ); + DALI_TEST_EQUALS( 1, result, TEST_LOCATION ); + result = TextAbstraction::Internal::ValueToIndex( 49, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); + DALI_TEST_EQUALS( 1, result, TEST_LOCATION ); - tet_infoline("UtcDaliFontClient below of range"); - result = TextAbstraction::Internal::ValueToIndex( 220, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); + tet_infoline("UtcDaliFontClient Defined in range"); + for( unsigned int index = 1u; index < NUM_OF_ORDERED_VALUES; ++index ) + { + result = TextAbstraction::Internal::ValueToIndex( ORDERED_VALUES[index], ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); + DALI_TEST_EQUALS( index, result, TEST_LOCATION ); + } + + tet_infoline("UtcDaliFontClient Non defined in range"); + result = TextAbstraction::Internal::ValueToIndex( 51, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); + DALI_TEST_EQUALS( 1, result, TEST_LOCATION ); + result = TextAbstraction::Internal::ValueToIndex( 55, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); + DALI_TEST_EQUALS( 1, result, TEST_LOCATION ); + result = TextAbstraction::Internal::ValueToIndex( 62, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); + DALI_TEST_EQUALS( 2, result, TEST_LOCATION ); + result = TextAbstraction::Internal::ValueToIndex( 64, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); + DALI_TEST_EQUALS( 2, result, TEST_LOCATION ); + result = TextAbstraction::Internal::ValueToIndex( 151, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); DALI_TEST_EQUALS( 8, result, TEST_LOCATION ); + result = TextAbstraction::Internal::ValueToIndex( 175, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); + DALI_TEST_EQUALS( 9, result, TEST_LOCATION ); + result = TextAbstraction::Internal::ValueToIndex( 176, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); + DALI_TEST_EQUALS( 9, result, TEST_LOCATION ); + result = TextAbstraction::Internal::ValueToIndex( 199, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); + DALI_TEST_EQUALS( 9, result, TEST_LOCATION ); - tet_infoline("UtcDaliFontClient zero "); - result = TextAbstraction::Internal::ValueToIndex( 0, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); - DALI_TEST_EQUALS( 0, result, TEST_LOCATION ); + tet_infoline("UtcDaliFontClient above of range"); + result = TextAbstraction::Internal::ValueToIndex( 220, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); + DALI_TEST_EQUALS( 9, result, TEST_LOCATION ); + result = TextAbstraction::Internal::ValueToIndex( 500, ORDERED_VALUES, NUM_OF_ORDERED_VALUES - 1u ); + DALI_TEST_EQUALS( 9, result, TEST_LOCATION ); END_TEST; } diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.cpp index 467bb5262..b50f50648 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.cpp +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.cpp @@ -337,3 +337,51 @@ BufferImage CreateBufferImage() { return CreateBufferImage(4, 4, Color::WHITE); } + +namespace Test +{ + +struct ObjectDestructionFunctor +{ + // Create a ObjectDestructionFunctor passing in a Dali::RefObject* to be monitored and a bool variable. + // Create ObjectRegistry instance and connect to the ObjectDestroyedSignal passing in the above functor for the callback. + // Get the ObjectPointer (Actor::GetObjectPtr) of the Actor to be checked for destruction and assign it to the Dali::RefObject* + // Check the bool variable which would be true when object destroyed. + ObjectDestructionFunctor( Dali::RefObject* objectPtr, bool& refObjectDestroyed ) + : refObjectPointerToCheck( objectPtr ), + refObjectDestroyedBoolean( refObjectDestroyed ) + { + refObjectDestroyed = false; + } + + void operator()( const Dali::RefObject* objectPointer ) + { + if ( refObjectPointerToCheck == objectPointer ) + { + refObjectDestroyedBoolean = true; + } + } + + Dali::RefObject* refObjectPointerToCheck; + bool& refObjectDestroyedBoolean; +}; + +ObjectDestructionTracker::ObjectDestructionTracker() + :mRefObjectDestroyed( false) +{ +} + +void ObjectDestructionTracker::Start( Actor actor ) +{ + ObjectDestructionFunctor destructionFunctor( actor.GetObjectPtr(), mRefObjectDestroyed ); + + ObjectRegistry objectRegistry = Stage::GetCurrent().GetObjectRegistry(); + objectRegistry.ObjectDestroyedSignal().Connect( this, destructionFunctor ); +} + +bool ObjectDestructionTracker::IsDestroyed() +{ + return mRefObjectDestroyed; +} + +} // namespace Test diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.h index 7f81872e1..8cefb7c53 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.h @@ -499,4 +499,45 @@ struct DefaultFunctionCoverage BufferImage CreateBufferImage(); BufferImage CreateBufferImage(int width, int height, const Vector4& color); +// Test namespace to prevent pollution of Dali namespace, add Test helper functions here +namespace Test +{ +/** + * @brief + * + * Helper to check object destruction occurred + * 1) In main part of code create an ObjectDestructionTracker + * 2) Within sub section of main create object Actor test and call Start with Actor to test for destruction + * 3) Perform code which is expected to destroy Actor + * 4) Back in main part of code use IsDestroyed() to test if Actor was destroyed + */ +class ObjectDestructionTracker : public ConnectionTracker +{ +public: + + /** + * @brief Call in main part of code + */ + ObjectDestructionTracker(); + + /** + * @brief Call in sub bock of code where the Actor being checked is still alive. + * + * @param[in] actor Actor to be checked for destruction + */ + void Start( Actor actor ); + + /** + * @brief Call to check if Actor alive or destroyed. + * + * @return bool true if Actor was destroyed + */ + bool IsDestroyed(); + +private: + bool mRefObjectDestroyed; +}; + +} // namespace Test + #endif // __DALI_TEST_SUITE_UTILS_H__ diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-trace-call-stack.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-trace-call-stack.cpp index 3f2e6e5fe..0054e59f3 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-trace-call-stack.cpp +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-trace-call-stack.cpp @@ -130,6 +130,18 @@ bool TraceCallStack::FindMethodAndParams(std::string method, const NamedParams& return FindIndexFromMethodAndParams( method, params ) > -1; } +bool TraceCallStack::FindMethodAndParamsFromStartIndex( std::string method, std::string params, size_t& startIndex ) const +{ + for( size_t i = startIndex; i < mCallStack.size(); ++i ) + { + if( ( mCallStack[i].method.compare( method ) == 0 ) && ( mCallStack[i].paramList.compare( params ) == 0 ) ) + { + startIndex = i; + return true; + } + } + return false; +} /** * Search for a method in the stack with the given parameter list diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-trace-call-stack.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-trace-call-stack.h index 137bfafef..e1882ea0e 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-trace-call-stack.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-trace-call-stack.h @@ -101,6 +101,19 @@ public: */ bool FindMethodAndParams(std::string method, const NamedParams& params) const; + /** + * Search for a method in the stack with the given parameter list. + * The search is done from a given index. + * This allows the order of methods and parameters to be checked. + * @param[in] method The name of the method + * @param[in] params A comma separated list of parameter values + * @param[in/out] startIndex The method index to start looking from. + * This is updated if a method is found so subsequent + * calls can search for methods occuring after this one. + * @return True if the method was in the stack + */ + bool FindMethodAndParamsFromStartIndex( std::string method, std::string params, size_t& startIndex ) const; + /** * Search for a method in the stack with the given parameter list * @param[in] method The name of the method diff --git a/automated-tests/src/dali-adaptor/utc-Dali-Application.cpp b/automated-tests/src/dali-adaptor/utc-Dali-Application.cpp index daaee0b07..829997deb 100644 --- a/automated-tests/src/dali-adaptor/utc-Dali-Application.cpp +++ b/automated-tests/src/dali-adaptor/utc-Dali-Application.cpp @@ -610,3 +610,14 @@ int UtcDaliApplicationMemoryLowSignalN(void) END_TEST; } + +int UtcDaliApplicationGetResourcePathP(void) +{ + Application application = Application::New(); + std::string result ("**invalid path**"); // Calling GetResourcePath should replace this with a system dependent path or "". + result = application.GetResourcePath(); + DALI_TEST_CHECK( result !="**invalid path**" ); + + END_TEST; +} + diff --git a/build/tizen/adaptor-uv/Makefile.am b/build/tizen/adaptor-uv/Makefile.am index f05baca2b..4e8e1d7d2 100644 --- a/build/tizen/adaptor-uv/Makefile.am +++ b/build/tizen/adaptor-uv/Makefile.am @@ -234,6 +234,32 @@ endif # WAYLAND endif +# IVI +if IVI_PROFILE + +adaptor_internal_src_files += $(adaptor_common_internal_src_files) \ + $(adaptor_common_internal_mobile_profile_src_files) \ + $(adaptor_tizen_internal_src_files) \ + $(static_libraries_libunibreak_src_files) + +if WAYLAND +if USE_ECORE_WAYLAND +adaptor_internal_src_files += $(adaptor_ecore_wayland_tizen_internal_src_files) +else +adaptor_internal_src_files += $(adaptor_wayland_tizen_internal_src_files) +endif # USE_ECORE_WAYLAND + +adaptor_internal_src_files += $(adaptor_tizen_internal_egl_extension_src_files)\ + $(adaptor_tizen_internal_native_image_src_files) + +else +adaptor_internal_src_files += $(adaptor_x11_tizen_internal_src_files) \ + $(adaptor_common_internal_egl_extension_src_files) +endif # WAYLAND + +endif # IVI_PROFILE + + # Node JS support for using an external libuv main loop. If not enabled then just use e-core as normal # Used for things like callbacks, file-monintors, x input handling if LIB_UV_EVENT_LOOP @@ -330,6 +356,7 @@ libdali_adaptor_uv_la_CXXFLAGS = \ -DFONT_DOWNLOADED_PATH="\"${fontDownloadedPath}\"" \ -DFONT_APPLICATION_PATH="\"${fontApplicationPath}\"" \ -DFONT_CONFIGURATION_FILE="\"${fontConfigurationFile}\"" \ + -DTIZEN_PLATFORM_CONFIG_SUPPORTED=${tizenPlatformConfigSupported} \ -DNON_POWER_OF_TWO_TEXTURES \ -DDALI_COMPILATION -DDALI_ADAPTOR_COMPILATION \ -Werror -Wall -lgcc \ @@ -392,7 +419,10 @@ libdali_adaptor_uv_la_LIBADD += $(ELEMENTARY_LIBS) \ else -if MOBILE_PROFILE +libdali_adaptor_uv_la_CXXFLAGS += $(ECORE_WAYLAND_CFLAGS) +libdali_adaptor_uv_la_LIBADD += $(ECORE_WAYLAND_LIBS) + +if IVI_PROFILE libdali_adaptor_uv_la_CXXFLAGS += $(ECORE_WAYLAND_CFLAGS) libdali_adaptor_uv_la_LIBADD += $(ECORE_WAYLAND_LIBS) endif @@ -457,6 +487,19 @@ libdali_adaptor_uv_la_CXXFLAGS += $(HAPTIC_CFLAGS) libdali_adaptor_uv_la_LIBADD += endif +if IVI_PROFILE +libdali_adaptor_uv_la_CXXFLAGS += \ + $(DEVICED_CFLAGS) \ + $(EFL_ASSIST_CFLAGS) \ + $(NATIVE_BUFFER_CFLAGS) \ + $(NATIVE_BUFFER_POOL_CFLAGS) + +libdali_adaptor_uv_la_LIBADD += \ + $(EFL_ASSIST_LIBS) \ + $(NATIVE_BUFFER_LIBS) \ + $(NATIVE_BUFFER_POOL_LIBS) +endif + if UBUNTU_PROFILE libdali_adaptor_uv_la_LIBADD += -ljpeg CFLAGS += -fPIC diff --git a/build/tizen/adaptor-uv/configure.ac b/build/tizen/adaptor-uv/configure.ac index dad8f61e3..e61fccfb6 100644 --- a/build/tizen/adaptor-uv/configure.ac +++ b/build/tizen/adaptor-uv/configure.ac @@ -189,13 +189,13 @@ AC_ARG_WITH([tizen-2-2-compatibility], # Tizen Profile options AC_ARG_ENABLE([profile], - [AC_HELP_STRING([--enable-profile=COMMON,MOBILE,WEARABLE,TV,UBUNTU], + [AC_HELP_STRING([--enable-profile=COMMON,MOBILE,WEARABLE,TV,IVI,UBUNTU], [Select the variant of tizen])], [enable_profile=$enableval], [enable_profile=UBUNTU]) # Ensure valid profile selected -if test "x$enable_profile" != "xCOMMON" -a "x$enable_profile" != "xMOBILE" -a "x$enable_profile" != "xWEARABLE" -a "x$enable_profile" != "xTV" -a "x$enable_profile" != "xUBUNTU"; then +if test "x$enable_profile" != "xCOMMON" -a "x$enable_profile" != "xMOBILE" -a "x$enable_profile" != "xWEARABLE" -a "x$enable_profile" != "xTV" -a "x$enable_profile" != "xIVI" -a "x$enable_profile" != "xUBUNTU"; then AC_MSG_ERROR([$enable_profile is an invalid profile]) fi @@ -210,6 +210,7 @@ AM_CONDITIONAL([COMMON_PROFILE], [test x$enable_profile = xCOMMON]) AM_CONDITIONAL([MOBILE_PROFILE], [test x$enable_profile = xMOBILE]) AM_CONDITIONAL([WEARABLE_PROFILE], [test x$enable_profile = xWEARABLE]) AM_CONDITIONAL([TV_PROFILE], [test x$enable_profile = xTV]) +AM_CONDITIONAL([IVI_PROFILE], [test x$enable_profile = xIVI]) AM_CONDITIONAL([UBUNTU_PROFILE], [test x$enable_profile = xUBUNTU]) AM_CONDITIONAL([WAYLAND], [test x$enable_wayland = xyes]) AM_CONDITIONAL([USE_EFL], [test x$enable_efl = xyes]) @@ -242,6 +243,10 @@ if test "x$enable_profile" = "xTV"; then PKG_CHECK_MODULES(OPENGLES20, glesv2) fi +if test "x$enable_profile" = "xIVI"; then +PKG_CHECK_MODULES(OPENGLES20, glesv2) +fi + if test "x$enable_profile" = "xUBUNTU"; then PKG_CHECK_MODULES(OPENGLES20, glesv2 egl) else @@ -284,9 +289,10 @@ fi else -# dali-adaptor-uv for MOBILE profile needs ecore-wayland even if enable_efl==no -# because adaptors/mobile/pixmap-render-surface-factory.cpp uses it. -if test "x$enable_profile" = "xMOBILE"; then +# For adaptors/mobile/native-render-surface-factory.cpp +PKG_CHECK_MODULES(ECORE_WAYLAND, ecore-wayland) + +if test "x$enable_profile" = "xIVI"; then PKG_CHECK_MODULES(ECORE_WAYLAND, ecore-wayland) fi @@ -326,11 +332,18 @@ if test x$FONT_CONFIGURATION_FILE != x; then fontConfigurationFile=$FONT_CONFIGURATION_FILE fi +if test x$TIZEN_PLATFORM_CONFIG_SUPPORTED != x; then + tizenPlatformConfigSupported=$TIZEN_PLATFORM_CONFIG_SUPPORTED +else + tizenPlatformConfigSupported=0 +fi + AC_SUBST(dataReadWriteDir) AC_SUBST(dataReadOnlyDir) AC_SUBST(DALI_ADAPTOR_CFLAGS) AC_SUBST(DALI_PROFILE_CFLAGS) AC_SUBST(fontConfigurationFile) +AC_SUBST(tizenPlatformConfigSupported) # Specify the include directory for development headers #devincludepath=${includedir}/dali/internal @@ -368,7 +381,9 @@ Configuration Font config file: $fontConfigurationFile Building with EFL Libraries: $enable_efl Using Tizen APP FW libraries: $enable_appfw - OpenGL ES version: $enable_gles" + OpenGL ES version: $enable_gles + Tizen Platform Config supported: $tizenPlatformConfigSupported +" # optional output of node.js source path if we're building with libuv if test "x$build_for_libuv" != "xno"; then echo " LibUV header path $with_libuv" diff --git a/build/tizen/adaptor/Makefile.am b/build/tizen/adaptor/Makefile.am index cf80ebd2f..86701578b 100644 --- a/build/tizen/adaptor/Makefile.am +++ b/build/tizen/adaptor/Makefile.am @@ -185,10 +185,12 @@ adaptor_internal_src_files += $(adaptor_wayland_tizen_internal_src_files) endif # USE_ECORE_WAYLAND adaptor_internal_src_files += $(adaptor_tizen_internal_egl_extension_src_files) \ - $(adaptor_tizen_internal_native_image_src_files) + $(adaptor_tizen_internal_native_image_src_files) \ + $(adaptor_common_internal_wayland_mobile_profile_src_files) else adaptor_internal_src_files += $(adaptor_x11_tizen_internal_src_files) \ - $(adaptor_common_internal_egl_extension_src_files) + $(adaptor_common_internal_egl_extension_src_files) \ + $(adaptor_common_internal_x_mobile_profile_src_files) endif # WAYLAND endif # MOBILE_PROFILE @@ -210,10 +212,12 @@ endif # USE_ECORE_WAYLAND adaptor_internal_src_files += $(adaptor_tizen_internal_egl_extension_src_files) \ $(adaptor_tizen_internal_native_image_src_files) \ - $(adaptor_internal_wearable_profile_src_files) + $(adaptor_internal_wearable_profile_src_files) \ + $(adaptor_common_internal_wayland_mobile_profile_src_files) else adaptor_internal_src_files += $(adaptor_x11_tizen_internal_src_files) \ - $(adaptor_common_internal_egl_extension_src_files) + $(adaptor_common_internal_egl_extension_src_files) \ + $(adaptor_common_internal_x_mobile_profile_src_files) endif # WAYLAND endif # WEARABLE @@ -245,6 +249,33 @@ endif # WAYLAND endif +# IVI +if IVI_PROFILE + +adaptor_internal_src_files += $(adaptor_common_internal_src_files) \ + $(adaptor_common_internal_mobile_profile_src_files) \ + $(adaptor_tizen_internal_src_files) \ + $(static_libraries_libunibreak_src_files) + +if WAYLAND + +if USE_ECORE_WAYLAND +adaptor_internal_src_files += $(adaptor_ecore_wayland_tizen_internal_src_files) +else +adaptor_internal_src_files += $(adaptor_wayland_tizen_internal_src_files) +endif # USE_ECORE_WAYLAND + +adaptor_internal_src_files += $(adaptor_tizen_internal_egl_extension_src_files) \ + $(adaptor_tizen_internal_native_image_src_files) +else +adaptor_internal_src_files += $(adaptor_x11_tizen_internal_src_files) \ + $(adaptor_common_internal_egl_extension_src_files) +endif # WAYLAND + +endif # IVI_PROFILE + + + # Node JS support for using an external libuv main loop. If not enabled then just use e-core as normal # Used for things like callbacks, file-monintors, x input handling if LIB_UV_EVENT_LOOP @@ -344,6 +375,7 @@ libdali_adaptor_la_CXXFLAGS = \ -DFONT_DOWNLOADED_PATH="\"${fontDownloadedPath}\"" \ -DFONT_APPLICATION_PATH="\"${fontApplicationPath}\"" \ -DFONT_CONFIGURATION_FILE="\"${fontConfigurationFile}\"" \ + -DTIZEN_PLATFORM_CONFIG_SUPPORTED=${tizenPlatformConfigSupported} \ -DNON_POWER_OF_TWO_TEXTURES \ -DDALI_COMPILATION -DDALI_ADAPTOR_COMPILATION \ -Werror -Wall -lgcc \ @@ -466,6 +498,19 @@ libdali_adaptor_la_CXXFLAGS += $(HAPTIC_CFLAGS) libdali_adaptor_la_LIBADD += endif +if IVI_PROFILE +libdali_adaptor_la_CXXFLAGS += \ + $(DEVICED_CFLAGS) \ + $(EFL_ASSIST_CFLAGS) \ + $(NATIVE_BUFFER_CFLAGS) \ + $(NATIVE_BUFFER_POOL_CFLAGS) + +libdali_adaptor_la_LIBADD += \ + $(EFL_ASSIST_LIBS) \ + $(NATIVE_BUFFER_LIBS) \ + $(NATIVE_BUFFER_POOL_LIBS) +endif + if UBUNTU_PROFILE libdali_adaptor_la_LIBADD += -ljpeg CFLAGS += -fPIC diff --git a/build/tizen/adaptor/configure.ac b/build/tizen/adaptor/configure.ac index 6764320c2..f008052d2 100644 --- a/build/tizen/adaptor/configure.ac +++ b/build/tizen/adaptor/configure.ac @@ -189,13 +189,13 @@ AC_ARG_WITH([tizen-2-2-compatibility], # Tizen Profile options AC_ARG_ENABLE([profile], - [AC_HELP_STRING([--enable-profile=COMMON,MOBILE,WEARABLE,TV,UBUNTU], + [AC_HELP_STRING([--enable-profile=COMMON,MOBILE,WEARABLE,TV,IVI,UBUNTU], [Select the variant of tizen])], [enable_profile=$enableval], [enable_profile=UBUNTU]) # Ensure valid profile selected -if test "x$enable_profile" != "xCOMMON" -a "x$enable_profile" != "xMOBILE" -a "x$enable_profile" != "xWEARABLE" -a "x$enable_profile" != "xTV" -a "x$enable_profile" != "xUBUNTU"; then +if test "x$enable_profile" != "xCOMMON" -a "x$enable_profile" != "xMOBILE" -a "x$enable_profile" != "xWEARABLE" -a "x$enable_profile" != "xTV" -a "x$enable_profile" != "xIVI" -a "x$enable_profile" != "xUBUNTU"; then AC_MSG_ERROR([$enable_profile is an invalid profile]) fi @@ -210,6 +210,7 @@ AM_CONDITIONAL([COMMON_PROFILE], [test x$enable_profile = xCOMMON]) AM_CONDITIONAL([MOBILE_PROFILE], [test x$enable_profile = xMOBILE]) AM_CONDITIONAL([WEARABLE_PROFILE], [test x$enable_profile = xWEARABLE]) AM_CONDITIONAL([TV_PROFILE], [test x$enable_profile = xTV]) +AM_CONDITIONAL([IVI_PROFILE], [test x$enable_profile = xIVI]) AM_CONDITIONAL([UBUNTU_PROFILE], [test x$enable_profile = xUBUNTU]) AM_CONDITIONAL([WAYLAND], [test x$enable_wayland = xyes]) AM_CONDITIONAL([USE_EFL], [test x$enable_efl = xyes]) @@ -251,6 +252,10 @@ if test "x$enable_profile" = "xTV"; then PKG_CHECK_MODULES(OPENGLES20, glesv2) fi +if test "x$enable_profile" = "xIVI"; then +PKG_CHECK_MODULES(OPENGLES20, glesv2) +fi + if test "x$enable_profile" = "xUBUNTU"; then PKG_CHECK_MODULES(OPENGLES20, glesv2 egl) #PKG_CHECK_MODULES(OPENGLES20, gl egl) @@ -328,6 +333,12 @@ else dataReadOnlyDir=${prefix}/share/dali/ fi +if test x$TIZEN_PLATFORM_CONFIG_SUPPORTED != x; then + tizenPlatformConfigSupported=$TIZEN_PLATFORM_CONFIG_SUPPORTED +else + tizenPlatformConfigSupported=0 +fi + if test x$FONT_CONFIGURATION_FILE != x; then fontConfigurationFile=$FONT_CONFIGURATION_FILE fi @@ -337,6 +348,7 @@ AC_SUBST(dataReadOnlyDir) AC_SUBST(DALI_ADAPTOR_CFLAGS) AC_SUBST(DALI_PROFILE_CFLAGS) AC_SUBST(fontConfigurationFile) +AC_SUBST(tizenPlatformConfigSupported) # Specify the include directory for development headers #devincludepath=${includedir}/dali/internal @@ -376,6 +388,7 @@ Configuration Building with EFL Libraries: $enable_efl Using Tizen APP FW libraries: $enable_appfw OpenGL ES version: $enable_gles + Tizen Platform Config supported $tizenPlatformConfigSupported TizenVR Engine: $enable_tizenvr TizenVR Engine Dir: $with_tizenvr_dir " diff --git a/packaging/dali-adaptor.spec b/packaging/dali-adaptor.spec index 2c77b5657..96ed70b1b 100644 --- a/packaging/dali-adaptor.spec +++ b/packaging/dali-adaptor.spec @@ -14,7 +14,7 @@ Name: dali-adaptor Summary: The DALi Tizen Adaptor -Version: 1.1.45 +Version: 1.2.5 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-2-Clause and MIT @@ -27,7 +27,8 @@ Requires: giflib #need libtzplatform-config for directory if tizen version is 3.x -%if "%{tizen_version_major}" == "3" +%if "%{tizen_version_major}" >= "3" +%define tizen_platform_config_supported 1 BuildRequires: pkgconfig(libtzplatform-config) %endif @@ -67,6 +68,15 @@ BuildRequires: pkgconfig(appcore-watch) %define gles_requirement_setup 1 %endif +%if "%{profile}" == "ivi" +%define dali_profile IVI +%define dali_feedback_plugin 0 +%define dali_videoplayer_plugin 1 +%define shaderbincache_flag DISABLE +BuildRequires: pkgconfig(glesv2) +%define gles_requirement_setup 1 +%endif + %if "%{profile}" == "common" %define dali_profile COMMON %define dali_feedback_plugin 0 @@ -219,22 +229,22 @@ VideoPlayer plugin to play a video file for Dali %prep %setup -q -#Use TZ_PATH when tizen version is 3.x +#Use TZ_PATH when tizen version is 3.x or greater -%if "%{tizen_version_major}" == "2" -%define dali_data_rw_dir /usr/share/dali/ -%define dali_data_ro_dir /usr/share/dali/ -%define font_preloaded_path /usr/share/fonts/ -%define font_downloaded_path /opt/share/fonts/ -%define font_application_path /usr/share/app_fonts/ -%define font_configuration_file /opt/etc/fonts/conf.avail/99-slp.conf -%else +%if "%{tizen_version_major}" >= "3" %define dali_data_rw_dir %TZ_SYS_RO_SHARE/dali/ %define dali_data_ro_dir %TZ_SYS_RO_SHARE/dali/ %define font_preloaded_path %TZ_SYS_RO_SHARE/fonts/ %define font_downloaded_path %TZ_SYS_SHARE/fonts/ %define font_application_path %TZ_SYS_RO_SHARE/app_fonts/ %define font_configuration_file %TZ_SYS_ETC/fonts/conf.avail/99-slp.conf +%else +%define dali_data_rw_dir /usr/share/dali/ +%define dali_data_ro_dir /usr/share/dali/ +%define font_preloaded_path /usr/share/fonts/ +%define font_downloaded_path /opt/share/fonts/ +%define font_application_path /usr/share/app_fonts/ +%define font_configuration_file /opt/etc/fonts/conf.avail/99-slp.conf %endif %define user_shader_cache_dir %{dali_data_ro_dir}/core/shaderbin/ @@ -274,6 +284,9 @@ FONT_PRELOADED_PATH="%{font_preloaded_path}" ; export FONT_PRELOADED_PATH FONT_DOWNLOADED_PATH="%{font_downloaded_path}" ; export FONT_DOWNLOADED_PATH FONT_APPLICATION_PATH="%{font_application_path}" ; export FONT_APPLICATION_PATH FONT_CONFIGURATION_FILE="%{font_configuration_file}" ; export FONT_CONFIGURATION_FILE +%if 0%{?tizen_platform_config_supported} +TIZEN_PLATFORM_CONFIG_SUPPORTED="%{tizen_platform_config_supported}" ; export TIZEN_PLATFORM_CONFIG_SUPPORTED +%endif # Default to GLES 2.0 if not specified. %{!?target_gles_version: %define target_gles_version 20} diff --git a/platform-abstractions/tizen/image-loaders/loader-gif.cpp b/platform-abstractions/tizen/image-loaders/loader-gif.cpp index 9bb365706..8f8481cc9 100644 --- a/platform-abstractions/tizen/image-loaders/loader-gif.cpp +++ b/platform-abstractions/tizen/image-loaders/loader-gif.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -259,13 +259,16 @@ bool HandleImageDescriptionRecordType( Bitmap& bitmap, GifFileType* gifInfo, uns bool HandleExtensionRecordType( GifFileType* gifInfo ) { SavedImage image; - image.ExtensionBlocks = NULL; - image.ExtensionBlockCount = 0; GifByteType *extensionByte( NULL ); #ifdef LIBGIF_VERSION_5_1_OR_ABOVE + ExtensionBlock extensionBlocks; + image.ExtensionBlocks = &extensionBlocks; + image.ExtensionBlockCount = 1; int *extensionBlockTypePointer = &image.ExtensionBlocks->Function; #else + image.ExtensionBlocks = NULL; + image.ExtensionBlockCount = 0; int *extensionBlockTypePointer = &image.Function; #endif diff --git a/text/dali/devel-api/text-abstraction/font-client.cpp b/text/dali/devel-api/text-abstraction/font-client.cpp index 048a6f291..e8fba7f2b 100644 --- a/text/dali/devel-api/text-abstraction/font-client.cpp +++ b/text/dali/devel-api/text-abstraction/font-client.cpp @@ -93,14 +93,21 @@ PointSize26Dot6 FontClient::GetPointSize( FontId id ) return GetImplementation(*this).GetPointSize( id ); } -FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 requestedPointSize, bool preferColor ) +FontId FontClient::FindDefaultFont( Character charcode, + PointSize26Dot6 requestedPointSize, + bool preferColor ) { - return GetImplementation(*this).FindDefaultFont( charcode, requestedPointSize, preferColor ); + return GetImplementation(*this).FindDefaultFont( charcode, + requestedPointSize, + preferColor ); } -FontId FontClient::FindFallbackFont( FontId preferredFont, Character charcode, PointSize26Dot6 requestedPointSize, bool preferColor ) +FontId FontClient::FindFallbackFont( Character charcode, + const FontDescription& preferredFontDescription, + PointSize26Dot6 requestedPointSize, + bool preferColor ) { - return GetImplementation(*this).FindFallbackFont( preferredFont, charcode, requestedPointSize, preferColor ); + return GetImplementation(*this).FindFallbackFont( charcode, preferredFontDescription, requestedPointSize, preferColor ); } FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex ) diff --git a/text/dali/devel-api/text-abstraction/font-client.h b/text/dali/devel-api/text-abstraction/font-client.h index 326622cb6..885fe6c5b 100644 --- a/text/dali/devel-api/text-abstraction/font-client.h +++ b/text/dali/devel-api/text-abstraction/font-client.h @@ -132,36 +132,36 @@ public: /** * @brief Retrieve the list of default fonts supported by the system. * - * @param[out] defaultFonts A list of default font paths, family & style strings. + * @param[out] defaultFonts A list of default font paths, family, width, weight and slant. */ void GetDefaultFonts( FontList& defaultFonts ); /** - * @brief Retrieve the active default font from the system + * @brief Retrieve the active default font from the system. * - * @param[out] fontDescription font structure describing the default font + * @param[out] fontDescription font structure describing the default font. */ void GetDefaultPlatformFontDescription( FontDescription& fontDescription ); /** * @brief Retrieve the list of fonts supported by the system. * - * @param[out] systemFonts A list of font paths, family & style strings. + * @param[out] systemFonts A list of font paths, family, width, weight and slant. */ void GetSystemFonts( FontList& systemFonts ); /** * @brief Retrieves the font description of a given font @p id. * - * @param[in] id The font id. - * @param[out] fontDescription The path, family & style describing the font. + * @param[in] id The font identifier. + * @param[out] fontDescription The path, family & style (width, weight and slant) describing the font. */ void GetDescription( FontId id, FontDescription& fontDescription ); /** * @brief Retrieves the font point size of a given font @p id. * - * @param[in] id The font id. + * @param[in] id The font identifier. * * @return The point size in 26.6 fractional points. */ @@ -172,10 +172,12 @@ public: * * This is useful when localised strings are provided for multiple languages * i.e. when a single default font does not work for all languages. + * * @param[in] charcode The character for which a font is needed. * @param[in] requestedPointSize The point size in 26.6 fractional points; the default point size is 12*64. - * @param[in] preferColor True if a color font is preferred. - * @return A valid font ID, or zero if the font does not exist. + * @param[in] preferColor @e true if a color font is preferred. + * + * @return A valid font identifier, or zero if the font does not exist. */ FontId FindDefaultFont( Character charcode, PointSize26Dot6 requestedPointSize = DEFAULT_POINT_SIZE, @@ -186,15 +188,17 @@ public: * * This is useful when localised strings are provided for multiple languages * i.e. when a single default font does not work for all languages. - * @param[in] preferredFont The preferred font which may not provide a glyph for charcode. - * The fallback-font will be the closest match to preferredFont, which does support the required glyph. + * * @param[in] charcode The character for which a font is needed. + * @param[in] preferredFontDescription Description of the preferred font which may not provide a glyph for @p charcode. + * The fallback-font will be the closest match to @p preferredFontDescription, which does support the required glyph. * @param[in] requestedPointSize The point size in 26.6 fractional points; the default point size is 12*64. - * @param[in] preferColor True if a color font is preferred. - * @return A valid font ID, or zero if the font does not exist. + * @param[in] preferColor @e true if a color font is preferred. + * + * @return A valid font identifier, or zero if the font does not exist. */ - FontId FindFallbackFont( FontId preferredFont, - Character charcode, + FontId FindFallbackFont( Character charcode, + const FontDescription& preferredFontDescription, PointSize26Dot6 requestedPointSize = DEFAULT_POINT_SIZE, bool preferColor = false ); @@ -204,23 +208,24 @@ public: * @param[in] path The path to a font file. * @param[in] requestedPointSize The point size in 26.6 fractional points; the default point size is 12*64. * @param[in] faceIndex The index of the font face (optional). - * @return A valid font ID, or zero if the font does not exist. + * + * @return A valid font identifier, or zero if the font does not exist. */ FontId GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize = DEFAULT_POINT_SIZE, FaceIndex faceIndex = 0 ); /** - * @brief Retrieve the unique identifier for a font. + * @brief Retrieves a unique font identifier for a given description. * - * @note It the font style is not empty, it will be used instead the font weight and font slant slant. - * - * @param[in] fontDescription A font description. + * @param[in] preferredFontDescription Description of the preferred font. + * The font will be the closest match to @p preferredFontDescription. * @param[in] requestedPointSize The point size in 26.6 fractional points; the default point size is 12*64. * @param[in] faceIndex The index of the font face (optional). - * @return A valid font ID, or zero if the font does not exist. + * + * @return A valid font identifier, or zero if no font is found. */ - FontId GetFontId( const FontDescription& fontDescription, + FontId GetFontId( const FontDescription& preferredFontDescription, PointSize26Dot6 requestedPointSize = DEFAULT_POINT_SIZE, FaceIndex faceIndex = 0 ); @@ -269,7 +274,7 @@ public: /** * @brief Query the metrics for a font. * - * @param[in] fontId The ID of the font for the required glyph. + * @param[in] fontId The identifier of the font for the required glyph. * @param[out] metrics The font metrics. */ void GetFontMetrics( FontId fontId, FontMetrics& metrics ); @@ -277,8 +282,9 @@ public: /** * @brief Retrieve the glyph index for a UTF-32 character code. * - * @param[in] fontId The ID of the font for the required glyph. + * @param[in] fontId The identifier of the font for the required glyph. * @param[in] charcode The UTF-32 character code. + * * @return The glyph index, or zero if the character code is undefined. */ GlyphIndex GetGlyphIndex( FontId fontId, Character charcode ); @@ -287,20 +293,22 @@ public: * @brief Retrieve the metrics for a series of glyphs. * * @param[in,out] array An array of glyph-info structures with initialized FontId & GlyphIndex values. - * It may contain the advance and an offset set into the bearing from the shaping tool. - * On return, the glyph's size value will be initialized. The bearing value will be updated by adding the font's glyph bearing to the one set by the shaping tool. + * It may contain the advance and an offset set into the bearing from the shaping tool. + * On return, the glyph's size value will be initialized. The bearing value will be updated by adding the font's glyph bearing to the one set by the shaping tool. * @param[in] size The size of the array. * @param[in] type The type of glyphs used for rendering; either bitmaps or vectors. * @param[in] horizontal True for horizontal layouts (set to false for vertical layouting). - * @return True if all of the requested metrics were found. + * + * @return @e true if all of the requested metrics were found. */ bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal = true ); /** * @brief Create a bitmap representation of a glyph. * - * @param[in] fontId The ID of the font. + * @param[in] fontId The identifier of the font. * @param[in] glyphIndex The index of a glyph within the specified font. + * * @return A valid BufferImage, or an empty handle if the glyph could not be rendered. */ PixelData CreateBitmap( FontId fontId, GlyphIndex glyphIndex ); @@ -309,7 +317,7 @@ public: * @brief Create a vector representation of a glyph. * * @note This feature requires highp shader support and is not available on all platforms - * @param[in] fontId The ID of the font. + * @param[in] fontId The identifier of the font. * @param[in] glyphIndex The index of a glyph within the specified font. * @param[out] blob A blob of data; this is owned by FontClient and should be copied by the caller of CreateVectorData(). * @param[out] blobLength The length of the blob data, or zero if the blob creation failed. diff --git a/text/dali/devel-api/text-abstraction/font-list.h b/text/dali/devel-api/text-abstraction/font-list.h index 46e2438d7..9170941dc 100644 --- a/text/dali/devel-api/text-abstraction/font-list.h +++ b/text/dali/devel-api/text-abstraction/font-list.h @@ -39,6 +39,7 @@ namespace FontWidth */ enum Type { + NONE, ///< Means not defined. Will use what is set as default, currently NORMAL. ULTRA_CONDENSED, EXTRA_CONDENSED, CONDENSED, @@ -47,7 +48,21 @@ namespace FontWidth SEMI_EXPANDED, EXPANDED, EXTRA_EXPANDED, - ULTRA_EXPANDED, + ULTRA_EXPANDED + }; + + const char* const Name[] = + { + "NONE", + "ULTRA_CONDENSED", + "EXTRA_CONDENSED", + "CONDENSED", + "SEMI_CONDENSED", + "NORMAL", + "SEMI_EXPANDED", + "EXPANDED", + "EXTRA_EXPANDED", + "ULTRA_EXPANDED" }; } // namespace FontWidth @@ -58,6 +73,7 @@ namespace FontWeight */ enum Type { + NONE, ///< Means not defined. Will use what is set as default, currently NORMAL. THIN, ULTRA_LIGHT, EXTRA_LIGHT = ULTRA_LIGHT, @@ -77,6 +93,22 @@ namespace FontWeight HEAVY = BLACK, EXTRA_BLACK = BLACK }; + + const char* const Name[] = + { + "NONE", + "THIN", + "ULTRA_LIGHT", + "LIGHT", + "DEMI_LIGHT", + "BOOK", + "NORMAL", + "MEDIUM", + "DEMI_BOLD", + "BOLD", + "ULTRA_BOLD", + "BLACK" + }; } namespace FontSlant @@ -86,11 +118,20 @@ namespace FontSlant */ enum Type { + NONE, ///< Means not defined. Will use what is set as default, currently NORMAL. NORMAL, ROMAN = NORMAL, ITALIC, OBLIQUE }; + + const char* const Name[] = + { + "NONE", + "NORMAL", + "ITALIC", + "OBLIQUE" + }; } // namespace FontSlant struct FontDescription @@ -98,9 +139,9 @@ struct FontDescription FontDescription() : path(), family(), - width( FontWidth::NORMAL ), - weight( FontWeight::NORMAL ), - slant( FontSlant::NORMAL ) + width( FontWidth::NONE ), + weight( FontWeight::NONE ), + slant( FontSlant::NONE ) {} ~FontDescription() diff --git a/text/dali/devel-api/text-abstraction/script.cpp b/text/dali/devel-api/text-abstraction/script.cpp index 2b534f8b0..265e9aa5e 100644 --- a/text/dali/devel-api/text-abstraction/script.cpp +++ b/text/dali/devel-api/text-abstraction/script.cpp @@ -51,24 +51,87 @@ bool IsRightToLeftScript( Script script ) Script GetCharacterScript( Character character ) { - // Latin script: + // Latin script: It contains punctuation characters and symbols which are not part of the latin script. https://en.wikipedia.org/wiki/Latin_script_in_Unicode // 0x0000 - 0x007f C0 Controls and Basic Latin + // + // ASCII digits (not part of LATIN script): + // 0x0030 - 0x0039 + // + // ASCII punctuation and symbols (not part of LATIN script): + // 0x0020 - 0x002F + // 0x003A - 0x0040 + // 0x005B - 0x0060 + // 0x007B - 0x007E + // + // Controls (not part of LATIN script): + // 0x007F + // // 0x0080 - 0x00ff C1 Controls and Latin-1 Supplement + // + // Controls (not part of LATIN script): + // 0x0080 - 0x009F + // + // Punctuations and symbols (not part of LATIN script): + // 0x00A0 - 0x00BF + // + // Mathematical operators (not part of LATIN script): + // 0x00D7 + // 0x00F7 + // // 0x0100 - 0x017f Latin Extended-A // 0x0180 - 0x024f Latin Extended-B // 0x0250 - 0x02af IPA Extensions // 0x02b0 - 0x02ff Spacing Modifier Letters + // + // Punctuation (not part of LATIN script): + // 0x02B9 - 0x02BF + // // 0x1d00 - 0x1d7f Phonetic Extensions + // + // Uralic Phonetic (not part of LATIN script): + // 0x1D26 - 0x1D2B + // + // Subscripts and superscripts + // 0x1D5D - 0x1D61 + // 0x1D66 - 0x1D6A + // 0x1D78 + // // 0x1d80 - 0x1dbf Phonetic Extensions Supplement + // + // 0x1DBF (subscript or superscript. Not part of LATIN script ) + // // 0x1e00 - 0x1eff Latin Extended Additional // 0x2070 - 0x209f Superscripts and Subscripts - // 0x2100 - 0x214f Letterlike symbols - // 0x2150 - 0x218f Number Forms + // + // 0x2070 (not part of LATIN script) + // 0x2074 - 0x207E (not part of LATIN script) + // + // 0x2100 - 0x214f Letterlike symbols (not part of LATIN script) + // + // 0x212A - 0x212B (are part of LATIN script) + // 0x2132 (are part of LATIN script) + // 0x214E (are part of LATIN script) + // + // 0x2150 - 0x2189 Number Forms + // + // 0x2150 - 0x215F Fractions (not part of LATIN script) + // 0x2189 Fractions (not part of LATIN script) + // // 0x2c60 - 0x2c7f Latin Extended-C // 0xa720 - 0xa7ff Latin Extended-D + // + // 0xA720 - 0xA721 Uralic Phonetic (not part of LATIN script) + // 0xA788 (not part of LATIN script) + // 0xA789 - 0xA78A Budu (not part of LATIN script) + // // 0xab30 - 0xab6f Latin Extended-E + // // 0xfb00 - 0xfb06 Latin Alphabetic Presentation Forms // 0xff00 - 0xffef Halfwidth and Fullwidth Forms + // + // 0xFF00 - 0xFF20 HWFW Symbols (not part of LATIN script) + // 0xFF3B - 0xFF40 HWFW Symbols (not part of LATIN script) + // 0xFF5B - 0xFFEF HWFW Symbols (not part of LATIN script) // Brahmic scripts: // 0x0900 - 0x097f Devanagari @@ -172,6 +235,19 @@ Script GetCharacterScript( Character character ) // 6b. Additional transport and map symbols ( 1F681 - 1F6C5 ) // 6c. Other additional symbols ( 1F30D - 1F567 ) + // Symbols. Work around for these symbols. + // 0x25cb + // 0x25cf + // 0x25a1 + // 0x25a0 + // 0x2664 + // 0x2661 + // 0x2662 + // 0x2667 + // 0x2606 + // 0x25aa + // 0x262a + if( IsCommonScript( character ) ) { return COMMON; @@ -183,16 +259,63 @@ Script GetCharacterScript( Character character ) { if( character <= 0x077f ) { - if( character == 0x00A9 ) + if( ( 0x0030 <= character ) && ( character <= 0x0039 ) ) + { + return ASCII_DIGITS; + } + if( character <= 0x007E ) { - return EMOJI; // 5. Uncategorized: copyright sign + if( ( 0x0020 <= character ) && ( character <= 0x002F ) ) + { + return ASCII_PS; + } + if( ( 0x003A <= character ) && ( character <= 0x0040 ) ) + { + return ASCII_PS; + } + if( ( 0x005B <= character ) && ( character <= 0x0060 ) ) + { + return ASCII_PS; + } + if( ( 0x007B <= character ) && ( character <= 0x007E ) ) + { + return ASCII_PS; + } } - if( character == 0x00AE ) + if( ( 0x007F <= character ) && ( character <= 0x009F ) ) { - return EMOJI; // 5. Uncategorized: registered sign + // 0x007F is actually part of C0 Controls and Basic Latin. However, is the last and only control character of its block + // and the following characters of the next block are consecutive. + return C1_CONTROLS; + } + if( ( 0x00A0 <= character ) && ( character <= 0x00BF ) ) + { + if( character == 0x00A9 ) + { + return EMOJI; // 5. Uncategorized: copyright sign + } + if( character == 0x00AE ) + { + return EMOJI; // 5. Uncategorized: registered sign + } + + return C1_PS; + } + if( character == 0x00D7 ) + { + return C1_MATH; + } + if( character == 0x00F7 ) + { + return C1_MATH; } if( character <= 0x02ff ) { + if( ( 0x02B9 <= character ) && ( character <= 0x02BF ) ) + { + return SML_P; + } + return LATIN; } if( ( 0x0370 <= character ) && ( character <= 0x03ff ) ) @@ -318,6 +441,27 @@ Script GetCharacterScript( Character character ) } if( ( 0x1d00 <= character ) && ( character <= 0x1eff ) ) { + if( ( 0x1D26 <= character ) && ( character <= 0x1D2B ) ) + { + return PHONETIC_U; + } + if( ( 0x1D5D <= character ) && ( character <= 0x1D61 ) ) + { + return PHONETIC_SS; + } + if( ( 0x1D66 <= character ) && ( character <= 0x1D6A ) ) + { + return PHONETIC_SS; + } + if( character == 0x1D78 ) + { + return PHONETIC_SS; + } + if( character == 0x1DBF) + { + return PHONETIC_SS; + } + return LATIN; } } @@ -337,6 +481,15 @@ Script GetCharacterScript( Character character ) } if( ( 0x2070 <= character ) && ( character <= 0x209f ) ) { + if( character == 0x2070 ) + { + return NUMERIC_SS; + } + if( ( 0x2074 <= character ) && ( character <= 0x207E ) ) + { + return NUMERIC_SS; + } + return LATIN; } if( character == 0x20e3 ) @@ -351,10 +504,69 @@ Script GetCharacterScript( Character character ) { return EMOJI; // 5. Uncategorized: information source } - if( ( 0x2100 <= character ) && ( character <= 0x218f ) ) - { + if( ( 0x2100 <= character ) && ( character <= 0x2189 ) ) + { + if( ( 0x2100 <= character ) && ( character <= 0x214f ) ) + { + if( ( 0x212A <= character ) && ( character <= 0x212B ) ) + { + return LATIN; + } + if( character == 0x2132 ) + { + return LATIN; + } + if( character == 0x214E ) + { + return LATIN; + } + + return LETTER_LIKE; + } + if( ( 0x2150 <= character ) && ( character <= 0x215F ) ) + { + return FRACTIONS_NF; + } + if( character == 0x2189 ) + { + return FRACTIONS_NF; + } + return LATIN; } + + // Symbols + if( ( 0x25cb == character ) || + ( 0x25cf == character ) || + ( 0x25a1 == character ) ) + { + return SYMBOLS1; + } + + if( 0x25a0 == character ) + { + return SYMBOLS2; + } + + if( ( 0x2664 == character ) || + ( 0x2661 == character ) || + ( 0x2662 == character ) || + ( 0x2667 == character ) ) + { + return SYMBOLS3; + } + + if( ( 0x2606 == character ) || + ( 0x25aa == character ) ) + { + return SYMBOLS4; + } + + if( 0x262a == character ) + { + return SYMBOLS5; + } + // U+2194 5. Uncategorized: left right arrow // U+2B55 5. Uncategorized: heavy large circle if( ( 0x2194 <= character ) && ( character <= 0x2B55 ) ) @@ -441,6 +653,27 @@ Script GetCharacterScript( Character character ) } if( ( 0xa720 <= character ) && ( character <= 0xa7ff ) ) { + if( character == 0xA720 ) + { + return PHONETIC_U; + } + if( character == 0xA721 ) + { + return PHONETIC_U; + } + if( character == 0xA788 ) + { + return NON_LATIN_LED; + } + if( character == 0xA789 ) + { + return NON_LATIN_LED; + } + if( character == 0xA78A ) + { + return NON_LATIN_LED; + } + return LATIN; } if( ( 0xa960 <= character ) && ( character <= 0xa97f ) ) @@ -484,6 +717,19 @@ Script GetCharacterScript( Character character ) } if( ( 0xff00 <= character ) && ( character <= 0xffef ) ) { + if( ( 0xFF00 <= character ) && ( character <= 0xFF20 ) ) + { + return HWFW_S; + } + if( ( 0xFF3B <= character ) && ( character <= 0xFF40 ) ) + { + return HWFW_S; + } + if( ( 0xFF5B <= character ) && ( character <= 0xFFEF ) ) + { + return HWFW_S; + } + return LATIN; } if( ( 0x1ee00 <= character ) && ( character <= 0x1eeff ) ) diff --git a/text/dali/devel-api/text-abstraction/script.h b/text/dali/devel-api/text-abstraction/script.h index ee08ab2cd..753563e15 100644 --- a/text/dali/devel-api/text-abstraction/script.h +++ b/text/dali/devel-api/text-abstraction/script.h @@ -36,84 +36,134 @@ namespace TextAbstraction */ enum Script { - COMMON, ///< Valid for all scripts. i.e white space or '\n'. - - CYRILLIC, ///< The Cyrillic script. Used by Russian, Bulgarian, Ukrainian, Macedonian, ... - GREEK, ///< The Greek script. Used by Greek. - LATIN, ///< The latin script. Used by many western languages and others around the world. - - ARABIC, ///< The arabic script. Used by Arab and Urdu among others. - HEBREW, ///< The Hebrew script. Used by the Hebrew, Yiddish, Ladino, and Judeo-Arabic. - - ARMENIAN, ///< The Armenian script. Used by Armenian. - GEORGIAN, ///< The Georgian script. Used by Georgian. - - CJK, ///< The CJK script. Used by Chinese, Japanese, Korean and Vietnamese(old writing system). - HANGUL, ///< The Hangul jamo script. Used by Korean. - HIRAGANA, ///< The Hiragana script. Used by the Japanese. - KATAKANA, ///< The Katakana script. Used by the Japanese. - BOPOMOFO, ///< The Bopomofo script. Also called Zhuyin fuhao or Zhuyin. A phonetic notation used for the transcription of spoken Chinese. - - BENGALI, ///< The Bengali script. Used by Bangla, Assamese, Bishnupriya Manipuri, Daphla, Garo, Hallam, Khasi, Mizo, Munda, Naga, Rian, and Santali. - BURMESE, ///< The Burmese script. Used by the Burmese (Myanmar) language. - DEVANAGARI, ///< The devanagari script. Used by Hindi, Marathi, Sindhi, Nepali and Sanskrit. - GUJARATI, ///< The Gujarati script. Used by Gujarati. - GURMUKHI, ///< The Gurmukhi script. Used by Punjabi. - KANNADA, ///< The Kannada script. Used by Kannada and Tulu. - MALAYALAM, ///< The Malayalam script. Used by Malayalam. - ORIYA, ///< The Oriya script. Used by Oriya (Odia), Khondi, and Santali. - SINHALA, ///< The Sinhala script. Used by Sinhala and Pali. - TAMIL, ///< The Tamil script. Used by Tamil, Badaga, and Saurashtra. - TELUGU, ///< The Telugu script. Used by Telugu, Gondi, and Lambadi. - - LAO, ///< The Lao script. Used by the Lao language. - THAI, ///< The Thai script. Used by the Thai language - KHMER, ///< The Khmer script. Used by the Khmer language. - - EMOJI, ///< The Emoji which map to standardized Unicode characters. - - UNKNOWN ///< The script is unknown. + COMMON, ///< Valid for all scripts. i.e white space or '\n'. + + ASCII_DIGITS, ///< ASCII digits. + ASCII_PS, ///< ASCII punctuation and symbols. + + C1_CONTROLS, ///< Controls of the C1 Controls and Latin-1 Supplement unicode block. + C1_PS, ///< Punctuation and symbols of the C1 Controls and Latin-1 Supplement unicode block. + C1_MATH, ///< Math symbols of the C1 Controls and Latin-1 Supplement unicode block. + + SML_P, ///< Punctuation symbols of the Spacing Modifier Letters unicode block. + PHONETIC_U, ///< Uralic phonetic symbols of the Phonetic Extensions unicode block. + PHONETIC_SS, ///< Subscripts and superscripts of the Phonetic Extensions unicode block. + + NUMERIC_SS, ///< Numeric subscripts and superscripts. + + LETTER_LIKE, ///< Symbols of the Letterlike unicode block. + NUMBER_FORMS, ///< Number Forms unicode block. + FRACTIONS_NF, ///< Numeric fraction symbols of the Number Forms unicode block. + NON_LATIN_LED, ///< Non latin symbols within the Latin Extended D unicode block. + HWFW_S, ///< Non latin symbols within the Halfwidth and fullwidth unicode block. + + CYRILLIC, ///< The Cyrillic script. Used by Russian, Bulgarian, Ukrainian, Macedonian, ... + GREEK, ///< The Greek script. Used by Greek. + LATIN, ///< The latin script. Used by many western languages and others around the world. + + ARABIC, ///< The arabic script. Used by Arab and Urdu among others. + HEBREW, ///< The Hebrew script. Used by the Hebrew, Yiddish, Ladino, and Judeo-Arabic. + + ARMENIAN, ///< The Armenian script. Used by Armenian. + GEORGIAN, ///< The Georgian script. Used by Georgian. + + CJK, ///< The CJK script. Used by Chinese, Japanese, Korean and Vietnamese(old writing system). + HANGUL, ///< The Hangul jamo script. Used by Korean. + HIRAGANA, ///< The Hiragana script. Used by the Japanese. + KATAKANA, ///< The Katakana script. Used by the Japanese. + BOPOMOFO, ///< The Bopomofo script. Also called Zhuyin fuhao or Zhuyin. A phonetic notation used for the transcription of spoken Chinese. + + BENGALI, ///< The Bengali script. Used by Bangla, Assamese, Bishnupriya Manipuri, Daphla, Garo, Hallam, Khasi, Mizo, Munda, Naga, Rian, and Santali. + BURMESE, ///< The Burmese script. Used by the Burmese (Myanmar) language. + DEVANAGARI, ///< The devanagari script. Used by Hindi, Marathi, Sindhi, Nepali and Sanskrit. + GUJARATI, ///< The Gujarati script. Used by Gujarati. + GURMUKHI, ///< The Gurmukhi script. Used by Punjabi. + KANNADA, ///< The Kannada script. Used by Kannada and Tulu. + MALAYALAM, ///< The Malayalam script. Used by Malayalam. + ORIYA, ///< The Oriya script. Used by Oriya (Odia), Khondi, and Santali. + SINHALA, ///< The Sinhala script. Used by Sinhala and Pali. + TAMIL, ///< The Tamil script. Used by Tamil, Badaga, and Saurashtra. + TELUGU, ///< The Telugu script. Used by Telugu, Gondi, and Lambadi. + + LAO, ///< The Lao script. Used by the Lao language. + THAI, ///< The Thai script. Used by the Thai language + KHMER, ///< The Khmer script. Used by the Khmer language. + + EMOJI, ///< The Emoji which map to standardized Unicode characters. + + SYMBOLS1, ///< Some symbols. + SYMBOLS2, ///< Some symbols. + SYMBOLS3, ///< Some symbols. + SYMBOLS4, ///< Some symbols. + SYMBOLS5, ///< Some symbols. + + UNKNOWN ///< The script is unknown. }; const char* const ScriptName[] = { - "COMMON", ///< Valid for all scripts. i.e white space or '\n'. - - "CYRILLIC", ///< The Cyrillic script. Used by Russian, Bulgarian, Ukrainian, Macedonian, ... - "GREEK", ///< The Greek script. Used by Greek. - "LATIN", ///< The latin script. Used by many western languages and others around the world. - - "ARABIC", ///< The arabic script. Used by Arab and Urdu among others. - "HEBREW", ///< The Hebrew script. Used by the Hebrew, Yiddish, Ladino, and Judeo-Arabic. - - "ARMENIAN", ///< The Armenian script. Used by Armenian. - "GEORGIAN", ///< The Georgian script. Used by Georgian. - - "CJK", ///< The CJK script. Used by Chinese, Japanese, Korean and Vietnamese(old writing system). - "HANGUL", ///< The Hangul jamo script. Used by Korean. - "HIRAGANA", ///< The Hiragana script. Used by the Japanese. - "KATAKANA", ///< The Katakana script. Used by the Japanese. - "BOPOMOFO", ///< The Bopomofo script. Also called Zhuyin fuhao or Zhuyin. A phonetic notation used for the transcription of spoken Chinese. - - "BENGALI", ///< The Bengali script. Used by Bangla, Assamese, Bishnupriya Manipuri, Daphla, Garo, Hallam, Khasi, Mizo, Munda, Naga, Rian, and Santali. - "BURMESE", ///< The Burmese script. Used by the Burmese (Myanmar) language. - "DEVANAGARI", ///< The devanagari script. Used by Hindi, Marathi, Sindhi, Nepali and Sanskrit. - "GUJARATI", ///< The Gujarati script. Used by Gujarati. - "GURMUKHI", ///< The Gurmukhi script. Used by Punjabi. - "KANNADA", ///< The Kannada script. Used by Kannada and Tulu. - "MALAYALAM", ///< The Malayalam script. Used by Malayalam. - "ORIYA", ///< The Oriya script. Used by Oriya (Odia), Khondi, and Santali. - "SINHALA", ///< The Sinhala script. Used by Sinhala and Pali. - "TAMIL", ///< The Tamil script. Used by Tamil, Badaga, and Saurashtra. - "TELUGU", ///< The Telugu script. Used by Telugu, Gondi, and Lambadi. - - "LAO", ///< The Lao script. Used by the Lao language. - "THAI", ///< The Thai script. Used by the Thai language - "KHMER", ///< The Khmer script. Used by the Khmer language. - - "EMOJI", ///< The Emoji which map to standardized Unicode characters. - - "UNKNOWN" ///< The script is unknown. + "COMMON", ///< Valid for all scripts. i.e white space or '\n'. + + "ASCII_DIGITS", ///< ASCII digits. + "ASCII_PS", ///< ASCII punctuation and symbols. + + "C1_CONTROLS", ///< Controls of the C1 Controls and Latin-1 Supplement unicode block. + "C1_PS", ///< Punctuation and symbols of the C1 Controls and Latin-1 Supplement unicode block. + "C1_MATH", ///< Math symbols of the C1 Controls and Latin-1 Supplement unicode block. + + "SML_P", ///< Punctuation symbols of the Spacing Modifier Letters unicode block. + "PHONETIC_U", ///< Uralic phonetic symbols of the Phonetic Extensions unicode block. + "PHONETIC_SS", ///< Subscripts and superscripts of the Phonetic Extensions unicode block. + + "NUMERIC_SS", ///< Numeric subscripts and superscripts. + + "LETTER_LIKE", ///< Symbols of the Letterlike unicode block. + "NUMBER_FORMS", ///< Number Forms unicode block. + "FRACTIONS_NF", ///< Numeric fraction symbols of the Number Forms unicode block. + "NON_LATIN_LED", ///< Non latin symbols within the Latin Extended D unicode block. + "HWFW_S", ///< Non latin symbols within the Halfwidth and fullwidth unicode block. + + "CYRILLIC", ///< The Cyrillic script. Used by Russian, Bulgarian, Ukrainian, Macedonian, ... + "GREEK", ///< The Greek script. Used by Greek. + "LATIN", ///< The latin script. Used by many western languages and others around the world. + + "ARABIC", ///< The arabic script. Used by Arab and Urdu among others. + "HEBREW", ///< The Hebrew script. Used by the Hebrew, Yiddish, Ladino, and Judeo-Arabic. + + "ARMENIAN", ///< The Armenian script. Used by Armenian. + "GEORGIAN", ///< The Georgian script. Used by Georgian. + + "CJK", ///< The CJK script. Used by Chinese, Japanese, Korean and Vietnamese(old writing system). + "HANGUL", ///< The Hangul jamo script. Used by Korean. + "HIRAGANA", ///< The Hiragana script. Used by the Japanese. + "KATAKANA", ///< The Katakana script. Used by the Japanese. + "BOPOMOFO", ///< The Bopomofo script. Also called Zhuyin fuhao or Zhuyin. A phonetic notation used for the transcription of spoken Chinese. + + "BENGALI", ///< The Bengali script. Used by Bangla, Assamese, Bishnupriya Manipuri, Daphla, Garo, Hallam, Khasi, Mizo, Munda, Naga, Rian, and Santali. + "BURMESE", ///< The Burmese script. Used by the Burmese (Myanmar) language. + "DEVANAGARI", ///< The devanagari script. Used by Hindi, Marathi, Sindhi, Nepali and Sanskrit. + "GUJARATI", ///< The Gujarati script. Used by Gujarati. + "GURMUKHI", ///< The Gurmukhi script. Used by Punjabi. + "KANNADA", ///< The Kannada script. Used by Kannada and Tulu. + "MALAYALAM", ///< The Malayalam script. Used by Malayalam. + "ORIYA", ///< The Oriya script. Used by Oriya (Odia), Khondi, and Santali. + "SINHALA", ///< The Sinhala script. Used by Sinhala and Pali. + "TAMIL", ///< The Tamil script. Used by Tamil, Badaga, and Saurashtra. + "TELUGU", ///< The Telugu script. Used by Telugu, Gondi, and Lambadi. + + "LAO", ///< The Lao script. Used by the Lao language. + "THAI", ///< The Thai script. Used by the Thai language + "KHMER", ///< The Khmer script. Used by the Khmer language. + + "EMOJI", ///< The Emoji which map to standardized Unicode characters. + + "SYMBOLS1", ///< Some symbols. + "SYMBOLS2", ///< Some symbols. + "SYMBOLS3", ///< Some symbols. + "SYMBOLS4", ///< Some symbols. + "SYMBOLS5", ///< Some symbols. + + "UNKNOWN" ///< The script is unknown. }; /** diff --git a/text/dali/internal/text-abstraction/font-client-helper.cpp b/text/dali/internal/text-abstraction/font-client-helper.cpp index d7e3e1642..d84e4ded2 100644 --- a/text/dali/internal/text-abstraction/font-client-helper.cpp +++ b/text/dali/internal/text-abstraction/font-client-helper.cpp @@ -42,8 +42,13 @@ int ValueToIndex( int value, const int* const table, unsigned int maxIndex ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->FontClient::Plugin::ValueToIndex value(%d)\n", value); - if( ( NULL == table ) || - ( value <= table[0] ) ) + if( NULL == table ) + { + // Return an invalid index if there is no table. + return -1; + } + + if( value <= table[0] ) { return 0; } @@ -53,14 +58,14 @@ int ValueToIndex( int value, const int* const table, unsigned int maxIndex ) return maxIndex; } - for( unsigned int index = 0u; index < maxIndex; ) + for( unsigned int index = 0u; index < maxIndex; ++index ) { const int v1 = table[index]; - const unsigned int indexPlus = ++index; + const unsigned int indexPlus = index + 1u; const int v2 = table[indexPlus]; if( ( v1 < value ) && ( value <= v2 ) ) { - const int result = ( ( value - v1 ) < ( v2 - value ) ) ? index : indexPlus; + const int result = ( ( v1 > 0 ) && ( ( value - v1 ) < ( v2 - value ) ) ) ? index : indexPlus; DALI_LOG_INFO( gLogFilter, Debug::Verbose, "FontClient::Plugin::ValueToIndex result(%d)\n", result ); return result; } diff --git a/text/dali/internal/text-abstraction/font-client-impl.cpp b/text/dali/internal/text-abstraction/font-client-impl.cpp index 42a2a8ad0..040c557be 100644 --- a/text/dali/internal/text-abstraction/font-client-impl.cpp +++ b/text/dali/internal/text-abstraction/font-client-impl.cpp @@ -128,18 +128,28 @@ void FontClient::GetSystemFonts( FontList& systemFonts ) mPlugin->GetSystemFonts( systemFonts ); } -FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 requestedPointSize, bool preferColor ) +FontId FontClient::FindDefaultFont( Character charcode, + PointSize26Dot6 requestedPointSize, + bool preferColor ) { CreatePlugin(); - return mPlugin->FindDefaultFont( charcode, requestedPointSize, preferColor ); + return mPlugin->FindDefaultFont( charcode, + requestedPointSize, + preferColor ); } -FontId FontClient::FindFallbackFont( FontId preferredFont, Character charcode, PointSize26Dot6 requestedPointSize, bool preferColor ) +FontId FontClient::FindFallbackFont( Character charcode, + const FontDescription& preferredFontDescription, + PointSize26Dot6 requestedPointSize, + bool preferColor ) { CreatePlugin(); - return mPlugin->FindFallbackFont( preferredFont, charcode, requestedPointSize, preferColor ); + return mPlugin->FindFallbackFont( charcode, + preferredFontDescription, + requestedPointSize, + preferColor ); } bool FontClient::IsScalable( const FontPath& path ) diff --git a/text/dali/internal/text-abstraction/font-client-impl.h b/text/dali/internal/text-abstraction/font-client-impl.h index 783147ccc..555fca861 100644 --- a/text/dali/internal/text-abstraction/font-client-impl.h +++ b/text/dali/internal/text-abstraction/font-client-impl.h @@ -98,12 +98,17 @@ public: /** * @copydoc Dali::FontClient::FindDefaultFont() */ - FontId FindDefaultFont( Character charcode, PointSize26Dot6 requestedPointSize, bool preferColor ); + FontId FindDefaultFont( Character charcode, + PointSize26Dot6 requestedPointSize, + bool preferColor ); /** * @copydoc Dali::FontClient::FindFallbackFont() */ - FontId FindFallbackFont( FontId preferredFont, Character charcode, PointSize26Dot6 requestedPointSize, bool preferColor ); + FontId FindFallbackFont( Character charcode, + const FontDescription& preferredFontDescription, + PointSize26Dot6 requestedPointSize, + bool preferColor ); /** * @copydoc Dali::FontClient::GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex ) diff --git a/text/dali/internal/text-abstraction/font-client-plugin-impl.cpp b/text/dali/internal/text-abstraction/font-client-plugin-impl.cpp index feaec0546..56e297ceb 100644 --- a/text/dali/internal/text-abstraction/font-client-plugin-impl.cpp +++ b/text/dali/internal/text-abstraction/font-client-plugin-impl.cpp @@ -55,6 +55,7 @@ const bool FONT_FIXED_SIZE_BITMAP( true ); // http://www.freedesktop.org/software/fontconfig/fontconfig-user.html +// NONE -1 --> DEFAULT_FONT_WIDTH (NORMAL) will be used. // ULTRA_CONDENSED 50 // EXTRA_CONDENSED 63 // CONDENSED 75 @@ -64,9 +65,10 @@ const bool FONT_FIXED_SIZE_BITMAP( true ); // EXPANDED 125 // EXTRA_EXPANDED 150 // ULTRA_EXPANDED 200 -const int FONT_WIDTH_TYPE_TO_INT[] = { 50, 63, 75, 87, 100, 113, 125, 150, 200 }; +const int FONT_WIDTH_TYPE_TO_INT[] = { -1, 50, 63, 75, 87, 100, 113, 125, 150, 200 }; const unsigned int NUM_FONT_WIDTH_TYPE = sizeof( FONT_WIDTH_TYPE_TO_INT ) / sizeof( int ); +// NONE -1 --> DEFAULT_FONT_WEIGHT (NORMAL) will be used. // THIN 0 // ULTRA_LIGHT, EXTRA_LIGHT 40 // LIGHT 50 @@ -78,13 +80,14 @@ const unsigned int NUM_FONT_WIDTH_TYPE = sizeof( FONT_WIDTH_TYPE_TO_INT ) / size // BOLD 200 // ULTRA_BOLD, EXTRA_BOLD 205 // BLACK, HEAVY, EXTRA_BLACK 210 -const int FONT_WEIGHT_TYPE_TO_INT[] = { 0, 40, 50, 55, 75, 80, 100, 180, 200, 205, 210 }; +const int FONT_WEIGHT_TYPE_TO_INT[] = { -1, 0, 40, 50, 55, 75, 80, 100, 180, 200, 205, 210 }; const unsigned int NUM_FONT_WEIGHT_TYPE = sizeof( FONT_WEIGHT_TYPE_TO_INT ) / sizeof( int ); -// NORMAL, ROMAN 0 -// ITALIC 100 -// OBLIQUE 110 -const int FONT_SLANT_TYPE_TO_INT[] = { 0, 100, 110 }; +// NONE -1 --> DEFAULT_FONT_SLANT (NORMAL) will be used. +// NORMAL, ROMAN 0 +// ITALIC 100 +// OBLIQUE 110 +const int FONT_SLANT_TYPE_TO_INT[] = { -1, 0, 100, 110 }; const unsigned int NUM_FONT_SLANT_TYPE = sizeof( FONT_SLANT_TYPE_TO_INT ) / sizeof( int ); } // namespace @@ -158,11 +161,11 @@ FontClient::Plugin::FontIdCacheItem::FontIdCacheItem( FontDescriptionId validate { } -FontClient::Plugin::CacheItem::CacheItem( FT_Face ftFace, - const FontPath& path, - PointSize26Dot6 requestedPointSize, - FaceIndex face, - const FontMetrics& metrics ) +FontClient::Plugin::FontFaceCacheItem::FontFaceCacheItem( FT_Face ftFace, + const FontPath& path, + PointSize26Dot6 requestedPointSize, + FaceIndex face, + const FontMetrics& metrics ) : mFreeTypeFace( ftFace ), mPath( path ), mRequestedPointSize( requestedPointSize ), @@ -175,13 +178,13 @@ FontClient::Plugin::CacheItem::CacheItem( FT_Face ftFace, { } -FontClient::Plugin::CacheItem::CacheItem( FT_Face ftFace, - const FontPath& path, - PointSize26Dot6 requestedPointSize, - FaceIndex face, - const FontMetrics& metrics, - float fixedWidth, - float fixedHeight ) +FontClient::Plugin::FontFaceCacheItem::FontFaceCacheItem( FT_Face ftFace, + const FontPath& path, + PointSize26Dot6 requestedPointSize, + FaceIndex face, + const FontMetrics& metrics, + float fixedWidth, + float fixedHeight ) : mFreeTypeFace( ftFace ), mPath( path ), mRequestedPointSize( requestedPointSize ), @@ -408,12 +411,11 @@ FontId FontClient::Plugin::FindFontForCharacter( const FontList& fontList, { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "FontClient::Plugin::FindFontForCharacter\n"); - FontId fontId(0); - bool foundColor(false); + FontId fontId = 0u; + bool foundColor = false; // Traverse the list of fonts. - // Check for each default font if supports the character. - + // Check for each font if supports the character. for( FontList::const_iterator it = fontList.begin(), endIt = fontList.end(); it != endIt; ++it ) @@ -467,7 +469,7 @@ FontId FontClient::Plugin::FindFontForCharacter( const FontList& fontList, } } - // Keep going unless we prefer a different (color) font + // Keep going unless we prefer a different (color) font. if( !preferColor || foundColor ) { FcPatternDestroy( match ); @@ -499,6 +501,7 @@ FontId FontClient::Plugin::FindDefaultFont( Character charcode, fontDescription.width = IntToWidthType( DEFAULT_FONT_WIDTH ); fontDescription.weight = IntToWeightType( DEFAULT_FONT_WEIGHT ); fontDescription.slant = IntToSlantType( DEFAULT_FONT_SLANT ); + SetFontList( fontDescription, mDefaultFonts ); } @@ -509,8 +512,8 @@ FontId FontClient::Plugin::FindDefaultFont( Character charcode, return fontId; } -FontId FontClient::Plugin::FindFallbackFont( FontId preferredFont, - Character charcode, +FontId FontClient::Plugin::FindFallbackFont( Character charcode, + const FontDescription& preferredFontDescription, PointSize26Dot6 requestedPointSize, bool preferColor ) { @@ -518,7 +521,12 @@ FontId FontClient::Plugin::FindFallbackFont( FontId preferredFont, FontId fontId = 0u; FontDescription fontDescription; - GetDescription( preferredFont, fontDescription ); + + // Fill the font description with the preferred font description and complete with the defaults. + fontDescription.family = preferredFontDescription.family.empty() ? DEFAULT_FONT_FAMILY_NAME : preferredFontDescription.family; + fontDescription.weight = ( ( FontWeight::NONE == preferredFontDescription.weight ) ? IntToWeightType( DEFAULT_FONT_WEIGHT ) : preferredFontDescription.weight ); + fontDescription.width = ( ( FontWidth::NONE == preferredFontDescription.width ) ? IntToWidthType( DEFAULT_FONT_WIDTH ) : preferredFontDescription.width ); + fontDescription.slant = ( ( FontSlant::NONE == preferredFontDescription.slant ) ? IntToSlantType( DEFAULT_FONT_SLANT ) : preferredFontDescription.slant ); // Check first if the font's description has been queried before. FontList* fontList( NULL ); @@ -529,7 +537,7 @@ FontId FontClient::Plugin::FindFallbackFont( FontId preferredFont, SetFontList( fontDescription, *fontList ); // Add the font-list to the cache. - mFallbackCache.push_back( FallbackCacheItem(fontDescription, fontList) ); + mFallbackCache.push_back( FallbackCacheItem( fontDescription, fontList ) ); } if( fontList ) @@ -683,7 +691,7 @@ void FontClient::Plugin::GetFontMetrics( FontId fontId, if( ( fontId > 0 ) && ( fontId - 1u < mFontCache.size() ) ) { - const CacheItem& font = mFontCache[fontId-1]; + const FontFaceCacheItem& font = mFontCache[fontId-1]; metrics = font.mMetrics; @@ -754,7 +762,7 @@ bool FontClient::Plugin::GetBitmapMetrics( GlyphInfo* array, if( fontId > 0 && fontId-1 < mFontCache.size() ) { - const CacheItem& font = mFontCache[fontId-1]; + const FontFaceCacheItem& font = mFontCache[fontId-1]; FT_Face ftFace = font.mFreeTypeFace; @@ -842,7 +850,7 @@ bool FontClient::Plugin::GetVectorMetrics( GlyphInfo* array, if( fontId > 0 && fontId-1 < mFontCache.size() ) { - CacheItem& font = mFontCache[fontId-1]; + FontFaceCacheItem& font = mFontCache[fontId-1]; if( ! font.mVectorFontId ) { @@ -942,7 +950,7 @@ void FontClient::Plugin::CreateVectorBlob( FontId fontId, GlyphIndex glyphIndex, if( fontId > 0 && fontId-1 < mFontCache.size() ) { - CacheItem& font = mFontCache[fontId-1]; + FontFaceCacheItem& font = mFontCache[fontId-1]; if( ! font.mVectorFontId ) { @@ -1056,6 +1064,7 @@ bool FontClient::Plugin::MatchFontDescriptionToPattern( FcPattern* pattern, Dali fontDescription.width = IntToWidthType( width ); fontDescription.weight = IntToWeightType( weight ); fontDescription.slant = IntToSlantType( slant ); + // destroyed the matched pattern FcPatternDestroy( match ); ret = true; @@ -1073,9 +1082,30 @@ FcPattern* FontClient::Plugin::CreateFontFamilyPattern( const FontDescription& f // add a property to the pattern for the font family FcPatternAddString( fontFamilyPattern, FC_FAMILY, reinterpret_cast( fontDescription.family.c_str() ) ); - FcPatternAddInteger( fontFamilyPattern, FC_WIDTH, FONT_WIDTH_TYPE_TO_INT[fontDescription.width] ); - FcPatternAddInteger( fontFamilyPattern, FC_WEIGHT, FONT_WEIGHT_TYPE_TO_INT[fontDescription.weight] ); - FcPatternAddInteger( fontFamilyPattern, FC_SLANT, FONT_SLANT_TYPE_TO_INT[fontDescription.slant] ); + int width = FONT_WIDTH_TYPE_TO_INT[fontDescription.width]; + if( width < 0 ) + { + // Use default. + width = DEFAULT_FONT_WIDTH; + } + + int weight = FONT_WEIGHT_TYPE_TO_INT[fontDescription.weight]; + if( weight < 0 ) + { + // Use default. + weight = DEFAULT_FONT_WEIGHT; + } + + int slant = FONT_SLANT_TYPE_TO_INT[fontDescription.slant]; + if( slant < 0 ) + { + // Use default. + slant = DEFAULT_FONT_SLANT; + } + + FcPatternAddInteger( fontFamilyPattern, FC_WIDTH, width ); + FcPatternAddInteger( fontFamilyPattern, FC_WEIGHT, weight ); + FcPatternAddInteger( fontFamilyPattern, FC_SLANT, slant ); // Add a property of the pattern, to say we want to match TrueType fonts FcPatternAddString( fontFamilyPattern , FC_FONTFORMAT, reinterpret_cast( FONT_FORMAT.c_str() ) ); @@ -1197,7 +1227,7 @@ FontId FontClient::Plugin::CreateFont( const FontPath& path, 0.0f, 0.0f ); - mFontCache.push_back( CacheItem( ftFace, path, requestedPointSize, faceIndex, metrics, fixedWidth, fixedHeight ) ); + mFontCache.push_back( FontFaceCacheItem( ftFace, path, requestedPointSize, faceIndex, metrics, fixedWidth, fixedHeight ) ); id = mFontCache.size(); if( cacheDescription ) @@ -1242,7 +1272,7 @@ FontId FontClient::Plugin::CreateFont( const FontPath& path, static_cast< float >( ftFace->underline_position ) * FROM_266, static_cast< float >( ftFace->underline_thickness ) * FROM_266 ); - mFontCache.push_back( CacheItem( ftFace, path, requestedPointSize, faceIndex, metrics ) ); + mFontCache.push_back( FontFaceCacheItem( ftFace, path, requestedPointSize, faceIndex, metrics ) ); id = mFontCache.size(); if( cacheDescription ) @@ -1311,12 +1341,12 @@ bool FontClient::Plugin::FindFont( const FontPath& path, FontId& fontId ) const { fontId = 0u; - for( std::vector::const_iterator it = mFontCache.begin(), + for( std::vector::const_iterator it = mFontCache.begin(), endIt = mFontCache.end(); it != endIt; ++it, ++fontId ) { - const CacheItem& cacheItem = *it; + const FontFaceCacheItem& cacheItem = *it; if( cacheItem.mRequestedPointSize == requestedPointSize && cacheItem.mFaceIndex == faceIndex && @@ -1524,9 +1554,9 @@ void FontClient::Plugin::CacheFontPath( FT_Face ftFace, FontId id, PointSize26Do FontDescription description; description.path = path; description.family = FontFamily( ftFace->family_name ); - description.weight = FontWeight::NORMAL; - description.width = FontWidth::NORMAL; - description.slant = FontSlant::NORMAL; + description.weight = FontWeight::NONE; + description.width = FontWidth::NONE; + description.slant = FontSlant::NONE; // Note FreeType doesn't give too much info to build a proper font style. if( ftFace->style_flags & FT_STYLE_FLAG_ITALIC ) diff --git a/text/dali/internal/text-abstraction/font-client-plugin-impl.h b/text/dali/internal/text-abstraction/font-client-plugin-impl.h index 4f191a660..aad7d54b1 100644 --- a/text/dali/internal/text-abstraction/font-client-plugin-impl.h +++ b/text/dali/internal/text-abstraction/font-client-plugin-impl.h @@ -91,27 +91,27 @@ struct FontClient::Plugin FontDescriptionId validatedFontId; ///< Index to the vector with font descriptions. PointSize26Dot6 requestedPointSize; ///< The font point size. - FontId fontId; ///< The font id. + FontId fontId; ///< The font identifier. }; /** * @brief Caches the FreeType face and font metrics of the triplet 'path to the font file name, font point size and face index'. */ - struct CacheItem + struct FontFaceCacheItem { - CacheItem( FT_Face ftFace, - const FontPath& path, - PointSize26Dot6 requestedPointSize, - FaceIndex face, - const FontMetrics& metrics ); - - CacheItem( FT_Face ftFace, - const FontPath& path, - PointSize26Dot6 requestedPointSize, - FaceIndex face, - const FontMetrics& metrics, - float fixedWidth, - float fixedHeight ); + FontFaceCacheItem( FT_Face ftFace, + const FontPath& path, + PointSize26Dot6 requestedPointSize, + FaceIndex face, + const FontMetrics& metrics ); + + FontFaceCacheItem( FT_Face ftFace, + const FontPath& path, + PointSize26Dot6 requestedPointSize, + FaceIndex face, + const FontMetrics& metrics, + float fixedWidth, + float fixedHeight ); FT_Face mFreeTypeFace; ///< The FreeType face. FontPath mPath; ///< The path to the font file name. @@ -161,7 +161,7 @@ struct FontClient::Plugin /** * @copydoc Dali::FontClient::SetDefaultFont() */ - void SetDefaultFont( const FontDescription& fontDescription ); + void SetDefaultFont( const FontDescription& preferredFontDescription ); /** * @copydoc Dali::FontClient::GetDefaultPlatformFontDescription() @@ -189,7 +189,14 @@ struct FontClient::Plugin PointSize26Dot6 GetPointSize( FontId id ); /** - * @copydoc Dali::FontClient::FindFontForCharacter() + * @brief Finds within the @p fontList a font which support the @p carcode. + * + * @param[in] fontList A list of font paths, family, width, weight and slant. + * @param[in] charcode The character for which a font is needed. + * @param[in] requestedPointSize The point size in 26.6 fractional points. + * @param[in] preferColor @e true if a color font is preferred. + * + * @return A valid font identifier, or zero if no font is found. */ FontId FindFontForCharacter( const FontList& fontList, Character charcode, @@ -199,12 +206,17 @@ struct FontClient::Plugin /** * @copydoc Dali::FontClient::FindDefaultFont() */ - FontId FindDefaultFont( Character charcode, PointSize26Dot6 requestedPointSize, bool preferColor ); + FontId FindDefaultFont( Character charcode, + PointSize26Dot6 requestedPointSize, + bool preferColor ); /** * @copydoc Dali::FontClient::FindFallbackFont() */ - FontId FindFallbackFont( FontId preferredFont, Character charcode, PointSize26Dot6 requestedPointSize, bool preferColor ); + FontId FindFallbackFont( Character charcode, + const FontDescription& preferredFontDescription, + PointSize26Dot6 requestedPointSize, + bool preferColor ); /** * @see Dali::FontClient::GetFontId( const FontPath& path, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex ) @@ -219,7 +231,9 @@ struct FontClient::Plugin bool cacheDescription = true ); /** - * @copydoc Dali::FontClient::GetFontId( const FontDescription& fontDescription, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex ) + * @see Dali::FontClient::GetFontId( const FontDescription& preferredFontDescription, PointSize26Dot6 requestedPointSize, FaceIndex faceIndex ) + * + * @param[in] actualPointSize The actual point size. In case of emojis the @p requestedPointSize is used to build the metrics and cache the font and the @p actualPointSize is used to load the glyph. */ FontId GetFontId( const FontDescription& fontDescription, PointSize26Dot6 requestedPointSize, @@ -351,7 +365,7 @@ private: * @param[in] faceIndex A face index. * @param[in] cacheDescription Whether to cache the font description. * - * @return The font id. + * @return The font identifier. */ FontId CreateFont( const FontPath& path, PointSize26Dot6 requestedPointSize, @@ -368,12 +382,12 @@ private: /** * @brief Finds in the cache if there is a triplet with the path to the font file name, the font point size and the face index. - * If there is one , if writes the font id in the param @p fontId. + * If there is one , if writes the font identifier in the param @p fontId. * * @param[in] path Path to the font file name. * @param[in] requestedPointSize The font point size. * @param[in] faceIndex The face index. - * @param[out] fontId The font id. + * @param[out] fontId The font identifier. * * @return @e true if there triplet is found. */ @@ -401,12 +415,12 @@ private: FontList*& fontList ); /** - * @brief Finds in the cache a pair 'validated font id and font point size'. - * If there is one it writes the font id in the param @p fontId. + * @brief Finds in the cache a pair 'validated font identifier and font point size'. + * If there is one it writes the font identifier in the param @p fontId. * * @param[in] validatedFontId Index to the vector with font descriptions. * @param[in] requestedPointSize The font point size. - * @param[out] fontId The font id. + * @param[out] fontId The font identifier. * * @return @e true if the pair is found. */ @@ -462,10 +476,10 @@ private: std::vector mFallbackCache; ///< Cached fallback font lists. - std::vector mFontCache; ///< Caches the FreeType face and font metrics of the triplet 'path to the font file name, font point size and face index'. + std::vector mFontCache; ///< Caches the FreeType face and font metrics of the triplet 'path to the font file name, font point size and face index'. std::vector mValidatedFontCache; ///< Caches indices to the vector of font descriptions for a given font. FontList mFontDescriptionCache; ///< Caches font descriptions for the validated font. - std::vector mFontIdCache; ///< Caches font ids for the pairs of font point size and the index to the vector with font descriptions of the validated fonts. + std::vector mFontIdCache; ///< Caches font identifiers for the pairs of font point size and the index to the vector with font descriptions of the validated fonts. VectorFontCache* mVectorFontCache; ///< Separate cache for vector data blobs etc. diff --git a/text/dali/internal/text-abstraction/shaping-impl.cpp b/text/dali/internal/text-abstraction/shaping-impl.cpp index ccdf4bc1f..ae87d9448 100644 --- a/text/dali/internal/text-abstraction/shaping-impl.cpp +++ b/text/dali/internal/text-abstraction/shaping-impl.cpp @@ -47,6 +47,22 @@ const hb_script_t SCRIPT_TO_HARFBUZZ[] = { HB_SCRIPT_COMMON, + HB_SCRIPT_COMMON, // ASCII_DIGITS + HB_SCRIPT_COMMON, // ASCII_PS + + HB_SCRIPT_COMMON, // C1_CONTROLS + HB_SCRIPT_COMMON, // C1_PS + HB_SCRIPT_COMMON, // C1_MATH + HB_SCRIPT_COMMON, // SML_P + HB_SCRIPT_COMMON, // PHONETIC_U + HB_SCRIPT_COMMON, // PHONETIC_SS + HB_SCRIPT_COMMON, // NUMERIC_SS + HB_SCRIPT_COMMON, // LETTER_LIKE + HB_SCRIPT_COMMON, // NUMBER_FORMS + HB_SCRIPT_COMMON, // FRACTIONS_NF + HB_SCRIPT_COMMON, // NON_LATIN_LED + HB_SCRIPT_COMMON, // HWFW_S + HB_SCRIPT_CYRILLIC, HB_SCRIPT_GREEK, HB_SCRIPT_LATIN, @@ -80,6 +96,11 @@ const hb_script_t SCRIPT_TO_HARFBUZZ[] = HB_SCRIPT_KHMER, HB_SCRIPT_UNKNOWN, // EMOJI + HB_SCRIPT_UNKNOWN, // SYMBOLS1 + HB_SCRIPT_UNKNOWN, // SYMBOLS2 + HB_SCRIPT_UNKNOWN, // SYMBOLS3 + HB_SCRIPT_UNKNOWN, // SYMBOLS4 + HB_SCRIPT_UNKNOWN, // SYMBOLS5 HB_SCRIPT_UNKNOWN };