2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "ecore-indicator-impl.h"
24 #include <Ecore_Wayland.h>
26 #include <sys/types.h>
32 #include <dali/public-api/images/native-image.h>
33 #include <dali/public-api/events/touch-event.h>
34 #include <dali/public-api/events/touch-point.h>
35 #include <dali/public-api/common/stage.h>
36 #include <dali/public-api/images/buffer-image.h>
37 #include <dali/devel-api/images/texture-set-image.h>
38 #include <dali/integration-api/debug.h>
40 #include <tbm_surface.h>
41 #include <wayland-extension/tizen-remote-surface-client-protocol.h>
42 #include <wayland-client.h>
43 #include <wayland-tbm-client.h>
46 #include <adaptor-impl.h>
47 #include <accessibility-adaptor-impl.h>
48 #include <native-image-source.h>
52 #if defined(DEBUG_ENABLED)
53 #define STATE_DEBUG_STRING(state) (state==DISCONNECTED?"DISCONNECTED":state==CONNECTED?"CONNECTED":"UNKNOWN")
59 const float SLIDING_ANIMATION_DURATION( 0.2f ); // 200 milli seconds
60 const float AUTO_INDICATOR_STAY_DURATION(3.0f); // 3 seconds
61 const float SHOWING_DISTANCE_HEIGHT_RATE(0.34f); // 20 pixels
69 const int NUM_GRADIENT_INTERVALS(5); // Number of gradient intervals
70 const float GRADIENT_ALPHA[NUM_GRADIENT_INTERVALS+1] = { 0.6f, 0.38f, 0.20f, 0.08f, 0.0f, 0.0f };
72 #define MAKE_SHADER(A)#A
74 const char* BACKGROUND_VERTEX_SHADER = MAKE_SHADER(
75 attribute mediump vec2 aPosition;
76 attribute mediump float aAlpha;
77 varying mediump float vAlpha;
78 uniform mediump mat4 uMvpMatrix;
79 uniform mediump vec3 uSize;
83 mediump vec4 vertexPosition = vec4( aPosition * uSize.xy, 0.0, 1.0 );
84 vertexPosition = uMvpMatrix * vertexPosition;
87 gl_Position = vertexPosition;
91 const char* BACKGROUND_FRAGMENT_SHADER = MAKE_SHADER(
92 uniform lowp vec4 uColor;
93 varying mediump float vAlpha;
97 gl_FragColor = uColor;
98 gl_FragColor.a *= vAlpha;
102 const char* FOREGROUND_VERTEX_SHADER = DALI_COMPOSE_SHADER(
103 attribute mediump vec2 aPosition;\n
104 varying mediump vec2 vTexCoord;\n
105 uniform mediump mat4 uMvpMatrix;\n
106 uniform mediump vec3 uSize;\n
107 uniform mediump vec4 sTextureRect;\n
111 gl_Position = uMvpMatrix * vec4(aPosition * uSize.xy, 0.0, 1.0);\n
112 vTexCoord = aPosition + vec2(0.5);\n
116 const char* FOREGROUND_FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
117 varying mediump vec2 vTexCoord;\n
118 uniform sampler2D sTexture;\n
122 gl_FragColor = texture2D( sTexture, vTexCoord );\n // the foreground does not apply actor color
126 const char* FOREGROUND_TBM_FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
127 varying mediump vec2 vTexCoord;\n
128 uniform samplerExternalOES sTexture;\n
132 gl_FragColor = texture2D( sTexture, vTexCoord );\n // the foreground does not apply actor color
136 Dali::Geometry CreateQuadGeometry()
138 Dali::Property::Map quadVertexFormat;
139 quadVertexFormat["aPosition"] = Dali::Property::VECTOR2;
140 Dali::PropertyBuffer vertexData = Dali::PropertyBuffer::New( quadVertexFormat );
142 const float halfQuadSize = .5f;
143 struct QuadVertex { Dali::Vector2 position; };
144 QuadVertex quadVertexData[4] = {
145 { Dali::Vector2(-halfQuadSize, -halfQuadSize) },
146 { Dali::Vector2(-halfQuadSize, halfQuadSize) },
147 { Dali::Vector2( halfQuadSize, -halfQuadSize) },
148 { Dali::Vector2( halfQuadSize, halfQuadSize) } };
149 vertexData.SetData(quadVertexData, 4);
151 Dali::Geometry quad = Dali::Geometry::New();
152 quad.AddVertexBuffer( vertexData );
153 quad.SetType( Dali::Geometry::TRIANGLE_STRIP );
157 const float OPAQUE_THRESHOLD(0.99f);
158 const float TRANSPARENT_THRESHOLD(0.05f);
160 // indicator service name
161 const char* INDICATOR_SERVICE_NAME("elm_indicator");
163 // Copied from ecore_evas_extn_engine.h
179 OP_PROFILE_CHANGE_REQUEST,
180 OP_PROFILE_CHANGE_DONE,
198 // Copied from elm_conform.c
200 const int MSG_DOMAIN_CONTROL_INDICATOR( 0x10001 );
201 const int MSG_ID_INDICATOR_REPEAT_EVENT( 0x10002 );
202 const int MSG_ID_INDICATOR_ROTATION( 0x10003 );
203 const int MSG_ID_INDICATOR_OPACITY( 0X1004 );
204 const int MSG_ID_INDICATOR_TYPE( 0X1005 );
205 const int MSG_ID_INDICATOR_START_ANIMATION( 0X10006 );
217 struct IpcIndicatorDataAnimation
223 struct IpcDataEvMouseUp
226 Evas_Button_Flags flags;
228 unsigned int timestamp;
229 Evas_Event_Flags event_flags;
231 IpcDataEvMouseUp(unsigned long timestamp)
233 flags(EVAS_BUTTON_NONE),
235 timestamp(static_cast<unsigned int>(timestamp)),
236 event_flags(EVAS_EVENT_FLAG_NONE)
241 struct IpcDataEvMouseDown
244 Evas_Button_Flags flags;
246 unsigned int timestamp;
247 Evas_Event_Flags event_flags;
249 IpcDataEvMouseDown(unsigned long timestamp)
251 flags(EVAS_BUTTON_NONE),
253 timestamp(static_cast<unsigned int>(timestamp)),
254 event_flags(EVAS_EVENT_FLAG_NONE)
259 struct IpcDataEvMouseMove
262 Evas_Button_Flags flags;
264 unsigned int timestamp;
265 Evas_Event_Flags event_flags;
267 IpcDataEvMouseMove(const Dali::TouchPoint& touchPoint, unsigned long timestamp)
268 : x(static_cast<Evas_Coord>(touchPoint.local.x)),
269 y(static_cast<Evas_Coord>(touchPoint.local.y)),
270 flags(EVAS_BUTTON_NONE),
272 timestamp(static_cast<unsigned int>(timestamp)),
273 event_flags(EVAS_EVENT_FLAG_NONE)
278 struct IpcDataEvMouseOut
280 unsigned int timestamp;
282 Evas_Event_Flags event_flags;
284 IpcDataEvMouseOut(unsigned long timestamp)
285 : timestamp(static_cast<unsigned int>(timestamp)),
287 event_flags(EVAS_EVENT_FLAG_NONE)
292 static void UpdateIndicatorImage( void* data, struct tizen_remote_surface* remoteSurface, struct wl_buffer* buffer, uint32_t time )
294 Dali::Internal::Adaptor::Indicator* indicator = static_cast< Dali::Internal::Adaptor::Indicator* >( data );
298 tbm_surface_h tbmSurface = static_cast< tbm_surface_h >( wl_buffer_get_user_data( buffer ) );
300 indicator->UpdateIndicatorImage( tbmSurface );
304 static void MissingIndicatorImage( void* data, struct tizen_remote_surface* surface )
308 static const struct tizen_remote_surface_listener remoteSurfaceCallback =
310 UpdateIndicatorImage,
311 MissingIndicatorImage,
314 } // anonymous namespace
323 #if defined(DEBUG_ENABLED)
324 Debug::Filter* gIndicatorLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_INDICATOR");
327 // Impl to hide EFL implementation.
329 struct Indicator::Impl
331 enum // operation mode
334 INDICATOR_STAY_WITH_DURATION
340 Impl(Indicator* indicator)
341 : mIndicator(indicator),
342 mEcoreEventHandler(NULL)
344 #if defined(DALI_PROFILE_MOBILE)
345 mEcoreEventHandler = ecore_event_handler_add(ECORE_WL_EVENT_INDICATOR_FLICK, EcoreEventIndicator, this);
346 #endif // WAYLAND && DALI_PROFILE_MOBILE
354 if ( mEcoreEventHandler )
356 ecore_event_handler_del(mEcoreEventHandler);
360 static void SetIndicatorVisibility( void* data, int operation )
362 Indicator::Impl* indicatorImpl((Indicator::Impl*)data);
364 if ( indicatorImpl == NULL || indicatorImpl->mIndicator == NULL)
368 if ( operation == INDICATOR_STAY_WITH_DURATION )
370 // if indicator is not showing, INDICATOR_FLICK_DONE is given
371 if( indicatorImpl->mIndicator->mVisible == Dali::Window::AUTO &&
372 !indicatorImpl->mIndicator->mIsShowing )
374 indicatorImpl->mIndicator->ShowIndicator( AUTO_INDICATOR_STAY_DURATION );
377 else if( operation == INDICATOR_HIDE )
379 if( indicatorImpl->mIndicator->mVisible == Dali::Window::AUTO &&
380 indicatorImpl->mIndicator->mIsShowing )
382 indicatorImpl->mIndicator->ShowIndicator( HIDE_NOW );
386 #if defined(DALI_PROFILE_MOBILE)
388 * Called when the Ecore indicator event is received.
390 static Eina_Bool EcoreEventIndicator( void* data, int type, void* event )
392 SetIndicatorVisibility( data, INDICATOR_STAY_WITH_DURATION );
393 return ECORE_CALLBACK_PASS_ON;
395 #endif // WAYLAND && DALI_PROFILE_MOBILE
398 Indicator* mIndicator;
399 Ecore_Event_Handler* mEcoreEventHandler;
402 Indicator::LockFile::LockFile(const std::string filename)
403 : mFilename(filename),
406 mFileDescriptor = open(filename.c_str(), O_RDWR);
407 if( mFileDescriptor == -1 )
411 DALI_LOG_ERROR( "### Cannot open %s for indicator lock ###\n", mFilename.c_str() );
415 Indicator::LockFile::~LockFile()
417 // Closing file descriptor also unlocks file.
418 close( mFileDescriptor );
421 bool Indicator::LockFile::Lock()
423 DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
426 if( mFileDescriptor > 0 )
428 if( lockf( mFileDescriptor, F_LOCK, 0 ) == 0 ) // Note, operation may block.
436 // file descriptor is no longer valid or not writable
439 DALI_LOG_ERROR( "### Cannot lock indicator: bad file descriptor for %s ###\n", mFilename.c_str() );
447 void Indicator::LockFile::Unlock()
449 DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
450 if( lockf( mFileDescriptor, F_ULOCK, 0 ) != 0 )
454 // file descriptor is no longer valid or not writable
457 DALI_LOG_ERROR( "### Cannot unlock indicator: bad file descriptor for %s\n", mFilename.c_str() );
462 bool Indicator::LockFile::RetrieveAndClearErrorStatus()
464 bool error = mErrorThrown;
465 mErrorThrown = false;
469 Indicator::ScopedLock::ScopedLock(LockFile* lockFile)
470 : mLockFile(lockFile),
475 mLocked = mLockFile->Lock();
479 Indicator::ScopedLock::~ScopedLock()
487 bool Indicator::ScopedLock::IsLocked()
492 Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer )
494 mGestureDetected( false ),
496 mOpacityMode( Dali::Window::OPAQUE ),
497 mState( DISCONNECTED ),
499 mServerConnection( NULL ),
500 mObserver( observer ),
501 mOrientation( orientation ),
504 mVisible( Dali::Window::INVISIBLE ),
506 mIsAnimationPlaying( false ),
507 mCurrentSharedFile( 0 ),
508 mSharedBufferType( BUFFER_TYPE_SHM ),
510 mBackgroundVisible( false ),
513 mIndicatorContentActor = Dali::Actor::New();
514 mIndicatorContentActor.SetParentOrigin( ParentOrigin::TOP_CENTER );
515 mIndicatorContentActor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
517 // Indicator image handles the touch event including "leave"
518 mIndicatorContentActor.SetLeaveRequired( true );
519 mIndicatorContentActor.TouchedSignal().Connect( this, &Indicator::OnTouched );
520 mIndicatorContentActor.SetColor( Color::BLACK );
522 mIndicatorActor = Dali::Actor::New();
523 mIndicatorActor.Add( mIndicatorContentActor );
525 // Event handler to find out flick down gesture
526 mEventActor = Dali::Actor::New();
527 mEventActor.SetParentOrigin( ParentOrigin::TOP_CENTER );
528 mEventActor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
529 mIndicatorActor.Add( mEventActor );
531 // Attach pan gesture to find flick down during hiding.
532 // It can prevent the problem that scrollview gets pan gesture even indicator area is touched,
533 // since it consumes the pan gesture in advance.
534 mPanDetector = Dali::PanGestureDetector::New();
535 mPanDetector.DetectedSignal().Connect( this, &Indicator::OnPan );
536 mPanDetector.Attach( mEventActor );
540 // register indicator to accessibility adaptor
541 Dali::AccessibilityAdaptor accessibilityAdaptor = AccessibilityAdaptor::Get();
542 if(accessibilityAdaptor)
544 AccessibilityAdaptor::GetImplementation( accessibilityAdaptor ).SetIndicator( this );
546 // hide the indicator by default
547 mIndicatorActor.SetVisible( false );
549 // create impl to handle ecore event
550 mImpl = new Impl(this);
553 Indicator::~Indicator()
563 mEventActor.TouchedSignal().Disconnect( this, &Indicator::OnTouched );
568 void Indicator::SetAdaptor(Adaptor* adaptor)
571 mIndicatorBuffer->SetAdaptor( adaptor );
574 Dali::Actor Indicator::GetActor()
576 return mIndicatorActor;
579 void Indicator::Open( Dali::Window::WindowOrientation orientation )
581 DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
583 // Calls from Window should be set up to ensure we are in a
584 // disconnected state before opening a second time.
585 DALI_ASSERT_DEBUG( mState == DISCONNECTED );
587 mOrientation = orientation;
591 // Change background visibility depending on orientation
592 if( mOrientation == Dali::Window::LANDSCAPE || mOrientation == Dali::Window::LANDSCAPE_INVERSE )
594 if( mBackgroundRenderer )
596 mIndicatorContentActor.RemoveRenderer( mBackgroundRenderer );
597 mBackgroundVisible = false;
602 SetOpacityMode( mOpacityMode );
606 void Indicator::Close()
608 DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "State: %s", STATE_DEBUG_STRING(mState) );
610 if( mState == CONNECTED )
613 if( mObserver != NULL )
615 mObserver->IndicatorClosed( this );
619 Dali::Texture emptyTexture;
620 SetForegroundImage( emptyTexture );
623 void Indicator::SetOpacityMode( Dali::Window::IndicatorBgOpacity mode )
627 Dali::Geometry geometry = CreateBackgroundGeometry();
630 if( mBackgroundRenderer )
632 if( mBackgroundRenderer.GetGeometry() != geometry )
634 mBackgroundRenderer.SetGeometry( geometry );
639 if( !mBackgroundShader )
641 mBackgroundShader = Dali::Shader::New( BACKGROUND_VERTEX_SHADER, BACKGROUND_FRAGMENT_SHADER, Dali::Shader::Hint::OUTPUT_IS_TRANSPARENT );
644 mBackgroundRenderer = Dali::Renderer::New( geometry, mBackgroundShader );
647 if( !mBackgroundVisible )
649 mIndicatorContentActor.AddRenderer( mBackgroundRenderer );
650 mBackgroundVisible = true;
653 else if( mBackgroundRenderer )
655 mIndicatorContentActor.RemoveRenderer( mBackgroundRenderer );
656 mBackgroundVisible = false;
661 void Indicator::SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool forceUpdate )
663 if ( visibleMode != mVisible || forceUpdate )
665 // If we were previously hidden, then we should update the image data before we display the indicator
666 if ( mVisible == Dali::Window::INVISIBLE )
668 UpdateImageData( mCurrentSharedFile );
671 if ( visibleMode == Dali::Window::INVISIBLE )
673 if (mServerConnection)
675 mServerConnection->SendEvent( OP_HIDE, NULL, 0 );
680 mIndicatorActor.SetVisible( true );
682 if( mServerConnection )
684 mServerConnection->SendEvent( OP_SHOW, NULL, 0 );
688 mVisible = visibleMode;
691 if( mForegroundRenderer &&
692 ( mForegroundRenderer.GetTextures().GetTexture( 0u ) ||
693 Dali::TextureGetImage( mForegroundRenderer.GetTextures(), 0u ) )
696 if( CheckVisibleState() && mVisible == Dali::Window::AUTO )
699 ShowIndicator( AUTO_INDICATOR_STAY_DURATION /* stay n sec */ );
701 else if( CheckVisibleState() && mVisible == Dali::Window::VISIBLE )
704 ShowIndicator( KEEP_SHOWING );
709 ShowIndicator( HIDE_NOW );
719 bool Indicator::IsConnected()
721 return ( mState == CONNECTED );
724 bool Indicator::SendMessage( int messageDomain, int messageId, const void *data, int size )
728 return mServerConnection->SendEvent( OP_MSG, messageDomain, messageId, data, size );
736 bool Indicator::OnTouched(Dali::Actor indicator, const Dali::TouchEvent& touchEvent)
738 if( mServerConnection )
740 const TouchPoint& touchPoint = touchEvent.GetPoint( 0 );
742 // Send touch event to indicator server when indicator is showing
743 if( CheckVisibleState() || mIsShowing )
745 switch( touchPoint.state )
747 case Dali::PointState::DOWN:
749 IpcDataEvMouseMove ipcMove( touchPoint, touchEvent.time );
750 IpcDataEvMouseDown ipcDown( touchEvent.time );
751 mServerConnection->SendEvent( OP_EV_MOUSE_MOVE, &ipcMove, sizeof(ipcMove) );
752 mServerConnection->SendEvent( OP_EV_MOUSE_DOWN, &ipcDown, sizeof(ipcDown) );
754 if( mVisible == Dali::Window::AUTO )
756 // Stop hiding indicator
757 ShowIndicator( KEEP_SHOWING );
762 case Dali::PointState::MOTION:
764 IpcDataEvMouseMove ipcMove( touchPoint, touchEvent.time );
765 mServerConnection->SendEvent( OP_EV_MOUSE_MOVE, &ipcMove, sizeof(ipcMove) );
769 case Dali::PointState::UP:
770 case Dali::PointState::INTERRUPTED:
772 IpcDataEvMouseUp ipcUp( touchEvent.time );
773 mServerConnection->SendEvent( OP_EV_MOUSE_UP, &ipcUp, sizeof(ipcUp) );
775 if( mVisible == Dali::Window::AUTO )
778 ShowIndicator( 0.5f /* hide after 0.5 sec */ );
783 case Dali::TouchPoint::Leave:
785 IpcDataEvMouseMove ipcMove( touchPoint, touchEvent.time );
786 mServerConnection->SendEvent( OP_EV_MOUSE_MOVE, &ipcMove, sizeof(ipcMove) );
787 IpcDataEvMouseUp ipcOut( touchEvent.time );
788 mServerConnection->SendEvent( OP_EV_MOUSE_OUT, &ipcOut, sizeof(ipcOut) );
803 bool Indicator::Connect()
805 DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
807 DALI_ASSERT_DEBUG( mState == DISCONNECTED );
809 bool connected = false;
811 mServerConnection = new ServerConnection( INDICATOR_SERVICE_NAME, 0, false, this );
812 if( mServerConnection )
814 connected = mServerConnection->IsConnected();
817 delete mServerConnection;
818 mServerConnection = NULL;
824 StartReconnectionTimer();
834 void Indicator::StartReconnectionTimer()
836 if( ! mReconnectTimer )
838 mReconnectTimer = Dali::Timer::New(1000);
839 mConnection.DisconnectAll();
840 mReconnectTimer.TickSignal().Connect( mConnection, &Indicator::OnReconnectTimer );
842 mReconnectTimer.Start();
845 bool Indicator::OnReconnectTimer()
849 if( mState == DISCONNECTED )
860 void Indicator::Disconnect()
862 DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
864 mState = DISCONNECTED;
866 delete mServerConnection;
867 mServerConnection = NULL;
869 ClearSharedFileInfo();
872 void Indicator::Resize( int width, int height )
883 if( mImageWidth != width || mImageHeight != height )
886 mImageHeight = height;
888 mIndicatorContentActor.SetSize( mImageWidth, mImageHeight );
889 mIndicatorActor.SetSize( mImageWidth, mImageHeight );
890 mEventActor.SetSize(mImageWidth, mImageHeight);
895 void Indicator::SetLockFileInfo( Ecore_Ipc_Event_Server_Data *epcEvent )
897 DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
899 // epcEvent->ref == w
900 // epcEvent->ref_to == h
901 // epcEvent->response == buffer num
902 // epcEvent->data = lockfile + nul byte
904 if( (epcEvent->ref > 0) && (epcEvent->ref_to > 0) && (epcEvent->data) &&
905 (((unsigned char *)epcEvent->data)[epcEvent->size - 1] == 0) )
907 int n = epcEvent->response;
909 if( n >= 0 && n < SHARED_FILE_NUMBER )
911 mCurrentSharedFile = n;
913 mSharedFileInfo[n].mImageWidth = epcEvent->ref;
914 mSharedFileInfo[n].mImageHeight = epcEvent->ref_to;
916 mSharedFileInfo[n].mLockFileName.clear();
918 mSharedFileInfo[n].mLockFileName = static_cast< char* >( epcEvent->data );
920 DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "SetLockFileInfo: buffer num = %d, w = %d, h = %d, lock = %s\n",
921 n, mSharedFileInfo[n].mImageWidth, mSharedFileInfo[n].mImageHeight, mSharedFileInfo[n].mLockFileName.c_str() );
926 void Indicator::SetSharedImageInfo( Ecore_Ipc_Event_Server_Data *epcEvent )
928 DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
930 // epcEvent->ref == shm id
931 // epcEvent->ref_to == shm num
932 // epcEvent->response == buffer num
933 // epcEvent->data = shm ref string + nul byte
935 if ( (epcEvent->data) &&
936 (epcEvent->size > 0) &&
937 (((unsigned char *)epcEvent->data)[epcEvent->size - 1] == 0) )
939 int n = epcEvent->response;
941 if( n >= 0 && n < SHARED_FILE_NUMBER )
943 mCurrentSharedFile = n;
945 mSharedFileInfo[n].mSharedFileName.clear();
947 mSharedFileInfo[n].mSharedFileName = static_cast< char* >( epcEvent->data );
949 mSharedFileInfo[n].mSharedFileID = epcEvent->ref;
950 mSharedFileInfo[n].mSharedFileNumber = epcEvent->ref_to;
952 DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "SetSharedImageInfo: buffer num %d, shared file = %s, id = %d, num = %d\n",
953 n, mSharedFileInfo[n].mSharedFileName.c_str(), mSharedFileInfo[n].mSharedFileID, mSharedFileInfo[n].mSharedFileNumber );
958 void Indicator::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent )
960 DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
962 // epcEvent->ref == alpha
963 // epcEvent->ref_to == sys
964 // epcEvent->response == buffer num
966 if ( mSharedBufferType != BUFFER_TYPE_SHM )
971 int n = epcEvent->response;
973 if( n >= 0 && n < SHARED_FILE_NUMBER )
975 mCurrentSharedFile = n;
977 delete mSharedFileInfo[n].mSharedFile;
978 mSharedFileInfo[n].mSharedFile = NULL;
980 delete mSharedFileInfo[n].mLock;
981 mSharedFileInfo[n].mLock = NULL;
983 std::stringstream sharedFileID;
984 std::stringstream sharedFileNumber;
986 sharedFileID << mSharedFileInfo[n].mSharedFileID;
987 sharedFileNumber << mSharedFileInfo[n].mSharedFileNumber;
989 std::string sharedFilename = "/" + mSharedFileInfo[n].mSharedFileName + "-" + sharedFileID.str() + "." + sharedFileNumber.str();
991 DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "LoadSharedImage: file name = %s\n", sharedFilename.c_str() );
993 mSharedFileInfo[n].mSharedFile = SharedFile::New( sharedFilename.c_str(), mSharedFileInfo[n].mImageWidth * mSharedFileInfo[n].mImageWidth * 4, true );
994 if( mSharedFileInfo[n].mSharedFile != NULL )
996 mSharedFileInfo[n].mLock = new Indicator::LockFile( mSharedFileInfo[n].mLockFileName );
997 if( mSharedFileInfo[n].mLock->RetrieveAndClearErrorStatus() )
999 DALI_LOG_ERROR( "### Indicator error: Cannot open lock file %s ###\n", mSharedFileInfo[n].mLockFileName.c_str() );
1002 CreateNewImage( n );
1008 void Indicator::SetupNativeIndicatorImage( Ecore_Ipc_Event_Server_Data *epcEvent )
1010 // Bind tizen remote surface
1011 Eina_Inlist* globals;
1012 Ecore_Wl_Global* global;
1013 struct tizen_remote_surface_manager* remoteSurfaceManager = NULL;
1014 struct tizen_remote_surface* remoteSurface = NULL;
1015 struct wl_registry* registry;
1016 struct wayland_tbm_client* tbmClient;
1017 struct wl_tbm* wlTbm;
1019 if ( !remoteSurfaceManager )
1021 registry = ecore_wl_registry_get();
1022 globals = ecore_wl_globals_get();
1024 if (!registry || !globals)
1026 DALI_LOG_ERROR( "SetupNativeIndicatorImage registry or globals error\n" );
1030 EINA_INLIST_FOREACH(globals, global)
1032 if (!strcmp(global->interface, "tizen_remote_surface_manager"))
1034 remoteSurfaceManager = ( struct tizen_remote_surface_manager* )wl_registry_bind(registry, global->id, &tizen_remote_surface_manager_interface, 1);
1038 if ( !remoteSurfaceManager )
1040 DALI_LOG_ERROR( "SetupNativeIndicatorImage bind error\n" );
1044 tbmClient = ( struct wayland_tbm_client* )wayland_tbm_client_init( ecore_wl_display_get() );
1047 DALI_LOG_ERROR( "SetupNativeIndicatorImage client init error\n" );
1051 wlTbm = ( struct wl_tbm* )wayland_tbm_client_get_wl_tbm( tbmClient );
1054 DALI_LOG_ERROR( "SetupNativeIndicatorImage wl tbm error\n" );
1058 uint32_t resourceId = epcEvent->ref;
1059 remoteSurface = tizen_remote_surface_manager_create_surface( remoteSurfaceManager, resourceId, wlTbm );
1061 if( !remoteSurface )
1063 DALI_LOG_ERROR( "SetupNativeIndicatorImage create surface error\n" );
1067 tizen_remote_surface_add_listener( remoteSurface, &remoteSurfaceCallback, this );
1068 tizen_remote_surface_redirect( remoteSurface );
1069 tizen_remote_surface_transfer_visibility( remoteSurface, TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_VISIBLE);
1072 void Indicator::UpdateIndicatorImage( Any source )
1074 if( !mNativeImageSource )
1076 mNativeImageSource = Dali::NativeImageSource::New( source );
1077 Dali::NativeImage nativeImage = Dali::NativeImage::New( *mNativeImageSource );
1079 SetForegroundNativeImage( nativeImage );
1080 mIndicatorContentActor.SetSize( mImageWidth, mImageHeight );
1081 mIndicatorActor.SetSize( mImageWidth, mImageHeight );
1082 mEventActor.SetSize( mImageWidth, mImageHeight );
1088 mNativeImageSource->SetSource( source );
1089 Dali::Stage::GetCurrent().KeepRendering( 0.0f );
1092 void Indicator::UpdateTopMargin()
1094 int newMargin = (mVisible == Dali::Window::VISIBLE && mOpacityMode == Dali::Window::OPAQUE) ? mImageHeight : 0;
1095 if (mTopMargin != newMargin)
1097 mTopMargin = newMargin;
1098 mAdaptor->IndicatorSizeChanged( mTopMargin );
1102 void Indicator::UpdateVisibility()
1104 if( CheckVisibleState() )
1106 // set default indicator type (enable the quick panel)
1107 OnIndicatorTypeChanged( INDICATOR_TYPE_1 );
1111 // set default indicator type (disable the quick panel)
1112 OnIndicatorTypeChanged( INDICATOR_TYPE_2 );
1117 mIndicatorContentActor.SetPosition( 0.0f, -mImageHeight, 0.0f );
1120 SetVisible(mVisible, true);
1123 void Indicator::UpdateImageData( int bufferNumber )
1125 DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "State: %s mVisible: %s", STATE_DEBUG_STRING(mState), mVisible?"T":"F" );
1127 if( mState == CONNECTED && mVisible )
1131 // in case of shm indicator (not pixmap), not sure we can skip it when mIsShowing is false
1132 CopyToBuffer( bufferNumber );
1138 mAdaptor->RequestUpdateOnce();
1144 bool Indicator::CopyToBuffer( int bufferNumber )
1146 bool success = false;
1148 if( mSharedFileInfo[bufferNumber].mLock )
1150 Indicator::ScopedLock scopedLock(mSharedFileInfo[bufferNumber].mLock);
1151 if( mSharedFileInfo[bufferNumber].mLock->RetrieveAndClearErrorStatus() )
1155 else if( scopedLock.IsLocked() )
1157 unsigned char *src = mSharedFileInfo[bufferNumber].mSharedFile->GetAddress();
1158 size_t size = mSharedFileInfo[bufferNumber].mImageWidth * mSharedFileInfo[bufferNumber].mImageHeight * 4;
1160 if( mIndicatorBuffer->UpdatePixels( src, size ) )
1162 mAdaptor->RequestUpdateOnce();
1171 void Indicator::LoadPixmapImage( Ecore_Ipc_Event_Server_Data *epcEvent )
1175 void Indicator::CreateNewPixmapImage()
1179 void Indicator::CreateNewImage( int bufferNumber )
1181 DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "W:%d H:%d", mSharedFileInfo[bufferNumber].mImageWidth, mSharedFileInfo[bufferNumber].mImageHeight );
1182 mIndicatorBuffer = new IndicatorBuffer( mAdaptor, mSharedFileInfo[bufferNumber].mImageWidth, mSharedFileInfo[bufferNumber].mImageHeight, Pixel::BGRA8888 );
1183 bool success = false;
1185 if( CopyToBuffer( bufferNumber ) ) // Only create images if we have valid image buffer
1187 Dali::Texture texture = Dali::Texture::New( mIndicatorBuffer->GetNativeImage() );
1190 SetForegroundImage( texture );
1197 DALI_LOG_WARNING("### Cannot create indicator image - disconnecting ###\n");
1199 if( mObserver != NULL )
1201 mObserver->IndicatorClosed( this );
1203 // Don't do connection in this callback - strange things happen!
1204 StartReconnectionTimer();
1208 Dali::Geometry Indicator::CreateBackgroundGeometry()
1210 switch( mOpacityMode )
1212 case Dali::Window::TRANSLUCENT:
1213 if( !mTranslucentGeometry )
1215 // Construct 5 interval mesh
1229 struct BackgroundVertex
1235 unsigned int numVertices = 2 * ( NUM_GRADIENT_INTERVALS + 1 );
1236 BackgroundVertex vertices[ numVertices ];
1239 float delta = 1.0f / NUM_GRADIENT_INTERVALS;
1240 BackgroundVertex* currentVertex = vertices;
1241 for( int y = 0; y < NUM_GRADIENT_INTERVALS + 1; ++y, d += delta )
1243 currentVertex->mPosition = Vector2( -0.5f, d );
1244 currentVertex->mAlpha = GRADIENT_ALPHA[ y ];
1247 currentVertex->mPosition = Vector2( 0.5f, d );
1248 currentVertex->mAlpha = GRADIENT_ALPHA[ y ];
1253 unsigned int numIndices = 2 * 3 * NUM_GRADIENT_INTERVALS;
1254 unsigned short indices[ numIndices ];
1256 unsigned short* currentIndex = indices;
1257 for( int y = 0; y < NUM_GRADIENT_INTERVALS; ++y )
1259 *currentIndex++ = (2 * y);
1260 *currentIndex++ = (2 * y) + 3;
1261 *currentIndex++ = (2 * y) + 1;
1263 *currentIndex++ = (2 * y);
1264 *currentIndex++ = (2 * y) + 2;
1265 *currentIndex++ = (2 * y) + 3;
1268 Dali::Property::Map vertexFormat;
1269 vertexFormat[ "aPosition" ] = Dali::Property::VECTOR2;
1270 vertexFormat[ "aAlpha" ] = Dali::Property::FLOAT;
1271 Dali::PropertyBuffer vertexPropertyBuffer = Dali::PropertyBuffer::New( vertexFormat );
1272 vertexPropertyBuffer.SetData( vertices, numVertices );
1274 // Create the geometry object
1275 mTranslucentGeometry = Dali::Geometry::New();
1276 mTranslucentGeometry.AddVertexBuffer( vertexPropertyBuffer );
1277 mTranslucentGeometry.SetIndexBuffer( &indices[0], numIndices );
1280 return mTranslucentGeometry;
1281 case Dali::Window::OPAQUE:
1283 if( !mSolidGeometry )
1286 struct BackgroundVertex
1292 BackgroundVertex vertices[ 4 ] = { { Vector2( -0.5f, -0.5f ), 1.0f }, { Vector2( 0.5f, -0.5f ), 1.0f },
1293 { Vector2( -0.5f, 0.5f ), 1.0f }, { Vector2( 0.5f, 0.5f ), 1.0f } };
1296 unsigned short indices[ 6 ] = { 0, 3, 1, 0, 2, 3 };
1298 Dali::Property::Map vertexFormat;
1299 vertexFormat[ "aPosition" ] = Dali::Property::VECTOR2;
1300 vertexFormat[ "aAlpha" ] = Dali::Property::FLOAT;
1301 Dali::PropertyBuffer vertexPropertyBuffer = Dali::PropertyBuffer::New( vertexFormat );
1302 vertexPropertyBuffer.SetData( vertices, 4 );
1305 // Create the geometry object
1306 mSolidGeometry = Dali::Geometry::New();
1307 mSolidGeometry.AddVertexBuffer( vertexPropertyBuffer );
1308 mSolidGeometry.SetIndexBuffer( &indices[0], 6 );
1311 return mSolidGeometry;
1312 case Dali::Window::TRANSPARENT:
1316 return Dali::Geometry();
1319 void Indicator::SetForegroundImage( Dali::Texture texture )
1321 if( !mForegroundRenderer && texture )
1324 Dali::Shader shader = Dali::Shader::New( FOREGROUND_VERTEX_SHADER, FOREGROUND_FRAGMENT_SHADER );
1326 // Create renderer from geometry and material
1327 Dali::Geometry quad = CreateQuadGeometry();
1328 mForegroundRenderer = Dali::Renderer::New( quad, shader );
1329 // Make sure the foreground stays in front of the background
1330 mForegroundRenderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, 1.f );
1332 // Set blend function
1333 mForegroundRenderer.SetProperty( Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB, Dali::BlendFactor::ONE );
1334 mForegroundRenderer.SetProperty( Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB, Dali::BlendFactor::ONE_MINUS_SRC_ALPHA );
1335 mForegroundRenderer.SetProperty( Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA, Dali::BlendFactor::ONE );
1336 mForegroundRenderer.SetProperty( Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA, Dali::BlendFactor::ONE );
1338 // Create a texture-set and add to renderer
1340 Dali::TextureSet textureSet = Dali::TextureSet::New();
1341 textureSet.SetTexture( 0u, texture );
1342 mForegroundRenderer.SetTextures( textureSet );
1344 mIndicatorContentActor.AddRenderer( mForegroundRenderer );
1346 else if( mForegroundRenderer )
1348 Dali::TextureSet textureSet = mForegroundRenderer.GetTextures();
1349 textureSet.SetTexture( 0u, texture );
1352 if( mImageWidth == 0 && mImageHeight == 0 && texture)
1354 Resize( texture.GetWidth(), texture.GetHeight() );
1358 void Indicator::SetForegroundNativeImage( Dali::Image image )
1360 if( !mForegroundRenderer && image )
1363 std::string fragmentShader = "#extension GL_OES_EGL_image_external:require\n";
1364 fragmentShader += "\n";
1365 fragmentShader += FOREGROUND_TBM_FRAGMENT_SHADER;
1368 Dali::Shader shader = Dali::Shader::New( FOREGROUND_VERTEX_SHADER, fragmentShader );
1370 // Create renderer from geometry and material
1371 Dali::Geometry quad = CreateQuadGeometry();
1372 mForegroundRenderer = Dali::Renderer::New( quad, shader );
1373 // Make sure the foreground stays in front of the background
1374 mForegroundRenderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, 1.f );
1376 // Set blend function
1377 mForegroundRenderer.SetProperty( Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB, Dali::BlendFactor::ONE );
1378 mForegroundRenderer.SetProperty( Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB, Dali::BlendFactor::ONE_MINUS_SRC_ALPHA );
1379 mForegroundRenderer.SetProperty( Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA, Dali::BlendFactor::ONE );
1380 mForegroundRenderer.SetProperty( Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA, Dali::BlendFactor::ONE );
1382 // Create a texture-set and add to renderer
1384 Dali::TextureSet textureSet = Dali::TextureSet::New();
1385 Dali::TextureSetImage( textureSet, 0u, image );
1387 mForegroundRenderer.SetTextures( textureSet );
1389 mIndicatorContentActor.AddRenderer( mForegroundRenderer );
1391 else if( mForegroundRenderer )
1393 Dali::TextureSet textureSet = mForegroundRenderer.GetTextures();
1394 Dali::TextureSetImage( textureSet, 0u, image );
1397 if( mImageWidth == 0 && mImageHeight == 0 && image )
1399 Resize( image.GetWidth(), image.GetHeight() );
1403 void Indicator::OnIndicatorTypeChanged( Type indicatorType )
1405 if( mObserver != NULL )
1407 mObserver->IndicatorTypeChanged( indicatorType );
1411 void Indicator::DataReceived( void* event )
1413 DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
1414 Ecore_Ipc_Event_Server_Data *epcEvent = static_cast<Ecore_Ipc_Event_Server_Data *>( event );
1416 switch( epcEvent->minor )
1420 DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_UPDATE\n" );
1423 mAdaptor->RequestUpdateOnce();
1427 case OP_UPDATE_DONE:
1429 DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_UPDATE_DONE [%d]\n", epcEvent->response );
1430 // epcEvent->response == display buffer #
1431 UpdateImageData( epcEvent->response );
1436 DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_SHM_REF0\n" );
1437 SetSharedImageInfo( epcEvent );
1442 DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_SHM_REF1\n" );
1443 SetLockFileInfo( epcEvent );
1448 DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_SHM_REF2\n" );
1449 LoadSharedImage( epcEvent );
1454 DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_GL_REF\n" );
1455 SetupNativeIndicatorImage( epcEvent );
1460 DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_RESIZE\n" );
1462 if( (epcEvent->data) && (epcEvent->size >= (int)sizeof(IpcDataResize)) )
1464 IpcDataResize *newSize = static_cast<IpcDataResize*>( epcEvent->data );
1465 Resize( newSize->w, newSize->h );
1471 int msgDomain = epcEvent->ref;
1472 int msgId = epcEvent->ref_to;
1474 void *msgData = NULL;
1475 int msgDataSize = 0;
1476 msgData = epcEvent->data;
1477 msgDataSize = epcEvent->size;
1479 DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_MSG_PARENT. msgDomain = %d\n", msgDomain );
1481 if( msgDomain == MSG_DOMAIN_CONTROL_INDICATOR )
1485 case MSG_ID_INDICATOR_TYPE:
1487 DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_MSG_PARENT, INDICATOR_TYPE\n" );
1488 Type* indicatorType = static_cast<Type*>( epcEvent->data );
1489 OnIndicatorTypeChanged( *indicatorType );
1493 case MSG_ID_INDICATOR_START_ANIMATION:
1495 DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: MSG_ID_INDICATOR_START_ANIMATION\n" );
1497 if (msgDataSize != (int)sizeof(IpcIndicatorDataAnimation))
1499 DALI_LOG_ERROR("Message data is incorrect\n");
1503 IpcIndicatorDataAnimation *animData = static_cast<IpcIndicatorDataAnimation*>(msgData);
1505 if(!CheckVisibleState())
1507 ShowIndicator( animData->duration /* n sec */ );
1518 void Indicator::ConnectionClosed()
1520 DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
1522 // Will get this callback if the server connection failed to start up.
1523 delete mServerConnection;
1524 mServerConnection = NULL;
1525 mState = DISCONNECTED;
1527 // Attempt to re-connect
1531 bool Indicator::CheckVisibleState()
1533 if( mOrientation == Dali::Window::LANDSCAPE
1534 || mOrientation == Dali::Window::LANDSCAPE_INVERSE
1535 || (mVisible == Dali::Window::INVISIBLE)
1536 || (mVisible == Dali::Window::AUTO && !mIsShowing) )
1544 void Indicator::ClearSharedFileInfo()
1546 for( int i = 0; i < SHARED_FILE_NUMBER; i++ )
1548 delete mSharedFileInfo[i].mLock;
1549 mSharedFileInfo[i].mLock = NULL;
1551 delete mSharedFileInfo[i].mSharedFile;
1552 mSharedFileInfo[i].mSharedFile = NULL;
1554 mSharedFileInfo[i].mLockFileName.clear();
1555 mSharedFileInfo[i].mSharedFileName.clear();
1560 * duration can be this
1564 * KEEP_SHOWING = -1,
1568 void Indicator::ShowIndicator(float duration)
1570 if( !mIndicatorAnimation )
1572 mIndicatorAnimation = Dali::Animation::New(SLIDING_ANIMATION_DURATION);
1573 mIndicatorAnimation.FinishedSignal().Connect(this, &Indicator::OnAnimationFinished);
1576 if(mIsShowing && !EqualsZero(duration))
1578 // If need to show during showing, do nothing.
1579 // In 2nd phase (below) will update timer
1581 else if(!mIsShowing && mIsAnimationPlaying && EqualsZero(duration))
1583 // If need to hide during hiding or hidden already, do nothing
1587 mIndicatorAnimation.Clear();
1589 if( EqualsZero(duration) )
1591 mIndicatorAnimation.AnimateTo( Property( mIndicatorContentActor, Dali::Actor::Property::POSITION ), Vector3(0, -mImageHeight, 0), Dali::AlphaFunction::EASE_OUT );
1595 OnIndicatorTypeChanged( INDICATOR_TYPE_2 ); // un-toucable
1599 mIndicatorAnimation.AnimateTo( Property( mIndicatorContentActor, Dali::Actor::Property::POSITION ), Vector3(0, 0, 0), Dali::AlphaFunction::EASE_OUT );
1603 OnIndicatorTypeChanged( INDICATOR_TYPE_1 ); // touchable
1606 mIndicatorAnimation.Play();
1607 mIsAnimationPlaying = true;
1614 mShowTimer = Dali::Timer::New(1000 * duration);
1615 mShowTimer.TickSignal().Connect(this, &Indicator::OnShowTimer);
1617 mShowTimer.SetInterval(1000* duration);
1620 if( mVisible == Dali::Window::AUTO )
1622 // check the stage touch
1623 Dali::Stage::GetCurrent().TouchedSignal().Connect( this, &Indicator::OnStageTouched );
1628 if(mShowTimer && mShowTimer.IsRunning())
1633 if( mVisible == Dali::Window::AUTO )
1635 // check the stage touch
1636 Dali::Stage::GetCurrent().TouchedSignal().Disconnect( this, &Indicator::OnStageTouched );
1641 bool Indicator::OnShowTimer()
1643 // after time up, hide indicator
1644 ShowIndicator( HIDE_NOW );
1649 void Indicator::OnAnimationFinished(Dali::Animation& animation)
1651 mIsAnimationPlaying = false;
1652 // once animation is finished and indicator is hidden, take it off stage
1653 if( mObserver != NULL )
1655 mObserver->IndicatorVisibilityChanged( mIsShowing ); // is showing?
1659 void Indicator::OnPan( Dali::Actor actor, const Dali::PanGesture& gesture )
1663 if( mServerConnection )
1665 switch( gesture.state )
1667 case Gesture::Started:
1669 mGestureDetected = false;
1671 // The gesture position is the current position after it has moved by the displacement.
1672 // We want to reference the original position.
1673 mGestureDeltaY = gesture.position.y - gesture.displacement.y;
1676 // No break, Fall through
1677 case Gesture::Continuing:
1679 if( mVisible == Dali::Window::AUTO && !mIsShowing )
1681 // Only take one touch point
1682 if( gesture.numberOfTouches == 1 && mGestureDetected == false )
1684 mGestureDeltaY += gesture.displacement.y;
1686 if( mGestureDeltaY >= mImageHeight * SHOWING_DISTANCE_HEIGHT_RATE )
1688 ShowIndicator( AUTO_INDICATOR_STAY_DURATION );
1689 mGestureDetected = true;
1697 case Gesture::Finished:
1698 case Gesture::Cancelled:
1700 // if indicator is showing, hide again when touching is finished (Since touch leave is activated, checking it in gesture::finish instead of touch::up)
1701 if( mVisible == Dali::Window::AUTO && mIsShowing )
1703 ShowIndicator( AUTO_INDICATOR_STAY_DURATION );
1715 void Indicator::OnStageTouched(const Dali::TouchEvent& touchEvent)
1717 const TouchPoint& touchPoint = touchEvent.GetPoint( 0 );
1719 // when stage is touched while indicator is showing temporary, hide it
1720 if( mIsShowing && ( CheckVisibleState() == false || mVisible == Dali::Window::AUTO ) )
1722 switch( touchPoint.state )
1724 case Dali::PointState::DOWN:
1726 // if touch point is inside the indicator, indicator is not hidden
1727 if( mImageHeight < int(touchPoint.screen.y) )
1729 ShowIndicator( HIDE_NOW );