[5.0] Add GetLogicalKey API in DevelKeyEvent 99/201199/1 accepted/tizen/5.0/unified/20190315.061321 submit/tizen_5.0/20190312.070039
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Mon, 11 Mar 2019 06:04:43 +0000 (15:04 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Mon, 11 Mar 2019 08:35:14 +0000 (17:35 +0900)
- Added GetLogicalKey API to get the logical key.
 (eg. '1' key of NumberPad -> logicalKey : "KP_1")

Change-Id: I1f0424d31646c310a1471f745e5172c8e9cdbbf1
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
automated-tests/src/dali/utc-Dali-KeyEvent.cpp
dali/devel-api/CMakeLists.txt
dali/devel-api/events/key-event-devel.cpp [new file with mode: 0644]
dali/devel-api/events/key-event-devel.h [new file with mode: 0644]
dali/devel-api/file.list
dali/integration-api/events/key-event-integ.cpp
dali/integration-api/events/key-event-integ.h
dali/internal/event/events/key-event-impl.cpp
dali/internal/event/events/key-event-impl.h
dali/internal/event/events/key-event-processor.cpp

index d147104..e2de6e5 100755 (executable)
@@ -295,7 +295,7 @@ int UtcDaliIntegrationKeyEvent(void)
     Integration::KeyEvent keyEvent;
     DALI_TEST_EQUALS( keyEvent.type, Integration::Event::Key, TEST_LOCATION );
     DALI_TEST_CHECK( keyEvent.keyName == std::string() );
-    DALI_TEST_CHECK( keyEvent.key == std::string() );
+    DALI_TEST_CHECK( keyEvent.logicalKey == std::string() );
     DALI_TEST_CHECK( keyEvent.keyString == std::string() );
     DALI_TEST_EQUALS( keyEvent.keyCode, -1, TEST_LOCATION );
     DALI_TEST_EQUALS( keyEvent.keyModifier, 0, TEST_LOCATION );
@@ -305,7 +305,7 @@ int UtcDaliIntegrationKeyEvent(void)
 
   {
     const std::string keyName("keyName");
-    const std::string key("key");
+    const std::string logicalKey("logicalKey");
     const std::string keyString("keyString");
     const int keyCode(333);
     const int keyModifier(312);
@@ -316,10 +316,10 @@ int UtcDaliIntegrationKeyEvent(void)
     const Device::Class::Type deviceClass = Device::Class::KEYBOARD;
     const Device::Subclass::Type deviceSubclass = Device::Subclass::NONE;
 
-    Integration::KeyEvent keyEvent(keyName, key, keyString, keyCode, keyModifier, timeStamp, keyState, compose, deviceName, deviceClass, deviceSubclass );
+    Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, keyModifier, timeStamp, keyState, compose, deviceName, deviceClass, deviceSubclass );
     DALI_TEST_EQUALS( keyEvent.type, Integration::Event::Key, TEST_LOCATION );
     DALI_TEST_CHECK( keyEvent.keyName == keyName );
-    DALI_TEST_CHECK( keyEvent.key == key );
+    DALI_TEST_CHECK( keyEvent.logicalKey == logicalKey );
     DALI_TEST_CHECK( keyEvent.keyString == keyString );
     DALI_TEST_EQUALS( keyEvent.keyCode, keyCode, TEST_LOCATION );
     DALI_TEST_EQUALS( keyEvent.keyModifier, keyModifier, TEST_LOCATION );
@@ -343,7 +343,7 @@ int UtcDaliIntegrationKeyEventConvertor(void)
 
   DALI_TEST_EQUALS( keyEvent.type, Integration::Event::Key, TEST_LOCATION );
   DALI_TEST_CHECK( keyEvent.keyName == TEST_STRING_1 );
-  DALI_TEST_CHECK( keyEvent.key == "" );
+  DALI_TEST_CHECK( keyEvent.logicalKey == "" );
   DALI_TEST_CHECK( keyEvent.keyString == "i" );
   DALI_TEST_EQUALS( keyEvent.keyCode, 99, TEST_LOCATION );
   DALI_TEST_EQUALS( keyEvent.keyModifier, SHIFT_MODIFIER, TEST_LOCATION );
index 3823731..857ab6e 100644 (file)
@@ -8,6 +8,7 @@ SET( SOURCES ${SOURCES}
   ${CMAKE_CURRENT_SOURCE_DIR}/common/hash.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/common/stage-devel.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/events/hit-test-algorithm.cpp
+  ${CMAKE_CURRENT_SOURCE_DIR}/events/key-event-devel.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/events/touch-data-devel.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/images/distance-field.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/images/texture-set-image.cpp
@@ -43,6 +44,7 @@ SET( DEVEL_API_HEADERS
   ${CMAKE_CURRENT_SOURCE_DIR}/common/stage-devel.h
 
   ${CMAKE_CURRENT_SOURCE_DIR}/events/hit-test-algorithm.h
+  ${CMAKE_CURRENT_SOURCE_DIR}/events/key-event-devel.h
   ${CMAKE_CURRENT_SOURCE_DIR}/events/touch-data-devel.h
   ${CMAKE_CURRENT_SOURCE_DIR}/events/mouse-button.h
 
diff --git a/dali/devel-api/events/key-event-devel.cpp b/dali/devel-api/events/key-event-devel.cpp
new file mode 100644 (file)
index 0000000..502404e
--- /dev/null
@@ -0,0 +1,36 @@
+/*\r
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+// INTERNAL INCLUDES\r
+#include <dali/devel-api/events/key-event-devel.h>\r
+#include <dali/internal/event/events/key-event-impl.h>\r
+\r
+namespace Dali\r
+{\r
+\r
+namespace DevelKeyEvent\r
+{\r
+\r
+std::string GetLogicalKey( KeyEvent keyEvent )\r
+{\r
+  return GetImplementation( &keyEvent )->GetLogicalKey();\r
+}\r
+\r
+} // namespace DevelKeyEvent\r
+\r
+} // namespace Dali\r
+\r
diff --git a/dali/devel-api/events/key-event-devel.h b/dali/devel-api/events/key-event-devel.h
new file mode 100644 (file)
index 0000000..bdf1680
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef DALI_KEY_EVENT_DEVEL_H\r
+#define DALI_KEY_EVENT_DEVEL_H\r
+\r
+/*\r
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+// INTERNAL INCLUDES\r
+#include <dali/public-api/events/key-event.h>\r
+\r
+namespace Dali\r
+{\r
+\r
+namespace DevelKeyEvent\r
+{\r
+\r
+/**\r
+ * @brief Gets the logical key string.\r
+ *\r
+ * For example, when the user presses 'shift' key and '1' key together, the logical key is "exclamation".\r
+ * Plus, the keyPressedName is "1", and the keyPressed is "!".\r
+ *\r
+ * @param[in] keyEvent The instance of KeyEvent.\r
+ * @return The logical key symbol\r
+ */\r
+DALI_CORE_API std::string GetLogicalKey( KeyEvent keyEvent );\r
+\r
+} // namespace DevelKeyEvent\r
+\r
+} // namespace Dali\r
+\r
+#endif // DALI_KEY_EVENT_DEVEL_H\r
index fb9fd42..d64f4cb 100644 (file)
@@ -8,6 +8,7 @@ devel_api_src_files = \
   $(devel_api_src_dir)/common/hash.cpp \
   $(devel_api_src_dir)/common/stage-devel.cpp \
   $(devel_api_src_dir)/events/hit-test-algorithm.cpp \
+  $(devel_api_src_dir)/events/key-event-devel.cpp \
   ${devel_api_src_dir}/events/touch-data-devel.cpp \
   $(devel_api_src_dir)/images/distance-field.cpp \
   $(devel_api_src_dir)/images/texture-set-image.cpp \
@@ -47,6 +48,7 @@ devel_api_core_common_header_files = \
 
 devel_api_core_events_header_files = \
   $(devel_api_src_dir)/events/hit-test-algorithm.h \
+  $(devel_api_src_dir)/events/key-event-devel.h \
   ${devel_api_src_dir}/events/touch-data-devel.h \
   ${devel_api_src_dir}/events/mouse-button.h
 
index f8c6f7f..db7e1bc 100755 (executable)
@@ -30,7 +30,7 @@ namespace Integration
 KeyEvent::KeyEvent()
 : Event( Key ),
   keyName(),
-  key(),
+  logicalKey(),
   keyString(),
   keyCode( -1 ),
   keyModifier( 0 ),
@@ -43,12 +43,12 @@ KeyEvent::KeyEvent()
 {
 }
 
-KeyEvent::KeyEvent( const std::string& keyName, const std::string& key, const std::string& keyString, int keyCode, int keyModifier,
+KeyEvent::KeyEvent( const std::string& keyName, const std::string& logicalKey, const std::string& keyString, int keyCode, int keyModifier,
                     unsigned long timeStamp, const State& keyState, const std::string& compose, const std::string& deviceName,
                     const Device::Class::Type deviceClass, const Device::Subclass::Type deviceSubclass )
 : Event( Key ),
   keyName( keyName ),
-  key( key ),
+  logicalKey( logicalKey ),
   keyString( keyString ),
   keyCode( keyCode ),
   keyModifier( keyModifier ),
@@ -64,7 +64,7 @@ KeyEvent::KeyEvent( const std::string& keyName, const std::string& key, const st
 KeyEvent::KeyEvent( const Dali::KeyEvent& event )
 : Event( Key ),
   keyName( event.keyPressedName ),
-  key( "" ),
+  logicalKey( "" ),
   keyString( event.keyPressed ),
   keyCode( event.keyCode ),
   keyModifier( event.keyModifier ),
@@ -76,7 +76,7 @@ KeyEvent::KeyEvent( const Dali::KeyEvent& event )
   deviceSubclass( Device::Subclass::NONE )
 {
   const Internal::KeyEventImpl* keyEventImpl = GetImplementation( &event );
-  key = keyEventImpl->GetKey();
+  logicalKey = keyEventImpl->GetLogicalKey();
   compose = keyEventImpl->GetCompose();
   deviceName = keyEventImpl->GetDeviceName();
   deviceClass = keyEventImpl->GetDeviceClass();
index 64d6e02..52055e4 100755 (executable)
@@ -56,7 +56,7 @@ struct DALI_CORE_API KeyEvent : public Event
   /**
    * Constructor
    * @param[in]  keyName       The name of the key pressed or command from the IMF, if later then the some following parameters will be needed.
-   * @param[in]  key           The logical key symbol (eg. shift + 1 == "exclamation")
+   * @param[in]  logicalKey    The logical key symbol (eg. shift + 1 == "exclamation")
    * @param[in]  keyString     A string of input characters or key pressed
    * @param[in]  keyCode       The unique key code for the key pressed.
    * @param[in]  keyModifier   The key modifier for special keys like shift and alt
@@ -68,7 +68,7 @@ struct DALI_CORE_API KeyEvent : public Event
    * @param[in]  deviceSubclass  Subclass of device KeyEvent originated from
    */
   KeyEvent(const std::string& keyName,
-           const std::string& key,
+           const std::string& logicalKey,
            const std::string& keyString,
            int keyCode,
            int keyModifier,
@@ -100,7 +100,7 @@ struct DALI_CORE_API KeyEvent : public Event
   /**
    * The logical key symbol
    */
-  std::string key;
+  std::string logicalKey;
 
   /**
    *@copydoc Dali::KeyEvent::keyPressed
index 7e92231..8f0c84f 100755 (executable)
@@ -44,7 +44,7 @@ namespace Internal
 {
 
 KeyEventImpl::KeyEventImpl( KeyEvent* keyEvent )
-: mKey( "" ),
+: mLogicalKey( "" ),
   mCompose( "" ),
   mDeviceName( "" ),
   mDeviceClass( Device::Class::NONE ),
@@ -69,7 +69,7 @@ KeyEventImpl& KeyEventImpl::operator=( const KeyEventImpl& rhs )
 {
   if( this != &rhs )
   {
-    mKey = rhs.mKey;
+    mLogicalKey = rhs.mLogicalKey;
     mCompose = rhs.mCompose;
     mDeviceName = rhs.mDeviceName;
     mDeviceClass = rhs.mDeviceClass;
@@ -79,14 +79,14 @@ KeyEventImpl& KeyEventImpl::operator=( const KeyEventImpl& rhs )
   return *this;
 }
 
-std::string KeyEventImpl::GetKey() const
+std::string KeyEventImpl::GetLogicalKey() const
 {
-  return mKey;
+  return mLogicalKey;
 }
 
-void KeyEventImpl::SetKey( const std::string& key )
+void KeyEventImpl::SetLogicalKey( const std::string& logicalKey )
 {
-  mKey = key;
+  mLogicalKey = logicalKey;
 }
 
 std::string KeyEventImpl::GetCompose() const
index fe82467..1f581dc 100755 (executable)
@@ -52,13 +52,13 @@ public:
    * @brief Get the key symbol string.
    * @return The key symbol
    */
-  std::string GetKey() const;
+  std::string GetLogicalKey() const;
 
   /**
    * @brief Set the key symbol string to the KeyEvent.
    * @param[in] key The key symbol to set
    */
-  void SetKey( const std::string& key );
+  void SetLogicalKey( const std::string& logicalKey );
 
   /**
    * @brief Get the compose string.
@@ -128,7 +128,7 @@ private:
 
 private:
 
-  std::string mKey;
+  std::string mLogicalKey;
   std::string mCompose;
   std::string mDeviceName;
   Device::Class::Type mDeviceClass;
index 93ffaf6..750654b 100755 (executable)
@@ -44,7 +44,7 @@ void KeyEventProcessor::ProcessKeyEvent(const Integration::KeyEvent& event)
 {
   KeyEvent keyEvent(event.keyName, event.keyString, event.keyCode, event.keyModifier, event.time, static_cast<Dali::KeyEvent::State>(event.state));
 
-  GetImplementation( &keyEvent )->SetKey( event.key );
+  GetImplementation( &keyEvent )->SetLogicalKey( event.logicalKey );
   GetImplementation( &keyEvent )->SetCompose( event.compose );
   GetImplementation( &keyEvent )->SetDeviceName( event.deviceName );
   GetImplementation( &keyEvent )->SetDeviceClass( event.deviceClass );