From 7813c373f03786489b2ffe5d802088f3f5879559 Mon Sep 17 00:00:00 2001 From: Agnelo Vaz Date: Mon, 10 Apr 2017 11:57:09 +0100 Subject: [PATCH] Send Integration KeyEvents to Core Currently the public key event is used in adaptor and send to core, instead should use Integration Requirement for device name functionality Change-Id: Ifa943408cd21a0e9309d7176cf9e01071588ae9e --- adaptors/base/interfaces/window-event-interface.h | 3 ++- adaptors/common/events/event-handler.h | 3 ++- adaptors/ecore/wayland/event-handler-ecore-wl.cpp | 18 ++++++++---------- adaptors/wayland/event-handler-wl.cpp | 15 +++++++-------- adaptors/wayland/input-manager.cpp | 5 ++++- adaptors/wayland/input-manager.h | 1 - adaptors/wayland/input/text/text-input-manager.cpp | 4 ++-- adaptors/x11/ecore-x-event-handler.cpp | 19 +++++++++---------- adaptors/x11/x-event-handler.cpp | 15 +++++++-------- adaptors/x11/x-events/x-input2.cpp | 11 ++++++++--- 10 files changed, 49 insertions(+), 45 deletions(-) diff --git a/adaptors/base/interfaces/window-event-interface.h b/adaptors/base/interfaces/window-event-interface.h index 92c9aa1..e8dc98d 100644 --- a/adaptors/base/interfaces/window-event-interface.h +++ b/adaptors/base/interfaces/window-event-interface.h @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include #include namespace Dali @@ -52,7 +53,7 @@ public: * @brief Key Event callback * @param[in] keyEvent key event */ - virtual void KeyEvent( Dali::KeyEvent& keyEvent ) = 0; + virtual void KeyEvent( Dali::Integration::KeyEvent& keyEvent ) = 0; /** * @brief Wheel Event callback diff --git a/adaptors/common/events/event-handler.h b/adaptors/common/events/event-handler.h index c7b7684..3b1caed 100644 --- a/adaptors/common/events/event-handler.h +++ b/adaptors/common/events/event-handler.h @@ -19,6 +19,7 @@ */ // EXTERNAL INCLUDES +#include #include #include #include @@ -130,7 +131,7 @@ private: * Send key event to core. * @param[in] keyEvent The KeyEvent to send. */ - void SendEvent(KeyEvent& keyEvent); + void SendEvent(Integration::KeyEvent& keyEvent); /** * Send wheel event to core. diff --git a/adaptors/ecore/wayland/event-handler-ecore-wl.cpp b/adaptors/ecore/wayland/event-handler-ecore-wl.cpp index f92fbdb..23ce4c2 100644 --- a/adaptors/ecore/wayland/event-handler-ecore-wl.cpp +++ b/adaptors/ecore/wayland/event-handler-ecore-wl.cpp @@ -439,7 +439,7 @@ struct EventHandler::Impl keyString = keyEvent->string; } - KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, KeyEvent::Down); + Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down ); handler->SendEvent( keyEvent ); } } @@ -510,8 +510,7 @@ struct EventHandler::Impl { keyString = keyEvent->string; } - - KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, KeyEvent::Up); + Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up ); handler->SendEvent( keyEvent ); } } @@ -1189,21 +1188,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(keyEvent.state)); - mCoreEventInterface.QueueCoreEvent( event ); + // Create send KeyEvent to Core. + mCoreEventInterface.QueueCoreEvent( keyEvent ); mCoreEventInterface.ProcessCoreEvents(); } @@ -1253,7 +1250,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 ) diff --git a/adaptors/wayland/event-handler-wl.cpp b/adaptors/wayland/event-handler-wl.cpp index b6a604e..4ea2f35 100644 --- a/adaptors/wayland/event-handler-wl.cpp +++ b/adaptors/wayland/event-handler-wl.cpp @@ -83,7 +83,7 @@ struct EventHandler::Impl : public WindowEventInterface { mHandler->SendEvent( point, timeStamp ); } - virtual void KeyEvent( Dali::KeyEvent& keyEvent ) + virtual void KeyEvent( Integration::KeyEvent& keyEvent ) { mHandler->SendEvent( keyEvent ); } @@ -174,21 +174,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(keyEvent.state)); - mCoreEventInterface.QueueCoreEvent( event ); + // Create send KeyEvent to Core. + mCoreEventInterface.QueueCoreEvent( keyEvent ); mCoreEventInterface.ProcessCoreEvents(); } @@ -240,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 ) diff --git a/adaptors/wayland/input-manager.cpp b/adaptors/wayland/input-manager.cpp index 6f90b32..c276a41 100644 --- a/adaptors/wayland/input-manager.cpp +++ b/adaptors/wayland/input-manager.cpp @@ -18,6 +18,9 @@ // CLASS HEADER #include "input-manager.h" +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include #include @@ -191,7 +194,7 @@ void InputManager::KeyFocusLeave( Seat* seat, unsigned int serial, WlSurface* su void InputManager::KeyEvent( Seat* seat, unsigned int serial, unsigned int timestamp, unsigned int keycode, unsigned int state ) { - Dali::KeyEvent keyEvent = seat->GetDALiKeyEvent( serial, timestamp, keycode, state ); + Integration::KeyEvent keyEvent( seat->GetDALiKeyEvent( serial, timestamp, keycode, state ) ); mWindowEventInterface->KeyEvent( keyEvent); diff --git a/adaptors/wayland/input-manager.h b/adaptors/wayland/input-manager.h index eb33fa4..0fc0b1f 100644 --- a/adaptors/wayland/input-manager.h +++ b/adaptors/wayland/input-manager.h @@ -20,7 +20,6 @@ // EXTERNAL INCLUDES #include -#include // INTERNAL INCLUDES #include diff --git a/adaptors/wayland/input/text/text-input-manager.cpp b/adaptors/wayland/input/text/text-input-manager.cpp index e6b31e9..7d1fb01 100644 --- a/adaptors/wayland/input/text/text-input-manager.cpp +++ b/adaptors/wayland/input/text/text-input-manager.cpp @@ -221,8 +221,8 @@ void TextInputManager::Keysym( Seat* seat, } - - mWindowEventInterface->KeyEvent( keyEvent ); + Integration::KeyEvent convertedEvent( keyEvent ); + mWindowEventInterface->KeyEvent( convertedEvent ); } void TextInputManager::Language( Seat* seat, uint32_t serial, const char *language ) diff --git a/adaptors/x11/ecore-x-event-handler.cpp b/adaptors/x11/ecore-x-event-handler.cpp index 38c64ac..db0cf03 100644 --- a/adaptors/x11/ecore-x-event-handler.cpp +++ b/adaptors/x11/ecore-x-event-handler.cpp @@ -707,7 +707,7 @@ struct EventHandler::Impl keyString = keyEvent->string; } - KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, KeyEvent::Down); + Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down ); handler->SendEvent( keyEvent ); } } @@ -774,9 +774,9 @@ struct EventHandler::Impl keyString = keyEvent->string; } - KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, KeyEvent::Up); - handler->SendEvent( keyEvent ); + Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up ); + handler->SendEvent( keyEvent ); } } @@ -1763,21 +1763,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(keyEvent.state)); - mCoreEventInterface.QueueCoreEvent( event ); + // Send to KeyEvent Core. + mCoreEventInterface.QueueCoreEvent( keyEvent ); mCoreEventInterface.ProcessCoreEvents(); } @@ -1830,7 +1828,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 ) diff --git a/adaptors/x11/x-event-handler.cpp b/adaptors/x11/x-event-handler.cpp index 0e73249..aa4a272 100644 --- a/adaptors/x11/x-event-handler.cpp +++ b/adaptors/x11/x-event-handler.cpp @@ -145,7 +145,7 @@ struct EventHandler::Impl : public WindowEventInterface { mHandler->SendEvent( point, timeStamp ); } - virtual void KeyEvent( Dali::KeyEvent& keyEvent ) + virtual void KeyEvent( Integration::KeyEvent& keyEvent ) { mHandler->SendEvent( keyEvent ); } @@ -239,21 +239,19 @@ void EventHandler::SendEvent(Dali::Integration::Point& point, unsigned long time } } -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(keyEvent.state)); - mCoreEventInterface.QueueCoreEvent( event ); + // Create send KeyEvent to Core. + mCoreEventInterface.QueueCoreEvent( keyEvent ); mCoreEventInterface.ProcessCoreEvents(); } @@ -305,7 +303,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 ) diff --git a/adaptors/x11/x-events/x-input2.cpp b/adaptors/x11/x-events/x-input2.cpp index e634331..747b558 100644 --- a/adaptors/x11/x-events/x-input2.cpp +++ b/adaptors/x11/x-events/x-input2.cpp @@ -123,7 +123,9 @@ void XInput2::ProcessKeyEvent( XKeyEvent* xEvent ) keyEvent.keyPressedName = keyname; keyEvent.time = xEvent->time; - mEventInterface->KeyEvent( keyEvent ); + Integration::KeyEvent convertedEvent( keyEvent ); + + mEventInterface->KeyEvent( convertedEvent ); } void XInput2::ProcessClientMessage( XEvent* event ) { @@ -163,7 +165,9 @@ void XInput2::ProcessClientMessage( XEvent* event ) keyEvent.keyPressedName = keyname; keyEvent.time = event->xclient.data.l[0]; - mEventInterface->KeyEvent( keyEvent ); + Integration::KeyEvent convertedEvent( keyEvent ); + + mEventInterface->KeyEvent( convertedEvent ); } } @@ -222,7 +226,8 @@ void XInput2::ProcessGenericEvent( XGenericEventCookie* cookie ) { KeyEvent keyEvent; CreateKeyEvent( deviceEvent, keyEvent ); - mEventInterface->KeyEvent( keyEvent ); + Integration::KeyEvent convertedEvent( keyEvent ); + mEventInterface->KeyEvent( convertedEvent ); break; } default: -- 2.7.4