*/
virtual bool AccessibilityActionZoom() = 0;
- /**
- * Perform the accessibility action to read the information in the indicator (by two fingers triple tap).
- * @return whether the accessibility action is performed or not.
- */
- virtual bool AccessibilityActionReadIndicatorInformation() = 0;
-
/**
* Perform the accessibility action to pause/resume the current read out (by two fingers single tap).
* @return whether the accessibility action is performed or not.
return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionZoomEvent();
}
-bool AccessibilityAdaptor::HandleActionReadIndicatorInformationEvent()
-{
- return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionReadIndicatorInformationEvent();
-}
-
bool AccessibilityAdaptor::HandleActionReadPauseResumeEvent()
{
return Internal::Adaptor::AccessibilityAdaptor::GetImplementation(*this).HandleActionReadPauseResumeEvent();
class TouchPoint;
/**
- * @brief The AccessibilityAdaptor provides communication to the indicator and the accessibility manager interface (implemented in toolkit).
+ * @brief The AccessibilityAdaptor provides communication to the accessibility manager interface (implemented in toolkit).
*
*/
class DALI_ADAPTOR_API AccessibilityAdaptor : public BaseHandle
*/
bool HandleActionZoomEvent();
- /**
- * @brief Handle the accessibility action to read the information in the indicator
- * (by two fingers triple tap).
- *
- * @return Whether the action is performed successfully or not.
- */
- bool HandleActionReadIndicatorInformationEvent();
-
/**
* @brief Handle the accessibility action to pause/resume the current speech
* (by two fingers single tap).
AccessibilityAdaptor::AccessibilityAdaptor()
: mReadPosition(),
mActionHandler( NULL ),
- mIndicator( NULL ),
- mIsEnabled( false ),
- mIndicatorFocused( false )
+ mIsEnabled( false )
{
mAccessibilityGestureDetector = new AccessibilityGestureDetector();
}
}
}
-void AccessibilityAdaptor::SetIndicator(IndicatorInterface* indicator)
-{
- mIndicator = indicator;
-}
-
bool AccessibilityAdaptor::HandleActionNextEvent(bool allowEndFeedback)
{
bool ret = false;
return ret;
}
-bool AccessibilityAdaptor::HandleActionReadIndicatorInformationEvent()
-{
- bool ret = false;
-
- if( mActionHandler )
- {
- ret = mActionHandler->AccessibilityActionReadIndicatorInformation();
- }
-
- DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
-
- return ret;
-}
-
bool AccessibilityAdaptor::HandleActionReadPauseResumeEvent()
{
bool ret = false;
#include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
#include <dali/devel-api/adaptor-framework/accessibility-action-handler.h>
#include <dali/devel-api/adaptor-framework/accessibility-gesture-handler.h>
-#include <dali/internal/window-system/common/indicator-interface.h>
#include <dali/internal/accessibility/common/accessibility-gesture-detector.h>
namespace Dali
*/
void SetGestureHandler(AccessibilityGestureHandler& handler);
- /**
- * @brief Set the Indicator
- * @param[in] Indiciator interface
- */
- void SetIndicator( IndicatorInterface* indicator );
-
/**
* @copydoc Dali::AccessibilityAdaptor::HandleActionNextEvent()
*/
*/
bool HandleActionZoomEvent();
- /**
- * @copydoc Dali::AccessibilityAdaptor::HandleActionReadIndicatorInformationEvent()
- */
- bool HandleActionReadIndicatorInformationEvent();
-
/**
* @copydoc Dali::AccessibilityAdaptor::HandleActionReadPauseResumeEvent()
*/
AccessibilityGestureDetectorPtr mAccessibilityGestureDetector; ///< The accessibility gesture detector
- IndicatorInterface* mIndicator; ///< The indicator
-
bool mIsEnabled : 1; ///< enable/disable the accessibility action
- bool mIndicatorFocused : 1; ///< Whether the Indicator is focused
public:
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionNext(allowEndFeedback);
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionPrevious(allowEndFeedback);
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_ACTIVATE;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionActivate();
}
mReadPosition.x = x;
mReadPosition.y = y;
- Dali::AccessibilityAdaptor handle( this );
-
- bool indicatorFocused = false;
-
- // Check whether the Indicator is focused
- if( mIndicator && mIndicator->IsConnected() )
- {
- // Check the position and size of Indicator actor
- Dali::Actor indicatorActor = mIndicator->GetActor();
- Vector3 position = Vector3(0.0f, 0.0f, 0.0f);
- Vector3 size = indicatorActor.GetCurrentSize();
-
- if(mReadPosition.x >= position.x &&
- mReadPosition.x <= position.x + size.width &&
- mReadPosition.y >= position.y &&
- mReadPosition.y <= position.y + size.height)
- {
- indicatorFocused = true;
- DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] Indicator area!!!!\n", __FUNCTION__, __LINE__);
- }
- }
-
- if( mIndicator )
- {
- if( !mIndicatorFocused && indicatorFocused )
- {
- // If Indicator is focused, the focus should be cleared in Dali focus chain.
- if( mActionHandler )
- {
- mActionHandler->ClearAccessibilityFocus();
- }
- }
- else if( mIndicatorFocused && !indicatorFocused )
- {
-#ifndef WAYLAND
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_UNHIGHLIGHT;
-
- // Indicator should be unhighlighted
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] Send unhighlight message to indicator!!!!\n", __FUNCTION__, __LINE__);
-#endif
- }
-
- mIndicatorFocused = indicatorFocused;
-
- // Send accessibility READ action information to Indicator
- if( mIndicatorFocused )
- {
-#ifndef WAYLAND
- Elm_Access_Action_Info actionInfo;
- actionInfo.x = mReadPosition.x;
- actionInfo.y = mReadPosition.y;
-
- if(allowReadAgain)
- {
- actionInfo.action_type = ELM_ACCESS_ACTION_READ;
- }
- else
- {
- actionInfo.action_type = static_cast<Elm_Access_Action_Type>( GetElmAccessActionOver() );
- }
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
-
- DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] Send READ message to indicator!!!!\n", __FUNCTION__, __LINE__);
-#endif
- }
- }
-
- if( mActionHandler && !mIndicatorFocused)
+ if( mActionHandler )
{
- // If Indicator is not focused, the accessibility actions should be handled by the registered
- // accessibility action handler (e.g. focus manager)
+ // The accessibility actions should be handled by the registered accessibility action handler (e.g. focus manager)
ret = mActionHandler->AccessibilityActionRead(allowReadAgain);
DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionReadNext(allowEndFeedback);
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionReadPrevious(allowEndFeedback);
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_UP;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionUp();
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_DOWN;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionDown();
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionNext(allowEndFeedback);
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionPrevious(allowEndFeedback);
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_ACTIVATE;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionActivate();
}
mReadPosition.x = x;
mReadPosition.y = y;
- Dali::AccessibilityAdaptor handle( this );
-
- bool indicatorFocused = false;
-
- // Check whether the Indicator is focused
- if( mIndicator && mIndicator->IsConnected() )
- {
- // Check the position and size of Indicator actor
- Dali::Actor indicatorActor = mIndicator->GetActor();
- Vector3 position = Vector3(0.0f, 0.0f, 0.0f);
- Vector3 size = indicatorActor.GetCurrentSize();
-
- if(mReadPosition.x >= position.x &&
- mReadPosition.x <= position.x + size.width &&
- mReadPosition.y >= position.y &&
- mReadPosition.y <= position.y + size.height)
- {
- indicatorFocused = true;
- DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] Indicator area!!!!\n", __FUNCTION__, __LINE__);
- }
- }
-
- if( mIndicator )
- {
- if( !mIndicatorFocused && indicatorFocused )
- {
- // If Indicator is focused, the focus should be cleared in Dali focus chain.
- if( mActionHandler )
- {
- mActionHandler->ClearAccessibilityFocus();
- }
- }
- else if( mIndicatorFocused && !indicatorFocused )
- {
-#ifndef WAYLAND
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_UNHIGHLIGHT;
-
- // Indicator should be unhighlighted
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] Send unhighlight message to indicator!!!!\n", __FUNCTION__, __LINE__);
-#endif
- }
-
- mIndicatorFocused = indicatorFocused;
-
- // Send accessibility READ action information to Indicator
- if( mIndicatorFocused )
- {
-#ifndef WAYLAND
- Elm_Access_Action_Info actionInfo;
- actionInfo.x = mReadPosition.x;
- actionInfo.y = mReadPosition.y;
-
- if(allowReadAgain)
- {
- actionInfo.action_type = ELM_ACCESS_ACTION_READ;
- }
- else
- {
- actionInfo.action_type = static_cast<Elm_Access_Action_Type>( GetElmAccessActionOver() );
- }
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
-
- DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] Send READ message to indicator!!!!\n", __FUNCTION__, __LINE__);
-#endif
- }
- }
-
- if( mActionHandler && !mIndicatorFocused)
+ if( mActionHandler )
{
- // If Indicator is not focused, the accessibility actions should be handled by the registered
- // accessibility action handler (e.g. focus manager)
+ // The accessibility actions should be handled by the registered accessibility action handler (e.g. focus manager)
ret = mActionHandler->AccessibilityActionRead(allowReadAgain);
DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionReadNext(allowEndFeedback);
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionReadPrevious(allowEndFeedback);
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_UP;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionUp();
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_DOWN;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionDown();
}
#include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
#include <dali/devel-api/adaptor-framework/accessibility-action-handler.h>
#include <dali/devel-api/adaptor-framework/accessibility-gesture-handler.h>
-#include <dali/internal/window-system/common/indicator-interface.h>
#include <dali/internal/accessibility/common/accessibility-gesture-detector.h>
#include <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionNext(allowEndFeedback);
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionPrevious(allowEndFeedback);
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_ACTIVATE;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionActivate();
}
mReadPosition.x = x;
mReadPosition.y = y;
- Dali::AccessibilityAdaptor handle( this );
-
- bool indicatorFocused = false;
-
- // Check whether the Indicator is focused
- if( mIndicator && mIndicator->IsConnected() )
+ if( mActionHandler)
{
- // Check the position and size of Indicator actor
- Dali::Actor indicatorActor = mIndicator->GetActor();
- Vector3 position = Vector3(0.0f, 0.0f, 0.0f);
- Vector3 size = indicatorActor.GetCurrentSize();
-
- if(mReadPosition.x >= position.x &&
- mReadPosition.x <= position.x + size.width &&
- mReadPosition.y >= position.y &&
- mReadPosition.y <= position.y + size.height)
- {
- indicatorFocused = true;
- DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] Indicator area!!!!\n", __FUNCTION__, __LINE__);
- }
- }
-
- if( mIndicator )
- {
- if( !mIndicatorFocused && indicatorFocused )
- {
- // If Indicator is focused, the focus should be cleared in Dali focus chain.
- if( mActionHandler )
- {
- mActionHandler->ClearAccessibilityFocus();
- }
- }
- else if( mIndicatorFocused && !indicatorFocused )
- {
-#ifndef WAYLAND
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_UNHIGHLIGHT;
-
- // Indicator should be unhighlighted
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] Send unhighlight message to indicator!!!!\n", __FUNCTION__, __LINE__);
-#endif
- }
-
- mIndicatorFocused = indicatorFocused;
-
- // Send accessibility READ action information to Indicator
- if( mIndicatorFocused )
- {
-#ifndef WAYLAND
- Elm_Access_Action_Info actionInfo;
- actionInfo.x = mReadPosition.x;
- actionInfo.y = mReadPosition.y;
-
- if(allowReadAgain)
- {
- actionInfo.action_type = ELM_ACCESS_ACTION_READ;
- }
- else
- {
- actionInfo.action_type = static_cast<Elm_Access_Action_Type>( GetElmAccessActionOver() );
- }
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
-
- DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] Send READ message to indicator!!!!\n", __FUNCTION__, __LINE__);
-#endif
- }
- }
-
- if( mActionHandler && !mIndicatorFocused)
- {
- // If Indicator is not focused, the accessibility actions should be handled by the registered
- // accessibility action handler (e.g. focus manager)
+ // The accessibility actions should be handled by the registered accessibility action handler (e.g. focus manager)
ret = mActionHandler->AccessibilityActionRead(allowReadAgain);
DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_NEXT;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionReadNext(allowEndFeedback);
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_HIGHLIGHT_PREV;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionReadPrevious(allowEndFeedback);
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_UP;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionUp();
}
{
bool ret = false;
-#ifndef WAYLAND
- if( mIndicator && mIndicatorFocused )
- {
- Elm_Access_Action_Info actionInfo;
- actionInfo.action_type = ELM_ACCESS_ACTION_DOWN;
-
- ret = mIndicator->SendMessage(MSG_DOMAIN_CONTROL_ACCESS, actionInfo.action_type, &actionInfo, sizeof(actionInfo));
- }
- else if( mActionHandler )
-#else
if( mActionHandler )
-#endif
{
ret = mActionHandler->AccessibilityActionDown();
}
const std::string& windowClassName = mEnvironmentOptions.GetWindowClassName();
mMainWindow = Dali::Window::New( mWindowPositionSize, mMainWindowName, windowClassName, mMainWindowMode == Dali::Application::TRANSPARENT );
- int indicatorVisibleMode = mEnvironmentOptions.GetIndicatorVisibleMode();
- if( indicatorVisibleMode >= Dali::Window::INVISIBLE && indicatorVisibleMode <= Dali::Window::AUTO )
- {
- GetImplementation( mMainWindow ).SetIndicatorVisibleMode( static_cast< Dali::Window::IndicatorVisibleMode >( indicatorVisibleMode ) );
- }
-
// Quit the application when the window is closed
GetImplementation( mMainWindow ).DeleteRequestSignal().Connect( mSlotDelegate, &Application::Quit );
}
Window& windowImpl = GetImplementation(newWindow);
windowImpl.SetAdaptor(*mAdaptor);
- int indicatorVisibleMode = mEnvironmentOptions.GetIndicatorVisibleMode();
- if( indicatorVisibleMode >= Dali::Window::INVISIBLE && indicatorVisibleMode <= Dali::Window::AUTO )
- {
- GetImplementation( newWindow ).SetIndicatorVisibleMode( static_cast< Dali::Window::IndicatorVisibleMode >( indicatorVisibleMode ) );
- }
-
Internal::Adaptor::WindowRenderSurface* renderSurface = windowImpl.GetSurface();
Any nativeWindow = newWindow.GetNativeHandle();
mPanMinimumEvents( -1 ),
mGlesCallTime( 0 ),
mMultiSamplingLevel( DEFAULT_MULTI_SAMPLING_LEVEL ),
- mIndicatorVisibleMode( -1 ),
mThreadingMode( ThreadingMode::COMBINED_UPDATE_RENDER ),
mGlesCallAccumulate( false ),
mDepthBufferRequired( DEFAULT_DEPTH_BUFFER_REQUIRED_SETTING ),
return mMaxTextureSize;
}
-int EnvironmentOptions::GetIndicatorVisibleMode() const
-{
- return mIndicatorVisibleMode;
-}
-
unsigned int EnvironmentOptions::GetRenderToFboInterval() const
{
return mRenderToFboInterval;
}
}
- int indicatorVisibleMode( -1 );
- if( GetIntegerEnvironmentVariable( DALI_ENV_INDICATOR_VISIBLE_MODE, indicatorVisibleMode ) )
- {
- if( indicatorVisibleMode > -1 )
- {
- mIndicatorVisibleMode = indicatorVisibleMode;
- }
- }
-
mRenderToFboInterval = GetIntegerEnvironmentVariable( DALI_RENDER_TO_FBO, 0u );
*/
unsigned int GetMaxTextureSize() const;
- /**
- * @return The maximum texture size
- */
- int GetIndicatorVisibleMode() const;
-
/**
* @brief Retrieves the interval of frames to be rendered into the Frame Buffer Object and the Frame Buffer.
*
int mPanMinimumEvents; ///< minimum events required before pan starts
int mGlesCallTime; ///< time in seconds between status updates
int mMultiSamplingLevel; ///< The number of samples required in multisample buffers
- int mIndicatorVisibleMode; ///< Indicator visible mode
ThreadingMode::Type mThreadingMode; ///< threading mode
bool mGlesCallAccumulate; ///< Whether or not to accumulate gles call statistics
bool mDepthBufferRequired; ///< Whether the depth buffer is required
#define DALI_ENV_MAX_TEXTURE_SIZE "DALI_MAX_TEXTURE_SIZE"
-#define DALI_ENV_INDICATOR_VISIBLE_MODE "DALI_INDICATOR_VISIBLE_MODE"
-
#define DALI_RENDER_TO_FBO "DALI_RENDER_TO_FBO"
#define DALI_ENV_DISABLE_DEPTH_BUFFER "DALI_DISABLE_DEPTH_BUFFER"
// After DALi can support multi window, this part should be changed.
Dali::Window window = application->GetWindow();
- window.ShowIndicator(Dali::Window::INVISIBLE);
Any nativeHandle = window.GetNativeHandle();
#ifdef ECORE_WAYLAND2
case 20: // TwoFingersTripleTap
{
// Read information from indicator
- accessibilityAdaptor->HandleActionReadIndicatorInformationEvent();
+ // Not supported
break;
}
case 21: // ThreeFingersSingleTap
+++ /dev/null
-/*
- * 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.
- *
- */
-
-// CLASS HEADER
-#include <dali/internal/window-system/common/indicator-buffer.h>
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-
-IndicatorBuffer::IndicatorBuffer( Adaptor* adaptor, unsigned int width, unsigned int height, Pixel::Format pixelFormat )
-: mAdaptor(adaptor),
- mImageWidth(width),
- mImageHeight(height),
- mPixelFormat(pixelFormat)
-{
- DALI_ASSERT_ALWAYS( adaptor );
-
- // Use BitmapImage when SharedGlBuffer extension is unavailable
- mBitmapBuffer = new NativeBitmapBuffer( adaptor, mImageWidth, mImageHeight, mPixelFormat );
- mNativeImage = mBitmapBuffer;
-}
-
-bool IndicatorBuffer::UpdatePixels( const unsigned char *src, size_t size )
-{
- // Use double buffered bitmap when SharedGlBuffer extension is unavailable
- mBitmapBuffer->Write( src, size );
- return true;
-}
-
-NativeImageInterface& IndicatorBuffer::GetNativeImage() const
-{
- DALI_ASSERT_DEBUG(mNativeImage.Get());
- return *mNativeImage;
-}
-
-void IndicatorBuffer::SetAdaptor( Adaptor* adaptor )
-{
- mAdaptor = adaptor;
-}
-
-} // Adaptor
-} // Internal
-} // Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_INDICATOR_BUFFER_H__
-#define __DALI_INTERNAL_INDICATOR_BUFFER_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 <dali/public-api/object/ref-object.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/imaging/common/native-bitmap-buffer-impl.h>
-#include <dali/internal/adaptor/common/adaptor-impl.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-namespace Adaptor
-{
-
-class NativeBitmapBuffer;
-class IndicatorBuffer;
-
-typedef IntrusivePtr<IndicatorBuffer> IndicatorBufferPtr;
-
-/**
- * The IndicatorBuffer class uses the best available implementation for rendering indicator data.
- * On platforms where EglImage is available it uses either SharedGlBuffer or NativeImageSource, on older
- * platforms it falls back to using a bitmap buffer based solution.
- */
-class IndicatorBuffer : public RefObject
-{
-public:
-
- /**
- * Constructor
- */
- IndicatorBuffer( Adaptor* adaptor, unsigned int width, unsigned int height, Pixel::Format pixelFormat );
-
- /**
- * Copy bitmap data to pixel buffer.
- * @param src bitmap data source
- * @param size size of bitmap data
- * @return true if successful, false otherwise
- */
- bool UpdatePixels( const unsigned char *src, size_t size );
-
- /**
- * Returns the NativeImage used internally
- * @return the NativeImage used internally
- */
- NativeImageInterface& GetNativeImage() const;
-
- /**
- * Set currently used Adaptor
- * @param adaptor
- */
- void SetAdaptor( Adaptor* adaptor );
-
-private:
- NativeImageInterfacePtr mNativeImage; ///< Image buffer created for shared file copy
-
- NativeBitmapBufferPtr mBitmapBuffer; ///< Image buffer created for shared file copy if extension not available
-
- Adaptor* mAdaptor;
-
- int mImageWidth;
- int mImageHeight;
- Pixel::Format mPixelFormat;
-};
-
-} // Adaptor
-} // Internal
-} // Dali
-
-#endif // __DALI_INTERNAL_INDICATOR_H__
+++ /dev/null
-#ifndef __DALI_INTERNAL_BASE_INDICATOR_INTERFACE_H__
-#define __DALI_INTERNAL_BASE_INDICATOR_INTERFACE_H__
-
-/*
- * Copyright (c) 2015 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 <dali/public-api/actors/actor.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/adaptor-framework/window.h>
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-
-class Adaptor;
-
-/**
- * @brief The Indicator interface.
- * Can be used to draw an indicator graphic generated from the platform as an overlay on
- * top of DALi scene contents.
- */
-class IndicatorInterface
-{
-public:
-
- /**
- * @brief Type of indiciator
- */
- enum Type
- {
- INDICATOR_TYPE_UNKNOWN,
- INDICATOR_TYPE_1,
- INDICATOR_TYPE_2
- };
-
-
-public:
-
- /**
- * @brief observer for listening to indicator events
- */
- class Observer
- {
- public:
- /**
- * @brief Notify the observer if the indicator type changes
- * @param[in] type The new indicator type
- */
- virtual void IndicatorTypeChanged( Type type ) = 0;
-
- /**
- * @brief Notify the observer when the upload has completed.
- * @param[in] indicator The indicator that has finished uploading.
- */
- virtual void IndicatorClosed(IndicatorInterface* indicator) = 0;
-
- /**
- * @brief Notify the observer when the indicator visible status is changed.
- * @param[in] isShowing Whether the indicator is visible.
- */
- virtual void IndicatorVisibilityChanged( bool isVisible ) = 0;
- };
-
-
-public:
-
- /**
- * @brief constructor
- */
- IndicatorInterface() {}
-
- /**
- * @brief Virtual Destructor
- */
- virtual ~IndicatorInterface() {}
-
- /**
- * @brief assign the adaptor to this object
- * @param[in] adaptor
- */
- virtual void SetAdaptor(Adaptor* adaptor) = 0;
-
- /**
- * @brief Get the actor which contains the indicator image. Ensure that the handle is
- * released when no longer needed.
- * Changes from the indicator service will modify the image and resize the actor appropriately.
- * @return The indicator actor.
- */
- virtual Dali::Actor GetActor() = 0;
-
- /**
- * Opens a new connection for the required orientation.
- * @param[in] orientation The new orientation
- */
- virtual void Open( Dali::Window::WindowOrientation orientation ) = 0;
-
- /**
- * Close the current connection. Will respond with Observer::IndicatorClosed()
- * when done.
- * @note, IndicatorClosed() will be called synchronously if there's no update
- * in progress, or asychronously if waiting for SignalUploaded )
- */
- virtual void Close() = 0;
-
- /**
- * Notify the indicator flicked.
- */
- virtual void Flicked() = 0;
-
- /**
- * Set the opacity mode of the indicator background.
- * @param[in] mode opacity mode
- */
- virtual void SetOpacityMode( Dali::Window::IndicatorBgOpacity mode ) = 0;
-
- /**
- * Set whether the indicator is visible or not.
- * @param[in] visibleMode visible mode for indicator bar.
- * @param[in] forceUpdate true if want to change visible mode forcely
- */
- virtual void SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool forceUpdate = false ) = 0;
-
- /**
- * Check whether the indicator is connected to the indicator service.
- * @return whether the indicator is connected or not.
- */
- virtual bool IsConnected() = 0;
-
- /**
- * Send message to the indicator service.
- * @param[in] messageDomain Message Reference number
- * @param[in] messageId Reference number of the message this message refers to
- * @param[in] data The data to send as part of the message
- * @param[in] size Length of the data, in bytes, to send
- * @return whether the message is sent successfully or not
- */
- virtual bool SendMessage( int messageDomain, int messageId, const void *data, int size ) = 0;
-};
-
-} // Adaptor
-} // Internal
-} // Dali
-
-#endif
mSelectionDataSendSignal(),
mSelectionDataReceivedSignal(),
mStyleChangedSignal(),
- mAccessibilitySignal(),
- mIndicatorFlickedSignal()
+ mAccessibilitySignal()
{
}
return mAccessibilitySignal;
}
-WindowBase::IndicatorSignalType& WindowBase::IndicatorFlickedSignal()
-{
- return mIndicatorFlickedSignal;
-}
-
} // namespace Adaptor
} // namespace Internal
#include <dali/public-api/adaptor-framework/window.h>
#include <dali/public-api/adaptor-framework/key-grab.h>
#include <dali/public-api/adaptor-framework/style-change.h>
-#include <dali/internal/window-system/common/indicator-interface.h>
#include <dali/internal/window-system/common/damage-observer.h>
#include <dali/internal/window-system/common/rotation-observer.h>
#include <dali/internal/graphics/gles/egl-implementation.h>
typedef Signal< void ( StyleChange::Type ) > StyleSignalType;
typedef Signal< void ( const AccessibilityInfo& ) > AccessibilitySignalType;
- // Indicator
- typedef Signal< void ( ) > IndicatorSignalType;
-
/**
* @brief Default constructor
*/
*/
virtual void MoveResize( Dali::PositionSize positionSize ) = 0;
- /**
- * @copydoc Dali::Window::ShowIndicator()
- */
- virtual void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode ) = 0;
-
- /**
- * Set the indicator properties on the window
- */
- virtual void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ) = 0;
-
- /**
- * @copydoc Dali::Internal::Adaptor::IndicatorInterface::Observer::IndicatorTypeChanged()
- */
- virtual void IndicatorTypeChanged( IndicatorInterface::Type type ) = 0;
-
/**
* @copydoc Dali::Window::SetClass()
*/
*/
AccessibilitySignalType& AccessibilitySignal();
- /**
- * @brief This signal is emitted when an indicator is flicked.
- */
- IndicatorSignalType& IndicatorFlickedSignal();
-
protected:
// Undefined
SelectionSignalType mSelectionDataReceivedSignal;
StyleSignalType mStyleChangedSignal;
AccessibilitySignalType mAccessibilitySignal;
- IndicatorSignalType mIndicatorFlickedSignal;
};
} // namespace Adaptor
// INTERNAL INCLUDES
#include <dali/public-api/adaptor-framework/window.h>
-#include <dali/internal/window-system/common/indicator-interface.h>
// EXTERNAL INCLUDES
#include <memory>
virtual ~WindowFactory() = default;
virtual std::unique_ptr< WindowBase > CreateWindowBase( Dali::PositionSize positionSize, Any surface, bool isTransparent ) = 0;
-
- virtual std::unique_ptr< IndicatorInterface > CreateIndicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer ) = 0;
};
extern std::unique_ptr< WindowFactory > GetWindowFactory();
: mId( mWindowCounter++ ),
mSurface( nullptr ),
mWindowBase(),
- mIndicatorVisible( Dali::Window::INVISIBLE ), // TODO: Enable this after indicator implementation based on tizen 5.
- mIndicatorIsShown( false ),
- mShowRotatedIndicatorOnClose( false ),
mStarted( false ),
mIsFocusAcceptable( true ),
mVisible( true ),
mIconified( false ),
mOpaqueState( false ),
mResizeEnabled( false ),
- mIndicator(),
- mIndicatorOrientation( Dali::Window::PORTRAIT ),
- mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
- mIndicatorOpacityMode( Dali::Window::OPAQUE ),
mAdaptor( NULL ),
mType( Dali::Window::NORMAL ),
mPreferredOrientation( Dali::Window::PORTRAIT ),
- mIndicatorVisibilityChangedSignal(),
mFocusChangedSignal(),
mResizedSignal(),
mDeleteRequestSignal()
Window::~Window()
{
- if( mIndicator )
- {
- mIndicator->Close();
- }
-
if ( mAdaptor )
{
mAdaptor->RemoveObserver( *this );
mWindowBase->IconifyChangedSignal().Connect( this, &Window::OnIconifyChanged );
mWindowBase->FocusChangedSignal().Connect( this, &Window::OnFocusChanged );
mWindowBase->DeleteRequestSignal().Connect( this, &Window::OnDeleteRequest );
- mWindowBase->IndicatorFlickedSignal().Connect( this, &Window::OnIndicatorFlicked );
mSurface->OutputTransformedSignal().Connect( this, &Window::OnOutputTransformed );
mOrientation->SetAdaptor(adaptor);
}
- if( mIndicator != NULL )
- {
- mIndicator->SetAdaptor(mAdaptor);
- }
-
mSurface->SetAdaptor( *mAdaptor );
}
void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode )
{
- // TODO: Enable this after indicator implementation based on tizen 5.
-// mIndicatorVisible = visibleMode;
-
- mWindowBase->ShowIndicator( mIndicatorVisible, mIndicatorOpacityMode );
-
- DoShowIndicator( mIndicatorOrientation );
}
void Window::SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacityMode )
{
- mIndicatorOpacityMode = opacityMode;
-
- if( mIndicator != NULL )
- {
- mIndicator->SetOpacityMode( opacityMode );
- }
-}
-
-void Window::SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode )
-{
- // TODO: Enable this after indicator implementation based on tizen 5.
-// mIndicatorVisible = mode;
}
void Window::RotateIndicator( Dali::Window::WindowOrientation orientation )
{
- DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "Orientation: %d\n", orientation );
-
- DoRotateIndicator( orientation );
}
void Window::SetClass( std::string name, std::string className )
mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( width, height ) );
}
-void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation )
-{
- if( mIndicator == NULL )
- {
- if( mIndicatorVisible != Dali::Window::INVISIBLE )
- {
- auto windowFactory = Dali::Internal::Adaptor::GetWindowFactory();
- mIndicator = windowFactory->CreateIndicator( mAdaptor, mIndicatorOrientation, this );
- if( mIndicator )
- {
- mIndicator->SetOpacityMode( mIndicatorOpacityMode );
- Dali::Actor actor = mIndicator->GetActor();
- SetIndicatorActorRotation();
- }
- }
- // else don't create a hidden indicator
- }
- else // Already have indicator
- {
- if( mIndicatorVisible == Dali::Window::VISIBLE )
- {
- // If we are resuming, and rotation has changed,
- if( mIndicatorIsShown == false && mIndicatorOrientation != mNextIndicatorOrientation )
- {
- // then close current indicator and open new one
- mShowRotatedIndicatorOnClose = true;
- mIndicator->Close(); // May synchronously call IndicatorClosed() callback & 1 level of recursion
- // Don't show actor - will contain indicator for old orientation.
- }
- }
- }
-
- // set indicator visible mode
- if( mIndicator != NULL )
- {
- mIndicator->SetVisible( mIndicatorVisible );
- }
-
- bool show = (mIndicatorVisible != Dali::Window::INVISIBLE );
- SetIndicatorProperties( show, lastOrientation );
- mIndicatorIsShown = show;
-}
-
-void Window::DoRotateIndicator( Dali::Window::WindowOrientation orientation )
-{
- if( mIndicatorIsShown )
- {
- mShowRotatedIndicatorOnClose = true;
- mNextIndicatorOrientation = orientation;
- if( mIndicator )
- {
- mIndicator->Close(); // May synchronously call IndicatorClosed() callback
- }
- }
- else
- {
- // Save orientation for when the indicator is next shown
- mShowRotatedIndicatorOnClose = false;
- mNextIndicatorOrientation = orientation;
- }
-}
-
-void Window::SetIndicatorActorRotation()
-{
- DALI_LOG_TRACE_METHOD( gWindowLogFilter );
- if( mIndicator )
- {
- Dali::Actor actor = mIndicator->GetActor();
- switch( mIndicatorOrientation )
- {
- case Dali::Window::PORTRAIT:
- actor.SetParentOrigin( ParentOrigin::TOP_CENTER );
- actor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- actor.SetOrientation( Degree(0), Vector3::ZAXIS );
- break;
- case Dali::Window::PORTRAIT_INVERSE:
- actor.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
- actor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- actor.SetOrientation( Degree(180), Vector3::ZAXIS );
- break;
- case Dali::Window::LANDSCAPE:
- actor.SetParentOrigin( ParentOrigin::CENTER_LEFT );
- actor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- actor.SetOrientation( Degree(270), Vector3::ZAXIS );
- break;
- case Dali::Window::LANDSCAPE_INVERSE:
- actor.SetParentOrigin( ParentOrigin::CENTER_RIGHT );
- actor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- actor.SetOrientation( Degree(90), Vector3::ZAXIS );
- break;
- }
- }
-}
-
-void Window::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
-{
- mWindowBase->SetIndicatorProperties( isShow, lastOrientation );
-}
-
void Window::OnIconifyChanged( bool iconified )
{
if( iconified )
mDeleteRequestSignal.Emit();
}
-void Window::OnIndicatorFlicked()
-{
- if( mIndicator )
- {
- mIndicator->Flicked();
- }
-}
-
-void Window::IndicatorTypeChanged( IndicatorInterface::Type type )
-{
- mWindowBase->IndicatorTypeChanged( type );
-}
-
-void Window::IndicatorClosed( IndicatorInterface* indicator )
-{
- DALI_LOG_TRACE_METHOD( gWindowLogFilter );
-
- if( mShowRotatedIndicatorOnClose )
- {
- Dali::Window::WindowOrientation currentOrientation = mIndicatorOrientation;
- if( mIndicator )
- {
- mIndicator->Open( mNextIndicatorOrientation );
- }
- mIndicatorOrientation = mNextIndicatorOrientation;
- SetIndicatorActorRotation();
- DoShowIndicator( currentOrientation );
- }
-}
-
-void Window::IndicatorVisibilityChanged( bool isVisible )
-{
- mIndicatorVisibilityChangedSignal.Emit( isVisible );
-}
-
void Window::OnStart()
{
- DoShowIndicator( mIndicatorOrientation );
}
void Window::OnPause()
void Window::OnResume()
{
- // resume indicator status
- if( mIndicator != NULL )
- {
- // Restore own indicator opacity
- // Send opacity mode to indicator service when app resumed
- mIndicator->SetOpacityMode( mIndicatorOpacityMode );
- }
}
void Window::OnStop()
{
- if( mIndicator )
- {
- mIndicator->Close();
- }
-
- mIndicator.release();
}
void Window::OnDestroy()
// INTERNAL INCLUDES
#include <dali/internal/adaptor/common/lifecycle-observer.h>
#include <dali/internal/adaptor/common/adaptor-impl.h>
-#include <dali/internal/window-system/common/indicator-interface.h>
#include <dali/public-api/adaptor-framework/window.h>
#include <dali/public-api/adaptor-framework/key-grab.h>
#include <dali/devel-api/adaptor-framework/drag-and-drop-detector.h>
/**
* Window provides a surface to render onto with orientation & indicator properties.
*/
-class Window : public Dali::BaseObject, public IndicatorInterface::Observer, public LifeCycleObserver, public ConnectionTracker
+class Window : public Dali::BaseObject, public LifeCycleObserver, public ConnectionTracker
{
public:
typedef Dali::Window::IndicatorSignalType IndicatorSignalType;
*/
void SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacity );
- /**
- * Set the indicator visible mode
- */
- void SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode );
-
/**
* @copydoc Dali::Window::RotateIndicator()
*/
*/
void Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className);
- /**
- * Shows / hides the indicator bar.
- * Handles close/open if rotation changes whilst hidden
- */
- void DoShowIndicator( Dali::Window::WindowOrientation lastOrientation );
-
- /**
- * Close current indicator and open a connection onto the new indicator service.
- * Effect may not be synchronous if waiting for an indicator update on existing connection.
- */
- void DoRotateIndicator( Dali::Window::WindowOrientation orientation );
-
- /**
- * Change the indicator actor's rotation to match the current orientation
- */
- void SetIndicatorActorRotation();
-
- /**
- * Set the indicator properties on the window
- */
- void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation );
-
/**
* Called when the window becomes iconified or deiconified.
*/
*/
void OnDeleteRequest();
- /**
- * Called when the Ecore indicator event is received.
- */
- void OnIndicatorFlicked();
-
-private: // IndicatorInterface::Observer interface
-
- /**
- * @copydoc Dali::Internal::Adaptor::IndicatorInterface::Observer::IndicatorTypeChanged()
- */
- virtual void IndicatorTypeChanged( IndicatorInterface::Type type );
-
- /**
- * @copydoc Dali::Internal::Adaptor::IndicatorInterface::Observer::IndicatorClosed()
- */
- virtual void IndicatorClosed( IndicatorInterface* indicator);
-
- /**
- * @copydoc Dali::Internal::Adaptor::IndicatorInterface::Observer::IndicatorVisibilityChanged()
- */
- virtual void IndicatorVisibilityChanged( bool isVisible );
-
private: // Adaptor::Observer interface
/**
std::unique_ptr< WindowRenderSurface > mSurface;
Dali::Integration::Scene mScene;
WindowBase* mWindowBase;
- Dali::Window::IndicatorVisibleMode mIndicatorVisible; ///< public state
- bool mIndicatorIsShown:1; ///< private state
- bool mShowRotatedIndicatorOnClose:1;
bool mStarted:1;
bool mIsTransparent:1;
bool mIsFocusAcceptable:1;
bool mIconified:1;
bool mOpaqueState:1;
bool mResizeEnabled:1;
- std::unique_ptr< IndicatorInterface > mIndicator;
- Dali::Window::WindowOrientation mIndicatorOrientation;
- Dali::Window::WindowOrientation mNextIndicatorOrientation;
- Dali::Window::IndicatorBgOpacity mIndicatorOpacityMode;
Adaptor* mAdaptor;
Dali::DragAndDropDetector mDragAndDropDetector;
Dali::Window::Type mType;
${adaptor_window_system_dir}/common/display-connection.cpp \
${adaptor_window_system_dir}/common/ecore-server-connection.cpp \
${adaptor_window_system_dir}/common/event-handler.cpp \
- ${adaptor_window_system_dir}/common/indicator-buffer.cpp \
${adaptor_window_system_dir}/common/native-render-surface-factory.cpp \
${adaptor_window_system_dir}/common/orientation-impl.cpp \
${adaptor_window_system_dir}/common/window-base.cpp \
adaptor_window_system_tizen_wayland_src_files=\
${adaptor_window_system_dir}/tizen-wayland/display-connection-factory-ecore-wl.cpp \
${adaptor_window_system_dir}/tizen-wayland/display-connection-impl-ecore-wl.cpp \
- ${adaptor_window_system_dir}/tizen-wayland/indicator-impl-ecore-wl.cpp \
${adaptor_window_system_dir}/tizen-wayland/native-render-surface-ecore-wl.cpp
# module: window-system, backend: ecore-wl
return ECORE_CALLBACK_PASS_ON;
}
-/////////////////////////////////////////////////////////////////////////////////////////////////
-// Indicator Callbacks
-/////////////////////////////////////////////////////////////////////////////////////////////////
-
-#if defined (DALI_PROFILE_MOBILE)
- /**
- * Called when the Ecore indicator event is received.
- */
- static Eina_Bool EcoreEventIndicator( void* data, int type, void* event )
- {
- WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
- if( windowBase )
- {
- windowBase->OnIndicatorFlicked( data, type, event );
- }
- return ECORE_CALLBACK_PASS_ON;
- }
-#endif // DALI_PROFILE_MOBILE
-
/////////////////////////////////////////////////////////////////////////////////////////////////
// Font Callbacks
/////////////////////////////////////////////////////////////////////////////////////////////////
mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this ) );
mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, this ) );
-#if defined (DALI_PROFILE_MOBILE)
- // Register indicator event
- mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL_EVENT_INDICATOR_FLICK, EcoreEventIndicator, this ) );
-#endif
-
// Register Vconf notify - font name and size
vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this );
vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this );
mSelectionDataReceivedSignal.Emit( event );
}
-void WindowBaseEcoreWl::OnIndicatorFlicked( void* data, int type, void* event )
-{
- mIndicatorFlickedSignal.Emit();
-}
-
void WindowBaseEcoreWl::OnFontNameChanged()
{
mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_CHANGE );
ecore_wl_window_update_size( mEcoreWindow, positionSize.width, positionSize.height );
}
-void WindowBaseEcoreWl::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode )
-{
- DALI_LOG_TRACE_METHOD_FMT( gWindowBaseLogFilter, "visible : %d\n", visibleMode );
-
- if( visibleMode == Dali::Window::VISIBLE )
- {
- // when the indicator is visible, set proper mode for indicator server according to bg mode
- if( opacityMode == Dali::Window::OPAQUE )
- {
- ecore_wl_window_indicator_opacity_set( mEcoreWindow, ECORE_WL_INDICATOR_OPAQUE );
- }
- else if( opacityMode == Dali::Window::TRANSLUCENT )
- {
- ecore_wl_window_indicator_opacity_set( mEcoreWindow, ECORE_WL_INDICATOR_TRANSLUCENT );
- }
- else if( opacityMode == Dali::Window::TRANSPARENT )
- {
- ecore_wl_window_indicator_opacity_set( mEcoreWindow, ECORE_WL_INDICATOR_OPAQUE );
- }
- }
- else
- {
- // when the indicator is not visible, set TRANSPARENT mode for indicator server
- ecore_wl_window_indicator_opacity_set( mEcoreWindow, ECORE_WL_INDICATOR_TRANSPARENT); // it means hidden indicator
- }
-}
-
-void WindowBaseEcoreWl::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
-{
- if( isShow )
- {
- ecore_wl_window_indicator_state_set( mEcoreWindow, ECORE_WL_INDICATOR_STATE_ON );
- }
- else
- {
- ecore_wl_window_indicator_state_set( mEcoreWindow, ECORE_WL_INDICATOR_STATE_OFF );
- }
-}
-
-void WindowBaseEcoreWl::IndicatorTypeChanged( IndicatorInterface::Type type )
-{
-#if defined(DALI_PROFILE_MOBILE)
- switch( type )
- {
- case IndicatorInterface::INDICATOR_TYPE_1:
- {
- ecore_wl_indicator_visible_type_set( mEcoreWindow, ECORE_WL_INDICATOR_VISIBLE_TYPE_SHOWN );
- break;
- }
- case IndicatorInterface::INDICATOR_TYPE_2:
- {
- ecore_wl_indicator_visible_type_set( mEcoreWindow, ECORE_WL_INDICATOR_VISIBLE_TYPE_HIDDEN );
- break;
- }
- case IndicatorInterface::INDICATOR_TYPE_UNKNOWN:
- default:
- {
- break;
- }
- }
-#endif //MOBILE
-}
-
void WindowBaseEcoreWl::SetClass( const std::string& name, const std::string& className )
{
ecore_wl_window_title_set( mEcoreWindow, name.c_str() );
*/
void OnDataReceive( void* data, int type, void* event );
- /**
- * @brief Called when the indicator event is received.
- */
- void OnIndicatorFlicked( void* data, int type, void* event );
-
/**
* @brief Called when a font name is changed.
*/
*/
virtual void MoveResize( PositionSize positionSize ) override;
- /**
- * @copydoc Dali::Internal::Adaptor::WindowBase::ShowIndicator()
- */
- virtual void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode ) override;
-
- /**
- * @copydoc Dali::Internal::Adaptor::WindowBase::SetIndicatorProperties()
- */
- virtual void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ) override;
-
- /**
- * @copydoc Dali::Internal::Adaptor::WindowBase::IndicatorTypeChanged()
- */
- virtual void IndicatorTypeChanged( IndicatorInterface::Type type ) override;
-
/**
* @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
*/
#include <dali/internal/window-system/tizen-wayland/ecore-wl/window-factory-ecore-wl.h>
// INTERNAL HEADERS
-#include <dali/internal/window-system/tizen-wayland/indicator-impl-ecore-wl.h>
#include <dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h>
#include <dali/internal/window-system/common/display-utils.h>
return Utils::MakeUnique< WindowBaseEcoreWl >( positionSize, surface, isTransparent );
}
-std::unique_ptr< IndicatorInterface > WindowFactoryEcoreWl::CreateIndicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer )
-{
- return Utils::MakeUnique< IndicatorEcoreWl >( adaptor, orientation, observer );
-}
-
// this should be created from Window impl
std::unique_ptr< WindowFactory > GetWindowFactory()
{
{
public:
std::unique_ptr< WindowBase > CreateWindowBase( Dali::PositionSize positionSize, Any surface, bool isTransparent ) override;
-
- std::unique_ptr< IndicatorInterface > CreateIndicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer ) override;
};
} // namespace Adaptor
return ECORE_CALLBACK_PASS_ON;
}
-/////////////////////////////////////////////////////////////////////////////////////////////////
-// Indicator Callbacks
-/////////////////////////////////////////////////////////////////////////////////////////////////
-
-#if defined (DALI_PROFILE_MOBILE)
- /**
- * Called when the Ecore indicator event is received.
- */
- static Eina_Bool EcoreEventIndicator( void* data, int type, void* event )
- {
- WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
- if( windowBase )
- {
- windowBase->OnIndicatorFlicked( data, type, event );
- }
- return ECORE_CALLBACK_PASS_ON;
- }
-#endif // DALI_PROFILE_MOBILE
-
/////////////////////////////////////////////////////////////////////////////////////////////////
// Font Callbacks
/////////////////////////////////////////////////////////////////////////////////////////////////
mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this ) );
mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, this ) );
-#if defined (DALI_PROFILE_MOBILE)
- // Register indicator event
- mEcoreEventHandler.PushBack( ecore_event_handler_add( ECORE_WL2_EVENT_INDICATOR_FLICK, EcoreEventIndicator, this ) );
-#endif
-
// Register Vconf notify - font name and size
vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this );
vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this );
mSelectionDataReceivedSignal.Emit( event );
}
-void WindowBaseEcoreWl2::OnIndicatorFlicked( void* data, int type, void* event )
-{
- mIndicatorFlickedSignal.Emit();
-}
-
void WindowBaseEcoreWl2::OnFontNameChanged()
{
mStyleChangedSignal.Emit( StyleChange::DEFAULT_FONT_CHANGE );
ecore_wl2_window_sync_geometry_set( mEcoreWindow, ++mMoveResizeSerial, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
}
-void WindowBaseEcoreWl2::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode )
-{
- DALI_LOG_TRACE_METHOD_FMT( gWindowBaseLogFilter, "visible : %d\n", visibleMode );
-
- if( visibleMode == Dali::Window::VISIBLE )
- {
- // when the indicator is visible, set proper mode for indicator server according to bg mode
- if( opacityMode == Dali::Window::OPAQUE )
- {
- ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_OPAQUE );
- }
- else if( opacityMode == Dali::Window::TRANSLUCENT )
- {
- ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_TRANSLUCENT );
- }
- else if( opacityMode == Dali::Window::TRANSPARENT )
- {
- ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_OPAQUE );
- }
- }
- else
- {
- // when the indicator is not visible, set TRANSPARENT mode for indicator server
- ecore_wl2_window_indicator_opacity_set( mEcoreWindow, ECORE_WL2_INDICATOR_TRANSPARENT); // it means hidden indicator
- }
-}
-
-void WindowBaseEcoreWl2::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
-{
- if( isShow )
- {
- ecore_wl2_window_indicator_state_set( mEcoreWindow, ECORE_WL2_INDICATOR_STATE_ON );
- }
- else
- {
- ecore_wl2_window_indicator_state_set( mEcoreWindow, ECORE_WL2_INDICATOR_STATE_OFF );
- }
-}
-
-void WindowBaseEcoreWl2::IndicatorTypeChanged( IndicatorInterface::Type type )
-{
-#if defined(DALI_PROFILE_MOBILE)
- switch( type )
- {
- case IndicatorInterface::INDICATOR_TYPE_1:
- {
- ecore_wl2_indicator_visible_type_set( mEcoreWindow, ECORE_WL2_INDICATOR_VISIBLE_TYPE_SHOWN );
- break;
- }
- case IndicatorInterface::INDICATOR_TYPE_2:
- {
- ecore_wl2_indicator_visible_type_set( mEcoreWindow, ECORE_WL2_INDICATOR_VISIBLE_TYPE_HIDDEN );
- break;
- }
- case IndicatorInterface::INDICATOR_TYPE_UNKNOWN:
- default:
- {
- break;
- }
- }
-#endif //MOBILE
-}
-
void WindowBaseEcoreWl2::SetClass( const std::string& name, const std::string& className )
{
ecore_wl2_window_title_set( mEcoreWindow, name.c_str() );
*/
void OnDataReceive( void* data, int type, void* event );
- /**
- * @brief Called when the indicator event is received.
- */
- void OnIndicatorFlicked( void* data, int type, void* event );
-
/**
* @brief Called when a font name is changed.
*/
*/
virtual void MoveResize( PositionSize positionSize ) override;
- /**
- * @copydoc Dali::Internal::Adaptor::WindowBase::ShowIndicator()
- */
- virtual void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode ) override;
-
- /**
- * @copydoc Dali::Internal::Adaptor::WindowBase::SetIndicatorProperties()
- */
- virtual void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ) override;
-
- /**
- * @copydoc Dali::Internal::Adaptor::WindowBase::IndicatorTypeChanged()
- */
- virtual void IndicatorTypeChanged( IndicatorInterface::Type type ) override;
-
/**
* @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
*/
#include <dali/internal/window-system/tizen-wayland/ecore-wl2/window-factory-ecore-wl2.h>
// INTERNAL HEADERS
-#include <dali/internal/window-system/tizen-wayland/indicator-impl-ecore-wl.h>
#include <dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h>
#include <dali/internal/window-system/common/display-utils.h>
return Utils::MakeUnique< WindowBaseEcoreWl2 >( positionSize, surface, isTransparent );
}
-std::unique_ptr< IndicatorInterface > WindowFactoryEcoreWl2::CreateIndicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer )
-{
- return Utils::MakeUnique< IndicatorEcoreWl >( adaptor, orientation, observer );
-}
-
// this should be created from Window impl
std::unique_ptr< WindowFactory > GetWindowFactory()
{
{
public:
std::unique_ptr< WindowBase > CreateWindowBase( Dali::PositionSize positionSize, Any surface, bool isTransparent ) override;
-
- std::unique_ptr< IndicatorInterface > CreateIndicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer ) override;
};
} // namespace Adaptor
+++ /dev/null
-/*
- * Copyright (c) 2018 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 <dali/internal/window-system/tizen-wayland/indicator-impl-ecore-wl.h>
-
-// EXTERNAL INCLUDES
-// Ecore is littered with C style cast
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-#include <Ecore.h>
-#include <Evas.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include <dali/public-api/images/native-image.h>
-#include <dali/public-api/events/touch-point.h>
-#include <dali/public-api/common/stage.h>
-#include <dali/public-api/images/pixel.h>
-
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/adaptor/common/adaptor-impl.h>
-#include <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
-#include <dali/public-api/adaptor-framework/native-image-source.h>
-
-#if defined(DEBUG_ENABLED)
-#define STATE_DEBUG_STRING(state) (state==DISCONNECTED?"DISCONNECTED":state==CONNECTED?"CONNECTED":"UNKNOWN")
-#endif
-
-namespace
-{
-
-const float SLIDING_ANIMATION_DURATION( 0.2f ); // 200 milli seconds
-const float AUTO_INDICATOR_STAY_DURATION( 3.0f ); // 3 seconds
-
-enum
-{
- KEEP_SHOWING = -1,
- HIDE_NOW = 0
-};
-
-const int NUM_GRADIENT_INTERVALS(5); // Number of gradient intervals
-const float GRADIENT_ALPHA[NUM_GRADIENT_INTERVALS+1] = { 0.6f, 0.38f, 0.20f, 0.08f, 0.0f, 0.0f };
-
-#define MAKE_SHADER(A)#A
-
-const char* BACKGROUND_VERTEX_SHADER = MAKE_SHADER(
- attribute mediump vec2 aPosition;
- attribute mediump float aAlpha;
- varying mediump float vAlpha;
- uniform mediump mat4 uMvpMatrix;
- uniform mediump vec3 uSize;
-
- void main()
- {
- mediump vec4 vertexPosition = vec4( aPosition * uSize.xy, 0.0, 1.0 );
- vertexPosition = uMvpMatrix * vertexPosition;
-
- vAlpha = aAlpha;
- gl_Position = vertexPosition;
- }
-);
-
-const char* BACKGROUND_FRAGMENT_SHADER = MAKE_SHADER(
- uniform lowp vec4 uColor;
- varying mediump float vAlpha;
-
- void main()
- {
- gl_FragColor = uColor;
- gl_FragColor.a *= vAlpha;
- }
-);
-
-const char* FOREGROUND_VERTEX_SHADER = DALI_COMPOSE_SHADER(
- attribute mediump vec2 aPosition;\n
- varying mediump vec2 vTexCoord;\n
- uniform mediump mat4 uMvpMatrix;\n
- uniform mediump vec3 uSize;\n
- uniform mediump vec4 sTextureRect;\n
- \n
- void main()\n
- {\n
- gl_Position = uMvpMatrix * vec4(aPosition * uSize.xy, 0.0, 1.0);\n
- vTexCoord = aPosition + vec2(0.5);\n
- }\n
-);
-
-const char* FOREGROUND_FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
- varying mediump vec2 vTexCoord;\n
- uniform sampler2D sTexture;\n
- \n
- void main()\n
- {\n
- gl_FragColor = texture2D( sTexture, vTexCoord );\n // the foreground does not apply actor color
- }\n
-);
-
-Dali::Geometry CreateQuadGeometry()
-{
- Dali::Property::Map quadVertexFormat;
- quadVertexFormat["aPosition"] = Dali::Property::VECTOR2;
- Dali::PropertyBuffer vertexData = Dali::PropertyBuffer::New( quadVertexFormat );
-
- const float halfQuadSize = .5f;
- struct QuadVertex { Dali::Vector2 position; };
- QuadVertex quadVertexData[4] = {
- { Dali::Vector2(-halfQuadSize, -halfQuadSize) },
- { Dali::Vector2(-halfQuadSize, halfQuadSize) },
- { Dali::Vector2( halfQuadSize, -halfQuadSize) },
- { Dali::Vector2( halfQuadSize, halfQuadSize) } };
- vertexData.SetData(quadVertexData, 4);
-
- Dali::Geometry quad = Dali::Geometry::New();
- quad.AddVertexBuffer( vertexData );
- quad.SetType( Dali::Geometry::TRIANGLE_STRIP );
- return quad;
-}
-
-// indicator service name
-const char* INDICATOR_SERVICE_NAME("elm_indicator");
-
-// Copied from ecore_evas_extn_engine.h
-
-enum // opcodes
-{
- OP_RESIZE,
- OP_SHOW,
- OP_HIDE,
- OP_FOCUS,
- OP_UNFOCUS,
- OP_UPDATE,
- OP_UPDATE_DONE,
- OP_SHM_REF0,
- OP_SHM_REF1,
- OP_SHM_REF2,
- OP_PROFILE_CHANGE_REQUEST,
- OP_PROFILE_CHANGE_DONE,
- OP_EV_MOUSE_IN,
- OP_EV_MOUSE_OUT,
- OP_EV_MOUSE_UP,
- OP_EV_MOUSE_DOWN,
- OP_EV_MOUSE_MOVE,
- OP_EV_MOUSE_WHEEL,
- OP_EV_MULTI_UP,
- OP_EV_MULTI_DOWN,
- OP_EV_MULTI_MOVE,
- OP_EV_KEY_UP,
- OP_EV_KEY_DOWN,
- OP_EV_HOLD,
- OP_MSG_PARENT,
- OP_MSG,
-};
-
-// Copied from elm_conform.c
-
-const int MSG_DOMAIN_CONTROL_INDICATOR( 0x10001 );
-const int MSG_ID_INDICATOR_REPEAT_EVENT( 0x10002 );
-const int MSG_ID_INDICATOR_ROTATION( 0x10003 );
-const int MSG_ID_INDICATOR_OPACITY( 0X1004 );
-const int MSG_ID_INDICATOR_TYPE( 0X1005 );
-const int MSG_ID_INDICATOR_START_ANIMATION( 0X10006 );
-
-struct IpcDataResize
-{
- int w, h;
-};
-
-struct IpcIndicatorDataAnimation
-{
- unsigned int xwin;
- double duration;
-};
-
-struct IpcDataEvMouseUp
-{
- int b;
- Evas_Button_Flags flags;
- int mask;
- unsigned int timestamp;
- Evas_Event_Flags event_flags;
-
- IpcDataEvMouseUp(unsigned long timestamp)
- : b(1),
- flags(EVAS_BUTTON_NONE),
- mask(0),
- timestamp(static_cast<unsigned int>(timestamp)),
- event_flags(EVAS_EVENT_FLAG_NONE)
- {
- }
-};
-
-struct IpcDataEvMouseDown
-{
- int b;
- Evas_Button_Flags flags;
- int mask;
- unsigned int timestamp;
- Evas_Event_Flags event_flags;
-
- IpcDataEvMouseDown(unsigned long timestamp)
- : b(1),
- flags(EVAS_BUTTON_NONE),
- mask(0),
- timestamp(static_cast<unsigned int>(timestamp)),
- event_flags(EVAS_EVENT_FLAG_NONE)
- {
- }
-};
-
-struct IpcDataEvMouseMove
-{
- int x, y;
- Evas_Button_Flags flags;
- int mask;
- unsigned int timestamp;
- Evas_Event_Flags event_flags;
-
- IpcDataEvMouseMove(const Dali::Vector2& touchPoint, unsigned long timestamp)
- : x(static_cast<Evas_Coord>(touchPoint.x)),
- y(static_cast<Evas_Coord>(touchPoint.y)),
- flags(EVAS_BUTTON_NONE),
- mask(0),
- timestamp(static_cast<unsigned int>(timestamp)),
- event_flags(EVAS_EVENT_FLAG_NONE)
- {
- }
-};
-
-struct IpcDataEvMouseOut
-{
- unsigned int timestamp;
- int mask;
- Evas_Event_Flags event_flags;
-
- IpcDataEvMouseOut(unsigned long timestamp)
- : timestamp(static_cast<unsigned int>(timestamp)),
- mask(0),
- event_flags(EVAS_EVENT_FLAG_NONE)
- {
- }
-};
-
-#ifdef ENABLE_INDICATOR_IMAGE_SAVING
-
-void SaveIndicatorImage( Dali::NativeImageSourcePtr nativeImageSource )
-{
- // Save image data to disk in BMP form.
- static int gFilenameCounter = 0;
- static const char bmpHeader[] = {
- 0x42, 0x4d, 0x0a, 0xcb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x7c, 0x00,
- 0x00, 0x00,
- 0xe0, 0x01, 0x00, 0x00, // Width (480)
- 0x1b, 0x00, 0x00, 0x00, // Height ( 27)
- 0x01, 0x00, 0x20, 0x00, 0x03, 0x00,
- 0x00, 0x00, 0x80, 0xca, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff,
- 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x42, 0x47, 0x52, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- // This is a BMP header with width & height hard-coded in.
- // The data was first determined by dumping the raw data and inspecting in GIMP, before creating this header data.
- std::vector<unsigned char> buffer;
- unsigned int w = 0;
- unsigned int h = 0;
- Dali::Pixel::Format pixelFormat;
- if( nativeImageSource->GetPixels( buffer, w, h, pixelFormat ) )
- {
- int imageSize = w * h * 4;
- std::stringstream fileName;
- // Give each file an incremental filename.
- fileName << "/opt/usr/media/Images/out-" << std::setfill( '0' ) << std::setw( 5 ) << gFilenameCounter << ".bmp";
-
- std::ofstream outfile( fileName.str().c_str(), std::ofstream::binary );
- if( outfile.is_open() )
- {
- DALI_LOG_WARNING( "Saving Indicator Image w:%d, h:%d, %s\n", w, h, fileName.str().c_str() );
-
- outfile.write( bmpHeader, sizeof( bmpHeader ) / sizeof( bmpHeader[0] ) ); // Size of the BMP header.
- outfile.write( (const char*)buffer.data(), imageSize );
- outfile.close();
- gFilenameCounter++;
- }
- else
- {
- DALI_LOG_ERROR( "COULD NOT OPEN FOR SAVING: %s\n", fileName.str().c_str() );
- }
- }
-}
-
-#endif
-
-} // anonymous namespace
-
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-#if defined(DEBUG_ENABLED)
-Debug::Filter* gIndicatorLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_INDICATOR");
-#endif
-
-IndicatorEcoreWl::LockFile::LockFile(const std::string filename)
-: mFilename(filename),
- mErrorThrown(false)
-{
- mFileDescriptor = open(filename.c_str(), O_RDWR);
- if( mFileDescriptor == -1 )
- {
- mFileDescriptor = 0;
- mErrorThrown = true;
- DALI_LOG_ERROR( "### Cannot open %s for indicator lock ###\n", mFilename.c_str() );
- }
-}
-
-IndicatorEcoreWl::LockFile::~LockFile()
-{
- // Closing file descriptor also unlocks file.
- if( mFileDescriptor > 0 )
- {
- close( mFileDescriptor );
- }
-}
-
-bool IndicatorEcoreWl::LockFile::Lock()
-{
- DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
-
- bool locked = false;
- if( mFileDescriptor > 0 )
- {
- struct flock filelock;
-
- filelock.l_type = F_RDLCK;
- filelock.l_whence = SEEK_SET;
- filelock.l_start = 0;
- filelock.l_len = 0;
- if( fcntl( mFileDescriptor, F_SETLKW, &filelock ) == -1 )
- {
- mErrorThrown = true;
- DALI_LOG_ERROR( "### Failed to lock with fd : %s ###\n", mFilename.c_str() );
- }
- else
- {
- locked = true;
- }
- }
- else
- {
- mErrorThrown = true;
- DALI_LOG_ERROR( "### Invalid fd ###\n" );
- }
-
- return locked;
-}
-
-void IndicatorEcoreWl::LockFile::Unlock()
-{
- DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
-
- if( mFileDescriptor > 0 )
- {
- struct flock filelock;
-
- filelock.l_type = F_UNLCK;
- filelock.l_whence = SEEK_SET;
- filelock.l_start = 0;
- filelock.l_len = 0;
- if (fcntl(mFileDescriptor, F_SETLKW, &filelock) == -1)
- {
- mErrorThrown = true;
- DALI_LOG_ERROR( "### Failed to lock with fd : %s ###\n", mFilename.c_str() );
- }
- }
-}
-
-bool IndicatorEcoreWl::LockFile::RetrieveAndClearErrorStatus()
-{
- bool error = mErrorThrown;
- mErrorThrown = false;
- return error;
-}
-
-IndicatorEcoreWl::ScopedLock::ScopedLock(LockFile* lockFile)
-: mLockFile(lockFile),
- mLocked(false)
-{
- if(mLockFile)
- {
- mLocked = mLockFile->Lock();
- }
-}
-
-IndicatorEcoreWl::ScopedLock::~ScopedLock()
-{
- if( mLockFile )
- {
- mLockFile->Unlock();
- }
-}
-
-bool IndicatorEcoreWl::ScopedLock::IsLocked()
-{
- return mLocked;
-}
-
-IndicatorEcoreWl::IndicatorEcoreWl( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer )
-: mConnection( this ),
- mOpacityMode( Dali::Window::OPAQUE ),
- mState( DISCONNECTED ),
- mAdaptor(adaptor),
- mServerConnection( NULL ),
- mObserver( observer ),
- mOrientation( orientation ),
- mImageWidth( 0 ),
- mImageHeight( 0 ),
- mVisible( Dali::Window::INVISIBLE ),
- mIsShowing( true ),
- mIsAnimationPlaying( false ),
- mCurrentSharedFile( 0 ),
- mBackgroundVisible( false )
-{
- mIndicatorContentActor = Dali::Actor::New();
- mIndicatorContentActor.SetParentOrigin( ParentOrigin::TOP_CENTER );
- mIndicatorContentActor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
-
- // Indicator image handles the touch event including "leave"
- mIndicatorContentActor.SetLeaveRequired( true );
- mIndicatorContentActor.TouchSignal().Connect( this, &IndicatorEcoreWl::OnTouch );
- mIndicatorContentActor.SetColor( Color::BLACK );
-
- mIndicatorActor = Dali::Actor::New();
- mIndicatorActor.Add( mIndicatorContentActor );
-
- // Event handler to find out flick down gesture
- mEventActor = Dali::Actor::New();
- mEventActor.SetParentOrigin( ParentOrigin::TOP_CENTER );
- mEventActor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- mIndicatorActor.Add( mEventActor );
-
- // Attach pan gesture to find flick down during hiding.
- // It can prevent the problem that scrollview gets pan gesture even indicator area is touched,
- // since it consumes the pan gesture in advance.
- mPanDetector = Dali::PanGestureDetector::New();
- mPanDetector.DetectedSignal().Connect( this, &IndicatorEcoreWl::OnPan );
- mPanDetector.Attach( mEventActor );
-
- Open( orientation );
-
- // register indicator to accessibility adaptor
- Dali::AccessibilityAdaptor accessibilityAdaptor = AccessibilityAdaptor::Get();
- if(accessibilityAdaptor)
- {
- AccessibilityAdaptor::GetImplementation( accessibilityAdaptor ).SetIndicator( this );
- }
- // hide the indicator by default
- mIndicatorActor.SetVisible( false );
-}
-
-IndicatorEcoreWl::~IndicatorEcoreWl()
-{
- if(mEventActor)
- {
- mEventActor.TouchSignal().Disconnect( this, &IndicatorEcoreWl::OnTouch );
- }
- Disconnect();
-}
-
-void IndicatorEcoreWl::SetAdaptor(Adaptor* adaptor)
-{
- mAdaptor = adaptor;
- mIndicatorBuffer->SetAdaptor( adaptor );
-}
-
-Dali::Actor IndicatorEcoreWl::GetActor()
-{
- return mIndicatorActor;
-}
-
-void IndicatorEcoreWl::Open( Dali::Window::WindowOrientation orientation )
-{
- DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
-
- // Calls from Window should be set up to ensure we are in a
- // disconnected state before opening a second time.
- DALI_ASSERT_DEBUG( mState == DISCONNECTED );
-
- mOrientation = orientation;
-
- Connect();
-
- // Change background visibility depending on orientation
- if( mOrientation == Dali::Window::LANDSCAPE || mOrientation == Dali::Window::LANDSCAPE_INVERSE )
- {
- if( mBackgroundRenderer )
- {
- mIndicatorContentActor.RemoveRenderer( mBackgroundRenderer );
- mBackgroundVisible = false;
- }
- }
- else
- {
- SetOpacityMode( mOpacityMode );
- }
-}
-
-void IndicatorEcoreWl::Close()
-{
- DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "State: %s", STATE_DEBUG_STRING(mState) );
-
- if( mState == CONNECTED )
- {
- Disconnect();
- if( mObserver != NULL )
- {
- mObserver->IndicatorClosed( this );
- }
- }
-
- Dali::Texture emptyTexture;
- SetForegroundImage( emptyTexture );
-}
-
-void IndicatorEcoreWl::Flicked()
-{
- // if indicator is not showing, INDICATOR_FLICK_DONE is given
- if( mVisible == Dali::Window::AUTO && !mIsShowing )
- {
- ShowIndicator( AUTO_INDICATOR_STAY_DURATION );
- }
-}
-
-void IndicatorEcoreWl::SetOpacityMode( Dali::Window::IndicatorBgOpacity mode )
-{
- mOpacityMode = mode;
-
- Dali::Geometry geometry = CreateBackgroundGeometry();
- if( geometry )
- {
- if( mBackgroundRenderer )
- {
- if( mBackgroundRenderer.GetGeometry() != geometry )
- {
- mBackgroundRenderer.SetGeometry( geometry );
- }
- }
- else
- {
- if( !mBackgroundShader )
- {
- mBackgroundShader = Dali::Shader::New( BACKGROUND_VERTEX_SHADER, BACKGROUND_FRAGMENT_SHADER, Dali::Shader::Hint::OUTPUT_IS_TRANSPARENT );
- }
-
- mBackgroundRenderer = Dali::Renderer::New( geometry, mBackgroundShader );
- }
-
- if( !mBackgroundVisible )
- {
- mIndicatorContentActor.AddRenderer( mBackgroundRenderer );
- mBackgroundVisible = true;
- }
- }
- else if( mBackgroundRenderer )
- {
- mIndicatorContentActor.RemoveRenderer( mBackgroundRenderer );
- mBackgroundVisible = false;
- }
-}
-
-void IndicatorEcoreWl::SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool forceUpdate )
-{
- if ( visibleMode != mVisible || forceUpdate )
- {
- // If we were previously hidden, then we should update the image data before we display the indicator
- if ( mVisible == Dali::Window::INVISIBLE )
- {
- UpdateImageData( mCurrentSharedFile );
- }
-
- 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;
-
- if( mForegroundRenderer && mForegroundRenderer.GetTextures().GetTexture( 0u ) )
- {
- if( CheckVisibleState() && mVisible == Dali::Window::AUTO )
- {
- // hide indicator
- ShowIndicator( AUTO_INDICATOR_STAY_DURATION /* stay n sec */ );
- }
- else if( CheckVisibleState() && mVisible == Dali::Window::VISIBLE )
- {
- // show indicator
- ShowIndicator( KEEP_SHOWING );
- }
- else
- {
- // hide indicator
- ShowIndicator( HIDE_NOW );
- }
- }
- else
- {
- mIsShowing = false;
- }
- }
-}
-
-bool IndicatorEcoreWl::IsConnected()
-{
- return ( mState == CONNECTED );
-}
-
-bool IndicatorEcoreWl::SendMessage( int messageDomain, int messageId, const void *data, int size )
-{
- if(IsConnected())
- {
- return mServerConnection->SendEvent( OP_MSG, messageDomain, messageId, data, size );
- }
- else
- {
- return false;
- }
-}
-
-bool IndicatorEcoreWl::OnTouch(Dali::Actor indicator, const Dali::TouchData& touchData)
-{
- if( mServerConnection )
- {
- // Send touch event to indicator server when indicator is showing
- if( CheckVisibleState() || mIsShowing )
- {
- switch( touchData.GetState(0) )
- {
- case Dali::PointState::DOWN:
- {
- IpcDataEvMouseMove ipcMove( touchData.GetLocalPosition(0), touchData.GetTime() );
- IpcDataEvMouseDown ipcDown( touchData.GetTime() );
- mServerConnection->SendEvent( OP_EV_MOUSE_MOVE, &ipcMove, sizeof(ipcMove) );
- mServerConnection->SendEvent( OP_EV_MOUSE_DOWN, &ipcDown, sizeof(ipcDown) );
-
- if( mVisible == Dali::Window::AUTO )
- {
- // Stop hiding indicator
- ShowIndicator( KEEP_SHOWING );
- }
- }
- break;
-
- case Dali::PointState::MOTION:
- {
- IpcDataEvMouseMove ipcMove( touchData.GetLocalPosition(0), touchData.GetTime() );
- mServerConnection->SendEvent( OP_EV_MOUSE_MOVE, &ipcMove, sizeof(ipcMove) );
- }
- break;
-
- case Dali::PointState::UP:
- case Dali::PointState::INTERRUPTED:
- {
- IpcDataEvMouseUp ipcUp( touchData.GetTime() );
- mServerConnection->SendEvent( OP_EV_MOUSE_UP, &ipcUp, sizeof(ipcUp) );
-
- if( mVisible == Dali::Window::AUTO )
- {
- // Hide indicator
- ShowIndicator( 0.5f /* hide after 0.5 sec */ );
- }
- }
- break;
-
- case Dali::TouchPoint::Leave:
- {
- IpcDataEvMouseMove ipcMove( touchData.GetLocalPosition(0), touchData.GetTime() );
- mServerConnection->SendEvent( OP_EV_MOUSE_MOVE, &ipcMove, sizeof(ipcMove) );
- IpcDataEvMouseUp ipcOut( touchData.GetTime() );
- mServerConnection->SendEvent( OP_EV_MOUSE_OUT, &ipcOut, sizeof(ipcOut) );
- }
- break;
-
- default:
- break;
- }
-
- return true;
- }
- }
-
- return false;
-}
-
-bool IndicatorEcoreWl::Connect()
-{
- DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
-
- DALI_ASSERT_DEBUG( mState == DISCONNECTED );
-
- bool connected = false;
-
- mServerConnection = new ServerConnection( INDICATOR_SERVICE_NAME, 0, false, this );
- if( mServerConnection )
- {
- connected = mServerConnection->IsConnected();
- if( ! connected )
- {
- delete mServerConnection;
- mServerConnection = NULL;
- }
- }
-
- if( !connected )
- {
- StartReconnectionTimer();
- }
- else
- {
- mState = CONNECTED;
- }
-
- return connected;
-}
-
-void IndicatorEcoreWl::StartReconnectionTimer()
-{
- if( ! mReconnectTimer )
- {
- mReconnectTimer = Dali::Timer::New(1000);
- mConnection.DisconnectAll();
- mReconnectTimer.TickSignal().Connect( mConnection, &IndicatorEcoreWl::OnReconnectTimer );
- }
- mReconnectTimer.Start();
-}
-
-bool IndicatorEcoreWl::OnReconnectTimer()
-{
- bool retry = false;
-
- if( mState == DISCONNECTED )
- {
- if( !Connect() )
- {
- retry = true;
- }
- }
-
- return retry;
-}
-
-void IndicatorEcoreWl::Disconnect()
-{
- DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
-
- mState = DISCONNECTED;
-
- delete mServerConnection;
- mServerConnection = NULL;
-
- ClearSharedFileInfo();
-}
-
-void IndicatorEcoreWl::Resize( int width, int height )
-{
- if( width < 1 )
- {
- width = 1;
- }
- if( height < 1 )
- {
- height = 1;
- }
-
- if( mImageWidth != width || mImageHeight != height )
- {
- mImageWidth = width;
- mImageHeight = height;
-
- mIndicatorContentActor.SetSize( mImageWidth, mImageHeight );
- mIndicatorActor.SetSize( mImageWidth, mImageHeight );
- mEventActor.SetSize(mImageWidth, mImageHeight);
- }
-}
-
-void IndicatorEcoreWl::SetLockFileInfo( Ecore_Ipc_Event_Server_Data *epcEvent )
-{
- DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
-
- // epcEvent->ref == w
- // epcEvent->ref_to == h
- // epcEvent->response == buffer num
- // epcEvent->data = lockfile + nul byte
-
- if( (epcEvent->ref > 0) && (epcEvent->ref_to > 0) && (epcEvent->data) &&
- (((unsigned char *)epcEvent->data)[epcEvent->size - 1] == 0) )
- {
- int n = epcEvent->response;
-
- if( n >= 0 && n < SHARED_FILE_NUMBER )
- {
- mCurrentSharedFile = n;
-
- mSharedFileInfo[n].mImageWidth = epcEvent->ref;
- mSharedFileInfo[n].mImageHeight = epcEvent->ref_to;
-
- mSharedFileInfo[n].mLockFileName.clear();
-
- mSharedFileInfo[n].mLockFileName = static_cast< char* >( epcEvent->data );
-
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "SetLockFileInfo: buffer num = %d, w = %d, h = %d, lock = %s\n",
- n, mSharedFileInfo[n].mImageWidth, mSharedFileInfo[n].mImageHeight, mSharedFileInfo[n].mLockFileName.c_str() );
- }
- }
-}
-
-void IndicatorEcoreWl::SetSharedImageInfo( Ecore_Ipc_Event_Server_Data *epcEvent )
-{
- DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
-
- // epcEvent->ref == shm id
- // epcEvent->ref_to == shm num
- // epcEvent->response == buffer num
- // epcEvent->data = shm ref string + nul byte
-
- if ( (epcEvent->data) &&
- (epcEvent->size > 0) &&
- (((unsigned char *)epcEvent->data)[epcEvent->size - 1] == 0) )
- {
- int n = epcEvent->response;
-
- if( n >= 0 && n < SHARED_FILE_NUMBER )
- {
- mCurrentSharedFile = n;
-
- mSharedFileInfo[n].mSharedFileName.clear();
-
- mSharedFileInfo[n].mSharedFileName = static_cast< char* >( epcEvent->data );
-
- mSharedFileInfo[n].mSharedFileID = epcEvent->ref;
- mSharedFileInfo[n].mSharedFileNumber = epcEvent->ref_to;
-
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "SetSharedImageInfo: buffer num %d, shared file = %s, id = %d, num = %d\n",
- n, mSharedFileInfo[n].mSharedFileName.c_str(), mSharedFileInfo[n].mSharedFileID, mSharedFileInfo[n].mSharedFileNumber );
- }
- }
-}
-
-void IndicatorEcoreWl::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent )
-{
- DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
-
- // epcEvent->ref == alpha
- // epcEvent->ref_to == sys
- // epcEvent->response == buffer num
-
- int n = epcEvent->response;
-
- if( n >= 0 && n < SHARED_FILE_NUMBER )
- {
- mCurrentSharedFile = n;
-
- delete mSharedFileInfo[n].mSharedFile;
- mSharedFileInfo[n].mSharedFile = NULL;
-
- delete mSharedFileInfo[n].mLock;
- mSharedFileInfo[n].mLock = NULL;
-
- std::stringstream sharedFileID;
- std::stringstream sharedFileNumber;
-
- sharedFileID << mSharedFileInfo[n].mSharedFileID;
- sharedFileNumber << mSharedFileInfo[n].mSharedFileNumber;
-
- std::string sharedFilename = "/" + mSharedFileInfo[n].mSharedFileName + "-" + sharedFileID.str() + "." + sharedFileNumber.str();
-
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "LoadSharedImage: file name = %s\n", sharedFilename.c_str() );
-
- mSharedFileInfo[n].mSharedFile = SharedFile::New( sharedFilename.c_str(), mSharedFileInfo[n].mImageWidth * mSharedFileInfo[n].mImageWidth * 4, true );
- if( mSharedFileInfo[n].mSharedFile != NULL )
- {
- mSharedFileInfo[n].mLock = new IndicatorEcoreWl::LockFile( mSharedFileInfo[n].mLockFileName );
- if( mSharedFileInfo[n].mLock->RetrieveAndClearErrorStatus() )
- {
- DALI_LOG_ERROR( "### Indicator error: Cannot open lock file %s ###\n", mSharedFileInfo[n].mLockFileName.c_str() );
- }
- else
- {
- CreateNewImage( n );
- UpdateVisibility();
- }
- }
- }
-}
-
-void IndicatorEcoreWl::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 );
- }
-
- if( !mIsShowing )
- {
- mIndicatorContentActor.SetPosition( 0.0f, -mImageHeight, 0.0f );
- }
-
- SetVisible(mVisible, true);
-}
-
-void IndicatorEcoreWl::UpdateImageData( int bufferNumber )
-{
- DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "State: %s mVisible: %s", STATE_DEBUG_STRING(mState), mVisible?"T":"F" );
-
- if( mState == CONNECTED && mVisible )
- {
- // not sure we can skip it when mIsShowing is false
- CopyToBuffer( bufferNumber );
- }
-}
-
-bool IndicatorEcoreWl::CopyToBuffer( int bufferNumber )
-{
- bool success = false;
-
- if( mSharedFileInfo[bufferNumber].mLock )
- {
- IndicatorEcoreWl::ScopedLock scopedLock(mSharedFileInfo[bufferNumber].mLock);
- if( mSharedFileInfo[bufferNumber].mLock->RetrieveAndClearErrorStatus() )
- {
- // Do nothing here.
- }
- else if( scopedLock.IsLocked() )
- {
- unsigned char *src = mSharedFileInfo[bufferNumber].mSharedFile->GetAddress();
- size_t size = static_cast< size_t >( mSharedFileInfo[bufferNumber].mImageWidth ) * mSharedFileInfo[bufferNumber].mImageHeight * 4;
-
- if( mIndicatorBuffer->UpdatePixels( src, size ) )
- {
- mAdaptor->RequestUpdateOnce();
- success = true;
- }
- }
- }
-
- return success;
-}
-
-void IndicatorEcoreWl::CreateNewImage( int bufferNumber )
-{
- DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "W:%d H:%d", mSharedFileInfo[bufferNumber].mImageWidth, mSharedFileInfo[bufferNumber].mImageHeight );
- mIndicatorBuffer = new IndicatorBuffer( mAdaptor, mSharedFileInfo[bufferNumber].mImageWidth, mSharedFileInfo[bufferNumber].mImageHeight, Pixel::BGRA8888 );
- bool success = false;
-
- if( CopyToBuffer( bufferNumber ) ) // Only create images if we have valid image buffer
- {
- Dali::Texture texture = Dali::Texture::New( mIndicatorBuffer->GetNativeImage() );
- if( texture )
- {
- SetForegroundImage( texture );
- success = true;
- }
- }
-
- if( !success )
- {
- DALI_LOG_WARNING("### Cannot create indicator image ###\n");
- }
-}
-
-Dali::Geometry IndicatorEcoreWl::CreateBackgroundGeometry()
-{
- switch( mOpacityMode )
- {
- case Dali::Window::TRANSLUCENT:
- if( !mTranslucentGeometry )
- {
- // Construct 5 interval mesh
- // 0 +---+ 1
- // | \ |
- // 2 +---+ 3
- // | \ |
- // 4 +---+ 5
- // | \ |
- // 6 +---+ 7
- // | \ |
- // 8 +---+ 9
- // | \ |
- // 10 +---+ 11
-
- // Create vertices
- struct BackgroundVertex
- {
- Vector2 mPosition;
- float mAlpha;
- };
-
- unsigned int numVertices = 2 * ( NUM_GRADIENT_INTERVALS + 1 );
- BackgroundVertex vertices[ numVertices ];
-
- float d = -0.5f;
- float delta = 1.0f / NUM_GRADIENT_INTERVALS;
- BackgroundVertex* currentVertex = vertices;
- for( int y = 0; y < NUM_GRADIENT_INTERVALS + 1; ++y, d += delta )
- {
- currentVertex->mPosition = Vector2( -0.5f, d );
- currentVertex->mAlpha = GRADIENT_ALPHA[ y ];
- currentVertex++;
-
- currentVertex->mPosition = Vector2( 0.5f, d );
- currentVertex->mAlpha = GRADIENT_ALPHA[ y ];
- currentVertex++;
- }
-
- // Create indices
- unsigned int numIndices = 2 * 3 * NUM_GRADIENT_INTERVALS;
- unsigned short indices[ numIndices ];
-
- unsigned short* currentIndex = indices;
- for( int y = 0; y < NUM_GRADIENT_INTERVALS; ++y )
- {
- *currentIndex++ = (2 * y);
- *currentIndex++ = (2 * y) + 3;
- *currentIndex++ = (2 * y) + 1;
-
- *currentIndex++ = (2 * y);
- *currentIndex++ = (2 * y) + 2;
- *currentIndex++ = (2 * y) + 3;
- }
-
- Dali::Property::Map vertexFormat;
- vertexFormat[ "aPosition" ] = Dali::Property::VECTOR2;
- vertexFormat[ "aAlpha" ] = Dali::Property::FLOAT;
- Dali::PropertyBuffer vertexPropertyBuffer = Dali::PropertyBuffer::New( vertexFormat );
- vertexPropertyBuffer.SetData( vertices, numVertices );
-
- // Create the geometry object
- mTranslucentGeometry = Dali::Geometry::New();
- mTranslucentGeometry.AddVertexBuffer( vertexPropertyBuffer );
- mTranslucentGeometry.SetIndexBuffer( &indices[0], numIndices );
- }
-
- return mTranslucentGeometry;
- case Dali::Window::OPAQUE:
-
- if( !mSolidGeometry )
- {
- // Create vertices
- struct BackgroundVertex
- {
- Vector2 mPosition;
- float mAlpha;
- };
-
- BackgroundVertex vertices[ 4 ] = { { Vector2( -0.5f, -0.5f ), 1.0f }, { Vector2( 0.5f, -0.5f ), 1.0f },
- { Vector2( -0.5f, 0.5f ), 1.0f }, { Vector2( 0.5f, 0.5f ), 1.0f } };
-
- // Create indices
- unsigned short indices[ 6 ] = { 0, 3, 1, 0, 2, 3 };
-
- Dali::Property::Map vertexFormat;
- vertexFormat[ "aPosition" ] = Dali::Property::VECTOR2;
- vertexFormat[ "aAlpha" ] = Dali::Property::FLOAT;
- Dali::PropertyBuffer vertexPropertyBuffer = Dali::PropertyBuffer::New( vertexFormat );
- vertexPropertyBuffer.SetData( vertices, 4 );
-
-
- // Create the geometry object
- mSolidGeometry = Dali::Geometry::New();
- mSolidGeometry.AddVertexBuffer( vertexPropertyBuffer );
- mSolidGeometry.SetIndexBuffer( &indices[0], 6 );
- }
-
- return mSolidGeometry;
- case Dali::Window::TRANSPARENT:
- break;
- }
-
- return Dali::Geometry();
-}
-
-void IndicatorEcoreWl::SetForegroundImage( Dali::Texture texture )
-{
- if( !mForegroundRenderer && texture )
- {
- // Create Shader
- Dali::Shader shader = Dali::Shader::New( FOREGROUND_VERTEX_SHADER, FOREGROUND_FRAGMENT_SHADER );
-
- // Create renderer from geometry and material
- Dali::Geometry quad = CreateQuadGeometry();
- mForegroundRenderer = Dali::Renderer::New( quad, shader );
- // Make sure the foreground stays in front of the background
- mForegroundRenderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, 1.f );
-
- // Set blend function
- mForegroundRenderer.SetProperty( Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB, Dali::BlendFactor::ONE );
- mForegroundRenderer.SetProperty( Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB, Dali::BlendFactor::ONE_MINUS_SRC_ALPHA );
- mForegroundRenderer.SetProperty( Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA, Dali::BlendFactor::ONE );
- mForegroundRenderer.SetProperty( Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA, Dali::BlendFactor::ONE );
-
- // Create a texture-set and add to renderer
-
- Dali::TextureSet textureSet = Dali::TextureSet::New();
- textureSet.SetTexture( 0u, texture );
- mForegroundRenderer.SetTextures( textureSet );
-
- mIndicatorContentActor.AddRenderer( mForegroundRenderer );
- }
- else if( mForegroundRenderer )
- {
- Dali::TextureSet textureSet = mForegroundRenderer.GetTextures();
- textureSet.SetTexture( 0u, texture );
- }
-
- if( mImageWidth == 0 && mImageHeight == 0 && texture)
- {
- Resize( texture.GetWidth(), texture.GetHeight() );
- }
-}
-
-void IndicatorEcoreWl::OnIndicatorTypeChanged( Type indicatorType )
-{
- if( mObserver != NULL )
- {
- mObserver->IndicatorTypeChanged( indicatorType );
- }
-}
-
-void IndicatorEcoreWl::DataReceived( void* event )
-{
- DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
- Ecore_Ipc_Event_Server_Data *epcEvent = static_cast<Ecore_Ipc_Event_Server_Data *>( event );
-
- switch( epcEvent->minor )
- {
- case OP_UPDATE:
- {
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_UPDATE\n" );
- if( mIsShowing )
- {
- mAdaptor->RequestUpdateOnce();
- }
- break;
- }
- case OP_UPDATE_DONE:
- {
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_UPDATE_DONE [%d]\n", epcEvent->response );
- // epcEvent->response == display buffer #
- UpdateImageData( epcEvent->response );
- break;
- }
- case OP_SHM_REF0:
- {
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_SHM_REF0\n" );
- SetSharedImageInfo( epcEvent );
- break;
- }
- case OP_SHM_REF1:
- {
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_SHM_REF1\n" );
- SetLockFileInfo( epcEvent );
- break;
- }
- case OP_SHM_REF2:
- {
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_SHM_REF2\n" );
- LoadSharedImage( epcEvent );
- break;
- }
- case OP_RESIZE:
- {
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_RESIZE\n" );
-
- if( (epcEvent->data) && (epcEvent->size >= (int)sizeof(IpcDataResize)) )
- {
- IpcDataResize *newSize = static_cast<IpcDataResize*>( epcEvent->data );
- Resize( newSize->w, newSize->h );
- }
- break;
- }
- case OP_MSG_PARENT:
- {
- int msgDomain = epcEvent->ref;
- int msgId = epcEvent->ref_to;
-
- void *msgData = NULL;
- int msgDataSize = 0;
- msgData = epcEvent->data;
- msgDataSize = epcEvent->size;
-
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_MSG_PARENT. msgDomain = %d\n", msgDomain );
-
- if( msgDomain == MSG_DOMAIN_CONTROL_INDICATOR )
- {
- switch( msgId )
- {
- case MSG_ID_INDICATOR_TYPE:
- {
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_MSG_PARENT, INDICATOR_TYPE\n" );
- Type* indicatorType = static_cast<Type*>( epcEvent->data );
- OnIndicatorTypeChanged( *indicatorType );
- break;
- }
-
- case MSG_ID_INDICATOR_START_ANIMATION:
- {
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: MSG_ID_INDICATOR_START_ANIMATION\n" );
-
- if (msgDataSize != (int)sizeof(IpcIndicatorDataAnimation))
- {
- DALI_LOG_ERROR("Message data is incorrect\n");
- break;
- }
-
- IpcIndicatorDataAnimation *animData = static_cast<IpcIndicatorDataAnimation*>(msgData);
-
- if(!CheckVisibleState())
- {
- ShowIndicator( animData->duration /* n sec */ );
- }
- break;
- }
- }
- }
- break;
- }
- }
-}
-
-void IndicatorEcoreWl::ConnectionClosed()
-{
- DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
-
- // Will get this callback if the server connection failed to start up.
- delete mServerConnection;
- mServerConnection = NULL;
- mState = DISCONNECTED;
-
- // Attempt to re-connect
- Connect();
-}
-
-bool IndicatorEcoreWl::CheckVisibleState()
-{
- if( mOrientation == Dali::Window::LANDSCAPE
- || mOrientation == Dali::Window::LANDSCAPE_INVERSE
- || (mVisible == Dali::Window::INVISIBLE)
- || (mVisible == Dali::Window::AUTO && !mIsShowing) )
- {
- return false;
- }
-
- return true;
-}
-
-void IndicatorEcoreWl::ClearSharedFileInfo()
-{
- for( int i = 0; i < SHARED_FILE_NUMBER; i++ )
- {
- delete mSharedFileInfo[i].mLock;
- mSharedFileInfo[i].mLock = NULL;
-
- delete mSharedFileInfo[i].mSharedFile;
- mSharedFileInfo[i].mSharedFile = NULL;
-
- mSharedFileInfo[i].mLockFileName.clear();
- mSharedFileInfo[i].mSharedFileName.clear();
- }
-}
-
-/**
- * duration can be this
- *
- * enum
- * {
- * KEEP_SHOWING = -1,
- * HIDE_NOW = 0
- * };
- */
-void IndicatorEcoreWl::ShowIndicator(float duration)
-{
- if( !mIndicatorAnimation )
- {
- mIndicatorAnimation = Dali::Animation::New(SLIDING_ANIMATION_DURATION);
- mIndicatorAnimation.FinishedSignal().Connect(this, &IndicatorEcoreWl::OnAnimationFinished);
- }
-
- if(mIsShowing && !EqualsZero(duration))
- {
- // If need to show during showing, do nothing.
- // In 2nd phase (below) will update timer
- }
- else if(!mIsShowing && mIsAnimationPlaying && EqualsZero(duration))
- {
- // If need to hide during hiding or hidden already, do nothing
- }
- else
- {
- mIndicatorAnimation.Clear();
-
- if( EqualsZero(duration) )
- {
- mIndicatorAnimation.AnimateTo( Property( mIndicatorContentActor, Dali::Actor::Property::POSITION ), Vector3(0, -mImageHeight, 0), Dali::AlphaFunction::EASE_OUT );
-
- mIsShowing = false;
-
- OnIndicatorTypeChanged( INDICATOR_TYPE_2 ); // un-toucable
- }
- else
- {
- mIndicatorAnimation.AnimateTo( Property( mIndicatorContentActor, Dali::Actor::Property::POSITION ), Vector3(0, 0, 0), Dali::AlphaFunction::EASE_OUT );
-
- mIsShowing = true;
-
- OnIndicatorTypeChanged( INDICATOR_TYPE_1 ); // touchable
- }
-
- mIndicatorAnimation.Play();
- mIsAnimationPlaying = true;
- }
-
- if(duration > 0)
- {
- if(!mShowTimer)
- {
- mShowTimer = Dali::Timer::New(1000 * duration);
- mShowTimer.TickSignal().Connect(this, &IndicatorEcoreWl::OnShowTimer);
- }
- mShowTimer.SetInterval(1000* duration);
- mShowTimer.Start();
-
- if( mVisible == Dali::Window::AUTO )
- {
- // check the stage touch
- Dali::Stage::GetCurrent().TouchSignal().Connect( this, &IndicatorEcoreWl::OnStageTouch );
- }
- }
- else
- {
- if(mShowTimer && mShowTimer.IsRunning())
- {
- mShowTimer.Stop();
- }
-
- if( mVisible == Dali::Window::AUTO )
- {
- // check the stage touch
- Dali::Stage::GetCurrent().TouchSignal().Disconnect( this, &IndicatorEcoreWl::OnStageTouch );
- }
- }
-}
-
-bool IndicatorEcoreWl::OnShowTimer()
-{
- // after time up, hide indicator
- ShowIndicator( HIDE_NOW );
-
- return false;
-}
-
-void IndicatorEcoreWl::OnAnimationFinished(Dali::Animation& animation)
-{
- mIsAnimationPlaying = false;
- // once animation is finished and indicator is hidden, take it off stage
- if( mObserver != NULL )
- {
- mObserver->IndicatorVisibilityChanged( mIsShowing ); // is showing?
- }
-}
-
-void IndicatorEcoreWl::OnPan( Dali::Actor actor, const Dali::PanGesture& gesture )
-{
- // Nothing to do, but we still want to consume pan
-}
-
-void IndicatorEcoreWl::OnStageTouch(const Dali::TouchData& touchData)
-{
- // when stage is touched while indicator is showing temporary, hide it
- if( mIsShowing && ( CheckVisibleState() == false || mVisible == Dali::Window::AUTO ) )
- {
- switch( touchData.GetState(0) )
- {
- case Dali::PointState::DOWN:
- {
- // if touch point is inside the indicator, indicator is not hidden
- if( mImageHeight < int( touchData.GetScreenPosition(0).y ) )
- {
- ShowIndicator( HIDE_NOW );
- }
- break;
- }
-
- default:
- break;
- }
- }
-}
-
-} // Adaptor
-
-} // Internal
-
-} // Dali
-
-#pragma GCC diagnostic pop
+++ /dev/null
-#ifndef DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_INDICATOR_IMPL_ECORE_WL_H
-#define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_INDICATOR_IMPL_ECORE_WL_H
-
-/*
- * Copyright (c) 2018 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 <dali/public-api/animation/animation.h>
-#include <dali/public-api/events/pan-gesture.h>
-#include <dali/public-api/events/pan-gesture-detector.h>
-#include <dali/public-api/events/touch-data.h>
-#include <dali/public-api/rendering/renderer.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/window-system/common/indicator-interface.h>
-#include <dali/internal/window-system/common/indicator-buffer.h>
-#include <dali/internal/window-system/common/ecore-server-connection.h>
-#include <dali/internal/system/common/shared-file.h>
-#include <dali/public-api/adaptor-framework/timer.h>
-#include <dali/public-api/adaptor-framework/window.h>
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-
-class Adaptor;
-
-/**
- * The Indicator class connects to the indicator server, and gets and draws the indicator
- * for the given orientation.
- */
-class IndicatorEcoreWl : public ConnectionTracker, public ServerConnection::Observer, public IndicatorInterface
-{
-public:
-
- enum State
- {
- DISCONNECTED,
- CONNECTED
- };
-
-protected:
- /**
- * Class to encapsulate lock file
- */
- class LockFile
- {
- public:
- /**
- * Constructor. open lock file
- */
- LockFile(const std::string filename);
-
- /**
- * Close lock file
- */
- ~LockFile();
-
- /**
- * Grab an exclusive lock on this file
- * @return true if the lock succeeded, false if it failed
- */
- bool Lock();
-
- /**
- * Remove the lock
- */
- void Unlock();
-
- /**
- * Test if there is an error with the lock file, and clears
- * the error flag;
- * @return true if an error was thrown
- */
- bool RetrieveAndClearErrorStatus();
-
- private:
- std::string mFilename;
- int mFileDescriptor;
- bool mErrorThrown;
- };
-
- /**
- * Class to ensure lock/unlock through object destruction
- */
- class ScopedLock
- {
- public:
- /**
- * Constructor - creates a lock on the lockfile
- * @param[in] lockFile The lockfile to use
- */
- ScopedLock( LockFile* lockFile );
-
- /**
- * Destructor - removes the lock (if any) on the lockfile
- */
- ~ScopedLock();
-
- /**
- * Method to test if the locking succeeded
- * @return TRUE if locked
- */
- bool IsLocked();
-
- private:
- LockFile* mLockFile; ///< The lock file to use
- bool mLocked; ///< Whether the lock succeeded
- };
-
-
-public: // Dali::Internal::Adaptor::IndicicatorInterface
- /**
- * @copydoc Dali::Internal::IndicatorInterface::IndicatorInterface
- */
- IndicatorEcoreWl( Adaptor* adaptor,
- Dali::Window::WindowOrientation orientation,
- IndicatorInterface::Observer* observer );
-
- /**
- * @copydoc Dali::Internal::IndicatorInterface::~IndicatorInterface
- */
- virtual ~IndicatorEcoreWl();
-
-
- /**
- * @copydoc Dali::Internal::IndicatorInterface::SetAdaptor
- */
- virtual void SetAdaptor(Adaptor* adaptor);
-
- /**
- * @copydoc Dali::Internal::IndicatorInterface::GetActor
- */
- virtual Dali::Actor GetActor();
-
- /**
- * @copydoc Dali::Internal::IndicatorInterface::Open
- */
- virtual void Open( Dali::Window::WindowOrientation orientation );
-
- /**
- * @copydoc Dali::Internal::IndicatorInterface::Close
- */
- virtual void Close();
-
- /**
- * @copydoc Dali::Internal::IndicatorInterface::Flicked
- */
- virtual void Flicked() override;
-
- /**
- * @copydoc Dali::Internal::IndicatorInterface::SetOpacityMode
- */
- virtual void SetOpacityMode( Dali::Window::IndicatorBgOpacity mode );
-
- /**
- * @copydoc Dali::Internal::IndicatorInterface::SetVisible
- */
- virtual void SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool forceUpdate = false );
-
- /**
- * @copydoc Dali::Internal::IndicatorInterface::IsConnected
- */
- virtual bool IsConnected();
-
- /**
- * @copydoc Dali::Internal::IndicatorInterface::SendMessage
- */
- virtual bool SendMessage( int messageDomain, int messageId, const void *data, int size );
-
-private:
- /**
- * Initialize the indicator actors
- */
- void Initialize();
-
- /**
- * Constructs the renderers used for the background
- */
- Dali::Geometry CreateBackgroundGeometry();
-
- /**
- * Set the texture to be rendered as indicator foreground
- * @param[in] texture The foreground texture.
- */
- void SetForegroundImage( Dali::Texture texture );
-
- /**
- * Touch event callback.
- * It should pass the valid touch event to indicator server
- *
- * @param[in] indicator The indicator actor that was touched
- * @param[in] touchEvent The touch data
- */
- bool OnTouch(Dali::Actor indicator, const Dali::TouchData& touchData);
-
- /**
- * Pan gesture callback.
- * It finds flick down gesture to show hidden indicator image
- *
- * @param[in] actor The actor for gesture
- * @param[in] gesture The gesture event
- */
- void OnPan( Dali::Actor actor, const Dali::PanGesture& gesture );
-
- /**
- * Touch event callback on stage.
- * If stage is touched, hide showing indicator image
- *
- * @param[in] touchEvent The touch data
- */
- void OnStageTouch(const Dali::TouchData& touchData);
-
- /**
- * Connect to the indicator service
- */
- bool Connect();
-
- /**
- * Start the reconnection timer. This will run every second until we reconnect to
- * the indicator service.
- */
- void StartReconnectionTimer();
-
- /**
- * If connection failed, attempt to re-connect every second
- */
- bool OnReconnectTimer();
-
- /**
- * Disconnect from the indicator service
- */
- void Disconnect();
-
- /**
- * Handle Resize event
- * @param[in] width The new width
- * @param[in] height The new height
- */
- void Resize( int width, int height );
-
- /**
- * Set the lock file info.
- * @param[in] epcEvent Current ecore event.
- */
- void SetLockFileInfo( Ecore_Ipc_Event_Server_Data *epcEvent );
-
- /**
- * Set the shared indicator image info
- * @param[in] epcEvent The event containing the image data
- */
- void SetSharedImageInfo( Ecore_Ipc_Event_Server_Data *epcEvent );
-
- /**
- * Load the shared indicator image
- * @param[in] epcEvent The event containing the image data
- */
- void LoadSharedImage( 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
- */
- void UpdateImageData( int bufferNumber );
-
- /**
- * Lock the temporary file, Copy the shared image into IndicatorBuffer
- * and then unlock the temporary file.
- * Caller should ensure we are not writing image to gl texture.
- * @param[in] bufferNumber The shared file number
- */
- bool CopyToBuffer( int bufferNumber );
-
- /**
- * Create a new image for the indicator, and set up signal handling for it.
- * @param[in] bufferNumber The shared file number
- */
- void CreateNewImage( int bufferNumber );
-
- /**
- * Indicator type has changed.
- * Inform observer
- * @param[in] type The new indicator type
- */
- void OnIndicatorTypeChanged( Type type );
-
- /**
- * Check whether the indicator could be visible or invisible
- * @return true if indicator should be shown
- */
- bool CheckVisibleState();
-
- /**
- * Show/Hide indicator actor with effect
- * @param[in] duration how long need to show the indicator,
- * if it equal to 0, hide the indicator
- * if it less than 0, show always
- */
- void ShowIndicator( float duration );
-
- /**
- * Showing timer callback
- */
- bool OnShowTimer();
-
- /**
- * Showing animation finished callback
- * @param[in] animation
- */
- void OnAnimationFinished( Dali::Animation& animation );
-
-private: // Implementation of ServerConnection::Observer
- /**
- * @copydoc Dali::Internal::Adaptor::ServerConnection::Observer::DataReceived()
- */
- virtual void DataReceived( void* event );
-
- /**
- * @copydoc Dali::Internal::Adaptor::ServerConnection::Observer::DataReceived()
- */
- virtual void ConnectionClosed();
-
-private:
-
- /**
- * Clear shared file info
- */
- void ClearSharedFileInfo();
-
-private:
-
- struct SharedFileInfo
- {
- SharedFileInfo()
- : mLock( NULL ),
- mSharedFile( NULL ),
- mImageWidth( 0 ),
- mImageHeight( 0 ),
- mLockFileName(),
- mSharedFileName(),
- mSharedFileID( 0 ),
- mSharedFileNumber( 0 )
- {
- }
-
- LockFile* mLock; ///< File lock for the shared file
- SharedFile* mSharedFile; ///< Shared file
-
- int mImageWidth; ///< Shared image width
- int mImageHeight; ///< Shared image height
-
- std::string mLockFileName; ///< Lock file name
- std::string mSharedFileName; ///< Shared file name
- int mSharedFileID; ///< Shared file ID
- int mSharedFileNumber; ///< Shared file number
- };
-
- static const int SHARED_FILE_NUMBER = 2; ///< Shared file number
-
- Dali::Geometry mTranslucentGeometry; ///< Geometry used for rendering the translucent background
- Dali::Geometry mSolidGeometry; ///< Geometry used for rendering the opaque background
- Dali::Shader mBackgroundShader; ///< Shader used for rendering the background
-
- IndicatorBufferPtr mIndicatorBuffer; ///< class which handles indicator rendering
- Dali::Renderer mForegroundRenderer; ///< Renderer renders the indicator foreground
- Dali::Renderer mBackgroundRenderer; ///< Renderer renders the indicator background
-
- Dali::Actor mIndicatorContentActor; ///< Actor container for image and background
- Dali::Actor mIndicatorActor; ///< Handle to topmost indicator actor
- Dali::Actor mEventActor; ///< Handle to event
- Dali::PanGestureDetector mPanDetector; ///< Pan detector to find flick gesture for hidden indicator
-
- Dali::Timer mReconnectTimer; ///< Reconnection timer
- SlotDelegate< IndicatorEcoreWl > mConnection;
-
- Dali::Window::IndicatorBgOpacity mOpacityMode; ///< Opacity enum for background
- IndicatorEcoreWl::State mState; ///< The connection state
-
- Adaptor* mAdaptor;
- ServerConnection* mServerConnection;
- IndicatorInterface::Observer* mObserver; ///< Upload observer
-
- Dali::Window::WindowOrientation mOrientation;
- int mImageWidth;
- int mImageHeight;
- Dali::Window::IndicatorVisibleMode mVisible; ///< Whether the indicator is visible
-
- Dali::Timer mShowTimer; ///< Timer to show indicator
- bool mIsShowing; ///< Whether the indicator is showing on the screen
- Dali::Animation mIndicatorAnimation; ///< Animation to show/hide indicator image
-
- bool mIsAnimationPlaying; ///< Whether the animation is playing
-
- int mCurrentSharedFile; ///< Current shared file number
- SharedFileInfo mSharedFileInfo[SHARED_FILE_NUMBER]; ///< Table to store shared file info
-
- bool mBackgroundVisible; ///< Indicate whether background is visible
-};
-
-} // Adaptor
-} // Internal
-} // Dali
-
-#endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_INDICATOR_IMPL_ECORE_WL_H
ecore_x_window_move_resize( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
}
-void WindowBaseEcoreX::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode )
-{
- DALI_LOG_TRACE_METHOD_FMT( gWindowBaseLogFilter, "visible : %d\n", visibleMode );
-
- if( visibleMode == Dali::Window::VISIBLE )
- {
- // when the indicator is visible, set proper mode for indicator server according to bg mode
- if( opacityMode == Dali::Window::OPAQUE )
- {
- ecore_x_e_illume_indicator_opacity_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_OPAQUE );
- }
- else if( opacityMode == Dali::Window::TRANSLUCENT )
- {
- ecore_x_e_illume_indicator_opacity_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT );
- }
- }
- else
- {
- // when the indicator is not visible, set TRANSPARENT mode for indicator server
- ecore_x_e_illume_indicator_opacity_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_TRANSPARENT ); // it means hidden indicator
- }
-}
-
-void WindowBaseEcoreX::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
-{
- int show_state = static_cast< int >( isShow );
- ecore_x_window_prop_property_set( mEcoreWindow, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
- ECORE_X_ATOM_CARDINAL, 32, &show_state, 1 );
-
- if( isShow )
- {
- ecore_x_e_illume_indicator_state_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_STATE_ON );
- }
- else
- {
- ecore_x_e_illume_indicator_state_set( mEcoreWindow, ECORE_X_ILLUME_INDICATOR_STATE_OFF );
- }
-}
-
-void WindowBaseEcoreX::IndicatorTypeChanged( IndicatorInterface::Type type )
-{
-}
-
void WindowBaseEcoreX::SetClass( const std::string& name, const std::string& className )
{
ecore_x_icccm_title_set( mEcoreWindow, name.c_str() );
*/
virtual void MoveResize( PositionSize positionSize ) override;
- /**
- * @copydoc Dali::Internal::Adaptor::WindowBase::ShowIndicator()
- */
- virtual void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode ) override;
-
- /**
- * @copydoc Dali::Internal::Adaptor::WindowBase::SetIndicatorProperties()
- */
- virtual void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ) override;
-
- /**
- * @copydoc Dali::Internal::Adaptor::WindowBase::IndicatorTypeChanged()
- */
- virtual void IndicatorTypeChanged( IndicatorInterface::Type type ) override;
-
/**
* @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
*/
return Utils::MakeUnique< WindowBaseEcoreX >( positionSize, surface, isTransparent );
}
-std::unique_ptr< IndicatorInterface > WindowFactoryEcoreX::CreateIndicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer )
-{
- return std::unique_ptr< IndicatorInterface >( nullptr );
-}
-
// this should be created from Window impl
std::unique_ptr< WindowFactory > GetWindowFactory()
{
{
public:
std::unique_ptr< WindowBase > CreateWindowBase( Dali::PositionSize positionSize, Any surface, bool isTransparent ) override;
-
- std::unique_ptr< IndicatorInterface > CreateIndicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer ) override;
};
} // namespace Adaptor
void Window::ShowIndicator( IndicatorVisibleMode visibleMode )
{
+ DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ShowIndicator is deprecated and will be removed from next release.\n" );
+
GetImplementation(*this).ShowIndicator( visibleMode );
}
Window::IndicatorSignalType& Window::IndicatorVisibilityChangedSignal()
{
+ DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: IndicatorVisibilityChangedSignal is deprecated and will be removed from next release.\n" );
+
return GetImplementation(*this).IndicatorVisibilityChangedSignal();
}
void Window::SetIndicatorBgOpacity( IndicatorBgOpacity opacity )
{
+ DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: SetIndicatorBgOpacity is deprecated and will be removed from next release.\n" );
+
GetImplementation(*this).SetIndicatorBgOpacity( opacity );
}
void Window::RotateIndicator( WindowOrientation orientation )
{
+ DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: RotateIndicator is deprecated and will be removed from next release.\n" );
+
GetImplementation(*this).RotateIndicator( orientation );
}
typedef Uint16Pair WindowSize; ///< Window size type @SINCE_1_2.60
typedef Uint16Pair WindowPosition; ///< Window position type @SINCE_1_2.60
- typedef Signal< void (bool) > IndicatorSignalType; ///< Indicator state signal type @SINCE_1_0.0
+ typedef Signal< void (bool) > IndicatorSignalType; ///< @DEPRECATED_1_4.9 @brief Indicator state signal type @SINCE_1_0.0
typedef Signal< void (bool) > FocusSignalType; ///< Window focus signal type @SINCE_1_2.60
typedef Signal< void (WindowSize) > ResizedSignalType; ///< Window resized signal type @SINCE_1_2.60
};
/**
+ * @DEPRECATED_1_4.9
* @brief Enumeration for opacity of the indicator.
* @SINCE_1_0.0
*/
enum IndicatorBgOpacity
{
- OPAQUE = 100, ///< Fully opaque indicator Bg @SINCE_1_0.0
- TRANSLUCENT = 50, ///< Semi translucent indicator Bg @SINCE_1_0.0
- TRANSPARENT = 0 ///< Fully transparent indicator Bg @SINCE_1_0.0
+ OPAQUE = 100, ///< @DEPRECATED_1_4.9 @brief Fully opaque indicator Bg @SINCE_1_0.0
+ TRANSLUCENT = 50, ///< @DEPRECATED_1_4.9 @brief Semi translucent indicator Bg @SINCE_1_0.0
+ TRANSPARENT = 0 ///< @DEPRECATED_1_4.9 @brief Fully transparent indicator Bg @SINCE_1_0.0
};
/**
+ * @DEPRECATED_1_4.9
* @brief Enumeration for visible mode of the indicator.
* @SINCE_1_0.0
*/
enum IndicatorVisibleMode
{
- INVISIBLE = 0, ///< Hide indicator @SINCE_1_0.0
- VISIBLE = 1, ///< Show indicator @SINCE_1_0.0
- AUTO = 2 ///< Hide in default, will show when necessary @SINCE_1_0.0
+ INVISIBLE = 0, ///< @DEPRECATED_1_4.9 @brief Hide indicator @SINCE_1_0.0
+ VISIBLE = 1, ///< @DEPRECATED_1_4.9 @brief Show indicator @SINCE_1_0.0
+ AUTO = 2 ///< @DEPRECATED_1_4.9 @brief Hide in default, will show when necessary @SINCE_1_0.0
};
/**
Window& operator=(const Window& rhs);
/**
+ * @DEPRECATED_1_4.9
* @brief This sets whether the indicator bar should be shown or not.
* @SINCE_1_0.0
* @param[in] visibleMode Visible mode for indicator bar, VISIBLE in default
*/
- void ShowIndicator( IndicatorVisibleMode visibleMode );
+ void ShowIndicator( IndicatorVisibleMode visibleMode ) DALI_DEPRECATED_API;
/**
+ * @DEPRECATED_1_4.9
* @brief This sets the opacity mode of indicator bar.
* @SINCE_1_0.0
* @param[in] opacity The opacity mode
*/
- void SetIndicatorBgOpacity( IndicatorBgOpacity opacity );
+ void SetIndicatorBgOpacity( IndicatorBgOpacity opacity ) DALI_DEPRECATED_API;
/**
+ * @DEPRECATED_1_4.9
* @brief This sets the orientation of indicator bar.
*
* It does not implicitly show the indicator if it is currently hidden.
* @SINCE_1_0.0
* @param[in] orientation The orientation
*/
- void RotateIndicator(WindowOrientation orientation);
+ void RotateIndicator(WindowOrientation orientation) DALI_DEPRECATED_API;
/**
* @brief Sets the window name and class string.
public: // Signals
/**
+ * @DEPRECATED_1_4.9
* @brief The user should connect to this signal to get a timing when indicator was shown / hidden.
* @SINCE_1_0.0
* @return The signal to connect to
*/
- IndicatorSignalType& IndicatorVisibilityChangedSignal();
+ IndicatorSignalType& IndicatorVisibilityChangedSignal() DALI_DEPRECATED_API;
/**
* @brief The user should connect to this signal to get a timing when window gains focus or loses focus.