[3.0] Modify window for rotation event and missed parts. 06/98906/2
authortaeyoon <taeyoon0.lee@samsung.com>
Mon, 21 Nov 2016 06:58:37 +0000 (15:58 +0900)
committertaeyoon <taeyoon0.lee@samsung.com>
Mon, 21 Nov 2016 07:22:35 +0000 (16:22 +0900)
Change-Id: Ie407a623274dd9482c09d677b45b43e1d75ed882

adaptors/ecore/wayland/event-handler-ecore-wl.cpp
adaptors/ecore/wayland/window-impl-ecore-wl.cpp

index 81c4a0d..1b3012d 100644 (file)
@@ -293,6 +293,9 @@ struct EventHandler::Impl
       mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, handler ) );
       mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, handler ) );
 
+      // Register Rotate event
+      mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_WL_EVENT_WINDOW_ROTATE, EcoreEventRotate, handler) );
+
       // Register Detent event
       mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_DETENT_ROTATE, EcoreEventDetent, handler) );
 
@@ -1151,6 +1154,31 @@ struct EventHandler::Impl
    }
 
   /*
+  * Called when rotate event is recevied
+  */
+  static Eina_Bool EcoreEventRotate( void* data, int type, void* event )
+  {
+    DALI_LOG_INFO( gSelectionEventLogFilter, Debug::Concise, "EcoreEventRotate\n" );
+
+    EventHandler* handler( (EventHandler*)data );
+    Ecore_Wl_Event_Window_Rotate* ev( (Ecore_Wl_Event_Window_Rotate*)event );
+
+    if( ev->win != (unsigned int)ecore_wl_window_id_get( handler->mImpl->mWindow ) )
+    {
+      return ECORE_CALLBACK_PASS_ON;
+    }
+
+    RotationEvent rotationEvent;
+    rotationEvent.angle = ev->angle;
+    rotationEvent.winResize = 0;
+    rotationEvent.width = ev->w;
+    rotationEvent.height = ev->h;
+    handler->SendRotationPrepareEvent( rotationEvent );
+
+    return ECORE_CALLBACK_PASS_ON;
+  }
+
+  /*
   * Called when detent event is recevied
   */
   static Eina_Bool EcoreEventDetent( void* data, int type, void* event )
@@ -1306,15 +1334,13 @@ void EventHandler::SendRotationPrepareEvent( const RotationEvent& event )
   if( mRotationObserver != NULL )
   {
     mRotationObserver->OnRotationPrepare( event );
+    mRotationObserver->OnRotationRequest();
   }
 }
 
 void EventHandler::SendRotationRequestEvent( )
 {
-  if( mRotationObserver != NULL )
-  {
-    mRotationObserver->OnRotationRequest( );
-  }
+  // No need to separate event into prepare and request in wayland
 }
 
 void EventHandler::FeedTouchPoint( TouchPoint& point, int timeStamp)
index 184299c..2160e4f 100644 (file)
@@ -466,14 +466,17 @@ void Window::SetIndicatorActorRotation()
 
 void Window::Raise()
 {
+  ecore_wl_window_raise( mEventHandler->mEcoreWindow );
 }
 
 void Window::Lower()
 {
+  ecore_wl_window_lower( mEventHandler->mEcoreWindow );
 }
 
 void Window::Activate()
 {
+  ecore_wl_window_activate( mEventHandler->mEcoreWindow );
 }
 
 Dali::DragAndDropDetector Window::GetDragAndDropDetector() const
@@ -565,7 +568,12 @@ void Window::RemoveAvailableOrientation(Dali::Window::WindowOrientation orientat
 
 void Window::SetAvailableOrientations(const std::vector<Dali::Window::WindowOrientation>& orientations)
 {
-  DALI_ASSERT_ALWAYS( mAvailableOrientations.size() <= 4 && "Incorrect number of available orientations" );
+  int rotations[4];
+  for( std::size_t i = 0; i < mAvailableOrientations.size(); ++i )
+  {
+    rotations[i] = static_cast< int >( mAvailableOrientations[i] );
+  }
+  ecore_wl_window_rotation_available_rotations_set( mEventHandler->mEcoreWindow, rotations, mAvailableOrientations.size() );
 }
 
 const std::vector<Dali::Window::WindowOrientation>& Window::GetAvailableOrientations()
@@ -576,6 +584,8 @@ const std::vector<Dali::Window::WindowOrientation>& Window::GetAvailableOrientat
 void Window::SetPreferredOrientation(Dali::Window::WindowOrientation orientation)
 {
   mPreferredOrientation = orientation;
+
+  ecore_wl_window_rotation_preferred_rotation_set( mEventHandler->mEcoreWindow, orientation );
 }
 
 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
@@ -585,6 +595,7 @@ Dali::Window::WindowOrientation Window::GetPreferredOrientation()
 
 void Window::RotationDone( int orientation, int width, int height )
 {
+  ecore_wl_window_rotation_change_done_send( mEventHandler->mEcoreWindow );
 }