Send Integration KeyEvents to Core
[platform/core/uifw/dali-adaptor.git] / adaptors / wayland / event-handler-wl.cpp
index 636de86..4ea2f35 100644 (file)
@@ -53,6 +53,13 @@ namespace Internal
 namespace Adaptor
 {
 
+#if defined(DEBUG_ENABLED)
+namespace
+{
+  Integration::Log::Filter* gTouchEventLogFilter  = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_TOUCH");
+} // unnamed namespace
+#endif
+
 struct EventHandler::Impl : public WindowEventInterface
 {
   // Construction & Destruction
@@ -72,11 +79,11 @@ struct EventHandler::Impl : public WindowEventInterface
   {
   }
   // @todo Consider allowing the EventHandler class to inherit from WindowEventInterface directly
-  virtual void TouchEvent( Dali::TouchPoint& point, unsigned long timeStamp )
+  virtual void TouchEvent( Dali::Integration::Point& point, unsigned long timeStamp )
   {
     mHandler->SendEvent( point, timeStamp );
   }
-  virtual void KeyEvent( Dali::KeyEvent& keyEvent )
+  virtual void KeyEvent( Integration::KeyEvent& keyEvent )
   {
     mHandler->SendEvent( keyEvent );
   }
@@ -114,7 +121,8 @@ EventHandler::EventHandler( RenderSurface* surface, CoreEventInterface& coreEven
   mDragAndDropDetector( dndDetector ),
   mClipboardEventNotifier( ClipboardEventNotifier::Get() ),
   mClipboard( Dali::Clipboard::Get()),
-  mImpl( NULL )
+  mImpl( NULL ),
+  mPaused( false )
 {
 
 
@@ -139,7 +147,7 @@ EventHandler::~EventHandler()
   mGestureManager.Stop();
 }
 
-void EventHandler::SendEvent(TouchPoint& point, unsigned long timeStamp)
+void EventHandler::SendEvent(Integration::Point& point, unsigned long timeStamp)
 {
 
   Integration::TouchEvent touchEvent;
@@ -147,7 +155,7 @@ void EventHandler::SendEvent(TouchPoint& point, unsigned long timeStamp)
   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.GetLocalPosition().x, point.GetLocalPosition().y);
 
     // First the touch and/or hover event & related gesture events are queued
     if(type == Integration::TouchEventCombiner::DispatchTouch || type == Integration::TouchEventCombiner::DispatchBoth)
@@ -166,21 +174,19 @@ void EventHandler::SendEvent(TouchPoint& 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();
 }
 
@@ -221,7 +227,8 @@ void EventHandler::SendRotationRequestEvent( )
 
 void EventHandler::FeedTouchPoint( TouchPoint& point, int timeStamp)
 {
-  SendEvent(point, timeStamp);
+  Integration::Point convertedPoint( point );
+  SendEvent(convertedPoint, timeStamp);
 }
 
 void EventHandler::FeedWheelEvent( WheelEvent& wheelEvent )
@@ -231,7 +238,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 )
@@ -246,7 +254,8 @@ void EventHandler::Reset()
 
   // Any touch listeners should be told of the interruption.
   Integration::TouchEvent event;
-  TouchPoint point(0, TouchPoint::Interrupted, 0, 0);
+  Integration::Point point;
+  point.SetState( PointState::INTERRUPTED );
   event.AddPoint( point );
 
   // First the touch event & related gesture events are queued