X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Ftizen%2Fecore-indicator-impl-tizen.cpp;h=52fef7357a63a26d40b6c2b7d1ee805a54fb9924;hb=3234effdb344da5c3609099f74259446d7cd3e5d;hp=cdff69f08fffdd3b1b4ae45a9bc2c5ce27863ecb;hpb=600ba58364dfdd21c1c283cd0fa6b515e59bf015;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/tizen/ecore-indicator-impl-tizen.cpp b/adaptors/tizen/ecore-indicator-impl-tizen.cpp index cdff69f..52fef73 100644 --- a/adaptors/tizen/ecore-indicator-impl-tizen.cpp +++ b/adaptors/tizen/ecore-indicator-impl-tizen.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -289,7 +289,9 @@ struct IpcDataEvMouseOut } }; -static void UpdateIndicatorImage( void* data, struct tizen_remote_surface* remoteSurface, struct wl_buffer* buffer, uint32_t time ) +struct wl_buffer* preBuffer; + +static void OnUpdateIndicatorImage( void* data, struct tizen_remote_surface* remoteSurface, struct wl_buffer* buffer, uint32_t time ) { Dali::Internal::Adaptor::Indicator* indicator = static_cast< Dali::Internal::Adaptor::Indicator* >( data ); @@ -299,16 +301,23 @@ static void UpdateIndicatorImage( void* data, struct tizen_remote_surface* remot indicator->UpdateIndicatorImage( tbmSurface ); } + + if( preBuffer != NULL && tizen_remote_surface_get_version( remoteSurface ) >= TIZEN_REMOTE_SURFACE_RELEASE_SINCE_VERSION ) + { + tizen_remote_surface_release( remoteSurface, preBuffer ); + } + + preBuffer = buffer; } -static void MissingIndicatorImage( void* data, struct tizen_remote_surface* surface ) +static void OnMissingIndicatorImage( void* data, struct tizen_remote_surface* surface ) { } static const struct tizen_remote_surface_listener remoteSurfaceCallback = { - UpdateIndicatorImage, - MissingIndicatorImage, + OnUpdateIndicatorImage, + OnMissingIndicatorImage, }; } // anonymous namespace @@ -425,21 +434,27 @@ bool Indicator::LockFile::Lock() bool locked = false; if( mFileDescriptor > 0 ) { - if( lockf( mFileDescriptor, F_LOCK, 0 ) == 0 ) // Note, operation may block. + 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 ) { - locked = true; + mErrorThrown = true; + DALI_LOG_ERROR( "### Failed to lock with fd : %s ###\n", mFilename.c_str() ); } else { - if( errno == EBADF ) - { - // file descriptor is no longer valid or not writable - mFileDescriptor = 0; - mErrorThrown = true; - DALI_LOG_ERROR( "### Cannot lock indicator: bad file descriptor for %s ###\n", mFilename.c_str() ); - } + locked = true; } } + else + { + mErrorThrown = true; + DALI_LOG_ERROR( "### Invalid fd ###\n" ); + } return locked; } @@ -447,15 +462,17 @@ bool Indicator::LockFile::Lock() void Indicator::LockFile::Unlock() { DALI_LOG_TRACE_METHOD( gIndicatorLogFilter ); - if( lockf( mFileDescriptor, F_ULOCK, 0 ) != 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) { - if( errno == EBADF ) - { - // file descriptor is no longer valid or not writable - mFileDescriptor = 0; - mErrorThrown = true; - DALI_LOG_ERROR( "### Cannot unlock indicator: bad file descriptor for %s\n", mFilename.c_str() ); - } + mErrorThrown = true; + DALI_LOG_ERROR( "### Failed to lock with fd : %s ###\n", mFilename.c_str() ); } } @@ -491,6 +508,7 @@ bool Indicator::ScopedLock::IsLocked() Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer ) : mPixmap( 0 ), + mGestureDeltaY( 0.0f ), mGestureDetected( false ), mConnection( this ), mOpacityMode( Dali::Window::OPAQUE ), @@ -507,7 +525,8 @@ Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientat mCurrentSharedFile( 0 ), mSharedBufferType( BUFFER_TYPE_SHM ), mImpl( NULL ), - mBackgroundVisible( false ) + mBackgroundVisible( false ), + mTopMargin( 0 ) { mIndicatorContentActor = Dali::Actor::New(); mIndicatorContentActor.SetParentOrigin( ParentOrigin::TOP_CENTER ); @@ -654,6 +673,7 @@ void Indicator::SetOpacityMode( Dali::Window::IndicatorBgOpacity mode ) mIndicatorContentActor.RemoveRenderer( mBackgroundRenderer ); mBackgroundVisible = false; } + UpdateTopMargin(); } void Indicator::SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool forceUpdate ) @@ -684,6 +704,7 @@ void Indicator::SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool } mVisible = visibleMode; + UpdateTopMargin(); if( mForegroundRenderer && ( mForegroundRenderer.GetTextures().GetTexture( 0u ) || @@ -885,6 +906,7 @@ void Indicator::Resize( int width, int height ) mIndicatorContentActor.SetSize( mImageWidth, mImageHeight ); mIndicatorActor.SetSize( mImageWidth, mImageHeight ); mEventActor.SetSize(mImageWidth, mImageHeight); + UpdateTopMargin(); } } @@ -993,6 +1015,8 @@ void Indicator::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent ) if( mSharedFileInfo[n].mLock->RetrieveAndClearErrorStatus() ) { DALI_LOG_ERROR( "### Indicator error: Cannot open lock file %s ###\n", mSharedFileInfo[n].mLockFileName.c_str() ); + + return; } CreateNewImage( n ); @@ -1025,9 +1049,9 @@ void Indicator::SetupNativeIndicatorImage( Ecore_Ipc_Event_Server_Data *epcEvent EINA_INLIST_FOREACH(globals, global) { - if (!strcmp(global->interface, "tizen_remote_surface_manager")) + if ( !strcmp( global->interface, "tizen_remote_surface_manager" ) ) { - remoteSurfaceManager = ( struct tizen_remote_surface_manager* )wl_registry_bind(registry, global->id, &tizen_remote_surface_manager_interface, 1); + remoteSurfaceManager = ( struct tizen_remote_surface_manager* )wl_registry_bind( registry, global->id, &tizen_remote_surface_manager_interface, ( ( global->version < 2 )? global->version: 2 ) ); } } } @@ -1085,6 +1109,16 @@ void Indicator::UpdateIndicatorImage( Any source ) Dali::Stage::GetCurrent().KeepRendering( 0.0f ); } +void Indicator::UpdateTopMargin() +{ + int newMargin = (mVisible == Dali::Window::VISIBLE && mOpacityMode == Dali::Window::OPAQUE) ? mImageHeight : 0; + if (mTopMargin != newMargin) + { + mTopMargin = newMargin; + mAdaptor->IndicatorSizeChanged( mTopMargin ); + } +} + void Indicator::UpdateVisibility() { if( CheckVisibleState() )