Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / ecore-wl2 / window-base-ecore-wl2.cpp
old mode 100644 (file)
new mode 100755 (executable)
index a4306c7..5ae9032
 
 // EXTERNAL_HEADERS
 #include <dali/public-api/object/any.h>
+#include <dali/public-api/events/mouse-button.h>
 #include <dali/integration-api/debug.h>
 #include <Ecore_Input.h>
 #include <vconf.h>
 #include <vconf-keys.h>
+#include <wayland-egl-tizen.h>
 
 namespace Dali
 {
@@ -605,7 +607,9 @@ WindowBaseEcoreWl2::WindowBaseEcoreWl2( Dali::PositionSize positionSize, Any sur
   mBrightness( 0 ),
   mBrightnessChangeState( 0 ),
   mBrightnessChangeDone( true ),
-  mOwnSurface( false )
+  mOwnSurface( false ),
+  mMoveResizeSerial( 0 ),
+  mLastSubmittedMoveResizeSerial( 0 )
 #ifdef DALI_ELDBUS_AVAILABLE
   , mSystemConnection( NULL )
 #endif
@@ -863,22 +867,25 @@ void WindowBaseEcoreWl2::OnMouseButtonDown( void* data, int type, void* event )
 
   if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
   {
-    PointState::Type state ( PointState::DOWN );
-
-    // Check if the buttons field is set and ensure it's the primary touch button.
-    // If this event was triggered by buttons other than the primary button (used for touch), then
-    // just send an interrupted event to Core.
-    if( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) )
-    {
-      state = PointState::INTERRUPTED;
-    }
-
     Device::Class::Type deviceClass;
     Device::Subclass::Type deviceSubclass;
 
     GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
     GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
 
+    PointState::Type state ( PointState::DOWN );
+
+    if( deviceClass != Device::Class::Type::MOUSE )
+    {
+      // Check if the buttons field is set and ensure it's the primary touch button.
+      // If this event was triggered by buttons other than the primary button (used for touch), then
+      // just send an interrupted event to Core.
+      if( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) )
+      {
+        state = PointState::INTERRUPTED;
+      }
+    }
+
     Integration::Point point;
     point.SetDeviceId( touchEvent->multi.device );
     point.SetState( state );
@@ -888,6 +895,7 @@ void WindowBaseEcoreWl2::OnMouseButtonDown( void* data, int type, void* event )
     point.SetAngle( Degree( touchEvent->multi.angle ) );
     point.SetDeviceClass( deviceClass );
     point.SetDeviceSubclass( deviceSubclass );
+    point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
 
     mTouchEventSignal.Emit( point, touchEvent->timestamp );
   }
@@ -914,6 +922,7 @@ void WindowBaseEcoreWl2::OnMouseButtonUp( void* data, int type, void* event )
     point.SetAngle( Degree( touchEvent->multi.angle ) );
     point.SetDeviceClass( deviceClass );
     point.SetDeviceSubclass( deviceSubclass );
+    point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) );
 
     mTouchEventSignal.Emit( point, touchEvent->timestamp );
   }
@@ -1326,6 +1335,13 @@ void WindowBaseEcoreWl2::SetEglWindowTransform( int angle )
 void WindowBaseEcoreWl2::ResizeEglWindow( PositionSize positionSize )
 {
   wl_egl_window_resize( mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y );
+
+  // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
+  if( mMoveResizeSerial != mLastSubmittedMoveResizeSerial )
+  {
+    wl_egl_window_tizen_set_window_serial( mEglWindow, mMoveResizeSerial );
+    mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
+  }
 }
 
 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
@@ -1342,7 +1358,7 @@ bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
 
 void WindowBaseEcoreWl2::Move( PositionSize positionSize )
 {
-  ecore_wl2_window_geometry_set( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
+  ecore_wl2_window_position_set( mEcoreWindow, positionSize.x, positionSize.y );
 }
 
 void WindowBaseEcoreWl2::Resize( PositionSize positionSize )
@@ -1352,7 +1368,7 @@ void WindowBaseEcoreWl2::Resize( PositionSize positionSize )
 
 void WindowBaseEcoreWl2::MoveResize( PositionSize positionSize )
 {
-  ecore_wl2_window_geometry_set( mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
+  ecore_wl2_window_sync_geometry_set( mEcoreWindow, ++mMoveResizeSerial, positionSize.x, positionSize.y, positionSize.width, positionSize.height );
 }
 
 void WindowBaseEcoreWl2::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode )
@@ -2141,10 +2157,6 @@ void WindowBaseEcoreWl2::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiV
   dpiVertical   = int( yres + 0.5f );
 }
 
-void WindowBaseEcoreWl2::SetViewMode( ViewMode viewMode )
-{
-}
-
 int WindowBaseEcoreWl2::GetScreenRotationAngle()
 {
   int transform = 0;