/*
- * 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.
}
};
-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 );
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
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;
}
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() );
}
}
Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, IndicatorInterface::Observer* observer )
: mPixmap( 0 ),
+ mGestureDeltaY( 0.0f ),
mGestureDetected( false ),
mConnection( this ),
mOpacityMode( Dali::Window::OPAQUE ),
mCurrentSharedFile( 0 ),
mSharedBufferType( BUFFER_TYPE_SHM ),
mImpl( NULL ),
- mBackgroundVisible( false )
+ mBackgroundVisible( false ),
+ mTopMargin( 0 )
{
mIndicatorContentActor = Dali::Actor::New();
mIndicatorContentActor.SetParentOrigin( ParentOrigin::TOP_CENTER );
mIndicatorContentActor.RemoveRenderer( mBackgroundRenderer );
mBackgroundVisible = false;
}
+ UpdateTopMargin();
}
void Indicator::SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool forceUpdate )
}
mVisible = visibleMode;
+ UpdateTopMargin();
if( mForegroundRenderer &&
( mForegroundRenderer.GetTextures().GetTexture( 0u ) ||
mIndicatorContentActor.SetSize( mImageWidth, mImageHeight );
mIndicatorActor.SetSize( mImageWidth, mImageHeight );
mEventActor.SetSize(mImageWidth, mImageHeight);
+ UpdateTopMargin();
}
}
if( mSharedFileInfo[n].mLock->RetrieveAndClearErrorStatus() )
{
DALI_LOG_ERROR( "### Indicator error: Cannot open lock file %s ###\n", mSharedFileInfo[n].mLockFileName.c_str() );
+
+ return;
}
CreateNewImage( n );
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 ) );
}
}
}
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() )