Indicator synchronization patch 18/81818/8
authorPaul Wisbey <p.wisbey@samsung.com>
Thu, 28 Jul 2016 12:13:32 +0000 (13:13 +0100)
committerPaul Wisbey <p.wisbey@samsung.com>
Thu, 4 Aug 2016 12:57:33 +0000 (05:57 -0700)
This contains the (indicator related) changes from the following patches:

Author: Jonghyun Ho <jonghyun.ho@samsung.com>
Date:   Wed Jul 27 16:22:29 2016 +0900
    OP_SHOW event is sent when indicator is set to visible

Author: Jonghyun Ho <jonghyun.ho@samsung.com>
Date:   Thu Jun 30 19:10:57 2016 +0900
    Hide indicator if quick panel is open

Author: Sungyeon,woo <s.woo@samsung.com>
Date:   Fri Jul 1 14:02:27 2016 +0900
    Fixed not to handle OP_UPDATE and OP_UPDATE_DONE message

Author: dongsug.song <dongsug.song@samsung.com>
Date:   Fri Jun 17 18:16:59 2016 +0900
    send indicator visibility changed signal at everytime

Author: Jonghyun Ho <jonghyun.ho@samsung.com>
Date:   Tue Mar 22 16:15:16 2016 +0900
    Add CheckVisibleState condition for exception case

Author: Jonghyun Ho <jonghyun.ho@samsung.com>
Date:   Wed Mar 16 17:25:59 2016 +0900
    Fixed indicator not to be hidden when touch point comes up inside

Author: Jonghyun Ho <jonghyun.ho@samsung.com>
Date:   Wed Jul 15 22:11:28 2015 +0900
    Add pixmap handler of indicator as an IPC interface

Author: daemyung jang <dm86.jang@samsung.com>
Date:   Wed Oct 21 12:41:53 2015 +0900
    Clear the indicator animation before Animation is played.

Author: Heeyong Song <heeyong.song@samsung.com>
Date:   Mon Sep 14 16:44:49 2015 +0900
    Change PixmapImage to NativeImageSource

Author: Jonghyun Ho <jonghyun.ho@samsung.com>
Date:   Tue Sep 1 18:52:13 2015 +0900
    Fix the issue "Unable to scroll notification bar in homescreen while sending email"

Change-Id: Id4d9c951d83783dd435bff5bbaf4517dd7e6e2ac

adaptors/ecore/common/ecore-indicator-impl.cpp
adaptors/ecore/common/ecore-indicator-impl.h

index a57aaa6..fb60098 100644 (file)
@@ -21,6 +21,9 @@
 // EXTERNAL INCLUDES
 #include <Ecore.h>
 #include <Evas.h>
+#ifndef WAYLAND
+#include <Ecore_X.h>
+#endif
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -148,6 +151,8 @@ const char* INDICATOR_SERVICE_NAME("elm_indicator");
 
 // Copied from ecore_evas_extn_engine.h
 
+#define NBUF 2
+
 enum // opcodes
 {
    OP_RESIZE,
@@ -175,7 +180,8 @@ enum // opcodes
    OP_EV_KEY_DOWN,
    OP_EV_HOLD,
    OP_MSG_PARENT,
-   OP_MSG
+   OP_MSG,
+   OP_PIXMAP_REF,
 };
 
 // Copied from elm_conform.c
@@ -285,6 +291,72 @@ namespace Adaptor
 Debug::Filter* gIndicatorLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_INDICATOR");
 #endif
 
+#ifndef WAYLAND
+// Impl to hide EFL implementation.
+struct Indicator::Impl
+{
+  // Construction & Destruction
+
+  /**
+   * Constructor
+   */
+  Impl(Indicator* indicator)
+  : mIndicator(indicator),
+    mEcoreEventHandler(NULL)
+  {
+    // Register Client message events for quick panel state.
+    mEcoreEventHandler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,  EcoreEventClientMessage, this);
+  }
+
+  /**
+   * Destructor
+   */
+  ~Impl()
+  {
+    ecore_event_handler_del(mEcoreEventHandler);
+  }
+
+  /**
+   * Called when the client messages (i.e. quick panel state) are received.
+   */
+  static Eina_Bool EcoreEventClientMessage( void* data, int type, void* event )
+  {
+    Ecore_X_Event_Client_Message* clientMessageEvent((Ecore_X_Event_Client_Message*)event);
+    Indicator::Impl* indicatorImpl((Indicator::Impl*)data);
+
+    if (clientMessageEvent == NULL || indicatorImpl == NULL || indicatorImpl->mIndicator == NULL)
+    {
+      return ECORE_CALLBACK_PASS_ON;
+    }
+
+#ifndef DALI_PROFILE_UBUNTU
+    if (clientMessageEvent->message_type == ECORE_X_ATOM_E_INDICATOR_FLICK_DONE)
+    {
+      // if indicator is not showing, INDICATOR_FLICK_DONE is given
+      if( indicatorImpl->mIndicator->mVisible == Dali::Window::AUTO &&
+          !indicatorImpl->mIndicator->mIsShowing )
+      {
+        indicatorImpl->mIndicator->ShowIndicator( AUTO_INDICATOR_STAY_DURATION );
+      }
+    }
+    else if( clientMessageEvent->message_type == ECORE_X_ATOM_E_MOVE_QUICKPANEL_STATE )
+    {
+      if( indicatorImpl->mIndicator->mVisible == Dali::Window::AUTO &&
+          indicatorImpl->mIndicator->mIsShowing )
+      {
+        indicatorImpl->mIndicator->ShowIndicator( HIDE_NOW );
+      }
+    }
+#endif
+
+    return ECORE_CALLBACK_PASS_ON;
+  }
+
+  // Data
+  Indicator*           mIndicator;
+  Ecore_Event_Handler* mEcoreEventHandler;
+};
+#endif
 
 Indicator::LockFile::LockFile(const std::string filename)
 : mFilename(filename),
@@ -392,6 +464,8 @@ Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientat
   mIsShowing( true ),
   mIsAnimationPlaying( false ),
   mCurrentSharedFile( 0 ),
+  mSharedBufferType( BUFFER_TYPE_SHM ),
+  mImpl( NULL ),
   mBackgroundVisible( false )
 {
   mIndicatorContentActor = Dali::Actor::New();
@@ -429,10 +503,23 @@ Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientat
   }
   // hide the indicator by default
   mIndicatorActor.SetVisible( false );
+
+#ifndef WAYLAND
+  // create impl to handle ecore event
+  mImpl = new Impl(this);
+#endif
 }
 
 Indicator::~Indicator()
 {
+#ifndef WAYLAND
+  if(mImpl)
+  {
+    delete mImpl;
+    mImpl = NULL;
+  }
+#endif
+
   if(mEventActor)
   {
     mEventActor.TouchedSignal().Disconnect( this, &Indicator::OnTouched );
@@ -541,9 +628,22 @@ void Indicator::SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool
     {
       UpdateImageData( mCurrentSharedFile );
     }
-    if ( visibleMode != Dali::Window::INVISIBLE )
+
+    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;
@@ -814,6 +914,11 @@ void Indicator::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent )
   // epcEvent->ref_to == sys
   // epcEvent->response == buffer num
 
+  if ( mSharedBufferType != BUFFER_TYPE_SHM )
+  {
+    return ;
+  }
+
   int n = epcEvent->response;
 
   if( n >= 0 && n < SHARED_FILE_NUMBER )
@@ -858,7 +963,7 @@ void Indicator::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent )
         OnIndicatorTypeChanged( INDICATOR_TYPE_2 );
       }
 
-      SetVisible(mVisible, true);
+      SetVisible(mVisible);
     }
   }
 }
@@ -867,37 +972,33 @@ 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
+  // epcEvent->ref == pixmap id
+  // epcEvent->ref_to == type
+  // epcEvent->response == buffer num
 
-  if( ( epcEvent->data ) &&
-      (epcEvent->size >= (int)sizeof(PixmapId)) )
+  if( (epcEvent->ref > 0) && (epcEvent->ref_to > 0) )
   {
-    ClearSharedFileInfo();
+    mSharedBufferType = (BufferType)(epcEvent->ref_to);
 
-    if( (epcEvent->ref > 0) && (epcEvent->ref_to > 0) )
-    {
-      mImageWidth  = epcEvent->ref;
-      mImageHeight = epcEvent->ref_to;
+    ClearSharedFileInfo();
 
-      mPixmap = *(static_cast<PixmapId*>(epcEvent->data));
-      CreateNewPixmapImage();
+    mPixmap = static_cast<PixmapId>(epcEvent->ref);
+    DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "mPixmap [%x]", mPixmap);
 
-      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 );
-      }
+    CreateNewPixmapImage();
 
-      SetVisible(mVisible, true);
+    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 );
     }
+
+    SetVisible(mVisible);
   }
 }
 
@@ -1174,7 +1275,7 @@ void Indicator::DataReceived( void* event )
       DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_UPDATE\n" );
       if( mIsShowing )
       {
-        mAdaptor->RequestUpdateOnce();
+        //mAdaptor->RequestUpdateOnce();
       }
       break;
     }
@@ -1182,7 +1283,7 @@ void Indicator::DataReceived( void* event )
     {
       DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_UPDATE_DONE [%d]\n", epcEvent->response );
       // epcEvent->response == display buffer #
-      UpdateImageData( epcEvent->response );
+      //UpdateImageData( epcEvent->response );
       break;
     }
     case OP_SHM_REF0:
@@ -1203,6 +1304,12 @@ void Indicator::DataReceived( void* event )
       LoadSharedImage( epcEvent );
       break;
     }
+    case OP_PIXMAP_REF:
+    {
+      DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "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" );
@@ -1281,7 +1388,8 @@ bool Indicator::CheckVisibleState()
 {
   if( mOrientation == Dali::Window::LANDSCAPE
     || mOrientation == Dali::Window::LANDSCAPE_INVERSE
-    || (mVisible != Dali::Window::VISIBLE) )
+    || (mVisible == Dali::Window::INVISIBLE)
+    || (mVisible == Dali::Window::AUTO && !mIsShowing) )
   {
     return false;
   }
@@ -1332,6 +1440,8 @@ void Indicator::ShowIndicator(float duration)
   }
   else
   {
+    mIndicatorAnimation.Clear();
+
     if( EqualsZero(duration) )
     {
       mIndicatorAnimation.AnimateTo( Property( mIndicatorContentActor, Dali::Actor::Property::POSITION ), Vector3(0, -mImageHeight, 0), Dali::AlphaFunction::EASE_OUT );
@@ -1396,17 +1506,16 @@ void Indicator::OnAnimationFinished(Dali::Animation& animation)
 {
   mIsAnimationPlaying = false;
   // once animation is finished and indicator is hidden, take it off stage
-  if( !mIsShowing )
+  if( mObserver != NULL )
   {
-    if( mObserver != NULL )
-    {
-      mObserver->IndicatorVisibilityChanged( mIsShowing ); // is showing?
-    }
+    mObserver->IndicatorVisibilityChanged( mIsShowing ); // is showing?
   }
 }
 
 void Indicator::OnPan( Dali::Actor actor, const Dali::PanGesture& gesture )
 {
+  return ;
+
   if( mServerConnection )
   {
     switch( gesture.state )
@@ -1470,7 +1579,11 @@ void Indicator::OnStageTouched(const Dali::TouchEvent& touchEvent)
     {
       case Dali::PointState::DOWN:
       {
-        ShowIndicator( HIDE_NOW );
+        // if touch point is inside the indicator, indicator is not hidden
+        if( mImageHeight < int(touchPoint.screen.y) )
+        {
+          ShowIndicator( HIDE_NOW );
+        }
         break;
       }
 
index 801c12e..4493113 100644 (file)
@@ -62,6 +62,16 @@ public:
     CONNECTED
   };
 
+  /**
+   * copied from ecore_evas_extn_engine.h
+   */
+  enum BufferType
+  {
+    BUFFER_TYPE_SHM = 0,        ///< shared memory-based buffer backend
+    BUFFER_TYPE_DRI2_PIXMAP,    ///< dri2 pixmap-based buffer backend
+    BUFFER_TYPE_EVASGL_PIXMAP,  ///< pixmap backend for Evas GL only (DEPRECATED)
+    BUFFER_TYPE_GL_PIXMAP,      ///< double buffered GL pixmap backend
+  };
 
 protected:
   /**
@@ -424,6 +434,11 @@ private:
   int                              mCurrentSharedFile;   ///< Current shared file number
   SharedFileInfo                   mSharedFileInfo[SHARED_FILE_NUMBER];    ///< Table to store shared file info
 
+  BufferType                       mSharedBufferType;    ///< Shared buffer type which is used to render indicator
+
+  struct Impl; ///< Contains Ecore specific information
+  Impl* mImpl; ///< Created on construction and destroyed on destruction.
+
   bool                             mBackgroundVisible;   ///< Indicate whether background is visible
 };