#include <errno.h>
#include <dali/public-api/images/bitmap-image.h>
+#include <dali/public-api/adaptor-framework/common/pixmap-image.h>
#include <dali/public-api/actors/image-actor.h>
#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/events/touch-point.h>
OP_EV_KEY_DOWN,
OP_EV_HOLD,
OP_MSG_PARENT,
- OP_MSG
+ OP_MSG,
+ OP_PIXMAP_REF
};
// Copied from elm_conform.c
}
Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientation, Observer* observer )
-: mConnection( this ),
+: mPixmap( 0 ),
+ mConnection( this ),
mOpacityMode( Dali::Window::OPAQUE ),
mState( DISCONNECTED ),
mAdaptor(adaptor),
}
}
+void Indicator::LoadPixmapImage( Ecore_Ipc_Event_Server_Data *epcEvent )
+{
+ DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
+
+ // epcEvent->ref == w
+ // epcEvent->ref_to == h
+ // epcEvent->response == alpha
+ // epcEvent->data = pixmap id
+ if( ( epcEvent->data ) &&
+ (epcEvent->size >= (int)sizeof(PixmapId)) )
+ {
+ if( mSharedFile != NULL )
+ {
+ delete mSharedFile;
+ mSharedFile = NULL;
+ }
+
+ if( (epcEvent->ref > 0) && (epcEvent->ref_to > 0) )
+ {
+ mImageWidth = epcEvent->ref;
+ mImageHeight = epcEvent->ref_to;
+
+ mPixmap = *(static_cast<PixmapId*>(epcEvent->data));
+ CreateNewPixmapImage();
+
+ if( CheckVisibleState() )
+ {
+ // set default indicator type (enable the quick panel)
+ OnIndicatorTypeChanged( INDICATOR_TYPE_1 );
+ }
+ else
+ {
+ // set default indicator type (disable the quick panel)
+ OnIndicatorTypeChanged( INDICATOR_TYPE_2 );
+ }
+ }
+ }
+}
+
void Indicator::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent )
{
DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
if( mState == CONNECTED && mVisible )
{
- CopyToBuffer();
+ if(mPixmap == 0)
+ {
+ CopyToBuffer();
+ }
+ else
+ {
+ mAdaptor->RequestUpdateOnce();
+ }
}
}
}
}
+void Indicator::CreateNewPixmapImage()
+{
+ DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "W:%d H:%d\n", mImageWidth, mImageHeight );
+ Dali::PixmapImagePtr pixmapImage = Dali::PixmapImage::New(mPixmap, Dali::Adaptor::Get());
+
+ if( pixmapImage )
+ {
+ mIndicatorImageActor.SetImage( Dali::Image::New(*pixmapImage) );
+ mIndicatorImageActor.SetSize( mImageWidth, mImageHeight );
+ mIndicatorActor.SetSize( mImageWidth, mImageHeight );
+
+ SetBackground();
+ if( mBackgroundActor )
+ {
+ mBackgroundActor.SetSize( mImageWidth, mImageHeight );
+ }
+ }
+ else
+ {
+ DALI_LOG_WARNING("### Cannot create indicator image - disconnecting ###\n");
+ Disconnect();
+ if( mObserver != NULL )
+ {
+ mObserver->IndicatorClosed( this );
+ }
+ // Don't do connection in this callback - strange things happen!
+ StartReconnectionTimer();
+ }
+}
+
void Indicator::CreateNewImage()
{
DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "W:%d H:%d\n", mImageWidth, mImageHeight );
switch( epcEvent->minor )
{
case OP_UPDATE:
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_UPDATE\n" );
+ DALI_LOG_ERROR( "Indicator client received: OP_UPDATE\n" );
break;
case OP_UPDATE_DONE:
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_UPDATE_DONE\n" );
+ DALI_LOG_ERROR( "Indicator client received: OP_UPDATE_DONE\n" );
UpdateImageData();
break;
case OP_LOCK_FILE:
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_LOCK_FILE\n" );
+ DALI_LOG_ERROR( "Indicator client received: OP_LOCK_FILE\n" );
NewLockFile( epcEvent );
break;
case OP_SHM_REF:
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_SHM_REF\n" );
+ DALI_LOG_ERROR( "Indicator client received: OP_SHM_REF\n" );
LoadSharedImage( epcEvent );
break;
+ case OP_PIXMAP_REF:
+ DALI_LOG_ERROR( "Indicator client received: OP_PIXMAP_REF\n" );
+ LoadPixmapImage( epcEvent );
+ break;
+
case OP_RESIZE:
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_RESIZE\n" );
+ DALI_LOG_ERROR( "Indicator client received: OP_RESIZE\n" );
if( (epcEvent->data) && (epcEvent->size >= (int)sizeof(IpcDataResize)) )
{
{
class Adaptor;
+typedef unsigned int PixmapId;
+
/**
* The Indicator class connects to the indicator server, and gets and draws the indicator
* for the given orientation.
void LoadSharedImage(Ecore_Ipc_Event_Server_Data *epcEvent);
/**
+ * Load the pixmap indicator image
+ * @param[in] epcEvent The event containing the image data
+ */
+ void LoadPixmapImage( Ecore_Ipc_Event_Server_Data *epcEvent );
+
+ /**
* Inform dali that the indicator data has been updated.
*/
void UpdateImageData();
void CreateNewImage();
/**
+ * Create a new pixmap image for the indicator, and set up signal handling for it.
+ */
+ void CreateNewPixmapImage();
+
+ /**
* Indicator type has changed.
* Inform observer
* @param[in] type The new indicator type
private:
IndicatorBufferPtr mIndicatorBuffer; ///< class which handles indicator rendering
+ PixmapId mPixmap; ///< Pixmap including indicator content
Dali::Image mImage; ///< Image created from mIndicatorBuffer
Dali::ImageActor mIndicatorImageActor; ///< Actor created from mImage