Set device information for ecore event
[platform/core/uifw/dali-adaptor.git] / adaptors / ecore / wayland / event-handler-ecore-wl.cpp
index 81c4a0d..c91973f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,6 +19,9 @@
 #include <events/event-handler.h>
 
 // EXTERNAL INCLUDES
+// Ecore is littered with C style cast
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
 #include <Ecore.h>
 #include <Ecore_Input.h>
 #include <ecore-wl-render-surface.h>
@@ -44,6 +47,7 @@
 #include <dali/integration-api/events/touch-event-integ.h>
 #include <dali/integration-api/events/hover-event-integ.h>
 #include <dali/integration-api/events/wheel-event-integ.h>
+#include <dali/devel-api/events/device.h>
 
 // INTERNAL INCLUDES
 #include <events/gesture-manager.h>
@@ -68,7 +72,6 @@ namespace Adaptor
 namespace
 {
 Integration::Log::Filter* gTouchEventLogFilter  = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_TOUCH");
-Integration::Log::Filter* gClientMessageLogFilter  = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_CLIENT_MESSAGE");
 Integration::Log::Filter* gDragAndDropLogFilter = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_DND");
 Integration::Log::Filter* gImfLogging  = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_IMF");
 Integration::Log::Filter* gSelectionEventLogFilter = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_SELECTION");
@@ -80,96 +83,14 @@ namespace
 {
 
 // DBUS accessibility
-#define A11Y_BUS "org.a11y.Bus"
-#define A11Y_INTERFACE "org.a11y.Bus"
-#define A11Y_PATH "/org/a11y/bus"
-#define A11Y_GET_ADDRESS "GetAddress"
-#define BUS "com.samsung.EModule"
-#define INTERFACE "com.samsung.GestureNavigation"
-#define PATH "/com/samsung/GestureNavigation"
-#define SIGNAL "GestureDetected"
+const char* BUS = "org.enlightenment.wm-screen-reader";
+const char* INTERFACE = "org.tizen.GestureNavigation";
+const char* PATH = "/org/tizen/GestureNavigation";
 
 const unsigned int PRIMARY_TOUCH_BUTTON_ID( 1 );
 
 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.
@@ -250,6 +171,131 @@ static unsigned int GetCurrentMilliSeconds(void)
 const char * DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE = "db/setting/accessibility/font_name";  // It will be update at vconf-key.h and replaced.
 #endif // DALI_PROFILE_UBUNTU
 
+/**
+ * Get the device name from the provided ecore key event
+ */
+void GetDeviceName( Ecore_Event_Key* keyEvent, std::string& result )
+{
+  const char* ecoreDeviceName = ecore_device_name_get( keyEvent->dev );
+
+  if ( ecoreDeviceName )
+  {
+    result = ecoreDeviceName;
+  }
+}
+
+/**
+ * Get the device class from the provided ecore event
+ */
+void GetDeviceClass( Ecore_Device_Class ecoreDeviceClass, DevelDevice::Class::Type& deviceClass )
+{
+  switch( ecoreDeviceClass )
+  {
+    case ECORE_DEVICE_CLASS_SEAT:
+    {
+      deviceClass = DevelDevice::Class::USER;
+      break;
+    }
+    case ECORE_DEVICE_CLASS_KEYBOARD:
+    {
+      deviceClass = DevelDevice::Class::KEYBOARD;
+      break;
+    }
+    case ECORE_DEVICE_CLASS_MOUSE:
+    {
+      deviceClass = DevelDevice::Class::MOUSE;
+      break;
+    }
+    case ECORE_DEVICE_CLASS_TOUCH:
+    {
+      deviceClass = DevelDevice::Class::TOUCH;
+      break;
+    }
+    case ECORE_DEVICE_CLASS_PEN:
+    {
+      deviceClass = DevelDevice::Class::PEN;
+      break;
+    }
+    case ECORE_DEVICE_CLASS_POINTER:
+    {
+      deviceClass = DevelDevice::Class::POINTER;
+      break;
+    }
+    case ECORE_DEVICE_CLASS_GAMEPAD:
+    {
+      deviceClass = DevelDevice::Class::GAMEPAD;
+      break;
+    }
+    default:
+    {
+      deviceClass = DevelDevice::Class::NONE;
+      break;
+    }
+  }
+}
+
+void GetDeviceSubclass( Ecore_Device_Subclass ecoreDeviceSubclass, DevelDevice::Subclass::Type& deviceSubclass )
+{
+  switch( ecoreDeviceSubclass )
+  {
+    case ECORE_DEVICE_SUBCLASS_FINGER:
+    {
+      deviceSubclass = DevelDevice::Subclass::FINGER;
+      break;
+    }
+    case ECORE_DEVICE_SUBCLASS_FINGERNAIL:
+    {
+      deviceSubclass = DevelDevice::Subclass::FINGERNAIL;
+      break;
+    }
+    case ECORE_DEVICE_SUBCLASS_KNUCKLE:
+    {
+      deviceSubclass = DevelDevice::Subclass::KNUCKLE;
+      break;
+    }
+    case ECORE_DEVICE_SUBCLASS_PALM:
+    {
+      deviceSubclass = DevelDevice::Subclass::PALM;
+      break;
+    }
+    case ECORE_DEVICE_SUBCLASS_HAND_SIZE:
+    {
+      deviceSubclass = DevelDevice::Subclass::HAND_SIDE;
+      break;
+    }
+    case ECORE_DEVICE_SUBCLASS_HAND_FLAT:
+    {
+      deviceSubclass = DevelDevice::Subclass::HAND_FLAT;
+      break;
+    }
+    case ECORE_DEVICE_SUBCLASS_PEN_TIP:
+    {
+      deviceSubclass = DevelDevice::Subclass::PEN_TIP;
+      break;
+    }
+    case ECORE_DEVICE_SUBCLASS_TRACKPAD:
+    {
+      deviceSubclass = DevelDevice::Subclass::TRACKPAD;
+      break;
+    }
+    case ECORE_DEVICE_SUBCLASS_TRACKPOINT:
+    {
+      deviceSubclass = DevelDevice::Subclass::TRACKPOINT;
+      break;
+    }
+    case ECORE_DEVICE_SUBCLASS_TRACKBALL:
+    {
+      deviceSubclass = DevelDevice::Subclass::TRACKBALL;
+      break;
+    }
+    default:
+    {
+      deviceSubclass = DevelDevice::Subclass::NONE;
+      break;
+    }
+  }
+}
+
 } // unnamed namespace
 
 // Impl to hide EFL implementation.
@@ -263,20 +309,22 @@ struct EventHandler::Impl
   Impl( EventHandler* handler, Ecore_Wl_Window* window )
   : mHandler( handler ),
     mEcoreEventHandler(),
-    mWindow( window )
+    mWindow( window ),
+    mRotationAngle( 0 ),
+    mWindowWidth( 0 ),
+    mWindowHeight( 0 )
 #ifdef DALI_ELDBUS_AVAILABLE
-  , mSessionConnection( NULL ),
-    mA11yConnection( NULL )
-#endif
+  , mSystemConnection( NULL )
+#endif // DALI_ELDBUS_AVAILABLE
   {
     // Only register for touch and key events if we have a window
     if ( window != 0 )
     {
       // Register Touch events
-      mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN,  EcoreEventMouseButtonDown, handler ) );
-      mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP,    EcoreEventMouseButtonUp,   handler ) );
-      mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE,         EcoreEventMouseButtonMove, handler ) );
-      mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_OUT,          EcoreEventMouseButtonUp,   handler ) ); // process mouse out event like up event
+      mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_DOWN,   EcoreEventMouseButtonDown,   handler ) );
+      mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_UP,     EcoreEventMouseButtonUp,     handler ) );
+      mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_MOVE,          EcoreEventMouseButtonMove,   handler ) );
+      mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_BUTTON_CANCEL, EcoreEventMouseButtonCancel, handler ) );
 
       // Register Mouse wheel events
       mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_MOUSE_WHEEL,        EcoreEventMouseWheel,      handler ) );
@@ -293,6 +341,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) );
 
@@ -303,21 +354,13 @@ struct EventHandler::Impl
 #endif // DALI_PROFILE_UBUNTU
 
 #ifdef DALI_ELDBUS_AVAILABLE
-
       // Initialize ElDBus.
       DALI_LOG_INFO( gImfLogging, Debug::General, "Starting DBus Initialization\n" );
-      eldbus_init();
 
-      mSessionConnection = eldbus_connection_get( ELDBUS_CONNECTION_TYPE_SESSION );
-
-      Eldbus_Object *a11yObject = eldbus_object_get( mSessionConnection, A11Y_BUS, A11Y_PATH );
-      Eldbus_Proxy *elDBusManager = eldbus_proxy_get( a11yObject, A11Y_INTERFACE );
-
-      // Pass in handler in the cb_data field so we can access the accessibility adaptor within the callback.
-      eldbus_proxy_call( elDBusManager, A11Y_GET_ADDRESS, EcoreElDBusInitialisation, handler, -1, "" );
+      // Pass in handler.
+      EcoreElDBusInitialisation( handler );
 
       DALI_LOG_INFO( gImfLogging, Debug::General, "Finished DBus Initialization\n" );
-
 #endif // DALI_ELDBUS_AVAILABLE
     }
   }
@@ -338,18 +381,11 @@ struct EventHandler::Impl
     }
 
 #ifdef DALI_ELDBUS_AVAILABLE
-    // Close down ElDBus
-    if( mA11yConnection )
-    {
-      eldbus_connection_unref( mA11yConnection );
-    }
-
-    if( mSessionConnection )
+    // Close down ElDBus connections.
+    if( mSystemConnection )
     {
-      eldbus_connection_unref( mSessionConnection );
+      eldbus_connection_unref( mSystemConnection );
     }
-
-    eldbus_shutdown();
 #endif // DALI_ELDBUS_AVAILABLE
   }
 
@@ -379,6 +415,12 @@ struct EventHandler::Impl
         state = PointState::INTERRUPTED;
       }
 
+      DevelDevice::Class::Type deviceClass;
+      DevelDevice::Subclass::Type deviceSubclass;
+
+      GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
+      GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
+
       Integration::Point point;
       point.SetDeviceId( touchEvent->multi.device );
       point.SetState( state );
@@ -386,6 +428,9 @@ struct EventHandler::Impl
       point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
       point.SetPressure( touchEvent->multi.pressure );
       point.SetAngle( Degree( touchEvent->multi.angle ) );
+      point.SetDeviceClass( deviceClass );
+      point.SetDeviceSubclass( deviceSubclass );
+
       handler->SendEvent( point, touchEvent->timestamp );
     }
 
@@ -402,6 +447,12 @@ struct EventHandler::Impl
 
     if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
     {
+      DevelDevice::Class::Type deviceClass;
+      DevelDevice::Subclass::Type deviceSubclass;
+
+      GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
+      GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
+
       Integration::Point point;
       point.SetDeviceId( touchEvent->multi.device );
       point.SetState( PointState::UP );
@@ -409,6 +460,9 @@ struct EventHandler::Impl
       point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
       point.SetPressure( touchEvent->multi.pressure );
       point.SetAngle( Degree( touchEvent->multi.angle ) );
+      point.SetDeviceClass( deviceClass );
+      point.SetDeviceSubclass( deviceSubclass );
+
       handler->SendEvent( point, touchEvent->timestamp );
     }
 
@@ -416,24 +470,6 @@ struct EventHandler::Impl
   }
 
   /**
-   * Called when a touch up is received.
-   */
-  static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
-  {
-    Ecore_Event_Mouse_Wheel *mouseWheelEvent( (Ecore_Event_Mouse_Wheel*)event );
-
-    DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT Ecore_Event_Mouse_Wheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent->direction, mouseWheelEvent->modifiers, mouseWheelEvent->x, mouseWheelEvent->y, mouseWheelEvent->z);
-
-    EventHandler* handler( (EventHandler*)data );
-    if ( mouseWheelEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
-    {
-      WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp );
-      handler->SendWheelEvent( wheelEvent );
-    }
-    return ECORE_CALLBACK_PASS_ON;
-  }
-
-  /**
    * Called when a touch motion is received.
    */
   static Eina_Bool EcoreEventMouseButtonMove( void* data, int type, void* event )
@@ -443,6 +479,12 @@ struct EventHandler::Impl
 
     if ( touchEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
     {
+      DevelDevice::Class::Type deviceClass;
+      DevelDevice::Subclass::Type deviceSubclass;
+
+      GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass );
+      GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass );
+
       Integration::Point point;
       point.SetDeviceId( touchEvent->multi.device );
       point.SetState( PointState::MOTION );
@@ -450,12 +492,55 @@ struct EventHandler::Impl
       point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) );
       point.SetPressure( touchEvent->multi.pressure );
       point.SetAngle( Degree( touchEvent->multi.angle ) );
+      point.SetDeviceClass( deviceClass );
+      point.SetDeviceSubclass( deviceSubclass );
+
+      handler->SendEvent( point, touchEvent->timestamp );
+    }
+
+    return ECORE_CALLBACK_PASS_ON;
+  }
+
+  /**
+   * Called when a touch is canceled.
+   */
+  static Eina_Bool EcoreEventMouseButtonCancel( void* data, int type, void* event )
+  {
+    Ecore_Event_Mouse_Button *touchEvent( (Ecore_Event_Mouse_Button*)event );
+    EventHandler* handler( (EventHandler*)data );
+
+    if( touchEvent->window == (unsigned int)ecore_wl_window_id_get( handler->mImpl->mWindow ) )
+    {
+      Integration::Point point;
+      point.SetDeviceId( touchEvent->multi.device );
+      point.SetState( PointState::INTERRUPTED );
+      point.SetScreenPosition( Vector2( 0.0f, 0.0f ) );
       handler->SendEvent( point, touchEvent->timestamp );
+
+      DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT EcoreEventMouseButtonCancel\n" );
     }
 
     return ECORE_CALLBACK_PASS_ON;
   }
 
+  /**
+   * Called when a mouse wheel is received.
+   */
+  static Eina_Bool EcoreEventMouseWheel( void* data, int type, void* event )
+  {
+    Ecore_Event_Mouse_Wheel *mouseWheelEvent( (Ecore_Event_Mouse_Wheel*)event );
+
+    DALI_LOG_INFO( gImfLogging, Debug::General, "EVENT Ecore_Event_Mouse_Wheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent->direction, mouseWheelEvent->modifiers, mouseWheelEvent->x, mouseWheelEvent->y, mouseWheelEvent->z);
+
+    EventHandler* handler( (EventHandler*)data );
+    if ( mouseWheelEvent->window == (unsigned int)ecore_wl_window_id_get(handler->mImpl->mWindow) )
+    {
+      WheelEvent wheelEvent( WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp );
+      handler->SendWheelEvent( wheelEvent );
+    }
+    return ECORE_CALLBACK_PASS_ON;
+  }
+
   /////////////////////////////////////////////////////////////////////////////////////////////////
   // Key Callbacks
   /////////////////////////////////////////////////////////////////////////////////////////////////
@@ -492,10 +577,27 @@ struct EventHandler::Impl
         ecoreKeyDownEvent.timestamp = keyEvent->timestamp;
         ecoreKeyDownEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
         ecoreKeyDownEvent.locks     = (Ecore_IMF_Keyboard_Locks) ECORE_IMF_KEYBOARD_LOCK_NONE;
-
-        eventHandled = ecore_imf_context_filter_event( imfContext,
-                                                       ECORE_IMF_EVENT_KEY_DOWN,
-                                                       (Ecore_IMF_Event *) &ecoreKeyDownEvent );
+        ecoreKeyDownEvent.dev_name  = "";
+        ecoreKeyDownEvent.dev_class = ECORE_IMF_DEVICE_CLASS_KEYBOARD;
+        ecoreKeyDownEvent.dev_subclass = ECORE_IMF_DEVICE_SUBCLASS_NONE;
+
+        std::string checkDevice;
+        GetDeviceName( keyEvent, checkDevice );
+
+        // If the device is IME and the focused key is the direction keys, then we should send a key event to move a key cursor.
+        if( ( checkDevice == "ime" ) && ( ( !strncmp( keyEvent->keyname, "Left",  4 ) ) ||
+                                          ( !strncmp( keyEvent->keyname, "Right", 5 ) ) ||
+                                          ( !strncmp( keyEvent->keyname, "Up",    2 ) ) ||
+                                          ( !strncmp( keyEvent->keyname, "Down",  4 ) ) ) )
+        {
+          eventHandled = 0;
+        }
+        else
+        {
+          eventHandled = ecore_imf_context_filter_event( imfContext,
+                                                         ECORE_IMF_EVENT_KEY_DOWN,
+                                                         (Ecore_IMF_Event *) &ecoreKeyDownEvent );
+        }
 
         // If the event has not been handled by IMF then check if we should reset our IMF context
         if( !eventHandled )
@@ -530,7 +632,17 @@ struct EventHandler::Impl
           keyString = keyEvent->string;
         }
 
-        KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, KeyEvent::Down);
+        std::string deviceName;
+        DevelDevice::Class::Type deviceClass;
+        DevelDevice::Subclass::Type deviceSubclass;
+
+        GetDeviceName( keyEvent, deviceName );
+        GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
+        GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
+
+        DALI_LOG_INFO( gImfLogging, Debug::Verbose, "EVENT EcoreEventKeyDown - >>EcoreEventKeyDown deviceName(%s) deviceClass(%d)\n", deviceName.c_str(), deviceClass );
+
+        Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, deviceName, deviceClass, deviceSubclass );
         handler->SendEvent( keyEvent );
       }
     }
@@ -570,6 +682,9 @@ struct EventHandler::Impl
         ecoreKeyUpEvent.timestamp = keyEvent->timestamp;
         ecoreKeyUpEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
         ecoreKeyUpEvent.locks     = (Ecore_IMF_Keyboard_Locks) ECORE_IMF_KEYBOARD_LOCK_NONE;
+        ecoreKeyUpEvent.dev_name  = "";
+        ecoreKeyUpEvent.dev_class = ECORE_IMF_DEVICE_CLASS_KEYBOARD;
+        ecoreKeyUpEvent.dev_subclass = ECORE_IMF_DEVICE_SUBCLASS_NONE;
 
         eventHandled = ecore_imf_context_filter_event( imfContext,
                                                        ECORE_IMF_EVENT_KEY_UP,
@@ -597,7 +712,15 @@ struct EventHandler::Impl
           keyString = keyEvent->string;
         }
 
-        KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, KeyEvent::Up);
+        std::string deviceName;
+        DevelDevice::Class::Type deviceClass;
+        DevelDevice::Subclass::Type deviceSubclass;
+
+        GetDeviceName( keyEvent, deviceName );
+        GetDeviceClass( ecore_device_class_get( keyEvent->dev ), deviceClass );
+        GetDeviceSubclass( ecore_device_subclass_get( keyEvent->dev ), deviceSubclass );
+
+        Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, deviceName, deviceClass, deviceSubclass );
         handler->SendEvent( keyEvent );
       }
     }
@@ -787,129 +910,43 @@ struct EventHandler::Impl
       return;
     }
 
-    if ( !handler->mAccessibilityAdaptor )
+    if( !handler->mAccessibilityAdaptor )
     {
       DALI_LOG_ERROR( "Invalid accessibility adaptor\n" );
       return;
     }
 
     AccessibilityAdaptor* accessibilityAdaptor( &AccessibilityAdaptor::GetImplementation( handler->mAccessibilityAdaptor ) );
-    if ( !accessibilityAdaptor )
+    if( !accessibilityAdaptor )
     {
       DALI_LOG_ERROR( "Cannot access accessibility adaptor\n" );
       return;
     }
 
-    const char *gestureName;
+    int gestureValue;
     int xS, yS, xE, yE;
-    unsigned int state;
+    int state; // 0 - begin, 1 - ongoing, 2 - ended, 3 - aborted
+    int eventTime;
 
     // The string defines the arg-list's respective types.
-    if( !eldbus_message_arguments_get( message, "siiiiu", &gestureName, &xS, &yS, &xE, &yE, &state ) )
+    if( !eldbus_message_arguments_get( message, "iiiiiiu", &gestureValue, &xS, &yS, &xE, &yE, &state, &eventTime ) )
     {
       DALI_LOG_ERROR( "OnEcoreElDBusAccessibilityNotification: Error getting arguments\n" );
     }
 
-    DALI_LOG_INFO( gImfLogging, Debug::General, "Got gesture: Name: %s  Args: %d,%d,%d,%d  State: %d\n", gestureName, xS, yS, xE, yE );
-
-    unsigned int fingers = 0;
-    char* stringPosition = ( char* )gestureName;
-
-    // Check how many fingers the gesture uses.
-    for( unsigned int i = 0; i < FingerCountStringsTotal; ++i )
-    {
-      unsigned int matchLength = strlen( ElDBusAccessibilityFingerCountStrings[ i ] );
-      if( strncmp( gestureName, ElDBusAccessibilityFingerCountStrings[ i ], matchLength ) == 0 )
-      {
-        fingers = i + 1;
-        stringPosition += matchLength;
-        break;
-      }
-    }
-
-    if( fingers == 0 )
-    {
-      // Error: invalid gesture.
-      return;
-    }
-
-    GestureType gestureType = GESTURE_TYPE_NONE;
-    SubGestureType subGestureType = SUB_GESTURE_TYPE_NONE;
-    GestureDirection direction = GESTURE_DIRECTION_NONE;
-
-    // Check for full gesture type names first.
-    for( unsigned int i = 0; i < FullEventTypeStringsTotal; ++i )
-    {
-      unsigned int matchLength = strlen( ElDBusAccessibilityFullEventTypeStrings[ i ].name );
-      if( strncmp( stringPosition, ElDBusAccessibilityFullEventTypeStrings[ i ].name, matchLength ) == 0 )
-      {
-        gestureType = ElDBusAccessibilityFullEventTypeStrings[ i ].type;
-        break;
-      }
-    }
-
-    // If we didn't find a full gesture, check for sub gesture type names.
-    if( gestureType == GESTURE_TYPE_NONE )
-    {
-      // No full gesture name found, look for partial types.
-      for( unsigned int i = 0; i < DirectionalEventTypeStringsTotal; ++i )
-      {
-        unsigned int matchLength = strlen( ElDBusAccessibilityDirectionalEventTypeStrings[ i ].name );
-        if( strncmp( stringPosition, ElDBusAccessibilityDirectionalEventTypeStrings[ i ].name, matchLength ) == 0 )
-        {
-          subGestureType = ElDBusAccessibilityDirectionalEventTypeStrings[ i ].type;
-          stringPosition += matchLength;
-        break;
-        }
-      }
-
-      if( subGestureType == SUB_GESTURE_TYPE_NONE )
-      {
-        // ERROR: Gesture not recognised.
-        return;
-      }
-
-      // If the gesture was a sub type, get it's respective direction.
-      for( unsigned int i = 0; i < DirectionStringsTotal; ++i )
-      {
-        unsigned int matchLength = strlen( ElDBusAccessibilityDirectionStrings[ i ].name );
-        if( strncmp( stringPosition, ElDBusAccessibilityDirectionStrings[ i ].name, matchLength ) == 0 )
-        {
-          direction = ElDBusAccessibilityDirectionStrings[ i ].direction;
-          stringPosition += matchLength;
-          break;
-        }
-      }
-
-      if( direction == GESTURE_DIRECTION_NONE )
-      {
-        // ERROR: Gesture not recognised.
-        return;
-      }
-    }
-
-    // Action the detected gesture here.
-    if( gestureType != GESTURE_TYPE_NONE )
-    {
-      DALI_LOG_INFO( gImfLogging, Debug::General, "Got gesture: Fingers: %d  Gesture type: %d\n", fingers, gestureType );
-    }
-    else
-    {
-      DALI_LOG_INFO( gImfLogging, Debug::General, "Got gesture: Fingers: %d  Gesture sub type: %d Gesture direction: %d\n",
-        fingers, subGestureType, direction );
-    }
+    DALI_LOG_INFO( gImfLogging, Debug::General, "Got gesture: Name: %d  Args: %d,%d,%d,%d  State: %d\n", gestureValue, xS, yS, xE, yE );
 
     // Create a touch point object.
     TouchPoint::State touchPointState( TouchPoint::Down );
-    if ( state == 0 )
+    if( state == 0 )
     {
       touchPointState = TouchPoint::Down; // Mouse down.
     }
-    else if ( state == 1 )
+    else if( state == 1 )
     {
       touchPointState = TouchPoint::Motion; // Mouse move.
     }
-    else if ( state == 2 )
+    else if( state == 2 )
     {
       touchPointState = TouchPoint::Up; // Mouse up.
     }
@@ -922,169 +959,243 @@ struct EventHandler::Impl
     TouchPoint point( 0, touchPointState, (float)xS, (float)yS );
 
     // Perform actions based on received gestures.
-    // Note: This is seperated from the reading so we can (in future)
-    // have other input readers without changing the below code.
-    switch( fingers )
+    // Note: This is seperated from the reading so we can have other input readers without changing the below code.
+    switch( gestureValue )
     {
-      case 1:
+      case 0: // OneFingerHover
       {
-        if( gestureType == GESTURE_TYPE_SINGLE_TAP || ( gestureType == GESTURE_TYPE_HOVER && touchPointState == TouchPoint::Motion ) )
-        {
-          // Focus, read out.
-          accessibilityAdaptor->HandleActionReadEvent( (unsigned int)xS, (unsigned int)yS, true /* allow read again */ );
-        }
-        else if( gestureType == GESTURE_TYPE_DOUBLE_TAP )
-        {
-          if( false ) // TODO: how to detect double tap + hold
-          {
-            // Move or drag icon / view more options for selected items.
-            // accessibilityAdaptor->HandleActionTouchEvent( point, GetCurrentMilliSeconds() );
-          }
-          else
-          {
-            // Activate selected item / active edit mode.
-            accessibilityAdaptor->HandleActionActivateEvent();
-          }
-        }
-        else if( gestureType == GESTURE_TYPE_TRIPLE_TAP )
-        {
-          // Zoom
-          accessibilityAdaptor->HandleActionZoomEvent();
-        }
-        else if( subGestureType == SUB_GESTURE_TYPE_FLICK )
-        {
-          if( direction == GESTURE_DIRECTION_LEFT )
-          {
-            // Move to previous item.
-            accessibilityAdaptor->HandleActionReadPreviousEvent();
-          }
-          else if( direction == GESTURE_DIRECTION_RIGHT )
-          {
-            // Move to next item.
-            accessibilityAdaptor->HandleActionReadNextEvent();
-          }
-          else if( direction == GESTURE_DIRECTION_UP )
-          {
-            // Move to next item.
-            accessibilityAdaptor->HandleActionPreviousEvent();
-          }
-          else if( direction == GESTURE_DIRECTION_DOWN )
-          {
-            // Move to next item.
-            accessibilityAdaptor->HandleActionNextEvent();
-          }
-          else if( direction == GESTURE_DIRECTION_LEFT_RETURN )
-          {
-            // Scroll up to the previous page
-            accessibilityAdaptor->HandleActionPageUpEvent();
-          }
-          else if( direction == GESTURE_DIRECTION_RIGHT_RETURN )
-          {
-            // Scroll down to the next page
-            accessibilityAdaptor->HandleActionPageDownEvent();
-          }
-          else if( direction == GESTURE_DIRECTION_UP_RETURN )
-          {
-            // Move to the first item on screen
-            accessibilityAdaptor->HandleActionMoveToFirstEvent();
-          }
-          else if( direction == GESTURE_DIRECTION_DOWN_RETURN )
-          {
-            // Move to the last item on screen
-            accessibilityAdaptor->HandleActionMoveToLastEvent();
-          }
-        }
+        // Focus, read out.
+        accessibilityAdaptor->HandleActionReadEvent( (unsigned int)xS, (unsigned int)yS, true /* allow read again */ );
         break;
       }
-
-      case 2:
+      case 1: // TwoFingersHover
       {
-        if( gestureType == GESTURE_TYPE_HOVER )
-        {
-          // In accessibility mode, scroll action should be handled when the currently focused actor is contained in scrollable control
-          accessibilityAdaptor->HandleActionScrollEvent( point, GetCurrentMilliSeconds() );
-        }
-        else if( gestureType == GESTURE_TYPE_SINGLE_TAP )
-        {
-          // Pause/Resume current speech
-          accessibilityAdaptor->HandleActionReadPauseResumeEvent();
-        }
-        else if( gestureType == GESTURE_TYPE_DOUBLE_TAP )
-        {
-          // Start/Stop current action
-          accessibilityAdaptor->HandleActionStartStopEvent();
-        }
-        else if( gestureType == GESTURE_TYPE_TRIPLE_TAP )
-        {
-          // Read information from indicator
-          accessibilityAdaptor->HandleActionReadIndicatorInformationEvent();
-        }
-        else if( subGestureType == SUB_GESTURE_TYPE_FLICK )
-        {
-          if( direction == GESTURE_DIRECTION_LEFT )
-          {
-            // Scroll left to the previous page
-            accessibilityAdaptor->HandleActionPageLeftEvent();
-          }
-          else if( direction == GESTURE_DIRECTION_RIGHT )
-          {
-            // Scroll right to the next page
-            accessibilityAdaptor->HandleActionPageRightEvent();
-          }
-          else if( direction == GESTURE_DIRECTION_UP )
-          {
-            // Scroll up the list.
-            accessibilityAdaptor->HandleActionScrollUpEvent();
-          }
-          else if( direction == GESTURE_DIRECTION_DOWN )
-          {
-            // Scroll down the list.
-            accessibilityAdaptor->HandleActionScrollDownEvent();
-          }
-        }
+        // In accessibility mode, scroll action should be handled when the currently focused actor is contained in scrollable control
+        accessibilityAdaptor->HandleActionScrollEvent( point, GetCurrentMilliSeconds() );
         break;
       }
-
-      case 3:
+      case 2: // ThreeFingersHover
       {
-        if( gestureType == GESTURE_TYPE_SINGLE_TAP )
-        {
-          // Read from top item on screen continuously.
-          accessibilityAdaptor->HandleActionReadFromTopEvent();
-        }
-        else if( gestureType == GESTURE_TYPE_DOUBLE_TAP )
-        {
-          // Read from next item continuously.
-          accessibilityAdaptor->HandleActionReadFromNextEvent();
-        }
+        // Read from top item on screen continuously.
+        accessibilityAdaptor->HandleActionReadFromTopEvent();
+        break;
+      }
+      case 3: // OneFingerFlickLeft
+      {
+        // Move to previous item.
+        accessibilityAdaptor->HandleActionReadPreviousEvent();
+        break;
+      }
+      case 4: // OneFingerFlickRight
+      {
+        // Move to next item.
+        accessibilityAdaptor->HandleActionReadNextEvent();
+        break;
+      }
+      case 5: // OneFingerFlickUp
+      {
+        // Move to previous item.
+        accessibilityAdaptor->HandleActionPreviousEvent();
+        break;
+      }
+      case 6: // OneFingerFlickDown
+      {
+        // Move to next item.
+        accessibilityAdaptor->HandleActionNextEvent();
+        break;
+      }
+      case 7: // TwoFingersFlickUp
+      {
+        // Scroll up the list.
+        accessibilityAdaptor->HandleActionScrollUpEvent();
+        break;
+      }
+      case 8: // TwoFingersFlickDown
+      {
+        // Scroll down the list.
+        accessibilityAdaptor->HandleActionScrollDownEvent();
+        break;
+      }
+      case 9: // TwoFingersFlickLeft
+      {
+        // Scroll left to the previous page
+        accessibilityAdaptor->HandleActionPageLeftEvent();
+        break;
+      }
+      case 10: // TwoFingersFlickRight
+      {
+        // Scroll right to the next page
+        accessibilityAdaptor->HandleActionPageRightEvent();
+        break;
+      }
+      case 11: // ThreeFingersFlickLeft
+      {
+        // Not exist yet
+        break;
+      }
+      case 12: // ThreeFingersFlickRight
+      {
+        // Not exist yet
+        break;
+      }
+      case 13: // ThreeFingersFlickUp
+      {
+        // Not exist yet
+        break;
+      }
+      case 14: // ThreeFingersFlickDown
+      {
+        // Not exist yet
+        break;
+      }
+      case 15: // OneFingerSingleTap
+      {
+        // Focus, read out.
+        accessibilityAdaptor->HandleActionReadEvent( (unsigned int)xS, (unsigned int)yS, true /* allow read again */ );
+        break;
+      }
+      case 16: // OneFingerDoubleTap
+      {
+        // Activate selected item / active edit mode.
+        accessibilityAdaptor->HandleActionActivateEvent();
+        break;
+      }
+      case 17: // OneFingerTripleTap
+      {
+        // Zoom
+        accessibilityAdaptor->HandleActionZoomEvent();
+        break;
+      }
+      case 18: // TwoFingersSingleTap
+      {
+        // Pause/Resume current speech
+        accessibilityAdaptor->HandleActionReadPauseResumeEvent();
+        break;
+      }
+      case 19: // TwoFingersDoubleTap
+      {
+        // Start/Stop current action
+        accessibilityAdaptor->HandleActionStartStopEvent();
+        break;
+      }
+      case 20: // TwoFingersTripleTap
+      {
+        // Read information from indicator
+        accessibilityAdaptor->HandleActionReadIndicatorInformationEvent();
+        break;
+      }
+      case 21: // ThreeFingersSingleTap
+      {
+        // Read from top item on screen continuously.
+        accessibilityAdaptor->HandleActionReadFromTopEvent();
+        break;
+      }
+      case 22: // ThreeFingersDoubleTap
+      {
+        // Read from next item continuously.
+        accessibilityAdaptor->HandleActionReadFromNextEvent();
+        break;
+      }
+      case 23: // ThreeFingersTripleTap
+      {
+        // Not exist yet
+        break;
+      }
+      case 24: // OneFingerFlickLeftReturn
+      {
+        // Scroll up to the previous page
+        accessibilityAdaptor->HandleActionPageUpEvent();
+        break;
+      }
+      case 25: // OneFingerFlickRightReturn
+      {
+        // Scroll down to the next page
+        accessibilityAdaptor->HandleActionPageDownEvent();
+        break;
+      }
+      case 26: // OneFingerFlickUpReturn
+      {
+        // Move to the first item on screen
+        accessibilityAdaptor->HandleActionMoveToFirstEvent();
+        break;
+      }
+      case 27: // OneFingerFlickDownReturn
+      {
+        // Move to the last item on screen
+        accessibilityAdaptor->HandleActionMoveToLastEvent();
+        break;
+      }
+      case 28: // TwoFingersFlickLeftReturn
+      {
+        // Not exist yet
+        break;
+      }
+      case 29: // TwoFingersFlickRightReturn
+      {
+        // Not exist yet
+        break;
+      }
+      case 30: // TwoFingersFlickUpReturn
+      {
+        // Not exist yet
+        break;
+      }
+      case 31: // TwoFingersFlickDownReturn
+      {
+        // Not exist yet
+        break;
+      }
+      case 32: // ThreeFingersFlickLeftReturn
+      {
+        // Not exist yet
+        break;
+      }
+      case 33: // ThreeFingersFlickRightReturn
+      {
+        // Not exist yet
+        break;
+      }
+      case 34: // ThreeFingersFlickUpReturn
+      {
+        // Not exist yet
+        break;
+      }
+      case 35: // ThreeFingersFlickDownReturn
+      {
+        // Not exist yet
         break;
       }
     }
   }
 
-  // Callback for to set up Ecore ElDBus for accessibility callbacks.
-  static void EcoreElDBusInitialisation( void *handle, const Eldbus_Message *message, Eldbus_Pending *pending EINA_UNUSED )
+  void EcoreElDBusInitialisation( void *handle )
   {
     Eldbus_Object *object;
     Eldbus_Proxy *manager;
-    const char *a11yBusAddress = NULL;
-    EventHandler* handler = static_cast< EventHandler* >( handle );
 
-    // The string defines the arg-list's respective types.
-    if( !eldbus_message_arguments_get( message, "s", &a11yBusAddress ) )
+    if( !( mSystemConnection = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM) ) )
     {
-      DALI_LOG_ERROR( "EcoreElDBusInitialisation: Error getting arguments\n" );
+      DALI_LOG_ERROR( "Unable to get system bus\n" );
     }
 
-    DALI_LOG_INFO( gImfLogging, Debug::General, "Ecore ElDBus Accessibility address: %s\n", a11yBusAddress );
-
-    handler->mImpl->mA11yConnection = eldbus_address_connection_get( a11yBusAddress );
+    object = eldbus_object_get( mSystemConnection, BUS, PATH );
+    if( !object )
+    {
+      DALI_LOG_ERROR( "Getting object failed\n" );
+      return;
+    }
 
-    object = eldbus_object_get( handler->mImpl->mA11yConnection, BUS, PATH );
     manager = eldbus_proxy_get( object, INTERFACE );
+    if( !manager )
+    {
+      DALI_LOG_ERROR( "Getting proxy failed\n" );
+      return;
+    }
 
-    // Pass the callback data through to the signal handler.
-    eldbus_proxy_signal_handler_add( manager, SIGNAL, OnEcoreElDBusAccessibilityNotification, handle );
+    if( !eldbus_proxy_signal_handler_add( manager, "GestureDetected", OnEcoreElDBusAccessibilityNotification, handle ) )
+    {
+      DALI_LOG_ERROR( "No signal handler returned\n" );
+    }
   }
 #endif // DALI_ELDBUS_AVAILABLE
 
@@ -1151,6 +1262,41 @@ 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;
+
+    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;
+  }
+
+  /*
   * Called when detent event is recevied
   */
   static Eina_Bool EcoreEventDetent( void* data, int type, void* event )
@@ -1187,15 +1333,51 @@ struct EventHandler::Impl
     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* mSessionConnection;
-  Eldbus_Connection* mA11yConnection;
-#endif
+  Eldbus_Connection* mSystemConnection;
+#endif // DALI_ELDBUS_AVAILABLE
 };
 
 EventHandler::EventHandler( RenderSurface* surface, CoreEventInterface& coreEventInterface, GestureManager& gestureManager, DamageObserver& damageObserver, DragAndDropDetectorPtr dndDetector )
@@ -1240,12 +1422,14 @@ void EventHandler::SendEvent(Integration::Point& point, unsigned long timeStamp)
     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.deviceId, point.state, point.local.x, point.local.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)
@@ -1264,21 +1448,19 @@ void EventHandler::SendEvent(Integration::Point& point, unsigned long timeStamp)
   }
 }
 
-void EventHandler::SendEvent(KeyEvent& keyEvent)
+void EventHandler::SendEvent(Integration::KeyEvent& keyEvent)
 {
   Dali::PhysicalKeyboard physicalKeyboard = PhysicalKeyboard::Get();
   if ( physicalKeyboard )
   {
-    if ( ! KeyLookup::IsDeviceButton( keyEvent.keyPressedName.c_str() ) )
+    if ( ! KeyLookup::IsDeviceButton( keyEvent.keyName.c_str() ) )
     {
       GetImplementation( physicalKeyboard ).KeyReceived( keyEvent.time > 1 );
     }
   }
 
-  // Create KeyEvent and send to Core.
-  Integration::KeyEvent event(keyEvent.keyPressedName, keyEvent.keyPressed, keyEvent.keyCode,
-  keyEvent.keyModifier, keyEvent.time, static_cast<Integration::KeyEvent::State>(keyEvent.state));
-  mCoreEventInterface.QueueCoreEvent( event );
+  // Create send KeyEvent to Core.
+  mCoreEventInterface.QueueCoreEvent( keyEvent );
   mCoreEventInterface.ProcessCoreEvents();
 }
 
@@ -1305,16 +1487,18 @@ void EventHandler::SendRotationPrepareEvent( const RotationEvent& event )
 {
   if( mRotationObserver != NULL )
   {
+    mImpl->mRotationAngle = event.angle;
+    mImpl->mWindowWidth = event.width;
+    mImpl->mWindowHeight = event.height;
+
     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)
@@ -1330,7 +1514,8 @@ void EventHandler::FeedWheelEvent( WheelEvent& wheelEvent )
 
 void EventHandler::FeedKeyEvent( KeyEvent& event )
 {
-  SendEvent( event );
+  Integration::KeyEvent convertedEvent( event );
+  SendEvent( convertedEvent );
 }
 
 void EventHandler::FeedEvent( Integration::Event& event )
@@ -1384,3 +1569,5 @@ void EventHandler::SetRotationObserver( RotationObserver* observer )
 } // namespace Internal
 
 } // namespace Dali
+
+#pragma GCC diagnostic pop