From: Heeyong Song Date: Mon, 17 Apr 2017 08:49:07 +0000 (+0900) Subject: Device Class set in ecore wayland X-Git-Tag: dali_1.2.37~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F56%2F125456%2F3;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Device Class set in ecore wayland Change-Id: I9458ff8b42f6dd48aa1bb5e332534757f6c62096 --- diff --git a/adaptors/ecore/wayland/event-handler-ecore-wl.cpp b/adaptors/ecore/wayland/event-handler-ecore-wl.cpp index 9989810..0b9b3d2 100644 --- a/adaptors/ecore/wayland/event-handler-ecore-wl.cpp +++ b/adaptors/ecore/wayland/event-handler-ecore-wl.cpp @@ -44,6 +44,7 @@ #include #include #include +#include // INTERNAL INCLUDES #include @@ -180,6 +181,57 @@ void GetDeviceName( Ecore_Event_Key* keyEvent, std::string& result ) } } +/** + * Get the device class from the provided ecore key event + */ +void GetDeviceClass( Ecore_Event_Key* keyEvent, DevelKeyEvent::DeviceClass::Type& deviceClass ) +{ + Ecore_Device_Class ecoreDeviceClass = ecore_device_class_get( keyEvent->dev ); + + switch( ecoreDeviceClass ) + { + case ECORE_DEVICE_CLASS_SEAT: + { + deviceClass = DevelKeyEvent::DeviceClass::USER; + break; + } + case ECORE_DEVICE_CLASS_KEYBOARD: + { + deviceClass = DevelKeyEvent::DeviceClass::KEYBOARD; + break; + } + case ECORE_DEVICE_CLASS_MOUSE: + { + deviceClass = DevelKeyEvent::DeviceClass::MOUSE; + break; + } + case ECORE_DEVICE_CLASS_TOUCH: + { + deviceClass = DevelKeyEvent::DeviceClass::TOUCH; + break; + } + case ECORE_DEVICE_CLASS_PEN: + { + deviceClass = DevelKeyEvent::DeviceClass::PEN; + break; + } + case ECORE_DEVICE_CLASS_POINTER: + { + deviceClass = DevelKeyEvent::DeviceClass::POINTER; + break; + } + case ECORE_DEVICE_CLASS_GAMEPAD: + { + deviceClass = DevelKeyEvent::DeviceClass::GAMEPAD; + break; + } + default: + { + deviceClass = DevelKeyEvent::DeviceClass::NONE; + break; + } + } +} } // unnamed namespace @@ -454,11 +506,14 @@ struct EventHandler::Impl } std::string deviceName; + DevelKeyEvent::DeviceClass::Type deviceClass; + GetDeviceName( keyEvent, deviceName ); + GetDeviceClass( keyEvent, deviceClass ); - DALI_LOG_INFO( gImfLogging, Debug::Verbose, "EVENT EcoreEventKeyDown - >>EcoreEventKeyDown deviceName(%s)\n", deviceName.c_str() ); + 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 ); + Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, deviceName, deviceClass ); handler->SendEvent( keyEvent ); } } @@ -531,9 +586,12 @@ struct EventHandler::Impl } std::string deviceName; + DevelKeyEvent::DeviceClass::Type deviceClass; + GetDeviceName( keyEvent, deviceName ); + GetDeviceClass( keyEvent, deviceClass ); - Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, deviceName ); + Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, deviceName, deviceClass ); handler->SendEvent( keyEvent ); } } diff --git a/adaptors/x11/ecore-x-event-handler.cpp b/adaptors/x11/ecore-x-event-handler.cpp index f16d5c1..2d3ce7f 100644 --- a/adaptors/x11/ecore-x-event-handler.cpp +++ b/adaptors/x11/ecore-x-event-handler.cpp @@ -49,6 +49,7 @@ #include #include #include +#include // INTERNAL INCLUDES #include @@ -85,6 +86,8 @@ namespace const char * DETENT_DEVICE_NAME = "tizen_detent"; const std::string DEFAULT_DEVICE_NAME = ""; +const DevelKeyEvent::DeviceClass::Type DEFAULT_DEVICE_CLASS = DevelKeyEvent::DeviceClass::NONE; + // DBUS accessibility #define A11Y_BUS "org.a11y.Bus" #define A11Y_INTERFACE "org.a11y.Bus" @@ -707,7 +710,7 @@ struct EventHandler::Impl keyString = keyEvent->string; } - Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME ); + Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS ); handler->SendEvent( keyEvent ); } } @@ -774,7 +777,7 @@ struct EventHandler::Impl keyString = keyEvent->string; } - Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME ); + Integration::KeyEvent keyEvent(keyName, keyString, keyCode, modifier, time, Integration::KeyEvent::Up, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS ); handler->SendEvent( keyEvent ); }