Merge branch 'devel/master' into tizen 52/134852/1
authorHeeyong Song <heeyong.song@samsung.com>
Tue, 20 Jun 2017 07:00:51 +0000 (16:00 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 20 Jun 2017 07:00:55 +0000 (16:00 +0900)
Change-Id: I26fbb0c1d18d37cb12a22ebe3907e9e4bc440cd8

1  2 
adaptors/ecore/wayland/event-handler-ecore-wl.cpp

@@@ -91,83 -91,6 +91,83 @@@ const unsigned int PRIMARY_TOUCH_BUTTON
  
  const unsigned int BYTES_PER_CHARACTER_FOR_ATTRIBUTES = 3;
  
 +#ifdef DALI_ELDBUS_AVAILABLE
 +// DBus gesture string matching lists.
 +// TODO: This needs moving to its own module.
 +const char * ElDBusAccessibilityFingerCountStrings[] =
 +{
 +  "OneFinger",
 +  "TwoFingers",
 +  "ThreeFingers"
 +};
 +const unsigned int FingerCountStringsTotal = sizeof( ElDBusAccessibilityFingerCountStrings ) / sizeof( ElDBusAccessibilityFingerCountStrings[0] );
 +enum GestureType
 +{
 +  GESTURE_TYPE_NONE,
 +  GESTURE_TYPE_HOVER,
 +  GESTURE_TYPE_SINGLE_TAP,
 +  GESTURE_TYPE_DOUBLE_TAP,
 +  GESTURE_TYPE_TRIPLE_TAP
 +};
 +struct GestureTypeTable
 +{
 +  const char* name;
 +  const GestureType type;
 +};
 +GestureTypeTable ElDBusAccessibilityFullEventTypeStrings[] =
 +{
 +  { "Hover",     GESTURE_TYPE_HOVER      },
 +  { "SingleTap", GESTURE_TYPE_SINGLE_TAP },
 +  { "DoubleTap", GESTURE_TYPE_DOUBLE_TAP },
 +  { "TripleTap", GESTURE_TYPE_TRIPLE_TAP }
 +};
 +const unsigned int FullEventTypeStringsTotal = sizeof( ElDBusAccessibilityFullEventTypeStrings ) / sizeof( ElDBusAccessibilityFullEventTypeStrings[0] );
 +enum SubGestureType
 +{
 +  SUB_GESTURE_TYPE_NONE,
 +  SUB_GESTURE_TYPE_FLICK
 +};
 +struct SubGestureTypeTable
 +{
 +  const char* name;
 +  const SubGestureType type;
 +};
 +SubGestureTypeTable ElDBusAccessibilityDirectionalEventTypeStrings[] =
 +{
 +  { "Flick", SUB_GESTURE_TYPE_FLICK }
 +};
 +const unsigned int DirectionalEventTypeStringsTotal = sizeof( ElDBusAccessibilityDirectionalEventTypeStrings ) / sizeof( ElDBusAccessibilityDirectionalEventTypeStrings[0] );
 +enum GestureDirection
 +{
 +  GESTURE_DIRECTION_NONE,
 +  GESTURE_DIRECTION_UP,
 +  GESTURE_DIRECTION_DOWN,
 +  GESTURE_DIRECTION_LEFT,
 +  GESTURE_DIRECTION_RIGHT,
 +  GESTURE_DIRECTION_UP_RETURN,
 +  GESTURE_DIRECTION_DOWN_RETURN,
 +  GESTURE_DIRECTION_LEFT_RETURN,
 +  GESTURE_DIRECTION_RIGHT_RETURN
 +};
 +struct GestureDirectionTable
 +{
 +    const char* name;
 +    const GestureDirection direction;
 +};
 +GestureDirectionTable ElDBusAccessibilityDirectionStrings[] =
 +{
 +  { "Up",           GESTURE_DIRECTION_UP           },
 +  { "Down",         GESTURE_DIRECTION_DOWN         },
 +  { "Left",         GESTURE_DIRECTION_LEFT         },
 +  { "Right",        GESTURE_DIRECTION_RIGHT        },
 +  { "UpReturn",     GESTURE_DIRECTION_UP_RETURN    },
 +  { "DownReturn",   GESTURE_DIRECTION_DOWN_RETURN  },
 +  { "LeftReturn",   GESTURE_DIRECTION_LEFT_RETURN  },
 +  { "RightReturn",  GESTURE_DIRECTION_RIGHT_RETURN }
 +};
 +const unsigned int DirectionStringsTotal = sizeof( ElDBusAccessibilityDirectionStrings ) / sizeof( ElDBusAccessibilityDirectionStrings[0] );
 +#endif // DALI_ELDBUS_AVAILABLE
 +
  /**
   * Ecore_Event_Modifier enums in Ecore_Input.h do not match Ecore_IMF_Keyboard_Modifiers in Ecore_IMF.h.
   * This function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Modifiers enums.
@@@ -326,7 -249,10 +326,10 @@@ struct EventHandler::Imp
    Impl( EventHandler* handler, Ecore_Wl_Window* window )
    : mHandler( handler ),
      mEcoreEventHandler(),
-     mWindow( window )
+     mWindow( window ),
+     mRotationAngle( 0 ),
+     mWindowWidth( 0 ),
+     mWindowHeight( 0 )
  #ifdef DALI_ELDBUS_AVAILABLE
    , mSystemConnection( NULL )
  #endif // DALI_ELDBUS_AVAILABLE
      RotationEvent rotationEvent;
      rotationEvent.angle = ev->angle;
      rotationEvent.winResize = 0;
-     rotationEvent.width = ev->w;
-     rotationEvent.height = ev->h;
+     if( ev->angle == 0 || ev->angle == 180 )
+     {
+       rotationEvent.width = ev->w;
+       rotationEvent.height = ev->h;
+     }
+     else
+     {
+       rotationEvent.width = ev->h;
+       rotationEvent.height = ev->w;
+     }
      handler->SendRotationPrepareEvent( rotationEvent );
  
      return ECORE_CALLBACK_PASS_ON;
      handler->SendEvent( StyleChange::DEFAULT_FONT_SIZE_CHANGE );
    }
  
+   void ConvertTouchPosition( Integration::Point& point )
+   {
+     Vector2 position = point.GetScreenPosition();
+     Vector2 convertedPosition;
+     switch( mRotationAngle )
+     {
+       case 90:
+       {
+         convertedPosition.x = mWindowWidth - position.y;
+         convertedPosition.y = position.x;
+         break;
+       }
+       case 180:
+       {
+         convertedPosition.x = mWindowWidth - position.x;
+         convertedPosition.y = mWindowHeight - position.y;
+         break;
+       }
+       case 270:
+       {
+         convertedPosition.x = position.y;
+         convertedPosition.y = mWindowHeight - position.x;
+         break;
+       }
+       default:
+       {
+         convertedPosition = position;
+         break;
+       }
+     }
+     point.SetScreenPosition( convertedPosition );
+   }
    // Data
    EventHandler* mHandler;
    std::vector<Ecore_Event_Handler*> mEcoreEventHandler;
    Ecore_Wl_Window* mWindow;
+   int mRotationAngle;
+   int mWindowWidth;
+   int mWindowHeight;
  #ifdef DALI_ELDBUS_AVAILABLE
    Eldbus_Connection* mSystemConnection;
  #endif // DALI_ELDBUS_AVAILABLE
@@@ -1358,12 -1332,14 +1409,14 @@@ void EventHandler::SendEvent(Integratio
      timeStamp = GetCurrentMilliSeconds();
    }
  
+   mImpl->ConvertTouchPosition( point );
    Integration::TouchEvent touchEvent;
    Integration::HoverEvent hoverEvent;
    Integration::TouchEventCombiner::EventDispatchType type = mCombiner.GetNextTouchEvent(point, timeStamp, touchEvent, hoverEvent);
    if(type != Integration::TouchEventCombiner::DispatchNone )
    {
-     DALI_LOG_INFO(gTouchEventLogFilter, Debug::General, "%d: Device %d: Button state %d (%.2f, %.2f)\n", timeStamp, point.GetDeviceId(), point.GetState(), point.GetLocalPosition().x, point.GetLocalPosition().y);
+     DALI_LOG_INFO(gTouchEventLogFilter, Debug::General, "%d: Device %d: Button state %d (%.2f, %.2f)\n", timeStamp, point.GetDeviceId(), point.GetState(), point.GetScreenPosition().x, point.GetScreenPosition().y);
  
      // First the touch and/or hover event & related gesture events are queued
      if(type == Integration::TouchEventCombiner::DispatchTouch || type == Integration::TouchEventCombiner::DispatchBoth)
@@@ -1421,6 -1397,10 +1474,10 @@@ void EventHandler::SendRotationPrepareE
  {
    if( mRotationObserver != NULL )
    {
+     mImpl->mRotationAngle = event.angle;
+     mImpl->mWindowWidth = event.width;
+     mImpl->mWindowHeight = event.height;
      mRotationObserver->OnRotationPrepare( event );
      mRotationObserver->OnRotationRequest();
    }